diff options
author | Rob Landley <rob@landley.net> | 2022-10-03 05:08:33 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2022-10-03 05:08:33 -0500 |
commit | b26689f9506556e3236c103c1dca48971430ca66 (patch) | |
tree | 51aca597fb16a8fc0e37c15082d0ee80660c3878 /toys/posix/grep.c | |
parent | 564dd81f2dcab492eb299b53730466193b617643 (diff) | |
download | toybox-b26689f9506556e3236c103c1dca48971430ca66.tar.gz |
Fix bucket sort with -F
Diffstat (limited to 'toys/posix/grep.c')
-rw-r--r-- | toys/posix/grep.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/toys/posix/grep.c b/toys/posix/grep.c index efaabe82..1f347046 100644 --- a/toys/posix/grep.c +++ b/toys/posix/grep.c @@ -445,9 +445,12 @@ static void parse_regex(void) // Sort fast path patterns into buckets by first character for (al = TT.e; al; al = new) { new = al->next; - key = '^'==*al->arg; - if ('\\'==al->arg[key]) key++; - else if ('$'==al->arg[key] && !al->arg[key+1]) key++; + if (FLAG(F)) key = 0; + else { + key = '^'==*al->arg; + if ('\\'==al->arg[key]) key++; + else if ('$'==al->arg[key] && !al->arg[key+1]) key++; + } key = al->arg[key]; if (FLAG(i)) key = toupper(key); al->next = TT.fixed[key]; |