Re: [patches] slicing into manageable chunks, corrections, untangling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jun 15, 2010 at 11:33:29PM +0200, Martin Mares wrote:
> Hello!
> 
> > -	printf(_("pid %d's %s scheduling policy: "), pid, what);
> > +	if (what == "current")
> > +		printf(_("pid %d's current scheduling policy: "), pid);
> 
> *puzzled*
> 
> What sense is there in comparing strings for equality using "==" ?

 Did you read the original Benno's email?
 http://thread.gmane.org/gmane.linux.utilities.util-linux-ng/3254

 The patch applied to the repository is below.

    Karel


>From a9a3e5f2f994d3f723c4eee87969dc0db69f8cdf Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@xxxxxxxxxxxxx>
Date: Mon, 14 Jun 2010 19:47:08 +0200
Subject: [PATCH] chrt: change two messages into four translatable sentences

In several languages the translations for "current" and "new" will
have to be slightly different depending on whether they apply to
"policy" or "priority".  (As a general rule, translatable messages
should be full sentences, and not partial ones with optional words
filled in via %s.)

Signed-off-by: Benno Schulenberg <bensberg@xxxxxxxxxxxxx>
Signed-off-by: Karel Zak <kzak@xxxxxxxxxx>
---
 schedutils/chrt.c |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/schedutils/chrt.c b/schedutils/chrt.c
index cc40013..8044d39 100644
--- a/schedutils/chrt.c
+++ b/schedutils/chrt.c
@@ -80,7 +80,7 @@ static void show_usage(int rc)
 	exit(rc);
 }
 
-static void show_rt_info(const char *what, pid_t pid)
+static void show_rt_info(pid_t pid, int isnew)
 {
 	struct sched_param sp;
 	int policy;
@@ -93,7 +93,11 @@ static void show_rt_info(const char *what, pid_t pid)
 	if (policy == -1)
 		err(EXIT_FAILURE, _("failed to get pid %d's policy"), pid);
 
-	printf(_("pid %d's %s scheduling policy: "), pid, what);
+	if (isnew)
+		printf(_("pid %d's new scheduling policy: "), pid);
+	else
+		printf(_("pid %d's current scheduling policy: "), pid);
+
 	switch (policy) {
 	case SCHED_OTHER:
 		printf("SCHED_OTHER\n");
@@ -131,8 +135,12 @@ static void show_rt_info(const char *what, pid_t pid)
 	if (sched_getparam(pid, &sp))
 		err(EXIT_FAILURE, _("failed to get pid %d's attributes"), pid);
 
-	printf(_("pid %d's %s scheduling priority: %d\n"),
-		pid, what, sp.sched_priority);
+	if (isnew)
+		printf(_("pid %d's new scheduling priority: %d\n"),
+		       pid, sp.sched_priority);
+	else
+		printf(_("pid %d's current scheduling priority: %d\n"),
+		       pid, sp.sched_priority);
 }
 
 static void show_min_max(void)
@@ -247,7 +255,7 @@ int main(int argc, char *argv[])
 		show_usage(EXIT_FAILURE);
 
 	if ((pid > -1) && (verbose || argc - optind == 1)) {
-		show_rt_info(_("current"), pid);
+		show_rt_info(pid, FALSE);
 		if (argc - optind == 1)
 			return EXIT_SUCCESS;
 	}
@@ -274,7 +282,7 @@ int main(int argc, char *argv[])
 		err(EXIT_FAILURE, _("failed to set pid %d's policy"), pid);
 
 	if (verbose)
-		show_rt_info(_("new"), pid);
+		show_rt_info(pid, TRUE);
 
 	if (!pid) {
 		argv += optind + 1;
-- 
1.6.6.1

--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux