summaryrefslogtreecommitdiffstats
path: root/text-utils/pg.c
diff options
context:
space:
mode:
Diffstat (limited to 'text-utils/pg.c')
-rw-r--r--text-utils/pg.c17
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 '-':