Commit Graph

30 Commits

Author SHA1 Message Date
Benno Schulenberg 09638694d4 textual: use angular brackets around each individual argument
In usage texts each word that is an argument should be marked
separately with angular brackets.  Also add a translator comment.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2014-10-01 09:37:02 +02:00
Sami Kerola 94b1623be3 renice: reorder usage() option descriptions
Make the Usage: and Options: sections to be in same order, which I found
to be quicker to use than alphabetical order.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-09-19 19:31:13 +01:00
Sami Kerola ce4030e484 rename: add getpriority() message lookup table
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-09-19 19:31:13 +01:00
Sami Kerola 80ca9e2039 renice: fix numeric uid argument parsing
The following was inconflict with what usage() tells are valid option
arguments.

$ renice 1 -u 1000
renice: unknown user 1000
$ id
uid=1000(kerolasa) ...

Reviewed-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-09-19 19:31:13 +01:00
Sami Kerola 00b490f002 renice: avoid having same lines of code twice
Add getprio() function to avoid duplication of a simple task.

Reviewed-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-09-19 19:31:13 +01:00
Sami Kerola 0bb01bb0b7 renice: disallow --priority <arg> without pid argument
Earlier a lonely priority with an argument but without pid resulted to no
action and success, when the invocation should have failed.

$ renice --priority 42 ; echo $?
0

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-09-19 19:31:12 +01:00
Sami Kerola 6dcc066f3b rename: use usage and version print out macros
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-09-19 19:31:12 +01:00
Sami Kerola 5ebcab664e renice: reorder functions to avoid need of function prototype
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-09-19 19:31:12 +01:00
Sami Kerola 665b3c8572 renice: exit with non-zero value when arguments cause warnings
This commit also fixes potential error counter wrap, which theoretically
could make command to exit with a success when it internally failed just
correct amount of times.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-07-01 11:07:19 +02:00
Benno Schulenberg b50945d4ac textual: spell and encode the name of Arkadiusz Miśkiewicz correctly
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2013-02-06 11:15:02 +01:00
Benno Schulenberg 5cc224f552 renice: accept also -V for --version, and document it
Also improve the man page.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2013-01-25 11:47:33 +01:00
Benno Schulenberg ae3ca2aacc renice: correct the usage synopsis, and improve help text
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2013-01-25 11:47:30 +01:00
Sami Kerola efb8854f4c sys-utils: verify writing to streams was successful
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-04-04 19:49:40 +02:00
Karel Zak ae1ae49e78 renice: cleanup usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-16 13:20:54 +02:00
Fabian Groffen eb76ca98b0 build-sys: provide alternatives for err, errx, warn and warnx
Solaris lacks err, errx, warn and warnx.  This also means the err.h header
doesn't exist.  Removed err.h include from all files, and included err.h from
c.h instead if it exists, otherwise alternatives are provided.

Signed-off-by: Fabian Groffen <grobian@gentoo.org>
2011-02-14 17:45:24 +01:00
Karel Zak abafd68667 fix __noreturn__ usage
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-12-10 16:47:18 +01:00
Francesco Cosoleto 8aa5046647 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>
2010-12-09 23:07:41 +01:00
Karel Zak 296351b0f1 renice: rewrite usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-11-30 12:46:06 +01:00
Francesco Cosoleto 40cebc2d6f renice: reverse %s position in error messages
Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
2010-11-30 12:28:17 +01:00
Francesco Cosoleto 83fa126b93 renice: remove hardcoded program name using warn() and warnx()
Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
2010-11-30 12:28:17 +01:00
Francesco Cosoleto 22e0d3ec97 renice: make some functions static 2010-11-30 12:28:17 +01:00
Karel Zak 7cfbafda9c renice: add -n option for compatibility with POSIX
The -n option is required by POSIX.1-200x.

Signed-off-by: Karel Zak <kzak@redhat.com>
2009-03-09 21:09:50 +01:00
LaMont Jones 628cab7cde renice: detect errors in arguments, add -v, -h and long options
* renice was using atoi(), which does no error detection, meaning
   that: "renice +20 blah" was accepted as valid.

 * add -h | --help

 * add -v | --version

 * add long options for -p, -u and -g

 * cleanup coding style

Addresses-Debian-Bug: #385245
Co-Author: Karel Zak <kzak@redhat.com>
Signed-off-by: LaMont Jones <lamont@debian.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2008-01-29 15:31:47 +01:00
Karel Zak e8f2641919 Imported from util-linux-2.11m tarball. 2006-12-07 00:25:49 +01:00
Karel Zak c07ebfa1e0 Imported from util-linux-2.11b tarball. 2006-12-07 00:25:46 +01:00
Karel Zak 66ee8158b6 Imported from util-linux-2.10s tarball. 2006-12-07 00:25:44 +01:00
Karel Zak 7eda085c41 Imported from util-linux-2.9v tarball. 2006-12-07 00:25:39 +01:00
Karel Zak 2b6fc908bc Imported from util-linux-2.8 tarball. 2006-12-07 00:25:35 +01:00
Karel Zak fd6b7a7ffc Imported from util-linux-2.7.1 tarball. 2006-12-07 00:25:34 +01:00
Karel Zak 6dbe3af945 Imported from util-linux-2.2 tarball. 2006-12-07 00:25:32 +01:00