From d72f08576d930466bf4555d0cc6787ecc5b38124 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Wed, 5 Apr 2023 07:42:09 -0500 Subject: [PATCH] Octal escaped ~ (used as literal -~ flag) was still getting parsed as control char, so move the de-escaping further down. --- lib/args.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/args.c b/lib/args.c index eec86c8e..53258279 100644 --- a/lib/args.c +++ b/lib/args.c @@ -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<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) { -- 2.39.2