[Asterisk-cvs] asterisk/apps app_record.c,1.20,1.21

anthm at lists.digium.com anthm at lists.digium.com
Thu Sep 23 12:36:07 CDT 2004


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

Modified Files:
	app_record.c 
Log Message:
tweak prior commit

Index: app_record.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_record.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- app_record.c	14 Jul 2004 07:34:34 -0000	1.20
+++ app_record.c	23 Sep 2004 16:39:33 -0000	1.21
@@ -56,7 +56,7 @@
 	char fil[256];
 	char tmp[256];
 	char ext[10];
-	char * vdata;  /* Used so I don't have to typecast every use of *data */
+	char *vdata;
 	int i = 0;
 	int j = 0;
 
@@ -78,15 +78,32 @@
 	int option_skip = 0;
 	int option_noanswer = 0;
 	int rfmt = 0;
+	int flags;
+	char *end=NULL;
+	char *p=NULL;
+
 
-	vdata = data; /* explained above */
 
 	/* The next few lines of code parse out the filename and header from the input string */
-	if (!vdata) { /* no data implies no filename or anything is present */
+	if (!data) { /* no data implies no filename or anything is present */
 		ast_log(LOG_WARNING, "Record requires an argument (filename)\n");
 		return -1;
 	}
+	vdata = ast_strdupa(data);
+	
+	p = vdata;
+	while(p && (p=strchr(p,':'))) {
+		end=p;
+		if(!strcasecmp(end,":end")) {
+			*end='\0';
+			end++;
+			break;
+		}
+		p++;
+		end=NULL;
+	}
 	
+
 	for (; vdata[i] && (vdata[i] != ':') && (vdata[i] != '|'); i++ ) {
 		if ((vdata[i] == '%') && (vdata[i+1] == 'd')) {
 			percentflag = 1;                      /* the wildcard is used */
@@ -205,8 +222,11 @@
 			ast_dsp_set_threshold(sildet, 256);
 		}
 
-		s = ast_writefile( tmp, ext, NULL, O_CREAT|O_TRUNC|O_WRONLY , 0, 0644);
-	
+
+		flags = end ? O_CREAT|O_APPEND|O_WRONLY : O_CREAT|O_TRUNC|O_WRONLY;
+		s = ast_writefile( tmp, ext, NULL, flags , 0, 0644);
+
+
 		if (s) {
 			if (maxduration > 0)
 				timeout = time(NULL) + (time_t)maxduration;




More information about the svn-commits mailing list