source:
buchla-68k/libsm/strfill.c@
6262b5c
Last change on this file since 6262b5c was 6262b5c, checked in by , 7 years ago | |
---|---|
|
|
File size: 596 bytes |
Rev | Line | |
---|---|---|
[f40a309] | 1 | /* |
2 | ============================================================================= | |
3 | strfill() -- fill a string with a constant byte and zero terminate it | |
4 | Version 1 -- 1988-08-19 -- D.N. Lynx Crowe | |
5 | ||
6 | Where: | |
7 | s = string pointer | |
8 | c = constant byte | |
9 | n = string length (not including the trailing zero) | |
10 | ||
11 | Returns a pointer to the string. | |
12 | ============================================================================= | |
13 | */ | |
14 | ||
[6262b5c] | 15 | #include "all.h" |
16 | ||
[7258c6a] | 17 | int8_t *strfill(int8_t *s, int8_t c, uint16_t n) |
[f40a309] | 18 | { |
[7258c6a] | 19 | register uint16_t i; |
20 | int8_t *p; | |
[f40a309] | 21 | |
22 | p = s; | |
23 | ||
24 | for (i = n; i--; ) | |
25 | *s++ = c; | |
26 | ||
27 | *s = '\0'; | |
28 | return(p); | |
29 | } | |
30 |
Note:
See TracBrowser
for help on using the repository browser.