add version output, -V option

remotes/origin/master-1.0.x
Victor Julien 16 years ago
parent 6beee776ca
commit 4862488dac

@ -261,6 +261,7 @@ void EngineKill(void) {
void usage(const char *progname) void usage(const char *progname)
{ {
printf("%s %s\n", PROG_NAME, PROG_VER);
printf("USAGE: %s\n\n", progname); printf("USAGE: %s\n\n", progname);
printf("\t-c <path> : path to configuration file\n"); printf("\t-c <path> : path to configuration file\n");
printf("\t-i <dev> : run in pcap live mode\n"); printf("\t-i <dev> : run in pcap live mode\n");
@ -318,7 +319,7 @@ int main(int argc, char **argv)
/* getopt_long stores the option index here. */ /* getopt_long stores the option index here. */
int option_index = 0; 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) { while ((opt = getopt_long(argc, argv, short_opts, long_opts, &option_index)) != -1) {
switch (opt) { switch (opt) {
@ -411,12 +412,17 @@ int main(int argc, char **argv)
regex_arg = NULL; regex_arg = NULL;
#endif #endif
break; break;
case 'V':
printf("\nThis is %s version %s\n\n", PROG_NAME, PROG_VER);
exit(EXIT_SUCCESS);
default: default:
usage(argv[0]); usage(argv[0]);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
SCLogInfo("This is %s version %s", PROG_NAME, PROG_VER);
if (!CheckValidDaemonModes(daemon, mode)) { if (!CheckValidDaemonModes(daemon, mode)) {
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }

@ -13,7 +13,8 @@
#include "packet-queue.h" #include "packet-queue.h"
/* the name of our binary */ /* the name of our binary */
#define PROG_NAME "suricata" #define PROG_NAME "Suricata"
#define PROG_VER "0.8"
/* max packets processed simultaniously */ /* max packets processed simultaniously */
#define MAX_PENDING 50 #define MAX_PENDING 50

Loading…
Cancel
Save