From 4862488dacac8bfca478ef9fb4790d74f2496649 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Thu, 31 Dec 2009 11:47:02 +0100 Subject: [PATCH] add version output, -V option --- src/suricata.c | 8 +++++++- src/suricata.h | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/suricata.c b/src/suricata.c index f14f94431f..b28b0740a5 100644 --- a/src/suricata.c +++ b/src/suricata.c @@ -261,6 +261,7 @@ void EngineKill(void) { void usage(const char *progname) { + printf("%s %s\n", PROG_NAME, PROG_VER); printf("USAGE: %s\n\n", progname); printf("\t-c : path to configuration file\n"); printf("\t-i : run in pcap live mode\n"); @@ -318,7 +319,7 @@ int main(int argc, char **argv) /* getopt_long stores the option index here. */ int option_index = 0; - char short_opts[] = "c:Dhi:l:q:r:us:U:"; + char short_opts[] = "c:Dhi:l:q:r:us:U:V"; while ((opt = getopt_long(argc, argv, short_opts, long_opts, &option_index)) != -1) { switch (opt) { @@ -411,12 +412,17 @@ int main(int argc, char **argv) regex_arg = NULL; #endif break; + case 'V': + printf("\nThis is %s version %s\n\n", PROG_NAME, PROG_VER); + exit(EXIT_SUCCESS); default: usage(argv[0]); exit(EXIT_FAILURE); } } + SCLogInfo("This is %s version %s", PROG_NAME, PROG_VER); + if (!CheckValidDaemonModes(daemon, mode)) { exit(EXIT_FAILURE); } diff --git a/src/suricata.h b/src/suricata.h index 0ec31ef8d5..35e1c7d47e 100644 --- a/src/suricata.h +++ b/src/suricata.h @@ -13,7 +13,8 @@ #include "packet-queue.h" /* the name of our binary */ -#define PROG_NAME "suricata" +#define PROG_NAME "Suricata" +#define PROG_VER "0.8" /* max packets processed simultaniously */ #define MAX_PENDING 50