From 461724cdbe88fede989a3ddebd4aac8b88e68b0d Mon Sep 17 00:00:00 2001 From: Robert Spalek Date: Mon, 24 Apr 2006 15:58:28 +0200 Subject: [PATCH] conf2: correct unescaping of C-strings --- lib/conf2.c | 12 ++---------- lib/conf2.t | 2 +- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/lib/conf2.c b/lib/conf2.c index 670bf73d..3c930e42 100644 --- a/lib/conf2.c +++ b/lib/conf2.c @@ -15,6 +15,7 @@ #include "lib/fastbuf.h" #include "lib/chartype.h" #include "lib/lfs.h" +#include "lib/stkstring.h" #include #include @@ -1058,16 +1059,7 @@ get_word(uns is_command_name) } line++; - // FIXME: this is utterly bogus, since printf() only expands these - // percents, and the \n, \x1b codes are actually expanded by the compiler - for (byte *c=copy_buf.ptr+start_copy; *c; c++) - if (*c == '%') { - if (c[1] != '%') - return "Formating sequences are not allowed"; - else - c++; - } - byte *tmp = cf_printf(copy_buf.ptr + start_copy); + byte *tmp = stk_str_unesc(copy_buf.ptr + start_copy); uns l = strlen(tmp); bb_grow(©_buf, start_copy + l + 1); strcpy(copy_buf.ptr + start_copy, tmp); diff --git a/lib/conf2.t b/lib/conf2.t index 95216e13..9ffc82cc 100644 --- a/lib/conf2.t +++ b/lib/conf2.t @@ -9,7 +9,7 @@ Top { \ \ 17M nrs2 3 3k 3 3 3 ; \ - str1 "hello, world%%\n" + str1 "hello,\t\x2bworld%%\n" str2 'Hagenuk, the best' "\ " qu'est-ce que c'est? -- 2.39.2