diff options
author | Jari Aalto | 2013-06-14 11:42:27 +0200 |
---|---|---|
committer | Karel Zak | 2013-06-18 10:49:35 +0200 |
commit | 34e38ad0c3be0856d7f62d4550cec0305bca6910 (patch) | |
tree | 3fc9744924a43d981cfdae3cdd03e458c755e890 /text-utils | |
parent | mount: fix mistaken word and some grammar in man page of mount (diff) | |
download | kernel-qcow2-util-linux-34e38ad0c3be0856d7f62d4550cec0305bca6910.tar.gz kernel-qcow2-util-linux-34e38ad0c3be0856d7f62d4550cec0305bca6910.tar.xz kernel-qcow2-util-linux-34e38ad0c3be0856d7f62d4550cec0305bca6910.zip |
pg.c: Add --help and --version
[kzak@redhat.com: - use USAGE_{HELP,VERISON} macros]
Signed-off-by: Jari Aalto <jari.aalto@cante.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'text-utils')
-rw-r--r-- | text-utils/pg.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/text-utils/pg.c b/text-utils/pg.c index 7ddf96bf9..7b61e6bd3 100644 --- a/text-utils/pg.c +++ b/text-utils/pg.c @@ -224,8 +224,11 @@ static void __attribute__((__noreturn__)) usage(FILE *out) fputs(_(" -s print messages to stdout\n"), out); fputs(_(" +number start at the given line\n"), out); fputs(_(" +/pattern/ start at the line containing pattern\n"), out); - fputs(_(" -h display this help and exit\n"), out); - fputs(_(" -V output version information and exit\n"), out); + + fputs(USAGE_SEPARATOR, out); + fputs(USAGE_HELP, out); + fputs(USAGE_VERSION, out); + fprintf(out, USAGE_MAN_TAIL("pg(1)")); quit(out == stderr ? 2 : 0); } @@ -1542,6 +1545,16 @@ int main(int argc, char **argv) if (*argv[arg] != '-' || argv[arg][1] == '\0') break; argc--; + + if (!strcmp(argv[arg], "--help")) { + usage(stdout); + } + + if (!strcmp(argv[arg], "--version")) { + printf(UTIL_LINUX_VERSION); + return EXIT_SUCCESS; + } + for (i = 1; argv[arg][i]; i++) { switch (argv[arg][i]) { case '-': |