diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2014-01-31 19:38:36 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2014-02-17 14:15:43 -0500 |
commit | d15b0107d6f0f10e259a8937f7695e2130d5e9e4 (patch) | |
tree | 2d0416c5a71d7d822cb16c2fe7d60ed604a5a739 /src/string.c | |
parent | 2a3ed1eb9583625b318bbb26458926394b80901e (diff) | |
download | seabios-d15b0107d6f0f10e259a8937f7695e2130d5e9e4.tar.gz |
Enhance nullTrailingSpace() so that it can also skip leading spaces.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/string.c')
-rw-r--r-- | src/string.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/string.c b/src/string.c index 574c13e7..8556fe98 100644 --- a/src/string.c +++ b/src/string.c @@ -225,11 +225,14 @@ strchr(const char *s, int c) } // Remove any trailing blank characters (spaces, new lines, carriage returns) -void +char * nullTrailingSpace(char *buf) { int len = strlen(buf); char *end = &buf[len-1]; while (end >= buf && *end <= ' ') *(end--) = '\0'; + while (*buf && *buf <= ' ') + buf++; + return buf; } |