From 351284b5ec1f0544a37cea41c200227cb762d091 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Wed, 14 Oct 2009 01:06:18 +0000 Subject: make -key not take an argument with a / to appease msys's path translation git-svn-id: svn+q:///qpdf/trunk@803 71b93d88-0707-0410-a8cf-f5a4172ac649 --- examples/pdf-mod-info.cc | 10 +++++++--- examples/qtest/mod-info.test | 12 ++++++------ 2 files changed, 13 insertions(+), 9 deletions(-) (limited to 'examples') diff --git a/examples/pdf-mod-info.cc b/examples/pdf-mod-info.cc index 4e851316..45425634 100644 --- a/examples/pdf-mod-info.cc +++ b/examples/pdf-mod-info.cc @@ -100,7 +100,7 @@ int main(int argc, char* argv[]) char* fl_in = 0; char* fl_out = 0; - char* cur_key = 0; + std::string cur_key; for (int i = 1; i < argc; ++i) { @@ -120,18 +120,22 @@ int main(int argc, char* argv[]) { QTC::TC("examples", "pdf-mod-info -key"); cur_key = argv[i]; + if (! ((cur_key.length() > 0) && (cur_key[0] == '/'))) + { + cur_key = "/" + cur_key; + } Keys[cur_key] = ""; } else if ((! strcmp(argv[i], "-val")) && (++i < argc)) { - if (cur_key == 0) + if (cur_key.empty()) { QTC::TC("examples", "pdf-mod-info usage wrong val"); usage(); } QTC::TC("examples", "pdf-mod-info -val"); Keys[cur_key] = argv[i]; - cur_key = 0; + cur_key.clear(); } else { diff --git a/examples/qtest/mod-info.test b/examples/qtest/mod-info.test index 90db6276..145bf133 100644 --- a/examples/qtest/mod-info.test +++ b/examples/qtest/mod-info.test @@ -34,7 +34,7 @@ $td->runtest("usage #3", $td->NORMALIZE_NEWLINES); $td->runtest("usage #4", - {$td->COMMAND => "$prg -in source1.pdf -key /date -val 01/01/01 -val 12/12/12"}, + {$td->COMMAND => "$prg -in source1.pdf -key date -val 01/01/01 -val 12/12/12"}, {$td->FILE => "usage.out", $td->EXIT_STATUS => 2}, $td->NORMALIZE_NEWLINES); @@ -57,23 +57,23 @@ $td->runtest("dump #3", $td->EXIT_STATUS => 0}); run_and_cmp("modify Subject", - "$prg -in files/source1.pdf -out out.pdf -key /Subject " . + "$prg -in files/source1.pdf -out out.pdf -key Subject " . "-val \"Export Business\"", "", "out.pdf", "files/1.qdf"); run_and_cmp("add Subject, remove Producer, modify CreationDate", - "$prg -in files/source2.pdf -out out.pdf -key /Subject " . - "-val \"Tammlin\" -key /Producer -key /CreationDate -val 12/12", + "$prg -in files/source2.pdf -out out.pdf -key Subject " . + "-val \"Tammlin\" -key Producer -key CreationDate -val 12/12", "", "out.pdf", "files/2.qdf"); run_and_cmp("add Subject (empty-info file)", - "$prg -in files/empty-info.pdf -out out.pdf -key /Subject " . + "$prg -in files/empty-info.pdf -out out.pdf -key Subject " . "-val Tammlin", "", "out.pdf", "files/3.qdf"); copy("files/no-info.pdf", "no-info.pdf") or die "can't copy no-info: $!"; run_and_cmp("in-place Producer added (no-info file)", - "$prg -in no-info.pdf -key /Producer -val \"Obivan Kinobi\"", + "$prg -in no-info.pdf -key Producer -val \"Obivan Kinobi\"", "", "no-info.pdf", "files/4.qdf"); cleanup(); -- cgit v1.2.3-54-g00ecf