int donice(int,int,int);
+void usage(void)
+{
+ fprintf(stderr, _("usage: renice priority [ [ -p ] pids ] "
+ "[ [ -g ] pgrps ] [ [ -u ] users ]\n"));
+ exit(1);
+}
/*
* Change the priority (nice) of processes
* or groups of processes which are already
{
int which = PRIO_PROCESS;
int who = 0, prio, errs = 0;
+ char *endptr=NULL;
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
argc--, argv++;
if (argc < 2) {
- fprintf(stderr, _("usage: renice priority [ [ -p ] pids ] "
- "[ [ -g ] pgrps ] [ [ -u ] users ]\n"));
- exit(1);
+ usage();
+ }
+ prio = strtol(*argv,&endptr,10);
+ if (*endptr) {
+ usage();
}
- prio = atoi(*argv);
argc--, argv++;
#if 0
if (prio > PRIO_MAX)
}
who = pwd->pw_uid;
} else {
- who = atoi(*argv);
- if (who < 0) {
+ who = strtol(*argv,&endptr,10);
+ if (who < 0 || *endptr) {
fprintf(stderr, _("renice: %s: bad value\n"),
*argv);
continue;