]> granicus.if.org Git - procps-ng/commitdiff
skill: remove dead code
authorSami Kerola <kerolasa@iki.fi>
Thu, 15 Mar 2012 20:05:08 +0000 (21:05 +0100)
committerSami Kerola <kerolasa@iki.fi>
Fri, 16 Mar 2012 13:34:21 +0000 (14:34 +0100)
Commit 991b8a94f0354a128085c7411713e17282c4e04a took use
getopt_long(), which means the code that is related to earlier
selfmade argument parsing is unnecessary.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
skill.c

diff --git a/skill.c b/skill.c
index 8fe06391c03eb854997c524b70b4faffda3cc929..f91d44d6911764470a710592b31af8d43c98e702 100644 (file)
--- a/skill.c
+++ b/skill.c
@@ -473,9 +473,7 @@ static void skillsnice_parse(int argc,
 {
        int signo = -1;
        int prino = DEFAULT_NICE;
-       int num_found = 0;
        int ch, i;
-       const char *restrict argptr;
 
        static const struct option longopts[] = {
                {"command", required_argument, NULL, 'c'},
@@ -545,30 +543,10 @@ static void skillsnice_parse(int argc,
                        {
                                struct stat sbuf;
                                char path[32];
-                               if (!optarg)
-                                       /* Huh? Maybe "skill -t ''". */
-                                       skillsnice_usage(stderr);
                                snprintf(path, 32, "/dev/%s", optarg);
                                if (stat(path, &sbuf) >= 0
                                    && S_ISCHR(sbuf.st_mode)) {
-                                       num_found++;
                                        ENLIST(tty, sbuf.st_rdev);
-                                       if (!NEXTARG)
-                                               break;
-                               } else if (optarg && !(optarg[1])) {
-                                       /* if only 1 character */
-                                       switch (*optarg) {
-                                       default:
-                                               if (stat(optarg, &sbuf) < 0)
-                                                       /* the shell eats '?' */
-                                                       break;
-                                       case '-':
-                                       case '?':
-                                               num_found++;
-                                               ENLIST(tty, 0);
-                                               if (!NEXTARG)
-                                                       break;
-                                       }
                                }
                        }
                        break;
@@ -577,10 +555,7 @@ static void skillsnice_parse(int argc,
                                struct passwd *passwd_data;
                                passwd_data = getpwnam(optarg);
                                if (passwd_data) {
-                                       num_found++;
                                        ENLIST(uid, passwd_data->pw_uid);
-                                       if (!NEXTARG)
-                                               break;
                                }
                        }
                        break;