aboutsummaryrefslogtreecommitdiffstats
path: root/asterisk.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-06-27 23:02:52 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-06-27 23:02:52 +0000
commitd148cde249b23d61820b91fd6baf483848cf6985 (patch)
treeda6a8c446c46fb6bd6c6dd32ce0bc061ff3bc7ac /asterisk.c
parentbc12b3a7d31aca35b3eb83e14a7f7f238c88bbfb (diff)
Minor cleanups
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@1126 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'asterisk.c')
-rwxr-xr-xasterisk.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/asterisk.c b/asterisk.c
index 98af3cc91..820c52ff9 100755
--- a/asterisk.c
+++ b/asterisk.c
@@ -448,29 +448,34 @@ static void __quit_handler(int num)
static pthread_t consolethread = -1;
-static int fix_header(char *outbuf, int maxout, char **s, char *cmp)
+static const char *fix_header(char *outbuf, int maxout, const char *s, char *cmp)
{
- if (!strncmp(*s, cmp, strlen(cmp))) {
- *s += strlen(cmp);
+ const char *c;
+ if (!strncmp(s, cmp, strlen(cmp))) {
+ c = s + strlen(cmp);
term_color(outbuf, cmp, COLOR_GRAY, 0, maxout);
- return 1;
+ return c;
}
- return 0;
+ return NULL;
}
static void console_verboser(const char *s, int pos, int replace, int complete)
{
char tmp[80];
+ const char *c=NULL;
/* Return to the beginning of the line */
if (!pos) {
fprintf(stdout, "\r");
- if (fix_header(tmp, sizeof(tmp), &s, VERBOSE_PREFIX_4) ||
- fix_header(tmp, sizeof(tmp), &s, VERBOSE_PREFIX_3) ||
- fix_header(tmp, sizeof(tmp), &s, VERBOSE_PREFIX_2) ||
- fix_header(tmp, sizeof(tmp), &s, VERBOSE_PREFIX_1))
+ if ((c = fix_header(tmp, sizeof(tmp), s, VERBOSE_PREFIX_4)) ||
+ (c = fix_header(tmp, sizeof(tmp), s, VERBOSE_PREFIX_3)) ||
+ (c = fix_header(tmp, sizeof(tmp), s, VERBOSE_PREFIX_2)) ||
+ (c = fix_header(tmp, sizeof(tmp), s, VERBOSE_PREFIX_1)))
fputs(tmp, stdout);
}
- fputs(s + pos,stdout);
+ if (c)
+ fputs(c + pos,stdout);
+ else
+ fputs(s + pos,stdout);
fflush(stdout);
if (complete)
/* Wake up a select()ing console */