Browse code

clamconf: handle --version/-V

git-svn: trunk@4630

Tomasz Kojm authored on 2009/01/22 23:38:16
Showing 4 changed files
... ...
@@ -1,3 +1,7 @@
1
+Thu Jan 22 15:59:43 CET 2009 (tk)
2
+---------------------------------
3
+ * clamconf: handle --version/-V
4
+
1 5
 Thu Jan 22 15:52:14 CET 2009 (tk)
2 6
 ---------------------------------
3 7
  * libclamav/dlp.c: disable the test for ssn_max_group (bb#1355)
... ...
@@ -95,6 +95,7 @@ static void help(void)
95 95
     printf("           (C) 2009 Sourcefire, Inc.\n\n");
96 96
 
97 97
     printf("    --help               -h         Show help\n");
98
+    printf("    --version            -V         Show version\n");
98 99
     printf("    --config-dir=DIR     -c DIR     Read configuration files from DIR\n");
99 100
     printf("    --non-default        -n         Only display non-default settings\n");
100 101
     printf("\n");
... ...
@@ -121,6 +122,12 @@ int main(int argc, char **argv)
121 121
 	return 0;
122 122
     }
123 123
 
124
+    if(optget(opts, "version")->enabled) {
125
+	printf("Clam AntiVirus Configuration Tool %s\n", get_version());
126
+	optfree(opts);
127
+	return 0;
128
+    }
129
+
124 130
     printf("ClamAV engine version: %s\n", get_version());
125 131
     /* TODO: db information */
126 132
 
... ...
@@ -15,6 +15,9 @@ clamconf displays the values of configuration options.
15 15
 \fB\-h, \-\-help\fR
16 16
 Display help and exit.
17 17
 .TP 
18
+\fB\-V, \-\-version\fR
19
+Display software version and exit.
20
+.TP 
18 21
 \fB\-c DIR, \-\-config\-dir DIR\fR
19 22
 Search for configuration files clamd.conf and freshclam.conf in DIR.
20 23
 .TP 
... ...
@@ -63,7 +63,7 @@ const struct clam_option clam_options[] = {
63 63
     { NULL, "config-file", 'c', TYPE_STRING, NULL, 0, CONFDIR"/clamd.conf", FLAG_REQUIRED, OPT_CLAMD | OPT_CLAMDSCAN, "", "" },
64 64
     { NULL, "config-file", 0, TYPE_STRING, NULL, 0, CONFDIR"/freshclam.conf", FLAG_REQUIRED, OPT_FRESHCLAM, "", "" },
65 65
     { NULL, "config-file", 'c', TYPE_STRING, NULL, 0, CONFDIR"/clamav-milter.conf", FLAG_REQUIRED, OPT_MILTER, "", "" },
66
-    { NULL, "version", 'V', TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_CLAMD | OPT_FRESHCLAM | OPT_CLAMSCAN | OPT_CLAMDSCAN | OPT_SIGTOOL | OPT_MILTER, "", "" },
66
+    { NULL, "version", 'V', TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_CLAMD | OPT_FRESHCLAM | OPT_CLAMSCAN | OPT_CLAMDSCAN | OPT_SIGTOOL | OPT_MILTER | OPT_CLAMCONF, "", "" },
67 67
     { NULL, "debug", 0, TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_CLAMD | OPT_FRESHCLAM | OPT_CLAMSCAN | OPT_SIGTOOL, "", "" },
68 68
     { NULL, "verbose", 'v', TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_FRESHCLAM | OPT_CLAMSCAN | OPT_CLAMDSCAN | OPT_SIGTOOL, "", "" },
69 69
     { NULL, "quiet", 0, TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_FRESHCLAM | OPT_CLAMSCAN | OPT_CLAMDSCAN | OPT_SIGTOOL, "", "" },