diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2010-10-08 14:20:46 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2010-10-08 15:30:43 +0200 |
commit | 914e2f8f7f8a0632a538767f3cc6546a7223f91c (patch) | |
tree | 72966d1cb1bc4b3b824d0ea610868509eb9dda33 /common/Kconfig | |
parent | 97b2a33c50b69acdf9fd0ea3f1fb303c7fd38372 (diff) | |
download | barebox-914e2f8f7f8a0632a538767f3cc6546a7223f91c.tar.gz barebox-914e2f8f7f8a0632a538767f3cc6546a7223f91c.tar.xz |
hush: implement getopt builtin
Positional parameters are not nice, so implement a getopt
function. This has to be done as a builtin because otherwise
we have no access to the parents argc/argv.
getopt works as expected, here is a little example:
while getopt "hs:" OPT
do
if [ $OPT = h ]; then
echo "usage"
exit 1
else
echo "scr: opt: $OPT optarg: $OPTARG"
fi
done
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/Kconfig')
-rw-r--r-- | common/Kconfig | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/common/Kconfig b/common/Kconfig index ad70cde4f3..123d07086e 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -248,6 +248,13 @@ config HUSH_FANCY_PROMPT Allow to set PS1 from the command line. PS1 can have several escaped commands like \h for CONFIG_BOARDINFO or \w for the current working directory. +config HUSH_GETOPT + bool + depends on SHELL_HUSH + prompt "enable builtin getopt" + help + This enables a getopt function builtin to hush. + config CMDLINE_EDITING bool prompt "Enable command line editing" |