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/pr.c | |
parent | d1df8c198d8878b77d1d1583bc7b3c491534616a (diff) | |
download | coreutils-b869639f4661488eba0bb2d08020c6e71bb72627.tar.xz |
merge with 1.8d+
Diffstat (limited to 'src/pr.c')
-rw-r--r-- | src/pr.c | 58 |
1 files changed, 45 insertions, 13 deletions
@@ -499,7 +499,7 @@ main (argc, argv) if (!ISDIGIT (*s)) { error (0, 0, "`+' requires a numeric argument"); - usage (); + usage (2); } /* FIXME: use strtol */ first_page_number = atoi (s); @@ -604,7 +604,7 @@ main (argc, argv) fprintf (stderr, "\ %s: extra characters in the argument to the `-s' option: `%s'\n", program_name, s); - usage (); + usage (2); } } break; @@ -618,7 +618,7 @@ main (argc, argv) chars_per_line = atoi (optarg); break; default: - usage (); + usage (2); break; } } @@ -630,7 +630,7 @@ main (argc, argv) } if (show_help) - usage (); + usage (0); if (parallel_files && explicit_columns) error (1, 0, @@ -695,7 +695,7 @@ getoptarg (arg, switch_char, character, number) fprintf (stderr, "\ %s: extra characters in the argument to the `-%c' option: `%s'\n", program_name, switch_char, arg); - usage (); + usage (2); } } } @@ -1876,13 +1876,45 @@ cleanup () /* Complain, print a usage message, and die. */ static void -usage () +usage (status) + int status; { - fprintf (stderr, "\ -Usage: %s [+PAGE] [-COLUMN] [-abcdfFmrtv] [-e[in-tab-char[in-tab-width]]]\n\ - [-h header] [-i[out-tab-char[out-tab-width]]] [-l page-length]\n\ - [-n[number-separator[digits]]] [-o left-margin]\n\ - [-s[column-separator]] [-w page-width] [--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\ + +PAGE begin printing with page PAGE\n\ + -COLUMN produce COLUMN-column output and print columns down\n\ + -F, -f simulate formfeed with newlines on output\n\ + -a print columns across rather than down\n\ + -b balance columns on the last page\n\ + -c use hat notation (^G) and octal backslash notation\n\ + -d double space the output\n\ + -e[CHAR[WIDTH]] expand input CHARs (TABs) to tab WIDTH (8)\n\ + -h HEADER use HEADER instead of filename in page headers\n\ + -i[CHAR[WIDTH]] replace spaces with CHARs (TABs) to tab WIDTH (8)\n\ + -l PAGE_LENGTH set the page length to PAGE_LENGTH (66) lines\n\ + -m print all files in parallel, one in each column\n\ + -n[SEP[DIGITS]] number lines, use DIGITS (5) digits, then SEP (TAB)\n\ + -o MARGIN offset each line with MARGIN spaces (do not affect -w)\n\ + -r inhibit warning when a file cannot be opened\n\ + -s[SEP] separate columns by character SEP (TAB)\n\ + -t inhibit 5-line page headers and trailers\n\ + -v use octal backslash notation\n\ + -w PAGE_WIDTH set page width to PAGE_WIDTH (72) columns\n\ + --help display this help and exit\n\ + --version output version information and exit\n\ +\n\ +-t implied by -l N when N < 10. Without -s, columns are separated by\n\ +spaces. With no FILE, or when FILE is -, read standard input.\n\ +"); + } + exit (status); } |