source:
buchla-68k/libsm/strltrm.c@
f806726
Last change on this file since f806726 was dade7a0, checked in by , 7 years ago | |
---|---|
|
|
File size: 543 bytes |
Rev | Line | |
---|---|---|
[f40a309] | 1 | /* |
2 | ============================================================================= | |
3 | strltrm() -- trim leading blanks from a string, in-place | |
4 | Version 1 -- 1988-08-19 -- D.N. Lynx Crowe | |
5 | ||
6 | Returns a pointer to the string. | |
7 | ============================================================================= | |
8 | */ | |
9 | ||
[b28a12e] | 10 | #include "ram.h" |
[f40a309] | 11 | |
[7258c6a] | 12 | int8_t *strltrm(int8_t *s) |
[f40a309] | 13 | { |
[7258c6a] | 14 | register int8_t c; |
15 | register int8_t *lp, *rp; | |
[f40a309] | 16 | |
17 | if (*s NE ' ') | |
18 | return(s); | |
19 | ||
20 | lp = s; | |
21 | rp = s; | |
22 | ||
23 | while (*rp EQ ' ') | |
24 | ++rp; | |
25 | ||
[dade7a0] | 26 | while ((c = *rp++)) |
[f40a309] | 27 | *lp++ = c; |
28 | ||
29 | *lp = '\0'; | |
30 | ||
31 | return(s); | |
32 | } | |
[6262b5c] | 33 |
Note:
See TracBrowser
for help on using the repository browser.