Browse code

Add version info to clamsubmit

Shawn Webb authored on 2014/03/29 01:23:23
Showing 1 changed files
... ...
@@ -11,9 +11,10 @@
11 11
 
12 12
 #include "libclamav/clamav.h"
13 13
 #include "libclamav/others.h"
14
+#include "shared/misc.h"
14 15
 #include "shared/getopt.h"
15 16
 
16
-#define OPTS "e:p:n:N:H:h?"
17
+#define OPTS "e:p:n:N:H:h?v"
17 18
 
18 19
 char *read_stream(void);
19 20
 
... ...
@@ -26,10 +27,17 @@ void usage(char *name)
26 26
     fprintf(stderr, "    -n [FILE]\tSubmit a false negative (FN)\n");
27 27
     fprintf(stderr, "    -N [NAME]\tYour name (required)\n");
28 28
     fprintf(stderr, "    -p [FILE]\tSubmit a fase positive (FP)\n");
29
+    fprintf(stderr, "    -v\t\tShow version number and exit\n");
29 30
     fprintf(stderr, "You must specify -n or -p. Both are mutually exclusive. Pass in - as the filename for stdin.\n");
30 31
     exit(0);
31 32
 }
32 33
 
34
+void version(void)
35
+{
36
+    print_version(NULL);
37
+    exit(0);
38
+}
39
+
33 40
 int main(int argc, char *argv[])
34 41
 {
35 42
     CURL *curl;
... ...
@@ -52,6 +60,8 @@ int main(int argc, char *argv[])
52 52
 
53 53
     while ((ch = my_getopt(argc, argv, OPTS)) > 0) {
54 54
         switch (ch) {
55
+            case 'v':
56
+                version();
55 57
             case 'e':
56 58
                 email = optarg;
57 59
                 break;