diff options
Diffstat (limited to 'src/tail.c')
-rw-r--r-- | src/tail.c | 43 |
1 files changed, 33 insertions, 10 deletions
diff --git a/src/tail.c b/src/tail.c index e5308a15c..91c470b41 100644 --- a/src/tail.c +++ b/src/tail.c @@ -212,7 +212,7 @@ main (argc, argv) default: error (0, 0, "unrecognized option `-%c'", *argv[1]); - usage (); + usage (1); } ++argv[1]; } @@ -263,7 +263,7 @@ main (argc, argv) break; default: - usage (); + usage (1); } } @@ -274,7 +274,7 @@ main (argc, argv) } if (show_help) - usage (); + usage (0); if (number == -1) number = DEFAULT_NUMBER; @@ -1015,12 +1015,35 @@ atou (str) } static void -usage () +usage (status) + int status; { - fprintf (stderr, "\ -Usage: %s [-c [+]N[bkm]] [-n [+]N] [-fqv] [--bytes=[+]N[bkm]] [--lines=[+]N]\n\ - [--follow] [--quiet] [--silent] [--verbose] [--help] [--version]\n\ - [file...]\n\ - %s [{-,+}Nbcfklmqv] [file...]\n", program_name, program_name); - exit (1); + 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\ + -c, --bytes SIZE print last SIZE bytes\n\ + -f, --follow print files as they grow\n\ + -l, -n, --lines NUMBER print last NUMBER lines, instead of last 10\n\ + -q, --quiet, --silent never print headers giving file names\n\ + -v, --verbose always print headers giving file names\n\ + --help display this help and exit\n\ + --version output version information and exit\n\ +\n\ +SIZE may have a multiplier suffix: b for 512, k for 1K, m for 1 Meg.\n\ +If SIZE is prefixed by +, prints all except the first SIZE bytes. If\n\ +NUMBER is prefixed by +, prints all except the first NUMBER lines. If\n\ +-VALUE or +VALUE is used as first OPTION, read -c VALUE or -c +VALUE\n\ +when one of multipliers bkm follows concatenated, else read -n VALUE\n\ +or -n +VALUE. With no FILE, or when FILE is -, read standard input.\n\ +"); + } + exit (status); } |