From 29e75d51d447c5c0aae9834f5988b79a945c7acc Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sat, 1 Oct 2016 15:52:00 -0500 Subject: Move --version handling next to --help handling, so it applies to all commands. Say "toybox" before version string. Tweak sed to preserve lie-to-autoconf. --- toys/posix/sed.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'toys/posix/sed.c') diff --git a/toys/posix/sed.c b/toys/posix/sed.c index 31268ece..9169e077 100644 --- a/toys/posix/sed.c +++ b/toys/posix/sed.c @@ -10,7 +10,7 @@ * TODO: handle error return from emit(), error_msg/exit consistently * What's the right thing to do for -i when write fails? Skip to next? -USE_SED(NEWTOY(sed, "(version)e*f*inEr[+Er]", TOYFLAG_USR|TOYFLAG_BIN|TOYFLAG_LOCALE)) +USE_SED(NEWTOY(sed, "(help)(version)e*f*inEr[+Er]", TOYFLAG_USR|TOYFLAG_BIN|TOYFLAG_LOCALE|TOYFLAG_NOHELP)) config SED bool "sed" @@ -1001,6 +1001,9 @@ void sed_main(void) return; } + // Handling our own --version means we handle our own --help too. + if (toys.optflags&FLAG_help) help_exit(0); + // Parse pattern into commands. // If no -e or -f, first argument is the pattern. -- cgit v1.2.3