[Asterisk-Users] Asterisk CLI Prompt : Small hack

Matt G gibson at experthost.com
Tue Oct 5 08:50:01 MST 2004


Just incase anyone is interested, I got tired of not having a newline 
command available
with the cli_prompt. So me and a friend made this uber-quick hack to get 
it working.

Flames/comments/suggestions:
Matt                              or         Matt
flewid at flewid.ca                       sideshow at terahertz.net

now you can use %n in your prompts to give a newline. A prompt example 
is below.

export ASTERISK_PROMPT="%n[ %d/%t ]%n[ Load1: %l1 Load2: %l2 Load3: %l3 
]%n[ Processes: %l4 PID: %l5 ]%n[ %H ] %%%# "
or
env ASTERISK_PROMPT="%n[ %d/%t ]%n[ Load1: %l1 Load2: %l2 Load3: %l3 
]%n[ Processes: %l4 PID: %l5 ]%n[ %H ] %%%# "

--- begin patch [ apply in asterisk/ with patch -p0 < ]

--- asterisk.c.original 2004-10-05 10:26:21.000000000 -0400
+++ asterisk.c  2004-10-05 11:29:48.000000000 -0400
@@ -991,6 +991,9 @@
                                                        color_used = 1;
                                                }
                                                break;
+                                       case 'n': /* newline */
+                                               strncat(p, "\n", 
sizeof(prompt) - strlen(prompt) -1);
+                                               break;
                                        case 'd': /* date */
                                                memset(&tm, 0, 
sizeof(struct tm));
                                                gettimeofday(&tv, NULL);

----



More information about the asterisk-users mailing list