diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2009-01-25 16:09:23 +0100 |
---|---|---|
committer | Tobias Klauser <tklauser@distanz.ch> | 2009-01-25 16:09:23 +0100 |
commit | ae62197f6a0124fd6428d42a501e11cee68e6182 (patch) | |
tree | bf8d4749a4335758dbfc3ed93b9eb70f70ae749e | |
parent | 1410a0f20d46a64c1ca7ad23328f637a83c803ac (diff) |
Add -q, --quiet and --silent options
inotail should become option compatible to GNU tail.
-rw-r--r-- | inotail.1 | 21 | ||||
-rw-r--r-- | inotail.c | 13 |
2 files changed, 22 insertions, 12 deletions
@@ -2,14 +2,14 @@ .\" ** The above line should force tbl to be a preprocessor ** .\" Man page for inotail .\" -.\" Copyright (c) 2006 Tobias Klauser <tklauser@distanz.ch> +.\" Copyright (c) 2006-2009 Tobias Klauser <tklauser@distanz.ch> .\" .\" You may distribute under the terms of the GNU General Public .\" License as specified in the file COPYING that comes with .\" inotail. .pc -.TH INOTAIL 1 "2006-08-13" "" "Inotify enhanced tail" +.TH INOTAIL 1 "2009-01-25" "" "Inotify enhanced tail" .SH NAME inotail \- A fast and lightweight version of tail using inotify .SH SYNOPSIS @@ -30,24 +30,27 @@ Currently inotail is not fully compatible to neither POSIX or GNU tail but might be in the future. .SH OPTIONS .TP -.B \-c \fIN\fR, \fB\-\-bytes\fR=\fIN\fR +.B \-c \fIN\fR, \fB\-\-bytes\fR=\fIN output the last N bytes. If the first character of N is a '+', begin printing with the Nth character from the start of each file. .TP -.B \-f, \fB\-\-follow +.B \-f\fR, \fB\-\-follow keep the file(s) open and print appended data as the file grows .TP -.B \-n \fIN\fR, \fB\-\-lines\fR=\fIN\fR +.B \-n \fIN\fR, \fB\-\-lines\fR=\fIN output the last N lines (default: 10) If the first character of N is a '+', begin printing with the Nth line from the start of each file. .TP -.B \-v, \fB\-\-verbose -print headers with file names +.B \-q\fR, \fB\-\-quiet\fR, \fB\-\-silent +never print headers with file names .TP -.B \-h, \fB\-\-help +.B \-v\fR, \fB\-\-verbose +alway print headers with file names +.TP +.B \-h\fR, \fB\-\-help show help and exit .TP -.B \-V, \fB\-\-version +.B \-V\fR, \fB\-\-version show inotail version and exit .SH AUTHOR .PP @@ -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; |