diff options
author | eivind <eivind@FreeBSD.org> | 1999-02-02 14:26:39 +0000 |
---|---|---|
committer | eivind <eivind@FreeBSD.org> | 1999-02-02 14:26:39 +0000 |
commit | 040ae947ad12478255f12f72bfbf6dee22b0b036 (patch) | |
tree | 65489bb2d50cea23b95038788f98238bb09c1eeb /usr.bin/cut/cut.c | |
parent | 78b0de3bf4da3d2f06a3acb35097a2b381f9e01c (diff) | |
download | FreeBSD-src-040ae947ad12478255f12f72bfbf6dee22b0b036.zip FreeBSD-src-040ae947ad12478255f12f72bfbf6dee22b0b036.tar.gz |
Merge from NetBSD cut.1 rev 1.6 and cut.c rev 1.9, respectively. This
makes us conform to IEEE Std1003.2-1992 (``POSIX.2'').
Obtained from: NetBSD (but with slight modifications).
Diffstat (limited to 'usr.bin/cut/cut.c')
-rw-r--r-- | usr.bin/cut/cut.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/usr.bin/cut/cut.c b/usr.bin/cut/cut.c index 168e7b6..1075729 100644 --- a/usr.bin/cut/cut.c +++ b/usr.bin/cut/cut.c @@ -48,6 +48,7 @@ static const char sccsid[] = "@(#)cut.c 8.3 (Berkeley) 5/4/95"; #include <err.h> #include <errno.h> #include <limits.h> +#include <locale.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -73,10 +74,15 @@ main(argc, argv) void (*fcn) __P((FILE *, char *)) = NULL; int ch; + setlocale (LC_ALL, ""); + dchar = '\t'; /* default delimiter is \t */ - while ((ch = getopt(argc, argv, "c:d:f:s")) != -1) + /* Since we don't support multi-byte characters, the -c and -b + options are equivalent, and the -n option is meaningless. */ + while ((ch = getopt(argc, argv, "b:c:d:f:sn")) != EOF) switch(ch) { + case 'b': case 'c': fcn = c_cut; get_list(optarg); @@ -94,6 +100,8 @@ main(argc, argv) case 's': sflag = 1; break; + case 'n': + break; case '?': default: usage(); @@ -263,8 +271,9 @@ f_cut(fp, fname) static void usage() { - (void)fprintf(stderr, "%s\n%s\n", - "usage: cut -c list [file1 ...]", + (void)fprintf(stderr, "%s\n%s\n%s\n", + "usage: cut -b list [-n] [file ...]", + " cut -c list [file ...]", " cut -f list [-s] [-d delim] [file ...]"); exit(1); } |