]> git.ipfire.org Git - thirdparty/util-linux.git/blobdiff - login-utils/newgrp.c
scriptreplay: cleanup usage()
[thirdparty/util-linux.git] / login-utils / newgrp.c
index 7358ba1121011b9a529fee65a305e4178371b78d..5e4b4caa025ebfe2f301b3fa1f2b3513047c3177 100644 (file)
@@ -196,13 +196,12 @@ int main(int argc, char *argv[])
        setlocale(LC_ALL, "");
        bindtextdomain(PACKAGE, LOCALEDIR);
        textdomain(PACKAGE);
-       atexit(close_stdout);
+       close_stdout_atexit();
 
        while ((ch = getopt_long(argc, argv, "Vh", longopts, NULL)) != -1)
                switch (ch) {
                case 'V':
-                       printf(UTIL_LINUX_VERSION);
-                       return EXIT_SUCCESS;
+                       print_version(EXIT_SUCCESS);
                case 'h':
                        usage();
                default:
@@ -236,8 +235,5 @@ int main(int argc, char *argv[])
        shell = (pw_entry->pw_shell && *pw_entry->pw_shell ?
                                pw_entry->pw_shell : _PATH_BSHELL);
        execl(shell, shell, (char *)0);
-       warn(_("failed to execute %s"), shell);
-       fflush(stderr);
-
-       return EXIT_FAILURE;
+       errexec(shell);
 }