[Asterisk-cvs] asterisk file.c,1.21,1.22

markster at lists.digium.com markster at lists.digium.com
Sun Oct 5 19:35:06 CDT 2003


Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv8476

Modified Files:
	file.c 
Log Message:
Fix ENUM to live w/out config file, and fix internationalization


Index: file.c
===================================================================
RCS file: /usr/cvsroot/asterisk/file.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- file.c	16 Aug 2003 05:10:35 -0000	1.21
+++ file.c	6 Oct 2003 00:36:17 -0000	1.22
@@ -419,21 +419,24 @@
 	*/
 	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);




More information about the svn-commits mailing list