summaryrefslogtreecommitdiff
path: root/main/config.c
diff options
context:
space:
mode:
authorJason Parker <jparker@digium.com>2007-10-19 18:01:00 +0000
committerJason Parker <jparker@digium.com>2007-10-19 18:01:00 +0000
commit65761cbd7a322352fdb834fedee8d4bbb62be61c (patch)
treef7b900279b3959d2cc8feddc22a7d8643eb60f95 /main/config.c
parent306b944208788246310ebec3c7e2639839768378 (diff)
More changes to NEW_CLI.
Also fixes a few cli messages and some minor formatting. (closes issue #11001) Reported by: seanbright Patches: newcli.1.patch uploaded by seanbright (license 71) newcli.2.patch uploaded by seanbright (license 71) newcli.4.patch uploaded by seanbright (license 71) newcli.5.patch uploaded by seanbright (license 71) newcli.6.patch uploaded by seanbright (license 71) newcli.7.patch uploaded by seanbright (license 71) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@86534 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/config.c')
-rw-r--r--main/config.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/main/config.c b/main/config.c
index 1dc16fdc7..d8fb6df85 100644
--- a/main/config.c
+++ b/main/config.c
@@ -2143,37 +2143,42 @@ int ast_parse_arg(const char *arg, enum ast_parse_flags flags,
return error;
}
-static int config_command(int fd, int argc, char **argv)
+static char *handle_cli_core_show_config_mappings(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
struct ast_config_engine *eng;
struct ast_config_map *map;
+
+ switch (cmd) {
+ case CLI_INIT:
+ e->command = "core show config mappings";
+ e->usage =
+ "Usage: core show config mappings\n"
+ " Shows the filenames to config engines.\n";
+ return NULL;
+ case CLI_GENERATE:
+ return NULL;
+ }
ast_mutex_lock(&config_lock);
- ast_cli(fd, "\n\n");
+ ast_cli(a->fd, "\n\n");
for (eng = config_engine_list; eng; eng = eng->next) {
- ast_cli(fd, "\nConfig Engine: %s\n", eng->name);
+ 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(fd, "===> %s (db=%s, table=%s)\n", map->name, map->database,
+ ast_cli(a->fd, "===> %s (db=%s, table=%s)\n", map->name, map->database,
map->table ? map->table : map->name);
}
}
- ast_cli(fd,"\n\n");
+ ast_cli(a->fd,"\n\n");
ast_mutex_unlock(&config_lock);
- return 0;
+ return CLI_SUCCESS;
}
-static char show_config_help[] =
- "Usage: core show config mappings\n"
- " Shows the filenames to config engines.\n";
-
static struct ast_cli_entry cli_config[] = {
- { { "core", "show", "config", "mappings", NULL },
- config_command, "Display config mappings (file names to config engines)",
- show_config_help },
+ NEW_CLI(handle_cli_core_show_config_mappings, "Display config mappings (file names to config engines)"),
};
int register_config_cli()