From aaecbbac2f94b7a93eb2df7f9db78828cbb7b647 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Thu, 10 Dec 2015 15:57:08 -0600 Subject: 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. --- lib/args.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lib/args.c') diff --git a/lib/args.c b/lib/args.c index 594a1b47..1f42cdde 100644 --- a/lib/args.c +++ b/lib/args.c @@ -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<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 -- cgit v1.2.3