diff options
author | Jay Berkenbilt <ejb@ql.org> | 2017-07-30 14:44:45 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2017-07-30 14:47:09 +0200 |
commit | 841f967a5fbd0a14b460903bebd2e8962d4817fb (patch) | |
tree | 69454421ee80761e4bff6cb79628927b546a6efc | |
parent | 6f88fd36abe6c531caa182bb7c01c3ed00644578 (diff) | |
download | qpdf-841f967a5fbd0a14b460903bebd2e8962d4817fb.tar.zst |
Fix command-line checking in pdf-split-pages example
-rw-r--r-- | examples/pdf-split-pages.cc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/examples/pdf-split-pages.cc b/examples/pdf-split-pages.cc index 14f7c5d5..05a9fdc5 100644 --- a/examples/pdf-split-pages.cc +++ b/examples/pdf-split-pages.cc @@ -11,6 +11,7 @@ #include <iostream> #include <cstdlib> +static char const* whoami = 0; static bool static_id = false; static void process(char const* whoami, @@ -43,9 +44,15 @@ static void process(char const* whoami, } } +void usage() +{ + std::cerr << "Usage: " << whoami << " infile outprefix" << std::endl; + exit(2); +} + int main(int argc, char* argv[]) { - char* whoami = QUtil::getWhoami(argv[0]); + whoami = QUtil::getWhoami(argv[0]); // For libtool's sake.... if (strncmp(whoami, "lt-", 3) == 0) @@ -62,7 +69,7 @@ int main(int argc, char* argv[]) if (argc != 3) { - std::cerr << "Usage: " << whoami << " infile outprefix" << std::endl; + usage(); } try { |