From ae62197f6a0124fd6428d42a501e11cee68e6182 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Sun, 25 Jan 2009 16:09:23 +0100 Subject: Add -q, --quiet and --silent options inotail should become option compatible to GNU tail. --- inotail.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'inotail.c') diff --git a/inotail.c b/inotail.c index 9bb126d..5ecfcf4 100644 --- a/inotail.c +++ b/inotail.c @@ -49,9 +49,11 @@ static int n_ignored = 0; static const struct option long_opts[] = { { "bytes", required_argument, NULL, 'c' }, { "follow", optional_argument, NULL, 'f' }, + { "help", no_argument, NULL, 'h' }, { "lines", required_argument, NULL, 'n' }, + { "quiet", no_argument, NULL, 'q' }, + { "silent", no_argument, NULL, 'q' }, { "verbose", no_argument, NULL, 'v' }, - { "help", no_argument, NULL, 'h' }, { "version", no_argument, NULL, 'V' }, { NULL, 0, NULL, 0 } }; @@ -74,7 +76,9 @@ static void usage(const int status) " -c N, --bytes=N output the last N bytes\n" " -f, --follow output as the file grows\n" " -n N, --lines=N output the last N lines (default: %d)\n" - " -v, --verbose print headers with file names\n" + " -q, --quiet, --slient\n" + " never print headers with file names\n" + " -v, --verbose always print headers with file names\n" " -h, --help show this help and exit\n" " -V, --version show version and exit\n\n" "If the first character of N (the number of bytes or lines) is a `+',\n" @@ -717,7 +721,7 @@ int main(int argc, char **argv) char **filenames; struct file_struct *files = NULL; - while ((c = getopt_long(argc, argv, "c:n:fvVh", long_opts, NULL)) != -1) { + while ((c = getopt_long(argc, argv, "c:n:fqvVh", long_opts, NULL)) != -1) { switch (c) { case 'c': mode = M_BYTES; @@ -738,6 +742,9 @@ int main(int argc, char **argv) case 'f': forever = 1; break; + case 'q': + verbose = 0; + break; case 'v': verbose = 1; break; -- cgit v1.2.3-54-g00ecf