diff options
author | phk <phk@FreeBSD.org> | 2014-03-12 08:54:29 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2014-03-12 08:54:29 +0000 |
commit | dc881bd3d93c18c83c1c7b53fb172c0d334078c8 (patch) | |
tree | d99e1722aba8074fc9b0c256036f429a63c3f79c | |
parent | 0abf3679fe2f3c444ba8417684034d18894b5974 (diff) | |
download | FreeBSD-src-dc881bd3d93c18c83c1c7b53fb172c0d334078c8.zip FreeBSD-src-dc881bd3d93c18c83c1c7b53fb172c0d334078c8.tar.gz |
Make ministat CRNL tolerant by stripping all isspace() from the tail
end of input lines.
-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 218715c..c8d8e12 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)) { |