diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2023-10-26 08:47:13 +0000 |
---|---|---|
committer | Laurent Bercot <ska@appnovation.com> | 2023-10-26 08:47:13 +0000 |
commit | d452fcefe0220893ef1a8f868640809b4766480c (patch) | |
tree | ba39b0180313314a988dc44ee66de61d49f24f95 /src/include | |
parent | b305bf616804db7176601bc2acd3495f0217e1c4 (diff) | |
download | skalibs-d452fcefe0220893ef1a8f868640809b4766480c.tar.xz |
Modify string_quote/unquote to allow encoding of space as \s
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/skalibs/skamisc.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/include/skalibs/skamisc.h b/src/include/skalibs/skamisc.h index 463f63a..657f526 100644 --- a/src/include/skalibs/skamisc.h +++ b/src/include/skalibs/skamisc.h @@ -21,10 +21,17 @@ extern int getlnmaxsep (buffer *, char *, size_t, size_t *, char const *, size_t extern int sauniquename (stralloc *) ; -extern int string_quote (stralloc *, char const *, size_t) ; +extern int string_quote_options (stralloc *, char const *, size_t, uint32_t) ; +#define string_quote(sa, s, len) string_quote_options(sa, s, (len), 0) +#define string_quote_nospace(sa, s, len) string_quote_options(sa, s, (len), 1) #define string_quotes(sa, s) string_quote(sa, (s), strlen(s)) -extern int string_quote_nodelim (stralloc *, char const *, size_t) ; -extern int string_quote_nodelim_mustquote (stralloc *, char const *, size_t, char const *, size_t) ; + +extern int string_quote_nodelim_mustquote_options (stralloc *, char const *, size_t, char const *, size_t, uint32_t) ; +#define string_quote_nodelim_mustquote(sa, s, len, delim, delimlen) string_quote_nodelim_mustquote_options(sa, s, len, delim, (delimlen), 0) +#define string_quote_nodelim_mustquote_nospace(sa, s, len, delim, delimlen) string_quote_nodelim_mustquote_options(sa, s, len, delim, (delimlen), 1) +#define string_quote_nodelim (sa, s, len) string_quote_nodelim_mustquote(sa, s, (len), "\"", 1) +#define string_quote_nodelim_nospace (sa, s, len) string_quote_nodelim_mustquote_nospace(sa, s, (len), "\"", 1) + extern int string_unquote (char *, size_t *, char const *, size_t, size_t *) ; extern ssize_t string_unquote_nodelim (char *, char const *, size_t) ; extern int string_unquote_withdelim (char *, size_t *, char const *, size_t, size_t *, char const *, size_t) ; |