aboutsummaryrefslogtreecommitdiff
path: root/toys
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2016-10-01 15:52:00 -0500
committerRob Landley <rob@landley.net>2016-10-01 15:52:00 -0500
commit29e75d51d447c5c0aae9834f5988b79a945c7acc (patch)
tree4756abead6d275c824c63df0027ede9008ada3bb /toys
parent3366af7aa8212dfa9838fdfd17bae7909eb3797d (diff)
downloadtoybox-29e75d51d447c5c0aae9834f5988b79a945c7acc.tar.gz
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.
Diffstat (limited to 'toys')
-rw-r--r--toys/posix/sed.c5
1 files changed, 4 insertions, 1 deletions
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.