Exit with instruction to run --help if unknown option is encountered.
Before the following example printed error, but resulted to an attempt
to run argument.
$ x86_64 -x ls
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
static void __attribute__((__noreturn__))
show_usage(const char *s)
{
- errx(EXIT_FAILURE, _("%s\nTry `%s --help' for more information."), s, program_invocation_short_name);
+ if (s)
+ errx(EXIT_FAILURE, _("%s\nTry `%s --help' for more information."), s, program_invocation_short_name);
+ else
+ errx(EXIT_FAILURE, _("Try `%s --help' for more information."), program_invocation_short_name);
}
static void __attribute__((__noreturn__))
case OPT_UNAME26:
turn_on(UNAME26, options);
break;
+ default:
+ show_usage(NULL);
}
}