From 841f967a5fbd0a14b460903bebd2e8962d4817fb Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Sun, 30 Jul 2017 08:44:45 -0400 Subject: Fix command-line checking in pdf-split-pages example --- examples/pdf-split-pages.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'examples/pdf-split-pages.cc') 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 #include +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 { -- cgit v1.2.3-54-g00ecf