diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2003-09-08 16:48:07 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2003-09-08 16:48:07 +0000 |
commit | 2be6d9d7c174007ac0018fed802364d2115f0283 (patch) | |
tree | 32674bc8c5dc21153e7c8a4548f6641aef0566bf /apps | |
parent | ee8cba2208114438d40442616149adf12cc422c2 (diff) |
BSD portability enhancements (bug #234)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@1486 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rwxr-xr-x | apps/app_agi.c | 4 | ||||
-rwxr-xr-x | apps/app_mp3.c | 4 | ||||
-rwxr-xr-x | apps/app_queue.c | 2 | ||||
-rwxr-xr-x | apps/app_voicemail.c | 4 | ||||
-rwxr-xr-x | apps/app_voicemail2.c | 23 |
5 files changed, 21 insertions, 16 deletions
diff --git a/apps/app_agi.c b/apps/app_agi.c index 6399c0249..294b56bd3 100755 --- a/apps/app_agi.c +++ b/apps/app_agi.c @@ -23,7 +23,7 @@ #include <unistd.h> #include <string.h> #include <stdlib.h> -#include <sys/signal.h> +#include <signal.h> #include <sys/time.h> #include <stdio.h> #include <fcntl.h> @@ -152,7 +152,7 @@ static int launch_script(char *script, char *args, int *fds, int *efd, int *opid for (x=STDERR_FILENO + 2;x<1024;x++) close(x); /* Execute script */ - execl(script, script, args, NULL); + 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)); exit(1); diff --git a/apps/app_mp3.c b/apps/app_mp3.c index 52f1225c6..c8196a75f 100755 --- a/apps/app_mp3.c +++ b/apps/app_mp3.c @@ -61,9 +61,9 @@ static int mp3play(char *filename, int fd) } /* 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); + 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, NULL); + execl(MPG_123, MPG_123, "-q", "-s", "--mono", "-r", "8000", filename, (char *)NULL); ast_log(LOG_WARNING, "Execute of mpg123 failed\n"); return -1; } diff --git a/apps/app_queue.c b/apps/app_queue.c index af349a0d7..68d883c10 100755 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -1372,7 +1372,7 @@ static int queues_show(int fd, int argc, char **argv) strcat(max, " (dynamic)"); if (mem->calls) { snprintf(calls, sizeof(calls), " has taken %d calls (last was %ld secs ago)", - mem->calls, time(NULL) - mem->lastcall); + mem->calls, (long)(time(NULL) - mem->lastcall)); } else strcpy(calls, " has taken no calls yet"); ast_cli(fd, " %s/%s%s%s\n", mem->tech, mem->loc, max, calls); diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index 8ee076acd..8c2a23f9d 100755 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -643,7 +643,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, int silent, int chan->priority, chan->name, chan->callerid ? chan->callerid : "Unknown", - date, time(NULL)); + date, (long) time(NULL)); fclose(txt); } else ast_log(LOG_WARNING, "Error opening text file for output\n"); @@ -809,7 +809,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, int silent, int txt = fopen(txtfile, "a"); if (txt) { time(&end); - fprintf(txt, "duration=%ld\n", end-start); + fprintf(txt, "duration=%ld\n", (long)(end-start)); fclose(txt); } /* Send e-mail if applicable */ diff --git a/apps/app_voicemail2.c b/apps/app_voicemail2.c index 7fb3b4388..e5f1db755 100755 --- a/apps/app_voicemail2.c +++ b/apps/app_voicemail2.c @@ -1095,7 +1095,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, int silent, int chan->priority, chan->name, chan->callerid ? chan->callerid : "Unknown", - date, time(NULL)); + date, (long)time(NULL)); fclose(txt); } else ast_log(LOG_WARNING, "Error opening text file for output\n"); @@ -1105,7 +1105,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, int silent, int txt = fopen(txtfile, "a"); if (txt) { time(&end); - fprintf(txt, "duration=%ld\n", end-start); + fprintf(txt, "duration=%ld\n", (long)(end-start)); fclose(txt); } stringp = fmt; @@ -2100,10 +2100,11 @@ static int play_datetime_format(struct ast_channel *chan, time_t time, struct vm { struct timeval now; struct tm tmnow; - time_t beg_today; + time_t beg_today, tnow; gettimeofday(&now,NULL); - localtime_r(&now.tv_sec,&tmnow); + tnow = now.tv_sec; + localtime_r(&tnow,&tmnow); tmnow.tm_hour = 0; tmnow.tm_min = 0; tmnow.tm_sec = 0; @@ -2127,10 +2128,11 @@ static int play_datetime_format(struct ast_channel *chan, time_t time, struct vm { struct timeval now; struct tm tmnow; - time_t beg_today; + time_t beg_today, tnow; gettimeofday(&now,NULL); - localtime_r(&now.tv_sec,&tmnow); + tnow = now.tv_sec; + localtime_r(&tnow,&tmnow); tmnow.tm_hour = 0; tmnow.tm_min = 0; tmnow.tm_sec = 0; @@ -2184,9 +2186,10 @@ static int play_message_datetime(struct ast_channel *chan, struct ast_vm_user *v char filename[256], *origtime, temp[256]; struct vm_zone *the_zone = NULL; struct ast_config *msg_cfg; - time_t t; + 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); snprintf(filename,sizeof(filename), "%s.txt", vms->fn2); @@ -2198,10 +2201,11 @@ static int play_message_datetime(struct ast_channel *chan, struct ast_vm_user *v if (!(origtime = ast_variable_retrieve(msg_cfg, "message", "origtime"))) return 0; - if (sscanf(origtime,"%ld",&t) < 1) { + 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); /* Does this user have a timezone specified? */ @@ -2228,7 +2232,8 @@ static int play_message_datetime(struct ast_channel *chan, struct ast_vm_user *v /* Set the DIFF_* variables */ localtime_r(&t, &time_now); gettimeofday(&tv_now,NULL); - localtime_r(&tv_now.tv_sec,&time_then); + tnow = tv_now.tv_sec; + localtime_r(&tnow,&time_then); /* Day difference */ if (time_now.tm_year == time_then.tm_year) |