aboutsummaryrefslogtreecommitdiff
path: root/lib/forlan.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/forlan.c')
-rw-r--r--lib/forlan.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/forlan.c b/lib/forlan.c
index 2275bc7..977271d 100644
--- a/lib/forlan.c
+++ b/lib/forlan.c
@@ -1051,2 +1051,18 @@ func_decode(forlan_eval_env_t env, struct grecs_list *list)
1051static void 1051static void
1052func_dequote(forlan_eval_env_t env, struct grecs_list *list)
1053{
1054 struct forlan_value *val = list->head->data;
1055 char *s = val->v.string;
1056 size_t l = strlen(s);
1057
1058 if (l >= 2 && s[0] == '"' && s[l-1] == '"') {
1059 s++;
1060 l -= 2;
1061 }
1062 env->retval.v.string = grecs_malloc(l + 1);
1063 memcpy(env->retval.v.string, s, l);
1064 env->retval.v.string[l] = 0;
1065}
1066
1067static void
1052func_exit(forlan_eval_env_t env, struct grecs_list *list) 1068func_exit(forlan_eval_env_t env, struct grecs_list *list)
@@ -1129,2 +1145,3 @@ static struct forlan_function functab[] = {
1129 { "decode", forlan_value_literal, "s", 1, 1, func_decode }, 1145 { "decode", forlan_value_literal, "s", 1, 1, func_decode },
1146 { "dequote", forlan_value_literal, "s", 1, 1, func_dequote },
1130 { "exit", forlan_value_void, "s", 1, 1, func_exit }, 1147 { "exit", forlan_value_void, "s", 1, 1, func_exit },

Return to:

Send suggestions and report system problems to the System administrator.