From b869639f4661488eba0bb2d08020c6e71bb72627 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sat, 23 Oct 1993 15:37:19 +0000 Subject: merge with 1.8d+ --- src/cat.c | 42 ++++++++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 10 deletions(-) (limited to 'src/cat.c') diff --git a/src/cat.c b/src/cat.c index 8cbc61f7d..702d5c984 100644 --- a/src/cat.c +++ b/src/cat.c @@ -85,15 +85,37 @@ static int newlines2 = 0; static int exit_stat = 0; static void -usage () +usage (status) + int status; { - fprintf (stderr, "\ -Usage: %s [-benstuvAET] [--number] [--number-nonblank] [--squeeze-blank]\n\ - [--show-nonprinting] [--show-ends] [--show-tabs] [--show-all]\n\ - [--help] [--version] [file...]\n", - program_name); - - exit (2); + if (status != 0) + fprintf (stderr, "Try `%s --help' for more information.\n", + program_name); + else + { + printf ("\ +Usage: %s [OPTION] [FILE]...\n\ +", + program_name); + printf ("\ +\n\ + -b, --number-nonblank number nonblank output lines\n\ + -e equivalent to -vE\n\ + -n, --number number all output lines\n\ + -s, --squeeze-blank never more than one single blank line\n\ + -t equivalent to -vT\n\ + -u (ignored)\n\ + -v, --show-nonprinting use ^ and M- notation, save for LFD and TAB\n\ + -A, --show-all equivalent to -vET\n\ + -E, --show-ends display $ at end of each line\n\ + -T, --show-tabs display TAB characters as ^I\n\ + --help display this help and exit\n\ + --version output version information and exit\n\ +\n\ +With no FILE, or when FILE is -, read standard input.\n\ +"); + } + exit (status); } @@ -231,7 +253,7 @@ main (argc, argv) break; default: - usage (); + usage (2); } } @@ -242,7 +264,7 @@ main (argc, argv) } if (show_help) - usage (); + usage (0); output_desc = 1; -- cgit v1.2.3-54-g00ecf