aboutsummaryrefslogtreecommitdiffstats
path: root/pbx.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-11-21 18:38:42 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-11-21 18:38:42 +0000
commit702c2894d7d2e675b36797045e88e483f1391580 (patch)
treec1c9efa4003e1d1a53f9e212b14eec4804b0d483 /pbx.c
parente3e27950bbe6fec53c676b8c93ee08da3c8c35f4 (diff)
Make CALLTYPE available
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@1776 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'pbx.c')
-rwxr-xr-xpbx.c52
1 files changed, 39 insertions, 13 deletions
diff --git a/pbx.c b/pbx.c
index 10a890da9..f7dd0a2f0 100755
--- a/pbx.c
+++ b/pbx.c
@@ -2342,8 +2342,7 @@ static char *complete_show_application(char *line, char *word,
static int handle_show_application(int fd, int argc, char *argv[])
{
struct ast_app *a;
- int n, app, no_registered_app = 1;
- char *buf;
+ int app, no_registered_app = 1;
if (argc < 3) return RESULT_SHOWUSAGE;
@@ -2360,19 +2359,46 @@ static int handle_show_application(int fd, int argc, char *argv[])
* to 'show application' command ... */
for (app = 2; app < argc; app++) {
if (!strcasecmp(a->name, argv[app])) {
+ /* Maximum number of characters added by terminal coloring is 22 */
+ char infotitle[64 + AST_MAX_APP + 22], syntitle[40], destitle[40];
+ char info[64 + AST_MAX_APP], *synopsis = NULL, *description = NULL;
+ int synopsis_size, description_size;
+
no_registered_app = 0;
- /* ... one of our applications, show info ...*/
- n = asprintf(&buf,
- "\n -= Info about application '%s' =- \n\n"
- "[Synopsis]:\n %s\n\n"
- "[Description]:\n%s\n",
- a->name,
- a->synopsis ? a->synopsis : "Not available",
- a->description ? a-> description : "Not available");
- if (n >= 0) {
- ast_cli(fd, buf);
- free(buf);
+ if (a->synopsis)
+ synopsis_size = strlen(a->synopsis) + 23;
+ else
+ synopsis_size = strlen("Not available") + 23;
+ synopsis = alloca(synopsis_size);
+
+ if (a->description)
+ description_size = strlen(a->description) + 23;
+ else
+ description_size = strlen("Not available") + 23;
+ description = alloca(description_size);
+
+ if (synopsis && description) {
+ snprintf(info, 64 + AST_MAX_APP, "\n -= Info about application '%s' =- \n\n", a->name);
+ term_color(infotitle, info, COLOR_MAGENTA, 0, 64 + AST_MAX_APP + 22);
+ term_color(syntitle, "[Synopsis]:\n", COLOR_MAGENTA, 0, 40);
+ term_color(destitle, "[Description]:\n", COLOR_MAGENTA, 0, 40);
+ term_color(synopsis,
+ a->synopsis ? a->synopsis : "Not available",
+ COLOR_CYAN, 0, synopsis_size);
+ term_color(description,
+ a->description ? a->description : "Not available",
+ COLOR_CYAN, 0, description_size);
+
+ ast_cli(fd,"%s%s%s\n\n%s%s\n", infotitle, syntitle, synopsis, destitle, description);
+ } else {
+ /* ... one of our applications, show info ...*/
+ ast_cli(fd,"\n -= Info about application '%s' =- \n\n"
+ "[Synopsis]:\n %s\n\n"
+ "[Description]:\n%s\n",
+ a->name,
+ a->synopsis ? a->synopsis : "Not available",
+ a->description ? a->description : "Not available");
}
}
}