summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index 1111a2c..226b8d0 100644
--- a/src/main.c
+++ b/src/main.c
@@ -21,6 +21,11 @@
#include "i18n_cat.h"
+// Shamelessly ripped off from the GCC docs on stringizing
+// This (xstr) converts a macro to a string literal
+#define xstr(s) str(s)
+#define str(s) #s
+
void usage() {
printf(
@@ -42,6 +47,7 @@ void usage() {
"\n"
" -h,--help Print this help text\n"
" -d,--debug Enable debug mode (prints entire character pool)\n"
+ " -V,--version Prints the version\n"
);
}
@@ -99,7 +105,11 @@ int main(int argc, char* argv[]) {
return 0;
} else if(strcmp(argv[i], "-d") == 0 || strcmp(argv[i], "--debug") == 0) {
- debug = 1;
+ debug = 1;
+
+ } else if(strcmp(argv[i], "-V") == 0 || strcmp(argv[i], "--version") == 0) {
+ printf("upwgen %s\n", xstr(VERSTR));
+ return 0;
} else {
// If we reach this block, the user specified a custom length (or

Generated by cgit