diff options
author | martin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2013-03-09 20:31:16 +0000 |
---|---|---|
committer | martin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2013-03-09 20:31:16 +0000 |
commit | 7deb836e00ac474c87997fc39e456338e04c4b68 (patch) | |
tree | 391b609903581a8a71cb555885bdbf8d39140506 /navit/command.c | |
parent | 4ecc2d576d961ed8ebcb54ddce9a9801f63ddfee (diff) | |
download | navit-svn-7deb836e00ac474c87997fc39e456338e04c4b68.tar.gz |
Fix:Core:Correctly unescape strings
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@5401 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit/command.c')
-rw-r--r-- | navit/command.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/navit/command.c b/navit/command.c index f2d25e91..0aece848 100644 --- a/navit/command.c +++ b/navit/command.c @@ -541,9 +541,13 @@ eval_value(struct context *ctx, struct result *res) { return; } if (op[0] == '"') { + int escaped=0; do { - if (op[0] == '\\' && op[1] == '"') - op++; + if (op[0] == '\\') { + escaped=1; + if (op[1] == '"') + op++; + } op++; } while (op[0] && op[0] != '"'); if(!*op) { @@ -551,7 +555,19 @@ eval_value(struct context *ctx, struct result *res) { return; } op++; - result_set(ctx, set_type_string, ctx->expr, op-ctx->expr, res); + if (escaped) { + char *tmpstr=g_malloc(op-ctx->expr+1),*s=tmpstr; + op=ctx->expr; + do { + if (op[0] == '\\') + op++; + *s++=*op++; + } while (op[0] != '"'); + *s++=*op++; + result_set(ctx, set_type_string, tmpstr, s-tmpstr, res); + g_free(tmpstr); + } else + result_set(ctx, set_type_string, ctx->expr, op-ctx->expr, res); ctx->expr=op; return; } |