diff options
author | Jeremy Harris <jgh146exb@wizmail.org> | 2016-08-14 15:11:04 +0100 |
---|---|---|
committer | Jeremy Harris <jgh146exb@wizmail.org> | 2016-08-14 15:11:04 +0100 |
commit | 3367f8c2e08bf998efc84050e39d5a9fbdffb5dd (patch) | |
tree | 03f0de306aac8c835b7324678e7610be60ce0588 /src | |
parent | 5bde3efabfec675b323501cae5e3a99784afcc31 (diff) |
Expansions: new ${escape8bit:<string>} operator. Bug 1863
Diffstat (limited to 'src')
-rw-r--r-- | src/src/expand.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/src/expand.c b/src/src/expand.c index c13284d8e..fd55436a2 100644 --- a/src/src/expand.c +++ b/src/src/expand.c @@ -207,6 +207,7 @@ static uschar *op_table_main[] = { US"base64d", US"domain", US"escape", + US"escape8bit", US"eval", US"eval10", US"expand", @@ -252,6 +253,7 @@ enum { EOP_BASE64D, EOP_DOMAIN, EOP_ESCAPE, + EOP_ESCAPE8BIT, EOP_EVAL, EOP_EVAL10, EOP_EXPAND, @@ -7109,11 +7111,23 @@ while (*s != 0) case EOP_ESCAPE: { - const uschar *t = string_printing(sub); + const uschar * t = string_printing(sub); yield = string_cat(yield, &size, &ptr, t); continue; } + case EOP_ESCAPE8BIT: + { + const uschar * s = sub; + uschar c; + + for (s = sub; c = *s; s++) + yield = c < 127 && c != '\\' + ? string_catn(yield, &size, &ptr, s, 1) + : string_catn(yield, &size, &ptr, string_sprintf("\\%03o", c), 4); + continue; + } + /* Handle numeric expression evaluation */ case EOP_EVAL: |