On Thursday 2019-12-12 18:45, Phil Sutter wrote: >[...] >> diff --git a/src/main.c b/src/main.c >> index fde8b15c5870..c96953e3cd2f 100644 >> --- a/src/main.c >> +++ b/src/main.c >> +static int nft_opts_init(int argc, char * const argv[], struct nft_opts *opts) >> +{ >> + uint32_t scope = 0; >> + char *new_argv; >> + int i; >> + >> + opts->argv = calloc(argc + 1, sizeof(char *)); >> + if (!opts->argv) >> + return -1; >> + >> + for (i = 0; i < argc; i++) { >> + if (scope > 0) { >> + if (argv[i][0] == '-') { >> + new_argv = malloc(strlen(argv[i]) + 2); [...] Or simply stop taking options after the first-non option. This is declared POSIX behavior, and, for glibc, it only needs the POSIXLY_CORRECT environment variable, which can be set ahead of getopt()/getopt_long() call and unset afterwards again.