From 089fc87a02b0c682ace3afc2f597f5e5b3b8f076 Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Sat, 23 May 2015 21:48:26 +0100 Subject: New ${env {NAME}} expansion. Bug 1604 --- doc/doc-docbook/spec.xfpt | 24 ++++++++++++++++++++++++ doc/doc-txt/NewStuff | 2 ++ 2 files changed, 26 insertions(+) (limited to 'doc') diff --git a/doc/doc-docbook/spec.xfpt b/doc/doc-docbook/spec.xfpt index 752712181..a598ec08b 100644 --- a/doc/doc-docbook/spec.xfpt +++ b/doc/doc-docbook/spec.xfpt @@ -9031,6 +9031,30 @@ When compiling a function that is to be used in this way with gcc, you need to add &%-shared%& to the gcc command. Also, in the Exim build-time configuration, you must add &%-export-dynamic%& to EXTRALIBS. + +.vitem "&*${env{*&<&'key'&>&*}{*&<&'string1'&>&*}{*&<&'string2'&>&*}}*&" +.cindex "expansion" "extracting value from environment" +.cindex "environment" "value from" +The key is first expanded separately, and leading and trailing white space +removed. +This is then searched for as a name in the environment. +If a variable is found then its value is placed in &$value$& +and <&'string1'&> is expanded, otherwise <&'string2'&> is expanded. + +Instead of {<&'string2'&>} the word &"fail"& (not in curly brackets) can +appear, for example: +.code +${env{USER}{$value} fail } +.endd +This forces an expansion failure (see section &<>&); +{<&'string1'&>} must be present for &"fail"& to be recognized. + +If {<&'string2'&>} is omitted an empty string is substituted on +search failure. +If {<&'string1'&>} is omitted the search result is substituted on +search success. + + .vitem "&*${extract{*&<&'key'&>&*}{*&<&'string1'&>&*}{*&<&'string2'&>&*}&&& {*&<&'string3'&>&*}}*&" .cindex "expansion" "extracting substrings by key" diff --git a/doc/doc-txt/NewStuff b/doc/doc-txt/NewStuff index aa60f46f1..3fe332556 100644 --- a/doc/doc-txt/NewStuff +++ b/doc/doc-txt/NewStuff @@ -33,6 +33,8 @@ Version 4.86 10. A logging option for slow DNS lookups, +11. New ${env {}} expansion. + Version 4.85 ------------ -- cgit v1.2.3