]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
utmpdump: cleanup usage()
authorKarel Zak <kzak@redhat.com>
Fri, 29 Jun 2012 15:27:40 +0000 (17:27 +0200)
committerKarel Zak <kzak@redhat.com>
Fri, 29 Jun 2012 15:27:40 +0000 (17:27 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
login-utils/utmpdump.c

index b5d6c924ac24ae7cf820f8aade8deaf0c34e7a0d..6f8bef5a1765c0216eac01800ae057cb04e3a20e 100644 (file)
@@ -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);
                }
        }