]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
hwclock: remove dead code in usage()
authorJ William Piggott <elseifthen@gmx.com>
Fri, 21 Apr 2017 00:29:15 +0000 (20:29 -0400)
committerJ William Piggott <elseifthen@gmx.com>
Tue, 20 Jun 2017 23:15:04 +0000 (19:15 -0400)
Commit 677ec86 caused usage() to be called only by --help.

So remove the now dead code from usage().

Signed-off-by: J William Piggott <elseifthen@gmx.com>
sys-utils/hwclock.c

index 55f54f5ee09bbe2428032f3e0880c9a1cdf81b9f..478231821130c2d0fdd2fb38ae92e03cf2067af5 100644 (file)
@@ -1199,24 +1199,9 @@ static void out_version(void)
        printf(UTIL_LINUX_VERSION);
 }
 
-/*
- * usage - Output (error and) usage information
- *
- * This function is called both directly from main to show usage information
- * and as fatal function from shhopt if some argument is not understood. In
- * case of normal usage info FMT should be NULL. In that case the info is
- * printed to stdout. If FMT is given usage will act like fprintf( stderr,
- * fmt, ... ), show a usage information and terminate the program
- * afterwards.
- */
 static void __attribute__((__noreturn__))
-usage(const struct hwclock_control *ctl, const char *fmt, ...)
+usage(const struct hwclock_control *ctl, FILE *usageto)
 {
-       FILE *usageto;
-       va_list ap;
-
-       usageto = fmt ? stderr : stdout;
-
        fputs(USAGE_HEADER, usageto);
        fputs(_(" hwclock [function] [option...]\n"), usageto);
 
@@ -1263,14 +1248,7 @@ usage(const struct hwclock_control *ctl, const char *fmt, ...)
        fputs(_("     --test           do not update anything, just show what would happen\n"
                " -D, --debug          debugging mode\n" "\n"), usageto);
 
-       if (fmt) {
-               va_start(ap, fmt);
-               vfprintf(usageto, fmt, ap);
-               va_end(ap);
-       }
-
-       fflush(usageto);
-       hwclock_exit(ctl, fmt ? EX_USAGE : EX_OK);
+       hwclock_exit(ctl, EXIT_SUCCESS);
 }
 
 /*
@@ -1475,7 +1453,7 @@ int main(int argc, char **argv)
                        out_version();
                        return 0;
                case 'h':                       /* --help */
-                       usage(&ctl, NULL);
+                       usage(&ctl, stdout);
                default:
                        errtryhelp(EXIT_FAILURE);
                }