Bash is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
-Software Foundation; either version 1, or (at your option) any later
+Software Foundation; either version 2, or (at your option) any later
version.
Bash is distributed in the hope that it will be useful, but WITHOUT ANY
You should have received a copy of the GNU General Public License along
with Bash; see the file COPYING. If not, write to the Free Software
-Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA.
$PRODUCES kill.c
#include <stdio.h>
#include <errno.h>
#if defined (HAVE_UNISTD_H)
+# ifdef _MINIX
+# include <sys/types.h>
+# endif
# include <unistd.h>
#endif
#if defined (JOB_CONTROL)
extern int interactive;
+extern int job_control;
extern int posixly_correct;
#if !defined (CONTINUE_AFTER_KILL_ERROR)
pid_t pid;
if (list == 0)
- return (EXECUTION_SUCCESS);
+ {
+ builtin_usage ();
+ return (EXECUTION_FAILURE);
+ }
any_succeeded = listing = saw_signal = 0;
signal = SIGTERM;
return (EXECUTION_FAILURE);
}
+ if (list == 0)
+ {
+ builtin_usage ();
+ return (EXECUTION_FAILURE);
+ }
+
while (list)
{
word = list->word->word;
if (*word == '-')
word++;
- if (all_digits (word))
+ if (*word && all_digits (word))
{
/* Use the entire argument in case of minus sign presence. */
pid = (pid_t) atoi (list->word->word);
else
any_succeeded++;
}
- else if (*list->word->word != '%')
+ else if (*list->word->word && *list->word->word != '%')
{
builtin_error ("%s: no such pid", list->word->word);
CONTINUE_OR_FAIL;
}
- else if (interactive)
+ else if (*word && (interactive || job_control))
/* Posix.2 says you can kill without job control active (4.32.4) */
{ /* Must be a job spec. Check it out. */
int job;
}
else
{
- builtin_error ("`%s' is not a pid or valid job spec", list->word->word);
+ builtin_error ("`%s': not a pid or valid job spec", list->word->word);
CONTINUE_OR_FAIL;
}
continue_killing: