]> git.kernelconcepts.de Git - karo-tx-uboot.git/commit
Kconfig: Enable usage of escape char '\' in string values
authorStefan Roese <sr@denx.de>
Fri, 29 May 2015 09:47:32 +0000 (11:47 +0200)
committerLothar Waßmann <LW@KARO-electronics.de>
Tue, 8 Sep 2015 22:42:24 +0000 (00:42 +0200)
commit33f308c488a60a6568fbc10242e94a9c886ea3d1
tree52e29ef3cfde9f99ba3dac3e9b9b6ee50b3bbb4b
parentdf51f983196ebf8f39853140136deddfaaaf2228
Kconfig: Enable usage of escape char '\' in string values

I might have missed something, but I failed to use the escape char '\'
in strings. To pass a printf format string like "foo %d bar\n" via
Kconfig to the code.

Right now its not possible to use the escape character '\' in Kconfig
string values correctly to e.g. set this string value "test output\n".
The '\n' will be converted to 'n'.

The current implementation removes some of the '\' chars from the input
string in conf_set_sym_val(). Examples:

'\' -> ''
'\\' -> '\'
'\\\' -> '\'
'\\\\' -> '\\'
...

And then doubles the backslash chars in the output string in
sym_escape_string_value(). Example:

'\' -> '' -> ''
'\\' -> '\' -> '\\'
'\\\' -> '\' -> '\\'
'\\\\' -> '\\' -> '\\\\'
...

As you see in these examples, its impossible to generate a single '\'
charater in the output string as its needed for something like '\n'.

This patch now changes this behavior to not drop some backslashes in
conf_set_sym_val() and to not add new backslashes in the resulting
output string. Removing the function sym_escape_string_value()
completely as its not needed anymore.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
scripts/kconfig/confdata.c
scripts/kconfig/symbol.c