diff options
author | Rob Landley <rob@landley.net> | 2020-05-05 21:50:49 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2020-05-05 21:50:49 -0500 |
commit | ef67aedfe62bd103a07d1f6e6a8264adf8fd799f (patch) | |
tree | 3e1e87a4f5c4a050e9562a6365973aad54c1137d /lib | |
parent | 99dfb770358781d41c056aaf3569437002aa9e76 (diff) | |
download | toybox-ef67aedfe62bd103a07d1f6e6a8264adf8fd799f.tar.gz |
Fix 32 bit option parsing for long long optflag values.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/args.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -132,6 +132,7 @@ struct getoptflagstate // Use getoptflagstate to parse one command line option from argv static int gotflag(struct getoptflagstate *gof, struct opts *opt) { + unsigned long long i; int type; // Did we recognize this option? @@ -143,7 +144,6 @@ static int gotflag(struct getoptflagstate *gof, struct opts *opt) // Might enabling this switch off something else? if (toys.optflags & opt->dex[0]) { struct opts *clr; - unsigned long long i = 1; // Forget saved argument for flag we switch back off for (clr=gof->opts, i=1; clr; clr = clr->next, i<<=1) @@ -158,7 +158,6 @@ static int gotflag(struct getoptflagstate *gof, struct opts *opt) if (toys.optflags & gof->excludes) { struct opts *bad; - unsigned i = 1; for (bad=gof->opts, i=1; bad ;bad = bad->next, i<<=1) { if (opt == bad || !(i & toys.optflags)) continue; @@ -327,7 +326,7 @@ void parse_optflaglist(struct getoptflagstate *gof) // (This goes right to left so we need the whole list before we can start.) idx = 0; for (new = gof->opts; new; new = new->next) { - unsigned long long u = 1L<<idx++; + unsigned long long u = 1LL<<idx++; if (new->c == 1) new->c = 0; new->dex[1] = u; @@ -400,7 +399,7 @@ void get_optflags(void) // Iterate through command line arguments, skipping argv[0] for (gof.argc=1; toys.argv[gof.argc]; gof.argc++) { gof.arg = toys.argv[gof.argc]; - catch = NULL; + catch = 0; // Parse this argument if (gof.stopearly>1) goto notflag; |