aboutsummaryrefslogtreecommitdiff
path: root/src/string.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2014-01-31 19:38:36 -0500
committerKevin O'Connor <kevin@koconnor.net>2014-02-17 14:15:43 -0500
commitd15b0107d6f0f10e259a8937f7695e2130d5e9e4 (patch)
tree2d0416c5a71d7d822cb16c2fe7d60ed604a5a739 /src/string.c
parent2a3ed1eb9583625b318bbb26458926394b80901e (diff)
downloadseabios-hppa-d15b0107d6f0f10e259a8937f7695e2130d5e9e4.zip
seabios-hppa-d15b0107d6f0f10e259a8937f7695e2130d5e9e4.tar.gz
seabios-hppa-d15b0107d6f0f10e259a8937f7695e2130d5e9e4.tar.bz2
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.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/string.c b/src/string.c
index 574c13e..8556fe9 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;
}