aboutsummaryrefslogtreecommitdiffstats
path: root/file.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-10-06 00:36:17 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-10-06 00:36:17 +0000
commit66822e6349ba33caa3ebcb9bfdb97212ac955e38 (patch)
tree63019862ab741b3a8dadb38aeb14e57501efc835 /file.c
parentd3d9829dc63c1ae5f05bc4b58e711c418183145a (diff)
Fix ENUM to live w/out config file, and fix internationalization
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@1609 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'file.c')
-rwxr-xr-xfile.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/file.c b/file.c
index dde3d2673..27fbe2345 100755
--- a/file.c
+++ b/file.c
@@ -419,21 +419,24 @@ struct ast_filestream *ast_openstream(struct ast_channel *chan, char *filename,
*/
int fd = -1;
int fmts = -1;
- char filename2[256];
- char lang2[MAX_LANGUAGE];
+ char filename2[256]="";
+ char filename3[256]="";
+ char *endpart;
int res;
ast_stopstream(chan);
/* do this first, otherwise we detect the wrong writeformat */
if (chan->generator)
ast_deactivate_generator(chan);
if (preflang && strlen(preflang)) {
- snprintf(filename2, sizeof(filename2), "%s/%s", preflang, filename);
+ strncpy(filename3, filename, sizeof(filename3) - 1);
+ endpart = strrchr(filename3, '/');
+ if (endpart) {
+ *endpart = '\0';
+ endpart++;
+ snprintf(filename2, sizeof(filename2), "%s/%s/%s", filename3, preflang, endpart);
+ } else
+ snprintf(filename2, sizeof(filename2), "%s/%s", preflang, filename);
fmts = ast_fileexists(filename2, NULL, NULL);
- if (fmts < 1) {
- strncpy(lang2, preflang, sizeof(lang2)-1);
- snprintf(filename2, sizeof(filename2), "%s/%s", lang2, filename);
- fmts = ast_fileexists(filename2, NULL, NULL);
- }
}
if (fmts < 1) {
strncpy(filename2, filename, sizeof(filename2)-1);