As far as I can tell the only thing gained from using getopt is handling
    vipw --
as vipw takes no flags or arguments, is not intended for non-interactive
use, and is not POSIX, I don't see a reason -- should be handled. If
anyone prefers proper handling of -- perhaps
        if (!( argc == 1 || (argc == 2 && strcmp(argv[1], "--") == 0)))

Also kill a needless include.

- Matthew Martin

diff --git vipw.c vipw.c
index e9595b02198..88a741f1c15 100644
--- vipw.c
+++ vipw.c
@@ -37,7 +37,6 @@
 #include <pwd.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <string.h>
 #include <unistd.h>
 #include <util.h>
 
@@ -49,18 +48,8 @@ main(int argc, char *argv[])
 {
        int pfd, tfd;
        struct stat begin, end;
-       int ch;
 
-       while ((ch = getopt(argc, argv, "")) != -1) {
-               switch (ch) {
-               default:
-                       usage();
-               }
-       }
-       argc -= optind;
-       argv += optind;
-
-       if (argc != 0)
+       if (argc != 1)
                usage();
 
        if (pledge("stdio rpath wpath cpath fattr proc exec", NULL) == -1)

Reply via email to