aboutsummaryrefslogtreecommitdiff
path: root/toys/posix/sed.c
diff options
context:
space:
mode:
Diffstat (limited to 'toys/posix/sed.c')
-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.