Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/regex recognize the "C" language backslash escapes ...



details:   https://anonhg.NetBSD.org/src/rev/39bd8705daf3
branches:  trunk
changeset: 953502:39bd8705daf3
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Mar 11 15:00:29 2021 +0000

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

diffstat:

 lib/libc/regex/regcomp.c |  46 ++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 44 insertions(+), 2 deletions(-)

diffs (74 lines):

diff -r 7cd12dbe361e -r 39bd8705daf3 lib/libc/regex/regcomp.c
--- a/lib/libc/regex/regcomp.c  Thu Mar 11 14:19:43 2021 +0000
+++ b/lib/libc/regex/regcomp.c  Thu Mar 11 15:00:29 2021 +0000
@@ -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 @@
                        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 @@
                        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;
                        }



Home | Main Index | Thread Index | Old Index