diff options
author | Sami Kerola | 2013-03-06 23:28:39 +0100 |
---|---|---|
committer | Karel Zak | 2013-03-12 14:41:13 +0100 |
commit | a5618319e6facc2632fa159306dea5cabbc05cb2 (patch) | |
tree | f7696b215cfb4a32766c7188e904b575318fa153 /misc-utils/kill.c | |
parent | kill: add long options (diff) | |
download | kernel-qcow2-util-linux-a5618319e6facc2632fa159306dea5cabbc05cb2.tar.gz kernel-qcow2-util-linux-a5618319e6facc2632fa159306dea5cabbc05cb2.tar.xz kernel-qcow2-util-linux-a5618319e6facc2632fa159306dea5cabbc05cb2.zip |
kill: align with howto-usage-function.txt
[kzak@redhad.com: - s/commandname/name/
- improve --all description
- add -h/--help]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'misc-utils/kill.c')
-rw-r--r-- | misc-utils/kill.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/misc-utils/kill.c b/misc-utils/kill.c index e43f23aaf..7b53593ac 100644 --- a/misc-utils/kill.c +++ b/misc-utils/kill.c @@ -193,6 +193,9 @@ int main (int argc, char *argv[]) printf(UTIL_LINUX_VERSION); return 0; } + if (! strcmp (arg, "-h") || ! strcmp (arg, "--help")) + return usage(0); + if (! strcmp (arg, "-a") || ! strcmp (arg, "--all")) { check_all++; continue; @@ -405,14 +408,25 @@ static void printsignals (FILE *fp) fputc ('\n', fp); } -static int usage (int status) +static int usage(int status) { - FILE *fp; - - fp = (status == 0 ? stdout : stderr); - fprintf (fp, _("usage: %s [ -s signal | -p ] [ -a ] pid ...\n"), progname); - fprintf (fp, _(" %s -l [ signal ]\n"), progname); - return status; + FILE *out = (status == 0 ? stdout : stderr); + + fputs(USAGE_HEADER, out); + fprintf(out, _(" %s [options] <pid|name> [...]\n"), program_invocation_short_name); + fputs(USAGE_OPTIONS, out); + fputs(_(" -a, --all do not restrict the name-to-pid conversion to processes\n" + " with the same uid as the present process\n"), out); + fputs(_(" -s, --signal <sig> send specified signal\n"), out); + fputs(_(" -q, --queue <sig> use sigqueue(2) rather than kill(2)\n"), out); + fputs(_(" -p, --pid print pids without signaling them\n"), out); + fputs(_(" -l, --list <name> list signal names\n"), out); + fputs(USAGE_SEPARATOR, out); + fputs(USAGE_HELP, out); + fputs(USAGE_VERSION, out); + fprintf(out, USAGE_MAN_TAIL("kill(1)")); + + return status; } static int kill_verbose (char *procname, int pid, int sig) |