summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--NEWS16
-rw-r--r--doc/pies.texi15
-rw-r--r--src/comp.c2
-rw-r--r--src/pies.c17
-rw-r--r--src/piesctl.c2
-rw-r--r--tests/env.at2
6 files changed, 26 insertions, 28 deletions
diff --git a/NEWS b/NEWS
index eee1e25..4ee1ae5 100644
--- a/NEWS
+++ b/NEWS
@@ -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
diff --git a/src/comp.c b/src/comp.c
index d9e7966..06b5772 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -742,7 +742,7 @@ component_finish (struct component *comp, grecs_locus_t *locus)
component_free (comp);
return;
}
-
+
if (comp->flags & CF_SHELL)
{
comp->argc = 3;
diff --git a/src/pies.c b/src/pies.c
index f8525da..1f5fb8f 100644
--- a/src/pies.c
+++ b/src/pies.c
@@ -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))
{
- if (envop_entry_add (&comp->envop, envop_clear, NULL, NULL))
- grecs_error (locus, errno, "envop_entry_add");
+ 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;
}
@@ -1031,7 +1030,7 @@ _cb_socket_type (enum grecs_callback_command cmd,
{
grecs_locus_t *locus = &node->locus;
grecs_value_t *value = node->v.value;
-
+
if (grecs_assert_node_value_type (cmd, node, GRECS_TYPE_STRING))
return 1;
diff --git a/src/piesctl.c b/src/piesctl.c
index 390ccfc..2e35aea 100644
--- a/src/piesctl.c
+++ b/src/piesctl.c
@@ -189,7 +189,7 @@ parse_config (void)
if (grecs_assert_value_type (node->v.value, GRECS_TYPE_STRING,
&node->locus))
exit (EX_CONFIG);
-
+
if (pies_url_create (&client.url, node->v.value->v.string))
{
grecs_error (&node->locus, 0, _("%s: cannot create URL: %s"),
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"

Return to:

Send suggestions and report system problems to the System administrator.