summaryrefslogtreecommitdiffstats
path: root/sys-utils/renice.c
diff options
context:
space:
mode:
authorFrancesco Cosoleto2010-12-09 20:03:19 +0100
committerKarel Zak2010-12-09 23:07:41 +0100
commit8aa504664794150c2d64923e2a63341a2b56e065 (patch)
tree3c2a1735541c4808f81708d5e56a4c1b1ca81321 /sys-utils/renice.c
parentpartx: tiny change in usage() (diff)
downloadkernel-qcow2-util-linux-8aa504664794150c2d64923e2a63341a2b56e065.tar.gz
kernel-qcow2-util-linux-8aa504664794150c2d64923e2a63341a2b56e065.tar.xz
kernel-qcow2-util-linux-8aa504664794150c2d64923e2a63341a2b56e065.zip
renice: improve messages specifying what ID is referring to
Hello, On 30/11/2010 13:01, Karel Zak wrote: > Unfortunately, translators don't like this kind of strings where any > translatable substring is inserted to the normal sentence. It would be > better to use something like: > > "%d (%s): failed to set priority", who, idtype > > "%s: %d: failed to set priority", idtype, who > > or so... or "failed to set priority for %d (%s)"? From 536eb11f873f2c887e075a37ffb3c971cac258d5 Mon Sep 17 00:00:00 2001 From: Francesco Cosoleto <cosoleto@gmail.com> Date: Mon, 6 Dec 2010 01:23:10 +0100 Subject: [PATCH] renice: improve messages specifying what ID is referring to This version makes more clear the printed message specially when the --user option is used. Old version: $ renice 19 10 -u fra -g 1 renice: 10: setpriority: Operation not permitted renice: 1000: setpriority: Operation not permitted renice: 1: setpriority: Operation not permitted $ renice 19 -u fra 1000: old priority 0, new priority 19 New version: $ renice 19 10 -u fra -g 1 renice: failed to set priority for 10 (process ID): Operation not permitted renice: failed to set priority for 1000 (user ID): Operation not permitted renice: failed to set priority for 1 (process group ID): Operation not permitted $ renice 19 -u fra 1000 (user ID) old priority 0, new priority 19 Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
Diffstat (limited to 'sys-utils/renice.c')
-rw-r--r--sys-utils/renice.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/sys-utils/renice.c b/sys-utils/renice.c
index 4af6f04b3..8a60cd83a 100644
--- a/sys-utils/renice.c
+++ b/sys-utils/renice.c
@@ -154,25 +154,31 @@ main(int argc, char **argv)
static int
donice(int which, int who, int prio) {
int oldprio, newprio;
+ const char *idtype = _("process ID");
+
+ if (which == PRIO_USER)
+ idtype = _("user ID");
+ else if (which == PRIO_PGRP)
+ idtype = _("process group ID");
errno = 0;
oldprio = getpriority(which, who);
if (oldprio == -1 && errno) {
- warn(_("%d: getpriority"), who);
+ warn(_("failed to get priority for %d (%s)"), who, idtype);
return 1;
}
if (setpriority(which, who, prio) < 0) {
- warn(_("%d: setpriority"), who);
+ warn(_("failed to set priority for %d (%s)"), who, idtype);
return 1;
}
errno = 0;
newprio = getpriority(which, who);
if (newprio == -1 && errno) {
- warn(_("%d: getpriority"), who);
+ warn(_("failed to get priority for %d (%s)"), who, idtype);
return 1;
}
- printf(_("%d: old priority %d, new priority %d\n"),
- who, oldprio, newprio);
+ printf(_("%d (%s) old priority %d, new priority %d\n"),
+ who, idtype, oldprio, newprio);
return 0;
}