]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
kill: support --list=<signal>
authorKarel Zak <kzak@redhat.com>
Wed, 13 Mar 2013 15:02:55 +0000 (16:02 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 13 Mar 2013 15:02:55 +0000 (16:02 +0100)
The '=' is expected for optional arguments and required in procps version.

Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/kill.1
misc-utils/kill.c

index 34d3dfa68e4462f1e53acd17e01cae7f7ead456a..50f5cd206190d19c43ecabc0159b67e726868938 100644 (file)
@@ -71,7 +71,8 @@ Specify the signal to send.  The signal may be given as a signal name or
 number.
 .TP
 \fB\-l\fR, \fB\-\-list\fR [\fIsignal\fR]
-Print a list of signal names.  These are found in
+Print a list of signal names, or convert signal given as argument to a name.
+The signals are found in
 .I /usr/\:include/\:linux/\:signal.h
 .TP
 \fB\-L\fR, \fB\-\-table\fR
index 9b6640be5a51033779603b3ddf459d61ef1878a7..63fc2acdcb6f4daa5e1c1da2d84b5fb657b668db 100644 (file)
@@ -197,9 +197,8 @@ int main (int argc, char *argv[])
                printsignals (stdout, 0);
                return EXIT_SUCCESS;
            }
-           if (argc > 2) {
+           if (argc > 2)
                return usage (EXIT_FAILURE);
-           }
            /* argc == 2, accept "kill -l $?" */
            arg = argv[1];
            if ((numsig = arg_to_signum (arg, 1)) < 0)
@@ -207,6 +206,14 @@ int main (int argc, char *argv[])
            printsig (numsig);
            return EXIT_SUCCESS;
        }
+       /* for compatibility with procps kill(1) */
+       if (! strncmp (arg, "--list=", 7) || ! strncmp (arg, "-l=", 3)) {
+               char *p = strchr(arg, '=') + 1;
+               if ((numsig = arg_to_signum(p, 1)) < 0)
+                       errx(EXIT_FAILURE, _("unknown signal: %s"), p);
+               printsig (numsig);
+               return EXIT_SUCCESS;
+       }
        if (! strcmp (arg, "-L") || ! strcmp (arg, "--table")) {
            printsignals (stdout, 1);
            return EXIT_SUCCESS;
@@ -453,13 +460,13 @@ static int usage(int status)
        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(_(" -L, --table         list signal names and numbers\n"), 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 [=<signal>] list signal names, or convert one to a name\n"), out);
+       fputs(_(" -L, --table            list signal names and numbers\n"), out);
        fputs(USAGE_SEPARATOR, out);
        fputs(USAGE_HELP, out);
        fputs(USAGE_VERSION, out);