summaryrefslogtreecommitdiffabout
path: root/src/pies.c
Side-by-side diff
Diffstat (limited to 'src/pies.c') (more/less context) (ignore whitespace changes)
-rw-r--r--src/pies.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/pies.c b/src/pies.c
index 1f5fb8f..73d33a0 100644
--- a/src/pies.c
+++ b/src/pies.c
@@ -786,6 +786,22 @@ _cb_env_set (enum grecs_callback_command cmd,
}
static int
+_cb_env_eval (enum grecs_callback_command cmd,
+ grecs_node_t *node,
+ void *varptr, void *cb_data)
+{
+ grecs_locus_t *locus = &node->locus;
+ grecs_value_t *value = node->v.value;
+ struct component *comp = varptr;
+
+ if (grecs_assert_node_value_type (cmd, node, GRECS_TYPE_STRING))
+ return 1;
+ if (envop_entry_add (&comp->envop, envop_set, NULL, value->v.string))
+ grecs_error (locus, errno, "envop_entry_add");
+ return 0;
+}
+
+static int
_cb_env_unset (enum grecs_callback_command cmd,
grecs_node_t *node,
void *varptr, void *cb_data)
@@ -825,6 +841,12 @@ struct grecs_keyword cb_env_keywords[] = {
grecs_type_string, GRECS_DFLT,
NULL, 0,
_cb_env_set },
+ { "eval",
+ N_("string"),
+ N_("Evaluate string. Useful for side-effects, e.g. eval ${X:=2}."),
+ grecs_type_string, GRECS_DFLT,
+ NULL, 0,
+ _cb_env_eval },
{ "unset",
N_("name"),
N_("Unset environment variable. Name can contain wildcards."),

Return to:

Send suggestions and report system problems to the System administrator.