forked from ariadne/pkgconf
argvsplit: fix some quoting rules to match POSIX
parent
6a5b55740d
commit
be0d811942
|
@ -80,7 +80,7 @@ pkgconf_argv_split(const char *src, int *argc, char ***argv)
|
||||||
if (escaped)
|
if (escaped)
|
||||||
{
|
{
|
||||||
/* POSIX: only \CHAR is special inside a double quote if CHAR is {$, `, ", \, newline}. */
|
/* POSIX: only \CHAR is special inside a double quote if CHAR is {$, `, ", \, newline}. */
|
||||||
if (quote)
|
if (quote == '"')
|
||||||
{
|
{
|
||||||
if (!(*src_iter == '$' || *src_iter == '`' || *src_iter == '"' || *src_iter == '\\'))
|
if (!(*src_iter == '$' || *src_iter == '`' || *src_iter == '"' || *src_iter == '\\'))
|
||||||
*dst_iter++ = '\\';
|
*dst_iter++ = '\\';
|
||||||
|
@ -91,7 +91,7 @@ pkgconf_argv_split(const char *src, int *argc, char ***argv)
|
||||||
{
|
{
|
||||||
/* If we are outside a quoted string/char, an escaped space is usually used to
|
/* If we are outside a quoted string/char, an escaped space is usually used to
|
||||||
preserve spaces in file names. */
|
preserve spaces in file names. */
|
||||||
if (*src_iter != ' ')
|
if (!(*src_iter == '$' || *src_iter == '`' || *src_iter == '"' || *src_iter == '\\' || *src_iter == ' '))
|
||||||
*dst_iter++ = '\\';
|
*dst_iter++ = '\\';
|
||||||
|
|
||||||
*dst_iter++ = *src_iter;
|
*dst_iter++ = *src_iter;
|
||||||
|
|
Loading…
Reference in New Issue