From: Phil Sutter <phil@nwl.cc>
To: Florian Westphal <fw@strlen.de>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>, netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nft] main: enforce options before commands
Date: Fri, 13 Dec 2019 13:31:29 +0100 [thread overview]
Message-ID: <20191213123129.GC14465@orbyte.nwl.cc> (raw)
In-Reply-To: <20191213104033.GQ795@breakpoint.cc>
On Fri, Dec 13, 2019 at 11:40:33AM +0100, Florian Westphal wrote:
> Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> > This patch turns on POSIXLY_CORRECT on the getopt parser to enforce
> > options before commands. Users get a hint in such a case:
> >
> > # nft list ruleset -a
> > Error: syntax error, options must be specified before commands
> > nft list ruleset -a
>
> FWIW i like this better than the attempt to sanitize/escape argv[].
I just realize my reordering idea will need to check for flags accepting
parameters as well. With getopt's flexibility, determining if a
parameter is or contains option X quickly blows up into implementing a
poor man's getopt parser itself.
Maybe we should indeed just go with "no flags after first non-flag
allowed" and document that in man page.
Cheers, Phil
prev parent reply other threads:[~2019-12-13 20:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-13 10:32 [PATCH nft] main: enforce options before commands Pablo Neira Ayuso
2019-12-13 10:40 ` Florian Westphal
2019-12-13 12:31 ` Phil Sutter [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191213123129.GC14465@orbyte.nwl.cc \
--to=phil@nwl.cc \
--cc=fw@strlen.de \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox