summaryrefslogtreecommitdiffstats
path: root/login-utils/utmpdump.c
diff options
context:
space:
mode:
authorKarel Zak2012-06-29 17:27:40 +0200
committerKarel Zak2012-06-29 17:27:40 +0200
commitc8a6af07e79729175be1aec65d71dfd369c369a0 (patch)
treeea11e872f1d3f00486d1460b1c1b36f48146b8ef /login-utils/utmpdump.c
parentutmpdump: add long options (diff)
downloadkernel-qcow2-util-linux-c8a6af07e79729175be1aec65d71dfd369c369a0.tar.gz
kernel-qcow2-util-linux-c8a6af07e79729175be1aec65d71dfd369c369a0.tar.xz
kernel-qcow2-util-linux-c8a6af07e79729175be1aec65d71dfd369c369a0.zip
utmpdump: cleanup usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'login-utils/utmpdump.c')
-rw-r--r--login-utils/utmpdump.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/login-utils/utmpdump.c b/login-utils/utmpdump.c
index b5d6c924a..6f8bef5a1 100644
--- a/login-utils/utmpdump.c
+++ b/login-utils/utmpdump.c
@@ -184,11 +184,21 @@ void undump(FILE *fp)
free(linestart);
}
-void
-usage(int result)
+static void __attribute__((__noreturn__)) usage(FILE *out)
{
- printf(_("Usage: utmpdump [ -frhV ] [ filename ]\n"));
- exit(result);
+ fputs(USAGE_HEADER, out);
+
+ fprintf(out,
+ _(" %s [options]\n"), program_invocation_short_name);
+
+ fputs(USAGE_OPTIONS, out);
+ fputs(_(" -f, --follow output appended data as the file grows\n"
+ " -r, --reverse write back dumped data into utmp file\n"
+ " -h, --help display this help and exit\n"
+ " -V, --version output version information and exit\n"), out);
+
+ fprintf(out, USAGE_MAN_TAIL("utmpdump(1)"));
+ exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
}
int main(int argc, char **argv)
@@ -222,13 +232,13 @@ int main(int argc, char **argv)
break;
case 'h':
- usage(0);
+ usage(stdout);
break;
case 'V':
printf(UTIL_LINUX_VERSION);
- break;
+ return EXIT_SUCCESS;
default:
- usage(1);
+ usage(stderr);
}
}