From 6269db883ad6989a578bac299deab9c4285bb1df Mon Sep 17 00:00:00 2001
From: Peter Stephenson
Date: Sun, 10 May 2015 19:19:34 +0100
Subject: 35067: Add (b) parameter flag for pattern char backslashing.
Doc tweak from Daniel in 35071.
Includes test.
---
Src/subst.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
(limited to 'Src/subst.c')
diff --git a/Src/subst.c b/Src/subst.c
index f52bcdfc8..bf80495bd 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -1592,7 +1592,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags)
/* combination of (L), (U) and (C) flags. */
int casmod = CASMOD_NONE;
/*
- * quotemod says we are doing either (q) (positive), (Q) (negative)
+ * quotemod says we are doing either (q/b) (positive), (Q) (negative)
* or not (0). quotetype counts the q's for the first case.
* quoterr is simply (X) but gets passed around a lot because the
* combination (eX) needs it.
@@ -1861,6 +1861,12 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags)
quotemod++, quotetype++;
}
break;
+ case 'b':
+ if (quotemod || quotetype != QT_NONE)
+ goto flagerr;
+ quotemod = 1;
+ quotetype = QT_BACKSLASH_PATTERN;
+ break;
case 'Q':
quotemod--;
break;
@@ -3460,7 +3466,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags)
if (quotemod) {
int pre = 0, post = 0;
- if (quotemod > 0 && quotetype > QT_BACKSLASH) {
+ if (quotemod > 0) {
switch (quotetype)
{
case QT_DOLLARS:
@@ -3471,6 +3477,9 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags)
case QT_SINGLE_OPTIONAL:
/* quotes will be added for us */
+ case QT_BACKSLASH:
+ case QT_BACKSLASH_PATTERN:
+ /* no quotes */
break;
default:
--
cgit 1.4.1