From 5aacb6a82d4cf625774fa1ea39ca193a3be73b35 Mon Sep 17 00:00:00 2001 From: kpfleming Date: Mon, 18 Sep 2006 19:54:18 +0000 Subject: merge qwell's CLI verbification work git-svn-id: http://svn.digium.com/svn/asterisk/trunk@43212 f38db490-d61c-443f-a65b-d21fe96a405b --- res/res_agi.c | 70 +++++++++++++++++++++++++++++++++----------------- res/res_clioriginate.c | 12 ++++++--- res/res_config_pgsql.c | 14 +++++----- res/res_convert.c | 21 ++++++++++----- res/res_crypto.c | 29 +++++++++++++++------ res/res_features.c | 27 +++++++++++-------- res/res_indications.c | 40 ++++++++++++++--------------- res/res_jabber.c | 30 ++++++++++++++++------ res/res_musiconhold.c | 32 +++++++++++++++++------ res/res_odbc.c | 51 ++++++++++++++++++++---------------- 10 files changed, 211 insertions(+), 115 deletions(-) (limited to 'res') diff --git a/res/res_agi.c b/res/res_agi.c index edcda4e60..7794449aa 100644 --- a/res/res_agi.c +++ b/res/res_agi.c @@ -1302,7 +1302,7 @@ static char debug_usage[] = " Enables dumping of AGI transactions for debugging purposes\n"; static char no_debug_usage[] = -"Usage: agi no debug\n" +"Usage: agi nodebug\n" " Disables dumping of AGI transactions for debugging purposes\n"; static int agi_do_debug(int fd, int argc, char *argv[]) @@ -1314,7 +1314,7 @@ static int agi_do_debug(int fd, int argc, char *argv[]) return RESULT_SUCCESS; } -static int agi_no_debug(int fd, int argc, char *argv[]) +static int agi_no_debug_deprecated(int fd, int argc, char *argv[]) { if (argc != 3) return RESULT_SHOWUSAGE; @@ -1323,11 +1323,14 @@ static int agi_no_debug(int fd, int argc, char *argv[]) return RESULT_SUCCESS; } -static struct ast_cli_entry cli_debug = - { { "agi", "debug", NULL }, agi_do_debug, "Enable AGI debugging", debug_usage }; - -static struct ast_cli_entry cli_no_debug = - { { "agi", "no", "debug", NULL }, agi_no_debug, "Disable AGI debugging", no_debug_usage }; +static int agi_no_debug(int fd, int argc, char *argv[]) +{ + if (argc != 2) + return RESULT_SHOWUSAGE; + agidebug = 0; + ast_cli(fd, "AGI Debugging Disabled\n"); + return RESULT_SUCCESS; +} static int handle_noop(struct ast_channel *chan, AGI *agi, int arg, char *argv[]) { @@ -1924,7 +1927,7 @@ static int handle_showagi(int fd, int argc, char *argv[]) return RESULT_SUCCESS; } -static int handle_dumpagihtml(int fd, int argc, char *argv[]) +static int handle_agidumphtml(int fd, int argc, char *argv[]) { struct agi_command *e; char fullcmd[80]; @@ -2080,29 +2083,53 @@ static int deadagi_exec(struct ast_channel *chan, void *data) } static char showagi_help[] = -"Usage: show agi [topic]\n" +"Usage: agi list [topic]\n" " When called with a topic as an argument, displays usage\n" " information on the given command. If called without a\n" " topic, it provides a list of AGI commands.\n"; static char dumpagihtml_help[] = -"Usage: dump agihtml \n" +"Usage: agi dumphtml \n" " Dumps the agi command list in html format to given filename\n"; -static struct ast_cli_entry showagi = -{ { "show", "agi", NULL }, handle_showagi, "Show AGI commands or specific help", showagi_help }; - -static struct ast_cli_entry dumpagihtml = -{ { "dump", "agihtml", NULL }, handle_dumpagihtml, "Dumps a list of agi command in html format", dumpagihtml_help }; +static struct ast_cli_entry cli_show_agi_deprecated = { + { "show", "agi", NULL }, + handle_showagi, NULL, + NULL }; + +static struct ast_cli_entry cli_dump_agihtml_deprecated = { + { "dump", "agihtml", NULL }, + handle_agidumphtml, NULL, + NULL }; + +static struct ast_cli_entry cli_agi_no_debug_deprecated = { + { "agi", "no", "debug", NULL }, + agi_no_debug_deprecated, NULL, + NULL }; + +static struct ast_cli_entry cli_agi[] = { + { { "agi", "debug", NULL }, + agi_do_debug, "Enable AGI debugging", + debug_usage }, + + { { "agi", "nodebug", NULL }, + agi_no_debug, "Disable AGI debugging", + no_debug_usage, NULL, &cli_agi_no_debug_deprecated }, + + { { "agi", "list", NULL }, + handle_showagi, "List AGI commands or specific help", + showagi_help, NULL, &cli_show_agi_deprecated }, + + { { "agi", "dumphtml", NULL }, + handle_agidumphtml, "Dumps a list of agi commands in html format", + dumpagihtml_help, NULL, &cli_dump_agihtml_deprecated }, +}; static int unload_module(void) { ast_module_user_hangup_all(); - ast_cli_unregister(&showagi); - ast_cli_unregister(&dumpagihtml); - ast_cli_unregister(&cli_debug); - ast_cli_unregister(&cli_no_debug); + ast_cli_unregister_multiple(cli_agi, sizeof(cli_agi) / sizeof(struct ast_cli_entry)); ast_unregister_application(eapp); ast_unregister_application(deadapp); return ast_unregister_application(app); @@ -2110,10 +2137,7 @@ static int unload_module(void) static int load_module(void) { - ast_cli_register(&showagi); - ast_cli_register(&dumpagihtml); - ast_cli_register(&cli_debug); - ast_cli_register(&cli_no_debug); + ast_cli_register_multiple(cli_agi, sizeof(cli_agi) / sizeof(struct ast_cli_entry)); ast_register_application(deadapp, deadagi_exec, deadsynopsis, descrip); ast_register_application(eapp, eagi_exec, esynopsis, descrip); return ast_register_application(app, agi_exec, synopsis, descrip); diff --git a/res/res_clioriginate.c b/res/res_clioriginate.c index 454dc7815..44afd7b76 100644 --- a/res/res_clioriginate.c +++ b/res/res_clioriginate.c @@ -63,7 +63,11 @@ static char orig_help[] = static int handle_orig(int fd, int argc, char *argv[]); static char *complete_orig(const char *line, const char *word, int pos, int state); -struct ast_cli_entry cli_orig = { { "originate", NULL }, handle_orig, "Originate a call", orig_help, complete_orig }; +struct ast_cli_entry cli_cliorig[] = { + { { "originate", NULL }, + handle_orig, "Originate a call", + orig_help, complete_orig }, +}; static int orig_app(int fd, const char *chan, const char *app, const char *appdata) { @@ -158,12 +162,14 @@ static char *complete_orig(const char *line, const char *word, int pos, int stat static int unload_module(void) { - return ast_cli_unregister(&cli_orig); + ast_cli_unregister_multiple(cli_cliorig, sizeof(cli_cliorig) / sizeof(struct ast_cli_entry)); + return 0; } static int load_module(void) { - return ast_cli_register(&cli_orig); + ast_cli_register_multiple(cli_cliorig, sizeof(cli_cliorig) / sizeof(struct ast_cli_entry)); + return 0; } AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Call origination from the CLI"); diff --git a/res/res_config_pgsql.c b/res/res_config_pgsql.c index 4665823f3..fae140011 100644 --- a/res/res_config_pgsql.c +++ b/res/res_config_pgsql.c @@ -70,11 +70,11 @@ static char cli_realtime_pgsql_status_usage[] = "Usage: realtime pgsql status\n" " Shows connection information for the Postgresql RealTime driver\n"; -static struct ast_cli_entry cli_realtime_pgsql_status = { - { "realtime", "pgsql", "status", NULL }, realtime_pgsql_status, - "Shows connection information for the Postgresql RealTime driver", - cli_realtime_pgsql_status_usage, NULL - }; +static struct ast_cli_entry cli_realtime[] = { + { { "realtime", "pgsql", "status", NULL }, + realtime_pgsql_status, "Shows connection information for the Postgresql RealTime driver", + cli_realtime_pgsql_status_usage }, +}; static struct ast_variable *realtime_pgsql(const char *database, const char *table, va_list ap) { @@ -569,7 +569,7 @@ static int load_module(void) if (option_verbose) { ast_verbose("Postgresql RealTime driver loaded.\n"); } - ast_cli_register(&cli_realtime_pgsql_status); + ast_cli_register_multiple(cli_realtime, sizeof(cli_realtime) / sizeof(struct ast_cli_entry)); ast_mutex_unlock(&pgsql_lock); @@ -585,7 +585,7 @@ static int unload_module(void) PQfinish(pgsqlConn); pgsqlConn = NULL; }; - ast_cli_unregister(&cli_realtime_pgsql_status); + ast_cli_unregister_multiple(cli_realtime, sizeof(cli_realtime) / sizeof(struct ast_cli_entry)); ast_config_engine_deregister(&pgsql_engine); if (option_verbose) { ast_verbose("Postgresql RealTime unloaded.\n"); diff --git a/res/res_convert.c b/res/res_convert.c index 0f46cf14d..ed2c6465a 100644 --- a/res/res_convert.c +++ b/res/res_convert.c @@ -122,24 +122,33 @@ fail_out: } static char usage_audio_convert[] = -"Usage: convert \n" +"Usage: file convert \n" " Convert from file_in to file_out. If an absolute path is not given, the\n" "default Asterisk sounds directory will be used.\n\n" "Example:\n" -" convert tt-weasels.gsm tt-weasels.ulaw\n"; +" file convert tt-weasels.gsm tt-weasels.ulaw\n"; -static struct ast_cli_entry audio_convert_cli={ - { "convert" , NULL }, cli_audio_convert, "Convert audio files", usage_audio_convert +static struct ast_cli_entry cli_convert_deprecated = { + { "convert" , NULL }, + cli_audio_convert, NULL, + NULL }; + +static struct ast_cli_entry cli_convert[] = { + { { "file", "convert" , NULL }, + cli_audio_convert, "Convert audio file", + usage_audio_convert, NULL, &cli_convert_deprecated }, }; static int unload_module(void) { - return ast_cli_unregister(&audio_convert_cli); + ast_cli_unregister_multiple(cli_convert, sizeof(cli_convert) / sizeof(struct ast_cli_entry)); + return 0; } static int load_module(void) { - return ast_cli_register(&audio_convert_cli); + ast_cli_register_multiple(cli_convert, sizeof(cli_convert) / sizeof(struct ast_cli_entry)); + return 0; } AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "File format conversion CLI command"); diff --git a/res/res_crypto.c b/res/res_crypto.c index 3fab770e6..586dd77cf 100644 --- a/res/res_crypto.c +++ b/res/res_crypto.c @@ -554,25 +554,38 @@ static int init_keys(int fd, int argc, char *argv[]) } static char show_key_usage[] = -"Usage: show keys\n" +"Usage: keys list\n" " Displays information about RSA keys known by Asterisk\n"; static char init_keys_usage[] = -"Usage: init keys\n" +"Usage: keys init\n" " Initializes private keys (by reading in pass code from the user)\n"; -static struct ast_cli_entry cli_show_keys = -{ { "show", "keys", NULL }, show_keys, "Displays RSA key information", show_key_usage }; +static struct ast_cli_entry cli_show_keys_deprecated = { + { "show", "keys", NULL }, + show_keys, NULL, + NULL }; -static struct ast_cli_entry cli_init_keys = -{ { "init", "keys", NULL }, init_keys, "Initialize RSA key passcodes", init_keys_usage }; +static struct ast_cli_entry cli_init_keys_deprecated = { + { "init", "keys", NULL }, + init_keys, NULL, + NULL }; + +static struct ast_cli_entry cli_crypto[] = { + { { "keys", "list", NULL }, + show_keys, "Displays RSA key information", + show_key_usage, NULL, &cli_show_keys_deprecated }, + + { { "keys", "init", NULL }, + init_keys, "Initialize RSA key passcodes", + init_keys_usage, NULL, &cli_init_keys_deprecated }, +}; static int crypto_init(void) { SSL_library_init(); ERR_load_crypto_strings(); - ast_cli_register(&cli_show_keys); - ast_cli_register(&cli_init_keys); + ast_cli_register_multiple(cli_crypto, sizeof(cli_crypto) / sizeof(struct ast_cli_entry)); /* Install ourselves into stubs */ ast_key_get = __ast_key_get; diff --git a/res/res_features.c b/res/res_features.c index 88c728fdd..48f93d873 100644 --- a/res/res_features.c +++ b/res/res_features.c @@ -1888,12 +1888,9 @@ static int handle_showfeatures(int fd, int argc, char *argv[]) } static char showfeatures_help[] = -"Usage: show features\n" +"Usage: feature list\n" " Lists currently configured features.\n"; -static struct ast_cli_entry showfeatures = -{ { "show", "features", NULL }, handle_showfeatures, "Lists configured features", showfeatures_help }; - static int handle_parkedcalls(int fd, int argc, char *argv[]) { struct parkeduser *cur; @@ -1922,8 +1919,20 @@ static char showparked_help[] = "Usage: show parkedcalls\n" " Lists currently parked calls.\n"; -static struct ast_cli_entry showparked = -{ { "show", "parkedcalls", NULL }, handle_parkedcalls, "Lists parked calls", showparked_help }; +static struct ast_cli_entry cli_show_features_deprecated = { + { "show", "features", NULL }, + handle_showfeatures, NULL, + NULL }; + +static struct ast_cli_entry cli_features[] = { + { { "feature", "list", NULL }, + handle_showfeatures, "Lists configured features", + showfeatures_help, NULL, &cli_show_features_deprecated }, + + { { "show", "parkedcalls", NULL }, + handle_parkedcalls, "Lists parked calls", + showparked_help }, +}; /*! \brief Dump lot status */ static int manager_parking_status( struct mansession *s, struct message *m ) @@ -2299,8 +2308,7 @@ static int load_module(void) if ((res = load_config())) return res; - ast_cli_register(&showparked); - ast_cli_register(&showfeatures); + ast_cli_register_multiple(cli_features, sizeof(cli_features) / sizeof(struct ast_cli_entry)); ast_pthread_create(&parking_thread, NULL, do_parking_thread, NULL); res = ast_register_application(parkedcall, park_exec, synopsis, descrip); if (!res) @@ -2323,8 +2331,7 @@ static int unload_module(void) ast_manager_unregister("ParkedCalls"); ast_manager_unregister("Park"); - ast_cli_unregister(&showfeatures); - ast_cli_unregister(&showparked); + ast_cli_unregister_multiple(cli_features, sizeof(cli_features) / sizeof(struct ast_cli_entry)); ast_unregister_application(parkcall); ast_devstate_prov_del("Park"); return ast_unregister_application(parkedcall); diff --git a/res/res_indications.c b/res/res_indications.c index d12868d9c..34ddf1e31 100644 --- a/res/res_indications.c +++ b/res/res_indications.c @@ -64,8 +64,8 @@ static char help_remove_indication[] = " Remove the given indication from the country.\n"; static char help_show_indications[] = -"Usage: show indications [ ...]\n" -" Show either a condensed for of all country/indications, or the\n" +"Usage: indication list [ ...]\n" +" Display either a condensed for of all country/indications, or the\n" " indications for the specified countries.\n"; char *playtones_desc= @@ -345,20 +345,24 @@ out: v = v->next; /* * CLI entries for commands provided by this module */ -static struct ast_cli_entry add_indication_cli = - { { "indication", "add", NULL }, handle_add_indication, - "Add the given indication to the country", help_add_indication, - NULL }; +static struct ast_cli_entry cli_show_indications_deprecated = { + { "show", "indications", NULL }, + handle_show_indications, NULL, + NULL }; -static struct ast_cli_entry remove_indication_cli = - { { "indication", "remove", NULL }, handle_remove_indication, - "Remove the given indication from the country", help_remove_indication, - NULL }; +static struct ast_cli_entry cli_indications[] = { + { { "indication", "add", NULL }, + handle_add_indication, "Add the given indication to the country", + help_add_indication, NULL }, -static struct ast_cli_entry show_indications_cli = - { { "show", "indications", NULL }, handle_show_indications, - "Show a list of all country/indications", help_show_indications, - NULL }; + { { "indication", "remove", NULL }, + handle_remove_indication, "Remove the given indication from the country", + help_remove_indication, NULL }, + + { { "indication", "list", NULL }, + handle_show_indications, "Display a list of all countries/indications", + help_show_indications, NULL, &cli_show_indications_deprecated }, +}; /* * Standard module functions ... @@ -369,9 +373,7 @@ static int unload_module(void) ast_unregister_indication_country(NULL); /* and the functions */ - ast_cli_unregister(&add_indication_cli); - ast_cli_unregister(&remove_indication_cli); - ast_cli_unregister(&show_indications_cli); + ast_cli_unregister_multiple(cli_indications, sizeof(cli_indications) / sizeof(struct ast_cli_entry)); ast_unregister_application("PlayTones"); ast_unregister_application("StopPlayTones"); return 0; @@ -382,9 +384,7 @@ static int load_module(void) { if (ind_load_module()) return AST_MODULE_LOAD_DECLINE; - ast_cli_register(&add_indication_cli); - ast_cli_register(&remove_indication_cli); - ast_cli_register(&show_indications_cli); + ast_cli_register_multiple(cli_indications, sizeof(cli_indications) / sizeof(struct ast_cli_entry)); ast_register_application("PlayTones", handle_playtones, "Play a tone list", playtones_desc); ast_register_application("StopPlayTones", handle_stopplaytones, "Stop playing a tone list","Stop playing a tone list"); diff --git a/res/res_jabber.c b/res/res_jabber.c index a3da8ff5a..bcd9f6135 100644 --- a/res/res_jabber.c +++ b/res/res_jabber.c @@ -113,12 +113,26 @@ static char test_usage[] = " as configured in jabber.conf can be optionally specified.\n"; static struct ast_cli_entry aji_cli[] = { - {{ "jabber", "debug", NULL}, aji_do_debug, "Enable Jabber debugging", debug_usage }, - {{ "jabber", "reload", NULL}, aji_do_reload, "Enable Jabber debugging", reload_usage }, - {{ "jabber", "show", "connected", NULL}, aji_show_clients, "Show state of clients and components", debug_usage }, - {{ "jabber", "no", "debug", NULL}, aji_no_debug, "Disable Jabber debug", no_debug_usage }, - {{ "jabber", "test", NULL}, aji_test, "Shows roster, but is genearlly used for mog's debugging.", test_usage }, - }; + { { "jabber", "debug", NULL}, + aji_do_debug, "Enable Jabber debugging", + debug_usage }, + + { { "jabber", "reload", NULL}, + aji_do_reload, "Enable Jabber debugging", + reload_usage }, + + { { "jabber", "show", "connected", NULL}, + aji_show_clients, "Show state of clients and components", + debug_usage }, + + { { "jabber", "no", "debug", NULL}, + aji_no_debug, "Disable Jabber debug", + no_debug_usage }, + + { { "jabber", "test", NULL}, + aji_test, "Shows roster, but is generally used for mog's debugging.", + test_usage }, +}; static char *app_ajisend = "JabberSend"; @@ -2286,7 +2300,7 @@ static int aji_reload() static int unload_module(void) { - ast_cli_unregister_multiple(aji_cli, sizeof(aji_cli) / sizeof(aji_cli[0])); + ast_cli_unregister_multiple(aji_cli, sizeof(aji_cli) / sizeof(struct ast_cli_entry)); ast_unregister_application(app_ajisend); ast_manager_unregister("JabberSend"); ASTOBJ_CONTAINER_TRAVERSE(&clients, 1, { @@ -2315,7 +2329,7 @@ static int load_module(void) "Sends a message to a Jabber Client", mandescr_jabber_send); ast_register_application(app_ajisend, aji_send_exec, ajisend_synopsis, ajisend_descrip); ast_register_application(app_ajistatus, aji_status_exec, ajistatus_synopsis, ajistatus_descrip); - ast_cli_register_multiple(aji_cli, sizeof(aji_cli) / sizeof(aji_cli[0])); + ast_cli_register_multiple(aji_cli, sizeof(aji_cli) / sizeof(struct ast_cli_entry)); ast_log(LOG_NOTICE, "res_jabber.so loaded.\n"); return 0; diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c index 18436e0bf..e553a994d 100644 --- a/res/res_musiconhold.c +++ b/res/res_musiconhold.c @@ -1183,11 +1183,29 @@ static int moh_classes_show(int fd, int argc, char *argv[]) return 0; } -static struct ast_cli_entry cli_moh = { { "moh", "reload"}, moh_cli, "Music On Hold", "Music On Hold", NULL}; - -static struct ast_cli_entry cli_moh_classes_show = { { "moh", "classes", "show"}, moh_classes_show, "List MOH classes", "Lists all MOH classes", NULL}; - -static struct ast_cli_entry cli_moh_files_show = { { "moh", "files", "show"}, cli_files_show, "List MOH file-based classes", "Lists all loaded file-based MOH classes and their files", NULL}; +static struct ast_cli_entry cli_moh_classes_show_deprecated = { + { "moh", "classes", "show"}, + moh_classes_show, NULL, + NULL }; + +static struct ast_cli_entry cli_moh_files_show_deprecated = { + { "moh", "files", "show"}, + cli_files_show, NULL, + NULL }; + +static struct ast_cli_entry cli_moh[] = { + { { "moh", "reload"}, + moh_cli, "Music On Hold", + "Music On Hold" }, + + { { "moh", "list", "classes"}, + moh_classes_show, "List MOH classes", + "Lists all MOH classes", NULL, &cli_moh_classes_show_deprecated }, + + { { "moh", "list", "files"}, + cli_files_show, "List MOH file-based classes", + "Lists all loaded file-based MOH classes and their files", NULL, &cli_moh_files_show_deprecated }, +}; static int init_classes(int reload) { @@ -1212,9 +1230,7 @@ static int load_module(void) res = ast_register_application(app0, moh0_exec, synopsis0, descrip0); ast_register_atexit(ast_moh_destroy); - ast_cli_register(&cli_moh); - ast_cli_register(&cli_moh_files_show); - ast_cli_register(&cli_moh_classes_show); + ast_cli_register_multiple(cli_moh, sizeof(cli_moh) / sizeof(struct ast_cli_entry)); if (!res) res = ast_register_application(app1, moh1_exec, synopsis1, descrip1); if (!res) diff --git a/res/res_odbc.c b/res/res_odbc.c index 1d4f9b5af..4ca7b0036 100644 --- a/res/res_odbc.c +++ b/res/res_odbc.c @@ -309,41 +309,48 @@ static int odbc_show_command(int fd, int argc, char **argv) struct odbc_class *class; struct odbc_obj *current; - if (!strcmp(argv[1], "show")) { - AST_LIST_LOCK(&odbc_list); - AST_LIST_TRAVERSE(&odbc_list, class, list) { - if ((argc == 2) || (argc == 3 && !strcmp(argv[2], "all")) || (!strcmp(argv[2], class->name))) { - int count = 0; - ast_cli(fd, "Name: %s\nDSN: %s\n", class->name, class->dsn); + AST_LIST_LOCK(&odbc_list); + AST_LIST_TRAVERSE(&odbc_list, class, list) { + if ((argc == 2) || (argc == 3 && !strcmp(argv[2], "all")) || (!strcmp(argv[2], class->name))) { + int count = 0; + ast_cli(fd, "Name: %s\nDSN: %s\n", class->name, class->dsn); - if (class->haspool) { - ast_cli(fd, "Pooled: yes\nLimit: %d\nConnections in use: %d\n", class->limit, class->count); + if (class->haspool) { + ast_cli(fd, "Pooled: yes\nLimit: %d\nConnections in use: %d\n", class->limit, class->count); - AST_LIST_TRAVERSE(&(class->odbc_obj), current, list) { - ast_cli(fd, " Connection %d: %s", ++count, current->up && odbc_sanity_check(current) ? "connected" : "disconnected"); - } - } else { - /* Should only ever be one of these */ - AST_LIST_TRAVERSE(&(class->odbc_obj), current, list) { - ast_cli(fd, "Pooled: no\nConnected: %s\n", current->up && odbc_sanity_check(current) ? "yes" : "no"); - } + AST_LIST_TRAVERSE(&(class->odbc_obj), current, list) { + ast_cli(fd, " Connection %d: %s", ++count, current->up && odbc_sanity_check(current) ? "connected" : "disconnected"); + } + } else { + /* Should only ever be one of these */ + AST_LIST_TRAVERSE(&(class->odbc_obj), current, list) { + ast_cli(fd, "Pooled: no\nConnected: %s\n", current->up && odbc_sanity_check(current) ? "yes" : "no"); } + } ast_cli(fd, "\n"); - } } - AST_LIST_UNLOCK(&odbc_list); } + AST_LIST_UNLOCK(&odbc_list); + return 0; } static char show_usage[] = -"Usage: odbc show []\n" +"Usage: odbc list []\n" " List settings of a particular ODBC class.\n" " or, if not specified, all classes.\n"; -static struct ast_cli_entry odbc_show_struct = - { { "odbc", "show", NULL }, odbc_show_command, "Show ODBC DSN(s)", show_usage }; +static struct ast_cli_entry cli_odbc_show_deprecated = { + { "odbc", "show", NULL }, + odbc_show_command, NULL, + NULL }; + +static struct ast_cli_entry cli_odbc[] = { + { { "odbc", "list", NULL }, + odbc_show_command, "List ODBC DSN(s)", + show_usage, NULL, &cli_odbc_show_deprecated }, +}; static int odbc_register_class(struct odbc_class *class, int connect) { @@ -668,7 +675,7 @@ static int load_module(void) { if(load_odbc_config() == -1) return AST_MODULE_LOAD_DECLINE; - ast_cli_register(&odbc_show_struct); + ast_cli_register_multiple(cli_odbc, sizeof(cli_odbc) / sizeof(struct ast_cli_entry)); ast_log(LOG_NOTICE, "res_odbc loaded.\n"); return 0; } -- cgit v1.2.3