Commit 841f967a5fbd0a14b460903bebd2e8962d4817fb
1 parent
6f88fd36
Fix command-line checking in pdf-split-pages example
Showing
1 changed file
with
9 additions
and
2 deletions
examples/pdf-split-pages.cc
| @@ -11,6 +11,7 @@ | @@ -11,6 +11,7 @@ | ||
| 11 | #include <iostream> | 11 | #include <iostream> |
| 12 | #include <cstdlib> | 12 | #include <cstdlib> |
| 13 | 13 | ||
| 14 | +static char const* whoami = 0; | ||
| 14 | static bool static_id = false; | 15 | static bool static_id = false; |
| 15 | 16 | ||
| 16 | static void process(char const* whoami, | 17 | static void process(char const* whoami, |
| @@ -43,9 +44,15 @@ static void process(char const* whoami, | @@ -43,9 +44,15 @@ static void process(char const* whoami, | ||
| 43 | } | 44 | } |
| 44 | } | 45 | } |
| 45 | 46 | ||
| 47 | +void usage() | ||
| 48 | +{ | ||
| 49 | + std::cerr << "Usage: " << whoami << " infile outprefix" << std::endl; | ||
| 50 | + exit(2); | ||
| 51 | +} | ||
| 52 | + | ||
| 46 | int main(int argc, char* argv[]) | 53 | int main(int argc, char* argv[]) |
| 47 | { | 54 | { |
| 48 | - char* whoami = QUtil::getWhoami(argv[0]); | 55 | + whoami = QUtil::getWhoami(argv[0]); |
| 49 | 56 | ||
| 50 | // For libtool's sake.... | 57 | // For libtool's sake.... |
| 51 | if (strncmp(whoami, "lt-", 3) == 0) | 58 | if (strncmp(whoami, "lt-", 3) == 0) |
| @@ -62,7 +69,7 @@ int main(int argc, char* argv[]) | @@ -62,7 +69,7 @@ int main(int argc, char* argv[]) | ||
| 62 | 69 | ||
| 63 | if (argc != 3) | 70 | if (argc != 3) |
| 64 | { | 71 | { |
| 65 | - std::cerr << "Usage: " << whoami << " infile outprefix" << std::endl; | 72 | + usage(); |
| 66 | } | 73 | } |
| 67 | try | 74 | try |
| 68 | { | 75 | { |