2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-06-12 15:12:22 +00:00

Separate copyright notice from --version option

This commit is contained in:
Jay Berkenbilt 2018-02-24 23:50:32 -05:00
parent c74d79ae11
commit 9a4ef8c95d
2 changed files with 21 additions and 6 deletions

View File

@ -225,6 +225,9 @@ provided last take precedence.\n\
Basic Options\n\
-------------\n\
\n\
--version show version of qpdf\n\
--copyright show qpdf's copyright and license information\n\
--help show command-line argument help\n\
--password=password specify a password for accessing encrypted files\n\
--verbose provide additional informational output\n\
--linearize generated a linearized (web optimized) file\n\
@ -1188,16 +1191,23 @@ static void read_args_from_file(char const* filename,
static void handle_help_version(int argc, char* argv[])
{
// Make sure the outpu looks right on an 80-column display.
if ((argc == 2) &&
((strcmp(argv[1], "--version") == 0) ||
(strcmp(argv[1], "-version") == 0)))
{
// make_dist looks for the line of code here that actually
// prints the version number, so read make_dist if you change
// anything other than the version number. Don't worry about
// the numbers. That's just a guide to 80 columns so that the
// help message looks right on an 80-column display.
std::cout
<< whoami << " version " << QPDF::QPDFVersion() << std::endl
<< "Run " << whoami << " --copyright to see copyright and license information."
<< std::endl;
exit(0);
}
if ((argc == 2) &&
((strcmp(argv[1], "--copyright") == 0) ||
(strcmp(argv[1], "-copyright") == 0)))
{
// 1 2 3 4 5 6 7 8
// 12345678901234567890123456789012345678901234567890123456789012345678901234567890
std::cout

View File

@ -250,12 +250,17 @@ foreach my $d (@bug_tests)
show_ntests();
# ----------
$td->notify("--- Library version ---");
$n_tests += 2;
$n_tests += 3;
$td->runtest("qpdf version",
{$td->COMMAND => "qpdf --version"},
{$td->REGEXP => "qpdf version \\S+\n.*", $td->EXIT_STATUS => 0},
$td->NORMALIZE_NEWLINES);
$td->runtest("qpdf copyright contains version too",
{$td->COMMAND => "qpdf --copyright"},
{$td->REGEXP => "(?s)qpdf version \\S+\n.*Apache.*",
$td->EXIT_STATUS => 0},
$td->NORMALIZE_NEWLINES);
$td->runtest("C API: qpdf version",
{$td->COMMAND => "qpdf-ctest --version"},
{$td->REGEXP => "qpdf-ctest version \\S+\n",