Hello,

On Tue, Jan 01, 2019 at 08:17:43PM +0100, Klemens Nanni wrote:
> Synopsis is `[-t table -T command [address ...]]', yet tables without
> commands are silently ignored:
> 
>       $ pfctl -t t
>       pfctl: /dev/pf: Permission denied
>       # pfctl -t t ; echo $?
>       0
> 
> Commands without tables are catched, but only after opening pf(4):
> 
>       $ pfctl -T show
>       pfctl: /dev/pf: Permission denied
>       # pfctl -T show
>       pfctl [-deghNnPqrvz] [-a anchor] [-D macro=value] [-F modifier] [-f 
> file]
>             [-i interface] [-K key] [-k key] [-L statefile] [-o level] [-p 
> device]
>             [-S statefile] [-s modifier [-R id]] [-t table -T command 
> [address ...]]
>             [-V rdomain] [-x level]
>       1
> 
> By moving the inter-dependence check right after option parsing is done,
> we can bail out much earlier and drop the internal wrapper
> pfctl_command_tables() as unneeded indirection with now duplicate checks.
> 
> With this diff both examples will show usage without doing anything as
> expected.  There's no other user of this wrapper.
> 
> Feedback? OK?

    make sense to me. I'm OK with no objections.

</snip>

    this piece I like the most:

> +     if (tblcmdopt == NULL ^ tableopt == NULL)
> +             usage();
> +

OK sashan

Reply via email to