source:
buchla-68k/libsm/strrtrm.c@
8b685e0
| Last change on this file since 8b685e0 was b28a12e, checked in by , 8 years ago | |
|---|---|
|
|
| File size: 536 bytes | |
| Rev | Line | |
|---|---|---|
| [f40a309] | 1 | /* |
| 2 | ============================================================================= | |
| 3 | strrtrm() -- trim trailing 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 *strrtrm(int8_t *s) |
| [f40a309] | 13 | { |
| [7258c6a] | 14 | register int8_t *lp, *rp; |
| [f40a309] | 15 | |
| 16 | lp = s; | |
| 17 | rp = s; | |
| 18 | ||
| 19 | while (*rp) | |
| 20 | ++rp; | |
| 21 | ||
| [7258c6a] | 22 | while ((int32_t)(--rp) GE (int32_t)lp) { |
| [f40a309] | 23 | |
| 24 | if (*rp EQ ' ') | |
| 25 | *rp = '\0'; | |
| 26 | else | |
| 27 | break; | |
| 28 | } | |
| 29 | ||
| 30 | return(lp); | |
| 31 | } | |
| [6262b5c] | 32 |
Note:
See TracBrowser
for help on using the repository browser.
![(please configure the [header_logo] section in trac.ini)](http://bob.lopatic.de/chrome/site/logo.png)