Display a message if no config mappings are found with "core show config mappings".
authorJason Parker <jparker@digium.com>
Mon, 7 Jan 2008 21:12:33 +0000 (21:12 +0000)
committerJason Parker <jparker@digium.com>
Mon, 7 Jan 2008 21:12:33 +0000 (21:12 +0000)
Closes issue #11704, patch by kshumard.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@96936 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/config.c

index 4359bcf..d5b0738 100644 (file)
@@ -2249,16 +2249,21 @@ static char *handle_cli_core_show_config_mappings(struct ast_cli_entry *e, int c
        
        ast_mutex_lock(&config_lock);
 
-       ast_cli(a->fd, "\n\n");
-       for (eng = config_engine_list; eng; eng = eng->next) {
-               ast_cli(a->fd, "\nConfig Engine: %s\n", eng->name);
-               for (map = config_maps; map; map = map->next)
-                       if (!strcasecmp(map->driver, eng->name)) {
-                               ast_cli(a->fd, "===> %s (db=%s, table=%s)\n", map->name, map->database,
-                                       map->table ? map->table : map->name);
+       if (!config_engine_list) {
+               ast_cli(a->fd, "No config mappings found.\n");
+       } else {
+               ast_cli(a->fd, "\n\n");
+               for (eng = config_engine_list; eng; eng = eng->next) {
+                       ast_cli(a->fd, "\nConfig Engine: %s\n", eng->name);
+                       for (map = config_maps; map; map = map->next) {
+                               if (!strcasecmp(map->driver, eng->name)) {
+                                       ast_cli(a->fd, "===> %s (db=%s, table=%s)\n", map->name, map->database,
+                                                       map->table ? map->table : map->name);
+                               }
                        }
+               }
+               ast_cli(a->fd,"\n\n");
        }
-       ast_cli(a->fd,"\n\n");
        
        ast_mutex_unlock(&config_lock);