diff options
Diffstat (limited to 'src/pies.c')
-rw-r--r-- | src/pies.c | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -786,6 +786,22 @@ _cb_env_set (enum grecs_callback_command cmd, | |||
786 | } | 786 | } |
787 | 787 | ||
788 | static int | 788 | static int |
789 | _cb_env_eval (enum grecs_callback_command cmd, | ||
790 | grecs_node_t *node, | ||
791 | void *varptr, void *cb_data) | ||
792 | { | ||
793 | grecs_locus_t *locus = &node->locus; | ||
794 | grecs_value_t *value = node->v.value; | ||
795 | struct component *comp = varptr; | ||
796 | |||
797 | if (grecs_assert_node_value_type (cmd, node, GRECS_TYPE_STRING)) | ||
798 | return 1; | ||
799 | if (envop_entry_add (&comp->envop, envop_set, NULL, value->v.string)) | ||
800 | grecs_error (locus, errno, "envop_entry_add"); | ||
801 | return 0; | ||
802 | } | ||
803 | |||
804 | static int | ||
789 | _cb_env_unset (enum grecs_callback_command cmd, | 805 | _cb_env_unset (enum grecs_callback_command cmd, |
790 | grecs_node_t *node, | 806 | grecs_node_t *node, |
791 | void *varptr, void *cb_data) | 807 | void *varptr, void *cb_data) |
@@ -825,6 +841,12 @@ struct grecs_keyword cb_env_keywords[] = { | |||
825 | grecs_type_string, GRECS_DFLT, | 841 | grecs_type_string, GRECS_DFLT, |
826 | NULL, 0, | 842 | NULL, 0, |
827 | _cb_env_set }, | 843 | _cb_env_set }, |
844 | { "eval", | ||
845 | N_("string"), | ||
846 | N_("Evaluate string. Useful for side-effects, e.g. eval ${X:=2}."), | ||
847 | grecs_type_string, GRECS_DFLT, | ||
848 | NULL, 0, | ||
849 | _cb_env_eval }, | ||
828 | { "unset", | 850 | { "unset", |
829 | N_("name"), | 851 | N_("name"), |
830 | N_("Unset environment variable. Name can contain wildcards."), | 852 | N_("Unset environment variable. Name can contain wildcards."), |