mirror of
git://git.sv.gnu.org/coreutils.git
synced 2026-04-20 02:36:16 +02:00
(send_signals): Don't check command line arguments here.
(main): Check them here instead. Handle argc < optind.
This commit is contained in:
16
src/kill.c
16
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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user