On Fri, Dec 13, 2019 at 11:40:33AM +0100, Florian Westphal wrote: > Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx> 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