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/libstddjb/string_unquote_withdelim.c | |
| parent | b305bf616804db7176601bc2acd3495f0217e1c4 (diff) | |
| download | skalibs-d452fcefe0220893ef1a8f868640809b4766480c.tar.gz | |
Modify string_quote/unquote to allow encoding of space as \s
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/libstddjb/string_unquote_withdelim.c')
| -rw-r--r-- | src/libstddjb/string_unquote_withdelim.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libstddjb/string_unquote_withdelim.c b/src/libstddjb/string_unquote_withdelim.c index 43da0db..16da0c7 100644 --- a/src/libstddjb/string_unquote_withdelim.c +++ b/src/libstddjb/string_unquote_withdelim.c @@ -33,7 +33,7 @@ int string_unquote_withdelim (char *d, size_t *w, char const *s, size_t len, siz { 6, 6, 4, 6, 4, 4, 6, 6, 6 }, { 6, 6, 0, 6, 0, 0, 6, 6, 6 } } ; - unsigned char class[256] = "7777777777777777777777777777777777777777777777772555555555777777777777777777777777777777777707777445554777777767776767673777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777" ; + unsigned char class[256] = "7777777777777777777777777777777777777777777777772555555555777777777777777777777777777777777707777445554777777767776667673777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777" ; size_t i = 0 ; unsigned char store = 0 ; unsigned char state = 0 ; @@ -50,7 +50,7 @@ int string_unquote_withdelim (char *d, size_t *w, char const *s, size_t len, siz state = states[state][c] ; if (action & PUSH0) d[(*w)++] = 0 ; if (action & PUSH) d[(*w)++] = s[i] ; - if (action & PUSHSPEC) d[(*w)++] = 7 + byte_chr("abtnvfr", 7, s[i]) ; + if (action & PUSHSPEC) d[(*w)++] = s[i] == 's' ? ' ' : 7 + byte_chr("abtnvfr", 7, s[i]) ; if (action & STORE) store = fmtscan_num(s[i], 16) << 4 ; if (action & CALC) d[(*w)++] = store | fmtscan_num(s[i], 16) ; if (action & SYNTAXERROR) errno = EPROTO ; |
