From 89074c16595d26c5ceaf112ed5385db97f88bbfe Mon Sep 17 00:00:00 2001 From: Francesco Cosoleto Date: Tue, 18 May 2010 01:07:50 +0200 Subject: [PATCH] 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(-) 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': -- 2.39.5