eOn Fri, May 11, 2018 at 01:53:58PM +0300, Kapetanakis Giannis wrote:
> Hi,
>
> By default we have:
>
> # relayctl show
> missing argument:
> valid commands/args:
> summary
> hosts
> redirects
> relays
> routers
> sessions
>
> On the other hand:
> # relayctl host
> usage: relayctl [-s socket] command [argument ...]
>
> # relayctl host dis
> missing argument:
> valid commands/args:
>
>
> I think it's better if it is like:
>
> # ./relayctl host
> missing argument:
> valid commands/args:
> disable
> enable
>
> same for table, redirect
>
Thanks, the diff looks fine
> If this is accepted maybe NOTOKEN can be completely removed from code.
>
It is just a value and it is better to keep it - the parser code is
somewhat generic and used by many tools in OpenBSD.
Reyk
> regards,
>
> G
>
> Index: parser.c
> ===
> RCS file: /cvs/src/usr.sbin/relayctl/parser.c,v
> retrieving revision 1.27
> diff -u -p -r1.27 parser.c
> --- parser.c22 Jan 2015 17:42:09 - 1.27
> +++ parser.c11 May 2018 10:52:11 -
> @@ -81,21 +81,18 @@ static const struct token t_show[] = {
> };
>
> static const struct token t_rdr[] = {
> - {NOTOKEN, "", NONE, NULL},
> {KEYWORD, "disable", RDR_DISABLE,t_rdr_id},
> {KEYWORD, "enable", RDR_ENABLE, t_rdr_id},
> {ENDTOKEN, "", NONE, NULL}
> };
>
> static const struct token t_table[] = {
> - {NOTOKEN, "", NONE, NULL},
> {KEYWORD, "disable", TABLE_DISABLE, t_table_id},
> {KEYWORD, "enable", TABLE_ENABLE, t_table_id},
> {ENDTOKEN, "", NONE, NULL}
> };
>
> static const struct token t_host[] = {
> - {NOTOKEN, "", NONE, NULL},
> {KEYWORD, "disable", HOST_DISABLE, t_host_id},
> {KEYWORD, "enable", HOST_ENABLE,t_host_id},
> {ENDTOKEN, "", NONE, NULL}
>
--