Mercurial > hg > toybox
diff main.c @ 1676:cbb1aca81eca draft
Make toy_exec() check if argc is in optargs and deal with it there so we don't need a separate xexec_optargs().
author | Rob Landley <rob@landley.net> |
---|---|
date | Sat, 07 Feb 2015 16:17:44 -0600 |
parents | 10922d83392a |
children | 31475e814232 |
line wrap: on
line diff
--- a/main.c Sat Feb 07 15:32:22 2015 -0600 +++ b/main.c Sat Feb 07 16:17:44 2015 -0600 @@ -127,6 +127,9 @@ { struct toy_list *which; + // don't blank old optargs if our new argc lives in the old optargs. + if (argv>=toys.optargs && argv<=toys.optargs+toys.optc) toys.optargs = 0; + // Return if we can't find it, or need to re-exec to acquire root, // or if stack depth is getting silly. if (!(which = toy_find(argv[0]))) return;