*
*/
-#include "internal.h"
#include <stdio.h>
#include <errno.h>
+#include <stdlib.h>
#include <sys/time.h>
#include <sys/resource.h>
+#include "busybox.h"
extern int renice_main(int argc, char **argv)
{
- int prio, err = 0;
-
- if (argc < 3) usage(renice_usage);
-
+ int prio, status = EXIT_SUCCESS;
+
+ if (argc < 3) bb_show_usage();
+
prio = atoi(*++argv);
if (prio > 20) prio = 20;
if (prio < -20) prio = -20;
-
+
while (*++argv) {
int ps = atoi(*argv);
int oldp = getpriority(PRIO_PROCESS, ps);
-
+
if (setpriority(PRIO_PROCESS, ps, prio) == 0) {
printf("%d: old priority %d, new priority %d\n", ps, oldp, prio );
} else {
- fprintf(stderr, "renice: %d: setpriority: ", ps);
- perror("");
- err = 1;
+ bb_perror_msg("%d: setpriority", ps);
+ status = EXIT_FAILURE;
}
}
- exit(err);
+
+ return status;
}