Hi, Attached set of patches I had still lying around. They have been rebased against current origin. The first three patches improve the wording or consistency of some help texts and error messages. The fourth patch gettextizes several overlooked translatable strings, and improves some of them and some related others. The fifth patch standardizes the reporting of the program name to "name from util-linux". The sixth patch improves the synopsis of renice to re-include the long option names and also improves the help text. Finally, the seventh patch makes renice recognize also -V for --version (instead of just -v), documents it, and in the bargain improves the man page. Regards, Benno -- http://www.fastmail.fm - Does exactly what it says on the tin
From c6ceb16b5aceeafa7bc6531471c5a550cd42c7c0 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg <bensberg@xxxxxxxxxxxxx> Date: Mon, 6 Feb 2012 16:01:48 +0100 Subject: [PATCH 1/7] textual: fix a few typos in some of the usage help texts Also improve clarity of some other lines of those texts. Signed-off-by: Benno Schulenberg <bensberg@xxxxxxxxxxxxx> --- misc-utils/look.c | 6 +++--- misc-utils/whereis.c | 8 ++++---- text-utils/more.c | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/misc-utils/look.c b/misc-utils/look.c index 351d007..7bbec1b 100644 --- a/misc-utils/look.c +++ b/misc-utils/look.c @@ -370,9 +370,9 @@ static void __attribute__ ((__noreturn__)) usage(FILE * out) _(" %s [options] string [file]\n"), program_invocation_short_name); fputs(_("\nOptions:\n"), out); - fputs(_(" -a, --alternative use alternate dictionary\n" - " -d, --alphanum compare only alpha numeric characters\n" - " -f, --ignore-case ignore when comparing\n" + fputs(_(" -a, --alternative use alternative dictionary\n" + " -d, --alphanum compare only alphanumeric characters\n" + " -f, --ignore-case ignore case differences when comparing\n" " -t, --terminate <char> define string termination character\n" " -V, --version output version information and exit\n" " -h, --help display this help and exit\n\n"), out); diff --git a/misc-utils/whereis.c b/misc-utils/whereis.c index ae4cc03..095ca62 100644 --- a/misc-utils/whereis.c +++ b/misc-utils/whereis.c @@ -142,13 +142,13 @@ static void __attribute__ ((__noreturn__)) usage(FILE * out) fputs(_("\nOptions:\n"), out); fputs(_(" -f <file> define search scope\n" - " -b search only binaries\n" + " -b search only for binaries\n" " -B <dirs> define binaries lookup path\n" - " -m search only manual paths\n" + " -m search only for manuals\n" " -M <dirs> define man lookup path\n" - " -s search only sources path\n" + " -s search only for sources\n" " -S <dirs> define sources lookup path\n" - " -u search from unusual entities\n" + " -u search for unusual entries\n" " -V output version information and exit\n" " -h display this help and exit\n\n"), out); diff --git a/text-utils/more.c b/text-utils/more.c index 41caeb1..03c6da7 100644 --- a/text-utils/more.c +++ b/text-utils/more.c @@ -319,8 +319,8 @@ static void __attribute__((__noreturn__)) usage(FILE *out) " -d display help instead of ring bell\n" " -f count logical, rather than screen lines\n" " -l suppress pause after form feed\n" - " -p suppress scroll, clean screen and display text\n" - " -c suppress scroll, display text and clean line ends\n" + " -p do not scroll, clean screen and display text\n" + " -c do not scroll, display text and clean line ends\n" " -u suppress underlining\n" " -s squeeze multiple blank lines into one\n" " -NUM specify the number of lines per screenful\n" -- 1.7.0.4
From e0acc1503a83c9e45532f90319b744e05f58d9c8 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg <bensberg@xxxxxxxxxxxxx> Date: Mon, 6 Feb 2012 16:04:33 +0100 Subject: [PATCH 2/7] textual: remove inconsistent periods from two error messages Signed-off-by: Benno Schulenberg <bensberg@xxxxxxxxxxxxx> --- sys-utils/fstrim.c | 2 +- text-utils/col.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys-utils/fstrim.c b/sys-utils/fstrim.c index 332601d..d3e446b 100644 --- a/sys-utils/fstrim.c +++ b/sys-utils/fstrim.c @@ -123,7 +123,7 @@ int main(int argc, char **argv) } if (optind == argc) - errx(EXIT_FAILURE, _("no mountpoint specified.")); + errx(EXIT_FAILURE, _("no mountpoint specified")); path = argv[optind++]; diff --git a/text-utils/col.c b/text-utils/col.c index f309fa2..4ad36fb 100644 --- a/text-utils/col.c +++ b/text-utils/col.c @@ -141,7 +141,7 @@ static void __attribute__((__noreturn__)) usage(FILE *out) static void __attribute__((__noreturn__)) wrerr(void) { - errx(EXIT_FAILURE, _("write error.")); + errx(EXIT_FAILURE, _("write error")); } int main(int argc, char **argv) -- 1.7.0.4
From 492678836206584527d921263e437f8ad6ad4747 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg <bensberg@xxxxxxxxxxxxx> Date: Mon, 6 Feb 2012 16:05:35 +0100 Subject: [PATCH 3/7] textual: tag two bug messages as "internal error" Signed-off-by: Benno Schulenberg <bensberg@xxxxxxxxxxxxx> --- schedutils/taskset.c | 3 +-- term-utils/ttymsg.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/schedutils/taskset.c b/schedutils/taskset.c index c1bb173..05f294c 100644 --- a/schedutils/taskset.c +++ b/schedutils/taskset.c @@ -93,8 +93,7 @@ static void print_affinity(struct taskset *ts, int isnew) } if (!str) - /* this is internal error... */ - errx(EXIT_FAILURE, _("conversion from cpuset to string failed")); + errx(EXIT_FAILURE, _("internal error: conversion from cpuset to string failed")); printf(msg, ts->pid, str); } diff --git a/term-utils/ttymsg.c b/term-utils/ttymsg.c index aea6c26..185e9bb 100644 --- a/term-utils/ttymsg.c +++ b/term-utils/ttymsg.c @@ -74,7 +74,7 @@ ttymsg(struct iovec *iov, size_t iovcnt, char *line, int tmout) { int fd, forked = 0, errsv; if (iovcnt > sizeof(localiov) / sizeof(localiov[0])) - return (_("too many iov's (change code in wall/ttymsg.c)")); + return (_("internal error: too many iov's")); /* The old code here rejected the line argument when it contained a '/', saying: "A slash may be an attempt to break security...". -- 1.7.0.4
From 9266bdfb000b8b31145f618e4e9823fb5b2fd442 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg <bensberg@xxxxxxxxxxxxx> Date: Mon, 6 Feb 2012 16:11:27 +0100 Subject: [PATCH 4/7] textual: gettextize several overlooked messages Also improve the clarity of some of them. Signed-off-by: Benno Schulenberg <bensberg@xxxxxxxxxxxxx> --- disk-utils/mkswap.c | 10 +++++----- misc-utils/rename.c | 3 +-- schedutils/chrt.c | 4 ++-- schedutils/ionice.c | 4 ++-- schedutils/taskset.c | 2 +- sys-utils/hwclock.c | 2 +- term-utils/agetty.c | 26 +++++++++++++------------- 7 files changed, 25 insertions(+), 26 deletions(-) diff --git a/disk-utils/mkswap.c b/disk-utils/mkswap.c index 415a985..4f59a63 100644 --- a/disk-utils/mkswap.c +++ b/disk-utils/mkswap.c @@ -434,7 +434,7 @@ wipe_device(int fd, const char *devname, int force) fprintf(stderr, _(" (%s partition table detected). "), type); else fprintf(stderr, _(" (compiled without libblkid). ")); - fprintf(stderr, "Use -f to force.\n"); + fprintf(stderr, _("Use -f to force.\n")); } #ifdef HAVE_LIBBLKID blkid_free_probe(pr); @@ -485,13 +485,13 @@ main(int argc, char **argv) { force=1; break; case 'p': - user_pagesize = strtou32_or_err(optarg, _("parse page size failed")); + user_pagesize = strtou32_or_err(optarg, _("parsing page size failed")); break; case 'L': opt_label = optarg; break; case 'v': - version = strtos32_or_err(optarg, _("parse version number failed")); + version = strtos32_or_err(optarg, _("parsing version number failed")); break; case 'U': #ifdef HAVE_LIBUUID @@ -515,7 +515,7 @@ main(int argc, char **argv) { if (optind < argc) block_count = argv[optind++]; if (optind != argc) { - warnx(("only one device as argument is currently supported.")); + warnx(_("only one device argument is currently supported")); usage(stderr); } @@ -526,7 +526,7 @@ main(int argc, char **argv) { #ifdef HAVE_LIBUUID if(opt_uuid) { if (uuid_parse(opt_uuid, uuid_dat) != 0) - errx(EXIT_FAILURE, _("error: UUID parsing failed")); + errx(EXIT_FAILURE, _("error: parsing UUID failed")); } else uuid_generate(uuid_dat); uuid = uuid_dat; diff --git a/misc-utils/rename.c b/misc-utils/rename.c index 21bd522..71da2eb 100644 --- a/misc-utils/rename.c +++ b/misc-utils/rename.c @@ -88,7 +88,6 @@ static int do_rename(char *from, char *to, char *s, int verbose, int symtarget) printf("`%s' -> `%s'\n", s, newname); } - free(newname); return 1; } @@ -148,7 +147,7 @@ int main(int argc, char **argv) argv += optind; if (argc < 3) { - warnx("not enough arguments"); + warnx(_("not enough arguments")); usage(stderr); } diff --git a/schedutils/chrt.c b/schedutils/chrt.c index be10076..0347914 100644 --- a/schedutils/chrt.c +++ b/schedutils/chrt.c @@ -263,8 +263,8 @@ int main(int argc, char **argv) verbose = 1; break; case 'V': - printf("%s from %s\n", program_invocation_short_name, - PACKAGE_STRING); + printf(_("%s from %s\n"), program_invocation_short_name, + PACKAGE_STRING); return EXIT_SUCCESS; case 'h': ret = EXIT_SUCCESS; diff --git a/schedutils/ionice.c b/schedutils/ionice.c index e25428d..f74e3c4 100644 --- a/schedutils/ionice.c +++ b/schedutils/ionice.c @@ -82,8 +82,8 @@ static void ioprio_print(int pid) name = to_prio[ioclass]; if (ioclass != IOPRIO_CLASS_IDLE) - printf("%s: prio %lu\n", name, - IOPRIO_PRIO_DATA(ioprio)); + printf(_("%s: priority %lu\n"), name, + IOPRIO_PRIO_DATA(ioprio)); else printf("%s\n", name); } diff --git a/schedutils/taskset.c b/schedutils/taskset.c index 05f294c..9039598 100644 --- a/schedutils/taskset.c +++ b/schedutils/taskset.c @@ -163,7 +163,7 @@ int main(int argc, char **argv) ts.use_list = 1; break; case 'V': - printf("%s from %s\n", program_invocation_short_name, + printf(_("%s from %s\n"), program_invocation_short_name, PACKAGE_STRING); return EXIT_SUCCESS; case 'h': diff --git a/sys-utils/hwclock.c b/sys-utils/hwclock.c index 04aa650..5235fb8 100644 --- a/sys-utils/hwclock.c +++ b/sys-utils/hwclock.c @@ -262,7 +262,7 @@ static int read_adjtime(struct adjtime *adjtime_p) adjfile = fopen(adj_file_name, "r"); /* open file for reading */ if (adjfile == NULL) { - warn("cannot open %s", adj_file_name); + warn(_("cannot open %s"), adj_file_name); return EX_OSFILE; } diff --git a/term-utils/agetty.c b/term-utils/agetty.c index ed97bc5..34b0afc 100644 --- a/term-utils/agetty.c +++ b/term-utils/agetty.c @@ -353,7 +353,7 @@ int main(int argc, char **argv) if (options.autolog) { /* Autologin prompt */ do_prompt(&options, &termios); - printf("%s%s (automatic login)\n", LOGIN, options.autolog); + printf(_("%s%s (automatic login)\n"), LOGIN, options.autolog); } else { /* Read the login name. */ debug("reading login name\n"); @@ -901,7 +901,7 @@ static void open_tty(char *tty, struct termios *tp, struct options *op) if (((tid = tcgetsid(fd)) < 0) || (pid != tid)) { if (ioctl(fd, TIOCSCTTY, 1) == -1) - log_warn("/dev/%s: cannot get controlling tty: %m", tty); + log_warn(_("/dev/%s: cannot get controlling tty: %m"), tty); } close(STDIN_FILENO); @@ -923,7 +923,7 @@ static void open_tty(char *tty, struct termios *tp, struct options *op) closed = 1; if (vhangup()) - log_err("/dev/%s: vhangup() failed: %m", tty); + log_err(_("/dev/%s: vhangup() failed: %m"), tty); } else close(fd); @@ -933,7 +933,7 @@ static void open_tty(char *tty, struct termios *tp, struct options *op) if (((tid = tcgetsid(STDIN_FILENO)) < 0) || (pid != tid)) { if (ioctl(STDIN_FILENO, TIOCSCTTY, 1) == -1) - log_warn("/dev/%s: cannot get controlling tty: %m", tty); + log_warn(_("/dev/%s: cannot get controlling tty: %m"), tty); } } else { @@ -949,7 +949,7 @@ static void open_tty(char *tty, struct termios *tp, struct options *op) } if (tcsetpgrp(STDIN_FILENO, pid)) - log_warn("/dev/%s: cannot set process group: %m", tty); + log_warn(_("/dev/%s: cannot set process group: %m"), tty); /* Get rid of the present outputs. */ if (!closed) { @@ -980,7 +980,7 @@ static void open_tty(char *tty, struct termios *tp, struct options *op) */ memset(tp, 0, sizeof(struct termios)); if (tcgetattr(STDIN_FILENO, tp) < 0) - log_err("%s: tcgetattr: %m", tty); + log_err(_("%s: failed to get terminal attributes: %m"), tty); /* * Detect if this is a virtual console or serial/modem line. @@ -1138,7 +1138,7 @@ static void reset_vc(const struct options *op, struct termios *tp) reset_virtual_console(tp, fl); if (tcsetattr(STDIN_FILENO, TCSADRAIN, tp)) - log_warn("tcsetattr problem: %m"); + log_warn(_("setting terminal attributes failed: %m")); } /* Extract baud rate from modem status message. */ @@ -1276,7 +1276,7 @@ static void do_prompt(struct options *op, struct termios *tp) } #endif /* ISSUE */ if (op->flags & F_LOGINPAUSE) { - puts("[press ENTER to login]"); + puts(_("[press ENTER to login]")); getc(stdin); } #ifdef KDGKBLED @@ -1497,7 +1497,7 @@ static char *get_logname(struct options *op, struct termios *tp, struct chardata len = mbstowcs((wchar_t *)0, logname, 0); if (len < 0) - log_err("%s: invalid character conversion for login name", op->tty); + log_err(_("%s: invalid character conversion for login name"), op->tty); wcs = (wchar_t *) malloc((len + 1) * sizeof(wchar_t)); if (!wcs) @@ -1505,13 +1505,13 @@ static char *get_logname(struct options *op, struct termios *tp, struct chardata len = mbstowcs(wcs, logname, len + 1); if (len < 0) - log_err("%s: invalid character conversion for login name", op->tty); + log_err(_("%s: invalid character conversion for login name"), op->tty); wcp = wcs; while (*wcp) { const wint_t wc = *wcp++; if (!iswprint(wc)) - log_err("%s: invalid character 0x%x in login name", op->tty, wc); + log_err(_("%s: invalid character 0x%x in login name"), op->tty, wc); } free(wcs); } else @@ -1596,7 +1596,7 @@ static void termio_final(struct options *op, struct termios *tp, struct chardata /* Finally, make the new settings effective. */ if (tcsetattr(STDIN_FILENO, TCSANOW, tp) < 0) - log_err("%s: tcsetattr: TCSANOW: %m", op->tty); + log_err(_("%s: failed to set terminal attributes: %m"), op->tty); } /* @@ -2053,6 +2053,6 @@ static void check_username(const char* nm) return; err: errno = EPERM; - log_err("checkname: %m"); + log_err(_("checkname failed: %m")); } -- 1.7.0.4
From fa70c76519d70878036481dda6d7cc15a48d0870 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg <bensberg@xxxxxxxxxxxxx> Date: Mon, 6 Feb 2012 16:37:16 +0100 Subject: [PATCH 5/7] textual: standardize reporting of program name plus package version Signed-off-by: Benno Schulenberg <bensberg@xxxxxxxxxxxxx> --- disk-utils/blockdev.c | 2 +- disk-utils/elvtune.c | 3 ++- disk-utils/mkfs.c | 5 +++-- misc-utils/blkid.c | 5 +++-- mount-deprecated/umount.c | 3 ++- sys-utils/flock.c | 3 ++- sys-utils/rtcwake.c | 3 ++- sys-utils/tunelp.c | 3 ++- text-utils/more.c | 3 ++- 9 files changed, 19 insertions(+), 11 deletions(-) diff --git a/disk-utils/blockdev.c b/disk-utils/blockdev.c index a9e8833..eb347b7 100644 --- a/disk-utils/blockdev.c +++ b/disk-utils/blockdev.c @@ -229,7 +229,7 @@ int main(int argc, char **argv) /* -V not together with commands */ if (!strcmp(argv[1], "-V") || !strcmp(argv[1], "--version")) { - printf(_("%s (%s)\n"), program_invocation_short_name, + printf(_("%s from %s\n"), program_invocation_short_name, PACKAGE_STRING); return EXIT_SUCCESS; } diff --git a/disk-utils/elvtune.c b/disk-utils/elvtune.c index 9f7fbf3..6aa01a2 100644 --- a/disk-utils/elvtune.c +++ b/disk-utils/elvtune.c @@ -64,7 +64,8 @@ usage(void) { static void version(void) { - fprintf(stderr, "elvtune (%s)\n", PACKAGE_STRING); + fprintf(stderr, _("%s from %s\n"), + program_invocation_short_name, PACKAGE_STRING); } int diff --git a/disk-utils/mkfs.c b/disk-utils/mkfs.c index dc2d2fd..1929a90 100644 --- a/disk-utils/mkfs.c +++ b/disk-utils/mkfs.c @@ -57,7 +57,7 @@ static void __attribute__ ((__noreturn__)) usage(FILE * out) static void __attribute__ ((__noreturn__)) print_version(void) { - printf(_("%s (%s)\n"), + printf(_("%s from %s\n"), program_invocation_short_name, PACKAGE_STRING); exit(EXIT_SUCCESS); } @@ -128,7 +128,8 @@ int main(int argc, char **argv) argv[--optind] = progname; if (verbose) { - printf(_("mkfs (%s)\n"), PACKAGE_STRING); + printf(_("%s from %s\n"), + program_invocation_short_name, PACKAGE_STRING); i = optind; while (argv[i]) printf("%s ", argv[i++]); diff --git a/misc-utils/blkid.c b/misc-utils/blkid.c index 856eba0..52e280f 100644 --- a/misc-utils/blkid.c +++ b/misc-utils/blkid.c @@ -56,8 +56,9 @@ int raw_chars; static void print_version(FILE *out) { - fprintf(out, "%s from %s (libblkid %s, %s)\n", - progname, PACKAGE_STRING, LIBBLKID_VERSION, LIBBLKID_DATE); + fprintf(out, "%s from %s (libblkid %s, %s)\n", + program_invocation_short_name, PACKAGE_STRING, + LIBBLKID_VERSION, LIBBLKID_DATE); } static void usage(int error) diff --git a/mount-deprecated/umount.c b/mount-deprecated/umount.c index 3820c67..da3b05b 100644 --- a/mount-deprecated/umount.c +++ b/mount-deprecated/umount.c @@ -811,7 +811,8 @@ main (int argc, char *argv[]) { ++verbose; break; case 'V': /* version */ - printf ("umount (%s)\n", PACKAGE_STRING); + printf(_("%s from %s\n"), + program_invocation_short_name, PACKAGE_STRING); exit (0); case 't': /* specify file system type */ types = optarg; diff --git a/sys-utils/flock.c b/sys-utils/flock.c index 50435e0..11c44b6 100644 --- a/sys-utils/flock.c +++ b/sys-utils/flock.c @@ -206,7 +206,8 @@ int main(int argc, char *argv[]) _("invalid exit code")); break; case 'V': - printf("flock (%s)\n", PACKAGE_STRING); + printf(_("%s from %s\n"), + program_invocation_short_name, PACKAGE_STRING); exit(EX_OK); default: /* optopt will be set if this was an unrecognized diff --git a/sys-utils/rtcwake.c b/sys-utils/rtcwake.c index 7a757ad..0edf7dc 100644 --- a/sys-utils/rtcwake.c +++ b/sys-utils/rtcwake.c @@ -461,7 +461,8 @@ int main(int argc, char **argv) break; case 'V': - printf(UTIL_LINUX_VERSION); + printf(_("%s from %s\n"), + program_invocation_short_name, PACKAGE_STRING); exit(EXIT_SUCCESS); case 'h': diff --git a/sys-utils/tunelp.c b/sys-utils/tunelp.c index 7313737..0486614 100644 --- a/sys-utils/tunelp.c +++ b/sys-utils/tunelp.c @@ -246,7 +246,8 @@ int main(int argc, char **argv) #endif case 'v': case 'V': - printf(UTIL_LINUX_VERSION); + printf(_("%s from %s\n"), + program_invocation_short_name, PACKAGE_STRING); return EXIT_SUCCESS; default: print_usage(stderr); diff --git a/text-utils/more.c b/text-utils/more.c index 03c6da7..cfa49af 100644 --- a/text-utils/more.c +++ b/text-utils/more.c @@ -564,7 +564,8 @@ void argscan(char *s) case '\t': break; case 'V': - printf(_("more (%s)\n"), PACKAGE_STRING); + printf(_("%s from %s\n"), + program_invocation_short_name, PACKAGE_STRING); exit(EXIT_SUCCESS); break; default: -- 1.7.0.4
From e461336274a55f9fe1ca0aa3173e766bfb27e489 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg <bensberg@xxxxxxxxxxxxx> Date: Mon, 6 Feb 2012 16:44:23 +0100 Subject: [PATCH 6/7] renice: correct the usage synopsis, and improve help text Signed-off-by: Benno Schulenberg <bensberg@xxxxxxxxxxxxx> --- sys-utils/renice.c | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-) diff --git a/sys-utils/renice.c b/sys-utils/renice.c index f5d51b6..aeede18 100644 --- a/sys-utils/renice.c +++ b/sys-utils/renice.c @@ -54,18 +54,18 @@ static void __attribute__((__noreturn__)) usage(FILE *out) { fputs(_("\nUsage:\n"), out); fprintf(out, - _(" %1$s [-n] <priority> [-p] <pid> [<pid> ...]\n" - " %1$s [-n] <priority> -g <pgrp> [<pgrp> ...]\n" - " %1$s [-n] <priority> -u <user> [<user> ...]\n"), + _(" %1$s [-n] <priority> [-p|--pid] <pid>...\n" + " %1$s [-n] <priority> -g|--pgrp <pgid>...\n" + " %1$s [-n] <priority> -u|--user <user>...\n"), program_invocation_short_name); fputs(_("\nOptions:\n"), out); - fputs(_(" -g, --pgrp <id> interpret as process group ID\n" - " -h, --help print help\n" - " -n, --priority <num> set the nice increment value\n" - " -p, --pid <id> force to be interpreted as process ID\n" - " -u, --user <name|id> interpret as username or user ID\n" - " -v, --version print version\n"), out); + fputs(_(" -g, --pgrp <id> interpret argument as process group ID\n" + " -n, --priority <num> specify the nice increment value\n" + " -p, --pid <id> interpret argument as process ID (default)\n" + " -u, --user <name|id> interpret argument as username or user ID\n" + " -h, --help display help text and exit\n" + " -v, --version display version information and exit\n"), out); fputs(_("\nFor more information see renice(1).\n"), out); -- 1.7.0.4
From 80b67441df8c165634a823bf595f6323c798c45c Mon Sep 17 00:00:00 2001 From: Benno Schulenberg <bensberg@xxxxxxxxxxxxx> Date: Mon, 6 Feb 2012 17:48:25 +0100 Subject: [PATCH 7/7] renice: accept also -V for --version, and document it Also improve the man page. Signed-off-by: Benno Schulenberg <bensberg@xxxxxxxxxxxxx> --- sys-utils/renice.1 | 66 +++++++++++++++++++++++---------------------------- sys-utils/renice.c | 11 ++++---- 2 files changed, 36 insertions(+), 41 deletions(-) diff --git a/sys-utils/renice.1 b/sys-utils/renice.1 index afffd9e..705138c 100644 --- a/sys-utils/renice.1 +++ b/sys-utils/renice.1 @@ -36,58 +36,52 @@ renice \- alter priority of running processes .SH SYNOPSIS .B renice --n priority [options] <pid> [...] +.RB [ \-n ] +.I priority +.RB [ \-gpu ] +.IR identifier ... .SH DESCRIPTION -.B Renice +.B renice alters the scheduling priority of one or more running processes. The -following -.I who -parameters are interpreted as process ID's, process group ID's, or user -names. -.BR Renice 'ing +first argument is the \fIpriority\fR value to be used. +The other arguments are interpreted as process IDs (by default), +process group IDs, user IDs, or user names. +.BR renice 'ing a process group causes all processes in the process group to have their scheduling priority altered. -.BR Renice 'ing +.BR renice 'ing a user causes all processes owned by the user to have their scheduling -priority altered. By default, the processes to be affected are specified by -their process ID's. +priority altered. .PP .SH OPTIONS .TP -\fB\-n\fR, \fB\-\-priority\fR \fIpriority\fR -The scheduling +.BR \-n , " \-\-priority " \fIpriority\fR +Specify the scheduling .I priority -of the process, process group, or user. Use of +to be used for the process, process group, or user. Use of the option .BR \-n " or " \-\-priority -can only exist as the first argument of -.B renice -command. +is optional, but when used it must be the first argument. .TP -\fB\-g\fR, \fB\-\-pgrp\fR \fIpgid\fR -Force -.I who -parameters to be interpreted as \fIprocess group ID\fR's. +.BR \-g , " \-\-pgrp " \fIpgid\fR... +Force the succeeding arguments to be interpreted as process group IDs. .TP -\fB\-u\fR, \fB\-\-user\fR \fIname\fR or \fIuid\fR -Force the -.I who -parameters to be interpreted as \fIuser name\fR or \fIid\fR. +.BR \-u , " \-\-user " \fIname_or_uid\fR... +Force the succeeding arguments to be interpreted as usernames or UIDs. .TP -\fB\-p\fR, \fB\-\-pid\fR \fIprocess id\fR -Resets the -.I who -interpretation to be (the default) \fIprocess ID\fR's. +.BR \-p , " \-\-pid " \fIpid\fR... +Force the succeeding arguments to be interpreted as process IDs +(the default). .TP -\fB\-v\fR, \fB\-\-version\fR -Print version. +.BR \-h , " \-\-help" +Display a help text. .TP -\fB\-h\fR, \fB\-\-help\fR -Print help. +.BR \-V , " \-\-version" +Display version information. .SH EXAMPLES +The following command would change the priority of the processes with +PIDs 987 and 32, plus all processes owned by the users daemon and root: .TP -.B renice +1 987 -u daemon root -p 32 -would change the priority of process ID's 987 and 32, and all processes owned -by users daemon and root. +.B " renice" +1 987 -u daemon root -p 32 .SH NOTES Users other than the super-user may only alter the priority of processes they own, and can only monotonically increase their ``nice value'' (for security @@ -105,7 +99,7 @@ negative (to make things go very fast). .SH FILES .TP .B /etc/passwd -to map user names to user ID's +to map user names to user IDs .SH SEE ALSO .BR getpriority (2), .BR setpriority (2) diff --git a/sys-utils/renice.c b/sys-utils/renice.c index aeede18..f401435 100644 --- a/sys-utils/renice.c +++ b/sys-utils/renice.c @@ -65,7 +65,7 @@ static void __attribute__((__noreturn__)) usage(FILE *out) " -p, --pid <id> interpret argument as process ID (default)\n" " -u, --user <name|id> interpret argument as username or user ID\n" " -h, --help display help text and exit\n" - " -v, --version display version information and exit\n"), out); + " -V, --version display version information and exit\n"), out); fputs(_("\nFor more information see renice(1).\n"), out); @@ -73,9 +73,8 @@ static void __attribute__((__noreturn__)) usage(FILE *out) } /* - * Change the priority (nice) of processes - * or groups of processes which are already - * running. + * Change the priority (the nice value) of processes + * or groups of processes which are already running. */ int main(int argc, char **argv) @@ -98,8 +97,10 @@ main(int argc, char **argv) usage(stdout); if (strcmp(*argv, "-v") == 0 || + strcmp(*argv, "-V") == 0 || strcmp(*argv, "--version") == 0) { - printf(_("renice from %s\n"), PACKAGE_STRING); + printf(_("%s from %s\n"), + program_invocation_short_name, PACKAGE_STRING); exit(EXIT_SUCCESS); } } -- 1.7.0.4