]> git.ipfire.org Git - thirdparty/util-linux.git/blobdiff - misc-utils/uuidgen.c
misc: cosmetics, remove argument from usage(FILE*)
[thirdparty/util-linux.git] / misc-utils / uuidgen.c
index 3883424e92b6b9fe7417984a5907be89c5130b32..77fda2fb3b5904de7996b85a2eedb92bd1b3e241 100644 (file)
  */
 
 #include <stdio.h>
-#ifdef HAVE_STDLIB_H
 #include <stdlib.h>
-#endif
-#ifdef HAVE_GETOPT_H
 #include <getopt.h>
-#else
-extern int getopt(int argc, char * const argv[], const char *optstring);
-extern char *optarg;
-extern int optind;
-#endif
 
 #include "uuid.h"
 #include "nls.h"
 #include "c.h"
 #include "closestream.h"
 
-static void __attribute__ ((__noreturn__)) usage(FILE * out)
+static void __attribute__((__noreturn__)) usage(void)
 {
-       fputs(_("\nUsage:\n"), out);
+       FILE *out = stdout;
+       fputs(USAGE_HEADER, out);
        fprintf(out,
              _(" %s [options]\n"), program_invocation_short_name);
 
-       fputs(_("\nOptions:\n"), out);
-       fputs(_(" -r, --random     generate random-based uuid\n"
-               " -t, --time       generate time-based uuid\n"
-               " -V, --version    output version information and exit\n"
-               " -h, --help       display this help and exit\n\n"), out);
+       fputs(USAGE_SEPARATOR, out);
+       fputs(_("Create a new UUID value.\n"), out);
 
+       fputs(USAGE_OPTIONS, out);
+       fputs(_(" -r, --random     generate random-based uuid\n"), out);
+       fputs(_(" -t, --time       generate time-based uuid\n"), out);
+       fputs(USAGE_SEPARATOR, out);
+       fputs(USAGE_HELP, out);
+       fputs(USAGE_VERSION, out);
        fprintf(out, USAGE_MAN_TAIL("uuidgen(1)"));
-       exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
+       exit(EXIT_SUCCESS);
 }
 
 int
@@ -75,9 +71,9 @@ main (int argc, char *argv[])
                        printf(UTIL_LINUX_VERSION);
                        return EXIT_SUCCESS;
                case 'h':
-                       usage(stdout);
+                       usage();
                default:
-                       usage(stderr);
+                       errtryhelp(EXIT_FAILURE);
                }
 
        switch (do_type) {