Hi Masahiro,

On 07.05.2015 14:41, Masahiro Yamada wrote:
2015-05-07 21:13 GMT+09:00 Stefan Roese <s...@denx.de>:
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.


Interesting.
I did not know this behavior of strings in Kconfig.

Then I'm not the only one. ;)

I want to see the reaction from linux-kconfig ML.

Okay. It makes sense then to send this patch to this list right away. A quick search didn't reveal any results though. Where is this list hosted?

Thanks,
Stefan

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to