[PATCH 3/3] hush: implement getopt builtin
Sascha Hauer
s.hauer at pengutronix.de
Fri Oct 8 08:45:15 EDT 2010
On Fri, Oct 08, 2010 at 02:36:27PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 14:24 Fri 08 Oct , Sascha Hauer wrote:
> > 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 at pengutronix.de>
> how about make it optional?
Probably a good idea. I just had in mind that we need to adjust
the defconfigs then to still have a working defaultenv.
How about making it optional and combined with your defaultenv-Kconfig
patch we could do a
select HUSH
select HUSH_GETOPT
to make sure all commands needed by the defaultenv are in place.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
More information about the barebox
mailing list