]> git.ipfire.org Git - thirdparty/util-linux.git/blobdiff - sys-utils/tunelp.c
Merge branch 'patch-23' of https://github.com/mariobl/util-linux
[thirdparty/util-linux.git] / sys-utils / tunelp.c
index fe261f393c849ceb8e65ce352676afd12466f552..95a21b39eeecbebec1b4b89543fc1916e964f40c 100644 (file)
@@ -112,8 +112,8 @@ static void __attribute__((__noreturn__)) usage(void)
        fputs(_(" -r, --reset                  reset the port\n"), out);
        fputs(_(" -q, --print-irq <on|off>     display current irq setting\n"), out);
        fputs(USAGE_SEPARATOR, out);
-       printf(USAGE_HELP_OPTIONS(30));
-       printf(USAGE_MAN_TAIL("tunelp(8)"));
+       fprintf(out, USAGE_HELP_OPTIONS(30));
+       fprintf(out, USAGE_MAN_TAIL("tunelp(8)"));
 
        exit(EXIT_SUCCESS);
 }
@@ -144,7 +144,7 @@ int main(int argc, char **argv)
        setlocale(LC_ALL, "");
        bindtextdomain(PACKAGE, LOCALEDIR);
        textdomain(PACKAGE);
-       atexit(close_stdout);
+       close_stdout_atexit();
 
        strutils_set_exitcode(EXIT_LP_BADVAL);
 
@@ -159,9 +159,6 @@ int main(int argc, char **argv)
        show_irq = 1;
        while ((c = getopt_long(argc, argv, "t:c:w:a:i:ho:C:sq:rT:vV", longopts, NULL)) != -1) {
                switch (c) {
-               case 'h':
-                       usage();
-                       break;
                case 'i':
                        cmds->op = LPSETIRQ;
                        cmds->val = strtol_or_err(optarg, _("argument error"));
@@ -229,10 +226,12 @@ int main(int argc, char **argv)
                        cmds = cmds->next;
                        cmds->next = NULL;
                        break;
+
+               case 'h':
+                       usage();
                case 'v':
                case 'V':
-                       printf(UTIL_LINUX_VERSION);
-                       return EXIT_SUCCESS;
+                       print_version(EXIT_SUCCESS);
                default:
                        errtryhelp(EXIT_FAILURE);
                }
@@ -293,8 +292,7 @@ int main(int argc, char **argv)
                                        printf(_(", error"));
                                printf("\n");
                        }
-               } else
-               if (ioctl(fd, cmds->op - offset, cmds->val) < 0)
+               } else if (ioctl(fd, cmds->op - offset, cmds->val) < 0)
                        warn(_("ioctl failed"));
                cmdst = cmds;
                cmds = cmds->next;