Skip to content

Commit 931d75c

Browse files
bostrtFelipe Zimmerle
authored andcommitted
Added -V version flag.
1 parent 1e5a2ea commit 931d75c

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

modsec-sdbm-util.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,9 +368,13 @@ int remove_key (apr_pool_t *pool, apr_sdbm_t *db, const char *key_str)
368368
return remove_datum_t(pool, db, &key);
369369
}
370370

371+
void version (void) {
372+
p("\n modsec-sdbm-util %s\n\n", VERSION);
373+
}
374+
371375
void help (void) {
372376

373-
p("\n Usage: modsec-sdbm-util [nkxsdahvurD] <database-name>\n\n");
377+
p("\n Usage: modsec-sdbm-util [nkxsdahVvurD] <database-name>\n\n");
374378

375379
p("This utility was created in order to make easy the maintenance of the SDBM files\n");
376380
p("which stores ModSecurity persistent collections.\n\n");
@@ -391,6 +395,7 @@ void help (void) {
391395
p(" -x, expired: Print only the expired elements. (As unpack, this item does not\n");
392396
p("\tmake sense without the dump option);\n");
393397
p(" -r, remove: Expects to receive a key as a paramter to be removed;\n");
398+
p(" -V. version: Print version information.\n");
394399
p(" -v, verbose: Some extra information about what this utility is doing.\n");
395400
p(" -h, help: this message.\n\n");
396401

@@ -411,7 +416,7 @@ int main (int argc, char **argv)
411416
return 0;
412417
}
413418

414-
while ((c = getopt (argc, argv, "nkxsdahvur:D:")) != -1)
419+
while ((c = getopt (argc, argv, "nkxsdahVvur:D:")) != -1)
415420
switch (c)
416421
{
417422
case 'd':
@@ -442,6 +447,9 @@ int main (int argc, char **argv)
442447
case 'v':
443448
verbose = 1;
444449
break;
450+
case 'V':
451+
version();
452+
return 0;
445453
case '?':
446454
if (optopt == 'r')
447455
fprintf (stderr, "Option -%c requires an argument.\n", optopt);

0 commit comments

Comments
 (0)