diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2019-06-06 08:26:23 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2019-06-06 08:26:23 +0300 |
commit | d713f4ed5193143bc16c40c2fd5096628082c047 (patch) | |
tree | 19a8b997796b0c3604277418b65656cbd8c4a5d3 | |
parent | b220b5a367469c571358c34ea0df813522e99485 (diff) | |
download | pies-d713f4ed5193143bc16c40c2fd5096628082c047.tar.gz pies-d713f4ed5193143bc16c40c2fd5096628082c047.tar.bz2 |
Change syntax of the env.clear statement.
It no longer requires an argument. The correct syntax is
env {
clear;
}
-rw-r--r-- | NEWS | 16 | ||||
-rw-r--r-- | doc/pies.texi | 15 | ||||
-rw-r--r-- | src/comp.c | 0 | ||||
-rw-r--r-- | src/pies.c | 13 | ||||
-rw-r--r-- | src/piesctl.c | 0 | ||||
-rw-r--r-- | tests/env.at | 2 |
6 files changed, 22 insertions, 24 deletions
@@ -1,4 +1,4 @@ -GNU Pies NEWS -- history of user-visible changes. 2019-06-03 +GNU Pies NEWS -- history of user-visible changes. 2019-06-06 See the end of file for copying conditions. Please send Pies bug reports to <bug-pies@gnu.org> or @@ -43,12 +43,12 @@ contains redirections, pipes, etc. E.g. The 'env' statement has been re-implemented as a compound statement. It can contain the following sub-statements: -** clear yes +** clear Clears the environment ** keep NAME Keeps the variable NAME when clearing the environment. Implies -"clear yes". NAME can be a globbing pattern, in which case all +"clear". NAME can be a globbing pattern, in which case all variables matching the pattern are retained. ** set "NAME=VALUE" @@ -62,11 +62,11 @@ variables matching the pattern are unset. Example: env { - clear yes - keep PATH - keep MANPATH - keep "LC_*" - set "MANPATH=$MANPATH${MANPATH:+:}/usr/local/man" + clear; + keep PATH; + keep MANPATH; + keep "LC_*"; + set "MANPATH=$MANPATH${MANPATH:+:}/usr/local/man"; } * Legacy 'env' statement. diff --git a/doc/pies.texi b/doc/pies.texi index ccb9f0e..63064e5 100644 --- a/doc/pies.texi +++ b/doc/pies.texi @@ -1061,7 +1061,7 @@ The compound @code{env} statement has the following syntax: @example @group env @{ - clear @var{bool}; + clear; keep @var{pattern}; set "@var{name}=@var{value}"; unset @var{pattern}; @@ -1075,11 +1075,10 @@ modify the environment. The @code{clear} and @code{keep} statements are executed first. Then, the @code{set} and @code{unset} statements are applied in the order of their appearance in the configuration. -@deffn {env} clear @var{bool} -If @var{bool} is @samp{yes}, all environment variables will be cleared -(unset). The resulting environment will be empty, unless one or more -@code{keep} statements are also given (see below). The @code{clear} -statement is always executed first. +@deffn {env} clear +Clears the environment by removing (unsetting) all variables, except +those listed in @code{keep} statements, if such are given (see below). +The @code{clear} statement is always executed first. @end deffn @deffn {env} keep @var{pattern} @@ -1093,7 +1092,7 @@ environment all variables except @samp{HOME}, @samp{USER}, @example @group env @{ - clear yes; + clear; keep HOME; keep USER; keep PATH; @@ -1171,7 +1170,7 @@ The modern syntax equivalent is: @example @group env @{ - clear yes; + clear; @} @end group @end example @@ -730,17 +730,16 @@ _cb_env_clear (enum grecs_callback_command cmd, grecs_locus_t *locus = &node->locus; grecs_value_t *value = node->v.value; struct component *comp = varptr; - int clear; - if (grecs_assert_node_value_type (cmd, node, GRECS_TYPE_STRING)) - return 1; - if (grecs_string_convert(&clear, grecs_type_bool, value->v.string, locus)) - return 1; - if (clear) + if (!GRECS_VALUE_EMPTY_P (value)) { + grecs_error (&value->locus, 0, "%s", _("unexpected argument")); + return 1; + } + if (envop_entry_add (&comp->envop, envop_clear, NULL, NULL)) grecs_error (locus, errno, "envop_entry_add"); - } + return 0; } diff --git a/src/piesctl.c b/src/piesctl.c index 390ccfc..2e35aea 100644 --- a/src/piesctl.c +++ b/src/piesctl.c diff --git a/tests/env.at b/tests/env.at index 430bf10..1c595de 100644 --- a/tests/env.at +++ b/tests/env.at @@ -36,7 +36,7 @@ dnl ############################# AT_BANNER([Environment statement]) -ENVTEST([clear],[clear],[clear yes;],[]) +ENVTEST([clear],[clear],[clear;],[]) ENVTEST([keep],[keep],[keep "LC_*";], [LC_ALL="C" |