diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2020-06-13 01:19:56 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2020-06-13 01:19:56 +0000 |
commit | 317faf26d7c732fe1661e940b697b94c509d22f8 (patch) | |
tree | a386c9a69366eaaf4e4385e97497da7d3b0a2978 /usr.bin/awk/run.c | |
parent | 8224e8d9b044b699034e06344410040ca86417eb (diff) |
POSIX doesn't permit an unescaped '/' in an extended regular expression.
Unlike upstream awk, ours has historically allowed unescaped '/'
inside a bracket expression for compatibility with other awk
implementations but the check was too simple-minded. This improves
the matching to allow things like /[]/]/, /[^]// and '/[abc[:digit:]/@#]/'
To enable strict POSIX compliance, set POSIXLY_CORRECT.
Diffstat (limited to 'usr.bin/awk/run.c')
-rw-r--r-- | usr.bin/awk/run.c | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/usr.bin/awk/run.c b/usr.bin/awk/run.c index 7bdb607b8d0..b150d90a55a 100644 --- a/usr.bin/awk/run.c +++ b/usr.bin/awk/run.c @@ -1,4 +1,4 @@ -/* $OpenBSD: run.c,v 1.57 2020/06/10 21:05:50 millert Exp $ */ +/* $OpenBSD: run.c,v 1.58 2020/06/13 01:19:55 millert Exp $ */ /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved @@ -2122,13 +2122,6 @@ void backsub(char **pb_ptr, const char **sptr_ptr) /* handle \\& variations */ { /* sptr[0] == '\\' */ char *pb = *pb_ptr; const char *sptr = *sptr_ptr; - static bool first = true; - static bool do_posix = false; - - if (first) { - first = false; - do_posix = (getenv("POSIXLY_CORRECT") != NULL); - } if (sptr[1] == '\\') { if (sptr[2] == '\\' && sptr[3] == '&') { /* \\\& -> \& */ |