diff options
author | Poul-Henning Kamp <phk@FreeBSD.org> | 2014-03-12 08:54:29 +0000 |
---|---|---|
committer | Poul-Henning Kamp <phk@FreeBSD.org> | 2014-03-12 08:54:29 +0000 |
commit | b0cba3367e557b3a0321e9152cfab79acc915e3d (patch) | |
tree | d99e1722aba8074fc9b0c256036f429a63c3f79c /usr.bin/ministat | |
parent | e2f4949a4a9a6a91d56e30603c1576045ef4d43c (diff) | |
download | src-b0cba3367e557b3a0321e9152cfab79acc915e3d.tar.gz src-b0cba3367e557b3a0321e9152cfab79acc915e3d.zip |
Make ministat CRNL tolerant by stripping all isspace() from the tail
end of input lines.
Notes
Notes:
svn path=/head/; revision=263077
Diffstat (limited to 'usr.bin/ministat')
-rw-r--r-- | usr.bin/ministat/ministat.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/ministat/ministat.c b/usr.bin/ministat/ministat.c index 218715c82421..c8d8e12355c9 100644 --- a/usr.bin/ministat/ministat.c +++ b/usr.bin/ministat/ministat.c @@ -13,6 +13,7 @@ __FBSDID("$FreeBSD$"); #include <stdio.h> #include <math.h> +#include <ctype.h> #include <err.h> #include <string.h> #include <stdlib.h> @@ -475,8 +476,8 @@ ReadSet(const char *n, int column, const char *delim) line++; i = strlen(buf); - if (buf[i-1] == '\n') - buf[i-1] = '\0'; + while (i > 0 && isspace(buf[i - 1])) + buf[--i] = '\0'; for (i = 1, t = strtok(buf, delim); t != NULL && *t != '#'; i++, t = strtok(NULL, delim)) { |