From 3c98814bb50132c41b093f82813cf5003e0995c8 Mon Sep 17 00:00:00 2001
From: Russell Bryant <russell@russellbryant.com>
Date: Thu, 19 May 2005 01:57:19 +0000
Subject: [PATCH] add 'dontwarn' option to asterisk.conf to appease the whining
 masses :p (bug #4320)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5723 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 asterisk.c                 | 4 ++++
 frame.c                    | 2 +-
 include/asterisk/options.h | 1 +
 pbx/pbx_config.c           | 7 +++++--
 4 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/asterisk.c b/asterisk.c
index 308519ba27..afdcf7ec62 100755
--- a/asterisk.c
+++ b/asterisk.c
@@ -88,6 +88,7 @@ int option_overrideconfig = 0;
 int option_reconnect = 0;
 int option_transcode_slin = 1;
 int option_maxcalls = 0;
+int option_dontwarn = 0;
 int fully_booted = 0;
 char record_cache_dir[AST_CACHE_DIR_LEN] = AST_TMP_DIR;
 char debug_filename[AST_FILENAME_MAX] = "";
@@ -1647,6 +1648,9 @@ static void ast_readconfig(void) {
 		/* Disable ANSI colors for console (-c at startup) */
 		} else if (!strcasecmp(v->name, "nocolor")) {
 			option_nocolor = ast_true(v->value);
+		/* Disable some usage warnings for picky people :p */
+		} else if (!strcasecmp(v->name, "dontwarn")) {
+			option_dontwarn = ast_true(v->value);
 		/* Dump core in case of crash (-g) */
 		} else if (!strcasecmp(v->name, "dumpcore")) {
 			option_dumpcore = ast_true(v->value);
diff --git a/frame.c b/frame.c
index e52881fe2c..23a6e59506 100755
--- a/frame.c
+++ b/frame.c
@@ -578,7 +578,7 @@ static int show_codecs(int fd, int argc, char *argv[])
 	if ((argc < 2) || (argc > 3))
 		return RESULT_SHOWUSAGE;
 
-	if (getenv("I_AM_NOT_AN_IDIOT") == NULL)
+	if (!option_dontwarn)
 		ast_cli(fd, "Disclaimer: this command is for informational purposes only.\n"
 				"\tIt does not indicate anything about your configuration.\n");
 
diff --git a/include/asterisk/options.h b/include/asterisk/options.h
index 9d962bbe5a..083b0c4741 100755
--- a/include/asterisk/options.h
+++ b/include/asterisk/options.h
@@ -34,6 +34,7 @@ extern int option_cache_record_files;
 extern int option_timestamp;
 extern int option_transcode_slin;
 extern int option_maxcalls;
+extern int option_dontwarn;
 extern char defaultlanguage[];
 extern time_t ast_startuptime;
 extern time_t ast_lastreloadtime;
diff --git a/pbx/pbx_config.c b/pbx/pbx_config.c
index fc069e12bc..8aa523c5aa 100755
--- a/pbx/pbx_config.c
+++ b/pbx/pbx_config.c
@@ -14,6 +14,7 @@
 #include <sys/types.h>
 #include "asterisk/pbx.h"
 #include "asterisk/config.h"
+#include "asterisk/options.h"
 #include "asterisk/module.h"
 #include "asterisk/logger.h"
 #include "asterisk/cli.h"
@@ -1742,8 +1743,10 @@ static int pbx_load_module(void)
 								if (plus)
 									ipri += atoi(plus);
 								lastpri = ipri;
-								if (!strcmp(realext, "_."))
-									ast_log(LOG_WARNING, "The use of '_.' for an extension is strongly discouraged and can have unexpected behavior.  Please use '_X.' instead at line %d\n", v->lineno);
+								if(!option_dontwarn) {
+									if (!strcmp(realext, "_."))
+										ast_log(LOG_WARNING, "The use of '_.' for an extension is strongly discouraged and can have unexpected behavior.  Please use '_X.' instead at line %d\n", v->lineno);
+								}
 								if (ast_add_extension2(con, 0, realext, ipri, label, cidmatch, appl, strdup(data), FREE, registrar)) {
 									ast_log(LOG_WARNING, "Unable to register extension at line %d\n", v->lineno);
 								}
-- 
GitLab