Minor cleanups
authorMark Spencer <markster@digium.com>
Fri, 27 Jun 2003 23:02:52 +0000 (23:02 +0000)
committerMark Spencer <markster@digium.com>
Fri, 27 Jun 2003 23:02:52 +0000 (23:02 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1126 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_directory.c
apps/app_festival.c
apps/app_milliwatt.c
asterisk.c
channels/chan_mgcp.c
cli.c

index 00c19be..949676d 100755 (executable)
@@ -112,7 +112,6 @@ static char *convert(char *lastname)
                        case 'Z':
                                tmp[lcount++] = '9';
                                break;
                        case 'Z':
                                tmp[lcount++] = '9';
                                break;
-                       default:
                        }
                        lastname++;
                }
                        }
                        lastname++;
                }
index 4801edc..58f2d77 100755 (executable)
@@ -46,8 +46,9 @@ static char *app = "Festival";
 static char *synopsis = "Say text to the user";
 
 static char *descrip = 
 static char *synopsis = "Say text to the user";
 
 static char *descrip = 
-"  Festival():  Connect to Festival, send the argument, get back the waveform,"
-"play it to the user.\n";
+"  Festival(text[|intkeys]):  Connect to Festival, send the argument, get back the waveform,"
+"play it to the user, allowing any given interrupt keys to immediately terminate and return\n"
+"the value.\n";
 
 STANDARD_LOCAL_USER;
 
 
 STANDARD_LOCAL_USER;
 
@@ -302,9 +303,7 @@ static int festival_exec(struct ast_channel *chan, void *data)
        if (!(temp = ast_variable_retrieve(cfg, "general", "usecache"))) {
                usecache=0;
        } else {
        if (!(temp = ast_variable_retrieve(cfg, "general", "usecache"))) {
                usecache=0;
        } else {
-               if (strcasecmp(temp,"yes")==0) {
-                       usecache=1;
-               }
+               usecache = ast_true(temp);
        }
        if (!(cachedir = ast_variable_retrieve(cfg, "general", "cachedir"))) {
                cachedir = "/tmp/";
        }
        if (!(cachedir = ast_variable_retrieve(cfg, "general", "cachedir"))) {
                cachedir = "/tmp/";
index b51d8b2..a2f92dc 100755 (executable)
@@ -55,7 +55,7 @@ static void milliwatt_release(struct ast_channel *chan, void *data)
        return;
 }
 
        return;
 }
 
-static int milliwatt_generate(struct ast_channel *chan, void *data, int len)
+static int milliwatt_generate(struct ast_channel *chan, void *data, int len, int samples)
 {
        struct ast_frame wf;
        unsigned char waste[AST_FRIENDLY_OFFSET];
 {
        struct ast_frame wf;
        unsigned char waste[AST_FRIENDLY_OFFSET];
index 98af3cc..820c52f 100755 (executable)
@@ -448,29 +448,34 @@ static void __quit_handler(int num)
 
 static pthread_t consolethread = -1;
 
 
 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);
                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];
 }
 
 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");
        /* 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(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 */
        fflush(stdout);
        if (complete)
        /* Wake up a select()ing console */
index b399b8c..c6a29e4 100755 (executable)
@@ -399,7 +399,7 @@ static int mgcp_postrequest(struct mgcp_subchannel *sub, unsigned char *data, in
     }
     time(&t);
     if (sub->messagepending && (sub->lastouttime + 20 < t)) {
     }
     time(&t);
     if (sub->messagepending && (sub->lastouttime + 20 < t)) {
-        ast_log(LOG_NOTICE, "Timeout waiting for response to message:%d,  lastouttime: %d, now: %d.  Dumping pending queue\n",
+        ast_log(LOG_NOTICE, "Timeout waiting for response to message:%d,  lastouttime: %ld, now: %ld.  Dumping pending queue\n",
                 sub->msgs ? sub->msgs->seqno : -1, sub->lastouttime, t);
         dump_queue(sub->parent);
     }
                 sub->msgs ? sub->msgs->seqno : -1, sub->lastouttime, t);
         dump_queue(sub->parent);
     }
diff --git a/cli.c b/cli.c
index 0254e4a..d45f6b8 100755 (executable)
--- a/cli.c
+++ b/cli.c
@@ -1007,7 +1007,6 @@ int ast_cli_command(int fd, char *s)
                                case RESULT_SHOWUSAGE:
                                        ast_cli(fd, e->usage);
                                        break;
                                case RESULT_SHOWUSAGE:
                                        ast_cli(fd, e->usage);
                                        break;
-                               default:
                                }
                        } else 
                                ast_cli(fd, "No such command '%s' (type 'help' for help)\n", find_best(argv));
                                }
                        } else 
                                ast_cli(fd, "No such command '%s' (type 'help' for help)\n", find_best(argv));