From 805152b61911602ace027b651172669b38045cb1 Mon Sep 17 00:00:00 2001 From: Kaian Date: Sun, 29 May 2016 12:34:55 +0200 Subject: [PATCH] Improve disabled command line options error messages #120 When using a command line option that must be enabled using configure flags, display an error message to give a hint that the given options is not enabled. --- src/main.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index 2630bc9..f2f29d8 100644 --- a/src/main.c +++ b/src/main.c @@ -193,10 +193,13 @@ main(int argc, char* argv[]) return 0; } break; -#if defined(WITH_GNUTLS) || defined(WITH_OPENSSL) case 'k': +#if defined(WITH_GNUTLS) || defined(WITH_OPENSSL) keyfile = optarg; break; +#else + fprintf(stderr, "sngrep is not compiled with SSL support."); + exit(1); #endif case 'c': only_calls = 1; @@ -228,13 +231,21 @@ main(int argc, char* argv[]) case 't': case 'W': break; -#ifdef USE_EEP case 'L': +#ifdef USE_EEP capture_eep_set_server_url(optarg); break; +#else + fprintf(stderr, "sngrep is not compiled with HEP/EEP support."); + exit(1); +#endif case 'H': +#ifdef USE_EEP capture_eep_set_client_url(optarg); break; +#else + fprintf(stderr, "sngrep is not compiled with HEP/EEP support."); + exit(1); #endif case '?': if (strchr(options, optopt)) {