--- app_festival.c.old Fri Oct 8 17:59:22 2004 +++ app_festival.c Fri Oct 8 18:31:02 2004 @@ -254,10 +254,10 @@ struct ast_hostent ahp; int fd; FILE *fs; - char *asthost; - char *cachedir; + char asthost[1024]=""; + char cachedir[1024]=""; char *temp; - char *festivalcommand; + char festivalcommand[1024]=""; int port=1314; int n; char ack[4]; @@ -281,40 +281,48 @@ char *intstr; struct ast_config *cfg; + cfg = ast_load(FESTIVAL_CONFIG); if (!cfg) { ast_log(LOG_WARNING, "No such configuration file %s\n", FESTIVAL_CONFIG); return -1; + } + temp = ast_variable_retrieve(cfg, "general", "host"); + strcpy(asthost, temp); + if (!asthost) { + strcpy(asthost, "localhost"); + } + ast_log(LOG_DEBUG, "Host variable is %s\n", asthost); + + temp = ast_variable_retrieve(cfg, "general", "port"); + if (!temp) { + port = 1314; + } else { + port = atoi(temp); + } + ast_log(LOG_DEBUG, "Port number is %d\n", port); + + temp = ast_variable_retrieve(cfg, "general", "usecache"); + if (!temp) { + usecache = 0; } else { - asthost = ast_variable_retrieve(cfg, "general", "host"); - if (!asthost) { - asthost = "localhost"; - } - ast_log(LOG_DEBUG, "Host variable is %s\n", asthost); - temp = ast_variable_retrieve(cfg, "general", "port"); - if (!temp) { - port = 1314; - } else { - port = atoi(temp); - } - ast_log(LOG_DEBUG, "Port number is %d\n", port); - temp = ast_variable_retrieve(cfg, "general", "usecache"); - if (!temp) { - usecache = 0; - } else { - usecache = ast_true(temp); - } - cachedir = ast_variable_retrieve(cfg, "general", "cachedir"); - if (!cachedir) { - cachedir = "/tmp/"; - } - ast_log(LOG_DEBUG, "Festival cache directory %s\n", cachedir); - festivalcommand = ast_variable_retrieve(cfg, "general", "festivalcommand"); - if (!festivalcommand) { - festivalcommand = "(tts_textasterisk \"%s\" 'file)(quit)\n"; - } - ast_log(LOG_DEBUG, "Festival command %s\n", festivalcommand); + usecache = ast_true(temp); + } + + temp = ast_variable_retrieve(cfg, "general", "cachedir"); + strcpy(cachedir, temp); + if (!temp) { + strcpy(cachedir, "/tmp/"); } + ast_log(LOG_DEBUG, "Festival cache directory %s\n", cachedir); + + temp = ast_variable_retrieve(cfg, "general", "festivalcommand"); + strcpy(festivalcommand, temp); + if (!temp) { + strcpy(festivalcommand, "(tts_textasterisk \"%s\" 'file)(quit)\n"); + } + ast_log(LOG_DEBUG, "Festival command %s\n", festivalcommand); + ast_destroy(cfg); if (!vdata || ast_strlen_zero(vdata)) { ast_log(LOG_WARNING, "festival requires an argument (text)\n");