From f29922a5bc6f64e2876694bdc77ef6b59639fbb2 Mon Sep 17 00:00:00 2001 From: Francesco Cosoleto Date: Tue, 18 May 2010 01:07:46 +0200 Subject: ipcs: get rid of colons from header strings for consistency This changes output of -u, -l, and -c. Example of non consistent output: $ ipcs -u | grep ^--- ------ Shared Memory Status -------- ------ Semaphore Status -------- ------ Messages: Status -------- Signed-off-by: Francesco Cosoleto --- sys-utils/ipcs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sys-utils/ipcs.c') diff --git a/sys-utils/ipcs.c b/sys-utils/ipcs.c index 766e5869..7cc204e1 100644 --- a/sys-utils/ipcs.c +++ b/sys-utils/ipcs.c @@ -487,21 +487,21 @@ void do_msg (char format) case LIMITS: if ((msgctl (0, IPC_INFO, (struct msqid_ds *) (void *) &msginfo)) < 0 ) return; - printf (_("------ Messages: Limits --------\n")); + printf (_("------ Messages Limits --------\n")); printf (_("max queues system wide = %d\n"), msginfo.msgmni); printf (_("max size of message (bytes) = %d\n"), msginfo.msgmax); printf (_("default max size of queue (bytes) = %d\n"), msginfo.msgmnb); return; case STATUS: - printf (_("------ Messages: Status --------\n")); + printf (_("------ Messages Status --------\n")); printf (_("allocated queues = %d\n"), msginfo.msgpool); printf (_("used headers = %d\n"), msginfo.msgmap); printf (_("used space = %d bytes\n"), msginfo.msgtql); return; case CREATOR: - printf (_("------ Message Queues: Creators/Owners --------\n")); + printf (_("------ Message Queues Creators/Owners --------\n")); printf ("%-10s %-10s %-10s %-10s %-10s %-10s\n", _("msqid"),_("perms"),_("cuid"),_("cgid"),_("uid"),_("gid")); break; -- cgit v1.2.3 From 3c462efefe8b2ca9786fbaa667b2e275ccb24e59 Mon Sep 17 00:00:00 2001 From: Francesco Cosoleto Date: Tue, 18 May 2010 01:07:48 +0200 Subject: ipcs: add missing "PIDs" to related shared memory header text Signed-off-by: Francesco Cosoleto --- sys-utils/ipcs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sys-utils/ipcs.c') diff --git a/sys-utils/ipcs.c b/sys-utils/ipcs.c index 7cc204e1..eb1e30a9 100644 --- a/sys-utils/ipcs.c +++ b/sys-utils/ipcs.c @@ -296,7 +296,7 @@ void do_shm (char format) break; case PID: - printf (_("------ Shared Memory Creator/Last-op --------\n")); + printf (_("------ Shared Memory Creator/Last-op PIDs --------\n")); printf ("%-10s %-10s %-10s %-10s\n", _("shmid"),_("owner"),_("cpid"),_("lpid")); break; -- cgit v1.2.3 From 89074c16595d26c5ceaf112ed5385db97f88bbfe Mon Sep 17 00:00:00 2001 From: Francesco Cosoleto Date: Tue, 18 May 2010 01:07:50 +0200 Subject: ipcs: reorganize help and usage texts Help text old version: ipcs provides information on ipc facilities for which you have read access. Resource Specification: -m : shared_mem -q : messages -s : semaphores -a : all (default) Output Format: -t : time -p : pid -c : creator -l : limits -u : summary -i id [-s -q -m] : details on resource identified by id usage : ipcs -asmq -tclup ipcs [-s -m -q] -i id ipcs -h for help. New version: Usage: ipcs [resource]... [output-format] ipcs [resource] -i id Provide information on IPC facilities for which you have read access. -h display this help -i id print details on resource identified by id Resource options: -m shared memory segments -q message queues -s semaphores -a all (default) Output format: -t time -p pid -c creator -l limits -u summary Usage text old version: usage : ipcs -asmq -tclup ipcs [-s -m -q] -i id ipcs -h for help. New version: Usage: ipcs [-asmq] [-t|-c|-l|-u|-p] ipcs [-s|-m|-q] -i id ipcs -h for help [kzak@redhat.com: - use program_invocation_short_name - minor cleanups] Signed-off-by: Francesco Cosoleto Signed-off-by: Karel Zak --- sys-utils/ipcs.c | 42 ++++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 14 deletions(-) (limited to 'sys-utils/ipcs.c') diff --git a/sys-utils/ipcs.c b/sys-utils/ipcs.c index eb1e30a9..60cfe417 100644 --- a/sys-utils/ipcs.c +++ b/sys-utils/ipcs.c @@ -109,26 +109,41 @@ void print_shm (int id); void print_msg (int id); void print_sem (int id); -static char *progname; - static void usage(int rc) { - printf (_("usage : %s -asmq -tclup \n"), progname); - printf (_("\t%s [-s -m -q] -i id\n"), progname); - printf (_("\t%s -h for help.\n"), progname); + printf (_("Usage: %1$s [-asmq] [-t|-c|-l|-u|-p]\n" + " %1$s [-s|-m|-q] -i id\n" + " %1$s -h for help\n"), + program_invocation_short_name); exit(rc); } static void help (int rc) { - printf (_("%s provides information on ipc facilities for" - " which you have read access.\n"), progname); - printf (_("Resource Specification:\n\t-m : shared_mem\n\t-q : messages\n")); - printf (_("\t-s : semaphores\n\t-a : all (default)\n")); - printf (_("Output Format:\n\t-t : time\n\t-p : pid\n\t-c : creator\n")); - printf (_("\t-l : limits\n\t-u : summary\n")); - printf (_("-i id [-s -q -m] : details on resource identified by id\n")); - usage(rc); + printf (_("Usage: %1$s [resource]... [output-format]\n" + " %1$s [resource] -i id\n\n"), + program_invocation_short_name); + + printf (_("Provide information on IPC facilities for which you " + "have read access.\n\n")); + + printf (_( + " -h display this help\n" + " -i id print details on resource identified by id\n\n")); + + printf (_("Resource options:\n" + " -m shared memory segments\n" + " -q message queues\n" + " -s semaphores\n" + " -a all (default)\n\n")); + + printf (_("Output format:\n" + " -t time\n" + " -p pid\n" + " -c creator\n" + " -l limits\n" + " -u summary\n")); + exit(rc); } int @@ -141,7 +156,6 @@ main (int argc, char **argv) { bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); - progname = argv[0]; while ((opt = getopt (argc, argv, options)) != -1) { switch (opt) { case 'i': -- cgit v1.2.3 From 4163ab187d26cbe7887dfabf8724c887de94e244 Mon Sep 17 00:00:00 2001 From: Francesco Cosoleto Date: Sun, 27 Jun 2010 14:24:33 +0200 Subject: ipcs: advise translators a different output format Shared memory status output format need changes but there are backward compatibility problems. This is a invite to apply in translations the same style used for the rest of the summaries as well as for the limits reported by -l option. Signed-off-by: Francesco Cosoleto --- sys-utils/ipcs.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'sys-utils/ipcs.c') diff --git a/sys-utils/ipcs.c b/sys-utils/ipcs.c index 60cfe417..2ef5788d 100644 --- a/sys-utils/ipcs.c +++ b/sys-utils/ipcs.c @@ -288,11 +288,25 @@ void do_shm (char format) case STATUS: printf (_("------ Shared Memory Status --------\n")); - printf (_("segments allocated %d\n"), shm_info.used_ids); - printf (_("pages allocated %ld\n"), shm_info.shm_tot); - printf (_("pages resident %ld\n"), shm_info.shm_rss); - printf (_("pages swapped %ld\n"), shm_info.shm_swp); - printf (_("Swap performance: %ld attempts\t %ld successes\n"), + /* TRANSLATORS: This output format is mantained for backward compatibility + as ipcs is used in scripts. For consistency with the rest, the translated + form can follow this model: + + "segments allocated = %d\n" + "pages allocated = %ld\n" + "pages resident = %ld\n" + "pages swapped = %ld\n" + "swap performance = %ld attempts, %ld successes\n" + */ + printf (_("segments allocated %d\n" + "pages allocated %ld\n" + "pages resident %ld\n" + "pages swapped %ld\n" + "Swap performance: %ld attempts\t %ld successes\n"), + shm_info.used_ids, + shm_info.shm_tot, + shm_info.shm_rss, + shm_info.shm_swp, shm_info.swap_attempts, shm_info.swap_successes); return; -- cgit v1.2.3