diff options
author | Rob Landley <rob@landley.net> | 2015-12-10 15:57:08 -0600 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2015-12-10 15:57:08 -0600 |
commit | aaecbbac2f94b7a93eb2df7f9db78828cbb7b647 (patch) | |
tree | ac2a23d038113e359b583e042170d9d319690cf2 /lib/args.c | |
parent | 5cb65054067391af7602bc303d77349c76648faf (diff) | |
download | toybox-aaecbbac2f94b7a93eb2df7f9db78828cbb7b647.tar.gz |
Expand toys.optargs to 64 bits so people adding more options to ls don't run out.
Keep the low 32 bits of FLAG_x constants as 32 bit numbers so that at least
on little endian platforms it's still normal 32 bit math outside of lib/args.c.
Diffstat (limited to 'lib/args.c')
-rw-r--r-- | lib/args.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -97,8 +97,8 @@ struct opts { struct opts *next; long *arg; // Pointer into union "this" to store arguments at. int c; // Argument character to match - int flags; // |=1, ^=2 - unsigned dex[3]; // which bits to disable/enable/exclude in toys.optflags + int flags; // |=1, ^=2, " "=4, ;=8 + unsigned long long dex[3]; // bits to disable/enable/exclude in toys.optflags char type; // Type of arguments to store union "this" union { long l; @@ -142,7 +142,7 @@ 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 i = 1; + 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) @@ -326,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 u = 1<<idx++; + unsigned long long u = 1L<<idx++; if (new->c == 1) new->c = 0; new->dex[1] = u; @@ -378,7 +378,7 @@ void get_optflags(void) { struct getoptflagstate gof; struct opts *catch; - long saveflags; + unsigned long long saveflags; char *letters[]={"s",""}; // Option parsing is a two stage process: parse the option string into |