chiark / gitweb /
util: New flag UNQUOTE_UNESCAPE_RELAX for unquote_first_word
authorFilipe Brandenburger <filbranden@google.com>
Wed, 3 Jun 2015 04:08:24 +0000 (21:08 -0700)
committerSven Eden <yamakuzure@gmx.net>
Tue, 14 Mar 2017 09:01:46 +0000 (10:01 +0100)
commit180a9fcdf2c708707783debad45418f488619138
tree398e167c342085cecd435939f7183c6e9bfff84e
parentef6006f284e011b4c176e2acb949ae5e52cd4808
util: New flag UNQUOTE_UNESCAPE_RELAX for unquote_first_word

The new flag UNQUOTE_UNESCAPE_RELAX preserves unrecognized escape
sequences verbatim in unquote_first_word, either when it's a trailing
backslash (similar to UNQUOTE_RELAX, but in this case keep the extra
backslash in the output) or in the middle of a sequence string.

Add unit test cases to ensure the new flag works as expected and to
prevent regressions from being introduced.

Tested with a follow up commit converting config_parse_exec() to start
using unquote_first_word, in which case this flags makes it possible to
preserve unrecognized escape sequences.

Relevant bug: https://bugs.freedesktop.org/show_bug.cgi?id=90794
src/shared/util.c
src/shared/util.h