diff options
author | Christopher Faylor <me@cgf.cx> | 2003-09-20 20:24:33 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2003-09-20 20:24:33 +0000 |
commit | 7ed1b504b6411ca1d27009e73bde7f053dbf65fd (patch) | |
tree | 37833ba89e48b6d0dbdf0a4a7914e748c70b0dd4 /winsup/utils | |
parent | 0199487e6a7933f9a6757c77a409c6a8b271d1d3 (diff) | |
download | newlib-7ed1b504b6411ca1d27009e73bde7f053dbf65fd.zip newlib-7ed1b504b6411ca1d27009e73bde7f053dbf65fd.tar.gz newlib-7ed1b504b6411ca1d27009e73bde7f053dbf65fd.tar.bz2 |
* kill.cc (main): Allow negative pids (indicates process groups).
Diffstat (limited to 'winsup/utils')
-rw-r--r-- | winsup/utils/ChangeLog | 4 | ||||
-rw-r--r-- | winsup/utils/kill.cc | 17 |
2 files changed, 18 insertions, 3 deletions
diff --git a/winsup/utils/ChangeLog b/winsup/utils/ChangeLog index 62399be..819c5b1 100644 --- a/winsup/utils/ChangeLog +++ b/winsup/utils/ChangeLog @@ -1,3 +1,7 @@ +2003-09-20 Christopher Faylor <cgf@redhat.com> + + * kill.cc (main): Allow negative pids (indicates process groups). + 2003-09-17 Christopher Faylor <cgf@redhat.com> * parse_pe.cc (exclusion::sort_and_check): Make error message a little diff --git a/winsup/utils/kill.cc b/winsup/utils/kill.cc index 8067cf8..a4dba05 100644 --- a/winsup/utils/kill.cc +++ b/winsup/utils/kill.cc @@ -164,6 +164,10 @@ main (int argc, char **argv) usage (); opterr = 0; + + char *p; + int pid = 0; + for (;;) { int ch; @@ -201,7 +205,12 @@ main (int argc, char **argv) break; case '?': if (gotasig) - usage (); + { + pid = strtol (argv[optind], &p, 10); + if (pid < 0) + goto out; + usage (); + } optreset = 1; optind = 1 + av - argv; gotasig = *av + 1; @@ -213,13 +222,14 @@ main (int argc, char **argv) } } +out: test_for_unknown_sig (sig, gotasig); argv += optind; while (*argv != NULL) { - char *p; - int pid = strtol (*argv, &p, 10); + if (!pid) + pid = strtol (*argv, &p, 10); if (*p != '\0') { fprintf (stderr, "%s: illegal pid: %s\n", prog_name, *argv); @@ -240,6 +250,7 @@ main (int argc, char **argv) ret = 1; } argv++; + pid = 0; } return ret; } |