Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bd6f628

Browse files
author
echo
committed
strutils.c: ignore escape characters while parsing options.
1 parent 75c7b31 commit bd6f628

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/strutils.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -1235,7 +1235,7 @@ int ul_optstr_next(char **optstr, char **name, size_t *namesz,
12351235
return -EINVAL;
12361236
if (!start)
12371237
start = p; /* beginning of the option item */
1238-
if (*p == '"')
1238+
if (*p == '"' && (p == optstr0 || *(p - 1) != '\\'))
12391239
open_quote ^= 1; /* reverse the status */
12401240
if (open_quote)
12411241
continue; /* still in quoted block */
@@ -1480,7 +1480,8 @@ int main(int argc, char *argv[])
14801480
" %1$s --stralnumcmp <str> <str>\n"
14811481
" %1$s --cstrcasecmp <str> <str>\n"
14821482
" %1$s --normalize <str>\n"
1483-
" %1$s --strto{s,u}{16,32,64} <str>\n",
1483+
" %1$s --strto{s,u}{16,32,64} <str>\n"
1484+
" %1$s --optstr <str>\n",
14841485
argv[0]);
14851486
exit(EXIT_FAILURE);
14861487
}

0 commit comments

Comments
 (0)