Re: [PATCH 1/7] kill: make options --pid and --queue mutually exclusive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/12/2014 12:28 PM, Sami Kerola wrote:
> Signed-off-by: Sami Kerola <kerolasa@xxxxxx>
> ---
>  misc-utils/kill.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/misc-utils/kill.c b/misc-utils/kill.c
> index d461b36..e678661 100644
> --- a/misc-utils/kill.c
> +++ b/misc-utils/kill.c
> @@ -381,6 +381,10 @@ static char **parse_arguments(int argc, char **argv, struct kill_control *ctl)
>  			ctl->do_pid = 1;
>  			if (ctl->do_kill)
>  				errx(EXIT_FAILURE, _("%s and %s are mutually exclusive"), "--pid", "--signal");
> +#ifdef HAVE_SIGQUEUE
> +			if (ctl->use_sigval)
> +				errx(EXIT_FAILURE, _("%s and %s are mutually exclusive"), "--pid", "--queue");
> +#endif
>  			continue;
>  		}
>  		if (!strcmp(arg, "-s") || !strcmp(arg, "--signal")) {
> @@ -399,6 +403,8 @@ static char **parse_arguments(int argc, char **argv, struct kill_control *ctl)
>  		if (!strcmp(arg, "-q") || !strcmp(arg, "--queue")) {
>  			if (argc < 2)
>  				errx(EXIT_FAILURE, _("option '%s' requires an argument"), arg);
> +			if (ctl->do_pid)
> +				errx(EXIT_FAILURE, _("%s and %s are mutually exclusive"), "--pid", "--queue");
>  			argc--, argv++;
>  			arg = *argv;
>  			if ((ctl->numsig = arg_to_signum(arg, 0)) < 0)
> 

Ain't this a good case for
  err_exclusive_options(c, longopts, excl, excl_st);
?

Have a nice day,
Berny


--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux