[Asterisk-cvs] asterisk/apps app_agi.c,1.11,1.12 app_mp3.c,1.4,1.5 app_queue.c,1.33,1.34 app_voicemail.c,1.13,1.14 app_voicemail2.c,1.46,1.47

markster at lists.digium.com markster at lists.digium.com
Mon Sep 8 11:46:58 CDT 2003


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

Modified Files:
	app_agi.c app_mp3.c app_queue.c app_voicemail.c 
	app_voicemail2.c 
Log Message:
BSD portability enhancements (bug #234)


Index: app_agi.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_agi.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** app_agi.c	21 Aug 2003 23:35:56 -0000	1.11
--- app_agi.c	8 Sep 2003 16:48:06 -0000	1.12
***************
*** 24,28 ****
  #include <string.h>
  #include <stdlib.h>
! #include <sys/signal.h>
  #include <sys/time.h>
  #include <stdio.h>
--- 24,28 ----
  #include <string.h>
  #include <stdlib.h>
! #include <signal.h>
  #include <sys/time.h>
  #include <stdio.h>
***************
*** 153,157 ****
  			close(x);
  		/* Execute script */
! 		execl(script, script, args, NULL);
  		/* Can't use ast_log since FD's are closed */
  		fprintf(stderr, "Failed to execute '%s': %s\n", script, strerror(errno));
--- 153,157 ----
  			close(x);
  		/* Execute script */
! 		execl(script, script, args, (char *)NULL);
  		/* Can't use ast_log since FD's are closed */
  		fprintf(stderr, "Failed to execute '%s': %s\n", script, strerror(errno));

Index: app_mp3.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_mp3.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** app_mp3.c	27 Apr 2003 18:13:11 -0000	1.4
--- app_mp3.c	8 Sep 2003 16:48:06 -0000	1.5
***************
*** 62,68 ****
  	/* Execute mpg123, but buffer if it's a net connection */
  	if (strncmp(filename, "http://", 7)) 
! 	    execl(MPG_123, MPG_123, "-q", "-s", "-b", "1024", "--mono", "-r", "8000", filename, NULL);
  	else
! 	    execl(MPG_123, MPG_123, "-q", "-s", "--mono", "-r", "8000", filename, NULL);
  	ast_log(LOG_WARNING, "Execute of mpg123 failed\n");
  	return -1;
--- 62,68 ----
  	/* Execute mpg123, but buffer if it's a net connection */
  	if (strncmp(filename, "http://", 7)) 
! 	    execl(MPG_123, MPG_123, "-q", "-s", "-b", "1024", "--mono", "-r", "8000", filename, (char *)NULL);
  	else
! 	    execl(MPG_123, MPG_123, "-q", "-s", "--mono", "-r", "8000", filename, (char *)NULL);
  	ast_log(LOG_WARNING, "Execute of mpg123 failed\n");
  	return -1;

Index: app_queue.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_queue.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -C2 -d -r1.33 -r1.34
*** app_queue.c	8 Sep 2003 16:44:36 -0000	1.33
--- app_queue.c	8 Sep 2003 16:48:06 -0000	1.34
***************
*** 1373,1377 ****
  				if (mem->calls) {
  					snprintf(calls, sizeof(calls), " has taken %d calls (last was %ld secs ago)",
! 							mem->calls, time(NULL) - mem->lastcall);
  				} else
  					strcpy(calls, " has taken no calls yet");
--- 1373,1377 ----
  				if (mem->calls) {
  					snprintf(calls, sizeof(calls), " has taken %d calls (last was %ld secs ago)",
! 							mem->calls, (long)(time(NULL) - mem->lastcall));
  				} else
  					strcpy(calls, " has taken no calls yet");

Index: app_voicemail.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_voicemail.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** app_voicemail.c	3 May 2003 20:46:19 -0000	1.13
--- app_voicemail.c	8 Sep 2003 16:48:06 -0000	1.14
***************
*** 644,648 ****
  	chan->name,
  	chan->callerid ? chan->callerid : "Unknown",
! 	date, time(NULL));
  							fclose(txt);
  						} else
--- 644,648 ----
  	chan->name,
  	chan->callerid ? chan->callerid : "Unknown",
! 	date, (long) time(NULL));
  							fclose(txt);
  						} else
***************
*** 810,814 ****
  							if (txt) {
  								time(&end);
! 								fprintf(txt, "duration=%ld\n", end-start);
  								fclose(txt);
  							}
--- 810,814 ----
  							if (txt) {
  								time(&end);
! 								fprintf(txt, "duration=%ld\n", (long)(end-start));
  								fclose(txt);
  							}

Index: app_voicemail2.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_voicemail2.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -C2 -d -r1.46 -r1.47
*** app_voicemail2.c	4 Sep 2003 04:20:43 -0000	1.46
--- app_voicemail2.c	8 Sep 2003 16:48:06 -0000	1.47
***************
*** 1096,1100 ****
  	chan->name,
  	chan->callerid ? chan->callerid : "Unknown",
! 	date, time(NULL));
  					fclose(txt);
  				} else
--- 1096,1100 ----
  	chan->name,
  	chan->callerid ? chan->callerid : "Unknown",
! 	date, (long)time(NULL));
  					fclose(txt);
  				} else
***************
*** 1106,1110 ****
  				if (txt) {
  					time(&end);
! 					fprintf(txt, "duration=%ld\n", end-start);
  					fclose(txt);
  				}
--- 1106,1110 ----
  				if (txt) {
  					time(&end);
! 					fprintf(txt, "duration=%ld\n", (long)(end-start));
  					fclose(txt);
  				}
***************
*** 2101,2108 ****
  					struct timeval now;
  					struct tm tmnow;
! 					time_t beg_today;
  
  					gettimeofday(&now,NULL);
! 					localtime_r(&now.tv_sec,&tmnow);
  					tmnow.tm_hour = 0;
  					tmnow.tm_min = 0;
--- 2101,2109 ----
  					struct timeval now;
  					struct tm tmnow;
! 					time_t beg_today, tnow;
  
  					gettimeofday(&now,NULL);
! 					tnow = now.tv_sec;
! 					localtime_r(&tnow,&tmnow);
  					tmnow.tm_hour = 0;
  					tmnow.tm_min = 0;
***************
*** 2128,2135 ****
  					struct timeval now;
  					struct tm tmnow;
! 					time_t beg_today;
  
  					gettimeofday(&now,NULL);
! 					localtime_r(&now.tv_sec,&tmnow);
  					tmnow.tm_hour = 0;
  					tmnow.tm_min = 0;
--- 2129,2137 ----
  					struct timeval now;
  					struct tm tmnow;
! 					time_t beg_today, tnow;
  
  					gettimeofday(&now,NULL);
! 					tnow = now.tv_sec;
! 					localtime_r(&tnow,&tmnow);
  					tmnow.tm_hour = 0;
  					tmnow.tm_min = 0;
***************
*** 2185,2191 ****
  	struct vm_zone *the_zone = NULL;
  	struct ast_config *msg_cfg;
! 	time_t t;
  	struct timeval tv_now;
  	struct tm time_now, time_then;
  
  	make_file(vms->fn2, sizeof(vms->fn2), vms->curdir, vms->curmsg); 
--- 2187,2194 ----
  	struct vm_zone *the_zone = NULL;
  	struct ast_config *msg_cfg;
! 	time_t t, tnow;
  	struct timeval tv_now;
  	struct tm time_now, time_then;
+ 	long tin;
  
  	make_file(vms->fn2, sizeof(vms->fn2), vms->curdir, vms->curmsg); 
***************
*** 2199,2206 ****
  	if (!(origtime = ast_variable_retrieve(msg_cfg, "message", "origtime")))
  		return 0;
! 	if (sscanf(origtime,"%ld",&t) < 1) {
  		ast_log(LOG_WARNING, "Couldn't find origtime in %s\n", filename);
  		return 0;
  	}
  	ast_destroy(msg_cfg);
  
--- 2202,2210 ----
  	if (!(origtime = ast_variable_retrieve(msg_cfg, "message", "origtime")))
  		return 0;
! 	if (sscanf(origtime,"%ld",&tin) < 1) {
  		ast_log(LOG_WARNING, "Couldn't find origtime in %s\n", filename);
  		return 0;
  	}
+ 	t = tin;
  	ast_destroy(msg_cfg);
  
***************
*** 2229,2233 ****
  	localtime_r(&t, &time_now);
  	gettimeofday(&tv_now,NULL);
! 	localtime_r(&tv_now.tv_sec,&time_then);
  
  	/* Day difference */
--- 2233,2238 ----
  	localtime_r(&t, &time_now);
  	gettimeofday(&tv_now,NULL);
! 	tnow = tv_now.tv_sec;
! 	localtime_r(&tnow,&time_then);
  
  	/* Day difference */




More information about the svn-commits mailing list