summaryrefslogtreecommitdiff
path: root/pdf-simple-sign.cpp
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2020-09-05 20:00:11 +0200
committerPřemysl Eric Janouch <p@janouch.name>2020-09-05 20:08:41 +0200
commit46fa50749f79e624a16adb081f7e5c5ff4a5b717 (patch)
tree0ad54eafa59b7246986dc59c6c677773d8244e90 /pdf-simple-sign.cpp
parent796a9640d36328465cef66752a811eac5f7b3da5 (diff)
downloadpdf-simple-sign-46fa50749f79e624a16adb081f7e5c5ff4a5b717.tar.gz
pdf-simple-sign-46fa50749f79e624a16adb081f7e5c5ff4a5b717.tar.xz
pdf-simple-sign-46fa50749f79e624a16adb081f7e5c5ff4a5b717.zip
Add a --version option
And fix that --reservation was missing from the optstring.
Diffstat (limited to 'pdf-simple-sign.cpp')
-rw-r--r--pdf-simple-sign.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/pdf-simple-sign.cpp b/pdf-simple-sign.cpp
index 34acc9f..6bbb284 100644
--- a/pdf-simple-sign.cpp
+++ b/pdf-simple-sign.cpp
@@ -37,6 +37,8 @@
#include <openssl/x509v3.h>
#include <openssl/pkcs12.h>
+#include "config.h"
+
// -------------------------------------------------------------------------------------------------
using uint = unsigned int;
@@ -952,6 +954,7 @@ int main(int argc, char* argv[]) {
static struct option opts[] = {
{"help", no_argument, 0, 'h'},
+ {"version", no_argument, 0, 'V'},
{"reservation", required_argument, 0, 'r'},
{nullptr, 0, 0, 0},
};
@@ -961,7 +964,7 @@ int main(int argc, char* argv[]) {
while (1) {
int option_index = 0;
auto c = getopt_long(argc, const_cast<char* const*>(argv),
- "h", opts, &option_index);
+ "hVr:", opts, &option_index);
if (c == -1)
break;
@@ -972,6 +975,9 @@ int main(int argc, char* argv[]) {
if (errno || *end || reservation <= 0 || reservation > USHRT_MAX)
die(1, "%s: must be a positive number", optarg);
break;
+ case 'V':
+ die(0, "%s", PROJECT_NAME " " PROJECT_VERSION);
+ break;
case 'h':
default:
usage();