Module Name:    src
Committed By:   christos
Date:           Thu Mar 11 15:00:29 UTC 2021

Modified Files:
        src/lib/libc/regex: regcomp.c

Log Message:
recognize the "C" language backslash escapes like gnu does (except b which
is already taken)


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/lib/libc/regex/regcomp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/regex/regcomp.c
diff -u src/lib/libc/regex/regcomp.c:1.45 src/lib/libc/regex/regcomp.c:1.46
--- src/lib/libc/regex/regcomp.c:1.45	Fri Feb 26 14:24:47 2021
+++ src/lib/libc/regex/regcomp.c	Thu Mar 11 10:00:29 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: regcomp.c,v 1.45 2021/02/26 19:24:47 christos Exp $	*/
+/*	$NetBSD: regcomp.c,v 1.46 2021/03/11 15:00:29 christos Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-3-Clause
@@ -51,7 +51,7 @@
 static char sccsid[] = "@(#)regcomp.c	8.5 (Berkeley) 3/20/94";
 __FBSDID("$FreeBSD: head/lib/libc/regex/regcomp.c 368359 2020-12-05 03:18:48Z kevans $");
 #endif
-__RCSID("$NetBSD: regcomp.c,v 1.45 2021/02/26 19:24:47 christos Exp $");
+__RCSID("$NetBSD: regcomp.c,v 1.46 2021/03/11 15:00:29 christos Exp $");
 
 #define _OPENBSD_SOURCE
 
@@ -547,6 +547,27 @@ p_ere_exp(struct parse *p, struct branch
 			case 's':
 				p_b_pseudoclass(p, wc);
 				break;
+			case 'a':
+				ordinary(p, '\a');
+				break;
+			case 'e':
+				ordinary(p, '\e');
+				break;
+			case 'f':
+				ordinary(p, '\f');
+				break;
+			case 'n':
+				ordinary(p, '\n');
+				break;
+			case 'r':
+				ordinary(p, '\r');
+				break;
+			case 't':
+				ordinary(p, '\t');
+				break;
+			case 'v':
+				ordinary(p, '\v');
+				break;
 			case '1':
 			case '2':
 			case '3':
@@ -906,6 +927,27 @@ p_simp_re(struct parse *p, struct branch
 			case BACKSL|'s':
 				p_b_pseudoclass(p, cc);
 				break;
+			case BACKSL|'a':
+				ordinary(p, '\a');
+				break;
+			case BACKSL|'e':
+				ordinary(p, '\e');
+				break;
+			case BACKSL|'f':
+				ordinary(p, '\f');
+				break;
+			case BACKSL|'n':
+				ordinary(p, '\n');
+				break;
+			case BACKSL|'r':
+				ordinary(p, '\r');
+				break;
+			case BACKSL|'t':
+				ordinary(p, '\t');
+				break;
+			case BACKSL|'v':
+				ordinary(p, '\v');
+				break;
 			default:
 				handled = false;
 			}

Reply via email to