]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
kill: align with howto-usage-function.txt
authorSami Kerola <kerolasa@iki.fi>
Wed, 6 Mar 2013 22:28:39 +0000 (22:28 +0000)
committerKarel Zak <kzak@redhat.com>
Tue, 12 Mar 2013 13:41:13 +0000 (14:41 +0100)
[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>
misc-utils/kill.c

index e43f23aaf034855c99d3f47f1347b94798085f1b..7b53593ac71c1852471c5f204b0f995ecc4212ee 100644 (file)
@@ -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)