summaryrefslogtreecommitdiff
path: root/inotail.c
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2009-01-25 16:09:23 +0100
committerTobias Klauser <tklauser@distanz.ch>2009-01-25 16:09:23 +0100
commitae62197f6a0124fd6428d42a501e11cee68e6182 (patch)
treebf8d4749a4335758dbfc3ed93b9eb70f70ae749e /inotail.c
parent1410a0f20d46a64c1ca7ad23328f637a83c803ac (diff)
Add -q, --quiet and --silent options
inotail should become option compatible to GNU tail.
Diffstat (limited to 'inotail.c')
-rw-r--r--inotail.c13
1 files changed, 10 insertions, 3 deletions
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;