diff options
author | tjr <tjr@FreeBSD.org> | 2002-06-15 10:16:39 +0000 |
---|---|---|
committer | tjr <tjr@FreeBSD.org> | 2002-06-15 10:16:39 +0000 |
commit | 7853af48f533b7581ad3968e66255f2a262f0833 (patch) | |
tree | b199ebf8a677f0f2b99f1a002484730913785de0 /usr.bin/expand/expand.c | |
parent | 379207e17995107fdfe31dc7cd3231a973327f47 (diff) | |
download | FreeBSD-src-7853af48f533b7581ad3968e66255f2a262f0833.zip FreeBSD-src-7853af48f533b7581ad3968e66255f2a262f0833.tar.gz |
Allow <blank>s to be used to separate tab stop positions with the -t
argument, not just ASCII space characters and commas. Don't count
non-printing characters when determining column position.
Diffstat (limited to 'usr.bin/expand/expand.c')
-rw-r--r-- | usr.bin/expand/expand.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/usr.bin/expand/expand.c b/usr.bin/expand/expand.c index f83419d..e5a63c5 100644 --- a/usr.bin/expand/expand.c +++ b/usr.bin/expand/expand.c @@ -47,6 +47,7 @@ static const char rcsid[] = #include <ctype.h> #include <err.h> +#include <locale.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> @@ -69,8 +70,11 @@ main(argc, argv) register int n; int rval; + setlocale(LC_CTYPE, ""); + /* handle obsolete syntax */ - while (argc > 1 && argv[1][0] == '-' && isdigit(argv[1][1])) { + while (argc > 1 && argv[1][0] == '-' && + isdigit((unsigned char)argv[1][1])) { getstops(&argv[1][1]); argc--; argv++; } @@ -140,7 +144,8 @@ main(argc, argv) default: putchar(c); - column++; + if (isprint(c)) + column++; continue; case '\n': @@ -173,7 +178,7 @@ getstops(cp) tabstops[nstops++] = i; if (*cp == 0) break; - if (*cp != ',' && *cp != ' ') + if (*cp != ',' && !isblank((unsigned char)*cp)) errx(1, "bad tab stop spec"); cp++; } |