1
0
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:
Jim Meyering
2003-05-10 15:45:00 +00:00
parent 9153514495
commit e2cad9b457

View File

@@ -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));
}