1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-07-05 09:38:40 +00:00

enhanced version information

This commit is contained in:
John Hewson 2013-01-23 12:29:59 +00:00
parent d274d4f6c8
commit b1dc3eb11a
3 changed files with 33 additions and 3 deletions

View File

@ -12,6 +12,8 @@
#include <iostream> #include <iostream>
#include <getopt.h> #include <getopt.h>
#include <poppler-config.h>
#include <goo/GooString.h> #include <goo/GooString.h>
#include <Object.h> #include <Object.h>
@ -24,6 +26,7 @@
#include "HTMLRenderer/HTMLRenderer.h" #include "HTMLRenderer/HTMLRenderer.h"
#include "util/ArgParser.h" #include "util/ArgParser.h"
#include "util/path.h" #include "util/path.h"
#include "util/ffw.h"
using namespace std; using namespace std;
using namespace pdf2htmlEX; using namespace pdf2htmlEX;
@ -31,11 +34,17 @@ using namespace pdf2htmlEX;
Param param; Param param;
ArgParser argparser; ArgParser argparser;
void show_usage_and_exit(const char * dummy = nullptr) void show_version()
{ {
cerr << "pdftohtmlEX version " << PDF2HTMLEX_VERSION << endl; cerr << "pdftohtmlEX version " << PDF2HTMLEX_VERSION;
cerr << " (poppler " << POPPLER_VERSION;
cerr << ", libfontforge " << ffw_get_version() << ")";
cerr << endl; cerr << endl;
cerr << "Copyright 2012 Lu Wang <coolwanglu@gmail.com>" << endl; cerr << "Copyright 2012 Lu Wang <coolwanglu@gmail.com>" << endl;
}
void show_usage()
{
cerr << endl; cerr << endl;
cerr << "Usage: pdf2htmlEX [Options] <input.pdf> [<output.html>]" << endl; cerr << "Usage: pdf2htmlEX [Options] <input.pdf> [<output.html>]" << endl;
cerr << endl; cerr << endl;
@ -47,11 +56,24 @@ void show_usage_and_exit(const char * dummy = nullptr)
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
void show_usage_and_exit(const char * dummy = nullptr)
{
show_version();
show_usage();
exit(EXIT_FAILURE);
}
void show_version_and_exit(const char * dummy = nullptr)
{
show_version();
exit(EXIT_FAILURE);
}
void parse_options (int argc, char **argv) void parse_options (int argc, char **argv)
{ {
argparser argparser
.add("help,h", "show all options", &show_usage_and_exit) .add("help,h", "show all options", &show_usage_and_exit)
.add("version,v", "show copyright and version info", &show_usage_and_exit) .add("version,v", "show copyright and version info", &show_version_and_exit)
.add("owner-password,o", &param.owner_password, "", "owner password (for encrypted files)", nullptr, true) .add("owner-password,o", &param.owner_password, "", "owner password (for encrypted files)", nullptr, true)
.add("user-password,u", &param.user_password, "", "user password (for encrypted files)", nullptr, true) .add("user-password,u", &param.user_password, "", "user password (for encrypted files)", nullptr, true)

View File

@ -400,3 +400,10 @@ void ffw_auto_hint(void)
FVAutoHint(cur_fv); FVAutoHint(cur_fv);
FVAutoInstr(cur_fv); FVAutoInstr(cur_fv);
} }
char* ffw_get_version(void)
{
char* str = (char*)malloc(sizeof(char) * 20);
printf("%d", library_version_configuration.library_source_versiondate);
return str;
}

View File

@ -23,6 +23,7 @@ extern "C" {
// global // global
void ffw_init(int debug); void ffw_init(int debug);
void ffw_finalize(void); void ffw_finalize(void);
char* ffw_get_version(void);
//////////////////////// ////////////////////////
// load & save // load & save