summaryrefslogtreecommitdiff
path: root/src/basic/util.h
diff options
context:
space:
mode:
authorFilipe Brandenburger <filbranden@google.com>2015-06-02 21:08:24 -0700
committerFilipe Brandenburger <filbranden@google.com>2015-06-17 11:12:11 -0700
commitd6293c070e6e4b83d8e7ec56e465b0b215d55d98 (patch)
treec30169db009cfe75bd8aa54e6c6ed3851738c5c8 /src/basic/util.h
parent05654e712f0ccfea7bbeb3e4de89861a670f974e (diff)
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
Diffstat (limited to 'src/basic/util.h')
-rw-r--r--src/basic/util.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/basic/util.h b/src/basic/util.h
index 7aca46d777..748f22f1a2 100644
--- a/src/basic/util.h
+++ b/src/basic/util.h
@@ -839,8 +839,9 @@ int is_dir(const char *path, bool follow);
int is_device_node(const char *path);
typedef enum UnquoteFlags {
- UNQUOTE_RELAX = 1,
- UNQUOTE_CUNESCAPE = 2,
+ UNQUOTE_RELAX = 1,
+ UNQUOTE_CUNESCAPE = 2,
+ UNQUOTE_CUNESCAPE_RELAX = 4,
} UnquoteFlags;
int unquote_first_word(const char **p, char **ret, UnquoteFlags flags);