On Thu, Jan 29, 2015 at 10:16 AM, Bernhard Reutner-Fischer <[email protected]> wrote: > I have this applet lying around in my tree for some time now. > Denys, ok for me to install this one? > > An alternative would of course be to start a multicall shell script, say > busybox.sh, installed as /bin/busybox.sh, linked to e.g. > /usr/bin/mcookie like: > > ---8<--- > #!/bin/sh > # Copyright (c) 2012 Bernhard Reutner-Fischer > # Licensed under GPLv2 or later > > case $0 in > *mcookie) > dd if=/dev/urandom bs=16 count=1 2>/dev/null | hexdump -e '"%08x"' > ;; > *) cat <<-EOH > BusyBox v1.24.0.git (2015-01-21 19:22:23 CET) multi-call shell script > BusyBox is copyrighted by many authors between 1998-2015. > Licensed under GPLv2 or later. See source distribution for detailed > copyright notices. > EOH > ;; > esac > ---8<--- > > I can whip up the needed infrastructure to host this "applet" and other > such helpers that can be implemented ontop of existing C applets if you > prefer.
I certainly prefer this! There are a few candidates already in applets_sh/* I feel it is not obvious it makes sense to have a multi-call shell script. What are we saving this way? Do we plan to have many helper functions there? If not, then there is no net win on file size, even some losses - you need to have case statement to run different applets. There is another problem. applets_sh/unix2dos: #!/bin/sh [ $# -ne 0 ] && DASH_I=-i sed $DASH_I -e 's/$/\r/' "$@" This would break if any of "$@" start with dash. If we do this: [ $# -ne 0 ] && DASH_I="-i --" sed -e 's/$/\r/' $DASH_I "$@" then any argument will be treated as a filename, even "-something" or "--" (!!!!) or "--help" - this can break scripts, since unix2dos _has_ options, and people can call it with options. http://linux.die.net/man/1/unix2dos So, maybe we _will_ need non-trivial helper functions to massage arg lists, handle --help etc, after all. _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
