On Sunday 22 August 2010 01:47, Rob Landley wrote:
> So I'm trying to build a Gentoo Stage 1 on top of busybox, uClibc, and a
> native toolchain, and emerge is hanging doing this:
> 
> patch -p0 --dry-run 
> /var/tmp/portage/sys-apps/util-linux-2.17.2/work/util-linux-ng-2.17.2/config/install-sh
>  install-
> sh/1.5.6
> 
> That's the first time I've ever actually seen anything use the patch behavior:
> 
> patch [options] [file-to-patch [patchfile]]
> 
> So if there's an unused extra filename, it's the name of the file to patch
> (overriding the +++ and --- lines for all hunks, apparently), and if there's
> an extra file after that it works like -i was specified.

Wow. bbox had this in help text, but did not actually support.


> I know how to make toybox do that (option parsing happens before main() gets
> called, the stuff your option string expresses interest in gets filled out in
> your global struct, and the remaining option array is toys.optargs[]), but
> have no idea how to make the strange getopt32() stuff busybox is using do that
> (you have to pass varargs to your function call and then the optargs wind up
> where?

Similarly to getopt, after getopt32() argv[optind] is the first non-option
parameter. I usually put   argv += optind;   right after getopt32(),
which means I can use argv[0] after that (smaller code).


> And if you need to pluck interspersied -options out of the leftover 
> optargs you reorder the argv[] passed into you by the environment so you
> contaminate what ps shows?

I think only argv[] pointers are permutated, not the strings they point to.


Anyway, here's the fix in busybox git:

http://git.busybox.net/busybox/commit/?id=e7b0a9e5bc60617fb00c321430253d7771d40fd3

Let me know whether it works for you.
-- 
vda
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to