=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/awk/lex.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- src/usr.bin/awk/lex.c 2004/12/30 01:52:48 1.8 +++ src/usr.bin/awk/lex.c 2006/04/16 02:10:18 1.9 @@ -1,4 +1,4 @@ -/* $OpenBSD: lex.c,v 1.8 2004/12/30 01:52:48 millert Exp $ */ +/* $OpenBSD: lex.c,v 1.9 2006/04/16 02:10:18 hugh Exp $ */ /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved @@ -514,7 +514,7 @@ int regexpr(void) { - int c; + int c, openclass = 0; static char *buf = 0; static int bufsz = 500; char *bp; @@ -522,7 +522,7 @@ if (buf == 0 && (buf = (char *) malloc(bufsz)) == NULL) FATAL("out of space for rex expr"); bp = buf; - for ( ; (c = input()) != '/' && c != 0; ) { + for ( ; ((c = input()) != '/' || openclass == 1) && c != 0; ) { if (!adjbuf(&buf, &bufsz, bp-buf+3, 500, &bp, 0)) FATAL("out of space for reg expr %.10s...", buf); if (c == '\n') { @@ -533,6 +533,10 @@ *bp++ = '\\'; *bp++ = input(); } else { + if (c == '[') + openclass = 1; + else if (c == ']') + openclass = 0; *bp++ = c; } }