diff options
author | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-11-01 18:22:39 +0000 |
---|---|---|
committer | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-11-01 18:22:39 +0000 |
commit | ea96823f2626e2a4178eec54f8a78a666d376ac1 (patch) | |
tree | d6fd63606de3355d2e0f7bb2ab751116095a1451 | |
parent | 1c4fdfd503883d806ba05da5d0e9156b54a4d51b (diff) |
fix a bunch of potential problems found by gcc 4.3.x, primarily bare strings being passed to printf()-like functions and ignored results from read()/write() and friends
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@153337 f38db490-d61c-443f-a65b-d21fe96a405b
42 files changed, 2146 insertions, 865 deletions
diff --git a/agi/eagi-sphinx-test.c b/agi/eagi-sphinx-test.c index 0ad12c787..968e3cfc3 100644 --- a/agi/eagi-sphinx-test.c +++ b/agi/eagi-sphinx-test.c @@ -70,7 +70,9 @@ static int read_environment(void) char *val; /* Read environment */ for(;;) { - fgets(buf, sizeof(buf), stdin); + if (!fgets(buf, sizeof(buf), stdin)) { + return -1; + } if (feof(stdin)) return -1; buf[strlen(buf) - 1] = '\0'; @@ -121,7 +123,9 @@ static char *wait_result(void) return NULL; } if (FD_ISSET(STDIN_FILENO, &fds)) { - fgets(astresp, sizeof(astresp), stdin); + if (!fgets(astresp, sizeof(astresp), stdin)) { + return NULL; + } if (feof(stdin)) { fprintf(stderr, "Got hungup on apparently\n"); return NULL; @@ -132,9 +136,10 @@ static char *wait_result(void) } if (FD_ISSET(AUDIO_FILENO, &fds)) { res = read(AUDIO_FILENO, audiobuf, sizeof(audiobuf)); - if (res > 0) { - if (sphinx_sock > -1) - write(sphinx_sock, audiobuf, res); + if ((res > 0) && (sphinx_sock > -1)) { + if (write(sphinx_sock, audiobuf, res) < 0) { + fprintf(stderr, "write() failed: %s\n", strerror(errno)); + } } } if ((sphinx_sock > -1) && FD_ISSET(sphinx_sock, &fds)) { diff --git a/agi/eagi-test.c b/agi/eagi-test.c index 7745d18ae..9bfbee79e 100644 --- a/agi/eagi-test.c +++ b/agi/eagi-test.c @@ -24,7 +24,9 @@ static int read_environment(void) char *val; /* Read environment */ for(;;) { - fgets(buf, sizeof(buf), stdin); + if (!fgets(buf, sizeof(buf), stdin)) { + return -1; + } if (feof(stdin)) return -1; buf[strlen(buf) - 1] = '\0'; @@ -68,7 +70,9 @@ static char *wait_result(void) return NULL; } if (FD_ISSET(STDIN_FILENO, &fds)) { - fgets(astresp, sizeof(astresp), stdin); + if (!fgets(astresp, sizeof(astresp), stdin)) { + return NULL; + } if (feof(stdin)) { fprintf(stderr, "Got hungup on apparently\n"); return NULL; diff --git a/apps/app_adsiprog.c b/apps/app_adsiprog.c index 40330152b..750cc6fc7 100644 --- a/apps/app_adsiprog.c +++ b/apps/app_adsiprog.c @@ -1364,7 +1364,9 @@ static struct adsi_script *compile_script(char *script) /* Create "main" as first subroutine */ getsubbyname(scr, "main", NULL, 0); while(!feof(f)) { - fgets(buf, sizeof(buf), f); + if (!fgets(buf, sizeof(buf), f)) { + continue; + } if (!feof(f)) { lineno++; /* Trim off trailing return */ diff --git a/apps/app_authenticate.c b/apps/app_authenticate.c index 56f53b8ad..e182deee2 100644 --- a/apps/app_authenticate.c +++ b/apps/app_authenticate.c @@ -167,7 +167,9 @@ static int auth_exec(struct ast_channel *chan, void *data) char *md5secret = NULL; while (!feof(f)) { - fgets(buf, sizeof(buf), f); + if (!fgets(buf, sizeof(buf), f)) { + continue; + } if (!ast_strlen_zero(buf)) { size_t len = strlen(buf); if (buf[len - 1] == '\n') diff --git a/apps/app_chanspy.c b/apps/app_chanspy.c index 91e7b4ca7..1ac8ef583 100644 --- a/apps/app_chanspy.c +++ b/apps/app_chanspy.c @@ -38,6 +38,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include <string.h> #include <unistd.h> #include <ctype.h> +#include <errno.h> #include "asterisk/file.h" #include "asterisk/logger.h" @@ -190,8 +191,11 @@ static int spy_generate(struct ast_channel *chan, void *data, int len, int sampl return -1; } - if (csth->fd) - write(csth->fd, f->data, f->datalen); + if (csth->fd) { + if (write(csth->fd, f->data, f->datalen) < 0) { + ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno)); + } + } ast_frfree(f); diff --git a/apps/app_festival.c b/apps/app_festival.c index 2aceceefd..ab05824f5 100644 --- a/apps/app_festival.c +++ b/apps/app_festival.c @@ -45,6 +45,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include <unistd.h> #include <fcntl.h> #include <ctype.h> +#include <errno.h> #include "asterisk/file.h" #include "asterisk/logger.h" @@ -160,7 +161,9 @@ static int send_waveform_to_fd(char *waveform, int length, int fd) { } #endif - write(fd,waveform,length); + if (write(fd,waveform,length) < 0) { + ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno)); + } close(fd); exit(0); } @@ -431,17 +434,25 @@ static int festival_exec(struct ast_channel *chan, void *vdata) writecache=1; strln=strlen((char *)data); ast_log(LOG_DEBUG,"line length : %d\n",strln); - write(fdesc,&strln,sizeof(int)); - write(fdesc,data,strln); + if (write(fdesc,&strln,sizeof(int)) < 0) { + ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno)); + } + if (write(fdesc,data,strln) < 0) { + ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno)); + } seekpos=lseek(fdesc,0,SEEK_CUR); ast_log(LOG_DEBUG,"Seek position : %d\n",seekpos); } } else { - read(fdesc,&strln,sizeof(int)); + if (read(fdesc,&strln,sizeof(int)) != sizeof(int)) { + ast_log(LOG_WARNING, "read() failed: %s\n", strerror(errno)); + } ast_log(LOG_DEBUG,"Cache file exists, strln=%d, strlen=%d\n",strln,(int)strlen((char *)data)); if (strlen((char *)data)==strln) { ast_log(LOG_DEBUG,"Size OK\n"); - read(fdesc,&bigstring,strln); + if (read(fdesc,&bigstring,strln) != strln) { + ast_log(LOG_WARNING, "read() failed: %s\n", strerror(errno)); + } bigstring[strln] = 0; if (strcmp(bigstring,data)==0) { readcache=1; @@ -470,7 +481,9 @@ static int festival_exec(struct ast_channel *chan, void *vdata) if (writecache==1) { ast_log(LOG_DEBUG,"Writing result to cache...\n"); while ((strln=read(fd,buffer,16384))!=0) { - write(fdesc,buffer,strln); + if (write(fdesc,buffer,strln) < 0) { + ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno)); + } } close(fd); close(fdesc); diff --git a/apps/app_sms.c b/apps/app_sms.c index 53e8590df..cd445456e 100644 --- a/apps/app_sms.c +++ b/apps/app_sms.c @@ -662,7 +662,9 @@ static void sms_log (sms_t * h, char status) *p++ = h->ud[n]; *p++ = '\n'; *p = 0; - write (o, line, strlen (line)); + if (write (o, line, strlen (line)) < 0) { + ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno)); + } close (o); } *h->oa = *h->da = h->udl = 0; diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index 078462eb0..fad92c6cb 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -4541,7 +4541,9 @@ static void adsi_message(struct ast_channel *chan, struct vm_state *vms) f = fopen(fn2, "r"); if (f) { while (!feof(f)) { - fgets((char *)buf, sizeof(buf), f); + if (!fgets((char *)buf, sizeof(buf), f)) { + continue; + } if (!feof(f)) { char *stringp=NULL; stringp = (char *)buf; diff --git a/channels/chan_alsa.c b/channels/chan_alsa.c index c45740ef1..eae5b6fa5 100644 --- a/channels/chan_alsa.c +++ b/channels/chan_alsa.c @@ -327,7 +327,9 @@ static void *sound_thread(void *unused) } #endif if (FD_ISSET(sndcmd[0], &rfds)) { - read(sndcmd[0], &cursound, sizeof(cursound)); + if (read(sndcmd[0], &cursound, sizeof(cursound)) < 0) { + ast_log(LOG_WARNING, "read() failed: %s\n", strerror(errno)); + } silencelen = 0; offset = 0; sampsent = 0; @@ -532,7 +534,9 @@ static int alsa_call(struct ast_channel *c, char *dest, int timeout) ast_queue_frame(alsa.owner, &f); ast_mutex_unlock(&alsa.owner->lock); } - write(sndcmd[1], &res, sizeof(res)); + if (write(sndcmd[1], &res, sizeof(res)) < 0) { + ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno)); + } } snd_pcm_prepare(alsa.icard); snd_pcm_start(alsa.icard); @@ -543,10 +547,12 @@ static int alsa_call(struct ast_channel *c, char *dest, int timeout) static void answer_sound(void) { int res; + nosound = 1; res = 4; - write(sndcmd[1], &res, sizeof(res)); - + if (write(sndcmd[1], &res, sizeof(res)) < 0) { + ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno)); + } } static int alsa_answer(struct ast_channel *c) @@ -576,7 +582,9 @@ static int alsa_hangup(struct ast_channel *c) if (!autoanswer) { /* Congestion noise */ res = 2; - write(sndcmd[1], &res, sizeof(res)); + if (write(sndcmd[1], &res, sizeof(res)) < 0) { + ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno)); + } } } snd_pcm_drop(alsa.icard); @@ -770,8 +778,11 @@ static int alsa_indicate(struct ast_channel *chan, int cond, const void *data, s res = -1; } - if (res > -1) - write(sndcmd[1], &res, sizeof(res)); + if (res > -1) { + if (write(sndcmd[1], &res, sizeof(res)) < 0) { + ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno)); + } + } ast_mutex_unlock(&alsalock); diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c index e3d73ac3f..4a26f6d36 100644 --- a/channels/chan_dahdi.c +++ b/channels/chan_dahdi.c @@ -8379,8 +8379,11 @@ static void dahdi_pri_message(struct pri *pri, char *s) ast_mutex_lock(&pridebugfdlock); - if (pridebugfd >= 0) - write(pridebugfd, s, strlen(s)); + if (pridebugfd >= 0) { + if (write(pridebugfd, s, strlen(s)) < 0) { + ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno)); + } + } ast_mutex_unlock(&pridebugfdlock); } @@ -8418,8 +8421,11 @@ static void dahdi_pri_error(struct pri *pri, char *s) ast_mutex_lock(&pridebugfdlock); - if (pridebugfd >= 0) - write(pridebugfd, s, strlen(s)); + if (pridebugfd >= 0) { + if (write(pridebugfd, s, strlen(s)) < 0) { + ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno)); + } + } ast_mutex_unlock(&pridebugfdlock); } diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index 5d593dd0c..cdda03ad7 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -779,7 +779,7 @@ static void jb_error_output(const char *fmt, ...) vsnprintf(buf, 1024, fmt, args); va_end(args); - ast_log(LOG_ERROR, buf); + ast_log(LOG_ERROR, "%s", buf); } static void jb_warning_output(const char *fmt, ...) @@ -791,7 +791,7 @@ static void jb_warning_output(const char *fmt, ...) vsnprintf(buf, 1024, fmt, args); va_end(args); - ast_log(LOG_WARNING, buf); + ast_log(LOG_WARNING, "%s", buf); } static void jb_debug_output(const char *fmt, ...) @@ -803,7 +803,7 @@ static void jb_debug_output(const char *fmt, ...) vsnprintf(buf, 1024, fmt, args); va_end(args); - ast_verbose(buf); + ast_verbose("%s", buf); } /* XXX We probably should use a mutex when working with this XXX */ @@ -5864,9 +5864,13 @@ static int complete_dpreply(struct chan_iax2_pvt *pvt, struct iax_ies *ies) dp->flags |= matchmore; } /* Wake up waiters */ - for (x=0;x<sizeof(dp->waiters) / sizeof(dp->waiters[0]); x++) - if (dp->waiters[x] > -1) - write(dp->waiters[x], "asdf", 4); + for (x = 0; x < ARRAY_LEN(dp->waiters); x++) { + if (dp->waiters[x] > -1) { + if (write(dp->waiters[x], "asdf", 4) < 0) { + ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno)); + } + } + } } prev = dp; dp = dp->peer; @@ -10503,9 +10507,13 @@ static struct iax2_dpcache *find_cache(struct ast_channel *chan, const char *dat /* Expire after only 60 seconds now. This is designed to help reduce backlog in heavily loaded systems without leaving it unavailable once the server comes back online */ dp->expiry.tv_sec = dp->orig.tv_sec + 60; - for (x=0;x<sizeof(dp->waiters) / sizeof(dp->waiters[0]); x++) - if (dp->waiters[x] > -1) - write(dp->waiters[x], "asdf", 4); + for (x = 0; x < ARRAY_LEN(dp->waiters); x++) { + if (dp->waiters[x] > -1) { + if (write(dp->waiters[x], "asdf", 4) < 0) { + ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno)); + } + } + } } } /* Our caller will obtain the rest */ diff --git a/channels/chan_oss.c b/channels/chan_oss.c index 7e27e7696..1a6cfd0b6 100644 --- a/channels/chan_oss.c +++ b/channels/chan_oss.c @@ -601,7 +601,8 @@ static void *sound_thread(void *arg) * Just in case, kick the driver by trying to read from it. * Ignore errors - this read is almost guaranteed to fail. */ - read(o->sounddev, ign, sizeof(ign)); + if (read(o->sounddev, ign, sizeof(ign)) < 0) { + } for (;;) { fd_set rfds, wfds; int maxfd, res; @@ -635,7 +636,10 @@ static void *sound_thread(void *arg) /* read which sound to play from the pipe */ int i, what = -1; - read(o->sndcmd[0], &what, sizeof(what)); + if (read(o->sndcmd[0], &what, sizeof(what)) != sizeof(what)) { + ast_log(LOG_WARNING, "read() failed: %s\n", strerror(errno)); + continue; + } for (i = 0; sounds[i].ind != -1; i++) { if (sounds[i].ind == what) { o->cursound = i; @@ -649,7 +653,8 @@ static void *sound_thread(void *arg) } if (o->sounddev > -1) { if (FD_ISSET(o->sounddev, &rfds)) /* read and ignore errors */ - read(o->sounddev, ign, sizeof(ign)); + if (read(o->sounddev, ign, sizeof(ign)) < 0) { + } if (FD_ISSET(o->sounddev, &wfds)) send_sound(o); } @@ -783,7 +788,9 @@ static int oss_text(struct ast_channel *c, const char *text) /* Play ringtone 'x' on device 'o' */ static void ring(struct chan_oss_pvt *o, int x) { - write(o->sndcmd[1], &x, sizeof(x)); + if (write(o->sndcmd[1], &x, sizeof(x)) < 0) { + ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno)); + } } @@ -1787,7 +1794,9 @@ static struct chan_oss_pvt *store_config(struct ast_config *cfg, char *ctg) asprintf(&cmd, "mixer %s", o->mixer_cmd); ast_log(LOG_WARNING, "running [%s]\n", cmd); - system(cmd); + if (system(cmd) < 0) { + ast_log(LOG_WARNING, "system() failed: %s\n", strerror(errno)); + } free(cmd); } if (o == &oss_default) /* we are done with the default */ diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c index 51b1839d5..657163398 100644 --- a/channels/chan_skinny.c +++ b/channels/chan_skinny.c @@ -3587,8 +3587,8 @@ static int handle_speed_dial_stat_req_message(struct skinny_req *req, struct ski return -1; req->data.speeddialreq.speedDialNumber = htolel(instance); - snprintf(req->data.speeddial.speedDialDirNumber, sizeof(req->data.speeddial.speedDialDirNumber), sd->exten); - snprintf(req->data.speeddial.speedDialDisplayName, sizeof(req->data.speeddial.speedDialDisplayName), sd->label); + ast_copy_string(req->data.speeddial.speedDialDirNumber, sd->exten, sizeof(req->data.speeddial.speedDialDirNumber)); + ast_copy_string(req->data.speeddial.speedDialDisplayName, sd->label, sizeof(req->data.speeddial.speedDialDisplayName)); transmit_response(s, req); return 1; @@ -3764,7 +3764,7 @@ static int handle_version_req_message(struct skinny_req *req, struct skinnysessi if (!(req = req_alloc(sizeof(struct version_res_message), VERSION_RES_MESSAGE))) return -1; - snprintf(req->data.version.version, sizeof(req->data.version.version), d->version_id); + ast_copy_string(req->data.version.version, d->version_id, sizeof(req->data.version.version)); transmit_response(s, req); return 1; } diff --git a/formats/format_gsm.c b/formats/format_gsm.c index f997af119..37fbd2382 100644 --- a/formats/format_gsm.c +++ b/formats/format_gsm.c @@ -139,7 +139,9 @@ static int gsm_seek(struct ast_filestream *fs, off_t sample_offset, int whence) int i; fseeko(fs->f, 0, SEEK_END); for (i=0; i< (offset - max) / GSM_FRAME_SIZE; i++) { - fwrite(gsm_silence, 1, GSM_FRAME_SIZE, fs->f); + if (!fwrite(gsm_silence, 1, GSM_FRAME_SIZE, fs->f)) { + ast_log(LOG_WARNING, "fwrite() failed: %s\n", strerror(errno)); + } } } return fseeko(fs->f, offset, SEEK_SET); diff --git a/formats/format_ogg_vorbis.c b/formats/format_ogg_vorbis.c index ff796e79f..7e20c0004 100644 --- a/formats/format_ogg_vorbis.c +++ b/formats/format_ogg_vorbis.c @@ -239,8 +239,12 @@ static int ogg_vorbis_rewrite(struct ast_filestream *s, while (!tmp->eos) { if (ogg_stream_flush(&tmp->os, &tmp->og) == 0) break; - fwrite(tmp->og.header, 1, tmp->og.header_len, s->f); - fwrite(tmp->og.body, 1, tmp->og.body_len, s->f); + if (!fwrite(tmp->og.header, 1, tmp->og.header_len, s->f)) { + ast_log(LOG_WARNING, "fwrite() failed: %s\n", strerror(errno)); + } + if (!fwrite(tmp->og.body, 1, tmp->og.body_len, s->f)) { + ast_log(LOG_WARNING, "fwrite() failed: %s\n", strerror(errno)); + } if (ogg_page_eos(&tmp->og)) tmp->eos = 1; } @@ -265,8 +269,12 @@ static void write_stream(struct vorbis_desc *s, FILE *f) if (ogg_stream_pageout(&s->os, &s->og) == 0) { break; } - fwrite(s->og.header, 1, s->og.header_len, f); - fwrite(s->og.body, 1, s->og.body_len, f); + if (!fwrite(s->og.header, 1, s->og.header_len, f)) { + ast_log(LOG_WARNING, "fwrite() failed: %s\n", strerror(errno)); + } + if (!fwrite(s->og.body, 1, s->og.body_len, f)) { + ast_log(LOG_WARNING, "fwrite() failed: %s\n", strerror(errno)); + } if (ogg_page_eos(&s->og)) { s->eos = 1; } diff --git a/formats/format_wav.c b/formats/format_wav.c index df808590f..a2acad87b 100644 --- a/formats/format_wav.c +++ b/formats/format_wav.c @@ -346,8 +346,11 @@ static void wav_close(struct ast_filestream *s) char zero = 0; struct wav_desc *fs = (struct wav_desc *)s->_private; /* Pad to even length */ - if (fs->bytes & 0x1) - fwrite(&zero, 1, 1, s->f); + if (fs->bytes & 0x1) { + if (!fwrite(&zero, 1, 1, s->f)) { + ast_log(LOG_WARNING, "fwrite() failed: %s\n", strerror(errno)); + } + } } static struct ast_frame *wav_read(struct ast_filestream *s, int *whennext) diff --git a/formats/format_wav_gsm.c b/formats/format_wav_gsm.c index 1655cbd21..a7b2310bd 100644 --- a/formats/format_wav_gsm.c +++ b/formats/format_wav_gsm.c @@ -509,7 +509,9 @@ static int wav_seek(struct ast_filestream *fs, off_t sample_offset, int whence) int i; fseek(fs->f, 0, SEEK_END); for (i=0; i< (offset - max) / MSGSM_FRAME_SIZE; i++) { - fwrite(msgsm_silence, 1, MSGSM_FRAME_SIZE, fs->f); + if (!fwrite(msgsm_silence, 1, MSGSM_FRAME_SIZE, fs->f)) { + ast_log(LOG_WARNING, "fwrite() failed: %s\n", strerror(errno)); + } } } s->secondhalf = 0; diff --git a/funcs/func_enum.c b/funcs/func_enum.c index 554937908..01d96449f 100644 --- a/funcs/func_enum.c +++ b/funcs/func_enum.c @@ -70,14 +70,14 @@ static int function_enum(struct ast_channel *chan, char *cmd, char *data, buf[0] = '\0'; if (ast_strlen_zero(data)) { - ast_log(LOG_WARNING, synopsis); + ast_log(LOG_WARNING, "%s", synopsis); return -1; } AST_STANDARD_APP_ARGS(args, data); if (args.argc < 1) { - ast_log(LOG_WARNING, synopsis); + ast_log(LOG_WARNING, "%s", synopsis); return -1; } diff --git a/main/ast_expr2f.c b/main/ast_expr2f.c index f4b7dd0dc..8cc75cfd5 100644 --- a/main/ast_expr2f.c +++ b/main/ast_expr2f.c @@ -9,7 +9,7 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 33 +#define YY_FLEX_SUBMINOR_VERSION 35 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif @@ -31,7 +31,7 @@ /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ -#if !defined __STDC_VERSION__ || __STDC_VERSION__ >= 199901L +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, * if you want the limit (max/min) macros for int types. @@ -54,7 +54,6 @@ typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; -#endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN @@ -85,6 +84,8 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif +#endif /* ! C99 */ + #endif /* ! FLEXINT_H */ #ifdef __cplusplus @@ -94,11 +95,12 @@ typedef unsigned int flex_uint32_t; #else /* ! __cplusplus */ -#if __STDC__ +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) #define YY_USE_CONST -#endif /* __STDC__ */ +#endif /* defined (__STDC__) */ #endif /* ! __cplusplus */ #ifdef YY_USE_CONST @@ -134,8 +136,6 @@ typedef void* yyscan_t; #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column) #define yy_flex_debug yyg->yy_flex_debug_r -int ast_yylex_init (yyscan_t* scanner); - /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. @@ -193,14 +193,9 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) -/* The following is because we cannot portably get our hands on size_t - * (without autoconf's help, which isn't available because we want - * flex-generated scanners to compile on their own). - */ - #ifndef YY_TYPEDEF_YY_SIZE_T #define YY_TYPEDEF_YY_SIZE_T -typedef unsigned int yy_size_t; +typedef size_t yy_size_t; #endif #ifndef YY_STRUCT_YY_BUFFER_STATE @@ -334,11 +329,948 @@ void ast_yyfree (void * ,yyscan_t yyscanner ); #define ast_yywrap(n) 1 #define YY_SKIP_YYWRAP -typedef unsigned char YY_CHAR; +typedef char YY_CHAR; typedef int yy_state_type; #define yytext_ptr yytext_r +static yyconst flex_int16_t yy_nxt[][128] = + { + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0 + }, + + { + 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, + 10, 8, 8, 9, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 9, 11, 12, 13, 14, 15, 16, 13, + 17, 18, 19, 20, 13, 21, 13, 22, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 24, 13, + 25, 26, 27, 28, 13, 13, 13, 13, 13, 13, + + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 8, 13, 8, 13, 13, 8, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 8, 29, 8, 8, 8 + }, + + { + 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, + 10, 8, 8, 9, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 9, 11, 12, 13, 14, 15, 16, 13, + + 17, 18, 19, 20, 13, 21, 13, 22, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 24, 13, + 25, 26, 27, 28, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 8, 13, 8, 13, 13, 8, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 8, 29, 8, 8, 8 + }, + + { + 7, 30, 30, 30, 30, 30, 30, 30, 30, 30, + + 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + + 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + 30, 30, 30, 31, 30, 32, 30, 30 + }, + + { + 7, 30, 30, 30, 30, 30, 30, 30, 30, 30, + 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + + 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + 30, 30, 30, 31, 30, 32, 30, 30 + }, + + { + 7, 33, 33, 33, 33, 33, 33, 33, 33, 34, + 34, 33, 33, 34, 33, 33, 33, 33, 33, 33, + 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, + 33, 33, 34, 34, 33, 33, 35, 34, 34, 33, + 34, 34, 34, 34, 33, 34, 33, 34, 33, 33, + + 33, 33, 33, 33, 33, 33, 33, 33, 34, 33, + 34, 34, 34, 34, 33, 33, 33, 33, 33, 33, + 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, + 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, + 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, + 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, + 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, + 33, 33, 33, 33, 34, 33, 33, 33 + }, + + { + 7, 33, 33, 33, 33, 33, 33, 33, 33, 34, + 34, 33, 33, 34, 33, 33, 33, 33, 33, 33, + + 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, + 33, 33, 34, 34, 33, 33, 35, 34, 34, 33, + 34, 34, 34, 34, 33, 34, 33, 34, 33, 33, + 33, 33, 33, 33, 33, 33, 33, 33, 34, 33, + 34, 34, 34, 34, 33, 33, 33, 33, 33, 33, + 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, + 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, + 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, + 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, + 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, + + 33, 33, 33, 33, 34, 33, 33, 33 + }, + + { + -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, + -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, + -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, + -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, + -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, + -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, + -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, + -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, + -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, + + -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, + -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, + -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, + -7, -7, -7, -7, -7, -7, -7, -7 + }, + + { + 7, -8, -8, -8, -8, -8, -8, -8, -8, -8, + -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, + -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, + -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, + -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, + -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, + + -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, + -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, + -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, + -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, + -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, + -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, + -8, -8, -8, -8, -8, -8, -8, -8 + }, + + { + 7, -9, -9, -9, -9, -9, -9, -9, -9, -9, + -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, + -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, + + -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, + -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, + -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, + -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, + -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, + -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, + -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, + -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, + -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, + -9, -9, -9, -9, -9, -9, -9, -9 + + }, + + { + 7, -10, -10, -10, -10, -10, -10, -10, -10, -10, + -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, + -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, + -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, + -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, + -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, + -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, + -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, + -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, + -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, + + -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, + -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, + -10, -10, -10, -10, -10, -10, -10, -10 + }, + + { + 7, -11, -11, -11, -11, -11, -11, -11, -11, -11, + -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, + -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, + -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, + -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, + -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, + -11, 36, -11, -11, -11, -11, -11, -11, -11, -11, + + -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, + -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, + -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, + -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, + -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, + -11, -11, -11, -11, -11, -11, -11, -11 + }, + + { + 7, 37, 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 38, 37, 37, 37, 37, 37, + + 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37 + }, + + { + 7, -13, -13, -13, -13, -13, -13, -13, -13, -13, + + -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, + -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, + -13, -13, -13, -13, -13, 39, 39, -13, -13, 39, + -13, -13, -13, -13, 39, -13, 39, -13, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, -13, 39, + -13, -13, -13, -13, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, + 39, -13, 39, -13, 39, 39, -13, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, + + 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, + 39, 39, 39, -13, -13, -13, -13, -13 + }, + + { + 7, -14, -14, -14, -14, -14, -14, -14, -14, -14, + -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, + -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, + -14, -14, -14, -14, -14, 39, 39, -14, -14, 39, + -14, -14, -14, -14, 39, -14, 39, -14, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, -14, 39, + -14, -14, -14, -14, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, + + 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, + 39, -14, 39, -14, 39, 39, -14, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 40, -14, -14, -14, -14 + }, + + { + 7, -15, -15, -15, -15, -15, -15, -15, -15, -15, + -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, + -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, + -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, + -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, + + -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, + -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, + -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, + -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, + -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, + -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, + -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, + -15, -15, -15, -15, -15, -15, -15, -15 + }, + + { + 7, -16, -16, -16, -16, -16, -16, -16, -16, -16, + -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, + + -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, + -16, -16, -16, -16, -16, -16, -16, -16, 41, -16, + -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, + -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, + -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, + -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, + -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, + -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, + -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, + -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, + + -16, -16, -16, -16, -16, -16, -16, -16 + }, + + { + 7, -17, -17, -17, -17, -17, -17, -17, -17, -17, + -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, + -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, + -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, + -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, + -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, + -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, + -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, + -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, + + -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, + -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, + -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, + -17, -17, -17, -17, -17, -17, -17, -17 + }, + + { + 7, -18, -18, -18, -18, -18, -18, -18, -18, -18, + -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, + -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, + -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, + -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, + -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, + + -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, + -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, + -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, + -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, + -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, + -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, + -18, -18, -18, -18, -18, -18, -18, -18 + }, + + { + 7, -19, -19, -19, -19, -19, -19, -19, -19, -19, + -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, + -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, + + -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, + -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, + -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, + -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, + -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, + -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, + -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, + -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, + -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, + -19, -19, -19, -19, -19, -19, -19, -19 + + }, + + { + 7, -20, -20, -20, -20, -20, -20, -20, -20, -20, + -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, + -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, + -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, + -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, + -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, + -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, + -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, + -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, + -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, + + -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, + -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, + -20, -20, -20, -20, -20, -20, -20, -20 + }, + + { + 7, -21, -21, -21, -21, -21, -21, -21, -21, -21, + -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, + -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, + -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, + -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, + -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, + -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, + + -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, + -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, + -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, + -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, + -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, + -21, -21, -21, -21, -21, -21, -21, -21 + }, + + { + 7, -22, -22, -22, -22, -22, -22, -22, -22, -22, + -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, + -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, + -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, + + -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, + -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, + -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, + -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, + -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, + -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, + -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, + -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, + -22, -22, -22, -22, -22, -22, -22, -22 + }, + + { + 7, -23, -23, -23, -23, -23, -23, -23, -23, -23, + + -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, + -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, + -23, -23, -23, -23, -23, 39, 39, -23, -23, 39, + -23, -23, -23, -23, 39, -23, 39, -23, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, -23, 39, + -23, -23, -23, -23, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, + 39, -23, 39, -23, 39, 39, -23, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, + + 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, + 39, 39, 39, -23, -23, -23, -23, -23 + }, + + { + 7, -24, -24, -24, -24, -24, -24, -24, -24, -24, + -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, + -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, + -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, + -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, + -24, -24, -24, -24, -24, -24, -24, -24, 43, -24, + -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, + -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, + + -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, + -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, + -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, + -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, + -24, -24, -24, -24, -24, -24, -24, -24 + }, + + { + 7, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, 44, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25 + }, + + { + 7, -26, -26, -26, -26, -26, -26, -26, -26, -26, + -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, + + -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, + -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, + -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, + -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, + -26, 45, -26, -26, -26, -26, -26, -26, -26, -26, + -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, + -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, + -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, + -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, + -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, + + -26, -26, -26, -26, -26, -26, 46, -26 + }, + + { + 7, -27, -27, -27, -27, -27, -27, -27, -27, -27, + -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, + -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, + -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, + -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, + -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, + -27, 47, -27, -27, -27, -27, -27, -27, -27, -27, + -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, + -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, + + -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, + -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, + -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, + -27, -27, -27, -27, -27, -27, -27, -27 + }, + + { + 7, -28, -28, -28, -28, -28, -28, -28, -28, -28, + -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, + -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, + -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, + -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, + -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, + + -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, + -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, + -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, + -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, + -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, + -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, + -28, -28, -28, -28, -28, -28, -28, -28 + }, + + { + 7, -29, -29, -29, -29, -29, -29, -29, -29, -29, + -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, + -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, + + -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, + -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, + -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, + -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, + -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, + -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, + -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, + -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, + -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, + -29, -29, -29, -29, 48, -29, -29, -29 + + }, + + { + 7, 49, 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, + + 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 50, 49, 51, 49, 49 + }, + + { + 7, -31, -31, -31, -31, -31, -31, -31, -31, -31, + -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, + -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, + -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, + -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, + -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, + -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, + + -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, + -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, + -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, + -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, + -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, + -31, -31, -31, -31, -31, -31, -31, -31 + }, + + { + 7, -32, -32, -32, -32, -32, -32, -32, -32, -32, + -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, + -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, + -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, + + -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, + -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, + -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, + -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, + -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, + -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, + -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, + -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, + -32, -32, -32, -32, -32, -32, -32, -32 + }, + + { + 7, 52, 52, 52, 52, 52, 52, 52, 52, -33, + + -33, 52, 52, -33, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, -33, -33, 52, 52, -33, -33, -33, 52, + -33, -33, -33, -33, 52, -33, 52, -33, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, -33, 52, + -33, -33, -33, -33, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, -33, 52, 52, 52 + }, + + { + 7, -34, -34, -34, -34, -34, -34, -34, -34, -34, + -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, + -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, + -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, + -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, + -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, + -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, + -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, + + -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, + -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, + -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, + -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, + -34, -34, -34, -34, -34, -34, -34, -34 + }, + + { + 7, -35, -35, -35, -35, -35, -35, -35, -35, -35, + -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, + -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, + -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, + -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, + + -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, + -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, + -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, + -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, + -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, + -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, + -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, + -35, -35, -35, 53, -35, -35, -35, -35 + }, + + { + 7, -36, -36, -36, -36, -36, -36, -36, -36, -36, + -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, + + -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, + -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, + -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, + -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, + -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, + -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, + -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, + -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, + -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, + -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, + + -36, -36, -36, -36, -36, -36, -36, -36 + }, + + { + 7, 37, 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 38, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, + + 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37 + }, + + { + 7, -38, -38, -38, -38, -38, -38, -38, -38, -38, + -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, + -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, + -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, + -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, + -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, + + -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, + -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, + -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, + -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, + -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, + -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, + -38, -38, -38, -38, -38, -38, -38, -38 + }, + + { + 7, -39, -39, -39, -39, -39, -39, -39, -39, -39, + -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, + -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, + + -39, -39, -39, -39, -39, 39, 39, -39, -39, 39, + -39, -39, -39, -39, 39, -39, 39, -39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, -39, 39, + -39, -39, -39, -39, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, + 39, -39, 39, -39, 39, 39, -39, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, + 39, 39, 39, -39, -39, -39, -39, -39 + + }, + + { + 7, -40, -40, -40, -40, -40, -40, -40, -40, -40, + -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, + -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, + -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, + -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, + -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, + -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, + -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, + -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, + -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, + + -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, + -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, + -40, -40, -40, -40, -40, -40, -40, -40 + }, + + { + 7, -41, -41, -41, -41, -41, -41, -41, -41, -41, + -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, + -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, + -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, + -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, + -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, + -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, + + -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, + -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, + -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, + -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, + -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, + -41, -41, -41, -41, -41, -41, -41, -41 + }, + + { + 7, -42, -42, -42, -42, -42, -42, -42, -42, -42, + -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, + -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, + -42, -42, -42, -42, -42, 39, 39, -42, -42, 39, + + -42, -42, -42, -42, 39, -42, 39, -42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, -42, 39, + -42, -42, -42, -42, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, + 39, -42, 39, -42, 39, 39, -42, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, + 39, 39, 39, -42, -42, -42, -42, -42 + }, + + { + 7, -43, -43, -43, -43, -43, -43, -43, -43, -43, + + -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, + -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, + -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, + -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, + -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, + -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, + -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, + -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, + -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, + -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, + + -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, + -43, -43, -43, -43, -43, -43, -43, -43 + }, + + { + 7, -44, -44, -44, -44, -44, -44, -44, -44, -44, + -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, + -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, + -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, + -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, + -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, + -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, + -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, + + -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, + -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, + -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, + -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, + -44, -44, -44, -44, -44, -44, -44, -44 + }, + + { + 7, -45, -45, -45, -45, -45, -45, -45, -45, -45, + -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, + -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, + -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, + -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, + + -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, + -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, + -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, + -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, + -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, + -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, + -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, + -45, -45, -45, -45, -45, -45, -45, -45 + }, + + { + 7, -46, -46, -46, -46, -46, -46, -46, -46, -46, + -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, + + -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, + -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, + -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, + -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, + -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, + -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, + -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, + -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, + -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, + -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, + + -46, -46, -46, -46, -46, -46, -46, -46 + }, + + { + 7, -47, -47, -47, -47, -47, -47, -47, -47, -47, + -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, + -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, + -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, + -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, + -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, + -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, + -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, + -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, + + -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, + -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, + -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, + -47, -47, -47, -47, -47, -47, -47, -47 + }, + + { + 7, -48, -48, -48, -48, -48, -48, -48, -48, -48, + -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, + -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, + -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, + -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, + -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, + + -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, + -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, + -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, + -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, + -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, + -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, + -48, -48, -48, -48, -48, -48, -48, -48 + }, + + { + 7, 49, 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, + + 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 50, 49, 51, 49, 49 + + }, + + { + 7, -50, -50, -50, -50, -50, -50, -50, -50, -50, + -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, + -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, + -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, + -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, + -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, + -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, + -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, + -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, + -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, + + -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, + -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, + -50, -50, -50, -50, -50, -50, -50, -50 + }, + + { + 7, -51, -51, -51, -51, -51, -51, -51, -51, -51, + -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, + -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, + -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, + -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, + -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, + -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, + + -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, + -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, + -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, + -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, + -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, + -51, -51, -51, -51, -51, -51, -51, -51 + }, + + { + 7, 52, 52, 52, 52, 52, 52, 52, 52, -52, + -52, 52, 52, -52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, -52, -52, 52, 52, -52, -52, -52, 52, + + -52, -52, -52, -52, 52, -52, 52, -52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, -52, 52, + -52, -52, -52, -52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, -52, 52, 52, 52 + }, + + { + 7, -53, -53, -53, -53, -53, -53, -53, -53, -53, + + -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, + -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, + -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, + -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, + -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, + -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, + -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, + -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, + -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, + -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, + + -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, + -53, -53, -53, -53, -53, -53, -53, -53 + }, + + } ; static yy_state_type yy_get_previous_state (yyscan_t yyscanner ); static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner); @@ -365,109 +1297,24 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[55] = +static yyconst flex_int16_t yy_accept[54] = { 0, 0, 0, 0, 0, 32, 32, 36, 35, 25, 27, 19, 35, 29, 29, 17, 2, 22, 23, 15, 13, 14, 16, 28, 20, 9, 3, 8, 18, 1, 35, 31, 30, 32, 33, 33, 12, 0, 26, 29, 24, 5, 28, 21, 11, 6, 7, 10, 4, 0, 31, - 30, 32, 34, 0 - } ; - -static yyconst flex_int32_t yy_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 2, 4, 5, 6, 7, 8, 9, 6, 10, - 11, 12, 13, 6, 14, 6, 15, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 17, 6, 18, - 19, 20, 21, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 1, 6, 1, 6, 6, 1, 6, 6, 6, 6, - - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 22, 23, 24, 25, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1 - } ; - -static yyconst flex_int32_t yy_meta[26] = - { 0, - 1, 2, 2, 2, 1, 3, 4, 2, 2, 2, - 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, - 2, 3, 2, 1, 1 - } ; - -static yyconst flex_int16_t yy_base[61] = - { 0, - 0, 0, 4, 5, 29, 54, 71, 101, 101, 101, - 50, 63, 25, 45, 101, 56, 101, 101, 101, 101, - 101, 101, 31, 47, 44, 14, 43, 101, 29, 18, - 101, 101, 0, 101, 28, 101, 38, 101, 42, 101, - 101, 50, 101, 101, 101, 101, 101, 101, 22, 101, - 101, 0, 101, 101, 79, 83, 87, 89, 93, 97 - } ; - -static yyconst flex_int16_t yy_def[61] = - { 0, - 54, 1, 55, 55, 56, 56, 54, 54, 54, 54, - 54, 57, 54, 58, 54, 54, 54, 54, 54, 54, - 54, 54, 54, 54, 54, 54, 54, 54, 54, 59, - 54, 54, 60, 54, 54, 54, 57, 54, 54, 54, - 54, 54, 54, 54, 54, 54, 54, 54, 59, 54, - 54, 60, 54, 0, 54, 54, 54, 54, 54, 54 + 30, 32, 34 } ; -static yyconst flex_int16_t yy_nxt[127] = +static yyconst yy_state_type yy_NUL_trans[54] = { 0, - 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - 28, 8, 29, 8, 8, 31, 31, 32, 32, 33, - 39, 39, 45, 33, 33, 35, 39, 39, 46, 50, - 39, 51, 38, 50, 33, 51, 42, 39, 39, 53, - 33, 48, 33, 33, 33, 39, 39, 39, 33, 33, - 35, 47, 44, 43, 41, 42, 40, 38, 36, 33, - 54, 54, 54, 54, 54, 33, 54, 33, 33, 30, - 30, 30, 30, 34, 34, 34, 34, 37, 37, 37, - 37, 39, 39, 49, 49, 49, 49, 52, 54, 52, - - 7, 54, 54, 54, 54, 54, 54, 54, 54, 54, - 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, - 54, 54, 54, 54, 54, 54 - } ; - -static yyconst flex_int16_t yy_chk[127] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 3, 4, 3, 4, 5, - 13, 13, 26, 5, 5, 5, 23, 23, 26, 30, - 13, 30, 37, 49, 5, 49, 23, 39, 39, 35, - 5, 29, 5, 5, 6, 42, 42, 39, 6, 6, - 6, 27, 25, 24, 16, 42, 14, 12, 11, 6, - 7, 0, 0, 0, 0, 6, 0, 6, 6, 55, - 55, 55, 55, 56, 56, 56, 56, 57, 57, 57, - 57, 58, 58, 59, 59, 59, 59, 60, 0, 60, - - 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, - 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, - 54, 54, 54, 54, 54, 54 + 8, 8, 30, 30, 33, 33, 0, 0, 0, 0, + 0, 37, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, + 0, 0, 52, 0, 0, 0, 37, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 49, 0, + 0, 52, 0 } ; /* The intent behind this definition is that it'll catch @@ -571,7 +1418,7 @@ int ast_yyget_column(yyscan_t yyscanner); static int curlycount = 0; static char *expr2_token_subst(const char *mess); -#line 575 "ast_expr2f.c" +#line 1422 "ast_expr2f.c" #define INITIAL 0 #define var 1 @@ -635,6 +1482,10 @@ static int yy_init_globals (yyscan_t yyscanner ); # define yylloc yyg->yylloc_r +int ast_yylex_init (yyscan_t* scanner); + +int ast_yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner); + /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ @@ -714,7 +1565,7 @@ static int input (yyscan_t yyscanner ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) +#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -722,33 +1573,17 @@ static int input (yyscan_t yyscanner ); */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ - if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + errno=0; \ + while ( (result = read( fileno(yyin), (char *) buf, max_size )) < 0 ) \ + { \ + if( errno != EINTR) \ { \ - int c = '*'; \ - size_t n; \ - for ( n = 0; n < max_size && \ - (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ) \ - buf[n++] = (char) c; \ - if ( c == EOF && ferror( yyin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ - result = n; \ + break; \ } \ - else \ - { \ errno=0; \ - while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ - { \ - if( errno != EINTR) \ - { \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - break; \ - } \ - errno=0; \ - clearerr(yyin); \ - } \ - }\ + clearerr(yyin); \ + }\ \ #endif @@ -779,9 +1614,11 @@ static int input (yyscan_t yyscanner ); #ifndef YY_DECL #define YY_DECL_IS_OURS 1 -extern int ast_yylex (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner); +extern int ast_yylex \ + (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner); -#define YY_DECL int ast_yylex (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner) +#define YY_DECL int ast_yylex \ + (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner) #endif /* !YY_DECL */ /* Code executed at the beginning of each rule, after yytext and yyleng @@ -811,7 +1648,7 @@ YY_DECL #line 105 "ast_expr2.fl" -#line 815 "ast_expr2f.c" +#line 1652 "ast_expr2f.c" yylval = yylval_param; @@ -863,26 +1700,18 @@ YY_DECL yy_current_state = yyg->yy_start; yy_match: - do + while ( (yy_current_state = yy_nxt[yy_current_state][ YY_SC_TO_UI(*yy_cp) ]) > 0 ) { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; if ( yy_accept[yy_current_state] ) { yyg->yy_last_accepting_state = yy_current_state; yyg->yy_last_accepting_cpos = yy_cp; } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 55 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + ++yy_cp; } - while ( yy_current_state != 54 ); - yy_cp = yyg->yy_last_accepting_cpos; - yy_current_state = yyg->yy_last_accepting_state; + + yy_current_state = -yy_current_state; yy_find_action: yy_act = yy_accept[yy_current_state]; @@ -896,7 +1725,7 @@ do_action: /* This label is used only to access EOF actions. */ case 0: /* must back up */ /* undo the effects of YY_DO_BEFORE_ACTION */ *yy_cp = yyg->yy_hold_char; - yy_cp = yyg->yy_last_accepting_cpos; + yy_cp = yyg->yy_last_accepting_cpos + 1; yy_current_state = yyg->yy_last_accepting_state; goto yy_find_action; @@ -1136,7 +1965,7 @@ YY_RULE_SETUP #line 206 "ast_expr2.fl" ECHO; YY_BREAK -#line 1140 "ast_expr2f.c" +#line 1969 "ast_expr2f.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(var): yyterminate(); @@ -1204,8 +2033,7 @@ case YY_STATE_EOF(var): else { - yy_cp = yyg->yy_last_accepting_cpos; - yy_current_state = yyg->yy_last_accepting_state; + yy_cp = yyg->yy_c_buf_p; goto yy_find_action; } } @@ -1370,7 +2198,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) /* Read in more data. */ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - yyg->yy_n_chars, num_to_read ); + yyg->yy_n_chars, (size_t) num_to_read ); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; } @@ -1394,6 +2222,14 @@ static int yy_get_next_buffer (yyscan_t yyscanner) else ret_val = EOB_ACT_CONTINUE_SCAN; + if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) ast_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + } + yyg->yy_n_chars += number_to_move; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; @@ -1415,19 +2251,17 @@ static int yy_get_next_buffer (yyscan_t yyscanner) for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( *yy_cp ) + { + yy_current_state = yy_nxt[yy_current_state][YY_SC_TO_UI(*yy_cp)]; + } + else + yy_current_state = yy_NUL_trans[yy_current_state]; if ( yy_accept[yy_current_state] ) { yyg->yy_last_accepting_state = yy_current_state; yyg->yy_last_accepting_cpos = yy_cp; } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 55 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; } return yy_current_state; @@ -1444,20 +2278,17 @@ static int yy_get_next_buffer (yyscan_t yyscanner) struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */ register char *yy_cp = yyg->yy_c_buf_p; - register YY_CHAR yy_c = 1; - if ( yy_accept[yy_current_state] ) - { - yyg->yy_last_accepting_state = yy_current_state; - yyg->yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + yy_current_state = yy_NUL_trans[yy_current_state]; + yy_is_jam = (yy_current_state == 0); + + if ( ! yy_is_jam ) { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 55 ) - yy_c = yy_meta[(unsigned int) yy_c]; + if ( yy_accept[yy_current_state] ) + { + yyg->yy_last_accepting_state = yy_current_state; + yyg->yy_last_accepting_cpos = yy_cp; + } } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 54); return yy_is_jam ? 0 : yy_current_state; } @@ -1822,7 +2653,9 @@ static void ast_yyensure_buffer_stack (yyscan_t yyscanner) yyg->yy_buffer_stack = (struct yy_buffer_state**)ast_yyalloc (num_to_alloc * sizeof(struct yy_buffer_state*) , yyscanner); - + if ( ! yyg->yy_buffer_stack ) + YY_FATAL_ERROR( "out of dynamic memory in ast_yyensure_buffer_stack()" ); + memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*)); yyg->yy_buffer_stack_max = num_to_alloc; @@ -1840,6 +2673,8 @@ static void ast_yyensure_buffer_stack (yyscan_t yyscanner) (yyg->yy_buffer_stack, num_to_alloc * sizeof(struct yy_buffer_state*) , yyscanner); + if ( ! yyg->yy_buffer_stack ) + YY_FATAL_ERROR( "out of dynamic memory in ast_yyensure_buffer_stack()" ); /* zero only the new slots.*/ memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*)); @@ -1884,7 +2719,7 @@ YY_BUFFER_STATE ast_yy_scan_buffer (char * base, yy_size_t size , yyscan_t yys /** Setup the input buffer state to scan a string. The next call to ast_yylex() will * scan from a @e copy of @a str. - * @param str a NUL-terminated string to scan + * @param yystr a NUL-terminated string to scan * @param yyscanner The scanner object. * @return the newly allocated buffer state object. * @note If you want to scan bytes that may contain NUL values, then use @@ -2158,6 +2993,42 @@ int ast_yylex_init(yyscan_t* ptr_yy_globals) return yy_init_globals ( *ptr_yy_globals ); } +/* ast_yylex_init_extra has the same functionality as ast_yylex_init, but follows the + * convention of taking the scanner as the last argument. Note however, that + * this is a *pointer* to a scanner, as it will be allocated by this call (and + * is the reason, too, why this function also must handle its own declaration). + * The user defined value in the first argument will be available to ast_yyalloc in + * the yyextra field. + */ + +int ast_yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals ) + +{ + struct yyguts_t dummy_yyguts; + + ast_yyset_extra (yy_user_defined, &dummy_yyguts); + + if (ptr_yy_globals == NULL){ + errno = EINVAL; + return 1; + } + + *ptr_yy_globals = (yyscan_t) ast_yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); + + if (*ptr_yy_globals == NULL){ + errno = ENOMEM; + return 1; + } + + /* By setting to 0xAA, we expose bugs in + yy_init_globals. Leave at 0x00 for releases. */ + memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); + + ast_yyset_extra (yy_user_defined, *ptr_yy_globals); + + return yy_init_globals ( *ptr_yy_globals ); +} + static int yy_init_globals (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; diff --git a/main/asterisk.c b/main/asterisk.c index 0a978a949..941789b53 100644 --- a/main/asterisk.c +++ b/main/asterisk.c @@ -1157,8 +1157,11 @@ static void hup_handler(int num) if (restartnow) execvp(_argv[0], _argv); sig_flags.need_reload = 1; - if (sig_alert_pipe[1] != -1) - write(sig_alert_pipe[1], &a, sizeof(a)); + if (sig_alert_pipe[1] != -1) { + if (write(sig_alert_pipe[1], &a, sizeof(a)) < 0) { + fprintf(stderr, "hup_handler: write() failed: %s\n", strerror(errno)); + } + } signal(num, hup_handler); } @@ -1316,7 +1319,7 @@ static void quit_handler(int num, int nice, int safeshutdown, int restart) close(ast_consock); if (!ast_opt_remote) unlink(ast_config_AST_PID); - printf(term_quit()); + printf("%s", term_quit()); if (restart) { if (option_verbose || ast_opt_console) ast_verbose("Preparing for Asterisk restart...\n"); @@ -1351,8 +1354,11 @@ static void __quit_handler(int num) { int a = 0; sig_flags.need_quit = 1; - if (sig_alert_pipe[1] != -1) - write(sig_alert_pipe[1], &a, sizeof(a)); + if (sig_alert_pipe[1] != -1) { + if (write(sig_alert_pipe[1], &a, sizeof(a)) < 0) { + fprintf(stderr, "hup_handler: write() failed: %s\n", strerror(errno)); + } + } /* There is no need to restore the signal handler here, since the app * is going to exit */ } @@ -1411,7 +1417,7 @@ static int ast_all_zeros(char *s) static void consolehandler(char *s) { - printf(term_end()); + printf("%s", term_end()); fflush(stdout); /* Called when readline data is available */ @@ -1621,8 +1627,8 @@ static int show_warranty(int fd, int argc, char *argv[]) { int x; - for (x = 0; x < sizeof(warranty_lines) / sizeof(warranty_lines[0]); x++) - ast_cli(fd, (char *) warranty_lines[x]); + for (x = 0; x < ARRAY_LEN(warranty_lines); x++) + ast_cli(fd, "%s", (char *) warranty_lines[x]); return RESULT_SUCCESS; } @@ -1650,8 +1656,8 @@ static int show_license(int fd, int argc, char *argv[]) { int x; - for (x = 0; x < sizeof(license_lines) / sizeof(license_lines[0]); x++) - ast_cli(fd, (char *) license_lines[x]); + for (x = 0; x < ARRAY_LEN(license_lines); x++) + ast_cli(fd, "%s", (char *) license_lines[x]); return RESULT_SUCCESS; } @@ -1794,7 +1800,7 @@ static int ast_el_read_char(EditLine *el, char *cp) for (tries=0; tries < 30 * reconnects_per_second; tries++) { if (ast_tryconnect()) { fprintf(stderr, "Reconnect succeeded after %.3f seconds\n", 1.0 / reconnects_per_second * tries); - printf(term_quit()); + printf("%s", term_quit()); WELCOME_MESSAGE; if (!ast_opt_mute) fdsend(ast_consock, "logger mute silent"); @@ -1823,9 +1829,12 @@ static int ast_el_read_char(EditLine *el, char *cp) } /* Write over the CLI prompt */ - if (!ast_opt_exec && !lastpos) - write(STDOUT_FILENO, "\r", 1); - write(STDOUT_FILENO, buf, res); + if (!ast_opt_exec && !lastpos) { + if (write(STDOUT_FILENO, "\r", 1) < 0) { + } + } + if (write(STDOUT_FILENO, buf, res) < 0) { + } if ((res < EL_BUF_SIZE - 1) && ((buf[res-1] == '\n') || (buf[res-2] == '\n'))) { *cp = CC_REFRESH; return(1); @@ -1912,8 +1921,13 @@ static char *cli_prompt(EditLine *el) if ((LOADAVG = fopen("/proc/loadavg", "r"))) { float avg1, avg2, avg3; int actproc, totproc, npid, which; - fscanf(LOADAVG, "%f %f %f %d/%d %d", - &avg1, &avg2, &avg3, &actproc, &totproc, &npid); + + if (fscanf(LOADAVG, "%f %f %f %d/%d %d", + &avg1, &avg2, &avg3, &actproc, &totproc, &npid) != 6) { + ast_log(LOG_WARNING, "parsing /proc/loadavg failed\n"); + fclose(LOADAVG); + break; + } if (sscanf(t, "%d", &which) == 1) { switch (which) { case 1: @@ -1933,6 +1947,7 @@ static char *cli_prompt(EditLine *el) break; } } + fclose(LOADAVG); } break; #endif @@ -2261,7 +2276,9 @@ static int ast_el_read_history(char *filename) return ret; while (!feof(f)) { - fgets(buf, sizeof(buf), f); + if (!fgets(buf, sizeof(buf), f)) { + continue; + } if (!strcmp(buf, "_HiStOrY_V2_\n")) continue; if (ast_all_zeros(buf)) @@ -2274,7 +2291,7 @@ static int ast_el_read_history(char *filename) return ret; } -static void ast_remotecontrol(char * data) +static void ast_remotecontrol(char *data) { char buf[80]; int res; @@ -2289,9 +2306,15 @@ static void ast_remotecontrol(char * data) char *ebuf; int num = 0; - read(ast_consock, buf, sizeof(buf)); - if (data) - write(ast_consock, data, strlen(data) + 1); + if (read(ast_consock, buf, sizeof(buf)) < 0) { + ast_log(LOG_ERROR, "read() failed: %s\n", strerror(errno)); + return; + } + if (data) { + if (write(ast_consock, data, strlen(data) + 1) < 0) { + ast_log(LOG_ERROR, "write() failed: %s\n", strerror(errno)); + } + } stringp = buf; hostname = strsep(&stringp, "/"); cpid = strsep(&stringp, "/"); @@ -2349,7 +2372,9 @@ static void ast_remotecontrol(char * data) /* Skip verbose lines */ if (*curline != 127) { not_written = 0; - write(STDOUT_FILENO, curline, nextline - curline); + if (write(STDOUT_FILENO, curline, nextline - curline) < 0) { + ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno)); + } } curline = nextline; } while (!ast_strlen_zero(curline)); @@ -2619,7 +2644,8 @@ static void *monitor_sig_flags(void *unused) sig_flags.need_quit = 0; quit_handler(0, 0, 1, 0); } - read(sig_alert_pipe[0], &a, sizeof(a)); + if (read(sig_alert_pipe[0], &a, sizeof(a)) != sizeof(a)) { + } } return NULL; @@ -2884,7 +2910,7 @@ int main(int argc, char *argv[]) #endif ast_term_init(); - printf(term_end()); + printf("%s", term_end()); fflush(stdout); if (ast_opt_console && !option_verbose) @@ -2909,18 +2935,18 @@ int main(int argc, char *argv[]) quit_handler(0, 0, 0, 0); exit(0); } - printf(term_quit()); + printf("%s", term_quit()); ast_remotecontrol(NULL); quit_handler(0, 0, 0, 0); exit(0); } else { ast_log(LOG_ERROR, "Asterisk already running on %s. Use 'asterisk -r' to connect.\n", ast_config_AST_SOCKET); - printf(term_quit()); + printf("%s", term_quit()); exit(1); } } else if (ast_opt_remote || ast_opt_exec) { ast_log(LOG_ERROR, "Unable to connect to remote asterisk (does %s exist?)\n", ast_config_AST_SOCKET); - printf(term_quit()); + printf("%s", term_quit()); exit(1); } /* Blindly write pid file since we couldn't connect */ @@ -2935,7 +2961,9 @@ int main(int argc, char *argv[]) #if HAVE_WORKING_FORK if (ast_opt_always_fork || !ast_opt_no_fork) { #ifndef HAVE_SBIN_LAUNCHD - daemon(1, 0); + if (daemon(1, 0) < 0) { + ast_log(LOG_ERROR, "daemon() failed: %s\n", strerror(errno)); + } ast_mainpid = getpid(); /* Blindly re-write pid file since we are forking */ unlink(ast_config_AST_PID); @@ -2977,7 +3005,7 @@ int main(int argc, char *argv[]) initstate((unsigned int) getpid() * 65536 + (unsigned int) time(NULL), randompool, sizeof(randompool)); if (init_logger()) { - printf(term_quit()); + printf("%s", term_quit()); exit(1); } @@ -3048,12 +3076,12 @@ int main(int argc, char *argv[]) ast_autoservice_init(); if (load_modules(1)) { - printf(term_quit()); + printf("%s", term_quit()); exit(1); } if (dnsmgr_init()) { - printf(term_quit()); + printf("%s", term_quit()); exit(1); } @@ -3062,12 +3090,12 @@ int main(int argc, char *argv[]) ast_channels_init(); if (ast_cdr_engine_init()) { - printf(term_quit()); + printf("%s", term_quit()); exit(1); } if (ast_device_state_engine_init()) { - printf(term_quit()); + printf("%s", term_quit()); exit(1); } @@ -3076,37 +3104,37 @@ int main(int argc, char *argv[]) ast_udptl_init(); if (ast_image_init()) { - printf(term_quit()); + printf("%s", term_quit()); exit(1); } if (ast_file_init()) { - printf(term_quit()); + printf("%s", term_quit()); exit(1); } if (load_pbx()) { - printf(term_quit()); + printf("%s", term_quit()); exit(1); } if (init_framer()) { - printf(term_quit()); + printf("%s", term_quit()); exit(1); } if (astdb_init()) { - printf(term_quit()); + printf("%s", term_quit()); exit(1); } if (ast_enum_init()) { - printf(term_quit()); + printf("%s", term_quit()); exit(1); } if (load_modules(0)) { - printf(term_quit()); + printf("%s", term_quit()); exit(1); } @@ -3115,7 +3143,7 @@ int main(int argc, char *argv[]) * registering manager actions. This will cause reversed locking * order between the module list and manager actions list. */ if (init_manager()) { - printf(term_quit()); + printf("%s", term_quit()); exit(1); } @@ -3126,7 +3154,7 @@ int main(int argc, char *argv[]) if (ast_opt_console && !option_verbose) ast_verbose(" ]\n"); if (option_verbose || ast_opt_console) - ast_verbose(term_color(tmp, "Asterisk Ready.\n", COLOR_BRWHITE, COLOR_BLACK, sizeof(tmp))); + ast_verbose("%s", term_color(tmp, "Asterisk Ready.\n", COLOR_BRWHITE, COLOR_BLACK, sizeof(tmp))); if (ast_opt_no_fork) consolethread = pthread_self(); diff --git a/main/channel.c b/main/channel.c index f23831041..621c2b1ef 100644 --- a/main/channel.c +++ b/main/channel.c @@ -1896,8 +1896,11 @@ int ast_waitfordigit_full(struct ast_channel *c, int ms, int audiofd, int cmdfd) break; case AST_FRAME_VOICE: /* Write audio if appropriate */ - if (audiofd > -1) - write(audiofd, f->data, f->datalen); + if (audiofd > -1) { + if (write(audiofd, f->data, f->datalen) < 0) { + ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno)); + } + } default: /* Ignore */ break; @@ -2034,7 +2037,9 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio) goto done; } } - read(chan->alertpipe[0], &blah, sizeof(blah)); + if (read(chan->alertpipe[0], &blah, sizeof(blah)) < 0) { + ast_log(LOG_WARNING, "read() failed: %s\n", strerror(errno)); + } } #ifdef HAVE_DAHDI @@ -3488,7 +3493,10 @@ int ast_do_masquerade(struct ast_channel *original) AST_LIST_INSERT_TAIL(&original->readq, cur, frame_list); if (original->alertpipe[1] > -1) { int poke = 0; - write(original->alertpipe[1], &poke, sizeof(poke)); + + if (write(original->alertpipe[1], &poke, sizeof(poke)) < 0) { + ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno)); + } } } } diff --git a/main/cli.c b/main/cli.c index e685268d7..ef3ce6d19 100644 --- a/main/cli.c +++ b/main/cli.c @@ -873,7 +873,7 @@ static int handle_commandcomplete(int fd, int argc, char *argv[]) return RESULT_SHOWUSAGE; buf = __ast_cli_generator(argv[2], argv[3], atoi(argv[4]), 0); if (buf) { - ast_cli(fd, buf); + ast_cli(fd, "%s", buf); free(buf); } else ast_cli(fd, "NULL\n"); diff --git a/main/db1-ast/hash/hash_page.c b/main/db1-ast/hash/hash_page.c index 737b97d32..52571c552 100644 --- a/main/db1-ast/hash/hash_page.c +++ b/main/db1-ast/hash/hash_page.c @@ -712,7 +712,8 @@ overflow_page(hashp) #define OVMSG "HASH: Out of overflow pages. Increase page size\n" if (offset > SPLITMASK) { if (++splitnum >= NCACHED) { - (void)write(STDERR_FILENO, OVMSG, sizeof(OVMSG) - 1); + if (write(STDERR_FILENO, OVMSG, sizeof(OVMSG) - 1) < 0) { + } return (0); } hashp->OVFL_POINT = splitnum; @@ -725,7 +726,8 @@ overflow_page(hashp) if (free_bit == (hashp->BSIZE << BYTE_SHIFT) - 1) { free_page++; if (free_page >= NCACHED) { - (void)write(STDERR_FILENO, OVMSG, sizeof(OVMSG) - 1); + if (write(STDERR_FILENO, OVMSG, sizeof(OVMSG) - 1) < 0) { + } return (0); } /* @@ -749,8 +751,8 @@ overflow_page(hashp) offset++; if (offset > SPLITMASK) { if (++splitnum >= NCACHED) { - (void)write(STDERR_FILENO, OVMSG, - sizeof(OVMSG) - 1); + if (write(STDERR_FILENO, OVMSG, sizeof(OVMSG) - 1) < 0) { + } return (0); } hashp->OVFL_POINT = splitnum; diff --git a/main/file.c b/main/file.c index 79822e652..45a033c55 100644 --- a/main/file.c +++ b/main/file.c @@ -1207,8 +1207,11 @@ static int waitstream_core(struct ast_channel *c, const char *breakon, break; case AST_FRAME_VOICE: /* Write audio if appropriate */ - if (audiofd > -1) - write(audiofd, fr->data, fr->datalen); + if (audiofd > -1) { + if (write(audiofd, fr->data, fr->datalen) < 0) { + ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno)); + } + } default: /* Ignore all others */ break; diff --git a/main/http.c b/main/http.c index d969e719f..e164d554f 100644 --- a/main/http.c +++ b/main/http.c @@ -496,8 +496,12 @@ static void *ast_httpd_helper_thread(void *data) tmp = strstr(c, "\r\n\r\n"); if (tmp) { ast_cli(ser->fd, "Content-length: %d\r\n", contentlength); - write(ser->fd, c, (tmp + 4 - c)); - write(ser->fd, tmp + 4, contentlength); + if (write(ser->fd, c, (tmp + 4 - c)) < 0) { + ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno)); + } + if (write(ser->fd, tmp + 4, contentlength) < 0) { + ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno)); + } } } else ast_cli(ser->fd, "%s", c); diff --git a/main/manager.c b/main/manager.c index b966440b0..20b5c6ff3 100644 --- a/main/manager.c +++ b/main/manager.c @@ -1765,7 +1765,9 @@ static int action_command(struct mansession *s, const struct message *m) final_buf = ast_calloc(1, l + 1); if (buf) { lseek(fd, 0, SEEK_SET); - read(fd, buf, l); + if (read(fd, buf, l) < 0) { + ast_log(LOG_WARNING, "read() failed: %s\n", strerror(errno)); + } buf[l] = '\0'; if (final_buf) { term_strip(final_buf, buf, l); diff --git a/main/translate.c b/main/translate.c index f68178ecd..598520c07 100644 --- a/main/translate.c +++ b/main/translate.c @@ -585,7 +585,7 @@ static int show_translation_deprecated(int fd, int argc, char *argv[]) } } ast_build_string(&buf, &left, "\n"); - ast_cli(fd, line); + ast_cli(fd, "%s", line); } AST_LIST_UNLOCK(&translators); return RESULT_SUCCESS; @@ -654,7 +654,7 @@ static int show_translation(int fd, int argc, char *argv[]) } } ast_build_string(&buf, &left, "\n"); - ast_cli(fd, line); + ast_cli(fd, "%s", line); } AST_LIST_UNLOCK(&translators); return RESULT_SUCCESS; diff --git a/pbx/ael/ael.flex b/pbx/ael/ael.flex index 6eb305843..58bfa369d 100644 --- a/pbx/ael/ael.flex +++ b/pbx/ael/ael.flex @@ -763,7 +763,9 @@ struct pval *ael2_parse(char *filename, int *errors) my_file = strdup(filename); stat(filename, &stats); buffer = (char*)malloc(stats.st_size+2); - fread(buffer, 1, stats.st_size, fin); + if (fread(buffer, 1, stats.st_size, fin) != stats.st_size) { + ast_log(LOG_ERROR, "fread() failed: %s\n", strerror(errno)); + } buffer[stats.st_size]=0; fclose(fin); @@ -831,7 +833,9 @@ static void setup_filestack(char *fnamebuf2, int fnamebuf_siz, glob_t *globbuf, struct stat stats; stat(fnamebuf2, &stats); buffer = (char*)malloc(stats.st_size+1); - fread(buffer, 1, stats.st_size, in1); + if (fread(buffer, 1, stats.st_size, in1) != stats.st_size) { + ast_log(LOG_ERROR, "fread() failed: %s\n", strerror(errno)); + } buffer[stats.st_size] = 0; ast_log(LOG_NOTICE," --Read in included file %s, %d chars\n",fnamebuf2, (int)stats.st_size); fclose(in1); diff --git a/pbx/ael/ael.tab.c b/pbx/ael/ael.tab.c index df2f4e265..189537017 100644 --- a/pbx/ael/ael.tab.c +++ b/pbx/ael/ael.tab.c @@ -1,7 +1,9 @@ -/* A Bison parser, made by GNU Bison 2.1a. */ +/* A Bison parser, made by GNU Bison 2.3. */ -/* Skeleton parser for Yacc-like parsing with Bison, - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +/* Skeleton implementation for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,10 +20,18 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -/* As a special exception, when this file is copied by Bison into a - Bison output file, you may use that output file without restriction. - This special exception was added by the Free Software Foundation - in version 1.24 of Bison. */ +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ /* C LALR(1) parser skeleton written by Richard Stallman, by simplifying the original so-called "semantic" parser. */ @@ -37,7 +47,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.1a" +#define YYBISON_VERSION "2.3" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -227,14 +237,14 @@ static char *ael_token_subst(const char *mess); #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 54 "ael.y" +#line 56 "ael.y" { int intval; /* integer value, typically flags */ char *str; /* strings */ struct pval *pval; /* full objects */ } -/* Line 198 of yacc.c. */ -#line 236 "ael.tab.c" +/* Line 187 of yacc.c. */ +#line 248 "ael.tab.c" YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 @@ -256,7 +266,7 @@ typedef struct YYLTYPE /* Copy the second part of user declarations. */ -#line 60 "ael.y" +#line 62 "ael.y" /* declaring these AFTER the union makes things a lot simpler! */ void yyerror(YYLTYPE *locp, struct parse_io *parseio, char const *s); @@ -278,8 +288,8 @@ static pval *nword(char *string, YYLTYPE *pos); static pval *update_last(pval *, YYLTYPE *); -/* Line 221 of yacc.c. */ -#line 281 "ael.tab.c" +/* Line 216 of yacc.c. */ +#line 293 "ael.tab.c" #ifdef short # undef short @@ -409,8 +419,13 @@ YYID (i) # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif -# ifdef __cplusplus -extern "C" { +# if (defined __cplusplus && ! defined _STDLIB_H \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif # endif # ifndef YYMALLOC # define YYMALLOC malloc @@ -426,9 +441,6 @@ void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif -# ifdef __cplusplus -} -# endif # endif #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ @@ -622,20 +634,20 @@ static const yytype_int8 yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 185, 185, 188, 189, 190, 193, 194, 195, 196, - 199, 200, 203, 212, 213, 214, 215, 216, 219, 225, - 231, 232, 233, 236, 236, 243, 244, 245, 246, 249, - 250, 251, 254, 255, 256, 257, 258, 259, 260, 261, - 264, 269, 273, 278, 283, 293, 294, 295, 301, 306, - 310, 318, 318, 322, 325, 328, 339, 340, 347, 348, - 352, 356, 362, 363, 368, 376, 377, 381, 387, 396, - 399, 400, 403, 406, 409, 410, 411, 409, 417, 421, - 422, 423, 424, 427, 427, 460, 461, 462, 463, 467, - 470, 471, 474, 475, 478, 481, 485, 489, 493, 499, - 500, 504, 507, 513, 513, 518, 526, 526, 537, 544, - 547, 548, 551, 552, 555, 558, 559, 562, 566, 570, - 576, 577, 580, 581, 582, 588, 593, 598, 599, 600, - 602, 605, 606, 613, 614, 615, 618, 621 + 0, 187, 187, 190, 191, 192, 195, 196, 197, 198, + 201, 202, 205, 214, 215, 216, 217, 218, 221, 227, + 233, 234, 235, 238, 238, 245, 246, 247, 248, 251, + 252, 253, 256, 257, 258, 259, 260, 261, 262, 263, + 266, 271, 275, 280, 285, 295, 296, 297, 303, 313, + 317, 325, 325, 329, 332, 335, 346, 347, 359, 360, + 369, 378, 389, 390, 400, 413, 414, 423, 434, 443, + 446, 447, 450, 453, 456, 457, 458, 456, 464, 468, + 469, 470, 471, 474, 474, 507, 508, 509, 510, 514, + 517, 518, 521, 522, 525, 528, 532, 536, 540, 546, + 547, 551, 554, 560, 560, 565, 573, 573, 584, 591, + 594, 595, 598, 599, 602, 605, 606, 609, 613, 617, + 623, 624, 627, 628, 629, 635, 640, 645, 646, 647, + 658, 661, 662, 669, 670, 671, 674, 677 }; #endif @@ -1043,14 +1055,14 @@ do { \ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void -yy_symbol_value_print (FILE *yyoutput, int yytype, const YYSTYPE * const yyvaluep, const YYLTYPE * const yylocationp, struct parse_io *parseio) +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, struct parse_io *parseio) #else static void yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, parseio) FILE *yyoutput; int yytype; - const YYSTYPE * const yyvaluep; - const YYLTYPE * const yylocationp; + YYSTYPE const * const yyvaluep; + YYLTYPE const * const yylocationp; struct parse_io *parseio; #endif { @@ -1079,14 +1091,14 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, parseio) #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void -yy_symbol_print (FILE *yyoutput, int yytype, const YYSTYPE * const yyvaluep, const YYLTYPE * const yylocationp, struct parse_io *parseio) +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, struct parse_io *parseio) #else static void yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp, parseio) FILE *yyoutput; int yytype; - const YYSTYPE * const yyvaluep; - const YYLTYPE * const yylocationp; + YYSTYPE const * const yyvaluep; + YYLTYPE const * const yylocationp; struct parse_io *parseio; #endif { @@ -1264,7 +1276,7 @@ yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { - size_t yyn = 0; + YYSIZE_T yyn = 0; char const *yyp = yystr; for (;;) @@ -1311,7 +1323,7 @@ yysyntax_error (char *yyresult, int yystate, int yychar) { int yyn = yypact[yystate]; - if (! (YYPACT_NINF < yyn && yyn < YYLAST)) + if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) return 0; else { @@ -1349,7 +1361,7 @@ yysyntax_error (char *yyresult, int yystate, int yychar) int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn; + int yychecklim = YYLAST - yyn + 1; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; int yycount = 1; @@ -1439,321 +1451,321 @@ yydestruct (yymsg, yytype, yyvaluep, yylocationp, parseio) switch (yytype) { case 42: /* "word" */ -#line 177 "ael.y" +#line 179 "ael.y" { free((yyvaluep->str));}; -#line 1443 "ael.tab.c" +#line 1457 "ael.tab.c" break; case 45: /* "objects" */ -#line 164 "ael.y" +#line 166 "ael.y" { destroy_pval((yyvaluep->pval)); prev_word=0; }; -#line 1451 "ael.tab.c" +#line 1465 "ael.tab.c" break; case 46: /* "object" */ -#line 164 "ael.y" +#line 166 "ael.y" { destroy_pval((yyvaluep->pval)); prev_word=0; }; -#line 1459 "ael.tab.c" +#line 1473 "ael.tab.c" break; case 47: /* "context_name" */ -#line 177 "ael.y" +#line 179 "ael.y" { free((yyvaluep->str));}; -#line 1464 "ael.tab.c" +#line 1478 "ael.tab.c" break; case 48: /* "context" */ -#line 164 "ael.y" +#line 166 "ael.y" { destroy_pval((yyvaluep->pval)); prev_word=0; }; -#line 1472 "ael.tab.c" +#line 1486 "ael.tab.c" break; case 50: /* "macro" */ -#line 164 "ael.y" +#line 166 "ael.y" { destroy_pval((yyvaluep->pval)); prev_word=0; }; -#line 1480 "ael.tab.c" +#line 1494 "ael.tab.c" break; case 51: /* "globals" */ -#line 164 "ael.y" +#line 166 "ael.y" { destroy_pval((yyvaluep->pval)); prev_word=0; }; -#line 1488 "ael.tab.c" +#line 1502 "ael.tab.c" break; case 52: /* "global_statements" */ -#line 164 "ael.y" +#line 166 "ael.y" { destroy_pval((yyvaluep->pval)); prev_word=0; }; -#line 1496 "ael.tab.c" +#line 1510 "ael.tab.c" break; case 53: /* "assignment" */ -#line 164 "ael.y" +#line 166 "ael.y" { destroy_pval((yyvaluep->pval)); prev_word=0; }; -#line 1504 "ael.tab.c" +#line 1518 "ael.tab.c" break; case 55: /* "arglist" */ -#line 164 "ael.y" +#line 166 "ael.y" { destroy_pval((yyvaluep->pval)); prev_word=0; }; -#line 1512 "ael.tab.c" +#line 1526 "ael.tab.c" break; case 56: /* "elements" */ -#line 164 "ael.y" +#line 166 "ael.y" { destroy_pval((yyvaluep->pval)); prev_word=0; }; -#line 1520 "ael.tab.c" +#line 1534 "ael.tab.c" break; case 57: /* "element" */ -#line 164 "ael.y" +#line 166 "ael.y" { destroy_pval((yyvaluep->pval)); prev_word=0; }; -#line 1528 "ael.tab.c" +#line 1542 "ael.tab.c" break; case 58: /* "ignorepat" */ -#line 164 "ael.y" +#line 166 "ael.y" { destroy_pval((yyvaluep->pval)); prev_word=0; }; -#line 1536 "ael.tab.c" +#line 1550 "ael.tab.c" break; case 59: /* "extension" */ -#line 164 "ael.y" +#line 166 "ael.y" { destroy_pval((yyvaluep->pval)); prev_word=0; }; -#line 1544 "ael.tab.c" +#line 1558 "ael.tab.c" break; case 60: /* "statements" */ -#line 164 "ael.y" +#line 166 "ael.y" { destroy_pval((yyvaluep->pval)); prev_word=0; }; -#line 1552 "ael.tab.c" +#line 1566 "ael.tab.c" break; case 61: /* "timerange" */ -#line 177 "ael.y" +#line 179 "ael.y" { free((yyvaluep->str));}; -#line 1557 "ael.tab.c" +#line 1571 "ael.tab.c" break; case 62: /* "timespec" */ -#line 164 "ael.y" +#line 166 "ael.y" { destroy_pval((yyvaluep->pval)); prev_word=0; }; -#line 1565 "ael.tab.c" +#line 1579 "ael.tab.c" break; case 63: /* "test_expr" */ -#line 177 "ael.y" +#line 179 "ael.y" { free((yyvaluep->str));}; -#line 1570 "ael.tab.c" +#line 1584 "ael.tab.c" break; case 65: /* "if_like_head" */ -#line 164 "ael.y" +#line 166 "ael.y" { destroy_pval((yyvaluep->pval)); prev_word=0; }; -#line 1578 "ael.tab.c" +#line 1592 "ael.tab.c" break; case 66: /* "word_list" */ -#line 177 "ael.y" +#line 179 "ael.y" { free((yyvaluep->str));}; -#line 1583 "ael.tab.c" +#line 1597 "ael.tab.c" break; case 68: /* "word3_list" */ -#line 177 "ael.y" +#line 179 "ael.y" { free((yyvaluep->str));}; -#line 1588 "ael.tab.c" +#line 1602 "ael.tab.c" break; case 69: /* "goto_word" */ -#line 177 "ael.y" +#line 179 "ael.y" { free((yyvaluep->str));}; -#line 1593 "ael.tab.c" +#line 1607 "ael.tab.c" break; case 70: /* "switch_statement" */ -#line 164 "ael.y" +#line 166 "ael.y" { destroy_pval((yyvaluep->pval)); prev_word=0; }; -#line 1601 "ael.tab.c" +#line 1615 "ael.tab.c" break; case 71: /* "statement" */ -#line 164 "ael.y" +#line 166 "ael.y" { destroy_pval((yyvaluep->pval)); prev_word=0; }; -#line 1609 "ael.tab.c" +#line 1623 "ael.tab.c" break; case 76: /* "opt_else" */ -#line 164 "ael.y" +#line 166 "ael.y" { destroy_pval((yyvaluep->pval)); prev_word=0; }; -#line 1617 "ael.tab.c" +#line 1631 "ael.tab.c" break; case 77: /* "target" */ -#line 164 "ael.y" +#line 166 "ael.y" { destroy_pval((yyvaluep->pval)); prev_word=0; }; -#line 1625 "ael.tab.c" +#line 1639 "ael.tab.c" break; case 78: /* "opt_pri" */ -#line 177 "ael.y" +#line 179 "ael.y" { free((yyvaluep->str));}; -#line 1630 "ael.tab.c" +#line 1644 "ael.tab.c" break; case 79: /* "jumptarget" */ -#line 164 "ael.y" +#line 166 "ael.y" { destroy_pval((yyvaluep->pval)); prev_word=0; }; -#line 1638 "ael.tab.c" +#line 1652 "ael.tab.c" break; case 80: /* "macro_call" */ -#line 164 "ael.y" +#line 166 "ael.y" { destroy_pval((yyvaluep->pval)); prev_word=0; }; -#line 1646 "ael.tab.c" +#line 1660 "ael.tab.c" break; case 82: /* "application_call_head" */ -#line 164 "ael.y" +#line 166 "ael.y" { destroy_pval((yyvaluep->pval)); prev_word=0; }; -#line 1654 "ael.tab.c" +#line 1668 "ael.tab.c" break; case 84: /* "application_call" */ -#line 164 "ael.y" +#line 166 "ael.y" { destroy_pval((yyvaluep->pval)); prev_word=0; }; -#line 1662 "ael.tab.c" +#line 1676 "ael.tab.c" break; case 85: /* "opt_word" */ -#line 177 "ael.y" +#line 179 "ael.y" { free((yyvaluep->str));}; -#line 1667 "ael.tab.c" +#line 1681 "ael.tab.c" break; case 86: /* "eval_arglist" */ -#line 164 "ael.y" +#line 166 "ael.y" { destroy_pval((yyvaluep->pval)); prev_word=0; }; -#line 1675 "ael.tab.c" +#line 1689 "ael.tab.c" break; case 87: /* "case_statements" */ -#line 164 "ael.y" +#line 166 "ael.y" { destroy_pval((yyvaluep->pval)); prev_word=0; }; -#line 1683 "ael.tab.c" +#line 1697 "ael.tab.c" break; case 88: /* "case_statement" */ -#line 164 "ael.y" +#line 166 "ael.y" { destroy_pval((yyvaluep->pval)); prev_word=0; }; -#line 1691 "ael.tab.c" +#line 1705 "ael.tab.c" break; case 89: /* "macro_statements" */ -#line 164 "ael.y" +#line 166 "ael.y" { destroy_pval((yyvaluep->pval)); prev_word=0; }; -#line 1699 "ael.tab.c" +#line 1713 "ael.tab.c" break; case 90: /* "macro_statement" */ -#line 164 "ael.y" +#line 166 "ael.y" { destroy_pval((yyvaluep->pval)); prev_word=0; }; -#line 1707 "ael.tab.c" +#line 1721 "ael.tab.c" break; case 91: /* "switches" */ -#line 164 "ael.y" +#line 166 "ael.y" { destroy_pval((yyvaluep->pval)); prev_word=0; }; -#line 1715 "ael.tab.c" +#line 1729 "ael.tab.c" break; case 92: /* "eswitches" */ -#line 164 "ael.y" +#line 166 "ael.y" { destroy_pval((yyvaluep->pval)); prev_word=0; }; -#line 1723 "ael.tab.c" +#line 1737 "ael.tab.c" break; case 93: /* "switchlist" */ -#line 164 "ael.y" +#line 166 "ael.y" { destroy_pval((yyvaluep->pval)); prev_word=0; }; -#line 1731 "ael.tab.c" +#line 1745 "ael.tab.c" break; case 94: /* "included_entry" */ -#line 164 "ael.y" +#line 166 "ael.y" { destroy_pval((yyvaluep->pval)); prev_word=0; }; -#line 1739 "ael.tab.c" +#line 1753 "ael.tab.c" break; case 95: /* "includeslist" */ -#line 164 "ael.y" +#line 166 "ael.y" { destroy_pval((yyvaluep->pval)); prev_word=0; }; -#line 1747 "ael.tab.c" +#line 1761 "ael.tab.c" break; case 96: /* "includes" */ -#line 164 "ael.y" +#line 166 "ael.y" { destroy_pval((yyvaluep->pval)); prev_word=0; }; -#line 1755 "ael.tab.c" +#line 1769 "ael.tab.c" break; default: @@ -2076,57 +2088,57 @@ yyreduce: switch (yyn) { case 2: -#line 185 "ael.y" +#line 187 "ael.y" { (yyval.pval) = parseio->pval = (yyvsp[(1) - (1)].pval); ;} break; case 3: -#line 188 "ael.y" +#line 190 "ael.y" {(yyval.pval)=(yyvsp[(1) - (1)].pval);;} break; case 4: -#line 189 "ael.y" +#line 191 "ael.y" { (yyval.pval) = linku1((yyvsp[(1) - (2)].pval), (yyvsp[(2) - (2)].pval)); ;} break; case 5: -#line 190 "ael.y" +#line 192 "ael.y" {(yyval.pval)=(yyvsp[(1) - (2)].pval);;} break; case 6: -#line 193 "ael.y" +#line 195 "ael.y" {(yyval.pval)=(yyvsp[(1) - (1)].pval);;} break; case 7: -#line 194 "ael.y" +#line 196 "ael.y" {(yyval.pval)=(yyvsp[(1) - (1)].pval);;} break; case 8: -#line 195 "ael.y" +#line 197 "ael.y" {(yyval.pval)=(yyvsp[(1) - (1)].pval);;} break; case 9: -#line 196 "ael.y" +#line 198 "ael.y" {(yyval.pval)=0;/* allow older docs to be read */;} break; case 10: -#line 199 "ael.y" +#line 201 "ael.y" { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; case 11: -#line 200 "ael.y" +#line 202 "ael.y" { (yyval.str) = strdup("default"); ;} break; case 12: -#line 203 "ael.y" +#line 205 "ael.y" { (yyval.pval) = npval2(PV_CONTEXT, &(yylsp[(1) - (6)]), &(yylsp[(6) - (6)])); (yyval.pval)->u1.str = (yyvsp[(3) - (6)].str); @@ -2136,32 +2148,32 @@ yyreduce: break; case 13: -#line 212 "ael.y" +#line 214 "ael.y" { (yyval.intval) = 1; ;} break; case 14: -#line 213 "ael.y" +#line 215 "ael.y" { (yyval.intval) = 0; ;} break; case 15: -#line 214 "ael.y" +#line 216 "ael.y" { (yyval.intval) = 2; ;} break; case 16: -#line 215 "ael.y" +#line 217 "ael.y" { (yyval.intval)=3; ;} break; case 17: -#line 216 "ael.y" +#line 218 "ael.y" { (yyval.intval)=3; ;} break; case 18: -#line 219 "ael.y" +#line 221 "ael.y" { (yyval.pval) = npval2(PV_MACRO, &(yylsp[(1) - (8)]), &(yylsp[(8) - (8)])); (yyval.pval)->u1.str = (yyvsp[(2) - (8)].str); (yyval.pval)->u2.arglist = (yyvsp[(4) - (8)].pval); (yyval.pval)->u3.macro_statements = (yyvsp[(7) - (8)].pval); @@ -2169,7 +2181,7 @@ yyreduce: break; case 19: -#line 225 "ael.y" +#line 227 "ael.y" { (yyval.pval) = npval2(PV_GLOBALS, &(yylsp[(1) - (4)]), &(yylsp[(4) - (4)])); (yyval.pval)->u1.statements = (yyvsp[(3) - (4)].pval); @@ -2177,27 +2189,27 @@ yyreduce: break; case 20: -#line 231 "ael.y" +#line 233 "ael.y" { (yyval.pval) = NULL; ;} break; case 21: -#line 232 "ael.y" +#line 234 "ael.y" {(yyval.pval) = linku1((yyvsp[(1) - (2)].pval), (yyvsp[(2) - (2)].pval)); ;} break; case 22: -#line 233 "ael.y" +#line 235 "ael.y" {(yyval.pval)=(yyvsp[(2) - (2)].pval);;} break; case 23: -#line 236 "ael.y" +#line 238 "ael.y" { reset_semicount(parseio->scanner); ;} break; case 24: -#line 236 "ael.y" +#line 238 "ael.y" { (yyval.pval) = npval2(PV_VARDEC, &(yylsp[(1) - (5)]), &(yylsp[(5) - (5)])); (yyval.pval)->u1.str = (yyvsp[(1) - (5)].str); @@ -2205,89 +2217,89 @@ yyreduce: break; case 25: -#line 243 "ael.y" +#line 245 "ael.y" { (yyval.pval) = NULL; ;} break; case 26: -#line 244 "ael.y" +#line 246 "ael.y" { (yyval.pval) = nword((yyvsp[(1) - (1)].str), &(yylsp[(1) - (1)])); ;} break; case 27: -#line 245 "ael.y" +#line 247 "ael.y" { (yyval.pval) = linku1((yyvsp[(1) - (3)].pval), nword((yyvsp[(3) - (3)].str), &(yylsp[(3) - (3)]))); ;} break; case 28: -#line 246 "ael.y" +#line 248 "ael.y" {(yyval.pval)=(yyvsp[(1) - (2)].pval);;} break; case 29: -#line 249 "ael.y" +#line 251 "ael.y" {(yyval.pval)=0;;} break; case 30: -#line 250 "ael.y" +#line 252 "ael.y" { (yyval.pval) = linku1((yyvsp[(1) - (2)].pval), (yyvsp[(2) - (2)].pval)); ;} break; case 31: -#line 251 "ael.y" +#line 253 "ael.y" { (yyval.pval)=(yyvsp[(2) - (2)].pval);;} break; case 32: -#line 254 "ael.y" +#line 256 "ael.y" {(yyval.pval)=(yyvsp[(1) - (1)].pval);;} break; case 33: -#line 255 "ael.y" +#line 257 "ael.y" {(yyval.pval)=(yyvsp[(1) - (1)].pval);;} break; case 34: -#line 256 "ael.y" +#line 258 "ael.y" {(yyval.pval)=(yyvsp[(1) - (1)].pval);;} break; case 35: -#line 257 "ael.y" +#line 259 "ael.y" {(yyval.pval)=(yyvsp[(1) - (1)].pval);;} break; case 36: -#line 258 "ael.y" +#line 260 "ael.y" {(yyval.pval)=(yyvsp[(1) - (1)].pval);;} break; case 37: -#line 259 "ael.y" +#line 261 "ael.y" {(yyval.pval)=(yyvsp[(1) - (1)].pval);;} break; case 38: -#line 260 "ael.y" +#line 262 "ael.y" {free((yyvsp[(1) - (2)].str)); (yyval.pval)=0;;} break; case 39: -#line 261 "ael.y" +#line 263 "ael.y" {(yyval.pval)=0;/* allow older docs to be read */;} break; case 40: -#line 264 "ael.y" +#line 266 "ael.y" { (yyval.pval) = npval2(PV_IGNOREPAT, &(yylsp[(1) - (4)]), &(yylsp[(4) - (4)])); (yyval.pval)->u1.str = (yyvsp[(3) - (4)].str);;} break; case 41: -#line 269 "ael.y" +#line 271 "ael.y" { (yyval.pval) = npval2(PV_EXTENSION, &(yylsp[(1) - (3)]), &(yylsp[(3) - (3)])); (yyval.pval)->u1.str = (yyvsp[(1) - (3)].str); @@ -2295,7 +2307,7 @@ yyreduce: break; case 42: -#line 273 "ael.y" +#line 275 "ael.y" { (yyval.pval) = npval2(PV_EXTENSION, &(yylsp[(1) - (4)]), &(yylsp[(4) - (4)])); (yyval.pval)->u1.str = (yyvsp[(2) - (4)].str); @@ -2304,7 +2316,7 @@ yyreduce: break; case 43: -#line 278 "ael.y" +#line 280 "ael.y" { (yyval.pval) = npval2(PV_EXTENSION, &(yylsp[(1) - (7)]), &(yylsp[(7) - (7)])); (yyval.pval)->u1.str = (yyvsp[(5) - (7)].str); @@ -2313,7 +2325,7 @@ yyreduce: break; case 44: -#line 283 "ael.y" +#line 285 "ael.y" { (yyval.pval) = npval2(PV_EXTENSION, &(yylsp[(1) - (8)]), &(yylsp[(8) - (8)])); (yyval.pval)->u1.str = (yyvsp[(6) - (8)].str); @@ -2323,36 +2335,41 @@ yyreduce: break; case 45: -#line 293 "ael.y" +#line 295 "ael.y" { (yyval.pval) = NULL; ;} break; case 46: -#line 294 "ael.y" +#line 296 "ael.y" { (yyval.pval) = linku1((yyvsp[(1) - (2)].pval), (yyvsp[(2) - (2)].pval)); ;} break; case 47: -#line 295 "ael.y" +#line 297 "ael.y" {(yyval.pval)=(yyvsp[(2) - (2)].pval);;} break; case 48: -#line 301 "ael.y" +#line 303 "ael.y" { - asprintf(&(yyval.str), "%s:%s:%s", (yyvsp[(1) - (5)].str), (yyvsp[(3) - (5)].str), (yyvsp[(5) - (5)].str)); - free((yyvsp[(1) - (5)].str)); - free((yyvsp[(3) - (5)].str)); - free((yyvsp[(5) - (5)].str)); ;} + if (asprintf(&(yyval.str), "%s:%s:%s", (yyvsp[(1) - (5)].str), (yyvsp[(3) - (5)].str), (yyvsp[(5) - (5)].str)) < 0) { + ast_log(LOG_WARNING, "asprintf() failed\n"); + (yyval.str) = NULL; + } else { + free((yyvsp[(1) - (5)].str)); + free((yyvsp[(3) - (5)].str)); + free((yyvsp[(5) - (5)].str)); + } + ;} break; case 49: -#line 306 "ael.y" +#line 313 "ael.y" { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; case 50: -#line 310 "ael.y" +#line 317 "ael.y" { (yyval.pval) = nword((yyvsp[(1) - (7)].str), &(yylsp[(1) - (7)])); (yyval.pval)->next = nword((yyvsp[(3) - (7)].str), &(yylsp[(3) - (7)])); @@ -2361,31 +2378,31 @@ yyreduce: break; case 51: -#line 318 "ael.y" +#line 325 "ael.y" { reset_parencount(parseio->scanner); ;} break; case 52: -#line 318 "ael.y" +#line 325 "ael.y" { (yyval.str) = (yyvsp[(3) - (4)].str); ;} break; case 53: -#line 322 "ael.y" +#line 329 "ael.y" { (yyval.pval)= npval2(PV_IF, &(yylsp[(1) - (2)]), &(yylsp[(2) - (2)])); (yyval.pval)->u1.str = (yyvsp[(2) - (2)].str); ;} break; case 54: -#line 325 "ael.y" +#line 332 "ael.y" { (yyval.pval) = npval2(PV_RANDOM, &(yylsp[(1) - (2)]), &(yylsp[(2) - (2)])); (yyval.pval)->u1.str=(yyvsp[(2) - (2)].str);;} break; case 55: -#line 328 "ael.y" +#line 335 "ael.y" { (yyval.pval) = npval2(PV_IFTIME, &(yylsp[(1) - (4)]), &(yylsp[(4) - (4)])); (yyval.pval)->u1.list = (yyvsp[(3) - (4)].pval); @@ -2393,95 +2410,135 @@ yyreduce: break; case 56: -#line 339 "ael.y" +#line 346 "ael.y" { (yyval.str) = (yyvsp[(1) - (1)].str);;} break; case 57: -#line 340 "ael.y" +#line 347 "ael.y" { - asprintf(&((yyval.str)), "%s%s", (yyvsp[(1) - (2)].str), (yyvsp[(2) - (2)].str)); - free((yyvsp[(1) - (2)].str)); - free((yyvsp[(2) - (2)].str)); - prev_word = (yyval.str);;} + if (asprintf(&((yyval.str)), "%s%s", (yyvsp[(1) - (2)].str), (yyvsp[(2) - (2)].str)) < 0) { + ast_log(LOG_WARNING, "asprintf() failed\n"); + (yyval.str) = NULL; + } else { + free((yyvsp[(1) - (2)].str)); + free((yyvsp[(2) - (2)].str)); + prev_word = (yyval.str); + } + ;} break; case 58: -#line 347 "ael.y" +#line 359 "ael.y" { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; case 59: -#line 348 "ael.y" +#line 360 "ael.y" { - asprintf(&((yyval.str)), "%s %s", (yyvsp[(1) - (2)].str), (yyvsp[(2) - (2)].str)); - free((yyvsp[(1) - (2)].str)); - free((yyvsp[(2) - (2)].str)); ;} + if (asprintf(&((yyval.str)), "%s %s", (yyvsp[(1) - (2)].str), (yyvsp[(2) - (2)].str)) < 0) { + ast_log(LOG_WARNING, "asprintf() failed\n"); + (yyval.str) = NULL; + } else { + free((yyvsp[(1) - (2)].str)); + free((yyvsp[(2) - (2)].str)); + } + ;} break; case 60: -#line 352 "ael.y" +#line 369 "ael.y" { - asprintf(&((yyval.str)), "%s:%s", (yyvsp[(1) - (3)].str), (yyvsp[(3) - (3)].str)); - free((yyvsp[(1) - (3)].str)); - free((yyvsp[(3) - (3)].str)); ;} + if (asprintf(&((yyval.str)), "%s:%s", (yyvsp[(1) - (3)].str), (yyvsp[(3) - (3)].str)) < 0) { + ast_log(LOG_WARNING, "asprintf() failed\n"); + (yyval.str) = NULL; + } else { + free((yyvsp[(1) - (3)].str)); + free((yyvsp[(3) - (3)].str)); + } + ;} break; case 61: -#line 356 "ael.y" +#line 378 "ael.y" { /* there are often '&' in hints */ - asprintf(&((yyval.str)), "%s&%s", (yyvsp[(1) - (3)].str), (yyvsp[(3) - (3)].str)); - free((yyvsp[(1) - (3)].str)); - free((yyvsp[(3) - (3)].str));;} + if (asprintf(&((yyval.str)), "%s&%s", (yyvsp[(1) - (3)].str), (yyvsp[(3) - (3)].str)) < 0) { + ast_log(LOG_WARNING, "asprintf() failed\n"); + (yyval.str) = NULL; + } else { + free((yyvsp[(1) - (3)].str)); + free((yyvsp[(3) - (3)].str)); + } + ;} break; case 62: -#line 362 "ael.y" +#line 389 "ael.y" { (yyval.str) = (yyvsp[(1) - (1)].str);;} break; case 63: -#line 363 "ael.y" +#line 390 "ael.y" { - asprintf(&((yyval.str)), "%s%s", (yyvsp[(1) - (2)].str), (yyvsp[(2) - (2)].str)); - free((yyvsp[(1) - (2)].str)); - free((yyvsp[(2) - (2)].str)); - prev_word = (yyval.str);;} + if (asprintf(&((yyval.str)), "%s%s", (yyvsp[(1) - (2)].str), (yyvsp[(2) - (2)].str)) < 0) { + ast_log(LOG_WARNING, "asprintf() failed\n"); + (yyval.str) = NULL; + } else { + free((yyvsp[(1) - (2)].str)); + free((yyvsp[(2) - (2)].str)); + prev_word = (yyval.str); + } + ;} break; case 64: -#line 368 "ael.y" +#line 400 "ael.y" { - asprintf(&((yyval.str)), "%s%s%s", (yyvsp[(1) - (3)].str), (yyvsp[(2) - (3)].str), (yyvsp[(3) - (3)].str)); - free((yyvsp[(1) - (3)].str)); - free((yyvsp[(2) - (3)].str)); - free((yyvsp[(3) - (3)].str)); - prev_word=(yyval.str);;} + if (asprintf(&((yyval.str)), "%s%s%s", (yyvsp[(1) - (3)].str), (yyvsp[(2) - (3)].str), (yyvsp[(3) - (3)].str)) < 0) { + ast_log(LOG_WARNING, "asprintf() failed\n"); + (yyval.str) = NULL; + } else { + free((yyvsp[(1) - (3)].str)); + free((yyvsp[(2) - (3)].str)); + free((yyvsp[(3) - (3)].str)); + prev_word=(yyval.str); + } + ;} break; case 65: -#line 376 "ael.y" +#line 413 "ael.y" { (yyval.str) = (yyvsp[(1) - (1)].str);;} break; case 66: -#line 377 "ael.y" +#line 414 "ael.y" { - asprintf(&((yyval.str)), "%s%s", (yyvsp[(1) - (2)].str), (yyvsp[(2) - (2)].str)); - free((yyvsp[(1) - (2)].str)); - free((yyvsp[(2) - (2)].str));;} + if (asprintf(&((yyval.str)), "%s%s", (yyvsp[(1) - (2)].str), (yyvsp[(2) - (2)].str)) < 0) { + ast_log(LOG_WARNING, "asprintf() failed\n"); + (yyval.str) = NULL; + } else { + free((yyvsp[(1) - (2)].str)); + free((yyvsp[(2) - (2)].str)); + } + ;} break; case 67: -#line 381 "ael.y" +#line 423 "ael.y" { - asprintf(&((yyval.str)), "%s:%s", (yyvsp[(1) - (3)].str), (yyvsp[(3) - (3)].str)); - free((yyvsp[(1) - (3)].str)); - free((yyvsp[(3) - (3)].str));;} + if (asprintf(&((yyval.str)), "%s:%s", (yyvsp[(1) - (3)].str), (yyvsp[(3) - (3)].str)) < 0) { + ast_log(LOG_WARNING, "asprintf() failed\n"); + (yyval.str) = NULL; + } else { + free((yyvsp[(1) - (3)].str)); + free((yyvsp[(3) - (3)].str)); + } + ;} break; case 68: -#line 387 "ael.y" +#line 434 "ael.y" { (yyval.pval) = npval2(PV_SWITCH, &(yylsp[(1) - (5)]), &(yylsp[(5) - (5)])); (yyval.pval)->u1.str = (yyvsp[(2) - (5)].str); @@ -2489,55 +2546,55 @@ yyreduce: break; case 69: -#line 396 "ael.y" +#line 443 "ael.y" { (yyval.pval) = npval2(PV_STATEMENTBLOCK, &(yylsp[(1) - (3)]), &(yylsp[(3) - (3)])); (yyval.pval)->u1.list = (yyvsp[(2) - (3)].pval); set_dads((yyval.pval),(yyvsp[(2) - (3)].pval));;} break; case 70: -#line 399 "ael.y" +#line 446 "ael.y" { (yyval.pval) = (yyvsp[(1) - (1)].pval); ;} break; case 71: -#line 400 "ael.y" +#line 447 "ael.y" { (yyval.pval) = npval2(PV_GOTO, &(yylsp[(1) - (3)]), &(yylsp[(3) - (3)])); (yyval.pval)->u1.list = (yyvsp[(2) - (3)].pval);;} break; case 72: -#line 403 "ael.y" +#line 450 "ael.y" { (yyval.pval) = npval2(PV_GOTO, &(yylsp[(1) - (3)]), &(yylsp[(3) - (3)])); (yyval.pval)->u1.list = (yyvsp[(2) - (3)].pval);;} break; case 73: -#line 406 "ael.y" +#line 453 "ael.y" { (yyval.pval) = npval2(PV_LABEL, &(yylsp[(1) - (2)]), &(yylsp[(2) - (2)])); (yyval.pval)->u1.str = (yyvsp[(1) - (2)].str); ;} break; case 74: -#line 409 "ael.y" +#line 456 "ael.y" {reset_semicount(parseio->scanner);;} break; case 75: -#line 410 "ael.y" +#line 457 "ael.y" {reset_semicount(parseio->scanner);;} break; case 76: -#line 411 "ael.y" +#line 458 "ael.y" {reset_parencount(parseio->scanner);;} break; case 77: -#line 411 "ael.y" +#line 458 "ael.y" { /* XXX word_list maybe ? */ (yyval.pval) = npval2(PV_FOR, &(yylsp[(1) - (12)]), &(yylsp[(12) - (12)])); (yyval.pval)->u1.for_init = (yyvsp[(4) - (12)].str); @@ -2547,7 +2604,7 @@ yyreduce: break; case 78: -#line 417 "ael.y" +#line 464 "ael.y" { (yyval.pval) = npval2(PV_WHILE, &(yylsp[(1) - (3)]), &(yylsp[(3) - (3)])); (yyval.pval)->u1.str = (yyvsp[(2) - (3)].str); @@ -2555,34 +2612,34 @@ yyreduce: break; case 79: -#line 421 "ael.y" +#line 468 "ael.y" { (yyval.pval) = (yyvsp[(1) - (1)].pval); ;} break; case 80: -#line 422 "ael.y" +#line 469 "ael.y" { (yyval.pval) = update_last((yyvsp[(2) - (3)].pval), &(yylsp[(2) - (3)])); ;} break; case 81: -#line 423 "ael.y" +#line 470 "ael.y" { (yyval.pval) = update_last((yyvsp[(1) - (2)].pval), &(yylsp[(2) - (2)])); ;} break; case 82: -#line 424 "ael.y" +#line 471 "ael.y" { (yyval.pval)= npval2(PV_APPLICATION_CALL, &(yylsp[(1) - (2)]), &(yylsp[(2) - (2)])); (yyval.pval)->u1.str = (yyvsp[(1) - (2)].str);;} break; case 83: -#line 427 "ael.y" +#line 474 "ael.y" {reset_semicount(parseio->scanner);;} break; case 84: -#line 427 "ael.y" +#line 474 "ael.y" { char *bufx; int tot=0; @@ -2619,22 +2676,22 @@ yyreduce: break; case 85: -#line 460 "ael.y" +#line 507 "ael.y" { (yyval.pval) = npval2(PV_BREAK, &(yylsp[(1) - (2)]), &(yylsp[(2) - (2)])); ;} break; case 86: -#line 461 "ael.y" +#line 508 "ael.y" { (yyval.pval) = npval2(PV_RETURN, &(yylsp[(1) - (2)]), &(yylsp[(2) - (2)])); ;} break; case 87: -#line 462 "ael.y" +#line 509 "ael.y" { (yyval.pval) = npval2(PV_CONTINUE, &(yylsp[(1) - (2)]), &(yylsp[(2) - (2)])); ;} break; case 88: -#line 463 "ael.y" +#line 510 "ael.y" { (yyval.pval) = update_last((yyvsp[(1) - (3)].pval), &(yylsp[(2) - (3)])); (yyval.pval)->u2.statements = (yyvsp[(2) - (3)].pval); set_dads((yyval.pval),(yyvsp[(2) - (3)].pval)); @@ -2642,41 +2699,41 @@ yyreduce: break; case 89: -#line 467 "ael.y" +#line 514 "ael.y" { (yyval.pval)=0; ;} break; case 90: -#line 470 "ael.y" +#line 517 "ael.y" { (yyval.pval) = (yyvsp[(2) - (2)].pval); ;} break; case 91: -#line 471 "ael.y" +#line 518 "ael.y" { (yyval.pval) = NULL ; ;} break; case 92: -#line 474 "ael.y" +#line 521 "ael.y" { (yyval.pval) = nword((yyvsp[(1) - (1)].str), &(yylsp[(1) - (1)])); ;} break; case 93: -#line 475 "ael.y" +#line 522 "ael.y" { (yyval.pval) = nword((yyvsp[(1) - (3)].str), &(yylsp[(1) - (3)])); (yyval.pval)->next = nword((yyvsp[(3) - (3)].str), &(yylsp[(3) - (3)])); ;} break; case 94: -#line 478 "ael.y" +#line 525 "ael.y" { (yyval.pval) = nword((yyvsp[(1) - (3)].str), &(yylsp[(1) - (3)])); (yyval.pval)->next = nword((yyvsp[(3) - (3)].str), &(yylsp[(3) - (3)])); ;} break; case 95: -#line 481 "ael.y" +#line 528 "ael.y" { (yyval.pval) = nword((yyvsp[(1) - (5)].str), &(yylsp[(1) - (5)])); (yyval.pval)->next = nword((yyvsp[(3) - (5)].str), &(yylsp[(3) - (5)])); @@ -2684,7 +2741,7 @@ yyreduce: break; case 96: -#line 485 "ael.y" +#line 532 "ael.y" { (yyval.pval) = nword((yyvsp[(1) - (5)].str), &(yylsp[(1) - (5)])); (yyval.pval)->next = nword((yyvsp[(3) - (5)].str), &(yylsp[(3) - (5)])); @@ -2692,7 +2749,7 @@ yyreduce: break; case 97: -#line 489 "ael.y" +#line 536 "ael.y" { (yyval.pval) = nword(strdup("default"), &(yylsp[(1) - (5)])); (yyval.pval)->next = nword((yyvsp[(3) - (5)].str), &(yylsp[(3) - (5)])); @@ -2700,7 +2757,7 @@ yyreduce: break; case 98: -#line 493 "ael.y" +#line 540 "ael.y" { (yyval.pval) = nword(strdup("default"), &(yylsp[(1) - (5)])); (yyval.pval)->next = nword((yyvsp[(3) - (5)].str), &(yylsp[(3) - (5)])); @@ -2708,24 +2765,24 @@ yyreduce: break; case 99: -#line 499 "ael.y" +#line 546 "ael.y" { (yyval.str) = strdup("1"); ;} break; case 100: -#line 500 "ael.y" +#line 547 "ael.y" { (yyval.str) = (yyvsp[(2) - (2)].str); ;} break; case 101: -#line 504 "ael.y" +#line 551 "ael.y" { /* ext[, pri] default 1 */ (yyval.pval) = nword((yyvsp[(1) - (2)].str), &(yylsp[(1) - (2)])); (yyval.pval)->next = nword((yyvsp[(2) - (2)].str), &(yylsp[(2) - (2)])); ;} break; case 102: -#line 507 "ael.y" +#line 554 "ael.y" { /* context, ext, pri */ (yyval.pval) = nword((yyvsp[(4) - (4)].str), &(yylsp[(4) - (4)])); (yyval.pval)->next = nword((yyvsp[(1) - (4)].str), &(yylsp[(1) - (4)])); @@ -2733,12 +2790,12 @@ yyreduce: break; case 103: -#line 513 "ael.y" +#line 560 "ael.y" {reset_argcount(parseio->scanner);;} break; case 104: -#line 513 "ael.y" +#line 560 "ael.y" { /* XXX original code had @2 but i think we need @5 */ (yyval.pval) = npval2(PV_MACRO_CALL, &(yylsp[(1) - (5)]), &(yylsp[(5) - (5)])); @@ -2747,19 +2804,19 @@ yyreduce: break; case 105: -#line 518 "ael.y" +#line 565 "ael.y" { (yyval.pval)= npval2(PV_MACRO_CALL, &(yylsp[(1) - (3)]), &(yylsp[(3) - (3)])); (yyval.pval)->u1.str = (yyvsp[(1) - (3)].str); ;} break; case 106: -#line 526 "ael.y" +#line 573 "ael.y" {reset_argcount(parseio->scanner);;} break; case 107: -#line 526 "ael.y" +#line 573 "ael.y" { if (strcasecmp((yyvsp[(1) - (3)].str),"goto") == 0) { (yyval.pval) = npval2(PV_GOTO, &(yylsp[(1) - (3)]), &(yylsp[(2) - (3)])); @@ -2772,7 +2829,7 @@ yyreduce: break; case 108: -#line 537 "ael.y" +#line 584 "ael.y" { (yyval.pval) = update_last((yyvsp[(1) - (3)].pval), &(yylsp[(3) - (3)])); if( (yyval.pval)->type == PV_GOTO ) @@ -2783,49 +2840,49 @@ yyreduce: break; case 109: -#line 544 "ael.y" +#line 591 "ael.y" { (yyval.pval) = update_last((yyvsp[(1) - (2)].pval), &(yylsp[(2) - (2)])); ;} break; case 110: -#line 547 "ael.y" +#line 594 "ael.y" { (yyval.str) = (yyvsp[(1) - (1)].str) ;} break; case 111: -#line 548 "ael.y" +#line 595 "ael.y" { (yyval.str) = strdup(""); ;} break; case 112: -#line 551 "ael.y" +#line 598 "ael.y" { (yyval.pval) = nword((yyvsp[(1) - (1)].str), &(yylsp[(1) - (1)])); ;} break; case 113: -#line 552 "ael.y" +#line 599 "ael.y" { (yyval.pval)= npval(PV_WORD,0/*@1.first_line*/,0/*@1.last_line*/,0/* @1.first_column*/, 0/*@1.last_column*/); (yyval.pval)->u1.str = strdup(""); ;} break; case 114: -#line 555 "ael.y" +#line 602 "ael.y" { (yyval.pval) = linku1((yyvsp[(1) - (3)].pval), nword((yyvsp[(3) - (3)].str), &(yylsp[(3) - (3)]))); ;} break; case 115: -#line 558 "ael.y" +#line 605 "ael.y" { (yyval.pval) = NULL; ;} break; case 116: -#line 559 "ael.y" +#line 606 "ael.y" { (yyval.pval) = linku1((yyvsp[(1) - (2)].pval), (yyvsp[(2) - (2)].pval)); ;} break; case 117: -#line 562 "ael.y" +#line 609 "ael.y" { (yyval.pval) = npval2(PV_CASE, &(yylsp[(1) - (4)]), &(yylsp[(3) - (4)])); /* XXX 3 or 4 ? */ (yyval.pval)->u1.str = (yyvsp[(2) - (4)].str); @@ -2833,7 +2890,7 @@ yyreduce: break; case 118: -#line 566 "ael.y" +#line 613 "ael.y" { (yyval.pval) = npval2(PV_DEFAULT, &(yylsp[(1) - (3)]), &(yylsp[(3) - (3)])); (yyval.pval)->u1.str = NULL; @@ -2841,7 +2898,7 @@ yyreduce: break; case 119: -#line 570 "ael.y" +#line 617 "ael.y" { (yyval.pval) = npval2(PV_PATTERN, &(yylsp[(1) - (4)]), &(yylsp[(4) - (4)])); /* XXX@3 or @4 ? */ (yyval.pval)->u1.str = (yyvsp[(2) - (4)].str); @@ -2849,27 +2906,27 @@ yyreduce: break; case 120: -#line 576 "ael.y" +#line 623 "ael.y" { (yyval.pval) = NULL; ;} break; case 121: -#line 577 "ael.y" +#line 624 "ael.y" { (yyval.pval) = linku1((yyvsp[(1) - (2)].pval), (yyvsp[(2) - (2)].pval)); ;} break; case 122: -#line 580 "ael.y" +#line 627 "ael.y" {(yyval.pval)=(yyvsp[(1) - (1)].pval);;} break; case 123: -#line 581 "ael.y" +#line 628 "ael.y" { (yyval.pval)=(yyvsp[(1) - (1)].pval);;} break; case 124: -#line 582 "ael.y" +#line 629 "ael.y" { (yyval.pval) = npval2(PV_CATCH, &(yylsp[(1) - (5)]), &(yylsp[(5) - (5)])); (yyval.pval)->u1.str = (yyvsp[(2) - (5)].str); @@ -2877,47 +2934,56 @@ yyreduce: break; case 125: -#line 588 "ael.y" +#line 635 "ael.y" { (yyval.pval) = npval2(PV_SWITCHES, &(yylsp[(1) - (4)]), &(yylsp[(2) - (4)])); (yyval.pval)->u1.list = (yyvsp[(3) - (4)].pval); set_dads((yyval.pval),(yyvsp[(3) - (4)].pval));;} break; case 126: -#line 593 "ael.y" +#line 640 "ael.y" { (yyval.pval) = npval2(PV_ESWITCHES, &(yylsp[(1) - (4)]), &(yylsp[(2) - (4)])); (yyval.pval)->u1.list = (yyvsp[(3) - (4)].pval); set_dads((yyval.pval),(yyvsp[(3) - (4)].pval));;} break; case 127: -#line 598 "ael.y" +#line 645 "ael.y" { (yyval.pval) = NULL; ;} break; case 128: -#line 599 "ael.y" +#line 646 "ael.y" { (yyval.pval) = linku1(nword((yyvsp[(1) - (3)].str), &(yylsp[(1) - (3)])), (yyvsp[(3) - (3)].pval)); ;} break; case 129: -#line 600 "ael.y" - { char *x; asprintf(&x,"%s@%s", (yyvsp[(1) - (5)].str),(yyvsp[(3) - (5)].str)); free((yyvsp[(1) - (5)].str)); free((yyvsp[(3) - (5)].str)); - (yyval.pval) = linku1(nword(x, &(yylsp[(1) - (5)])), (yyvsp[(5) - (5)].pval));;} +#line 647 "ael.y" + { + char *x; + if (asprintf(&x,"%s@%s", (yyvsp[(1) - (5)].str), (yyvsp[(3) - (5)].str)) < 0) { + ast_log(LOG_WARNING, "asprintf() failed\n"); + (yyval.pval) = NULL; + } else { + free((yyvsp[(1) - (5)].str)); + free((yyvsp[(3) - (5)].str)); + (yyval.pval) = linku1(nword(x, &(yylsp[(1) - (5)])), (yyvsp[(5) - (5)].pval)); + } + ;} break; case 130: -#line 602 "ael.y" +#line 658 "ael.y" {(yyval.pval)=(yyvsp[(2) - (2)].pval);;} break; case 131: -#line 605 "ael.y" +#line 661 "ael.y" { (yyval.pval) = nword((yyvsp[(1) - (1)].str), &(yylsp[(1) - (1)])); ;} break; case 132: -#line 606 "ael.y" +#line 662 "ael.y" { (yyval.pval) = nword((yyvsp[(1) - (3)].str), &(yylsp[(1) - (3)])); (yyval.pval)->u2.arglist = (yyvsp[(3) - (3)].pval); @@ -2925,36 +2991,36 @@ yyreduce: break; case 133: -#line 613 "ael.y" +#line 669 "ael.y" { (yyval.pval) = (yyvsp[(1) - (2)].pval); ;} break; case 134: -#line 614 "ael.y" +#line 670 "ael.y" { (yyval.pval) = linku1((yyvsp[(1) - (3)].pval), (yyvsp[(2) - (3)].pval)); ;} break; case 135: -#line 615 "ael.y" +#line 671 "ael.y" {(yyval.pval)=(yyvsp[(1) - (2)].pval);;} break; case 136: -#line 618 "ael.y" +#line 674 "ael.y" { (yyval.pval) = npval2(PV_INCLUDES, &(yylsp[(1) - (4)]), &(yylsp[(4) - (4)])); (yyval.pval)->u1.list = (yyvsp[(3) - (4)].pval);set_dads((yyval.pval),(yyvsp[(3) - (4)].pval));;} break; case 137: -#line 621 "ael.y" +#line 677 "ael.y" { (yyval.pval) = npval2(PV_INCLUDES, &(yylsp[(1) - (3)]), &(yylsp[(3) - (3)]));;} break; -/* Line 1270 of yacc.c. */ -#line 2956 "ael.tab.c" +/* Line 1267 of yacc.c. */ +#line 3024 "ael.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -3169,11 +3235,12 @@ yyreturn: if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif - return yyresult; + /* Make sure YYID is used. */ + return YYID (yyresult); } -#line 626 "ael.y" +#line 682 "ael.y" static char *token_equivs1[] = diff --git a/pbx/ael/ael.tab.h b/pbx/ael/ael.tab.h index 92a201a70..926a6f07f 100644 --- a/pbx/ael/ael.tab.h +++ b/pbx/ael/ael.tab.h @@ -1,7 +1,9 @@ -/* A Bison parser, made by GNU Bison 2.1a. */ +/* A Bison parser, made by GNU Bison 2.3. */ -/* Skeleton parser for Yacc-like parsing with Bison, - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +/* Skeleton interface for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,10 +20,18 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -/* As a special exception, when this file is copied by Bison into a - Bison output file, you may use that output file without restriction. - This special exception was added by the Free Software Foundation - in version 1.24 of Bison. */ +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ /* Tokens. */ #ifndef YYTOKENTYPE @@ -118,14 +128,14 @@ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 54 "ael.y" +#line 56 "ael.y" { int intval; /* integer value, typically flags */ char *str; /* strings */ struct pval *pval; /* full objects */ } -/* Line 1536 of yacc.c. */ -#line 129 "ael.tab.h" +/* Line 1489 of yacc.c. */ +#line 139 "ael.tab.h" YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 @@ -148,5 +158,3 @@ typedef struct YYLTYPE #endif - - diff --git a/pbx/ael/ael.y b/pbx/ael/ael.y index c5668487b..7ff058b91 100644 --- a/pbx/ael/ael.y +++ b/pbx/ael/ael.y @@ -301,10 +301,15 @@ statements : /* empty */ { $$ = NULL; } * detect the '-' but only the ':' as separator */ timerange: word3_list COLON word3_list COLON word3_list { - asprintf(&$$, "%s:%s:%s", $1, $3, $5); - free($1); - free($3); - free($5); } + if (asprintf(&$$, "%s:%s:%s", $1, $3, $5) < 0) { + ast_log(LOG_WARNING, "asprintf() failed\n"); + $$ = NULL; + } else { + free($1); + free($3); + free($5); + } + } | word { $$ = $1; } ; @@ -340,50 +345,90 @@ if_like_head : KW_IF test_expr { word_list : word { $$ = $1;} | word word { - asprintf(&($$), "%s%s", $1, $2); - free($1); - free($2); - prev_word = $$;} + if (asprintf(&($$), "%s%s", $1, $2) < 0) { + ast_log(LOG_WARNING, "asprintf() failed\n"); + $$ = NULL; + } else { + free($1); + free($2); + prev_word = $$; + } + } ; hint_word : word { $$ = $1; } | hint_word word { - asprintf(&($$), "%s %s", $1, $2); - free($1); - free($2); } + if (asprintf(&($$), "%s %s", $1, $2) < 0) { + ast_log(LOG_WARNING, "asprintf() failed\n"); + $$ = NULL; + } else { + free($1); + free($2); + } + } | hint_word COLON word { - asprintf(&($$), "%s:%s", $1, $3); - free($1); - free($3); } + if (asprintf(&($$), "%s:%s", $1, $3) < 0) { + ast_log(LOG_WARNING, "asprintf() failed\n"); + $$ = NULL; + } else { + free($1); + free($3); + } + } | hint_word AMPER word { /* there are often '&' in hints */ - asprintf(&($$), "%s&%s", $1, $3); - free($1); - free($3);} - + if (asprintf(&($$), "%s&%s", $1, $3) < 0) { + ast_log(LOG_WARNING, "asprintf() failed\n"); + $$ = NULL; + } else { + free($1); + free($3); + } + } + ; word3_list : word { $$ = $1;} | word word { - asprintf(&($$), "%s%s", $1, $2); - free($1); - free($2); - prev_word = $$;} + if (asprintf(&($$), "%s%s", $1, $2) < 0) { + ast_log(LOG_WARNING, "asprintf() failed\n"); + $$ = NULL; + } else { + free($1); + free($2); + prev_word = $$; + } + } | word word word { - asprintf(&($$), "%s%s%s", $1, $2, $3); - free($1); - free($2); - free($3); - prev_word=$$;} + if (asprintf(&($$), "%s%s%s", $1, $2, $3) < 0) { + ast_log(LOG_WARNING, "asprintf() failed\n"); + $$ = NULL; + } else { + free($1); + free($2); + free($3); + prev_word=$$; + } + } ; goto_word : word { $$ = $1;} | word word { - asprintf(&($$), "%s%s", $1, $2); - free($1); - free($2);} + if (asprintf(&($$), "%s%s", $1, $2) < 0) { + ast_log(LOG_WARNING, "asprintf() failed\n"); + $$ = NULL; + } else { + free($1); + free($2); + } + } | goto_word COLON word { - asprintf(&($$), "%s:%s", $1, $3); - free($1); - free($3);} + if (asprintf(&($$), "%s:%s", $1, $3) < 0) { + ast_log(LOG_WARNING, "asprintf() failed\n"); + $$ = NULL; + } else { + free($1); + free($3); + } + } ; switch_statement : KW_SWITCH test_expr LC case_statements RC { @@ -599,8 +644,17 @@ eswitches : KW_ESWITCHES LC switchlist RC { switchlist : /* empty */ { $$ = NULL; } | word SEMI switchlist { $$ = linku1(nword($1, &@1), $3); } - | word AT word SEMI switchlist { char *x; asprintf(&x,"%s@%s", $1,$3); free($1); free($3); - $$ = linku1(nword(x, &@1), $5);} + | word AT word SEMI switchlist { + char *x; + if (asprintf(&x,"%s@%s", $1, $3) < 0) { + ast_log(LOG_WARNING, "asprintf() failed\n"); + $$ = NULL; + } else { + free($1); + free($3); + $$ = linku1(nword(x, &@1), $5); + } + } | error switchlist {$$=$2;} ; diff --git a/pbx/ael/ael_lex.c b/pbx/ael/ael_lex.c index 8729649e1..8dac7dc06 100644 --- a/pbx/ael/ael_lex.c +++ b/pbx/ael/ael_lex.c @@ -9,7 +9,7 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 33 +#define YY_FLEX_SUBMINOR_VERSION 35 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif @@ -32,7 +32,7 @@ /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ -#if __STDC_VERSION__ >= 199901L +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, * if you want the limit (max/min) macros for int types. @@ -55,7 +55,6 @@ typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; -#endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN @@ -86,6 +85,8 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif +#endif /* ! C99 */ + #endif /* ! FLEXINT_H */ #ifdef __cplusplus @@ -95,11 +96,12 @@ typedef unsigned int flex_uint32_t; #else /* ! __cplusplus */ -#if __STDC__ +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) #define YY_USE_CONST -#endif /* __STDC__ */ +#endif /* defined (__STDC__) */ #endif /* ! __cplusplus */ #ifdef YY_USE_CONST @@ -135,8 +137,6 @@ typedef void* yyscan_t; #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column) #define yy_flex_debug yyg->yy_flex_debug_r -int ael_yylex_init (yyscan_t* scanner); - /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. @@ -194,14 +194,9 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) -/* The following is because we cannot portably get our hands on size_t - * (without autoconf's help, which isn't available because we want - * flex-generated scanners to compile on their own). - */ - #ifndef YY_TYPEDEF_YY_SIZE_T #define YY_TYPEDEF_YY_SIZE_T -typedef unsigned int yy_size_t; +typedef size_t yy_size_t; #endif #ifndef YY_STRUCT_YY_BUFFER_STATE @@ -950,7 +945,7 @@ static void pbcwhere(const char *text, int *line, int *col ) #define STORE_POS #define STORE_LOC #endif -#line 951 "ael_lex.c" +#line 948 "ael_lex.c" #define INITIAL 0 #define paren 1 @@ -1019,6 +1014,10 @@ static int yy_init_globals (yyscan_t yyscanner ); # define yylloc yyg->yylloc_r +int ael_yylex_init (yyscan_t* scanner); + +int ael_yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner); + /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ @@ -1098,7 +1097,7 @@ static int input (yyscan_t yyscanner ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) +#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -1163,9 +1162,11 @@ static int input (yyscan_t yyscanner ); #ifndef YY_DECL #define YY_DECL_IS_OURS 1 -extern int ael_yylex (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner); +extern int ael_yylex \ + (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner); -#define YY_DECL int ael_yylex (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner) +#define YY_DECL int ael_yylex \ + (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner) #endif /* !YY_DECL */ /* Code executed at the beginning of each rule, after yytext and yyleng @@ -1192,10 +1193,10 @@ YY_DECL register int yy_act; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; -#line 204 "ael.flex" +#line 206 "ael.flex" -#line 1196 "ael_lex.c" +#line 1199 "ael_lex.c" yylval = yylval_param; @@ -1286,255 +1287,255 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 206 "ael.flex" +#line 208 "ael.flex" { STORE_POS; return LC;} YY_BREAK case 2: YY_RULE_SETUP -#line 207 "ael.flex" +#line 209 "ael.flex" { STORE_POS; return RC;} YY_BREAK case 3: YY_RULE_SETUP -#line 208 "ael.flex" +#line 210 "ael.flex" { STORE_POS; return LP;} YY_BREAK case 4: YY_RULE_SETUP -#line 209 "ael.flex" +#line 211 "ael.flex" { STORE_POS; return RP;} YY_BREAK case 5: YY_RULE_SETUP -#line 210 "ael.flex" +#line 212 "ael.flex" { STORE_POS; return SEMI;} YY_BREAK case 6: YY_RULE_SETUP -#line 211 "ael.flex" +#line 213 "ael.flex" { STORE_POS; return EQ;} YY_BREAK case 7: YY_RULE_SETUP -#line 212 "ael.flex" +#line 214 "ael.flex" { STORE_POS; return COMMA;} YY_BREAK case 8: YY_RULE_SETUP -#line 213 "ael.flex" +#line 215 "ael.flex" { STORE_POS; return COLON;} YY_BREAK case 9: YY_RULE_SETUP -#line 214 "ael.flex" +#line 216 "ael.flex" { STORE_POS; return AMPER;} YY_BREAK case 10: YY_RULE_SETUP -#line 215 "ael.flex" +#line 217 "ael.flex" { STORE_POS; return BAR;} YY_BREAK case 11: YY_RULE_SETUP -#line 216 "ael.flex" +#line 218 "ael.flex" { STORE_POS; return EXTENMARK;} YY_BREAK case 12: YY_RULE_SETUP -#line 217 "ael.flex" +#line 219 "ael.flex" { STORE_POS; return AT;} YY_BREAK case 13: YY_RULE_SETUP -#line 218 "ael.flex" +#line 220 "ael.flex" {/*comment*/} YY_BREAK case 14: YY_RULE_SETUP -#line 219 "ael.flex" +#line 221 "ael.flex" { STORE_POS; return KW_CONTEXT;} YY_BREAK case 15: YY_RULE_SETUP -#line 220 "ael.flex" +#line 222 "ael.flex" { STORE_POS; return KW_ABSTRACT;} YY_BREAK case 16: YY_RULE_SETUP -#line 221 "ael.flex" +#line 223 "ael.flex" { STORE_POS; return KW_EXTEND;} YY_BREAK case 17: YY_RULE_SETUP -#line 222 "ael.flex" +#line 224 "ael.flex" { STORE_POS; return KW_MACRO;}; YY_BREAK case 18: YY_RULE_SETUP -#line 223 "ael.flex" +#line 225 "ael.flex" { STORE_POS; return KW_GLOBALS;} YY_BREAK case 19: YY_RULE_SETUP -#line 224 "ael.flex" +#line 226 "ael.flex" { STORE_POS; return KW_IGNOREPAT;} YY_BREAK case 20: YY_RULE_SETUP -#line 225 "ael.flex" +#line 227 "ael.flex" { STORE_POS; return KW_SWITCH;} YY_BREAK case 21: YY_RULE_SETUP -#line 226 "ael.flex" +#line 228 "ael.flex" { STORE_POS; return KW_IF;} YY_BREAK case 22: YY_RULE_SETUP -#line 227 "ael.flex" +#line 229 "ael.flex" { STORE_POS; return KW_IFTIME;} YY_BREAK case 23: YY_RULE_SETUP -#line 228 "ael.flex" +#line 230 "ael.flex" { STORE_POS; return KW_RANDOM;} YY_BREAK case 24: YY_RULE_SETUP -#line 229 "ael.flex" +#line 231 "ael.flex" { STORE_POS; return KW_REGEXTEN;} YY_BREAK case 25: YY_RULE_SETUP -#line 230 "ael.flex" +#line 232 "ael.flex" { STORE_POS; return KW_HINT;} YY_BREAK case 26: YY_RULE_SETUP -#line 231 "ael.flex" +#line 233 "ael.flex" { STORE_POS; return KW_ELSE;} YY_BREAK case 27: YY_RULE_SETUP -#line 232 "ael.flex" +#line 234 "ael.flex" { STORE_POS; return KW_GOTO;} YY_BREAK case 28: YY_RULE_SETUP -#line 233 "ael.flex" +#line 235 "ael.flex" { STORE_POS; return KW_JUMP;} YY_BREAK case 29: YY_RULE_SETUP -#line 234 "ael.flex" +#line 236 "ael.flex" { STORE_POS; return KW_RETURN;} YY_BREAK case 30: YY_RULE_SETUP -#line 235 "ael.flex" +#line 237 "ael.flex" { STORE_POS; return KW_BREAK;} YY_BREAK case 31: YY_RULE_SETUP -#line 236 "ael.flex" +#line 238 "ael.flex" { STORE_POS; return KW_CONTINUE;} YY_BREAK case 32: YY_RULE_SETUP -#line 237 "ael.flex" +#line 239 "ael.flex" { STORE_POS; return KW_FOR;} YY_BREAK case 33: YY_RULE_SETUP -#line 238 "ael.flex" +#line 240 "ael.flex" { STORE_POS; return KW_WHILE;} YY_BREAK case 34: YY_RULE_SETUP -#line 239 "ael.flex" +#line 241 "ael.flex" { STORE_POS; return KW_CASE;} YY_BREAK case 35: YY_RULE_SETUP -#line 240 "ael.flex" +#line 242 "ael.flex" { STORE_POS; return KW_DEFAULT;} YY_BREAK case 36: YY_RULE_SETUP -#line 241 "ael.flex" +#line 243 "ael.flex" { STORE_POS; return KW_PATTERN;} YY_BREAK case 37: YY_RULE_SETUP -#line 242 "ael.flex" +#line 244 "ael.flex" { STORE_POS; return KW_CATCH;} YY_BREAK case 38: YY_RULE_SETUP -#line 243 "ael.flex" +#line 245 "ael.flex" { STORE_POS; return KW_SWITCHES;} YY_BREAK case 39: YY_RULE_SETUP -#line 244 "ael.flex" +#line 246 "ael.flex" { STORE_POS; return KW_ESWITCHES;} YY_BREAK case 40: YY_RULE_SETUP -#line 245 "ael.flex" +#line 247 "ael.flex" { STORE_POS; return KW_INCLUDES;} YY_BREAK case 41: YY_RULE_SETUP -#line 246 "ael.flex" +#line 248 "ael.flex" { BEGIN(comment); my_col += 2; } YY_BREAK case 42: YY_RULE_SETUP -#line 248 "ael.flex" +#line 250 "ael.flex" { my_col += yyleng; } YY_BREAK case 43: /* rule 43 can match eol */ YY_RULE_SETUP -#line 249 "ael.flex" +#line 251 "ael.flex" { ++my_lineno; my_col=1;} YY_BREAK case 44: YY_RULE_SETUP -#line 250 "ael.flex" +#line 252 "ael.flex" { my_col += yyleng; } YY_BREAK case 45: /* rule 45 can match eol */ YY_RULE_SETUP -#line 251 "ael.flex" +#line 253 "ael.flex" { ++my_lineno; my_col=1;} YY_BREAK case 46: YY_RULE_SETUP -#line 252 "ael.flex" +#line 254 "ael.flex" { my_col += 2; BEGIN(INITIAL); } /* the nice thing about comments is that you know exactly what ends them */ YY_BREAK case 47: /* rule 47 can match eol */ YY_RULE_SETUP -#line 254 "ael.flex" +#line 256 "ael.flex" { my_lineno++; my_col = 1; } YY_BREAK case 48: YY_RULE_SETUP -#line 255 "ael.flex" +#line 257 "ael.flex" { my_col += yyleng; } YY_BREAK case 49: YY_RULE_SETUP -#line 256 "ael.flex" +#line 258 "ael.flex" { my_col += (yyleng*8)-(my_col%8); } YY_BREAK case 50: YY_RULE_SETUP -#line 258 "ael.flex" +#line 260 "ael.flex" { /* boy did I open a can of worms when I changed the lexical token "word". all the above keywords can be used as a beginning to a "word".- @@ -1563,17 +1564,17 @@ YY_RULE_SETUP YY_BREAK case 51: YY_RULE_SETUP -#line 283 "ael.flex" +#line 285 "ael.flex" { yymore(); /* Keep going */ } YY_BREAK case 52: YY_RULE_SETUP -#line 284 "ael.flex" +#line 286 "ael.flex" { yymore(); /* Keep Going */ } YY_BREAK case 53: YY_RULE_SETUP -#line 285 "ael.flex" +#line 287 "ael.flex" { /* the beginning of a ${} construct. prepare and pop into curlystate */ parencount2 = 0; pbcpos2 = 0; @@ -1584,7 +1585,7 @@ YY_RULE_SETUP YY_BREAK case 54: YY_RULE_SETUP -#line 292 "ael.flex" +#line 294 "ael.flex" { /* the beginning of a $[] construct. prepare and pop into brackstate */ parencount3 = 0; pbcpos3 = 0; @@ -1596,7 +1597,7 @@ YY_RULE_SETUP case 55: /* rule 55 can match eol */ YY_RULE_SETUP -#line 299 "ael.flex" +#line 301 "ael.flex" { /* a non-word constituent char, like a space, tab, curly, paren, etc */ char c = yytext[yyleng-1]; @@ -1612,7 +1613,7 @@ YY_RULE_SETUP case 56: /* rule 56 can match eol */ YY_RULE_SETUP -#line 310 "ael.flex" +#line 312 "ael.flex" { if ( pbcpop2('}') ) { /* error */ STORE_LOC; @@ -1633,7 +1634,7 @@ YY_RULE_SETUP case 57: /* rule 57 can match eol */ YY_RULE_SETUP -#line 327 "ael.flex" +#line 329 "ael.flex" { char c = yytext[yyleng-1]; if (c == '{') @@ -1645,7 +1646,7 @@ YY_RULE_SETUP case 58: /* rule 58 can match eol */ YY_RULE_SETUP -#line 335 "ael.flex" +#line 337 "ael.flex" { char c = yytext[yyleng-1]; if ( pbcpop2(c)) { /* error */ @@ -1662,7 +1663,7 @@ YY_RULE_SETUP case 59: /* rule 59 can match eol */ YY_RULE_SETUP -#line 349 "ael.flex" +#line 351 "ael.flex" { if ( pbcpop3(']') ) { /* error */ STORE_LOC; @@ -1683,7 +1684,7 @@ YY_RULE_SETUP case 60: /* rule 60 can match eol */ YY_RULE_SETUP -#line 366 "ael.flex" +#line 368 "ael.flex" { char c = yytext[yyleng-1]; if (c == '[') @@ -1695,7 +1696,7 @@ YY_RULE_SETUP case 61: /* rule 61 can match eol */ YY_RULE_SETUP -#line 374 "ael.flex" +#line 376 "ael.flex" { char c = yytext[yyleng-1]; if ( pbcpop3(c)) { /* error */ @@ -1719,7 +1720,7 @@ YY_RULE_SETUP case 62: /* rule 62 can match eol */ YY_RULE_SETUP -#line 395 "ael.flex" +#line 397 "ael.flex" { if ( pbcpop(')') ) { /* error */ STORE_LOC; @@ -1745,7 +1746,7 @@ YY_RULE_SETUP case 63: /* rule 63 can match eol */ YY_RULE_SETUP -#line 417 "ael.flex" +#line 419 "ael.flex" { char c = yytext[yyleng-1]; if (c == '(') @@ -1757,7 +1758,7 @@ YY_RULE_SETUP case 64: /* rule 64 can match eol */ YY_RULE_SETUP -#line 425 "ael.flex" +#line 427 "ael.flex" { char c = yytext[yyleng-1]; if ( pbcpop(c)) { /* error */ @@ -1782,7 +1783,7 @@ YY_RULE_SETUP case 65: /* rule 65 can match eol */ YY_RULE_SETUP -#line 447 "ael.flex" +#line 449 "ael.flex" { char c = yytext[yyleng-1]; if (c == '(') @@ -1794,7 +1795,7 @@ YY_RULE_SETUP case 66: /* rule 66 can match eol */ YY_RULE_SETUP -#line 455 "ael.flex" +#line 457 "ael.flex" { if ( pbcpop(')') ) { /* error */ STORE_LOC; @@ -1822,7 +1823,7 @@ YY_RULE_SETUP case 67: /* rule 67 can match eol */ YY_RULE_SETUP -#line 479 "ael.flex" +#line 481 "ael.flex" { if( parencount != 0) { /* printf("Folding in a comma!\n"); */ yymore(); @@ -1840,7 +1841,7 @@ YY_RULE_SETUP case 68: /* rule 68 can match eol */ YY_RULE_SETUP -#line 493 "ael.flex" +#line 495 "ael.flex" { char c = yytext[yyleng-1]; if ( pbcpop(c) ) { /* error */ @@ -1861,7 +1862,7 @@ YY_RULE_SETUP case 69: /* rule 69 can match eol */ YY_RULE_SETUP -#line 510 "ael.flex" +#line 512 "ael.flex" { char c = yytext[yyleng-1]; yymore(); @@ -1871,7 +1872,7 @@ YY_RULE_SETUP case 70: /* rule 70 can match eol */ YY_RULE_SETUP -#line 516 "ael.flex" +#line 518 "ael.flex" { char c = yytext[yyleng-1]; if ( pbcpop(c) ) { /* error */ @@ -1887,7 +1888,7 @@ YY_RULE_SETUP case 71: /* rule 71 can match eol */ YY_RULE_SETUP -#line 528 "ael.flex" +#line 530 "ael.flex" { STORE_LOC; yylval->str = strdup(yytext); @@ -1900,7 +1901,7 @@ YY_RULE_SETUP case 72: /* rule 72 can match eol */ YY_RULE_SETUP -#line 537 "ael.flex" +#line 539 "ael.flex" { char fnamebuf[1024],*p1,*p2; int glob_ret; @@ -1949,7 +1950,7 @@ case YY_STATE_EOF(comment): case YY_STATE_EOF(curlystate): case YY_STATE_EOF(wordstate): case YY_STATE_EOF(brackstate): -#line 578 "ael.flex" +#line 580 "ael.flex" { char fnamebuf[2048]; if (include_stack_index > 0 && include_stack[include_stack_index-1].globbuf_pos < include_stack[include_stack_index-1].globbuf.gl_pathc-1) { @@ -1984,10 +1985,10 @@ case YY_STATE_EOF(brackstate): YY_BREAK case 73: YY_RULE_SETUP -#line 610 "ael.flex" +#line 612 "ael.flex" ECHO; YY_BREAK -#line 1988 "ael_lex.c" +#line 1991 "ael_lex.c" case YY_END_OF_BUFFER: { @@ -2218,7 +2219,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) /* Read in more data. */ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - yyg->yy_n_chars, num_to_read ); + yyg->yy_n_chars, (size_t) num_to_read ); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; } @@ -2242,6 +2243,14 @@ static int yy_get_next_buffer (yyscan_t yyscanner) else ret_val = EOB_ACT_CONTINUE_SCAN; + if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) ael_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + } + yyg->yy_n_chars += number_to_move; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; @@ -2670,7 +2679,9 @@ static void ael_yyensure_buffer_stack (yyscan_t yyscanner) yyg->yy_buffer_stack = (struct yy_buffer_state**)ael_yyalloc (num_to_alloc * sizeof(struct yy_buffer_state*) , yyscanner); - + if ( ! yyg->yy_buffer_stack ) + YY_FATAL_ERROR( "out of dynamic memory in ael_yyensure_buffer_stack()" ); + memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*)); yyg->yy_buffer_stack_max = num_to_alloc; @@ -2688,6 +2699,8 @@ static void ael_yyensure_buffer_stack (yyscan_t yyscanner) (yyg->yy_buffer_stack, num_to_alloc * sizeof(struct yy_buffer_state*) , yyscanner); + if ( ! yyg->yy_buffer_stack ) + YY_FATAL_ERROR( "out of dynamic memory in ael_yyensure_buffer_stack()" ); /* zero only the new slots.*/ memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*)); @@ -2732,7 +2745,7 @@ YY_BUFFER_STATE ael_yy_scan_buffer (char * base, yy_size_t size , yyscan_t yys /** Setup the input buffer state to scan a string. The next call to ael_yylex() will * scan from a @e copy of @a str. - * @param str a NUL-terminated string to scan + * @param yystr a NUL-terminated string to scan * @param yyscanner The scanner object. * @return the newly allocated buffer state object. * @note If you want to scan bytes that may contain NUL values, then use @@ -3006,6 +3019,42 @@ int ael_yylex_init(yyscan_t* ptr_yy_globals) return yy_init_globals ( *ptr_yy_globals ); } +/* ael_yylex_init_extra has the same functionality as ael_yylex_init, but follows the + * convention of taking the scanner as the last argument. Note however, that + * this is a *pointer* to a scanner, as it will be allocated by this call (and + * is the reason, too, why this function also must handle its own declaration). + * The user defined value in the first argument will be available to ael_yyalloc in + * the yyextra field. + */ + +int ael_yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals ) + +{ + struct yyguts_t dummy_yyguts; + + ael_yyset_extra (yy_user_defined, &dummy_yyguts); + + if (ptr_yy_globals == NULL){ + errno = EINVAL; + return 1; + } + + *ptr_yy_globals = (yyscan_t) ael_yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); + + if (*ptr_yy_globals == NULL){ + errno = ENOMEM; + return 1; + } + + /* By setting to 0xAA, we expose bugs in + yy_init_globals. Leave at 0x00 for releases. */ + memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); + + ael_yyset_extra (yy_user_defined, *ptr_yy_globals); + + return yy_init_globals ( *ptr_yy_globals ); +} + static int yy_init_globals (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; @@ -3112,7 +3161,7 @@ void *ael_yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner) #define YYTABLES_NAME "yytables" -#line 610 "ael.flex" +#line 612 "ael.flex" @@ -3268,7 +3317,9 @@ struct pval *ael2_parse(char *filename, int *errors) my_file = strdup(filename); stat(filename, &stats); buffer = (char*)malloc(stats.st_size+2); - fread(buffer, 1, stats.st_size, fin); + if (fread(buffer, 1, stats.st_size, fin) != stats.st_size) { + ast_log(LOG_ERROR, "fread() failed: %s\n", strerror(errno)); + } buffer[stats.st_size]=0; fclose(fin); @@ -3336,7 +3387,9 @@ static void setup_filestack(char *fnamebuf2, int fnamebuf_siz, glob_t *globbuf, struct stat stats; stat(fnamebuf2, &stats); buffer = (char*)malloc(stats.st_size+1); - fread(buffer, 1, stats.st_size, in1); + if (fread(buffer, 1, stats.st_size, in1) != stats.st_size) { + ast_log(LOG_ERROR, "fread() failed: %s\n", strerror(errno)); + } buffer[stats.st_size] = 0; ast_log(LOG_NOTICE," --Read in included file %s, %d chars\n",fnamebuf2, (int)stats.st_size); fclose(in1); diff --git a/pbx/pbx_dundi.c b/pbx/pbx_dundi.c index 94b6e702d..3b009e84f 100644 --- a/pbx/pbx_dundi.c +++ b/pbx/pbx_dundi.c @@ -2948,7 +2948,9 @@ static void destroy_trans(struct dundi_transaction *trans, int fromtimeout) if (AST_LIST_EMPTY(&trans->parent->trans)) { /* Wake up sleeper */ if (trans->parent->pfds[1] > -1) { - write(trans->parent->pfds[1], "killa!", 6); + if (write(trans->parent->pfds[1], "killa!", 6) < 0) { + ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno)); + } } } } @@ -3716,7 +3718,10 @@ static int dundi_precache_internal(const char *context, const char *number, int dr.expiration = dundi_cache_time; dr.hmd = &hmd; dr.pfds[0] = dr.pfds[1] = -1; - pipe(dr.pfds); + if (pipe(dr.pfds) < 0) { + ast_log(LOG_WARNING, "pipe() failed: %s\n", strerror(errno)); + return -1; + } build_transactions(&dr, ttl, 0, &foundcache, &skipped, 0, 1, 1, NULL, avoids, NULL); optimize_transactions(&dr, 0); foundanswers = 0; diff --git a/res/res_agi.c b/res/res_agi.c index a60155087..a2ff4ef3e 100644 --- a/res/res_agi.c +++ b/res/res_agi.c @@ -1870,7 +1870,8 @@ static enum agi_result run_agi(struct ast_channel *chan, char *request, AGI *agi /* If it's voice, write it to the audio pipe */ if ((agi->audio > -1) && (f->frametype == AST_FRAME_VOICE)) { /* Write, ignoring errors */ - write(agi->audio, f->data, f->datalen); + if (write(agi->audio, f->data, f->datalen) < 0) { + } } ast_frfree(f); } @@ -1959,7 +1960,7 @@ static int handle_showagi(int fd, int argc, char *argv[]) if (argc > 2) { e = find_command(argv + 2, 1); if (e) - ast_cli(fd, e->usage); + ast_cli(fd, "%s", e->usage); else { if (find_command(argv + 2, -1)) { return help_workhorse(fd, argv + 1); diff --git a/res/res_crypto.c b/res/res_crypto.c index eea8356af..c2c33d015 100644 --- a/res/res_crypto.c +++ b/res/res_crypto.c @@ -118,7 +118,11 @@ static int pw_cb(char *buf, int size, int rwflag, void *userdata) if (key->infd > -1) { snprintf(prompt, sizeof(prompt), ">>>> passcode for %s key '%s': ", key->ktype == AST_KEY_PRIVATE ? "PRIVATE" : "PUBLIC", key->name); - write(key->outfd, prompt, strlen(prompt)); + if (write(key->outfd, prompt, strlen(prompt)) < 0) { + /* Note that we were at least called */ + key->infd = -2; + return -1; + } memset(buf, 0, sizeof(buf)); tmp = ast_hide_password(key->infd); memset(buf, 0, size); @@ -194,8 +198,7 @@ static struct ast_key *try_load_key (char *dir, char *fname, int ifd, int ofd, i /* Calculate a "whatever" quality md5sum of the key */ char buf[256]; memset(buf, 0, 256); - fgets(buf, sizeof(buf), f); - if (!feof(f)) { + if (fgets(buf, sizeof(buf), f)) { MD5Update(&md5, (unsigned char *) buf, strlen(buf)); } } diff --git a/res/res_indications.c b/res/res_indications.c index 2147546af..05382a0cb 100644 --- a/res/res_indications.c +++ b/res/res_indications.c @@ -179,7 +179,7 @@ static int handle_show_indications(int fd, int argc, char *argv[]) if (tz->nrringcadence) j--; ast_copy_string(buf+j,"\n",sizeof(buf)-j); - ast_cli(fd,buf); + ast_cli(fd, "%s", buf); for (ts=tz->tones; ts; ts=ts->next) ast_cli(fd,"%-7.7s %-15.15s %s\n",tz->country,ts->name,ts->data); break; diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c index ed2b55f0e..255f8d5d9 100644 --- a/res/res_musiconhold.c +++ b/res/res_musiconhold.c @@ -482,7 +482,10 @@ static int spawn_mp3(struct mohclass *class) } } /* Child */ - chdir(class->dir); + if (chdir(class->dir) < 0) { + ast_log(LOG_WARNING, "chdir() failed: %s\n", strerror(errno)); + _exit(1); + } if (ast_test_flag(class, MOH_CUSTOM)) { execv(argv[0], argv); } else { @@ -817,8 +820,14 @@ static int moh_scan_files(struct mohclass *class) { class->total_files = 0; dirnamelen = strlen(class->dir) + 2; - getcwd(path, sizeof(path)); - chdir(class->dir); + if (!getcwd(path, sizeof(path))) { + ast_log(LOG_WARNING, "getcwd() failed: %s\n", strerror(errno)); + return -1; + } + if (chdir(class->dir) < 0) { + ast_log(LOG_WARNING, "chdir() failed: %s\n", strerror(errno)); + return -1; + } while ((files_dirent = readdir(files_DIR))) { /* The file name must be at least long enough to have the file type extension */ if ((strlen(files_dirent->d_name) < 4)) @@ -857,7 +866,10 @@ static int moh_scan_files(struct mohclass *class) { } closedir(files_DIR); - chdir(path); + if (chdir(path) < 0) { + ast_log(LOG_WARNING, "chdir() failed: %s\n", strerror(errno)); + return -1; + } return class->total_files; } diff --git a/utils/astman.c b/utils/astman.c index f259f6884..757421725 100644 --- a/utils/astman.c +++ b/utils/astman.c @@ -144,10 +144,14 @@ static void fdprintf(int fd, char *fmt, ...) { char stuff[4096]; va_list ap; + int res; + va_start(ap, fmt); vsnprintf(stuff, sizeof(stuff), fmt, ap); va_end(ap); - write(fd, stuff, strlen(stuff)); + if ((res = write(fd, stuff, strlen(stuff))) < 0) { + fprintf(stderr, "write() failed: %s\n", strerror(errno)); + } } static char *get_header(struct message *m, char *var) @@ -398,13 +402,16 @@ static int manager_action(char *action, char *fmt, ...) struct ast_mansession *s; char tmp[4096]; va_list ap; + int res; s = &session; fdprintf(s->fd, "Action: %s\r\n", action); va_start(ap, fmt); vsnprintf(tmp, sizeof(tmp), fmt, ap); va_end(ap); - write(s->fd, tmp, strlen(tmp)); + if ((res = write(s->fd, tmp, strlen(tmp))) < 0) { + fprintf(stderr, "write() failed: %s\n", strerror(errno)); + } fdprintf(s->fd, "\r\n"); return 0; } diff --git a/utils/frame.c b/utils/frame.c index 7fdb1637d..52f2d498e 100644 --- a/utils/frame.c +++ b/utils/frame.c @@ -59,14 +59,14 @@ int getremainingfilelength( FILE *anyin, long *result) { long i; - i = ftell (anyin); + i = ftell(anyin); if (i == -1) return FALSE; - if (fseek (anyin, 0, SEEK_END) == -1) return FALSE; - *result = ftell (anyin); + if (fseek(anyin, 0, SEEK_END) == -1) return FALSE; + *result = ftell(anyin); if (*result == -1) return FALSE; (*result) -= i; (*result) /= samplewidth; - if (fseek (anyin, i, SEEK_SET) == -1) return FALSE; + if (fseek(anyin, i, SEEK_SET) == -1) return FALSE; return TRUE; } @@ -81,31 +81,39 @@ void readpkheader( FILE *anyin) for (i = 0; i < 11; i++) { - fread( &tempint, 4, 1, anyin); - printf( "%d: %d, ", i, tempint); + if (!fread( &tempint, 4, 1, anyin)) { + return; + } + printf( "%d: %d, ", i, tempint); } printf( "\n"); - fread( blood, 1, 8, anyin); + if (!fread( blood, 1, 8, anyin)) { + return; + } for (i = 0; i < 8; i++) - printf( "%d ", blood[i]); + printf( "%d ", blood[i]); printf( "\n"); for (i = 0; i < 8; i++) - { - for (x = 128; x > 0; x /= 2) - printf((blood[i] & x) == 0? "0 ":"1 "); - printf(i%4==3? "\n":"| "); - } + { + for (x = 128; x > 0; x /= 2) + printf((blood[i] & x) == 0? "0 ":"1 "); + printf(i%4==3? "\n":"| "); + } printf( "\n"); for (i = 0; i < 2; i++) { - fread( &tempint, 4, 1, anyin); - printf( "%d: %d, ", i, tempint); + if (!fread( &tempint, 4, 1, anyin)) { + return; + } + printf( "%d: %d, ", i, tempint); } printf( "\n"); for (i = 0; i < 2; i++) { - fread( &tempushort, 2, 1, anyin); - printf( "%d: %d, ", i, tempushort); + if (!fread( &tempushort, 2, 1, anyin)) { + return; + } + printf( "%d: %d, ", i, tempushort); } printf( "\n"); } @@ -125,59 +133,81 @@ void readwavheader( FILE *anyin) iswav = FALSE; if (ftell(anyin) == -1) /* If we cannot seek this file */ - { - nowav = TRUE; /* -> Pretend this is no wav-file */ - chat("File not seekable: not checking for WAV-header.\n"); - } + { + nowav = TRUE; /* -> Pretend this is no wav-file */ + chat("File not seekable: not checking for WAV-header.\n"); + } else - { - /* Expect four bytes "RIFF" and four bytes filelength */ - fread (str, 1, 8, anyin); /* 0 */ - str[4] = '\0'; - if (strcmp(str, "RIFF") != 0) nowav = TRUE; - /* Expect eight bytes "WAVEfmt " */ - fread (str, 1, 8, anyin); /* 8 */ - str[8] = '\0'; - if (strcmp(str, "WAVEfmt ") != 0) nowav = TRUE; - /* Expect length of fmt data, which should be 16 */ - fread (&tempuint, 4, 1, anyin); /* 16 */ - if (tempuint != 16) nowav = TRUE; - /* Expect format tag, which should be 1 for pcm */ - fread (&tempushort, 2, 1, anyin); /* 20 */ - if (tempushort != 1) - nowav = TRUE; - /* Expect number of channels */ - fread (&cn, 2, 1, anyin); /* 20 */ - if (cn != 1 && cn != 2) nowav = TRUE; - /* Read samplefrequency */ - fread (&sf, 4, 1, anyin); /* 24 */ - /* Read bytes per second: Should be samplefreq * channels * 2 */ - fread (&tempuint, 4, 1, anyin); /* 28 */ - if (tempuint != sf * cn * 2) nowav = TRUE; - /* read bytes per frame: Should be channels * 2 */ - fread (&tempushort, 2, 1, anyin); /* 32 */ - if (tempushort != cn * 2) nowav = TRUE; - /* Read bits per sample: Should be 16 */ - fread (&tempushort, 2, 1, anyin); /* 34 */ - if (tempushort != 16) nowav = TRUE; - fread (str, 4, 1, anyin); /* 36 */ - str[4] = '\0'; - if (strcmp(str, "data") != 0) nowav = TRUE; - fread (&tempuint, 4, 1, anyin); /* 40 */ - if (nowav) - { - fseek (anyin, 0, SEEK_SET); /* Back to beginning of file */ - chat("File has no WAV header.\n"); - } - else - { - samplefrequency = sf; - channels = cn; - chat ("Read WAV header: %d channels, samplefrequency %d.\n", - channels, samplefrequency); - iswav = TRUE; - } - } + { + /* Expect four bytes "RIFF" and four bytes filelength */ + if (!fread(str, 1, 8, anyin)) { /* 0 */ + return; + } + str[4] = '\0'; + if (strcmp(str, "RIFF") != 0) nowav = TRUE; + /* Expect eight bytes "WAVEfmt " */ + if (!fread(str, 1, 8, anyin)) { /* 8 */ + return; + } + str[8] = '\0'; + if (strcmp(str, "WAVEfmt ") != 0) nowav = TRUE; + /* Expect length of fmt data, which should be 16 */ + if (!fread(&tempuint, 4, 1, anyin)) { /* 16 */ + return; + } + if (tempuint != 16) nowav = TRUE; + /* Expect format tag, which should be 1 for pcm */ + if (!fread(&tempushort, 2, 1, anyin)) { /* 20 */ + return; + } + if (tempushort != 1) + nowav = TRUE; + /* Expect number of channels */ + if (!fread(&cn, 2, 1, anyin)) { /* 20 */ + return; + } + if (cn != 1 && cn != 2) nowav = TRUE; + /* Read samplefrequency */ + if (!fread(&sf, 4, 1, anyin)) { /* 24 */ + return; + } + /* Read bytes per second: Should be samplefreq * channels * 2 */ + if (!fread(&tempuint, 4, 1, anyin)) { /* 28 */ + return; + } + if (tempuint != sf * cn * 2) nowav = TRUE; + /* read bytes per frame: Should be channels * 2 */ + if (!fread(&tempushort, 2, 1, anyin)) { /* 32 */ + return; + } + if (tempushort != cn * 2) nowav = TRUE; + /* Read bits per sample: Should be 16 */ + if (!fread(&tempushort, 2, 1, anyin)) { /* 34 */ + return; + } + if (tempushort != 16) nowav = TRUE; + if (!fread(str, 4, 1, anyin)) { /* 36 */ + return; + } + str[4] = '\0'; + if (strcmp(str, "data") != 0) nowav = TRUE; + if (!fread(&tempuint, 4, 1, anyin)) { /* 40 */ + return; + } + if (nowav) + { + fseek(anyin, 0, SEEK_SET); /* Back to beginning of file */ + chat("File has no WAV header.\n"); + } + else + { + samplefrequency = sf; + channels = cn; + chat("Read WAV header: %d channels, samplefrequency %d.\n", + channels, samplefrequency); + iswav = TRUE; + } + } return; } @@ -192,36 +222,62 @@ void makewavheader( void) unsigned short tempushort; /* If fseek fails, don't create the header. */ - if (fseek (out, 0, SEEK_END) != -1) - { - filelength = ftell (out); - chat ("filelength %d, ", filelength); - fseek (out, 0, SEEK_SET); - fwrite ("RIFF", 1, 4, out); /* 0 */ - tempuint = filelength - 8; fwrite (&tempuint, 4, 1, out); /* 4 */ - fwrite ("WAVEfmt ", 1, 8, out); /* 8 */ - /* length of fmt data 16 bytes */ - tempuint = 16; - fwrite (&tempuint, 4, 1, out); /* 16 */ - /* Format tag: 1 for pcm */ - tempushort = 1; - fwrite (&tempushort, 2, 1, out); /* 20 */ - chat ("%d channels\n", channels); - fwrite (&channels, 2, 1, out); - chat ("samplefrequency %d\n", samplefrequency); - fwrite (&samplefrequency, 4, 1, out); /* 24 */ - /* Bytes per second */ - tempuint = channels * samplefrequency * 2; - fwrite (&tempuint, 4, 1, out); /* 28 */ - /* Block align */ - tempushort = 2 * channels; - fwrite (&tempushort, 2, 1, out); /* 32 */ - /* Bits per sample */ - tempushort = 16; - fwrite (&tempushort, 2, 1, out); /* 34 */ - fwrite ("data", 4, 1, out); /* 36 */ - tempuint = filelength - 44; fwrite (&tempuint, 4, 1, out); /* 40 */ - } + if (fseek(out, 0, SEEK_END) != -1) + { + filelength = ftell(out); + chat("filelength %d, ", filelength); + fseek(out, 0, SEEK_SET); + if (!fwrite("RIFF", 1, 4, out)) { /* 0 */ + return; + } + tempuint = filelength - 8; + if (!fwrite(&tempuint, 4, 1, out)) { /* 4 */ + return; + } + if (!fwrite("WAVEfmt ", 1, 8, out)) { /* 8 */ + return; + } + /* length of fmt data 16 bytes */ + tempuint = 16; + if (!fwrite(&tempuint, 4, 1, out)) { /* 16 */ + return; + } + /* Format tag: 1 for pcm */ + tempushort = 1; + if (!fwrite(&tempushort, 2, 1, out)) { /* 20 */ + return; + } + chat("%d channels\n", channels); + if (!fwrite(&channels, 2, 1, out)) { + return; + } + chat("samplefrequency %d\n", samplefrequency); + if (!fwrite(&samplefrequency, 4, 1, out)) { /* 24 */ + return; + } + /* Bytes per second */ + tempuint = channels * samplefrequency * 2; + if (!fwrite(&tempuint, 4, 1, out)) { /* 28 */ + return; + } + /* Block align */ + tempushort = 2 * channels; + if (!fwrite(&tempushort, 2, 1, out)) { /* 32 */ + return; + } + /* Bits per sample */ + tempushort = 16; + if (!fwrite(&tempushort, 2, 1, out)) { /* 34 */ + return; + } + if (!fwrite("data", 4, 1, out)) { /* 36 */ + return; + } + tempuint = filelength - 44; + if (!fwrite(&tempuint, 4, 1, out)) { /* 40 */ + return; + } + } return; } @@ -870,10 +926,10 @@ int myexit (int value) case 0: if (wavout) makewavheader(); /* Writes a fully informed .WAV header */ - chat ("Success!\n"); + chat("Success!\n"); break; default: - chat ("Failure.\n"); + chat("Failure.\n"); break; } exit (value); @@ -903,7 +959,9 @@ int workloop( FILE *theinfile, FILE *theoutfile, /* Call the routine that does the work */ if (!work (buffer, nowlength)) /* On error, stop. */ return FALSE; - fwrite(buffer, sizeof(short), nowlength, theoutfile); + if (!fwrite(buffer, sizeof(short), nowlength, theoutfile)) { + return FALSE; + } if (ferror( theoutfile) != 0) fatalperror("Error writing to output file"); } diff --git a/utils/muted.c b/utils/muted.c index c406258e1..179d596a6 100644 --- a/utils/muted.c +++ b/utils/muted.c @@ -114,7 +114,9 @@ static int load_config(void) return -1; } while(!feof(f)) { - fgets(buf, sizeof(buf), f); + if (!fgets(buf, sizeof(buf), f)) { + continue; + } if (!feof(f)) { lineno++; val = strchr(buf, '#'); @@ -682,7 +684,10 @@ int main(int argc, char *argv[]) } if (needfork) { #ifndef HAVE_SBIN_LAUNCHD - daemon(0,0); + if (daemon(0,0) < 0) { + fprintf(stderr, "daemon() failed: %s\n", strerror(errno)); + exit(1); + } #else fprintf(stderr, "Mac OS X detected. Use 'launchd -d muted -f' to launch.\n"); exit(1); diff --git a/utils/stereorize.c b/utils/stereorize.c index 7d72cbdbf..c8428320d 100644 --- a/utils/stereorize.c +++ b/utils/stereorize.c @@ -150,10 +150,10 @@ int main( int argcount, char *args[]) for (; i < maxk; i++) stereosample[2 * i + 1] = 0; - fwrite(stereosample, sizeof(*leftsample), 2 * maxk, out); - if (ferror( out) != 0) - fatalerror("Error writing to file '%s': %s\n", - outfilename, strerror(errno)); + if (!fwrite(stereosample, sizeof(*leftsample), 2 * maxk, out)) { + fatalerror("Error writing to file '%s': %s\n", + outfilename, strerror(errno)); + } } /* That was an endless loop. This point is never reached. */ } diff --git a/utils/streamplayer.c b/utils/streamplayer.c index fb0d055a2..ebb12e54b 100644 --- a/utils/streamplayer.c +++ b/utils/streamplayer.c @@ -112,8 +112,11 @@ int main(int argc, char *argv[]) select(2, NULL, &wfds, NULL, &tv); - if (FD_ISSET(1, &wfds)) - write(1, buf, res); + if (FD_ISSET(1, &wfds)) { + if (write(1, buf, res) < 1) { + break; + } + } } close(s); |