summaryrefslogtreecommitdiff
path: root/test/nsgif.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/nsgif.c')
-rw-r--r--test/nsgif.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/nsgif.c b/test/nsgif.c
index f873bab..16a4bc9 100644
--- a/test/nsgif.c
+++ b/test/nsgif.c
@@ -21,6 +21,9 @@
#include "cli.h"
#include "cli.c"
+#define STR_VAL(_S) STR(_S)
+#define STR(_S) #_S
+
#define BYTES_PER_PIXEL 4
static struct nsgif_options {
@@ -28,6 +31,7 @@ static struct nsgif_options {
const char *ppm;
uint64_t loops;
bool palette;
+ bool version;
bool info;
bool help;
} nsgif_options;
@@ -71,6 +75,14 @@ static const struct cli_table_entry cli_entries[] = {
.d = "Save palette images."
},
{
+ .s = 'V',
+ .l = "version",
+ .t = CLI_BOOL,
+ .no_pos = true,
+ .v.b = &nsgif_options.version,
+ .d = "Print version number."
+ },
+ {
.p = true,
.l = "FILE",
.t = CLI_STRING,
@@ -372,6 +384,11 @@ int main(int argc, char *argv[])
return EXIT_SUCCESS;
}
+ if (nsgif_options.version) {
+ printf("%s %s\n", STR_VAL(NSGIF_NAME), STR_VAL(NSGIF_VERSION));
+ return EXIT_SUCCESS;
+ }
+
if (nsgif_options.ppm != NULL) {
ppm = fopen(nsgif_options.ppm, "w+");
if (ppm == NULL) {