Keep the backslash when parsing arguments (fixes #35)

feature/tap-sh
Baptiste Daroussin 2012-08-14 11:12:01 +02:00
parent 2d5dfe7d70
commit ab48da3f33
3 changed files with 16 additions and 0 deletions

View File

@ -92,6 +92,8 @@ pkg_argv_split(const char *src, int *argc, char ***argv)
free(argv); free(argv);
free(buf); free(buf);
return -1; return -1;
} else {
*dst_iter++ = '\\';
} }
default: default:
*dst_iter++ = *src_iter; *dst_iter++ = *src_iter;

10
tests/lib1/quotes.pc Normal file
View File

@ -0,0 +1,10 @@
prefix=/usr
exec_prefix=${prefix}
libdir=${prefix}/lib
includedir=${prefix}/include
Name: quotes
Description: A testing pkg-config file
Version: 1.2.3
Libs: -L${libdir} -lfoo
Cflags: -DQUOTED=\"bla\"

View File

@ -167,6 +167,10 @@ run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --max-version 2.0 'foo '; echo \$
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --cflags missing-require; echo \$?" \ run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --cflags missing-require; echo \$?" \
'1' '1'
# test quoted #35
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --cflags quotes" \
"-DQUOTED=\\\"bla\\\""
# 10) tests for internal getopt implementation with options at the end # 10) tests for internal getopt implementation with options at the end
if [ "x@STRICT_MODE@" = "xno" ]; then if [ "x@STRICT_MODE@" = "xno" ]; then
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} foo --libs" \ run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} foo --libs" \