skill: remove dead code

Commit 991b8a94f0 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>
This commit is contained in:
Sami Kerola 2012-03-15 21:05:08 +01:00
parent 85e0a23347
commit be34477bbd

25
skill.c
View File

@ -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;