From ab48da3f3382271663e7987e2d7de166f00da6e2 Mon Sep 17 00:00:00 2001 From: Baptiste Daroussin Date: Tue, 14 Aug 2012 11:12:01 +0200 Subject: [PATCH] Keep the backslash when parsing arguments (fixes #35) --- argvsplit.c | 2 ++ tests/lib1/quotes.pc | 10 ++++++++++ tests/run.sh.in | 4 ++++ 3 files changed, 16 insertions(+) create mode 100644 tests/lib1/quotes.pc diff --git a/argvsplit.c b/argvsplit.c index cbfb55d..e9ed7b6 100644 --- a/argvsplit.c +++ b/argvsplit.c @@ -92,6 +92,8 @@ pkg_argv_split(const char *src, int *argc, char ***argv) free(argv); free(buf); return -1; + } else { + *dst_iter++ = '\\'; } default: *dst_iter++ = *src_iter; diff --git a/tests/lib1/quotes.pc b/tests/lib1/quotes.pc new file mode 100644 index 0000000..1aee256 --- /dev/null +++ b/tests/lib1/quotes.pc @@ -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\" diff --git a/tests/run.sh.in b/tests/run.sh.in index 231af22..ee50b3d 100644 --- a/tests/run.sh.in +++ b/tests/run.sh.in @@ -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 \$?" \ '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 if [ "x@STRICT_MODE@" = "xno" ]; then run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} foo --libs" \