summaryrefslogtreecommitdiff
path: root/res
diff options
context:
space:
mode:
authorMichiel van Baak <michiel@vanbaak.info>2008-09-28 23:32:14 +0000
committerMichiel van Baak <michiel@vanbaak.info>2008-09-28 23:32:14 +0000
commit90751b16caec323d90ddf7d41db4a25085a3bd76 (patch)
treed5167b9db2e6c55e56def0e52038799c477d3e3d /res
parent434c69b7fde58f0613afa8477d5a21e4dc76bf0d (diff)
Merge the cli_cleanup branch.
This work is done by lmadsen, junky and mvanbaak during AstriDevCon. This is the second audit the CLI got, and this time lmadsen made sure he had _ALL_ modules loaded that have CLI commands in them. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@145121 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res')
-rw-r--r--res/ais/clm.c4
-rw-r--r--res/ais/evt.c4
-rw-r--r--res/res_agi.c6
-rw-r--r--res/res_clioriginate.c22
-rw-r--r--res/res_config_ldap.c4
-rw-r--r--res/res_config_pgsql.c22
-rw-r--r--res/res_limit.c69
7 files changed, 67 insertions, 64 deletions
diff --git a/res/ais/clm.c b/res/ais/clm.c
index 5d7a356be..9788c263f 100644
--- a/res/ais/clm.c
+++ b/res/ais/clm.c
@@ -78,9 +78,9 @@ static char *ais_clm_show_members(struct ast_cli_entry *e, int cmd, struct ast_c
switch (cmd) {
case CLI_INIT:
- e->command = "ais clm show members";
+ e->command = "ais show clm members";
e->usage =
- "Usage: ais clm show members\n"
+ "Usage: ais show clm members\n"
" List members of the cluster using the CLM (Cluster Membership) service.\n";
return NULL;
diff --git a/res/ais/evt.c b/res/ais/evt.c
index 0057f0481..2965df0e3 100644
--- a/res/ais/evt.c
+++ b/res/ais/evt.c
@@ -271,9 +271,9 @@ static char *ais_evt_show_event_channels(struct ast_cli_entry *e, int cmd, struc
switch (cmd) {
case CLI_INIT:
- e->command = "ais evt show event channels";
+ e->command = "ais show evt event channels";
e->usage =
- "Usage: ais evt show event channels\n"
+ "Usage: ais show evt event channels\n"
" List configured event channels for the (EVT) Eventing service.\n";
return NULL;
diff --git a/res/res_agi.c b/res/res_agi.c
index 02b666c38..d5cd0961f 100644
--- a/res/res_agi.c
+++ b/res/res_agi.c
@@ -86,7 +86,7 @@ static char *descrip =
"AGISIGHUP channel variable to \"no\" before executing the AGI application.\n"
" Using 'EAGI' provides enhanced AGI, with incoming audio available out of band\n"
"on file descriptor 3.\n\n"
-" Use the CLI command 'agi show' to list available agi commands.\n"
+" Use the CLI command 'agi show commnands' to list available agi commands.\n"
" This application sets the following channel variable upon completion:\n"
" AGISTATUS The status of the attempt to the run the AGI script\n"
" text string, one of SUCCESS | FAILURE | NOTFOUND | HANGUP\n";
@@ -2727,9 +2727,9 @@ static char *handle_cli_agi_show(struct ast_cli_entry *e, int cmd, struct ast_cl
switch (cmd) {
case CLI_INIT:
- e->command = "agi show";
+ e->command = "agi show commands [topic]";
e->usage =
- "Usage: agi show [topic]\n"
+ "Usage: agi show commands [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";
diff --git a/res/res_clioriginate.c b/res/res_clioriginate.c
index 6a6371972..1052888dc 100644
--- a/res/res_clioriginate.c
+++ b/res/res_clioriginate.c
@@ -122,26 +122,26 @@ static char *handle_orig(struct ast_cli_entry *e, int cmd, struct ast_cli_args *
char *res;
switch (cmd) {
case CLI_INIT:
- e->command = "originate";
+ e->command = "channel originate";
e->usage =
" There are two ways to use this command. A call can be originated between a\n"
"channel and a specific application, or between a channel and an extension in\n"
"the dialplan. This is similar to call files or the manager originate action.\n"
"Calls originated with this command are given a timeout of 30 seconds.\n\n"
- "Usage1: originate <tech/data> application <appname> [appdata]\n"
+ "Usage1: channel originate <tech/data> application <appname> [appdata]\n"
" This will originate a call between the specified channel tech/data and the\n"
"given application. Arguments to the application are optional. If the given\n"
"arguments to the application include spaces, all of the arguments to the\n"
"application need to be placed in quotation marks.\n\n"
- "Usage2: originate <tech/data> extension [exten@][context]\n"
+ "Usage2: channel originate <tech/data> extension [exten@][context]\n"
" This will originate a call between the specified channel tech/data and the\n"
"given extension. If no context is specified, the 'default' context will be\n"
"used. If no extension is given, the 's' extension will be used.\n";
return NULL;
case CLI_GENERATE:
- if (a->pos != 2)
+ if (a->pos != 3)
return NULL;
/* ugly, can be removed when CLI entries have ast_module pointers */
@@ -152,18 +152,20 @@ static char *handle_orig(struct ast_cli_entry *e, int cmd, struct ast_cli_args *
return res;
}
- if (ast_strlen_zero(a->argv[1]) || ast_strlen_zero(a->argv[2]))
+ if (ast_strlen_zero(a->argv[2]) || ast_strlen_zero(a->argv[3]))
return CLI_SHOWUSAGE;
/* ugly, can be removed when CLI entries have ast_module pointers */
ast_module_ref(ast_module_info->self);
- if (!strcasecmp("application", a->argv[2])) {
- res = orig_app(a->fd, a->argv[1], a->argv[3], a->argv[4]);
- } else if (!strcasecmp("extension", a->argv[2])) {
- res = orig_exten(a->fd, a->argv[1], a->argv[3]);
- } else
+ if (!strcasecmp("application", a->argv[3])) {
+ res = orig_app(a->fd, a->argv[2], a->argv[4], a->argv[5]);
+ } else if (!strcasecmp("extension", a->argv[3])) {
+ res = orig_exten(a->fd, a->argv[2], a->argv[4]);
+ } else {
+ ast_log(LOG_WARNING, "else");
res = CLI_SHOWUSAGE;
+ }
ast_module_unref(ast_module_info->self);
diff --git a/res/res_config_ldap.c b/res/res_config_ldap.c
index 916ce8fe7..966da9eea 100644
--- a/res/res_config_ldap.c
+++ b/res/res_config_ldap.c
@@ -1529,9 +1529,9 @@ static char *realtime_ldap_status(struct ast_cli_entry *e, int cmd, struct ast_c
switch (cmd) {
case CLI_INIT:
- e->command = "realtime ldap status";
+ e->command = "realtime show ldap status";
e->usage =
- "Usage: realtime ldap status\n"
+ "Usage: realtime show ldap status\n"
" Shows connection information for the LDAP RealTime driver\n";
return NULL;
case CLI_GENERATE:
diff --git a/res/res_config_pgsql.c b/res/res_config_pgsql.c
index 5ef6cf67b..f7c1f3a6a 100644
--- a/res/res_config_pgsql.c
+++ b/res/res_config_pgsql.c
@@ -1315,13 +1315,13 @@ static char *handle_cli_realtime_pgsql_cache(struct ast_cli_entry *e, int cmd, s
switch (cmd) {
case CLI_INIT:
- e->command = "realtime pgsql cache";
+ e->command = "realtime show pgsql cache";
e->usage =
- "Usage: realtime pgsql cache [<table>]\n"
+ "Usage: realtime show pgsql cache [<table>]\n"
" Shows table cache for the PostgreSQL RealTime driver\n";
return NULL;
case CLI_GENERATE:
- if (a->argc != 3) {
+ if (a->argc != 4) {
return NULL;
}
l = strlen(a->word);
@@ -1337,25 +1337,25 @@ static char *handle_cli_realtime_pgsql_cache(struct ast_cli_entry *e, int cmd, s
return ret;
}
- if (a->argc == 3) {
+ if (a->argc == 4) {
/* List of tables */
AST_LIST_LOCK(&psql_tables);
AST_LIST_TRAVERSE(&psql_tables, cur, list) {
ast_cli(a->fd, "%s\n", cur->name);
}
AST_LIST_UNLOCK(&psql_tables);
- } else if (a->argc == 4) {
+ } else if (a->argc == 5) {
/* List of columns */
- if ((cur = find_table(a->argv[3]))) {
+ if ((cur = find_table(a->argv[4]))) {
struct columns *col;
- ast_cli(a->fd, "Columns for Table Cache '%s':\n", a->argv[3]);
+ ast_cli(a->fd, "Columns for Table Cache '%s':\n", a->argv[4]);
ast_cli(a->fd, "%-20.20s %-20.20s %-3.3s %-8.8s\n", "Name", "Type", "Len", "Nullable");
AST_LIST_TRAVERSE(&cur->columns, col, list) {
ast_cli(a->fd, "%-20.20s %-20.20s %3d %-8.8s\n", col->name, col->type, col->len, col->notnull ? "NOT NULL" : "");
}
ast_mutex_unlock(&cur->lock);
} else {
- ast_cli(a->fd, "No such table '%s'\n", a->argv[3]);
+ ast_cli(a->fd, "No such table '%s'\n", a->argv[4]);
}
}
return 0;
@@ -1368,16 +1368,16 @@ static char *handle_cli_realtime_pgsql_status(struct ast_cli_entry *e, int cmd,
switch (cmd) {
case CLI_INIT:
- e->command = "realtime pgsql status";
+ e->command = "realtime show pgsql status";
e->usage =
- "Usage: realtime pgsql status\n"
+ "Usage: realtime show pgsql status\n"
" Shows connection information for the PostgreSQL RealTime driver\n";
return NULL;
case CLI_GENERATE:
return NULL;
}
- if (a->argc != 3)
+ if (a->argc != 4)
return CLI_SHOWUSAGE;
if (pgsqlConn && PQstatus(pgsqlConn) == CONNECTION_OK) {
diff --git a/res/res_limit.c b/res/res_limit.c
index b1cf025b0..35bd9d3dc 100644
--- a/res/res_limit.c
+++ b/res/res_limit.c
@@ -44,22 +44,23 @@ static struct limits {
int resource;
char limit[3];
char desc[40];
+ char clicmd[15];
} limits[] = {
- { RLIMIT_CPU, "-t", "cpu time" },
- { RLIMIT_FSIZE, "-f", "file size" },
- { RLIMIT_DATA, "-d", "program data segment" },
- { RLIMIT_STACK, "-s", "program stack size" },
- { RLIMIT_CORE, "-c", "core file size" },
+ { RLIMIT_CPU, "-t", "cpu time", "time" },
+ { RLIMIT_FSIZE, "-f", "file size" , "file" },
+ { RLIMIT_DATA, "-d", "program data segment", "data" },
+ { RLIMIT_STACK, "-s", "program stack size", "stack" },
+ { RLIMIT_CORE, "-c", "core file size", "core" },
#ifdef RLIMIT_RSS
- { RLIMIT_RSS, "-m", "resident memory" },
- { RLIMIT_MEMLOCK, "-l", "amount of memory locked into RAM" },
+ { RLIMIT_RSS, "-m", "resident memory", "memory" },
+ { RLIMIT_MEMLOCK, "-l", "amount of memory locked into RAM", "locked" },
#endif
#ifdef RLIMIT_NPROC
- { RLIMIT_NPROC, "-u", "number of processes" },
+ { RLIMIT_NPROC, "-u", "number of processes", "processes" },
#endif
- { RLIMIT_NOFILE, "-n", "number of file descriptors" },
+ { RLIMIT_NOFILE, "-n", "number of file descriptors", "descriptors" },
#ifdef VMEM_DEF
- { VMEM_DEF, "-v", "virtual memory" },
+ { VMEM_DEF, "-v", "virtual memory", "virtual" },
#endif
};
@@ -67,7 +68,7 @@ static int str2limit(const char *string)
{
size_t i;
for (i = 0; i < ARRAY_LEN(limits); i++) {
- if (!strcasecmp(string, limits[i].limit))
+ if (!strcasecmp(string, limits[i].clicmd))
return limits[i].resource;
}
return -1;
@@ -77,7 +78,7 @@ static const char *str2desc(const char *string)
{
size_t i;
for (i = 0; i < ARRAY_LEN(limits); i++) {
- if (!strcmp(string, limits[i].limit))
+ if (!strcmp(string, limits[i].clicmd))
return limits[i].desc;
}
return "<unknown>";
@@ -91,9 +92,9 @@ static char *complete_ulimit(struct ast_cli_args *a)
if (a->pos > 1)
return NULL;
for (i = 0; i < ARRAY_LEN(limits); i++) {
- if (!strncasecmp(limits[i].limit, a->word, wordlen)) {
+ if (!strncasecmp(limits[i].clicmd, a->word, wordlen)) {
if (++which > a->n)
- return ast_strdup(limits[i].limit);
+ return ast_strdup(limits[i].clicmd);
}
}
return NULL;
@@ -108,41 +109,41 @@ static char *handle_cli_ulimit(struct ast_cli_entry *e, int cmd, struct ast_cli_
case CLI_INIT:
e->command = "ulimit";
e->usage =
- "Usage: ulimit {-d|"
+ "Usage: ulimit {data|"
#ifdef RLIMIT_RSS
- "-l|"
+ "limit|"
#endif
- "-f|"
+ "file|"
#ifdef RLIMIT_RSS
- "-m|"
+ "memory|"
#endif
- "-s|-t|"
+ "stack|time|"
#ifdef RLIMIT_NPROC
- "-u|"
+ "processes|"
#endif
#ifdef VMEM_DEF
- "-v|"
+ "virtual|"
#endif
- "-c|-n} [<num>]\n"
+ "core|descriptors} [<num>]\n"
" Shows or sets the corresponding resource limit.\n"
- " -d Process data segment [readonly]\n"
+ " data Process data segment [readonly]\n"
#ifdef RLIMIT_RSS
- " -l Memory lock size [readonly]\n"
+ " lock Memory lock size [readonly]\n"
#endif
- " -f File size\n"
+ " file File size\n"
#ifdef RLIMIT_RSS
- " -m Process resident memory [readonly]\n"
+ " memory Process resident memory [readonly]\n"
#endif
- " -s Process stack size [readonly]\n"
- " -t CPU usage [readonly]\n"
+ " stack Process stack size [readonly]\n"
+ " time CPU usage [readonly]\n"
#ifdef RLIMIT_NPROC
- " -u Child processes\n"
+ " processes Child processes\n"
#endif
#ifdef VMEM_DEF
- " -v Process virtual memory [readonly]\n"
+ " virtual Process virtual memory [readonly]\n"
#endif
- " -c Core dump file size\n"
- " -n Number of file descriptors\n";
+ " core Core dump file size\n"
+ " descriptors Number of file descriptors\n";
return NULL;
case CLI_GENERATE:
return complete_ulimit(a);
@@ -152,11 +153,11 @@ static char *handle_cli_ulimit(struct ast_cli_entry *e, int cmd, struct ast_cli_
return CLI_SHOWUSAGE;
if (a->argc == 1) {
- char arg2[3];
+ char arg2[15];
char *newargv[2] = { "ulimit", arg2 };
for (resource = 0; resource < ARRAY_LEN(limits); resource++) {
struct ast_cli_args newArgs = { .argv = newargv, .argc = 2 };
- ast_copy_string(arg2, limits[resource].limit, sizeof(arg2));
+ ast_copy_string(arg2, limits[resource].clicmd, sizeof(arg2));
handle_cli_ulimit(e, CLI_HANDLER, &newArgs);
}
return CLI_SUCCESS;