diff options
author | Jim Meyering <jim@meyering.net> | 1993-10-23 15:37:19 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1993-10-23 15:37:19 +0000 |
commit | b869639f4661488eba0bb2d08020c6e71bb72627 (patch) | |
tree | e325845ec7ca06b4d59fcc07e87020897c7c4d9b /src/uniq.c | |
parent | d1df8c198d8878b77d1d1583bc7b3c491534616a (diff) | |
download | coreutils-b869639f4661488eba0bb2d08020c6e71bb72627.tar.xz |
merge with 1.8d+
Diffstat (limited to 'src/uniq.c')
-rw-r--r-- | src/uniq.c | 44 |
1 files changed, 33 insertions, 11 deletions
diff --git a/src/uniq.c b/src/uniq.c index 6ba6b6869..5cbd4df60 100644 --- a/src/uniq.c +++ b/src/uniq.c @@ -160,7 +160,7 @@ main (argc, argv) break; default: - usage (); + usage (1); } } @@ -171,7 +171,7 @@ main (argc, argv) } if (show_help) - usage (); + usage (0); if (optind >= 2 && strcmp (argv[optind - 1], "--") != 0) { @@ -188,7 +188,7 @@ main (argc, argv) outfile = argv[optind++]; if (optind < argc) - usage (); /* Extra arguments. */ + usage (1); /* Extra arguments. */ check_file (infile, outfile); @@ -345,13 +345,35 @@ writeline (line, stream, linecount) } static void -usage () +usage (status) + int status; { - fprintf (stderr, "\ -Usage: %s [-cdu] [-f skip-fields] [-s skip-chars] [-w check-chars]\n\ - [-#skip-fields] [+#skip-chars] [--count] [--repeated] [--unique]\n\ - [--skip-fields=skip-fields] [--skip-chars=skip-chars]\n\ - [--check-chars=check-chars] [--help] [--version] [infile] [outfile]\n", - program_name); - exit (1); + if (status != 0) + fprintf (stderr, "Try `%s --help' for more information.\n", + program_name); + else + { + printf ("\ +Usage: %s [OPTION]... [INPUT [OUTPUT]]\n\ +", + program_name); + printf ("\ +\n\ + -c, --count prefix lines by the number of occurrences\n\ + -d, --repeated only print duplicate lines\n\ + -f, --skip-fields N avoid comparing the N first fields\n\ + -s, --skip-chars N avoid comparing the N first characters\n\ + -u, --unique only print unique lines\n\ + -w, --check-chars N compare no more then N characters in lines\n\ + -N same as -f N\n\ + +N same as -s N\n\ + --help display this help and exit\n\ + --version output version information and exit\n\ +\n\ +A field is a run of whitespace, than non whitespace characters.\n\ +Fields are skipped before chars. If OUTPUT not specified, writes to\n\ +standard output. If INPUT not specified, reads from standard input.\n\ +"); + } + exit (status); } |