summaryrefslogtreecommitdiff
path: root/src/tail.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1993-10-23 15:37:19 +0000
committerJim Meyering <jim@meyering.net>1993-10-23 15:37:19 +0000
commitb869639f4661488eba0bb2d08020c6e71bb72627 (patch)
treee325845ec7ca06b4d59fcc07e87020897c7c4d9b /src/tail.c
parentd1df8c198d8878b77d1d1583bc7b3c491534616a (diff)
downloadcoreutils-b869639f4661488eba0bb2d08020c6e71bb72627.tar.xz
merge with 1.8d+
Diffstat (limited to 'src/tail.c')
-rw-r--r--src/tail.c43
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);
}