From: Jim Meyering Date: Sat, 10 May 2003 15:45:00 +0000 (+0000) Subject: (send_signals): Don't check command line arguments here. X-Git-Tag: v5.0.1~537 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e2cad9b45721bc631aeebf76ba84c0ae571b6d1b;p=thirdparty%2Fcoreutils.git (send_signals): Don't check command line arguments here. (main): Check them here instead. Handle argc < optind. --- diff --git a/src/kill.c b/src/kill.c index 32ae99b38a..cd33366d14 100644 --- a/src/kill.c +++ b/src/kill.c @@ -259,12 +259,6 @@ send_signals (int signum, char *const *argv) int status = EXIT_SUCCESS; char const *arg = *argv; - if (! arg) - { - error (0, 0, _("missing operand after `%s'"), argv[-1]); - usage (EXIT_FAILURE); - } - do { char *endp; @@ -370,7 +364,13 @@ main (int argc, char **argv) usage (EXIT_FAILURE); } + if ( ! list && argc <= optind) + { + error (0, 0, _("no process ID specified")); + usage (EXIT_FAILURE); + } + return (list - ? list_signals (table, optind == argc ? NULL : argv + optind) - : send_signals (signum, argv + optind)); + ? list_signals (table, optind < argc ? argv + optind : NULL) + : send_signals (signum, argv)); }