From 83fa126b932f87213504fe7b96b5e2ee5b9455b0 Mon Sep 17 00:00:00 2001 From: Francesco Cosoleto Date: Wed, 24 Nov 2010 23:10:16 +0100 Subject: [PATCH] renice: remove hardcoded program name using warn() and warnx() Signed-off-by: Francesco Cosoleto --- sys-utils/renice.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/sys-utils/renice.c b/sys-utils/renice.c index f879791d..51814d16 100644 --- a/sys-utils/renice.c +++ b/sys-utils/renice.c @@ -44,6 +44,7 @@ #include #include #include +#include #include "nls.h" static int donice(int,int,int); @@ -123,16 +124,14 @@ main(int argc, char **argv) register struct passwd *pwd = getpwnam(*argv); if (pwd == NULL) { - fprintf(stderr, _("renice: %s: unknown user\n"), - *argv); + warnx(_("%s: unknown user"), *argv); continue; } who = pwd->pw_uid; } else { who = strtol(*argv, &endptr, 10); if (who < 0 || *endptr) { - fprintf(stderr, _("renice: %s: bad value\n"), - *argv); + warnx(_("%s: bad value"), *argv); continue; } } @@ -148,20 +147,17 @@ donice(int which, int who, int prio) { errno = 0; oldprio = getpriority(which, who); if (oldprio == -1 && errno) { - fprintf(stderr, "renice: %d: ", who); - perror(_("getpriority")); + warn(_("%d: getpriority"), who); return 1; } if (setpriority(which, who, prio) < 0) { - fprintf(stderr, "renice: %d: ", who); - perror(_("setpriority")); + warn(_("%d: setpriority"), who); return 1; } errno = 0; newprio = getpriority(which, who); if (newprio == -1 && errno) { - fprintf(stderr, "renice: %d: ", who); - perror(_("getpriority")); + warn(_("%d: getpriority"), who); return 1; } -- 2.39.5