Octal escaped ~ (used as literal -~ flag) was still getting parsed as

control char, so move the de-escaping further down.
This commit is contained in:
Rob Landley 2023-04-05 07:42:09 -05:00
parent b6732af9d7
commit d72f08576d

View File

@ -85,7 +85,7 @@
// ! More than one in group is error [!abc] means -ab calls error_exit()
// primarily useful if you can switch things back off again.
//
// You may use octal escapes with the high bit (127) set to use a control
// You may use octal escapes with the high bit (128) set to use a control
// character as an option flag. For example, \300 would be the option -@
// Notes from getopt man page
@ -318,7 +318,7 @@ static int parse_optflaglist(struct getoptflagstate *gof)
continue;
// Claim this option, loop to see what's after it.
} else new->c = 127&*options;
} else new->c = *options;
options++;
}
@ -330,6 +330,7 @@ static int parse_optflaglist(struct getoptflagstate *gof)
unsigned long long u = 1LL<<idx++;
if (new->c == 1 || new->c=='~') new->c = 0;
else new->c &= 127;
new->dex[1] = u;
if (new->flags & 1) gof->requires |= u;
if (new->type) {