From a39d8226556ce121b01099c063fd1c1af613c33d Mon Sep 17 00:00:00 2001 From: Sergey Dorofeev Date: Sun, 25 Mar 2012 14:57:25 +0400 Subject: [PATCH 01/11] Just a little mistake :) --- source/bforce/prot_binkp.c | 4 ++++ source/bforce/prot_common.c | 4 ++-- source/openwrt-conf | 3 +-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/source/bforce/prot_binkp.c b/source/bforce/prot_binkp.c index 992446b..a75adb8 100644 --- a/source/bforce/prot_binkp.c +++ b/source/bforce/prot_binkp.c @@ -534,6 +534,7 @@ case 4: buf[0] = BPMSG_FILE; *block_length = 1+sprintf(buf+1, "%s %ld %ld -1", bstate->pi->send->net_name, (long)bstate->pi->send->bytes_total, (long)bstate->pi->send->mod_time); + DEB((D_24554, "M_FILE: %s", buf+1)); *block_type = BINKP_BLK_CMD; return 3; // no state change. phase would be changed to 1 by recv when M_GET is received } @@ -544,6 +545,7 @@ case 4: buf[0] = BPMSG_FILE; *block_length = 1+sprintf(buf+1, "%s %ld %ld 0", bstate->pi->send->net_name, bstate->pi->send->bytes_total, bstate->pi->send->mod_time); + DEB((D_24554, "M_FILE: %s", buf+1)); *block_type = BINKP_BLK_CMD; bstate->phase += 1; return 1; @@ -853,6 +855,8 @@ got_skip: PROTO_ERROR("error parsing M_GOT/M_SKIP"); } + DEB((D_24554, "params: fn=%s sz=%d tm=%d", fi.fn, fi.sz, fi.tm)); + if (strcmp (bstate->pi->send->net_name, fi.fn) == 0 && bstate->pi->send->status != FSTAT_WAITACK) { DEB((D_24554, "aborting current file")); if (bstate->pi->send->netspool) { diff --git a/source/bforce/prot_common.c b/source/bforce/prot_common.c index fe5af1a..6a1969f 100644 --- a/source/bforce/prot_common.c +++ b/source/bforce/prot_common.c @@ -254,9 +254,9 @@ int p_tx_fopen(s_protinfo *pi, s_filehint *hint) return 1; if (hint) { - DEB((D_OUTBOUND, "trying to reopen file %s size %d time %d", hint->fn, hint->sz, hint->tm)); + DEB((D_OUTBOUND, "trying to reopen file %s size %d time %d (nsent=%d)", hint->fn, hint->sz, hint->tm, pi->n_sentfiles)); int i; - for (i=0; i++; in_sentfiles) { + for (i=0; in_sentfiles; i++) { DEB((D_OUTBOUND, "check %s %d %d", pi->sentfiles[i].net_name, pi->sentfiles[i].bytes_total, pi->sentfiles[i].mod_time)); if (strcmp(pi->sentfiles[i].net_name, hint->fn)==0) { DEB((D_OUTBOUND, "name match")); diff --git a/source/openwrt-conf b/source/openwrt-conf index 4558c1b..0b64565 100755 --- a/source/openwrt-conf +++ b/source/openwrt-conf @@ -12,7 +12,6 @@ CC=$PREFIX-gcc export PATH CC CPP #make clean -#./configure --prefix=/opt/bforce --host=mips-openwrt-linux --disable-syslog --enable-netspool -#--with-logdir=/home/fido/log --with-spooldir=/home/fido/bforce +#./configure --prefix=/opt/bforce --host=mips-openwrt-linux --disable-syslog --enable-netspool --with-logdir=/home/fido/log --with-spooldir=/home/fido/bforce #make && scp bin/bforce root@gw-home:/opt/bforce/bin/bforce-new make && scp bin/bforce root@gw-home:/opt/bforce/bin/bforce \ No newline at end of file From cd74def9c61b7786c78727f265e7f26850a07744 Mon Sep 17 00:00:00 2001 From: Sergey Dorofeev Date: Tue, 4 Jun 2013 20:31:26 +0400 Subject: [PATCH 02/11] flush --- source/Makefile | 202 ++++++++ source/bforce/expression.c | 976 +++++++++++++++++++++++++++++++++++++ source/include/config.h | 154 ++++++ 3 files changed, 1332 insertions(+) create mode 100644 source/Makefile create mode 100644 source/bforce/expression.c create mode 100644 source/include/config.h diff --git a/source/Makefile b/source/Makefile new file mode 100644 index 0000000..c804bb5 --- /dev/null +++ b/source/Makefile @@ -0,0 +1,202 @@ +# +# Copyright (c) 1999-2000, Alexander Belkin +# +# Copyright (c) 2004, Evgeniy Kozhuhovskiy +# +# $Id$ +# + +prefix=/home/sergey/bforce +exec_prefix=${prefix} + +CC = gcc +INCLUDES = -I./include +CFLAGS = -g -O2 -fno-builtin +LIBS = -lrt +YACC = byacc +INSTALL = /usr/bin/install -c +INSTALL_PROGRAM = ${INSTALL} +INSTALL_DATA = ${INSTALL} -m 644 +SRCDIR = . +SRCDIRCONF = $(SRCDIR)/../examples +CONTRIBDIR = $(SRCDIR)/../contrib + +OWNER = sergey +GROUP = sergey +CONFDIR = ${prefix}/etc +BINDIR = ${exec_prefix}/bin +LOGDIR = /var/log/bforce +SPOOLDIR = /var/spool/bforce + +DAEMON_LOGFILE = $(LOGDIR)/bf-daemon +BFORCE_LOGFILE = $(LOGDIR)/bf-log +BFORCE_DEBFILE = $(LOGDIR)/bf-debug +BFORCE_DEBLEVEL = 0L +BFORCE_CFGFILE = $(CONFDIR)/bforce.conf + +DEFINES = -DDAEMON_LOGFILE=\"$(DAEMON_LOGFILE)\" \ + -DBFORCE_LOGFILE=\"$(BFORCE_LOGFILE)\" \ + -DBFORCE_DEBFILE=\"$(BFORCE_DEBFILE)\" \ + -DBFORCE_DEBLEVEL=$(BFORCE_DEBLEVEL) \ + -DBFORCE_CFGFILE=\"$(BFORCE_CFGFILE)\" \ + -DBF_OS=\"linux-gnu\" -DHAVE_CONFIG_H + +SUBDIRS = bforce bfutil + +BFINDEX_OBJS = bfutil/bfindex.o \ + bforce/conf_deinit.o bforce/conf_proc.o \ + bforce/conf_read.o bforce/conf_get.o \ + bforce/logger.o bforce/nodelist.o \ + bforce/u_file.o bforce/u_ftn.o \ + bforce/u_misc.o bforce/u_string.o \ + bforce/u_time.o + +NLOOKUP_OBJS = bfutil/nlookup.o \ + bforce/conf_deinit.o bforce/conf_proc.o \ + bforce/conf_read.o bforce/conf_get.o \ + bforce/logger.o bforce/nodelist.o \ + bforce/u_file.o bforce/u_ftn.o \ + bforce/u_misc.o bforce/u_string.o \ + bforce/u_time.o + +BFSTAT_OBJS = bfutil/bfstat.o \ + bforce/conf_deinit.o bforce/conf_proc.o \ + bforce/conf_read.o bforce/conf_get.o \ + bforce/outb_flo.o bforce/outb_fsqueue.o \ + bforce/sess_stat.o \ + bforce/outb_getname.o bforce/outb_sysqueue.o \ + bforce/outb_scan.o bforce/logger.o \ + bforce/u_file.o \ + bforce/u_ftn.o bforce/u_misc.o \ + bforce/u_string.o bforce/u_time.o \ + bforce/u_plock.o + +BFORCE_OBJS = bforce/bforce.o \ + bforce/daemon.o bforce/daemon_branch.o \ + bforce/daemon_call.o bforce/daemon_lines.o \ + bforce/conf_deinit.o \ + bforce/conf_proc.o bforce/conf_read.o \ + bforce/conf_get.o bforce/expression.o \ + bforce/freq_bark.o bforce/freq_proc.o \ + bforce/freq_srif.o bforce/freq_wazoo.o \ + bforce/io_modem.o bforce/io_tcpip.o \ + bforce/io_unix_lock.o bforce/io_unix_modem.o \ + bforce/io_unix_tio.o bforce/io_unix_tty.o \ + bforce/logger.o bforce/nodelist.o \ + bforce/os_unix.o bforce/outb_bsy.o \ + bforce/outb_flo.o bforce/outb_fsqueue.o \ + bforce/outb_getname.o bforce/outb_sysqueue.o \ + bforce/outb_scan.o bforce/prot_common.o \ + bforce/prot_binkp.o bforce/prot_binkp_api.o \ + bforce/prot_binkp_misc.o bforce/prot_hydra.o \ + bforce/prot_xmrecv.o bforce/prot_xmsend.o \ + bforce/prot_zmmisc.o bforce/prot_zmrecv.o \ + bforce/prot_zmsend.o \ + bforce/prot_yoohoo.o bforce/prot_yoohoo_api.o \ + bforce/prot_emsi.o bforce/prot_emsi_misc.o \ + bforce/prot_emsi_api.o \ + bforce/sess_common.o bforce/sess_stat.o \ + bforce/sess_call.o bforce/sess_answ.o \ + bforce/sess_init.o bforce/sess_main.o \ + bforce/u_crc.o bforce/u_ftn.o \ + bforce/u_md5.o \ + bforce/u_misc.o bforce/u_string.o \ + bforce/u_time.o bforce/u_file.o \ + bforce/u_pkt.o bforce/u_recode.o \ + bforce/u_plock.o bforce/netspool.o + +.c.o: + @echo Compiling $*.c + @$(CC) $(CFLAGS) $(INCLUDES) $(DEFINES) -c $< -o $@ + +all: bin bin/bforce bin/bfindex bin/bfstat bin/nlookup + +bin: + test -d bin || mkdir bin + +bforce/expression.c: bforce/expression.y + $(YACC) bforce/expression.y + mv y.tab.c bforce/expression.c + +bin/bforce: $(BFLIB_OBJS) $(BFORCE_OBJS) + @echo "Linking $@" + @$(CC) $(BFLIB_OBJS) $(BFORCE_OBJS) $(LIBS) -o $@ + +bin/bfindex: $(BFLIB_OBJS) $(BFINDEX_OBJS) + @echo "Linking $@" + @$(CC) $(BFLIB_OBJS) $(BFINDEX_OBJS) $(LIBS) -o $@ + +bin/nlookup: $(BFLIB_OBJS) $(NLOOKUP_OBJS) + @echo "Linking $@" + @$(CC) $(BFLIB_OBJS) $(NLOOKUP_OBJS) $(LIBS) -o $@ + +bin/bfstat: $(BFLIB_OBJS) $(BFSTAT_OBJS) + @echo "Linking $@" + @$(CC) $(BFLIB_OBJS) $(BFSTAT_OBJS) $(LIBS) -o $@ + + +clean: + @for i in $(SUBDIRS); do (rm -f $$i/*.o || exit 1); done + rm -f ./bforce/expression.c + rm -f ./bin/bforce + rm -f ./bin/bfindex + rm -f ./bin/bfstat + rm -f ./bin/nlookup + rm -f ./bin/core +clean-am: + rm -f ./Makefile + rm -f ./include/config.h + rm -f ./config.log + rm -f ./config.status +clean-ac: + rm -f ./configure + +distclean: clean clean-am + +distclean-m: distclean clean-ac + + +ifnames: + @for i in $(SUBDIRS); do (ifnames $$i/*.c || exit 1); done + +bforce/expression.y.o: bforce/expression.y.c bforce/expression.l.c + +bforce/expression.l.o: bforce/expression.y.c bforce/expression.l.c + +installdirs: + if [ ! -d $(CONFDIR) ]; then mkdir -p $(CONFDIR); fi + if [ ! -d $(BINDIR) ]; then mkdir -p $(BINDIR); fi + if [ ! -d $(LOGDIR) ]; then mkdir -p $(LOGDIR); fi + if [ ! -d $(SPOOLDIR) ]; then mkdir -p $(SPOOLDIR); fi + if [ ! -d $(SPOOLDIR)/bt/in ]; then mkdir -p $(SPOOLDIR)/bt/in; fi + if [ ! -d $(SPOOLDIR)/bt/pin ]; then mkdir -p $(SPOOLDIR)/bt/pin; fi + if [ ! -d $(SPOOLDIR)/bt/out ]; then mkdir -p $(SPOOLDIR)/bt/out; fi + if [ ! -d $(SPOOLDIR)/ndl ]; then mkdir -p $(SPOOLDIR)/ndl; fi + if [ ! -d $(SPOOLDIR)/bforce ]; then mkdir -p $(SPOOLDIR); fi + chown $(OWNER):$(GROUP) $(CONFDIR) + chown $(OWNER):$(GROUP) $(LOGDIR) + chown $(OWNER):$(GROUP) $(SPOOLDIR)/bt/in + chown $(OWNER):$(GROUP) $(SPOOLDIR)/bt/pin + chown $(OWNER):$(GROUP) $(SPOOLDIR)/bt/out + chown $(OWNER):$(GROUP) $(SPOOLDIR)/ndl + chown $(OWNER):$(GROUP) $(SPOOLDIR) + +install-bin: + $(INSTALL_PROGRAM) -o $(OWNER) -g $(GROUP) $(SRCDIR)/bin/bforce $(BINDIR)/bforce + $(INSTALL_PROGRAM) -o $(OWNER) -g $(GROUP) $(SRCDIR)/bin/bfindex $(BINDIR)/bfindex + $(INSTALL_PROGRAM) -o $(OWNER) -g $(GROUP) $(SRCDIR)/bin/bfstat $(BINDIR)/bfstat + $(INSTALL_PROGRAM) -o $(OWNER) -g $(GROUP) $(SRCDIR)/bin/nlookup $(BINDIR)/nlookup + +install-config: + $(INSTALL_DATA) -o $(OWNER) -g $(GROUP) $(SRCDIRCONF)/bforce.conf $(CONFDIR)/bforce.conf.sample + $(INSTALL_DATA) -o $(OWNER) -g $(GROUP) $(SRCDIRCONF)/bforce.subst $(CONFDIR)/bforce.subst.sample + $(INSTALL_DATA) -o $(OWNER) -g $(GROUP) $(SRCDIRCONF)/bforce.passwd $(CONFDIR)/bforce.passwd.sample + $(INSTALL_DATA) -o $(OWNER) -g $(GROUP) $(SRCDIRCONF)/freq.aliases $(CONFDIR)/freq.aliases.sample + $(INSTALL_DATA) -o $(OWNER) -g $(GROUP) $(SRCDIRCONF)/freq.dirs $(CONFDIR)/freq.dirs.sample + +install-contrib: + $(INSTALL_PROGRAM) -o $(OWNER) -g $(GROUP) $(CONTRIBDIR)/outman $(BINDIR)/outman + @echo "Please, edit $(BINDIR)/outman" + +install: install-bin install-config + diff --git a/source/bforce/expression.c b/source/bforce/expression.c new file mode 100644 index 0000000..9bcc369 --- /dev/null +++ b/source/bforce/expression.c @@ -0,0 +1,976 @@ +#ifndef lint +static const char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93"; +#endif + +#define YYBYACC 1 +#define YYMAJOR 1 +#define YYMINOR 9 +#define YYPATCH 20120115 + +#define YYEMPTY (-1) +#define yyclearin (yychar = YYEMPTY) +#define yyerrok (yyerrflag = 0) +#define YYRECOVERING() (yyerrflag != 0) + +#define YYPREFIX "yy" + +#define YYPURE 0 + +#line 49 "bforce/expression.y" +#include "includes.h" +#include "confread.h" +#include "util.h" +#include "logger.h" +#include "session.h" +#include "nodelist.h" +#include "io.h" + +static struct tm *now = NULL; +static int expr_result = 0; +static char *expr_p_pos = NULL; +static char *expr_p_text = NULL; + +/* + * These are expression element checkers (not only) + * Return values: + * 0 - FALSE + * 1 - TRUE + * -1 - cannot check, because some data is not available yet + * -2 - invalid element (we should not check this expression more) + */ +static int expr_check_incoming(void); +static int expr_check_outgoing(void); +static int expr_check_protected(void); +static int expr_check_listed(void); +static int expr_check_logic(int e1, int op, int e2); +static int expr_check_phone(const char *phone); +static int expr_check_arop(int num1, int op, int num2); +static int expr_check_flag(const char *str); +static int expr_check_exec(const char *str); +static int expr_check_exist(const char *str); +static int expr_check_port(const char *str); +static int expr_check_mailer(const char *str); +static int expr_check_addr(const char *str); +static int expr_check_time(const char *str); + +static int yylex(void); +static int yyparse(void); +static int yyerror(const char *s); + +#line 60 "y.tab.c" + +#ifndef YYSTYPE +typedef int YYSTYPE; +#endif + +/* compatibility with bison */ +#ifdef YYPARSE_PARAM +/* compatibility with FreeBSD */ +# ifdef YYPARSE_PARAM_TYPE +# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM) +# else +# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM) +# endif +#else +# define YYPARSE_DECL() yyparse(void) +#endif + +/* Parameters sent to lex. */ +#ifdef YYLEX_PARAM +# define YYLEX_DECL() yylex(void *YYLEX_PARAM) +# define YYLEX yylex(YYLEX_PARAM) +#else +# define YYLEX_DECL() yylex(void) +# define YYLEX yylex() +#endif + +/* Parameters sent to yyerror. */ +#ifndef YYERROR_DECL +#define YYERROR_DECL() yyerror(const char *s) +#endif +#ifndef YYERROR_CALL +#define YYERROR_CALL(msg) yyerror(msg) +#endif + +extern int YYPARSE_DECL(); + +#define COMMA 257 +#define TEXT 258 +#define NUMBER 259 +#define INCOMING 260 +#define OUTGOING 261 +#define LISTED 262 +#define PROTECTED 263 +#define CONNSPEED 264 +#define EXEC 265 +#define EXIST 266 +#define PORT 267 +#define MAILER 268 +#define TZ 269 +#define FLAG 270 +#define SPEED 271 +#define PHONE 272 +#define TIME 273 +#define ADDRESS 274 +#define EQ 275 +#define NE 276 +#define GT 277 +#define GE 278 +#define LT 279 +#define LE 280 +#define AND 281 +#define OR 282 +#define NOT 283 +#define XOR 284 +#define OPENB 285 +#define CLOSEB 286 +#define AROP 287 +#define LOGOP 288 +#define YYERRCODE 256 +static const short yylhs[] = { -1, + 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 3, 3, 4, 4, +}; +static const short yylen[] = { 2, + 1, 1, 2, 3, 3, 1, 1, 1, 1, 2, + 3, 3, 3, 2, 2, 2, 2, 2, 2, 1, + 1, 3, 1, 3, +}; +static const short yydefred[] = { 0, + 20, 6, 7, 8, 9, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, + 0, 16, 17, 18, 19, 0, 0, 10, 0, 14, + 0, 15, 0, 0, 0, 11, 13, 0, 12, 0, + 5, 0, 22, 24, +}; +static const short yydgoto[] = { 18, + 19, 20, 28, 32, +}; +static const short yysindex[] = { -251, + 0, 0, 0, 0, 0, -287, -255, -254, -250, -232, + -259, -229, -257, -227, -225, -251, -251, 0, -253, 0, + -223, 0, 0, 0, 0, -222, -219, 0, -220, 0, + -217, 0, -253, -261, -251, 0, 0, -229, 0, -225, + 0, -253, 0, 0, +}; +static const short yyrindex[] = { 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 41, 0, + 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, + 2, 0, 5, 0, 0, 0, 0, 0, 0, 0, + 0, 6, 0, 0, +}; +static const short yygindex[] = { 0, + 7, 0, 8, 3, +}; +#define YYTABLESIZE 292 +static const short yytable[] = { 21, + 21, 23, 22, 23, 3, 4, 1, 24, 2, 3, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 33, 34, 41, 25, 35, 26, 27, 29, + 30, 16, 31, 17, 35, 36, 37, 38, 39, 40, + 1, 42, 44, 0, 0, 43, 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, 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, 21, 23, 21, 23, + 3, 4, +}; +static const short yycheck[] = { 287, + 0, 0, 258, 258, 0, 0, 258, 258, 260, 261, + 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, + 272, 273, 16, 17, 286, 258, 288, 287, 258, 287, + 258, 283, 258, 285, 288, 259, 259, 257, 259, 257, + 0, 35, 40, -1, -1, 38, -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, -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, 286, 286, 288, 288, + 286, 286, +}; +#define YYFINAL 18 +#ifndef YYDEBUG +#define YYDEBUG 0 +#endif +#define YYMAXTOKEN 288 +#if YYDEBUG +static const char *yyname[] = { + +"end-of-file",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,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,"COMMA","TEXT","NUMBER", +"INCOMING","OUTGOING","LISTED","PROTECTED","CONNSPEED","EXEC","EXIST","PORT", +"MAILER","TZ","FLAG","SPEED","PHONE","TIME","ADDRESS","EQ","NE","GT","GE","LT", +"LE","AND","OR","NOT","XOR","OPENB","CLOSEB","AROP","LOGOP", +}; +static const char *yyrule[] = { +"$accept : fullline", +"fullline : expression", +"expression : elemexp", +"expression : NOT expression", +"expression : expression LOGOP expression", +"expression : OPENB expression CLOSEB", +"elemexp : INCOMING", +"elemexp : OUTGOING", +"elemexp : LISTED", +"elemexp : PROTECTED", +"elemexp : FLAG flagstring", +"elemexp : CONNSPEED AROP NUMBER", +"elemexp : SPEED AROP NUMBER", +"elemexp : TZ AROP NUMBER", +"elemexp : PHONE TEXT", +"elemexp : TIME timestring", +"elemexp : EXEC TEXT", +"elemexp : EXIST TEXT", +"elemexp : PORT TEXT", +"elemexp : MAILER TEXT", +"elemexp : TEXT", +"flagstring : TEXT", +"flagstring : TEXT COMMA flagstring", +"timestring : TEXT", +"timestring : TEXT COMMA timestring", + +}; +#endif + +int yydebug; +int yynerrs; + +int yyerrflag; +int yychar; +YYSTYPE yyval; +YYSTYPE yylval; + +/* define the initial stack-sizes */ +#ifdef YYSTACKSIZE +#undef YYMAXDEPTH +#define YYMAXDEPTH YYSTACKSIZE +#else +#ifdef YYMAXDEPTH +#define YYSTACKSIZE YYMAXDEPTH +#else +#define YYSTACKSIZE 500 +#define YYMAXDEPTH 500 +#endif +#endif + +#define YYINITSTACKSIZE 500 + +typedef struct { + unsigned stacksize; + short *s_base; + short *s_mark; + short *s_last; + YYSTYPE *l_base; + YYSTYPE *l_mark; +} YYSTACKDATA; +/* variables for the parser stack */ +static YYSTACKDATA yystack; +#line 211 "bforce/expression.y" + +#include "expression_lex.c" + +static int expr_check_incoming(void) +{ + if( !state.valid ) + return -1; + + return state.caller ? 0 : 1; +} + +static int expr_check_outgoing(void) +{ + if( !state.valid ) + return -1; + + return state.caller ? 1 : 0; +} + +static int expr_check_protected(void) +{ + if( !state.valid || !state.node.addr.zone ) + return -1; + + return state.protected ? 1 : 0; +} + +static int expr_check_listed(void) +{ + if( !state.valid || !state.node.addr.zone ) + return -1; + + return state.node.listed ? 1 : 0; +} + +static int expr_check_logic(int e1, int op, int e2) +{ + DEB((D_EVENT, "[yacc] logic: %d %d %d", e1, op, e2)); + + if( e1 < 0 ) e1 = 0; + if( e2 < 0 ) e2 = 0; + + switch(op) { + case AND: + return (e1 && e2); + case OR: + return (e1 || e2); + case XOR: + return (e1 ^ e2); + } + + log("invalid logical operator in expression"); + + return 0; +} + +static int expr_check_phone(const char *phone) +{ + DEB((D_EVENT, "[yacc] phone: is %s in %s", + phone, state.node.phone)); + + if( !state.valid ) + return 0; + + return strstr(state.node.phone, phone) ? 1 : 0; +} + +static int expr_check_arop(int num1, int op, int num2) +{ + DEB((D_EVENT, "[yacc] arop: %d %d %d", num1, op, num2)); + + switch(op) { + case EQ: return (num1 == num2); + case NE: return (num1 != num2); + case GT: return (num1 > num2); + case GE: return (num1 >= num2); + case LT: return (num1 < num2); + case LE: return (num1 <= num2); + } + + log("invalid arithmetic operator in expression"); + + return 0; +} + +static int expr_check_flag(const char *str) +{ + DEB((D_EVENT, "[yacc] flag: \"%s\"", str)); + + if( !state.valid ) + return 0; + + return !nodelist_checkflag(state.node.flags, str); +} + +static int expr_check_exec(const char *str) +{ + DEB((D_EVENT, "[yacc] exec: \"%s\"", str)); + + return session_run_command(str) ? 0 : 1; +} + +static int expr_check_exist(const char *str) +{ + DEB((D_EVENT, "[yacc] exist: \"%s\"", str)); + + return access(str, F_OK) ? 1 : 0; +} + +static int expr_check_port(const char *str) +{ + DEB((D_EVENT, "[yacc] port: \"%s\"", str)); + + if( !state.valid ) + return -1; + + if( !strcasecmp(str, "tcpip") ) + { + return state.inet ? 1 : 0; + } + else if( state.modemport && state.modemport->name ) + { + return strstr(state.modemport->name, str) ? 1 : 0; + } + else if( isatty(0) ) + { + return strstr(ttyname(0), str) ? 1 : 0; + } + + return -1; +} + +static int expr_check_mailer(const char *str) +{ + char *p; + + DEB((D_EVENT, "[yacc] mailer: \"%s\"", str)); + + if( !state.valid ) + return -1; + + if( state.handshake && state.handshake->remote_mailer ) + p = state.handshake->remote_mailer(state.handshake); + else + return -1; + + return (p && string_casestr(p, str)) ? 1 : 0; +} + +static int expr_check_addr(const char *str) +{ + s_faddr addr; +#ifdef DEBUG + char abuf1[BF_MAXADDRSTR+1]; + char abuf2[BF_MAXADDRSTR+1]; + + DEB((D_EVENT, "[yacc] addr: \"%s\" (session with \"%s\")", + ftn_addrstr(abuf1, addr), + ftn_addrstr(abuf2, state.node.addr))); +#endif + + if( !state.valid ) + return -1; + + if( ftn_addrparse(&addr, str, TRUE) ) + { + log("invalid address \"%s\"", str); + return -2; + } + + return !ftn_addrcomp_mask(state.node.addr, addr); +} + +static int expr_check_time(const char *str) +{ + DEB((D_EVENT, "[yacc] time: \"%s\"", str)); + + switch( time_check(str, now) ) { + case -1: + log("invalid time string \"%s\"", str); + return -2; + case 0: + return 1; + } + + return 0; +} + +bool eventexpr(s_expr *expr) +{ + time_t tt; + char *tmp; + + if( !expr || !expr->expr ) + return 1; + + if( expr->error ) + return 0; + + DEB((D_EVENT, "eventexpr: [yacc] check expression \"%s\"", + expr->expr)); + + tt = time(NULL); + now = localtime(&tt); + tmp = (char*)xstrcpy(expr->expr); + + expr_p_pos = tmp; + expr_result = 0; + + if( yyparse() ) + { + expr->error = TRUE; + + log("cannot parse expression \"%s\"", expr->expr); + DEB((D_EVENT, "eventexpr: [yacc] $yyparse return error")); + + expr_result = 0; + } + + free(tmp); + + DEB((D_EVENT, "eventexpr: [yacc] checking result is \"%s\" (%d)", + (expr_result == 1) ? "TRUE" : "FALSE", expr_result)); + + return (expr_result == 1) ? TRUE : FALSE; +} + +static int yyerror(const char *str) +{ + log("expression check failure: %s", str); + + return 0; +} +#line 548 "y.tab.c" + +#if YYDEBUG +#include /* needed for printf */ +#endif + +#include /* needed for malloc, etc */ +#include /* needed for memset */ + +/* allocate initial stack or double stack size, up to YYMAXDEPTH */ +static int yygrowstack(YYSTACKDATA *data) +{ + int i; + unsigned newsize; + short *newss; + YYSTYPE *newvs; + + if ((newsize = data->stacksize) == 0) + newsize = YYINITSTACKSIZE; + else if (newsize >= YYMAXDEPTH) + return -1; + else if ((newsize *= 2) > YYMAXDEPTH) + newsize = YYMAXDEPTH; + + i = data->s_mark - data->s_base; + newss = (short *)realloc(data->s_base, newsize * sizeof(*newss)); + if (newss == 0) + return -1; + + data->s_base = newss; + data->s_mark = newss + i; + + newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs)); + if (newvs == 0) + return -1; + + data->l_base = newvs; + data->l_mark = newvs + i; + + data->stacksize = newsize; + data->s_last = data->s_base + newsize - 1; + return 0; +} + +#if YYPURE || defined(YY_NO_LEAKS) +static void yyfreestack(YYSTACKDATA *data) +{ + free(data->s_base); + free(data->l_base); + memset(data, 0, sizeof(*data)); +} +#else +#define yyfreestack(data) /* nothing */ +#endif + +#define YYABORT goto yyabort +#define YYREJECT goto yyabort +#define YYACCEPT goto yyaccept +#define YYERROR goto yyerrlab + +int +YYPARSE_DECL() +{ + int yym, yyn, yystate; +#if YYDEBUG + const char *yys; + + if ((yys = getenv("YYDEBUG")) != 0) + { + yyn = *yys; + if (yyn >= '0' && yyn <= '9') + yydebug = yyn - '0'; + } +#endif + + yynerrs = 0; + yyerrflag = 0; + yychar = YYEMPTY; + yystate = 0; + +#if YYPURE + memset(&yystack, 0, sizeof(yystack)); +#endif + + if (yystack.s_base == NULL && yygrowstack(&yystack)) goto yyoverflow; + yystack.s_mark = yystack.s_base; + yystack.l_mark = yystack.l_base; + yystate = 0; + *yystack.s_mark = 0; + +yyloop: + if ((yyn = yydefred[yystate]) != 0) goto yyreduce; + if (yychar < 0) + { + if ((yychar = YYLEX) < 0) yychar = 0; +#if YYDEBUG + if (yydebug) + { + yys = 0; + if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; + if (!yys) yys = "illegal-symbol"; + printf("%sdebug: state %d, reading %d (%s)\n", + YYPREFIX, yystate, yychar, yys); + } +#endif + } + if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == yychar) + { +#if YYDEBUG + if (yydebug) + printf("%sdebug: state %d, shifting to state %d\n", + YYPREFIX, yystate, yytable[yyn]); +#endif + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack)) + { + goto yyoverflow; + } + yystate = yytable[yyn]; + *++yystack.s_mark = yytable[yyn]; + *++yystack.l_mark = yylval; + yychar = YYEMPTY; + if (yyerrflag > 0) --yyerrflag; + goto yyloop; + } + if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == yychar) + { + yyn = yytable[yyn]; + goto yyreduce; + } + if (yyerrflag) goto yyinrecovery; + + yyerror("syntax error"); + + goto yyerrlab; + +yyerrlab: + ++yynerrs; + +yyinrecovery: + if (yyerrflag < 3) + { + yyerrflag = 3; + for (;;) + { + if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) + { +#if YYDEBUG + if (yydebug) + printf("%sdebug: state %d, error recovery shifting\ + to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]); +#endif + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack)) + { + goto yyoverflow; + } + yystate = yytable[yyn]; + *++yystack.s_mark = yytable[yyn]; + *++yystack.l_mark = yylval; + goto yyloop; + } + else + { +#if YYDEBUG + if (yydebug) + printf("%sdebug: error recovery discarding state %d\n", + YYPREFIX, *yystack.s_mark); +#endif + if (yystack.s_mark <= yystack.s_base) goto yyabort; + --yystack.s_mark; + --yystack.l_mark; + } + } + } + else + { + if (yychar == 0) goto yyabort; +#if YYDEBUG + if (yydebug) + { + yys = 0; + if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; + if (!yys) yys = "illegal-symbol"; + printf("%sdebug: state %d, error recovery discards token %d (%s)\n", + YYPREFIX, yystate, yychar, yys); + } +#endif + yychar = YYEMPTY; + goto yyloop; + } + +yyreduce: +#if YYDEBUG + if (yydebug) + printf("%sdebug: state %d, reducing by rule %d (%s)\n", + YYPREFIX, yystate, yyn, yyrule[yyn]); +#endif + yym = yylen[yyn]; + if (yym) + yyval = yystack.l_mark[1-yym]; + else + memset(&yyval, 0, sizeof yyval); + switch (yyn) + { +case 1: +#line 93 "bforce/expression.y" + { + DEB((D_EVENT, "[yacc] expression return %d", yystack.l_mark[0])); + expr_result = yystack.l_mark[0]; + } +break; +case 2: +#line 99 "bforce/expression.y" + { + DEB((D_EVENT, "[yacc] elemexp return %d", yystack.l_mark[0])); + yyval = yystack.l_mark[0]; + } +break; +case 3: +#line 104 "bforce/expression.y" + { + DEB((D_EVENT, "[yacc] not exprression %d", yystack.l_mark[0])); + if( (yystack.l_mark[0]) < 0 ) + yyval = 0; + else + yyval = !(yystack.l_mark[0]); + } +break; +case 4: +#line 112 "bforce/expression.y" + { + yyval = expr_check_logic(yystack.l_mark[-2], yystack.l_mark[-1], yystack.l_mark[0]); + } +break; +case 5: +#line 116 "bforce/expression.y" + { + DEB((D_EVENT, "eventexp: [yacc] backeted.expr %d", yystack.l_mark[-1])); + yyval = yystack.l_mark[-1]; + } +break; +case 6: +#line 122 "bforce/expression.y" + { + yyval = expr_check_incoming(); + } +break; +case 7: +#line 126 "bforce/expression.y" + { + yyval = expr_check_outgoing(); + } +break; +case 8: +#line 130 "bforce/expression.y" + { + yyval = expr_check_listed(); + } +break; +case 9: +#line 134 "bforce/expression.y" + { + yyval = expr_check_protected(); + } +break; +case 10: +#line 138 "bforce/expression.y" + { + yyval = yystack.l_mark[0]; + } +break; +case 11: +#line 142 "bforce/expression.y" + { + if( state.valid && state.connspeed > 0 ) + yyval = expr_check_arop(state.connspeed, yystack.l_mark[-1], yystack.l_mark[0]); + else + yyval = -1; + } +break; +case 12: +#line 149 "bforce/expression.y" + { + if( state.valid && state.node.speed > 0 ) + yyval = expr_check_arop(state.node.speed, yystack.l_mark[-1], yystack.l_mark[0]); + else + yyval = -1; + } +break; +case 13: +#line 156 "bforce/expression.y" + { + yyval = expr_check_arop(time_gmtoffset(), yystack.l_mark[-1], yystack.l_mark[0]); + } +break; +case 14: +#line 160 "bforce/expression.y" + { + yyval = expr_check_phone(expr_p_text); + } +break; +case 15: +#line 164 "bforce/expression.y" + { + yyval = yystack.l_mark[0]; + } +break; +case 16: +#line 168 "bforce/expression.y" + { + yyval = expr_check_exec(expr_p_text); + } +break; +case 17: +#line 172 "bforce/expression.y" + { + yyval = expr_check_exist(expr_p_text); + } +break; +case 18: +#line 176 "bforce/expression.y" + { + yyval = expr_check_port(expr_p_text); + } +break; +case 19: +#line 180 "bforce/expression.y" + { + yyval = expr_check_mailer(expr_p_text); + } +break; +case 20: +#line 184 "bforce/expression.y" + { + yyval = expr_check_addr(expr_p_text); + if( yyval == -2 ) + YYABORT; + } +break; +case 21: +#line 191 "bforce/expression.y" + { + yyval = expr_check_flag(expr_p_text); + } +break; +case 22: +#line 195 "bforce/expression.y" + { + yyval = expr_check_logic(yystack.l_mark[-2], OR, yystack.l_mark[0]); + } +break; +case 23: +#line 200 "bforce/expression.y" + { + yyval = expr_check_time(expr_p_text); + if( yyval == -2 ) + YYABORT; + } +break; +case 24: +#line 206 "bforce/expression.y" + { + yyval = expr_check_logic(yystack.l_mark[-2], OR, yystack.l_mark[0]); + } +break; +#line 915 "y.tab.c" + } + yystack.s_mark -= yym; + yystate = *yystack.s_mark; + yystack.l_mark -= yym; + yym = yylhs[yyn]; + if (yystate == 0 && yym == 0) + { +#if YYDEBUG + if (yydebug) + printf("%sdebug: after reduction, shifting from state 0 to\ + state %d\n", YYPREFIX, YYFINAL); +#endif + yystate = YYFINAL; + *++yystack.s_mark = YYFINAL; + *++yystack.l_mark = yyval; + if (yychar < 0) + { + if ((yychar = YYLEX) < 0) yychar = 0; +#if YYDEBUG + if (yydebug) + { + yys = 0; + if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; + if (!yys) yys = "illegal-symbol"; + printf("%sdebug: state %d, reading %d (%s)\n", + YYPREFIX, YYFINAL, yychar, yys); + } +#endif + } + if (yychar == 0) goto yyaccept; + goto yyloop; + } + if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == yystate) + yystate = yytable[yyn]; + else + yystate = yydgoto[yym]; +#if YYDEBUG + if (yydebug) + printf("%sdebug: after reduction, shifting from state %d \ +to state %d\n", YYPREFIX, *yystack.s_mark, yystate); +#endif + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack)) + { + goto yyoverflow; + } + *++yystack.s_mark = (short) yystate; + *++yystack.l_mark = yyval; + goto yyloop; + +yyoverflow: + yyerror("yacc stack overflow"); + +yyabort: + yyfreestack(&yystack); + return (1); + +yyaccept: + yyfreestack(&yystack); + return (0); +} diff --git a/source/include/config.h b/source/include/config.h new file mode 100644 index 0000000..bd0eafe --- /dev/null +++ b/source/include/config.h @@ -0,0 +1,154 @@ +/* include/config.h. Generated from config.h.in by configure. */ +/* include/config.h.in. Generated automatically from configure.in by autoheader. */ + +/* Define to empty if the keyword does not work. */ +/* #undef const */ + +/* Define if the `getpgrp' function takes no argument. */ +#define GETPGRP_VOID 1 + +/* Define if you don't have vprintf but do have _doprnt. */ +/* #undef HAVE_DOPRNT */ + +/* Define if you have that is POSIX.1 compatible. */ +#define HAVE_SYS_WAIT_H 1 + +/* Define if you have the vprintf function. */ +#define HAVE_VPRINTF 1 + +/* Define to `int' if doesn't define. */ +/* #undef mode_t */ + +/* Define to `int' if doesn't define. */ +/* #undef pid_t */ + +/* Define as the return type of signal handlers (int or void). */ +#define RETSIGTYPE void + +/* Define if the setvbuf function takes the buffering type as its second + argument and the buffer pointer as the third, as on System V + before release 3. */ +/* #undef SETVBUF_REVERSED */ + +/* Define to `unsigned' if doesn't define. */ +/* #undef size_t */ + +/* Define if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define if you can safely include both and . */ +#define TIME_WITH_SYS_TIME 1 + +/* Define if your declares struct tm. */ +/* #undef TM_IN_SYS_TIME */ + +/* Do you want debug code to be compiled? */ +#define DEBUG 1 + +/* Do you want use DCD line control? */ +#define MODEM_WATCH_CARRIER 1 + +/* Do you want hangup to watch for modem DCD line? */ +#define MODEM_HANGUP_WATCH_CARRIER 1 + +/* Version string */ +#define RELEASE_VERSION "0.23" + +/* Disable passwords logging? */ +#define BFORCE_LOG_PASSWD 1 + +/* Path to the UUCP lock files directory */ +#define BFORCE_LOCK_DIR "/var/lock/" + +/* Do you want to use syslog? */ +#define USE_SYSLOG 1 + +/* Netspool */ +#define NETSPOOL 1 + +/* Do you want use .csy locks? */ +#define BFORCE_USE_CSY 1 + +/* Define if you have the mkdir function. */ +#define HAVE_MKDIR 1 + +/* Define if you have the mktime function. */ +#define HAVE_MKTIME 1 + +/* Define if you have the rename function. */ +#define HAVE_RENAME 1 + +/* Define if you have the select function. */ +#define HAVE_SELECT 1 + +/* Define if you have the setproctitle function. */ +/* #undef HAVE_SETPROCTITLE */ + +/* Define if you have the socket function. */ +#define HAVE_SOCKET 1 + +/* Define if you have the statfs function. */ +#define HAVE_STATFS 1 + +/* Define if you have the statvfs function. */ +#define HAVE_STATVFS 1 + +/* Define if you have the strcasecmp function. */ +#define HAVE_STRCASECMP 1 + +/* Define if you have the strspn function. */ +#define HAVE_STRSPN 1 + +/* Define if you have the header file. */ +#define HAVE_DIRENT_H 1 + +/* Define if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define if you have the header file. */ +/* #undef HAVE_NDIR_H */ + +/* Define if you have the header file. */ +/* #undef HAVE_SYS_DIR_H */ + +/* Define if you have the header file. */ +#define HAVE_SYS_FILE_H 1 + +/* Define if you have the header file. */ +#define HAVE_SYS_IOCTL_H 1 + +/* Define if you have the header file. */ +#define HAVE_SYS_MOUNT_H 1 + +/* Define if you have the header file. */ +/* #undef HAVE_SYS_NDIR_H */ + +/* Define if you have the header file. */ +#define HAVE_SYS_PARAM_H 1 + +/* Define if you have the header file. */ +#define HAVE_SYS_SELECT_H 1 + +/* Define if you have the header file. */ +#define HAVE_SYS_STATFS_H 1 + +/* Define if you have the header file. */ +#define HAVE_SYS_STATVFS_H 1 + +/* Define if you have the header file. */ +/* #undef HAVE_SYS_TERMIOX_H */ + +/* Define if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define if you have the header file. */ +#define HAVE_SYS_VFS_H 1 + +/* Define if you have the header file. */ +#define HAVE_TERMIOS_H 1 + +/* Define if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define if you want buggy emsi :) */ +#define BUGGY_EMSI 0 From 6b84f75a6069cfd318b6aa09448a453bcbe21da9 Mon Sep 17 00:00:00 2001 From: Sergey Dorofeev Date: Tue, 4 Jun 2013 20:31:52 +0400 Subject: [PATCH 03/11] flush --- source/bforce/prot_binkp.c | 2 +- source/bforce/prot_common.c | 2 +- source/bforce/prot_zmrecv.c | 1 + source/bforce/sess_call.c | 4 ++-- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/source/bforce/prot_binkp.c b/source/bforce/prot_binkp.c index a75adb8..bc2f257 100644 --- a/source/bforce/prot_binkp.c +++ b/source/bforce/prot_binkp.c @@ -977,7 +977,7 @@ case BPMSG_GET: /* Get a file from offset */ if( bstate->pi->send ) { DEB((D_24554, "aborting current file")); - p_tx_fclose(bstate->pi); + //p_tx_fclose(bstate->pi); may be requested again } s_filehint hint; diff --git a/source/bforce/prot_common.c b/source/bforce/prot_common.c index 6a1969f..7e75140 100644 --- a/source/bforce/prot_common.c +++ b/source/bforce/prot_common.c @@ -627,7 +627,7 @@ long int p_tx_readfile(char *buffer, size_t buflen, s_protinfo *pi) pi->send->bytes_received = ftell_pos; return -1; } - + if( stat(pi->send->fname, &st) == -1 && errno == ENOENT ) { log("send: file not found! do you want to skip it?"); diff --git a/source/bforce/prot_zmrecv.c b/source/bforce/prot_zmrecv.c index d9cd864..65dde29 100644 --- a/source/bforce/prot_zmrecv.c +++ b/source/bforce/prot_zmrecv.c @@ -85,6 +85,7 @@ int rx_zmodem(s_protinfo *pi, bool caller) while(1) { + DEB((D_PROT, "rx_zmodem: one more loop")); if( timer_expired(deadtimer) ) { DEB((D_PROT, "rx_zmodem: deadtimer = %ld", (long)deadtimer)); diff --git a/source/bforce/sess_call.c b/source/bforce/sess_call.c index ed0a307..b2e897f 100644 --- a/source/bforce/sess_call.c +++ b/source/bforce/sess_call.c @@ -376,7 +376,7 @@ int call_system_modem(void) else log("warning: no modem dial suffix defined"); - log("calling %s (%s, %s)", + log("calling with modem %s (%s, %s)", ftn_addrstr(abuf, state.node.addr), (state.node.name && *state.node.name) ? state.node.name : "", string_printable(dialstring)); @@ -516,7 +516,7 @@ defalt: return BFERR_FATALERROR; } - log("calling %s (%s, %s)", + log("calling with internet %s (%s, %s)", ftn_addrstr(abuf, state.node.addr), (state.node.name && *state.node.name ) ? state.node.name : "", (state.node.host && *state.node.host) ? state.node.host : ""); From abe396a046cd8453c17625a230386448ac811f4b Mon Sep 17 00:00:00 2001 From: Sergey Dorofeev Date: Tue, 4 Jun 2013 20:32:27 +0400 Subject: [PATCH 04/11] flush --- debian/Makefile | 263 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 263 insertions(+) create mode 100644 debian/Makefile diff --git a/debian/Makefile b/debian/Makefile new file mode 100644 index 0000000..aef82e8 --- /dev/null +++ b/debian/Makefile @@ -0,0 +1,263 @@ +# Makefile.in generated by automake 1.8.3 from Makefile.am. +# ../debian/Makefile. Generated from Makefile.in by configure. + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +srcdir = . +top_srcdir = ../.. + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = /usr/bin/install -c +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = i686-pc-linux-gnu +host_triplet = i686-pc-linux-gnu +target_triplet = i686-pc-linux-gnu +subdir = ../debian +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) +mkinstalldirs = $(mkdir_p) +CONFIG_HEADER = $(top_builddir)/include/config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +CC = gcc +CFLAGS = -g -O2 +CPP = gcc -E +CPPFLAGS = +DEFS = -DHAVE_CONFIG_H +ECHO_C = +ECHO_N = -n +ECHO_T = +EGREP = /bin/grep -E +EXEEXT = +GROUP = sergey +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_PROGRAM = ${INSTALL} +INSTALL_SCRIPT = ${INSTALL} +LDFLAGS = +LIBOBJS = +LIBS = -lrt +LTLIBOBJS = +OBJEXT = o +OWNER = sergey +PACKAGE_BUGREPORT = sergey@fidoman.ru +PACKAGE_NAME = bforce +PACKAGE_STRING = bforce 0.24 +PACKAGE_TARNAME = bforce +PACKAGE_VERSION = 0.24 +PATH_SEPARATOR = : +SHELL = /bin/bash +YACC = byacc +ac_ct_CC = gcc +bindir = ${exec_prefix}/bin +build = i686-pc-linux-gnu +build_alias = +build_cpu = i686 +build_os = linux-gnu +build_vendor = pc +datadir = ${prefix}/share +exec_prefix = ${prefix} +host = i686-pc-linux-gnu +host_alias = +host_cpu = i686 +host_os = linux-gnu +host_vendor = pc +includedir = ${prefix}/include +infodir = ${prefix}/share/info +libdir = ${exec_prefix}/lib +libexecdir = ${exec_prefix}/libexec +localstatedir = ${prefix}/var +mandir = ${prefix}/share/man +oldincludedir = /usr/include +prefix = /home/sergey/bforce +program_transform_name = s,x,x, +sbindir = ${exec_prefix}/sbin +sharedstatedir = ${prefix}/com +sysconfdir = ${prefix}/etc +target = i686-pc-linux-gnu +target_alias = +target_cpu = i686 +target_os = linux-gnu +target_vendor = pc + +# $Id$ +EXTRA_DIST = copyright changelog rules conffiles \ + control dirs init.d + +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu ../debian/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu ../debian/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +uninstall-info-am: +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am + +.PHONY: all all-am check check-am clean clean-generic distclean \ + distclean-generic distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-exec \ + install-exec-am install-info install-info-am install-man \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \ + uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: From f467bc8f13767fbdd1a61174b4cad9b839f72035 Mon Sep 17 00:00:00 2001 From: Alexander Skovpen Date: Tue, 10 Jun 2014 21:27:30 +0400 Subject: [PATCH 05/11] added crypt support --- debian/Makefile | 38 +- source/Makefile | 15 +- source/Makefile.in | 3 +- source/bforce/expression.c | 2596 +++++++++++++++++++++--------- source/bforce/prot_binkp.c | 20 +- source/bforce/prot_binkp_crypt.c | 148 ++ source/bforce/prot_binkp_misc.c | 4 + source/include/config.h | 2 +- source/include/prot_binkp.h | 11 + 9 files changed, 2090 insertions(+), 747 deletions(-) create mode 100644 source/bforce/prot_binkp_crypt.c diff --git a/debian/Makefile b/debian/Makefile index aef82e8..4ba6be0 100644 --- a/debian/Makefile +++ b/debian/Makefile @@ -33,9 +33,9 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : -build_triplet = i686-pc-linux-gnu -host_triplet = i686-pc-linux-gnu -target_triplet = i686-pc-linux-gnu +build_triplet = x86_64-unknown-linux-gnu +host_triplet = x86_64-unknown-linux-gnu +target_triplet = x86_64-unknown-linux-gnu subdir = ../debian DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in am__aclocal_m4_deps = $(top_srcdir)/configure.in @@ -56,38 +56,38 @@ ECHO_N = -n ECHO_T = EGREP = /bin/grep -E EXEEXT = -GROUP = sergey +GROUP = ftn INSTALL_DATA = ${INSTALL} -m 644 INSTALL_PROGRAM = ${INSTALL} INSTALL_SCRIPT = ${INSTALL} LDFLAGS = LIBOBJS = -LIBS = -lrt +LIBS = LTLIBOBJS = OBJEXT = o -OWNER = sergey +OWNER = ftn PACKAGE_BUGREPORT = sergey@fidoman.ru PACKAGE_NAME = bforce PACKAGE_STRING = bforce 0.24 PACKAGE_TARNAME = bforce PACKAGE_VERSION = 0.24 PATH_SEPARATOR = : -SHELL = /bin/bash -YACC = byacc +SHELL = /bin/sh +YACC = bison -y ac_ct_CC = gcc bindir = ${exec_prefix}/bin -build = i686-pc-linux-gnu +build = x86_64-unknown-linux-gnu build_alias = -build_cpu = i686 +build_cpu = x86_64 build_os = linux-gnu -build_vendor = pc +build_vendor = unknown datadir = ${prefix}/share exec_prefix = ${prefix} -host = i686-pc-linux-gnu +host = x86_64-unknown-linux-gnu host_alias = -host_cpu = i686 +host_cpu = x86_64 host_os = linux-gnu -host_vendor = pc +host_vendor = unknown includedir = ${prefix}/include infodir = ${prefix}/share/info libdir = ${exec_prefix}/lib @@ -95,16 +95,16 @@ libexecdir = ${exec_prefix}/libexec localstatedir = ${prefix}/var mandir = ${prefix}/share/man oldincludedir = /usr/include -prefix = /home/sergey/bforce +prefix = /usr/local program_transform_name = s,x,x, sbindir = ${exec_prefix}/sbin sharedstatedir = ${prefix}/com -sysconfdir = ${prefix}/etc -target = i686-pc-linux-gnu +sysconfdir = /usr/local/etc/ftn/bforce +target = x86_64-unknown-linux-gnu target_alias = -target_cpu = i686 +target_cpu = x86_64 target_os = linux-gnu -target_vendor = pc +target_vendor = unknown # $Id$ EXTRA_DIST = copyright changelog rules conffiles \ diff --git a/source/Makefile b/source/Makefile index c804bb5..5b90c43 100644 --- a/source/Makefile +++ b/source/Makefile @@ -6,14 +6,14 @@ # $Id$ # -prefix=/home/sergey/bforce +prefix=/usr/local exec_prefix=${prefix} CC = gcc INCLUDES = -I./include CFLAGS = -g -O2 -fno-builtin -LIBS = -lrt -YACC = byacc +LIBS = +YACC = bison -y INSTALL = /usr/bin/install -c INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 @@ -21,9 +21,9 @@ SRCDIR = . SRCDIRCONF = $(SRCDIR)/../examples CONTRIBDIR = $(SRCDIR)/../contrib -OWNER = sergey -GROUP = sergey -CONFDIR = ${prefix}/etc +OWNER = ftn +GROUP = ftn +CONFDIR = /usr/local/etc/ftn/bforce BINDIR = ${exec_prefix}/bin LOGDIR = /var/log/bforce SPOOLDIR = /var/spool/bforce @@ -103,7 +103,8 @@ BFORCE_OBJS = bforce/bforce.o \ bforce/u_misc.o bforce/u_string.o \ bforce/u_time.o bforce/u_file.o \ bforce/u_pkt.o bforce/u_recode.o \ - bforce/u_plock.o bforce/netspool.o + bforce/u_plock.o bforce/netspool.o \ + bforce/prot_binkp_crypt.o .c.o: @echo Compiling $*.c diff --git a/source/Makefile.in b/source/Makefile.in index 0cdcb90..8de31a3 100644 --- a/source/Makefile.in +++ b/source/Makefile.in @@ -103,7 +103,8 @@ BFORCE_OBJS = bforce/bforce.o \ bforce/u_misc.o bforce/u_string.o \ bforce/u_time.o bforce/u_file.o \ bforce/u_pkt.o bforce/u_recode.o \ - bforce/u_plock.o bforce/netspool.o + bforce/u_plock.o bforce/netspool.o \ + bforce/prot_binkp_crypt.o .c.o: @echo Compiling $*.c diff --git a/source/bforce/expression.c b/source/bforce/expression.c index 9bcc369..e13e22f 100644 --- a/source/bforce/expression.c +++ b/source/bforce/expression.c @@ -1,317 +1,1905 @@ +/* A Bison parser, made by GNU Bison 2.4.3. */ + +/* Skeleton implementation for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2009, 2010 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 + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* 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. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Bison version. */ +#define YYBISON_VERSION "2.4.3" + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 0 + +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + +/* Using locations. */ +#define YYLSP_NEEDED 0 + + + +/* Copy the first part of user declarations. */ + +/* Line 189 of yacc.c */ +#line 48 "bforce/expression.y" + +#include "includes.h" +#include "confread.h" +#include "util.h" +#include "logger.h" +#include "session.h" +#include "nodelist.h" +#include "io.h" + +static struct tm *now = NULL; +static int expr_result = 0; +static char *expr_p_pos = NULL; +static char *expr_p_text = NULL; + +/* + * These are expression element checkers (not only) + * Return values: + * 0 - FALSE + * 1 - TRUE + * -1 - cannot check, because some data is not available yet + * -2 - invalid element (we should not check this expression more) + */ +static int expr_check_incoming(void); +static int expr_check_outgoing(void); +static int expr_check_protected(void); +static int expr_check_listed(void); +static int expr_check_logic(int e1, int op, int e2); +static int expr_check_phone(const char *phone); +static int expr_check_arop(int num1, int op, int num2); +static int expr_check_flag(const char *str); +static int expr_check_exec(const char *str); +static int expr_check_exist(const char *str); +static int expr_check_port(const char *str); +static int expr_check_mailer(const char *str); +static int expr_check_addr(const char *str); +static int expr_check_time(const char *str); + +static int yylex(void); +static int yyparse(void); +static int yyerror(const char *s); + + + +/* Line 189 of yacc.c */ +#line 116 "y.tab.c" + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 0 +#endif + +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE 0 +#endif + + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + COMMA = 258, + TEXT = 259, + NUMBER = 260, + INCOMING = 261, + OUTGOING = 262, + LISTED = 263, + PROTECTED = 264, + CONNSPEED = 265, + EXEC = 266, + EXIST = 267, + PORT = 268, + MAILER = 269, + TZ = 270, + FLAG = 271, + SPEED = 272, + PHONE = 273, + TIME = 274, + ADDRESS = 275, + EQ = 276, + NE = 277, + GT = 278, + GE = 279, + LT = 280, + LE = 281, + AND = 282, + OR = 283, + NOT = 284, + XOR = 285, + OPENB = 286, + CLOSEB = 287, + AROP = 288, + LOGOP = 289 + }; +#endif +/* Tokens. */ +#define COMMA 258 +#define TEXT 259 +#define NUMBER 260 +#define INCOMING 261 +#define OUTGOING 262 +#define LISTED 263 +#define PROTECTED 264 +#define CONNSPEED 265 +#define EXEC 266 +#define EXIST 267 +#define PORT 268 +#define MAILER 269 +#define TZ 270 +#define FLAG 271 +#define SPEED 272 +#define PHONE 273 +#define TIME 274 +#define ADDRESS 275 +#define EQ 276 +#define NE 277 +#define GT 278 +#define GE 279 +#define LT 280 +#define LE 281 +#define AND 282 +#define OR 283 +#define NOT 284 +#define XOR 285 +#define OPENB 286 +#define CLOSEB 287 +#define AROP 288 +#define LOGOP 289 + + + + +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef int YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +#endif + + +/* Copy the second part of user declarations. */ + + +/* Line 264 of yacc.c */ +#line 226 "y.tab.c" + +#ifdef short +# undef short +#endif + +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; +#endif + +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#elif (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +typedef signed char yytype_int8; +#else +typedef short int yytype_int8; +#endif + +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; +#endif + +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; +#endif + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int +# endif +#endif + +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + +#ifndef YY_ +# if defined YYENABLE_NLS && YYENABLE_NLS +# if ENABLE_NLS +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_(msgid) dgettext ("bison-runtime", msgid) +# endif +# endif +# ifndef YY_ +# define YY_(msgid) msgid +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(e) ((void) (e)) +#else +# define YYUSE(e) /* empty */ +#endif + +/* Identity function, used to suppress warnings about constant conditions. */ #ifndef lint -static const char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93"; +# define YYID(n) (n) +#else +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static int +YYID (int yyi) +#else +static int +YYID (yyi) + int yyi; +#endif +{ + return yyi; +} +#endif + +#if ! defined yyoverflow || YYERROR_VERBOSE + +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include /* INFRINGES ON USER NAME SPACE */ +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined _STDLIB_H \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# endif +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ + + +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; +}; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + + YYSTACK_GAP_MAXIMUM) + +/* Copy COUNT objects from FROM to TO. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# else +# define YYCOPY(To, From, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (YYID (0)) +# endif +# endif + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (YYID (0)) + +#endif + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 35 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 43 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 35 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 6 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 25 +/* YYNRULES -- Number of states. */ +#define YYNSTATES 46 + +/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 289 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +static const yytype_uint8 yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34 +}; + +#if YYDEBUG +/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in + YYRHS. */ +static const yytype_uint8 yyprhs[] = +{ + 0, 0, 3, 5, 7, 10, 14, 18, 20, 22, + 24, 26, 29, 33, 37, 41, 44, 47, 50, 53, + 56, 59, 61, 63, 67, 69 +}; + +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const yytype_int8 yyrhs[] = +{ + 36, 0, -1, 37, -1, 38, -1, 29, 37, -1, + 37, 34, 37, -1, 31, 37, 32, -1, 6, -1, + 7, -1, 8, -1, 9, -1, 16, 39, -1, 10, + 33, 5, -1, 17, 33, 5, -1, 15, 33, 5, + -1, 18, 4, -1, 19, 40, -1, 11, 4, -1, + 12, 4, -1, 13, 4, -1, 14, 4, -1, 4, + -1, 4, -1, 4, 3, 39, -1, 4, -1, 4, + 3, 40, -1 +}; + +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +static const yytype_uint8 yyrline[] = +{ + 0, 92, 92, 98, 103, 111, 115, 121, 125, 129, + 133, 137, 141, 148, 155, 159, 163, 167, 171, 175, + 179, 183, 190, 194, 199, 205 +}; +#endif + +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "$end", "error", "$undefined", "COMMA", "TEXT", "NUMBER", "INCOMING", + "OUTGOING", "LISTED", "PROTECTED", "CONNSPEED", "EXEC", "EXIST", "PORT", + "MAILER", "TZ", "FLAG", "SPEED", "PHONE", "TIME", "ADDRESS", "EQ", "NE", + "GT", "GE", "LT", "LE", "AND", "OR", "NOT", "XOR", "OPENB", "CLOSEB", + "AROP", "LOGOP", "$accept", "fullline", "expression", "elemexp", + "flagstring", "timestring", 0 +}; +#endif + +# ifdef YYPRINT +/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to + token YYLEX-NUM. */ +static const yytype_uint16 yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289 +}; +# endif + +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 35, 36, 37, 37, 37, 37, 38, 38, 38, + 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, + 38, 38, 39, 39, 40, 40 +}; + +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 1, 1, 2, 3, 3, 1, 1, 1, + 1, 2, 3, 3, 3, 2, 2, 2, 2, 2, + 2, 1, 1, 3, 1, 3 +}; + +/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state + STATE-NUM when YYTABLE doesn't specify something else to do. Zero + means the default is an error. */ +static const yytype_uint8 yydefact[] = +{ + 0, 21, 7, 8, 9, 10, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, + 3, 0, 17, 18, 19, 20, 0, 22, 11, 0, + 15, 24, 16, 4, 0, 1, 0, 12, 14, 0, + 13, 0, 6, 5, 23, 25 +}; + +/* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int8 yydefgoto[] = +{ + -1, 18, 19, 20, 28, 32 +}; + +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +#define YYPACT_NINF -33 +static const yytype_int8 yypact[] = +{ + -4, -33, -33, -33, -33, -33, -32, 15, 17, 18, + 19, -9, 22, -5, 25, 26, -4, -4, 31, -2, + -33, 28, -33, -33, -33, -33, 29, 32, -33, 33, + -33, 34, -33, -2, -14, -33, -4, -33, -33, 22, + -33, 26, -33, -2, -33, -33 +}; + +/* YYPGOTO[NTERM-NUM]. */ +static const yytype_int8 yypgoto[] = +{ + -33, -33, 0, -33, 1, 2 +}; + +/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule which + number is the opposite. If zero, do what YYDEFACT says. + If YYTABLE_NINF, syntax error. */ +#define YYTABLE_NINF -1 +static const yytype_uint8 yytable[] = +{ + 1, 21, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 33, 34, 42, 22, + 36, 23, 24, 25, 26, 16, 27, 17, 29, 30, + 31, 35, 36, 37, 38, 39, 43, 41, 40, 0, + 44, 0, 0, 45 +}; + +static const yytype_int8 yycheck[] = +{ + 4, 33, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 16, 17, 32, 4, + 34, 4, 4, 4, 33, 29, 4, 31, 33, 4, + 4, 0, 34, 5, 5, 3, 36, 3, 5, -1, + 39, -1, -1, 41 +}; + +/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const yytype_uint8 yystos[] = +{ + 0, 4, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 29, 31, 36, 37, + 38, 33, 4, 4, 4, 4, 33, 4, 39, 33, + 4, 4, 40, 37, 37, 0, 34, 5, 5, 3, + 5, 3, 32, 37, 39, 40 +}; + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + + +/* Like YYERROR except do call yyerror. This remains here temporarily + to ease the transition to the new meaning of YYERROR, for GCC. + Once GCC version 2 has supplanted version 1, this can go. However, + YYFAIL appears to be in use. Nevertheless, it is formally deprecated + in Bison 2.4.2's NEWS entry, where a plan to phase it out is + discussed. */ + +#define YYFAIL goto yyerrlab +#if defined YYFAIL + /* This is here to suppress warnings from the GCC cpp's + -Wunused-macros. Normally we don't worry about that warning, but + some users do, and we want to make it easy for users to remove + YYFAIL uses, which will produce warnings from Bison 2.5. */ +#endif + +#define YYRECOVERING() (!!yyerrstatus) + +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + yytoken = YYTRANSLATE (yychar); \ + YYPOPSTACK (1); \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ +while (YYID (0)) + + +#define YYTERROR 1 +#define YYERRCODE 256 + + +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ + +#define YYRHSLOC(Rhs, K) ((Rhs)[K]) +#ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (YYID (N)) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ + while (YYID (0)) #endif -#define YYBYACC 1 -#define YYMAJOR 1 -#define YYMINOR 9 -#define YYPATCH 20120115 -#define YYEMPTY (-1) -#define yyclearin (yychar = YYEMPTY) -#define yyerrok (yyerrflag = 0) -#define YYRECOVERING() (yyerrflag != 0) +/* YY_LOCATION_PRINT -- Print the location on the stream. + This macro was not mandated originally: define only if we know + we won't break user code: when these are the locations we know. */ + +#ifndef YY_LOCATION_PRINT +# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL +# define YY_LOCATION_PRINT(File, Loc) \ + fprintf (File, "%d.%d-%d.%d", \ + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) +# else +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +# endif +#endif + + +/* YYLEX -- calling `yylex' with the right arguments. */ + +#ifdef YYLEX_PARAM +# define YYLEX yylex (YYLEX_PARAM) +#else +# define YYLEX yylex () +#endif + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (YYID (0)) + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (YYID (0)) + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +#else +static void +yy_symbol_value_print (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; +#endif +{ + if (!yyvaluep) + return; +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# else + YYUSE (yyoutput); +# endif + switch (yytype) + { + default: + break; + } +} + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +#else +static void +yy_symbol_print (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; +#endif +{ + if (yytype < YYNTOKENS) + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + + yy_symbol_value_print (yyoutput, yytype, yyvaluep); + YYFPRINTF (yyoutput, ")"); +} + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +#else +static void +yy_stack_print (yybottom, yytop) + yytype_int16 *yybottom; + yytype_int16 *yytop; +#endif +{ + YYFPRINTF (stderr, "Stack now"); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (YYID (0)) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_reduce_print (YYSTYPE *yyvsp, int yyrule) +#else +static void +yy_reduce_print (yyvsp, yyrule) + YYSTYPE *yyvsp; + int yyrule; +#endif +{ + int yynrhs = yyr2[yyrule]; + int yyi; + unsigned long int yylno = yyrline[yyrule]; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], + &(yyvsp[(yyi + 1) - (yynrhs)]) + ); + YYFPRINTF (stderr, "\n"); + } +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyvsp, Rule); \ +} while (YYID (0)) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !YYDEBUG */ + + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH 10000 +#endif + + + +#if YYERROR_VERBOSE + +# ifndef yystrlen +# if defined __GLIBC__ && defined _STRING_H +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static YYSIZE_T +yystrlen (const char *yystr) +#else +static YYSIZE_T +yystrlen (yystr) + const char *yystr; +#endif +{ + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) + continue; + return yylen; +} +# endif +# endif + +# ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static char * +yystpcpy (char *yydest, const char *yysrc) +#else +static char * +yystpcpy (yydest, yysrc) + char *yydest; + const char *yysrc; +#endif +{ + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + YYSIZE_T yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (! yyres) + return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +/* Copy into YYRESULT an error message about the unexpected token + YYCHAR while in state YYSTATE. Return the number of bytes copied, + including the terminating null byte. If YYRESULT is null, do not + copy anything; just return the number of bytes that would be + copied. As a special case, return 0 if an ordinary "syntax error" + message will do. Return YYSIZE_MAXIMUM if overflow occurs during + size calculation. */ +static YYSIZE_T +yysyntax_error (char *yyresult, int yystate, int yychar) +{ + int yyn = yypact[yystate]; + + if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) + return 0; + else + { + int yytype = YYTRANSLATE (yychar); + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + int yysize_overflow = 0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + int yyx; + +# if 0 + /* This is so xgettext sees the translatable formats that are + constructed on the fly. */ + YY_("syntax error, unexpected %s"); + YY_("syntax error, unexpected %s, expecting %s"); + YY_("syntax error, unexpected %s, expecting %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); +# endif + char *yyfmt; + char const *yyf; + static char const yyunexpected[] = "syntax error, unexpected %s"; + static char const yyexpecting[] = ", expecting %s"; + static char const yyor[] = " or %s"; + char yyformat[sizeof yyunexpected + + sizeof yyexpecting - 1 + + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) + * (sizeof yyor - 1))]; + char const *yyprefix = yyexpecting; + + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yycount = 1; + + yyarg[0] = yytname[yytype]; + yyfmt = yystpcpy (yyformat, yyunexpected); + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + yyformat[sizeof yyunexpected - 1] = '\0'; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + yyfmt = yystpcpy (yyfmt, yyprefix); + yyprefix = yyor; + } + + yyf = YY_(yyformat); + yysize1 = yysize + yystrlen (yyf); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + + if (yysize_overflow) + return YYSIZE_MAXIMUM; + + if (yyresult) + { + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + char *yyp = yyresult; + int yyi = 0; + while ((*yyp = *yyf) != '\0') + { + if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyf += 2; + } + else + { + yyp++; + yyf++; + } + } + } + return yysize; + } +} +#endif /* YYERROR_VERBOSE */ + + +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) +#else +static void +yydestruct (yymsg, yytype, yyvaluep) + const char *yymsg; + int yytype; + YYSTYPE *yyvaluep; +#endif +{ + YYUSE (yyvaluep); + + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + + switch (yytype) + { + + default: + break; + } +} + +/* Prevent warnings from -Wmissing-prototypes. */ +#ifdef YYPARSE_PARAM +#if defined __STDC__ || defined __cplusplus +int yyparse (void *YYPARSE_PARAM); +#else +int yyparse (); +#endif +#else /* ! YYPARSE_PARAM */ +#if defined __STDC__ || defined __cplusplus +int yyparse (void); +#else +int yyparse (); +#endif +#endif /* ! YYPARSE_PARAM */ + + +/* The lookahead symbol. */ +int yychar; + +/* The semantic value of the lookahead symbol. */ +YYSTYPE yylval; + +/* Number of syntax errors so far. */ +int yynerrs; + + + +/*-------------------------. +| yyparse or yypush_parse. | +`-------------------------*/ + +#ifdef YYPARSE_PARAM +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (void *YYPARSE_PARAM) +#else +int +yyparse (YYPARSE_PARAM) + void *YYPARSE_PARAM; +#endif +#else /* ! YYPARSE_PARAM */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (void) +#else +int +yyparse () + +#endif +#endif +{ + + + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + + /* The stacks and their tools: + `yyss': related to states. + `yyvs': related to semantic values. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; + + YYSIZE_T yystacksize; + + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken; + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; + + yytoken = 0; + yyss = yyssa; + yyvs = yyvsa; + yystacksize = YYINITDEPTH; + + YYDPRINTF ((stderr, "Starting parse\n")); + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + + /* Initialize stack pointers. + Waste one element of value and location stack + so that they stay on the same level as the state stack. + The wasted elements are never initialized. */ + yyssp = yyss; + yyvsp = yyvs; + + goto yysetstate; + +/*------------------------------------------------------------. +| yynewstate -- Push a new state, which is found in yystate. | +`------------------------------------------------------------*/ + yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. So pushing a state here evens the stacks. */ + yyssp++; + + yysetstate: + *yyssp = yystate; + + if (yyss + yystacksize - 1 <= yyssp) + { + /* Get the current used size of the three stacks, in elements. */ + YYSIZE_T yysize = yyssp - yyss + 1; + +#ifdef yyoverflow + { + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yystacksize); + + yyss = yyss1; + yyvs = yyvs1; + } +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyexhaustedlab; +# else + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + goto yyexhaustedlab; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif +#endif /* no yyoverflow */ + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; + + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + + if (yystate == YYFINAL) + YYACCEPT; + + goto yybackup; + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: + + /* Do appropriate processing given the current state. Read a + lookahead token if we need one and don't already have one. */ + + /* First try to decide what to do without reference to lookahead token. */ + yyn = yypact[yystate]; + if (yyn == YYPACT_NINF) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = YYLEX; + } + + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + goto yydefault; + yyn = yytable[yyn]; + if (yyn <= 0) + { + if (yyn == 0 || yyn == YYTABLE_NINF) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + /* Shift the lookahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the shifted token. */ + yychar = YYEMPTY; + + yystate = yyn; + *++yyvsp = yylval; + + goto yynewstate; + + +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ +yyreduce: + /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; + + /* If YYLEN is nonzero, implement the default value of the action: + `$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + + + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 2: + +/* Line 1464 of yacc.c */ +#line 93 "bforce/expression.y" + { + DEB((D_EVENT, "[yacc] expression return %d", (yyvsp[(1) - (1)]))); + expr_result = (yyvsp[(1) - (1)]); + } + break; + + case 3: + +/* Line 1464 of yacc.c */ +#line 99 "bforce/expression.y" + { + DEB((D_EVENT, "[yacc] elemexp return %d", (yyvsp[(1) - (1)]))); + (yyval) = (yyvsp[(1) - (1)]); + } + break; + + case 4: + +/* Line 1464 of yacc.c */ +#line 104 "bforce/expression.y" + { + DEB((D_EVENT, "[yacc] not exprression %d", (yyvsp[(2) - (2)]))); + if( ((yyvsp[(2) - (2)])) < 0 ) + (yyval) = 0; + else + (yyval) = !((yyvsp[(2) - (2)])); + } + break; + + case 5: + +/* Line 1464 of yacc.c */ +#line 112 "bforce/expression.y" + { + (yyval) = expr_check_logic((yyvsp[(1) - (3)]), (yyvsp[(2) - (3)]), (yyvsp[(3) - (3)])); + } + break; + + case 6: + +/* Line 1464 of yacc.c */ +#line 116 "bforce/expression.y" + { + DEB((D_EVENT, "eventexp: [yacc] backeted.expr %d", (yyvsp[(2) - (3)]))); + (yyval) = (yyvsp[(2) - (3)]); + } + break; + + case 7: + +/* Line 1464 of yacc.c */ +#line 122 "bforce/expression.y" + { + (yyval) = expr_check_incoming(); + } + break; + + case 8: + +/* Line 1464 of yacc.c */ +#line 126 "bforce/expression.y" + { + (yyval) = expr_check_outgoing(); + } + break; + + case 9: + +/* Line 1464 of yacc.c */ +#line 130 "bforce/expression.y" + { + (yyval) = expr_check_listed(); + } + break; + + case 10: + +/* Line 1464 of yacc.c */ +#line 134 "bforce/expression.y" + { + (yyval) = expr_check_protected(); + } + break; + + case 11: + +/* Line 1464 of yacc.c */ +#line 138 "bforce/expression.y" + { + (yyval) = (yyvsp[(2) - (2)]); + } + break; + + case 12: + +/* Line 1464 of yacc.c */ +#line 142 "bforce/expression.y" + { + if( state.valid && state.connspeed > 0 ) + (yyval) = expr_check_arop(state.connspeed, (yyvsp[(2) - (3)]), (yyvsp[(3) - (3)])); + else + (yyval) = -1; + } + break; + + case 13: + +/* Line 1464 of yacc.c */ +#line 149 "bforce/expression.y" + { + if( state.valid && state.node.speed > 0 ) + (yyval) = expr_check_arop(state.node.speed, (yyvsp[(2) - (3)]), (yyvsp[(3) - (3)])); + else + (yyval) = -1; + } + break; + + case 14: + +/* Line 1464 of yacc.c */ +#line 156 "bforce/expression.y" + { + (yyval) = expr_check_arop(time_gmtoffset(), (yyvsp[(2) - (3)]), (yyvsp[(3) - (3)])); + } + break; + + case 15: + +/* Line 1464 of yacc.c */ +#line 160 "bforce/expression.y" + { + (yyval) = expr_check_phone(expr_p_text); + } + break; + + case 16: + +/* Line 1464 of yacc.c */ +#line 164 "bforce/expression.y" + { + (yyval) = (yyvsp[(2) - (2)]); + } + break; + + case 17: + +/* Line 1464 of yacc.c */ +#line 168 "bforce/expression.y" + { + (yyval) = expr_check_exec(expr_p_text); + } + break; + + case 18: + +/* Line 1464 of yacc.c */ +#line 172 "bforce/expression.y" + { + (yyval) = expr_check_exist(expr_p_text); + } + break; + + case 19: + +/* Line 1464 of yacc.c */ +#line 176 "bforce/expression.y" + { + (yyval) = expr_check_port(expr_p_text); + } + break; + + case 20: + +/* Line 1464 of yacc.c */ +#line 180 "bforce/expression.y" + { + (yyval) = expr_check_mailer(expr_p_text); + } + break; + + case 21: + +/* Line 1464 of yacc.c */ +#line 184 "bforce/expression.y" + { + (yyval) = expr_check_addr(expr_p_text); + if( (yyval) == -2 ) + YYABORT; + } + break; + + case 22: + +/* Line 1464 of yacc.c */ +#line 191 "bforce/expression.y" + { + (yyval) = expr_check_flag(expr_p_text); + } + break; + + case 23: + +/* Line 1464 of yacc.c */ +#line 195 "bforce/expression.y" + { + (yyval) = expr_check_logic((yyvsp[(1) - (3)]), OR, (yyvsp[(3) - (3)])); + } + break; + + case 24: + +/* Line 1464 of yacc.c */ +#line 200 "bforce/expression.y" + { + (yyval) = expr_check_time(expr_p_text); + if( (yyval) == -2 ) + YYABORT; + } + break; + + case 25: + +/* Line 1464 of yacc.c */ +#line 206 "bforce/expression.y" + { + (yyval) = expr_check_logic((yyvsp[(1) - (3)]), OR, (yyvsp[(3) - (3)])); + } + break; -#define YYPREFIX "yy" -#define YYPURE 0 -#line 49 "bforce/expression.y" -#include "includes.h" -#include "confread.h" -#include "util.h" -#include "logger.h" -#include "session.h" -#include "nodelist.h" -#include "io.h" +/* Line 1464 of yacc.c */ +#line 1690 "y.tab.c" + default: break; + } + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); -static struct tm *now = NULL; -static int expr_result = 0; -static char *expr_p_pos = NULL; -static char *expr_p_text = NULL; + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); -/* - * These are expression element checkers (not only) - * Return values: - * 0 - FALSE - * 1 - TRUE - * -1 - cannot check, because some data is not available yet - * -2 - invalid element (we should not check this expression more) - */ -static int expr_check_incoming(void); -static int expr_check_outgoing(void); -static int expr_check_protected(void); -static int expr_check_listed(void); -static int expr_check_logic(int e1, int op, int e2); -static int expr_check_phone(const char *phone); -static int expr_check_arop(int num1, int op, int num2); -static int expr_check_flag(const char *str); -static int expr_check_exec(const char *str); -static int expr_check_exist(const char *str); -static int expr_check_port(const char *str); -static int expr_check_mailer(const char *str); -static int expr_check_addr(const char *str); -static int expr_check_time(const char *str); + *++yyvsp = yyval; -static int yylex(void); -static int yyparse(void); -static int yyerror(const char *s); + /* Now `shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ -#line 60 "y.tab.c" + yyn = yyr1[yyn]; -#ifndef YYSTYPE -typedef int YYSTYPE; -#endif + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTOKENS]; -/* compatibility with bison */ -#ifdef YYPARSE_PARAM -/* compatibility with FreeBSD */ -# ifdef YYPARSE_PARAM_TYPE -# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM) -# else -# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM) -# endif -#else -# define YYPARSE_DECL() yyparse(void) -#endif + goto yynewstate; -/* Parameters sent to lex. */ -#ifdef YYLEX_PARAM -# define YYLEX_DECL() yylex(void *YYLEX_PARAM) -# define YYLEX yylex(YYLEX_PARAM) + +/*------------------------------------. +| yyerrlab -- here on detecting error | +`------------------------------------*/ +yyerrlab: + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; +#if ! YYERROR_VERBOSE + yyerror (YY_("syntax error")); #else -# define YYLEX_DECL() yylex(void) -# define YYLEX yylex() -#endif - -/* Parameters sent to yyerror. */ -#ifndef YYERROR_DECL -#define YYERROR_DECL() yyerror(const char *s) -#endif -#ifndef YYERROR_CALL -#define YYERROR_CALL(msg) yyerror(msg) -#endif - -extern int YYPARSE_DECL(); - -#define COMMA 257 -#define TEXT 258 -#define NUMBER 259 -#define INCOMING 260 -#define OUTGOING 261 -#define LISTED 262 -#define PROTECTED 263 -#define CONNSPEED 264 -#define EXEC 265 -#define EXIST 266 -#define PORT 267 -#define MAILER 268 -#define TZ 269 -#define FLAG 270 -#define SPEED 271 -#define PHONE 272 -#define TIME 273 -#define ADDRESS 274 -#define EQ 275 -#define NE 276 -#define GT 277 -#define GE 278 -#define LT 279 -#define LE 280 -#define AND 281 -#define OR 282 -#define NOT 283 -#define XOR 284 -#define OPENB 285 -#define CLOSEB 286 -#define AROP 287 -#define LOGOP 288 -#define YYERRCODE 256 -static const short yylhs[] = { -1, - 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 3, 3, 4, 4, -}; -static const short yylen[] = { 2, - 1, 1, 2, 3, 3, 1, 1, 1, 1, 2, - 3, 3, 3, 2, 2, 2, 2, 2, 2, 1, - 1, 3, 1, 3, -}; -static const short yydefred[] = { 0, - 20, 6, 7, 8, 9, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, - 0, 16, 17, 18, 19, 0, 0, 10, 0, 14, - 0, 15, 0, 0, 0, 11, 13, 0, 12, 0, - 5, 0, 22, 24, -}; -static const short yydgoto[] = { 18, - 19, 20, 28, 32, -}; -static const short yysindex[] = { -251, - 0, 0, 0, 0, 0, -287, -255, -254, -250, -232, - -259, -229, -257, -227, -225, -251, -251, 0, -253, 0, - -223, 0, 0, 0, 0, -222, -219, 0, -220, 0, - -217, 0, -253, -261, -251, 0, 0, -229, 0, -225, - 0, -253, 0, 0, -}; -static const short yyrindex[] = { 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 41, 0, - 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, - 2, 0, 5, 0, 0, 0, 0, 0, 0, 0, - 0, 6, 0, 0, -}; -static const short yygindex[] = { 0, - 7, 0, 8, 3, -}; -#define YYTABLESIZE 292 -static const short yytable[] = { 21, - 21, 23, 22, 23, 3, 4, 1, 24, 2, 3, - 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - 14, 15, 33, 34, 41, 25, 35, 26, 27, 29, - 30, 16, 31, 17, 35, 36, 37, 38, 39, 40, - 1, 42, 44, 0, 0, 43, 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, 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, 21, 23, 21, 23, - 3, 4, -}; -static const short yycheck[] = { 287, - 0, 0, 258, 258, 0, 0, 258, 258, 260, 261, - 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, - 272, 273, 16, 17, 286, 258, 288, 287, 258, 287, - 258, 283, 258, 285, 288, 259, 259, 257, 259, 257, - 0, 35, 40, -1, -1, 38, -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, -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, 286, 286, 288, 288, - 286, 286, -}; -#define YYFINAL 18 -#ifndef YYDEBUG -#define YYDEBUG 0 + { + YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); + if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) + { + YYSIZE_T yyalloc = 2 * yysize; + if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) + yyalloc = YYSTACK_ALLOC_MAXIMUM; + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yyalloc); + if (yymsg) + yymsg_alloc = yyalloc; + else + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + } + } + + if (0 < yysize && yysize <= yymsg_alloc) + { + (void) yysyntax_error (yymsg, yystate, yychar); + yyerror (yymsg); + } + else + { + yyerror (YY_("syntax error")); + if (yysize != 0) + goto yyexhaustedlab; + } + } #endif -#define YYMAXTOKEN 288 -#if YYDEBUG -static const char *yyname[] = { - -"end-of-file",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,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,"COMMA","TEXT","NUMBER", -"INCOMING","OUTGOING","LISTED","PROTECTED","CONNSPEED","EXEC","EXIST","PORT", -"MAILER","TZ","FLAG","SPEED","PHONE","TIME","ADDRESS","EQ","NE","GT","GE","LT", -"LE","AND","OR","NOT","XOR","OPENB","CLOSEB","AROP","LOGOP", -}; -static const char *yyrule[] = { -"$accept : fullline", -"fullline : expression", -"expression : elemexp", -"expression : NOT expression", -"expression : expression LOGOP expression", -"expression : OPENB expression CLOSEB", -"elemexp : INCOMING", -"elemexp : OUTGOING", -"elemexp : LISTED", -"elemexp : PROTECTED", -"elemexp : FLAG flagstring", -"elemexp : CONNSPEED AROP NUMBER", -"elemexp : SPEED AROP NUMBER", -"elemexp : TZ AROP NUMBER", -"elemexp : PHONE TEXT", -"elemexp : TIME timestring", -"elemexp : EXEC TEXT", -"elemexp : EXIST TEXT", -"elemexp : PORT TEXT", -"elemexp : MAILER TEXT", -"elemexp : TEXT", -"flagstring : TEXT", -"flagstring : TEXT COMMA flagstring", -"timestring : TEXT", -"timestring : TEXT COMMA timestring", + } -}; -#endif -int yydebug; -int yynerrs; -int yyerrflag; -int yychar; -YYSTYPE yyval; -YYSTYPE yylval; + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ -/* define the initial stack-sizes */ -#ifdef YYSTACKSIZE -#undef YYMAXDEPTH -#define YYMAXDEPTH YYSTACKSIZE -#else -#ifdef YYMAXDEPTH -#define YYSTACKSIZE YYMAXDEPTH -#else -#define YYSTACKSIZE 500 -#define YYMAXDEPTH 500 + if (yychar <= YYEOF) + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } + else + { + yydestruct ("Error: discarding", + yytoken, &yylval); + yychar = YYEMPTY; + } + } + + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; + + +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (/*CONSTCOND*/ 0) + goto yyerrorlab; + + /* Do not reclaim the symbols of the rule which action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + yystate = *yyssp; + goto yyerrlab1; + + +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ + + for (;;) + { + yyn = yypact[yystate]; + if (yyn != YYPACT_NINF) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; + + + yydestruct ("Error: popping", + yystos[yystate], yyvsp); + YYPOPSTACK (1); + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); + } + + *++yyvsp = yylval; + + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + + yystate = yyn; + goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +#if !defined(yyoverflow) || YYERROR_VERBOSE +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (YY_("memory exhausted")); + yyresult = 2; + /* Fall through. */ +#endif + +yyreturn: + if (yychar != YYEMPTY) + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval); + /* Do not reclaim the symbols of the rule which action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp); + YYPOPSTACK (1); + } +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); #endif +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); #endif + /* Make sure YYID is used. */ + return YYID (yyresult); +} + -#define YYINITSTACKSIZE 500 -typedef struct { - unsigned stacksize; - short *s_base; - short *s_mark; - short *s_last; - YYSTYPE *l_base; - YYSTYPE *l_mark; -} YYSTACKDATA; -/* variables for the parser stack */ -static YYSTACKDATA yystack; -#line 211 "bforce/expression.y" +/* Line 1684 of yacc.c */ +#line 210 "bforce/expression.y" + #include "expression_lex.c" @@ -545,432 +2133,4 @@ static int yyerror(const char *str) return 0; } -#line 548 "y.tab.c" - -#if YYDEBUG -#include /* needed for printf */ -#endif - -#include /* needed for malloc, etc */ -#include /* needed for memset */ - -/* allocate initial stack or double stack size, up to YYMAXDEPTH */ -static int yygrowstack(YYSTACKDATA *data) -{ - int i; - unsigned newsize; - short *newss; - YYSTYPE *newvs; - - if ((newsize = data->stacksize) == 0) - newsize = YYINITSTACKSIZE; - else if (newsize >= YYMAXDEPTH) - return -1; - else if ((newsize *= 2) > YYMAXDEPTH) - newsize = YYMAXDEPTH; - - i = data->s_mark - data->s_base; - newss = (short *)realloc(data->s_base, newsize * sizeof(*newss)); - if (newss == 0) - return -1; - - data->s_base = newss; - data->s_mark = newss + i; - - newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs)); - if (newvs == 0) - return -1; - - data->l_base = newvs; - data->l_mark = newvs + i; - - data->stacksize = newsize; - data->s_last = data->s_base + newsize - 1; - return 0; -} - -#if YYPURE || defined(YY_NO_LEAKS) -static void yyfreestack(YYSTACKDATA *data) -{ - free(data->s_base); - free(data->l_base); - memset(data, 0, sizeof(*data)); -} -#else -#define yyfreestack(data) /* nothing */ -#endif - -#define YYABORT goto yyabort -#define YYREJECT goto yyabort -#define YYACCEPT goto yyaccept -#define YYERROR goto yyerrlab - -int -YYPARSE_DECL() -{ - int yym, yyn, yystate; -#if YYDEBUG - const char *yys; - - if ((yys = getenv("YYDEBUG")) != 0) - { - yyn = *yys; - if (yyn >= '0' && yyn <= '9') - yydebug = yyn - '0'; - } -#endif - - yynerrs = 0; - yyerrflag = 0; - yychar = YYEMPTY; - yystate = 0; - -#if YYPURE - memset(&yystack, 0, sizeof(yystack)); -#endif - - if (yystack.s_base == NULL && yygrowstack(&yystack)) goto yyoverflow; - yystack.s_mark = yystack.s_base; - yystack.l_mark = yystack.l_base; - yystate = 0; - *yystack.s_mark = 0; - -yyloop: - if ((yyn = yydefred[yystate]) != 0) goto yyreduce; - if (yychar < 0) - { - if ((yychar = YYLEX) < 0) yychar = 0; -#if YYDEBUG - if (yydebug) - { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; - printf("%sdebug: state %d, reading %d (%s)\n", - YYPREFIX, yystate, yychar, yys); - } -#endif - } - if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yychar) - { -#if YYDEBUG - if (yydebug) - printf("%sdebug: state %d, shifting to state %d\n", - YYPREFIX, yystate, yytable[yyn]); -#endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack)) - { - goto yyoverflow; - } - yystate = yytable[yyn]; - *++yystack.s_mark = yytable[yyn]; - *++yystack.l_mark = yylval; - yychar = YYEMPTY; - if (yyerrflag > 0) --yyerrflag; - goto yyloop; - } - if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yychar) - { - yyn = yytable[yyn]; - goto yyreduce; - } - if (yyerrflag) goto yyinrecovery; - - yyerror("syntax error"); - - goto yyerrlab; - -yyerrlab: - ++yynerrs; - -yyinrecovery: - if (yyerrflag < 3) - { - yyerrflag = 3; - for (;;) - { - if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) - { -#if YYDEBUG - if (yydebug) - printf("%sdebug: state %d, error recovery shifting\ - to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]); -#endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack)) - { - goto yyoverflow; - } - yystate = yytable[yyn]; - *++yystack.s_mark = yytable[yyn]; - *++yystack.l_mark = yylval; - goto yyloop; - } - else - { -#if YYDEBUG - if (yydebug) - printf("%sdebug: error recovery discarding state %d\n", - YYPREFIX, *yystack.s_mark); -#endif - if (yystack.s_mark <= yystack.s_base) goto yyabort; - --yystack.s_mark; - --yystack.l_mark; - } - } - } - else - { - if (yychar == 0) goto yyabort; -#if YYDEBUG - if (yydebug) - { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; - printf("%sdebug: state %d, error recovery discards token %d (%s)\n", - YYPREFIX, yystate, yychar, yys); - } -#endif - yychar = YYEMPTY; - goto yyloop; - } - -yyreduce: -#if YYDEBUG - if (yydebug) - printf("%sdebug: state %d, reducing by rule %d (%s)\n", - YYPREFIX, yystate, yyn, yyrule[yyn]); -#endif - yym = yylen[yyn]; - if (yym) - yyval = yystack.l_mark[1-yym]; - else - memset(&yyval, 0, sizeof yyval); - switch (yyn) - { -case 1: -#line 93 "bforce/expression.y" - { - DEB((D_EVENT, "[yacc] expression return %d", yystack.l_mark[0])); - expr_result = yystack.l_mark[0]; - } -break; -case 2: -#line 99 "bforce/expression.y" - { - DEB((D_EVENT, "[yacc] elemexp return %d", yystack.l_mark[0])); - yyval = yystack.l_mark[0]; - } -break; -case 3: -#line 104 "bforce/expression.y" - { - DEB((D_EVENT, "[yacc] not exprression %d", yystack.l_mark[0])); - if( (yystack.l_mark[0]) < 0 ) - yyval = 0; - else - yyval = !(yystack.l_mark[0]); - } -break; -case 4: -#line 112 "bforce/expression.y" - { - yyval = expr_check_logic(yystack.l_mark[-2], yystack.l_mark[-1], yystack.l_mark[0]); - } -break; -case 5: -#line 116 "bforce/expression.y" - { - DEB((D_EVENT, "eventexp: [yacc] backeted.expr %d", yystack.l_mark[-1])); - yyval = yystack.l_mark[-1]; - } -break; -case 6: -#line 122 "bforce/expression.y" - { - yyval = expr_check_incoming(); - } -break; -case 7: -#line 126 "bforce/expression.y" - { - yyval = expr_check_outgoing(); - } -break; -case 8: -#line 130 "bforce/expression.y" - { - yyval = expr_check_listed(); - } -break; -case 9: -#line 134 "bforce/expression.y" - { - yyval = expr_check_protected(); - } -break; -case 10: -#line 138 "bforce/expression.y" - { - yyval = yystack.l_mark[0]; - } -break; -case 11: -#line 142 "bforce/expression.y" - { - if( state.valid && state.connspeed > 0 ) - yyval = expr_check_arop(state.connspeed, yystack.l_mark[-1], yystack.l_mark[0]); - else - yyval = -1; - } -break; -case 12: -#line 149 "bforce/expression.y" - { - if( state.valid && state.node.speed > 0 ) - yyval = expr_check_arop(state.node.speed, yystack.l_mark[-1], yystack.l_mark[0]); - else - yyval = -1; - } -break; -case 13: -#line 156 "bforce/expression.y" - { - yyval = expr_check_arop(time_gmtoffset(), yystack.l_mark[-1], yystack.l_mark[0]); - } -break; -case 14: -#line 160 "bforce/expression.y" - { - yyval = expr_check_phone(expr_p_text); - } -break; -case 15: -#line 164 "bforce/expression.y" - { - yyval = yystack.l_mark[0]; - } -break; -case 16: -#line 168 "bforce/expression.y" - { - yyval = expr_check_exec(expr_p_text); - } -break; -case 17: -#line 172 "bforce/expression.y" - { - yyval = expr_check_exist(expr_p_text); - } -break; -case 18: -#line 176 "bforce/expression.y" - { - yyval = expr_check_port(expr_p_text); - } -break; -case 19: -#line 180 "bforce/expression.y" - { - yyval = expr_check_mailer(expr_p_text); - } -break; -case 20: -#line 184 "bforce/expression.y" - { - yyval = expr_check_addr(expr_p_text); - if( yyval == -2 ) - YYABORT; - } -break; -case 21: -#line 191 "bforce/expression.y" - { - yyval = expr_check_flag(expr_p_text); - } -break; -case 22: -#line 195 "bforce/expression.y" - { - yyval = expr_check_logic(yystack.l_mark[-2], OR, yystack.l_mark[0]); - } -break; -case 23: -#line 200 "bforce/expression.y" - { - yyval = expr_check_time(expr_p_text); - if( yyval == -2 ) - YYABORT; - } -break; -case 24: -#line 206 "bforce/expression.y" - { - yyval = expr_check_logic(yystack.l_mark[-2], OR, yystack.l_mark[0]); - } -break; -#line 915 "y.tab.c" - } - yystack.s_mark -= yym; - yystate = *yystack.s_mark; - yystack.l_mark -= yym; - yym = yylhs[yyn]; - if (yystate == 0 && yym == 0) - { -#if YYDEBUG - if (yydebug) - printf("%sdebug: after reduction, shifting from state 0 to\ - state %d\n", YYPREFIX, YYFINAL); -#endif - yystate = YYFINAL; - *++yystack.s_mark = YYFINAL; - *++yystack.l_mark = yyval; - if (yychar < 0) - { - if ((yychar = YYLEX) < 0) yychar = 0; -#if YYDEBUG - if (yydebug) - { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; - printf("%sdebug: state %d, reading %d (%s)\n", - YYPREFIX, YYFINAL, yychar, yys); - } -#endif - } - if (yychar == 0) goto yyaccept; - goto yyloop; - } - if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yystate) - yystate = yytable[yyn]; - else - yystate = yydgoto[yym]; -#if YYDEBUG - if (yydebug) - printf("%sdebug: after reduction, shifting from state %d \ -to state %d\n", YYPREFIX, *yystack.s_mark, yystate); -#endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack)) - { - goto yyoverflow; - } - *++yystack.s_mark = (short) yystate; - *++yystack.l_mark = yyval; - goto yyloop; - -yyoverflow: - yyerror("yacc stack overflow"); -yyabort: - yyfreestack(&yystack); - return (1); - -yyaccept: - yyfreestack(&yystack); - return (0); -} diff --git a/source/bforce/prot_binkp.c b/source/bforce/prot_binkp.c index bc2f257..91f5263 100644 --- a/source/bforce/prot_binkp.c +++ b/source/bforce/prot_binkp.c @@ -137,6 +137,8 @@ int binkp_loop(s_binkp_state *bstate) { return PRC_ERROR; } writebuf[1] = block_length&0xff; + if (bstate->mode==bmode_transfer && bstate->remote_data->options&BINKP_OPT_CRYPT) + encrypt_buf(writebuf, have_to_write, bstate->remote_data->keys_out); } if (m==2 || m==3) { DEB((D_24554, "no more to send")); @@ -204,6 +206,8 @@ int binkp_loop(s_binkp_state *bstate) { log("read: remote socket shutdown"); return PRC_REMOTEABORTED; } + if (bstate->mode==bmode_transfer && bstate->remote_data->options & BINKP_OPT_CRYPT) + decrypt_buf(readbuf+read_pos, n, bstate->remote_data->keys_in); DEB((D_24554, "got %d bytes", n)); want_read -= n; read_pos += n; @@ -266,6 +270,11 @@ int binkp_loop(s_binkp_state *bstate) { int binkp_outgoing(s_binkp_sysinfo *local_data, s_binkp_sysinfo *remote_data) { + char *p; + init_keys(remote_data->keys_out, local_data->passwd ? local_data->passwd : "-"); + init_keys(remote_data->keys_in, "-"); + for (p=local_data->passwd ? local_data->passwd : "-"; *p; p++) + update_keys(remote_data->keys_in, (int)*p); s_binkp_state s; s.mode = bmode_outgoing_handshake; s.local_data = local_data; @@ -399,7 +408,7 @@ case 6: case 7: if (bstate->mode==bmode_outgoing_handshake) { buf[0]=BPMSG_NUL; - strcpy(buf+1, "OPT MB"); + strcpy(buf+1, "OPT MB CRYPT"); if (!nodelist_checkflag (state.node.flags, "NR")) strcat(buf+1, " NR"); // ND is too complicated and have unclear gain @@ -506,6 +515,15 @@ case 4: if (bstate->mode==bmode_incoming_handshake) { DEB((D_24554, "incoming handshake is complete")); bstate->complete = true; + char *p; + char pbuf[32]; + for (i=0;iremote_data->keys_in, pbuf?pbuf:"-"); + init_keys(bstate->remote_data->keys_out, "-"); + for (p=pbuf?pbuf:"-"; *p; p++) + update_keys(bstate->remote_data->keys_out, (int)*p); + } } else { DEB((D_24554, "outgoing handshake: everything is sent")); diff --git a/source/bforce/prot_binkp_crypt.c b/source/bforce/prot_binkp_crypt.c new file mode 100644 index 0000000..950c3f2 --- /dev/null +++ b/source/bforce/prot_binkp_crypt.c @@ -0,0 +1,148 @@ +/* + * crypt.c -- crypt binkp traffic + * + * crypt.c is a part of binkd project + * + * Copyright (c) 1990-2000 Info-ZIP. + * Copyright (C) 2001 Pavel Gulchouck 2:463/68 + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. See COPYING. + * + * This encryption code is a direct transcription of the algorithm from + * Roger Schlafly. + */ +/* + * $Id: crypt.c,v 2.4 2005/10/10 15:44:24 stas Exp $ + * + * $Log: crypt.c,v $ + * Revision 2.4 2005/10/10 15:44:24 stas + * Move CRC32's define into crypt.h + * + * Revision 2.3 2001/02/21 06:25:21 gul + * changed crlf to cr in the source file + * + * Revision 2.2 2001/02/20 12:01:50 gul + * rename encrypt to encrypt_buf to avoid conflict with unistd.h + * + * Revision 2.1 2001/02/15 16:05:59 gul + * crypt bugfix + * + * Revision 2.0 2001/02/15 11:02:16 gul + * Added crypt traffic possibility + * + * + */ + +#include "includes.h" +#include "session.h" +#include "prot_common.h" +#include "prot_binkp.h" + +unsigned long crc_32_tab[256] = { + 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L, + 0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L, + 0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L, + 0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL, + 0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L, + 0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L, + 0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L, + 0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL, + 0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L, + 0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL, + 0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L, + 0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L, + 0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L, + 0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL, + 0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL, + 0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L, + 0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL, + 0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L, + 0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L, + 0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L, + 0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL, + 0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L, + 0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L, + 0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL, + 0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L, + 0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L, + 0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L, + 0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L, + 0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L, + 0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL, + 0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL, + 0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L, + 0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L, + 0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL, + 0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL, + 0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L, + 0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL, + 0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L, + 0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL, + 0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L, + 0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL, + 0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L, + 0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L, + 0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL, + 0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L, + 0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L, + 0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L, + 0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L, + 0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L, + 0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L, + 0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL, + 0x2d02ef8dL +}; + +int update_keys (unsigned long keys[3], int c) +{ + int keyshift; + + keys[0] = CRC32(keys[0], c); + keys[1] += keys[0] & 0xff; + keys[1] = keys[1] * 134775813L + 1; + keyshift = (int)(keys[1] >> 24); + keys[2] = CRC32(keys[2], keyshift); + return c; +} + +void init_keys (unsigned long keys[3], const char *passwd) +{ + keys[0] = 305419896L; + keys[1] = 591751049L; + keys[2] = 878082192L; + while (*passwd) + { + update_keys(keys, (int)*passwd); + passwd++; + } +} + +int decrypt_byte (unsigned long keys[3]) +{ + unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an + * unpredictable manner on 16-bit systems; not a problem + * with any known compiler so far, though */ + + temp = ((unsigned)keys[2] & 0xffff) | 2; + return (int)(((temp * (temp ^ 1)) >> 8) & 0xff); +} + +void decrypt_buf (char *buf, unsigned int bufsize, unsigned long keys[3]) +{ + while (bufsize--) + update_keys(keys, *buf++ ^= decrypt_byte(keys)); +} + +void encrypt_buf (char *buf, unsigned int bufsize, unsigned long keys[3]) +{ + int t; + while (bufsize--) + { + t=decrypt_byte(keys); + update_keys(keys, *buf); + *buf++ ^= t; + } +} diff --git a/source/bforce/prot_binkp_misc.c b/source/bforce/prot_binkp_misc.c index 585dd4e..aa71ea2 100644 --- a/source/bforce/prot_binkp_misc.c +++ b/source/bforce/prot_binkp_misc.c @@ -140,6 +140,7 @@ void binkp_log_options(s_binkp_sysinfo *remote) { if (remote->options & BINKP_OPT_MB) log ("We are in MB mode."); if (remote->options & BINKP_OPT_NR) log ("We are in NR mode."); + if (remote->options & BINKP_OPT_CRYPT) log ("We are in CRYPT mode."); } /***************************************************************************** @@ -310,6 +311,9 @@ void binkp_parse_options(s_binkp_sysinfo *binkp, char *options) if( !strcmp(p, "NR") ) { binkp->options |= BINKP_OPT_NR; } else + if( !strcmp(p, "CRYPT") ) { + binkp->options |= BINKP_OPT_CRYPT; + } else if( !strcmp(p, "MB") ) binkp->options |= BINKP_OPT_MB; else if( !strcmp(p, "MPWD") ) diff --git a/source/include/config.h b/source/include/config.h index bd0eafe..1ba0e68 100644 --- a/source/include/config.h +++ b/source/include/config.h @@ -61,7 +61,7 @@ #define BFORCE_LOCK_DIR "/var/lock/" /* Do you want to use syslog? */ -#define USE_SYSLOG 1 +/* #undef USE_SYSLOG */ /* Netspool */ #define NETSPOOL 1 diff --git a/source/include/prot_binkp.h b/source/include/prot_binkp.h index e44c487..51d44ce 100644 --- a/source/include/prot_binkp.h +++ b/source/include/prot_binkp.h @@ -53,6 +53,7 @@ #define BINKP_OPT_MD5 0x08 /* CRAM-MD5 authentication */ #define BINKP_OPT_SHA1 0x10 /* CRAM-SHA1 authentication */ #define BINKP_OPT_DES 0x20 /* CRAM-DES authentication */ +#define BINKP_OPT_CRYPT 0x40 /* CRYPT support */ typedef enum binkp_mode { bmode_failoff, @@ -85,6 +86,8 @@ typedef struct { bool has_TRF; int TRF_PKT; int TRF_other; + unsigned long keys_out[3]; /* Encription keys for outbound */ + unsigned long keys_in[3]; /* Encription keys for inbound */ } s_binkp_sysinfo; @@ -180,5 +183,13 @@ int binkp_remote_traffic(s_handshake_protocol *THIS, s_traffic *dest); /* prot_binkp_api.c */ extern s_handshake_protocol handshake_protocol_binkp; +#define CRC32(c, b) (crc_32_tab[((int)(c) ^ (b)) & 0xff] ^ ((c) >> 8)) +extern unsigned long crc_32_tab[256]; + +int update_keys (unsigned long keys[3], int c); +void init_keys (unsigned long keys[3], const char *passwd); +int decrypt_byte (unsigned long keys[3]); +void decrypt_buf (char *buf, unsigned int bufsize, unsigned long keys[3]); +void encrypt_buf (char *buf, unsigned int bufsize, unsigned long keys[3]); #endif /* _P_BINKP_H_ */ From 5713fedeabb503fd76a03416f05902777a8363e3 Mon Sep 17 00:00:00 2001 From: Alexander Skovpen Date: Tue, 10 Jun 2014 21:31:49 +0400 Subject: [PATCH 06/11] removing unneeded --- debian/Makefile | 263 ----- source/Makefile | 203 ---- source/bforce/expression.c | 2136 ------------------------------------ source/include/config.h | 154 --- 4 files changed, 2756 deletions(-) delete mode 100644 debian/Makefile delete mode 100644 source/Makefile delete mode 100644 source/bforce/expression.c delete mode 100644 source/include/config.h diff --git a/debian/Makefile b/debian/Makefile deleted file mode 100644 index 4ba6be0..0000000 --- a/debian/Makefile +++ /dev/null @@ -1,263 +0,0 @@ -# Makefile.in generated by automake 1.8.3 from Makefile.am. -# ../debian/Makefile. Generated from Makefile.in by configure. - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ -srcdir = . -top_srcdir = ../.. - -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = /usr/bin/install -c -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = x86_64-unknown-linux-gnu -host_triplet = x86_64-unknown-linux-gnu -target_triplet = x86_64-unknown-linux-gnu -subdir = ../debian -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -am__aclocal_m4_deps = $(top_srcdir)/configure.in -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) -mkinstalldirs = $(mkdir_p) -CONFIG_HEADER = $(top_builddir)/include/config.h -CONFIG_CLEAN_FILES = -SOURCES = -DIST_SOURCES = -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -CC = gcc -CFLAGS = -g -O2 -CPP = gcc -E -CPPFLAGS = -DEFS = -DHAVE_CONFIG_H -ECHO_C = -ECHO_N = -n -ECHO_T = -EGREP = /bin/grep -E -EXEEXT = -GROUP = ftn -INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_PROGRAM = ${INSTALL} -INSTALL_SCRIPT = ${INSTALL} -LDFLAGS = -LIBOBJS = -LIBS = -LTLIBOBJS = -OBJEXT = o -OWNER = ftn -PACKAGE_BUGREPORT = sergey@fidoman.ru -PACKAGE_NAME = bforce -PACKAGE_STRING = bforce 0.24 -PACKAGE_TARNAME = bforce -PACKAGE_VERSION = 0.24 -PATH_SEPARATOR = : -SHELL = /bin/sh -YACC = bison -y -ac_ct_CC = gcc -bindir = ${exec_prefix}/bin -build = x86_64-unknown-linux-gnu -build_alias = -build_cpu = x86_64 -build_os = linux-gnu -build_vendor = unknown -datadir = ${prefix}/share -exec_prefix = ${prefix} -host = x86_64-unknown-linux-gnu -host_alias = -host_cpu = x86_64 -host_os = linux-gnu -host_vendor = unknown -includedir = ${prefix}/include -infodir = ${prefix}/share/info -libdir = ${exec_prefix}/lib -libexecdir = ${exec_prefix}/libexec -localstatedir = ${prefix}/var -mandir = ${prefix}/share/man -oldincludedir = /usr/include -prefix = /usr/local -program_transform_name = s,x,x, -sbindir = ${exec_prefix}/sbin -sharedstatedir = ${prefix}/com -sysconfdir = /usr/local/etc/ftn/bforce -target = x86_64-unknown-linux-gnu -target_alias = -target_cpu = x86_64 -target_os = linux-gnu -target_vendor = unknown - -# $Id$ -EXTRA_DIST = copyright changelog rules conffiles \ - control dirs init.d - -all: all-am - -.SUFFIXES: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu ../debian/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu ../debian/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -uninstall-info-am: -tags: TAGS -TAGS: - -ctags: CTAGS -CTAGS: - - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am - -.PHONY: all all-am check check-am clean clean-generic distclean \ - distclean-generic distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \ - uninstall-info-am - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/source/Makefile b/source/Makefile deleted file mode 100644 index 5b90c43..0000000 --- a/source/Makefile +++ /dev/null @@ -1,203 +0,0 @@ -# -# Copyright (c) 1999-2000, Alexander Belkin -# -# Copyright (c) 2004, Evgeniy Kozhuhovskiy -# -# $Id$ -# - -prefix=/usr/local -exec_prefix=${prefix} - -CC = gcc -INCLUDES = -I./include -CFLAGS = -g -O2 -fno-builtin -LIBS = -YACC = bison -y -INSTALL = /usr/bin/install -c -INSTALL_PROGRAM = ${INSTALL} -INSTALL_DATA = ${INSTALL} -m 644 -SRCDIR = . -SRCDIRCONF = $(SRCDIR)/../examples -CONTRIBDIR = $(SRCDIR)/../contrib - -OWNER = ftn -GROUP = ftn -CONFDIR = /usr/local/etc/ftn/bforce -BINDIR = ${exec_prefix}/bin -LOGDIR = /var/log/bforce -SPOOLDIR = /var/spool/bforce - -DAEMON_LOGFILE = $(LOGDIR)/bf-daemon -BFORCE_LOGFILE = $(LOGDIR)/bf-log -BFORCE_DEBFILE = $(LOGDIR)/bf-debug -BFORCE_DEBLEVEL = 0L -BFORCE_CFGFILE = $(CONFDIR)/bforce.conf - -DEFINES = -DDAEMON_LOGFILE=\"$(DAEMON_LOGFILE)\" \ - -DBFORCE_LOGFILE=\"$(BFORCE_LOGFILE)\" \ - -DBFORCE_DEBFILE=\"$(BFORCE_DEBFILE)\" \ - -DBFORCE_DEBLEVEL=$(BFORCE_DEBLEVEL) \ - -DBFORCE_CFGFILE=\"$(BFORCE_CFGFILE)\" \ - -DBF_OS=\"linux-gnu\" -DHAVE_CONFIG_H - -SUBDIRS = bforce bfutil - -BFINDEX_OBJS = bfutil/bfindex.o \ - bforce/conf_deinit.o bforce/conf_proc.o \ - bforce/conf_read.o bforce/conf_get.o \ - bforce/logger.o bforce/nodelist.o \ - bforce/u_file.o bforce/u_ftn.o \ - bforce/u_misc.o bforce/u_string.o \ - bforce/u_time.o - -NLOOKUP_OBJS = bfutil/nlookup.o \ - bforce/conf_deinit.o bforce/conf_proc.o \ - bforce/conf_read.o bforce/conf_get.o \ - bforce/logger.o bforce/nodelist.o \ - bforce/u_file.o bforce/u_ftn.o \ - bforce/u_misc.o bforce/u_string.o \ - bforce/u_time.o - -BFSTAT_OBJS = bfutil/bfstat.o \ - bforce/conf_deinit.o bforce/conf_proc.o \ - bforce/conf_read.o bforce/conf_get.o \ - bforce/outb_flo.o bforce/outb_fsqueue.o \ - bforce/sess_stat.o \ - bforce/outb_getname.o bforce/outb_sysqueue.o \ - bforce/outb_scan.o bforce/logger.o \ - bforce/u_file.o \ - bforce/u_ftn.o bforce/u_misc.o \ - bforce/u_string.o bforce/u_time.o \ - bforce/u_plock.o - -BFORCE_OBJS = bforce/bforce.o \ - bforce/daemon.o bforce/daemon_branch.o \ - bforce/daemon_call.o bforce/daemon_lines.o \ - bforce/conf_deinit.o \ - bforce/conf_proc.o bforce/conf_read.o \ - bforce/conf_get.o bforce/expression.o \ - bforce/freq_bark.o bforce/freq_proc.o \ - bforce/freq_srif.o bforce/freq_wazoo.o \ - bforce/io_modem.o bforce/io_tcpip.o \ - bforce/io_unix_lock.o bforce/io_unix_modem.o \ - bforce/io_unix_tio.o bforce/io_unix_tty.o \ - bforce/logger.o bforce/nodelist.o \ - bforce/os_unix.o bforce/outb_bsy.o \ - bforce/outb_flo.o bforce/outb_fsqueue.o \ - bforce/outb_getname.o bforce/outb_sysqueue.o \ - bforce/outb_scan.o bforce/prot_common.o \ - bforce/prot_binkp.o bforce/prot_binkp_api.o \ - bforce/prot_binkp_misc.o bforce/prot_hydra.o \ - bforce/prot_xmrecv.o bforce/prot_xmsend.o \ - bforce/prot_zmmisc.o bforce/prot_zmrecv.o \ - bforce/prot_zmsend.o \ - bforce/prot_yoohoo.o bforce/prot_yoohoo_api.o \ - bforce/prot_emsi.o bforce/prot_emsi_misc.o \ - bforce/prot_emsi_api.o \ - bforce/sess_common.o bforce/sess_stat.o \ - bforce/sess_call.o bforce/sess_answ.o \ - bforce/sess_init.o bforce/sess_main.o \ - bforce/u_crc.o bforce/u_ftn.o \ - bforce/u_md5.o \ - bforce/u_misc.o bforce/u_string.o \ - bforce/u_time.o bforce/u_file.o \ - bforce/u_pkt.o bforce/u_recode.o \ - bforce/u_plock.o bforce/netspool.o \ - bforce/prot_binkp_crypt.o - -.c.o: - @echo Compiling $*.c - @$(CC) $(CFLAGS) $(INCLUDES) $(DEFINES) -c $< -o $@ - -all: bin bin/bforce bin/bfindex bin/bfstat bin/nlookup - -bin: - test -d bin || mkdir bin - -bforce/expression.c: bforce/expression.y - $(YACC) bforce/expression.y - mv y.tab.c bforce/expression.c - -bin/bforce: $(BFLIB_OBJS) $(BFORCE_OBJS) - @echo "Linking $@" - @$(CC) $(BFLIB_OBJS) $(BFORCE_OBJS) $(LIBS) -o $@ - -bin/bfindex: $(BFLIB_OBJS) $(BFINDEX_OBJS) - @echo "Linking $@" - @$(CC) $(BFLIB_OBJS) $(BFINDEX_OBJS) $(LIBS) -o $@ - -bin/nlookup: $(BFLIB_OBJS) $(NLOOKUP_OBJS) - @echo "Linking $@" - @$(CC) $(BFLIB_OBJS) $(NLOOKUP_OBJS) $(LIBS) -o $@ - -bin/bfstat: $(BFLIB_OBJS) $(BFSTAT_OBJS) - @echo "Linking $@" - @$(CC) $(BFLIB_OBJS) $(BFSTAT_OBJS) $(LIBS) -o $@ - - -clean: - @for i in $(SUBDIRS); do (rm -f $$i/*.o || exit 1); done - rm -f ./bforce/expression.c - rm -f ./bin/bforce - rm -f ./bin/bfindex - rm -f ./bin/bfstat - rm -f ./bin/nlookup - rm -f ./bin/core -clean-am: - rm -f ./Makefile - rm -f ./include/config.h - rm -f ./config.log - rm -f ./config.status -clean-ac: - rm -f ./configure - -distclean: clean clean-am - -distclean-m: distclean clean-ac - - -ifnames: - @for i in $(SUBDIRS); do (ifnames $$i/*.c || exit 1); done - -bforce/expression.y.o: bforce/expression.y.c bforce/expression.l.c - -bforce/expression.l.o: bforce/expression.y.c bforce/expression.l.c - -installdirs: - if [ ! -d $(CONFDIR) ]; then mkdir -p $(CONFDIR); fi - if [ ! -d $(BINDIR) ]; then mkdir -p $(BINDIR); fi - if [ ! -d $(LOGDIR) ]; then mkdir -p $(LOGDIR); fi - if [ ! -d $(SPOOLDIR) ]; then mkdir -p $(SPOOLDIR); fi - if [ ! -d $(SPOOLDIR)/bt/in ]; then mkdir -p $(SPOOLDIR)/bt/in; fi - if [ ! -d $(SPOOLDIR)/bt/pin ]; then mkdir -p $(SPOOLDIR)/bt/pin; fi - if [ ! -d $(SPOOLDIR)/bt/out ]; then mkdir -p $(SPOOLDIR)/bt/out; fi - if [ ! -d $(SPOOLDIR)/ndl ]; then mkdir -p $(SPOOLDIR)/ndl; fi - if [ ! -d $(SPOOLDIR)/bforce ]; then mkdir -p $(SPOOLDIR); fi - chown $(OWNER):$(GROUP) $(CONFDIR) - chown $(OWNER):$(GROUP) $(LOGDIR) - chown $(OWNER):$(GROUP) $(SPOOLDIR)/bt/in - chown $(OWNER):$(GROUP) $(SPOOLDIR)/bt/pin - chown $(OWNER):$(GROUP) $(SPOOLDIR)/bt/out - chown $(OWNER):$(GROUP) $(SPOOLDIR)/ndl - chown $(OWNER):$(GROUP) $(SPOOLDIR) - -install-bin: - $(INSTALL_PROGRAM) -o $(OWNER) -g $(GROUP) $(SRCDIR)/bin/bforce $(BINDIR)/bforce - $(INSTALL_PROGRAM) -o $(OWNER) -g $(GROUP) $(SRCDIR)/bin/bfindex $(BINDIR)/bfindex - $(INSTALL_PROGRAM) -o $(OWNER) -g $(GROUP) $(SRCDIR)/bin/bfstat $(BINDIR)/bfstat - $(INSTALL_PROGRAM) -o $(OWNER) -g $(GROUP) $(SRCDIR)/bin/nlookup $(BINDIR)/nlookup - -install-config: - $(INSTALL_DATA) -o $(OWNER) -g $(GROUP) $(SRCDIRCONF)/bforce.conf $(CONFDIR)/bforce.conf.sample - $(INSTALL_DATA) -o $(OWNER) -g $(GROUP) $(SRCDIRCONF)/bforce.subst $(CONFDIR)/bforce.subst.sample - $(INSTALL_DATA) -o $(OWNER) -g $(GROUP) $(SRCDIRCONF)/bforce.passwd $(CONFDIR)/bforce.passwd.sample - $(INSTALL_DATA) -o $(OWNER) -g $(GROUP) $(SRCDIRCONF)/freq.aliases $(CONFDIR)/freq.aliases.sample - $(INSTALL_DATA) -o $(OWNER) -g $(GROUP) $(SRCDIRCONF)/freq.dirs $(CONFDIR)/freq.dirs.sample - -install-contrib: - $(INSTALL_PROGRAM) -o $(OWNER) -g $(GROUP) $(CONTRIBDIR)/outman $(BINDIR)/outman - @echo "Please, edit $(BINDIR)/outman" - -install: install-bin install-config - diff --git a/source/bforce/expression.c b/source/bforce/expression.c deleted file mode 100644 index e13e22f..0000000 --- a/source/bforce/expression.c +++ /dev/null @@ -1,2136 +0,0 @@ -/* A Bison parser, made by GNU Bison 2.4.3. */ - -/* Skeleton implementation for Bison's Yacc-like parsers in C - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2009, 2010 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 - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -/* 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. */ - -/* All symbols defined below should begin with yy or YY, to avoid - infringing on user name space. This should be done even for local - variables, as they might otherwise be expanded by user macros. - There are some unavoidable exceptions within include files to - define necessary library symbols; they are noted "INFRINGES ON - USER NAME SPACE" below. */ - -/* Identify Bison output. */ -#define YYBISON 1 - -/* Bison version. */ -#define YYBISON_VERSION "2.4.3" - -/* Skeleton name. */ -#define YYSKELETON_NAME "yacc.c" - -/* Pure parsers. */ -#define YYPURE 0 - -/* Push parsers. */ -#define YYPUSH 0 - -/* Pull parsers. */ -#define YYPULL 1 - -/* Using locations. */ -#define YYLSP_NEEDED 0 - - - -/* Copy the first part of user declarations. */ - -/* Line 189 of yacc.c */ -#line 48 "bforce/expression.y" - -#include "includes.h" -#include "confread.h" -#include "util.h" -#include "logger.h" -#include "session.h" -#include "nodelist.h" -#include "io.h" - -static struct tm *now = NULL; -static int expr_result = 0; -static char *expr_p_pos = NULL; -static char *expr_p_text = NULL; - -/* - * These are expression element checkers (not only) - * Return values: - * 0 - FALSE - * 1 - TRUE - * -1 - cannot check, because some data is not available yet - * -2 - invalid element (we should not check this expression more) - */ -static int expr_check_incoming(void); -static int expr_check_outgoing(void); -static int expr_check_protected(void); -static int expr_check_listed(void); -static int expr_check_logic(int e1, int op, int e2); -static int expr_check_phone(const char *phone); -static int expr_check_arop(int num1, int op, int num2); -static int expr_check_flag(const char *str); -static int expr_check_exec(const char *str); -static int expr_check_exist(const char *str); -static int expr_check_port(const char *str); -static int expr_check_mailer(const char *str); -static int expr_check_addr(const char *str); -static int expr_check_time(const char *str); - -static int yylex(void); -static int yyparse(void); -static int yyerror(const char *s); - - - -/* Line 189 of yacc.c */ -#line 116 "y.tab.c" - -/* Enabling traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif - -/* Enabling verbose error messages. */ -#ifdef YYERROR_VERBOSE -# undef YYERROR_VERBOSE -# define YYERROR_VERBOSE 1 -#else -# define YYERROR_VERBOSE 0 -#endif - -/* Enabling the token table. */ -#ifndef YYTOKEN_TABLE -# define YYTOKEN_TABLE 0 -#endif - - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - COMMA = 258, - TEXT = 259, - NUMBER = 260, - INCOMING = 261, - OUTGOING = 262, - LISTED = 263, - PROTECTED = 264, - CONNSPEED = 265, - EXEC = 266, - EXIST = 267, - PORT = 268, - MAILER = 269, - TZ = 270, - FLAG = 271, - SPEED = 272, - PHONE = 273, - TIME = 274, - ADDRESS = 275, - EQ = 276, - NE = 277, - GT = 278, - GE = 279, - LT = 280, - LE = 281, - AND = 282, - OR = 283, - NOT = 284, - XOR = 285, - OPENB = 286, - CLOSEB = 287, - AROP = 288, - LOGOP = 289 - }; -#endif -/* Tokens. */ -#define COMMA 258 -#define TEXT 259 -#define NUMBER 260 -#define INCOMING 261 -#define OUTGOING 262 -#define LISTED 263 -#define PROTECTED 264 -#define CONNSPEED 265 -#define EXEC 266 -#define EXIST 267 -#define PORT 268 -#define MAILER 269 -#define TZ 270 -#define FLAG 271 -#define SPEED 272 -#define PHONE 273 -#define TIME 274 -#define ADDRESS 275 -#define EQ 276 -#define NE 277 -#define GT 278 -#define GE 279 -#define LT 280 -#define LE 281 -#define AND 282 -#define OR 283 -#define NOT 284 -#define XOR 285 -#define OPENB 286 -#define CLOSEB 287 -#define AROP 288 -#define LOGOP 289 - - - - -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef int YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 -#endif - - -/* Copy the second part of user declarations. */ - - -/* Line 264 of yacc.c */ -#line 226 "y.tab.c" - -#ifdef short -# undef short -#endif - -#ifdef YYTYPE_UINT8 -typedef YYTYPE_UINT8 yytype_uint8; -#else -typedef unsigned char yytype_uint8; -#endif - -#ifdef YYTYPE_INT8 -typedef YYTYPE_INT8 yytype_int8; -#elif (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -typedef signed char yytype_int8; -#else -typedef short int yytype_int8; -#endif - -#ifdef YYTYPE_UINT16 -typedef YYTYPE_UINT16 yytype_uint16; -#else -typedef unsigned short int yytype_uint16; -#endif - -#ifdef YYTYPE_INT16 -typedef YYTYPE_INT16 yytype_int16; -#else -typedef short int yytype_int16; -#endif - -#ifndef YYSIZE_T -# ifdef __SIZE_TYPE__ -# define YYSIZE_T __SIZE_TYPE__ -# elif defined size_t -# define YYSIZE_T size_t -# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# else -# define YYSIZE_T unsigned int -# endif -#endif - -#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) - -#ifndef YY_ -# if defined YYENABLE_NLS && YYENABLE_NLS -# if ENABLE_NLS -# include /* INFRINGES ON USER NAME SPACE */ -# define YY_(msgid) dgettext ("bison-runtime", msgid) -# endif -# endif -# ifndef YY_ -# define YY_(msgid) msgid -# endif -#endif - -/* Suppress unused-variable warnings by "using" E. */ -#if ! defined lint || defined __GNUC__ -# define YYUSE(e) ((void) (e)) -#else -# define YYUSE(e) /* empty */ -#endif - -/* Identity function, used to suppress warnings about constant conditions. */ -#ifndef lint -# define YYID(n) (n) -#else -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static int -YYID (int yyi) -#else -static int -YYID (yyi) - int yyi; -#endif -{ - return yyi; -} -#endif - -#if ! defined yyoverflow || YYERROR_VERBOSE - -/* The parser invokes alloca or malloc; define the necessary symbols. */ - -# ifdef YYSTACK_USE_ALLOCA -# if YYSTACK_USE_ALLOCA -# ifdef __GNUC__ -# define YYSTACK_ALLOC __builtin_alloca -# elif defined __BUILTIN_VA_ARG_INCR -# include /* INFRINGES ON USER NAME SPACE */ -# elif defined _AIX -# define YYSTACK_ALLOC __alloca -# elif defined _MSC_VER -# include /* INFRINGES ON USER NAME SPACE */ -# define alloca _alloca -# else -# define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -# include /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 -# endif -# endif -# endif -# endif -# endif - -# ifdef YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) -# ifndef YYSTACK_ALLOC_MAXIMUM - /* The OS might guarantee only one guard page at the bottom of the stack, - and a page size can be as small as 4096 bytes. So we cannot safely - invoke alloca (N) if N exceeds 4096. Use a slightly smaller number - to allow for a few compiler-allocated temporary stack slots. */ -# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ -# endif -# else -# define YYSTACK_ALLOC YYMALLOC -# define YYSTACK_FREE YYFREE -# ifndef YYSTACK_ALLOC_MAXIMUM -# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM -# endif -# if (defined __cplusplus && ! defined _STDLIB_H \ - && ! ((defined YYMALLOC || defined malloc) \ - && (defined YYFREE || defined free))) -# include /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 -# endif -# endif -# ifndef YYMALLOC -# define YYMALLOC malloc -# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# ifndef YYFREE -# define YYFREE free -# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -void free (void *); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# endif -#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ - - -#if (! defined yyoverflow \ - && (! defined __cplusplus \ - || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) - -/* A type that is properly aligned for any stack member. */ -union yyalloc -{ - yytype_int16 yyss_alloc; - YYSTYPE yyvs_alloc; -}; - -/* The size of the maximum gap between one aligned stack and the next. */ -# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) - -/* The size of an array large to enough to hold all stacks, each with - N elements. */ -# define YYSTACK_BYTES(N) \ - ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ - + YYSTACK_GAP_MAXIMUM) - -/* Copy COUNT objects from FROM to TO. The source and destination do - not overlap. */ -# ifndef YYCOPY -# if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(To, From, Count) \ - __builtin_memcpy (To, From, (Count) * sizeof (*(From))) -# else -# define YYCOPY(To, From, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (To)[yyi] = (From)[yyi]; \ - } \ - while (YYID (0)) -# endif -# endif - -/* Relocate STACK from its old location to the new one. The - local variables YYSIZE and YYSTACKSIZE give the old and new number of - elements in the stack, and YYPTR gives the new location of the - stack. Advance YYPTR to a properly aligned location for the next - stack. */ -# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ - Stack = &yyptr->Stack_alloc; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ - } \ - while (YYID (0)) - -#endif - -/* YYFINAL -- State number of the termination state. */ -#define YYFINAL 35 -/* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 43 - -/* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 35 -/* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 6 -/* YYNRULES -- Number of rules. */ -#define YYNRULES 25 -/* YYNRULES -- Number of states. */ -#define YYNSTATES 46 - -/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ -#define YYUNDEFTOK 2 -#define YYMAXUTOK 289 - -#define YYTRANSLATE(YYX) \ - ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) - -/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ -static const yytype_uint8 yytranslate[] = -{ - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34 -}; - -#if YYDEBUG -/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in - YYRHS. */ -static const yytype_uint8 yyprhs[] = -{ - 0, 0, 3, 5, 7, 10, 14, 18, 20, 22, - 24, 26, 29, 33, 37, 41, 44, 47, 50, 53, - 56, 59, 61, 63, 67, 69 -}; - -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const yytype_int8 yyrhs[] = -{ - 36, 0, -1, 37, -1, 38, -1, 29, 37, -1, - 37, 34, 37, -1, 31, 37, 32, -1, 6, -1, - 7, -1, 8, -1, 9, -1, 16, 39, -1, 10, - 33, 5, -1, 17, 33, 5, -1, 15, 33, 5, - -1, 18, 4, -1, 19, 40, -1, 11, 4, -1, - 12, 4, -1, 13, 4, -1, 14, 4, -1, 4, - -1, 4, -1, 4, 3, 39, -1, 4, -1, 4, - 3, 40, -1 -}; - -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ -static const yytype_uint8 yyrline[] = -{ - 0, 92, 92, 98, 103, 111, 115, 121, 125, 129, - 133, 137, 141, 148, 155, 159, 163, 167, 171, 175, - 179, 183, 190, 194, 199, 205 -}; -#endif - -#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE -/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - First, the terminals, then, starting at YYNTOKENS, nonterminals. */ -static const char *const yytname[] = -{ - "$end", "error", "$undefined", "COMMA", "TEXT", "NUMBER", "INCOMING", - "OUTGOING", "LISTED", "PROTECTED", "CONNSPEED", "EXEC", "EXIST", "PORT", - "MAILER", "TZ", "FLAG", "SPEED", "PHONE", "TIME", "ADDRESS", "EQ", "NE", - "GT", "GE", "LT", "LE", "AND", "OR", "NOT", "XOR", "OPENB", "CLOSEB", - "AROP", "LOGOP", "$accept", "fullline", "expression", "elemexp", - "flagstring", "timestring", 0 -}; -#endif - -# ifdef YYPRINT -/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to - token YYLEX-NUM. */ -static const yytype_uint16 yytoknum[] = -{ - 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289 -}; -# endif - -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = -{ - 0, 35, 36, 37, 37, 37, 37, 38, 38, 38, - 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, - 38, 38, 39, 39, 40, 40 -}; - -/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = -{ - 0, 2, 1, 1, 2, 3, 3, 1, 1, 1, - 1, 2, 3, 3, 3, 2, 2, 2, 2, 2, - 2, 1, 1, 3, 1, 3 -}; - -/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state - STATE-NUM when YYTABLE doesn't specify something else to do. Zero - means the default is an error. */ -static const yytype_uint8 yydefact[] = -{ - 0, 21, 7, 8, 9, 10, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, - 3, 0, 17, 18, 19, 20, 0, 22, 11, 0, - 15, 24, 16, 4, 0, 1, 0, 12, 14, 0, - 13, 0, 6, 5, 23, 25 -}; - -/* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_int8 yydefgoto[] = -{ - -1, 18, 19, 20, 28, 32 -}; - -/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ -#define YYPACT_NINF -33 -static const yytype_int8 yypact[] = -{ - -4, -33, -33, -33, -33, -33, -32, 15, 17, 18, - 19, -9, 22, -5, 25, 26, -4, -4, 31, -2, - -33, 28, -33, -33, -33, -33, 29, 32, -33, 33, - -33, 34, -33, -2, -14, -33, -4, -33, -33, 22, - -33, 26, -33, -2, -33, -33 -}; - -/* YYPGOTO[NTERM-NUM]. */ -static const yytype_int8 yypgoto[] = -{ - -33, -33, 0, -33, 1, 2 -}; - -/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule which - number is the opposite. If zero, do what YYDEFACT says. - If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -1 -static const yytype_uint8 yytable[] = -{ - 1, 21, 2, 3, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 33, 34, 42, 22, - 36, 23, 24, 25, 26, 16, 27, 17, 29, 30, - 31, 35, 36, 37, 38, 39, 43, 41, 40, 0, - 44, 0, 0, 45 -}; - -static const yytype_int8 yycheck[] = -{ - 4, 33, 6, 7, 8, 9, 10, 11, 12, 13, - 14, 15, 16, 17, 18, 19, 16, 17, 32, 4, - 34, 4, 4, 4, 33, 29, 4, 31, 33, 4, - 4, 0, 34, 5, 5, 3, 36, 3, 5, -1, - 39, -1, -1, 41 -}; - -/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ -static const yytype_uint8 yystos[] = -{ - 0, 4, 6, 7, 8, 9, 10, 11, 12, 13, - 14, 15, 16, 17, 18, 19, 29, 31, 36, 37, - 38, 33, 4, 4, 4, 4, 33, 4, 39, 33, - 4, 4, 40, 37, 37, 0, 34, 5, 5, 3, - 5, 3, 32, 37, 39, 40 -}; - -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY (-2) -#define YYEOF 0 - -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrorlab - - -/* Like YYERROR except do call yyerror. This remains here temporarily - to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. However, - YYFAIL appears to be in use. Nevertheless, it is formally deprecated - in Bison 2.4.2's NEWS entry, where a plan to phase it out is - discussed. */ - -#define YYFAIL goto yyerrlab -#if defined YYFAIL - /* This is here to suppress warnings from the GCC cpp's - -Wunused-macros. Normally we don't worry about that warning, but - some users do, and we want to make it easy for users to remove - YYFAIL uses, which will produce warnings from Bison 2.5. */ -#endif - -#define YYRECOVERING() (!!yyerrstatus) - -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY && yylen == 1) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - yytoken = YYTRANSLATE (yychar); \ - YYPOPSTACK (1); \ - goto yybackup; \ - } \ - else \ - { \ - yyerror (YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ -while (YYID (0)) - - -#define YYTERROR 1 -#define YYERRCODE 256 - - -/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. - If N is 0, then set CURRENT to the empty location which ends - the previous symbol: RHS[0] (always defined). */ - -#define YYRHSLOC(Rhs, K) ((Rhs)[K]) -#ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - do \ - if (YYID (N)) \ - { \ - (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ - (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ - (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ - (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ - } \ - else \ - { \ - (Current).first_line = (Current).last_line = \ - YYRHSLOC (Rhs, 0).last_line; \ - (Current).first_column = (Current).last_column = \ - YYRHSLOC (Rhs, 0).last_column; \ - } \ - while (YYID (0)) -#endif - - -/* YY_LOCATION_PRINT -- Print the location on the stream. - This macro was not mandated originally: define only if we know - we won't break user code: when these are the locations we know. */ - -#ifndef YY_LOCATION_PRINT -# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL -# define YY_LOCATION_PRINT(File, Loc) \ - fprintf (File, "%d.%d-%d.%d", \ - (Loc).first_line, (Loc).first_column, \ - (Loc).last_line, (Loc).last_column) -# else -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -# endif -#endif - - -/* YYLEX -- calling `yylex' with the right arguments. */ - -#ifdef YYLEX_PARAM -# define YYLEX yylex (YYLEX_PARAM) -#else -# define YYLEX yylex () -#endif - -/* Enable debugging if requested. */ -#if YYDEBUG - -# ifndef YYFPRINTF -# include /* INFRINGES ON USER NAME SPACE */ -# define YYFPRINTF fprintf -# endif - -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ -} while (YYID (0)) - -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yy_symbol_print (stderr, \ - Type, Value); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (YYID (0)) - - -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -#else -static void -yy_symbol_value_print (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; -#endif -{ - if (!yyvaluep) - return; -# ifdef YYPRINT - if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# else - YYUSE (yyoutput); -# endif - switch (yytype) - { - default: - break; - } -} - - -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -#else -static void -yy_symbol_print (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; -#endif -{ - if (yytype < YYNTOKENS) - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); - else - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); - - yy_symbol_value_print (yyoutput, yytype, yyvaluep); - YYFPRINTF (yyoutput, ")"); -} - -/*------------------------------------------------------------------. -| yy_stack_print -- Print the state stack from its BOTTOM up to its | -| TOP (included). | -`------------------------------------------------------------------*/ - -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) -#else -static void -yy_stack_print (yybottom, yytop) - yytype_int16 *yybottom; - yytype_int16 *yytop; -#endif -{ - YYFPRINTF (stderr, "Stack now"); - for (; yybottom <= yytop; yybottom++) - { - int yybot = *yybottom; - YYFPRINTF (stderr, " %d", yybot); - } - YYFPRINTF (stderr, "\n"); -} - -# define YY_STACK_PRINT(Bottom, Top) \ -do { \ - if (yydebug) \ - yy_stack_print ((Bottom), (Top)); \ -} while (YYID (0)) - - -/*------------------------------------------------. -| Report that the YYRULE is going to be reduced. | -`------------------------------------------------*/ - -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_reduce_print (YYSTYPE *yyvsp, int yyrule) -#else -static void -yy_reduce_print (yyvsp, yyrule) - YYSTYPE *yyvsp; - int yyrule; -#endif -{ - int yynrhs = yyr2[yyrule]; - int yyi; - unsigned long int yylno = yyrline[yyrule]; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", - yyrule - 1, yylno); - /* The symbols being reduced. */ - for (yyi = 0; yyi < yynrhs; yyi++) - { - YYFPRINTF (stderr, " $%d = ", yyi + 1); - yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], - &(yyvsp[(yyi + 1) - (yynrhs)]) - ); - YYFPRINTF (stderr, "\n"); - } -} - -# define YY_REDUCE_PRINT(Rule) \ -do { \ - if (yydebug) \ - yy_reduce_print (yyvsp, Rule); \ -} while (YYID (0)) - -/* Nonzero means print parse trace. It is left uninitialized so that - multiple parsers can coexist. */ -int yydebug; -#else /* !YYDEBUG */ -# define YYDPRINTF(Args) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) -# define YY_STACK_PRINT(Bottom, Top) -# define YY_REDUCE_PRINT(Rule) -#endif /* !YYDEBUG */ - - -/* YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef YYINITDEPTH -# define YYINITDEPTH 200 -#endif - -/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only - if the built-in stack extension method is used). - - Do not make this value too large; the results are undefined if - YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) - evaluated with infinite-precision integer arithmetic. */ - -#ifndef YYMAXDEPTH -# define YYMAXDEPTH 10000 -#endif - - - -#if YYERROR_VERBOSE - -# ifndef yystrlen -# if defined __GLIBC__ && defined _STRING_H -# define yystrlen strlen -# else -/* Return the length of YYSTR. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static YYSIZE_T -yystrlen (const char *yystr) -#else -static YYSIZE_T -yystrlen (yystr) - const char *yystr; -#endif -{ - YYSIZE_T yylen; - for (yylen = 0; yystr[yylen]; yylen++) - continue; - return yylen; -} -# endif -# endif - -# ifndef yystpcpy -# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE -# define yystpcpy stpcpy -# else -/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in - YYDEST. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static char * -yystpcpy (char *yydest, const char *yysrc) -#else -static char * -yystpcpy (yydest, yysrc) - char *yydest; - const char *yysrc; -#endif -{ - char *yyd = yydest; - const char *yys = yysrc; - - while ((*yyd++ = *yys++) != '\0') - continue; - - return yyd - 1; -} -# endif -# endif - -# ifndef yytnamerr -/* Copy to YYRES the contents of YYSTR after stripping away unnecessary - quotes and backslashes, so that it's suitable for yyerror. The - heuristic is that double-quoting is unnecessary unless the string - contains an apostrophe, a comma, or backslash (other than - backslash-backslash). YYSTR is taken from yytname. If YYRES is - null, do not copy; instead, return the length of what the result - would have been. */ -static YYSIZE_T -yytnamerr (char *yyres, const char *yystr) -{ - if (*yystr == '"') - { - YYSIZE_T yyn = 0; - char const *yyp = yystr; - - for (;;) - switch (*++yyp) - { - case '\'': - case ',': - goto do_not_strip_quotes; - - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - /* Fall through. */ - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; - - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } - do_not_strip_quotes: ; - } - - if (! yyres) - return yystrlen (yystr); - - return yystpcpy (yyres, yystr) - yyres; -} -# endif - -/* Copy into YYRESULT an error message about the unexpected token - YYCHAR while in state YYSTATE. Return the number of bytes copied, - including the terminating null byte. If YYRESULT is null, do not - copy anything; just return the number of bytes that would be - copied. As a special case, return 0 if an ordinary "syntax error" - message will do. Return YYSIZE_MAXIMUM if overflow occurs during - size calculation. */ -static YYSIZE_T -yysyntax_error (char *yyresult, int yystate, int yychar) -{ - int yyn = yypact[yystate]; - - if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) - return 0; - else - { - int yytype = YYTRANSLATE (yychar); - YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); - YYSIZE_T yysize = yysize0; - YYSIZE_T yysize1; - int yysize_overflow = 0; - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - int yyx; - -# if 0 - /* This is so xgettext sees the translatable formats that are - constructed on the fly. */ - YY_("syntax error, unexpected %s"); - YY_("syntax error, unexpected %s, expecting %s"); - YY_("syntax error, unexpected %s, expecting %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); -# endif - char *yyfmt; - char const *yyf; - static char const yyunexpected[] = "syntax error, unexpected %s"; - static char const yyexpecting[] = ", expecting %s"; - static char const yyor[] = " or %s"; - char yyformat[sizeof yyunexpected - + sizeof yyexpecting - 1 - + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) - * (sizeof yyor - 1))]; - char const *yyprefix = yyexpecting; - - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yycount = 1; - - yyarg[0] = yytname[yytype]; - yyfmt = yystpcpy (yyformat, yyunexpected); - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - yyformat[sizeof yyunexpected - 1] = '\0'; - break; - } - yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr (0, yytname[yyx]); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; - yyfmt = yystpcpy (yyfmt, yyprefix); - yyprefix = yyor; - } - - yyf = YY_(yyformat); - yysize1 = yysize + yystrlen (yyf); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; - - if (yysize_overflow) - return YYSIZE_MAXIMUM; - - if (yyresult) - { - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - char *yyp = yyresult; - int yyi = 0; - while ((*yyp = *yyf) != '\0') - { - if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyf += 2; - } - else - { - yyp++; - yyf++; - } - } - } - return yysize; - } -} -#endif /* YYERROR_VERBOSE */ - - -/*-----------------------------------------------. -| Release the memory associated to this symbol. | -`-----------------------------------------------*/ - -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) -#else -static void -yydestruct (yymsg, yytype, yyvaluep) - const char *yymsg; - int yytype; - YYSTYPE *yyvaluep; -#endif -{ - YYUSE (yyvaluep); - - if (!yymsg) - yymsg = "Deleting"; - YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); - - switch (yytype) - { - - default: - break; - } -} - -/* Prevent warnings from -Wmissing-prototypes. */ -#ifdef YYPARSE_PARAM -#if defined __STDC__ || defined __cplusplus -int yyparse (void *YYPARSE_PARAM); -#else -int yyparse (); -#endif -#else /* ! YYPARSE_PARAM */ -#if defined __STDC__ || defined __cplusplus -int yyparse (void); -#else -int yyparse (); -#endif -#endif /* ! YYPARSE_PARAM */ - - -/* The lookahead symbol. */ -int yychar; - -/* The semantic value of the lookahead symbol. */ -YYSTYPE yylval; - -/* Number of syntax errors so far. */ -int yynerrs; - - - -/*-------------------------. -| yyparse or yypush_parse. | -`-------------------------*/ - -#ifdef YYPARSE_PARAM -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -int -yyparse (void *YYPARSE_PARAM) -#else -int -yyparse (YYPARSE_PARAM) - void *YYPARSE_PARAM; -#endif -#else /* ! YYPARSE_PARAM */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -int -yyparse (void) -#else -int -yyparse () - -#endif -#endif -{ - - - int yystate; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - - /* The stacks and their tools: - `yyss': related to states. - `yyvs': related to semantic values. - - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss; - yytype_int16 *yyssp; - - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs; - YYSTYPE *yyvsp; - - YYSIZE_T yystacksize; - - int yyn; - int yyresult; - /* Lookahead token as an internal (translated) token number. */ - int yytoken; - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; - -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif - -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) - - /* The number of symbols on the RHS of the reduced rule. - Keep to zero when no symbol should be popped. */ - int yylen = 0; - - yytoken = 0; - yyss = yyssa; - yyvs = yyvsa; - yystacksize = YYINITDEPTH; - - YYDPRINTF ((stderr, "Starting parse\n")); - - yystate = 0; - yyerrstatus = 0; - yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ - - /* Initialize stack pointers. - Waste one element of value and location stack - so that they stay on the same level as the state stack. - The wasted elements are never initialized. */ - yyssp = yyss; - yyvsp = yyvs; - - goto yysetstate; - -/*------------------------------------------------------------. -| yynewstate -- Push a new state, which is found in yystate. | -`------------------------------------------------------------*/ - yynewstate: - /* In all cases, when you get here, the value and location stacks - have just been pushed. So pushing a state here evens the stacks. */ - yyssp++; - - yysetstate: - *yyssp = yystate; - - if (yyss + yystacksize - 1 <= yyssp) - { - /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = yyssp - yyss + 1; - -#ifdef yyoverflow - { - /* Give user a chance to reallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - YYSTYPE *yyvs1 = yyvs; - yytype_int16 *yyss1 = yyss; - - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. This used to be a - conditional around just the two extra args, but that might - be undefined if yyoverflow is a macro. */ - yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), - &yystacksize); - - yyss = yyss1; - yyvs = yyvs1; - } -#else /* no yyoverflow */ -# ifndef YYSTACK_RELOCATE - goto yyexhaustedlab; -# else - /* Extend the stack our own way. */ - if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; - yystacksize *= 2; - if (YYMAXDEPTH < yystacksize) - yystacksize = YYMAXDEPTH; - - { - yytype_int16 *yyss1 = yyss; - union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); - if (! yyptr) - goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss_alloc, yyss); - YYSTACK_RELOCATE (yyvs_alloc, yyvs); -# undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE (yyss1); - } -# endif -#endif /* no yyoverflow */ - - yyssp = yyss + yysize - 1; - yyvsp = yyvs + yysize - 1; - - YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); - - if (yyss + yystacksize - 1 <= yyssp) - YYABORT; - } - - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); - - if (yystate == YYFINAL) - YYACCEPT; - - goto yybackup; - -/*-----------. -| yybackup. | -`-----------*/ -yybackup: - - /* Do appropriate processing given the current state. Read a - lookahead token if we need one and don't already have one. */ - - /* First try to decide what to do without reference to lookahead token. */ - yyn = yypact[yystate]; - if (yyn == YYPACT_NINF) - goto yydefault; - - /* Not known => get a lookahead token if don't already have one. */ - - /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ - if (yychar == YYEMPTY) - { - YYDPRINTF ((stderr, "Reading a token: ")); - yychar = YYLEX; - } - - if (yychar <= YYEOF) - { - yychar = yytoken = YYEOF; - YYDPRINTF ((stderr, "Now at end of input.\n")); - } - else - { - yytoken = YYTRANSLATE (yychar); - YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); - } - - /* If the proper action on seeing token YYTOKEN is to reduce or to - detect an error, take that action. */ - yyn += yytoken; - if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) - goto yydefault; - yyn = yytable[yyn]; - if (yyn <= 0) - { - if (yyn == 0 || yyn == YYTABLE_NINF) - goto yyerrlab; - yyn = -yyn; - goto yyreduce; - } - - /* Count tokens shifted since error; after three, turn off error - status. */ - if (yyerrstatus) - yyerrstatus--; - - /* Shift the lookahead token. */ - YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - - /* Discard the shifted token. */ - yychar = YYEMPTY; - - yystate = yyn; - *++yyvsp = yylval; - - goto yynewstate; - - -/*-----------------------------------------------------------. -| yydefault -- do the default action for the current state. | -`-----------------------------------------------------------*/ -yydefault: - yyn = yydefact[yystate]; - if (yyn == 0) - goto yyerrlab; - goto yyreduce; - - -/*-----------------------------. -| yyreduce -- Do a reduction. | -`-----------------------------*/ -yyreduce: - /* yyn is the number of a rule to reduce with. */ - yylen = yyr2[yyn]; - - /* If YYLEN is nonzero, implement the default value of the action: - `$$ = $1'. - - Otherwise, the following line sets YYVAL to garbage. - This behavior is undocumented and Bison - users should not rely upon it. Assigning to YYVAL - unconditionally makes the parser a bit smaller, and it avoids a - GCC warning that YYVAL may be used uninitialized. */ - yyval = yyvsp[1-yylen]; - - - YY_REDUCE_PRINT (yyn); - switch (yyn) - { - case 2: - -/* Line 1464 of yacc.c */ -#line 93 "bforce/expression.y" - { - DEB((D_EVENT, "[yacc] expression return %d", (yyvsp[(1) - (1)]))); - expr_result = (yyvsp[(1) - (1)]); - } - break; - - case 3: - -/* Line 1464 of yacc.c */ -#line 99 "bforce/expression.y" - { - DEB((D_EVENT, "[yacc] elemexp return %d", (yyvsp[(1) - (1)]))); - (yyval) = (yyvsp[(1) - (1)]); - } - break; - - case 4: - -/* Line 1464 of yacc.c */ -#line 104 "bforce/expression.y" - { - DEB((D_EVENT, "[yacc] not exprression %d", (yyvsp[(2) - (2)]))); - if( ((yyvsp[(2) - (2)])) < 0 ) - (yyval) = 0; - else - (yyval) = !((yyvsp[(2) - (2)])); - } - break; - - case 5: - -/* Line 1464 of yacc.c */ -#line 112 "bforce/expression.y" - { - (yyval) = expr_check_logic((yyvsp[(1) - (3)]), (yyvsp[(2) - (3)]), (yyvsp[(3) - (3)])); - } - break; - - case 6: - -/* Line 1464 of yacc.c */ -#line 116 "bforce/expression.y" - { - DEB((D_EVENT, "eventexp: [yacc] backeted.expr %d", (yyvsp[(2) - (3)]))); - (yyval) = (yyvsp[(2) - (3)]); - } - break; - - case 7: - -/* Line 1464 of yacc.c */ -#line 122 "bforce/expression.y" - { - (yyval) = expr_check_incoming(); - } - break; - - case 8: - -/* Line 1464 of yacc.c */ -#line 126 "bforce/expression.y" - { - (yyval) = expr_check_outgoing(); - } - break; - - case 9: - -/* Line 1464 of yacc.c */ -#line 130 "bforce/expression.y" - { - (yyval) = expr_check_listed(); - } - break; - - case 10: - -/* Line 1464 of yacc.c */ -#line 134 "bforce/expression.y" - { - (yyval) = expr_check_protected(); - } - break; - - case 11: - -/* Line 1464 of yacc.c */ -#line 138 "bforce/expression.y" - { - (yyval) = (yyvsp[(2) - (2)]); - } - break; - - case 12: - -/* Line 1464 of yacc.c */ -#line 142 "bforce/expression.y" - { - if( state.valid && state.connspeed > 0 ) - (yyval) = expr_check_arop(state.connspeed, (yyvsp[(2) - (3)]), (yyvsp[(3) - (3)])); - else - (yyval) = -1; - } - break; - - case 13: - -/* Line 1464 of yacc.c */ -#line 149 "bforce/expression.y" - { - if( state.valid && state.node.speed > 0 ) - (yyval) = expr_check_arop(state.node.speed, (yyvsp[(2) - (3)]), (yyvsp[(3) - (3)])); - else - (yyval) = -1; - } - break; - - case 14: - -/* Line 1464 of yacc.c */ -#line 156 "bforce/expression.y" - { - (yyval) = expr_check_arop(time_gmtoffset(), (yyvsp[(2) - (3)]), (yyvsp[(3) - (3)])); - } - break; - - case 15: - -/* Line 1464 of yacc.c */ -#line 160 "bforce/expression.y" - { - (yyval) = expr_check_phone(expr_p_text); - } - break; - - case 16: - -/* Line 1464 of yacc.c */ -#line 164 "bforce/expression.y" - { - (yyval) = (yyvsp[(2) - (2)]); - } - break; - - case 17: - -/* Line 1464 of yacc.c */ -#line 168 "bforce/expression.y" - { - (yyval) = expr_check_exec(expr_p_text); - } - break; - - case 18: - -/* Line 1464 of yacc.c */ -#line 172 "bforce/expression.y" - { - (yyval) = expr_check_exist(expr_p_text); - } - break; - - case 19: - -/* Line 1464 of yacc.c */ -#line 176 "bforce/expression.y" - { - (yyval) = expr_check_port(expr_p_text); - } - break; - - case 20: - -/* Line 1464 of yacc.c */ -#line 180 "bforce/expression.y" - { - (yyval) = expr_check_mailer(expr_p_text); - } - break; - - case 21: - -/* Line 1464 of yacc.c */ -#line 184 "bforce/expression.y" - { - (yyval) = expr_check_addr(expr_p_text); - if( (yyval) == -2 ) - YYABORT; - } - break; - - case 22: - -/* Line 1464 of yacc.c */ -#line 191 "bforce/expression.y" - { - (yyval) = expr_check_flag(expr_p_text); - } - break; - - case 23: - -/* Line 1464 of yacc.c */ -#line 195 "bforce/expression.y" - { - (yyval) = expr_check_logic((yyvsp[(1) - (3)]), OR, (yyvsp[(3) - (3)])); - } - break; - - case 24: - -/* Line 1464 of yacc.c */ -#line 200 "bforce/expression.y" - { - (yyval) = expr_check_time(expr_p_text); - if( (yyval) == -2 ) - YYABORT; - } - break; - - case 25: - -/* Line 1464 of yacc.c */ -#line 206 "bforce/expression.y" - { - (yyval) = expr_check_logic((yyvsp[(1) - (3)]), OR, (yyvsp[(3) - (3)])); - } - break; - - - -/* Line 1464 of yacc.c */ -#line 1690 "y.tab.c" - default: break; - } - YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); - - YYPOPSTACK (yylen); - yylen = 0; - YY_STACK_PRINT (yyss, yyssp); - - *++yyvsp = yyval; - - /* Now `shift' the result of the reduction. Determine what state - that goes to, based on the state we popped back to and the rule - number reduced by. */ - - yyn = yyr1[yyn]; - - yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; - if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) - yystate = yytable[yystate]; - else - yystate = yydefgoto[yyn - YYNTOKENS]; - - goto yynewstate; - - -/*------------------------------------. -| yyerrlab -- here on detecting error | -`------------------------------------*/ -yyerrlab: - /* If not already recovering from an error, report this error. */ - if (!yyerrstatus) - { - ++yynerrs; -#if ! YYERROR_VERBOSE - yyerror (YY_("syntax error")); -#else - { - YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); - if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) - { - YYSIZE_T yyalloc = 2 * yysize; - if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) - yyalloc = YYSTACK_ALLOC_MAXIMUM; - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yyalloc); - if (yymsg) - yymsg_alloc = yyalloc; - else - { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - } - } - - if (0 < yysize && yysize <= yymsg_alloc) - { - (void) yysyntax_error (yymsg, yystate, yychar); - yyerror (yymsg); - } - else - { - yyerror (YY_("syntax error")); - if (yysize != 0) - goto yyexhaustedlab; - } - } -#endif - } - - - - if (yyerrstatus == 3) - { - /* If just tried and failed to reuse lookahead token after an - error, discard it. */ - - if (yychar <= YYEOF) - { - /* Return failure if at end of input. */ - if (yychar == YYEOF) - YYABORT; - } - else - { - yydestruct ("Error: discarding", - yytoken, &yylval); - yychar = YYEMPTY; - } - } - - /* Else will try to reuse lookahead token after shifting the error - token. */ - goto yyerrlab1; - - -/*---------------------------------------------------. -| yyerrorlab -- error raised explicitly by YYERROR. | -`---------------------------------------------------*/ -yyerrorlab: - - /* Pacify compilers like GCC when the user code never invokes - YYERROR and the label yyerrorlab therefore never appears in user - code. */ - if (/*CONSTCOND*/ 0) - goto yyerrorlab; - - /* Do not reclaim the symbols of the rule which action triggered - this YYERROR. */ - YYPOPSTACK (yylen); - yylen = 0; - YY_STACK_PRINT (yyss, yyssp); - yystate = *yyssp; - goto yyerrlab1; - - -/*-------------------------------------------------------------. -| yyerrlab1 -- common code for both syntax error and YYERROR. | -`-------------------------------------------------------------*/ -yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ - - for (;;) - { - yyn = yypact[yystate]; - if (yyn != YYPACT_NINF) - { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) - { - yyn = yytable[yyn]; - if (0 < yyn) - break; - } - } - - /* Pop the current state because it cannot handle the error token. */ - if (yyssp == yyss) - YYABORT; - - - yydestruct ("Error: popping", - yystos[yystate], yyvsp); - YYPOPSTACK (1); - yystate = *yyssp; - YY_STACK_PRINT (yyss, yyssp); - } - - *++yyvsp = yylval; - - - /* Shift the error token. */ - YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); - - yystate = yyn; - goto yynewstate; - - -/*-------------------------------------. -| yyacceptlab -- YYACCEPT comes here. | -`-------------------------------------*/ -yyacceptlab: - yyresult = 0; - goto yyreturn; - -/*-----------------------------------. -| yyabortlab -- YYABORT comes here. | -`-----------------------------------*/ -yyabortlab: - yyresult = 1; - goto yyreturn; - -#if !defined(yyoverflow) || YYERROR_VERBOSE -/*-------------------------------------------------. -| yyexhaustedlab -- memory exhaustion comes here. | -`-------------------------------------------------*/ -yyexhaustedlab: - yyerror (YY_("memory exhausted")); - yyresult = 2; - /* Fall through. */ -#endif - -yyreturn: - if (yychar != YYEMPTY) - yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval); - /* Do not reclaim the symbols of the rule which action triggered - this YYABORT or YYACCEPT. */ - YYPOPSTACK (yylen); - YY_STACK_PRINT (yyss, yyssp); - while (yyssp != yyss) - { - yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp); - YYPOPSTACK (1); - } -#ifndef yyoverflow - if (yyss != yyssa) - YYSTACK_FREE (yyss); -#endif -#if YYERROR_VERBOSE - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); -#endif - /* Make sure YYID is used. */ - return YYID (yyresult); -} - - - -/* Line 1684 of yacc.c */ -#line 210 "bforce/expression.y" - - -#include "expression_lex.c" - -static int expr_check_incoming(void) -{ - if( !state.valid ) - return -1; - - return state.caller ? 0 : 1; -} - -static int expr_check_outgoing(void) -{ - if( !state.valid ) - return -1; - - return state.caller ? 1 : 0; -} - -static int expr_check_protected(void) -{ - if( !state.valid || !state.node.addr.zone ) - return -1; - - return state.protected ? 1 : 0; -} - -static int expr_check_listed(void) -{ - if( !state.valid || !state.node.addr.zone ) - return -1; - - return state.node.listed ? 1 : 0; -} - -static int expr_check_logic(int e1, int op, int e2) -{ - DEB((D_EVENT, "[yacc] logic: %d %d %d", e1, op, e2)); - - if( e1 < 0 ) e1 = 0; - if( e2 < 0 ) e2 = 0; - - switch(op) { - case AND: - return (e1 && e2); - case OR: - return (e1 || e2); - case XOR: - return (e1 ^ e2); - } - - log("invalid logical operator in expression"); - - return 0; -} - -static int expr_check_phone(const char *phone) -{ - DEB((D_EVENT, "[yacc] phone: is %s in %s", - phone, state.node.phone)); - - if( !state.valid ) - return 0; - - return strstr(state.node.phone, phone) ? 1 : 0; -} - -static int expr_check_arop(int num1, int op, int num2) -{ - DEB((D_EVENT, "[yacc] arop: %d %d %d", num1, op, num2)); - - switch(op) { - case EQ: return (num1 == num2); - case NE: return (num1 != num2); - case GT: return (num1 > num2); - case GE: return (num1 >= num2); - case LT: return (num1 < num2); - case LE: return (num1 <= num2); - } - - log("invalid arithmetic operator in expression"); - - return 0; -} - -static int expr_check_flag(const char *str) -{ - DEB((D_EVENT, "[yacc] flag: \"%s\"", str)); - - if( !state.valid ) - return 0; - - return !nodelist_checkflag(state.node.flags, str); -} - -static int expr_check_exec(const char *str) -{ - DEB((D_EVENT, "[yacc] exec: \"%s\"", str)); - - return session_run_command(str) ? 0 : 1; -} - -static int expr_check_exist(const char *str) -{ - DEB((D_EVENT, "[yacc] exist: \"%s\"", str)); - - return access(str, F_OK) ? 1 : 0; -} - -static int expr_check_port(const char *str) -{ - DEB((D_EVENT, "[yacc] port: \"%s\"", str)); - - if( !state.valid ) - return -1; - - if( !strcasecmp(str, "tcpip") ) - { - return state.inet ? 1 : 0; - } - else if( state.modemport && state.modemport->name ) - { - return strstr(state.modemport->name, str) ? 1 : 0; - } - else if( isatty(0) ) - { - return strstr(ttyname(0), str) ? 1 : 0; - } - - return -1; -} - -static int expr_check_mailer(const char *str) -{ - char *p; - - DEB((D_EVENT, "[yacc] mailer: \"%s\"", str)); - - if( !state.valid ) - return -1; - - if( state.handshake && state.handshake->remote_mailer ) - p = state.handshake->remote_mailer(state.handshake); - else - return -1; - - return (p && string_casestr(p, str)) ? 1 : 0; -} - -static int expr_check_addr(const char *str) -{ - s_faddr addr; -#ifdef DEBUG - char abuf1[BF_MAXADDRSTR+1]; - char abuf2[BF_MAXADDRSTR+1]; - - DEB((D_EVENT, "[yacc] addr: \"%s\" (session with \"%s\")", - ftn_addrstr(abuf1, addr), - ftn_addrstr(abuf2, state.node.addr))); -#endif - - if( !state.valid ) - return -1; - - if( ftn_addrparse(&addr, str, TRUE) ) - { - log("invalid address \"%s\"", str); - return -2; - } - - return !ftn_addrcomp_mask(state.node.addr, addr); -} - -static int expr_check_time(const char *str) -{ - DEB((D_EVENT, "[yacc] time: \"%s\"", str)); - - switch( time_check(str, now) ) { - case -1: - log("invalid time string \"%s\"", str); - return -2; - case 0: - return 1; - } - - return 0; -} - -bool eventexpr(s_expr *expr) -{ - time_t tt; - char *tmp; - - if( !expr || !expr->expr ) - return 1; - - if( expr->error ) - return 0; - - DEB((D_EVENT, "eventexpr: [yacc] check expression \"%s\"", - expr->expr)); - - tt = time(NULL); - now = localtime(&tt); - tmp = (char*)xstrcpy(expr->expr); - - expr_p_pos = tmp; - expr_result = 0; - - if( yyparse() ) - { - expr->error = TRUE; - - log("cannot parse expression \"%s\"", expr->expr); - DEB((D_EVENT, "eventexpr: [yacc] $yyparse return error")); - - expr_result = 0; - } - - free(tmp); - - DEB((D_EVENT, "eventexpr: [yacc] checking result is \"%s\" (%d)", - (expr_result == 1) ? "TRUE" : "FALSE", expr_result)); - - return (expr_result == 1) ? TRUE : FALSE; -} - -static int yyerror(const char *str) -{ - log("expression check failure: %s", str); - - return 0; -} - diff --git a/source/include/config.h b/source/include/config.h deleted file mode 100644 index 1ba0e68..0000000 --- a/source/include/config.h +++ /dev/null @@ -1,154 +0,0 @@ -/* include/config.h. Generated from config.h.in by configure. */ -/* include/config.h.in. Generated automatically from configure.in by autoheader. */ - -/* Define to empty if the keyword does not work. */ -/* #undef const */ - -/* Define if the `getpgrp' function takes no argument. */ -#define GETPGRP_VOID 1 - -/* Define if you don't have vprintf but do have _doprnt. */ -/* #undef HAVE_DOPRNT */ - -/* Define if you have that is POSIX.1 compatible. */ -#define HAVE_SYS_WAIT_H 1 - -/* Define if you have the vprintf function. */ -#define HAVE_VPRINTF 1 - -/* Define to `int' if doesn't define. */ -/* #undef mode_t */ - -/* Define to `int' if doesn't define. */ -/* #undef pid_t */ - -/* Define as the return type of signal handlers (int or void). */ -#define RETSIGTYPE void - -/* Define if the setvbuf function takes the buffering type as its second - argument and the buffer pointer as the third, as on System V - before release 3. */ -/* #undef SETVBUF_REVERSED */ - -/* Define to `unsigned' if doesn't define. */ -/* #undef size_t */ - -/* Define if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Define if you can safely include both and . */ -#define TIME_WITH_SYS_TIME 1 - -/* Define if your declares struct tm. */ -/* #undef TM_IN_SYS_TIME */ - -/* Do you want debug code to be compiled? */ -#define DEBUG 1 - -/* Do you want use DCD line control? */ -#define MODEM_WATCH_CARRIER 1 - -/* Do you want hangup to watch for modem DCD line? */ -#define MODEM_HANGUP_WATCH_CARRIER 1 - -/* Version string */ -#define RELEASE_VERSION "0.23" - -/* Disable passwords logging? */ -#define BFORCE_LOG_PASSWD 1 - -/* Path to the UUCP lock files directory */ -#define BFORCE_LOCK_DIR "/var/lock/" - -/* Do you want to use syslog? */ -/* #undef USE_SYSLOG */ - -/* Netspool */ -#define NETSPOOL 1 - -/* Do you want use .csy locks? */ -#define BFORCE_USE_CSY 1 - -/* Define if you have the mkdir function. */ -#define HAVE_MKDIR 1 - -/* Define if you have the mktime function. */ -#define HAVE_MKTIME 1 - -/* Define if you have the rename function. */ -#define HAVE_RENAME 1 - -/* Define if you have the select function. */ -#define HAVE_SELECT 1 - -/* Define if you have the setproctitle function. */ -/* #undef HAVE_SETPROCTITLE */ - -/* Define if you have the socket function. */ -#define HAVE_SOCKET 1 - -/* Define if you have the statfs function. */ -#define HAVE_STATFS 1 - -/* Define if you have the statvfs function. */ -#define HAVE_STATVFS 1 - -/* Define if you have the strcasecmp function. */ -#define HAVE_STRCASECMP 1 - -/* Define if you have the strspn function. */ -#define HAVE_STRSPN 1 - -/* Define if you have the header file. */ -#define HAVE_DIRENT_H 1 - -/* Define if you have the header file. */ -#define HAVE_FCNTL_H 1 - -/* Define if you have the header file. */ -/* #undef HAVE_NDIR_H */ - -/* Define if you have the header file. */ -/* #undef HAVE_SYS_DIR_H */ - -/* Define if you have the header file. */ -#define HAVE_SYS_FILE_H 1 - -/* Define if you have the header file. */ -#define HAVE_SYS_IOCTL_H 1 - -/* Define if you have the header file. */ -#define HAVE_SYS_MOUNT_H 1 - -/* Define if you have the header file. */ -/* #undef HAVE_SYS_NDIR_H */ - -/* Define if you have the header file. */ -#define HAVE_SYS_PARAM_H 1 - -/* Define if you have the header file. */ -#define HAVE_SYS_SELECT_H 1 - -/* Define if you have the header file. */ -#define HAVE_SYS_STATFS_H 1 - -/* Define if you have the header file. */ -#define HAVE_SYS_STATVFS_H 1 - -/* Define if you have the header file. */ -/* #undef HAVE_SYS_TERMIOX_H */ - -/* Define if you have the header file. */ -#define HAVE_SYS_TIME_H 1 - -/* Define if you have the header file. */ -#define HAVE_SYS_VFS_H 1 - -/* Define if you have the header file. */ -#define HAVE_TERMIOS_H 1 - -/* Define if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Define if you want buggy emsi :) */ -#define BUGGY_EMSI 0 From a27bb47b57d882d85302867e26ab61944ff0a089 Mon Sep 17 00:00:00 2001 From: Alexander Skovpen Date: Tue, 10 Jun 2014 22:35:28 +0400 Subject: [PATCH 07/11] small crypt fix :-)) --- source/bforce/prot_binkp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/bforce/prot_binkp.c b/source/bforce/prot_binkp.c index 91f5263..167d13d 100644 --- a/source/bforce/prot_binkp.c +++ b/source/bforce/prot_binkp.c @@ -681,7 +681,7 @@ case BPMSG_ADR: /* List of addresses */ DEB((D_24554, "sending options")); bstate->extracmd[0] = BPMSG_NUL; bstate->extraislast = false; - sprintf(bstate->extracmd+1,"OPT MB"); + sprintf(bstate->extracmd+1,"OPT MB CRYPT"); s_override ovr; for(i = 0; i < state.n_remoteaddr; i++) { ovr.sFlags = ""; From 91906fca27116b6db41644c4c8c77fabe5e3d7fa Mon Sep 17 00:00:00 2001 From: Alexander Skovpen Date: Tue, 10 Jun 2014 23:12:43 +0400 Subject: [PATCH 08/11] travis add --- .travis.yml | 5 +++++ README | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..204dd3b --- /dev/null +++ b/.travis.yml @@ -0,0 +1,5 @@ +language: c +compiler: + - gcc +# Change this to your needs +script: cd source && ./configure && make diff --git a/README b/README index b0916d9..53d2952 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -$Id$: +[![Build Status](https://travis-ci.org/askovpen/binkleyforce.svg?branch=master)](https://travis-ci.org/askovpen/binkleyforce) BinkleyForce FTN mailer ----------------------- From 4a8d737bdfca6c7731f928264d48a4d06aeb56a9 Mon Sep 17 00:00:00 2001 From: Alexander Skovpen Date: Tue, 10 Jun 2014 23:15:14 +0400 Subject: [PATCH 09/11] readme rename --- README => README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename README => README.md (100%) diff --git a/README b/README.md similarity index 100% rename from README rename to README.md From 19866b8def3e9b9ae284c7e7e406b2d69a4f9944 Mon Sep 17 00:00:00 2001 From: Alexander Skovpen Date: Tue, 10 Jun 2014 23:27:06 +0400 Subject: [PATCH 10/11] librt fix --- source/config.guess | 228 +++++++++------ source/config.sub | 183 +++++++----- source/configure | 311 +++++++++++--------- source/configure.in | 3 +- source/install-sh | 682 +++++++++++++++++++++++++++++++------------- 5 files changed, 922 insertions(+), 485 deletions(-) diff --git a/source/config.guess b/source/config.guess index 40eaed4..8b26ecf 100755 --- a/source/config.guess +++ b/source/config.guess @@ -1,14 +1,12 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -# 2011 Free Software Foundation, Inc. +# Copyright 1992-2013 Free Software Foundation, Inc. -timestamp='2011-05-11' +timestamp='2013-11-29' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or +# the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but @@ -17,26 +15,22 @@ timestamp='2011-05-11' # General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA -# 02110-1301, USA. +# along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - - -# Originally written by Per Bothner. Please send patches (context -# diff format) to and include a ChangeLog -# entry. +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). # -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. +# Originally written by Per Bothner. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD +# +# Please send patches with a ChangeLog entry to config-patches@gnu.org. + me=`echo "$0" | sed -e 's,.*/,,'` @@ -56,9 +50,7 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free -Software Foundation, Inc. +Copyright 1992-2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -140,12 +132,33 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown +case "${UNAME_SYSTEM}" in +Linux|GNU|GNU/*) + # If the system lacks a compiler, then just pick glibc. + # We could probably try harder. + LIBC=gnu + + eval $set_cc_for_build + cat <<-EOF > $dummy.c + #include + #if defined(__UCLIBC__) + LIBC=uclibc + #elif defined(__dietlibc__) + LIBC=dietlibc + #else + LIBC=gnu + #endif + EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` + ;; +esac + # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or - # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward @@ -202,6 +215,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; + *:Bitrig:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} + exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} @@ -304,7 +321,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; - arm:riscos:*:*|arm:RISCOS:*:*) + arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) @@ -792,21 +809,26 @@ EOF echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) - case ${UNAME_MACHINE} in - pc98) - echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + UNAME_PROCESSOR=`/usr/bin/uname -p` + case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; + *:MINGW64*:*) + echo ${UNAME_MACHINE}-pc-mingw64 + exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; + i*:MSYS*:*) + echo ${UNAME_MACHINE}-pc-msys + exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 @@ -852,15 +874,22 @@ EOF exit ;; *:GNU:*:*) # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; + aarch64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + aarch64_be:Linux:*:*) + UNAME_MACHINE=aarch64_be + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; @@ -872,56 +901,54 @@ EOF EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + if test "$?" = 0 ; then LIBC="gnulibc1" ; fi + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + arc:Linux:*:* | arceb:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then - echo ${UNAME_MACHINE}-unknown-linux-gnueabi + echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi else - echo ${UNAME_MACHINE}-unknown-linux-gnueabihf + echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf fi fi exit ;; avr32*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; cris:Linux:*:*) - echo cris-axis-linux-gnu + echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; crisv32:Linux:*:*) - echo crisv32-axis-linux-gnu + echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; frv:Linux:*:*) - echo frv-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + hexagon:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:Linux:*:*) - LIBC=gnu - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #ifdef __dietlibc__ - LIBC=dietlibc - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` - echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build @@ -940,54 +967,74 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; + or1k:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; or32:Linux:*:*) - echo or32-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; padre:Linux:*:*) - echo sparc-unknown-linux-gnu + echo sparc-unknown-linux-${LIBC} exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu + echo hppa64-unknown-linux-${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; + PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; + PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; + *) echo hppa-unknown-linux-${LIBC} ;; esac exit ;; ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu + echo powerpc64-unknown-linux-${LIBC} exit ;; ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu + echo powerpc-unknown-linux-${LIBC} + exit ;; + ppc64le:Linux:*:*) + echo powerpc64le-unknown-linux-${LIBC} + exit ;; + ppcle:Linux:*:*) + echo powerpcle-unknown-linux-${LIBC} exit ;; s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux + echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; tile*:Linux:*:*) - echo ${UNAME_MACHINE}-tilera-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; vax:Linux:*:*) - echo ${UNAME_MACHINE}-dec-linux-gnu + echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu + eval $set_cc_for_build + X86_64_ABI= + # If there is a compiler, see if it is configured for 32-bit objects. + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_X32 >/dev/null + then + X86_64_ABI=x32 + fi + fi + echo x86_64-unknown-linux-gnu${X86_64_ABI} exit ;; xtensa*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. @@ -1191,6 +1238,9 @@ EOF BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; + x86_64:Haiku:*:*) + echo x86_64-unknown-haiku + exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; @@ -1217,19 +1267,31 @@ EOF exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - case $UNAME_PROCESSOR in - i386) - eval $set_cc_for_build - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then - if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - UNAME_PROCESSOR="x86_64" - fi - fi ;; - unknown) UNAME_PROCESSOR=powerpc ;; - esac + eval $set_cc_for_build + if test "$UNAME_PROCESSOR" = unknown ; then + UNAME_PROCESSOR=powerpc + fi + if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + case $UNAME_PROCESSOR in + i386) UNAME_PROCESSOR=x86_64 ;; + powerpc) UNAME_PROCESSOR=powerpc64 ;; + esac + fi + fi + elif test "$UNAME_PROCESSOR" = i386 ; then + # Avoid executing cc on OS X 10.9, as it ships with a stub + # that puts up a graphical alert prompting to install + # developer tools. Any system running Mac OS X 10.7 or + # later (Darwin 11 and later) is required to have a 64-bit + # processor. This is not true of the ARM version of Darwin + # that Apple uses in portable devices. + UNAME_PROCESSOR=x86_64 + fi echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) @@ -1246,7 +1308,7 @@ EOF NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; - NSE-?:NONSTOP_KERNEL:*:*) + NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) @@ -1315,11 +1377,11 @@ EOF i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; + x86_64:VMkernel:*:*) + echo ${UNAME_MACHINE}-unknown-esx + exit ;; esac -#echo '(No uname command or uname output not recognized.)' 1>&2 -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 - eval $set_cc_for_build cat >$dummy.c <. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). -# Please send patches to . Submit a context -# diff and a properly formatted GNU ChangeLog entry. +# Please send patches with a ChangeLog entry to config-patches@gnu.org. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. @@ -75,9 +68,7 @@ Report bugs and patches to ." version="\ GNU config.sub ($timestamp) -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free -Software Foundation, Inc. +Copyright 1992-2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -125,13 +116,17 @@ esac maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ - linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ + linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; + android-linux) + os=-linux-android + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown + ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] @@ -154,7 +149,7 @@ case $os in -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray | -microblaze) + -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; @@ -223,6 +218,12 @@ case $os in -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; + -lynx*178) + os=-lynxos178 + ;; + -lynx*5) + os=-lynxos5 + ;; -lynx*) os=-lynxos ;; @@ -247,20 +248,28 @@ case $basic_machine in # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ + | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ + | arc | arceb \ + | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ + | avr | avr32 \ + | be32 | be64 \ | bfin \ - | c4x | clipper \ - | d10v | d30v | dlx | dsp16xx \ + | c4x | c8051 | clipper \ + | d10v | d30v | dlx | dsp16xx | dvp \ + | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ + | k1om \ + | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | mcore | mep | metag \ + | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ @@ -278,20 +287,21 @@ case $basic_machine in | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ + | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ - | nios | nios2 \ + | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ | open8 \ - | or32 \ + | or1k | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ - | rx \ + | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ @@ -300,7 +310,7 @@ case $basic_machine in | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ - | v850 | v850e \ + | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) @@ -315,8 +325,7 @@ case $basic_machine in c6x) basic_machine=tic6x-unknown ;; - m6811 | m68hc11 | m6812 | m68hc12 | picochip) - # Motorola 68HC11/12. + m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown os=-none ;; @@ -329,7 +338,10 @@ case $basic_machine in strongarm | thumb | xscale) basic_machine=arm-unknown ;; - + xgate) + basic_machine=$basic_machine-unknown + os=-none + ;; xscaleeb) basic_machine=armeb-unknown ;; @@ -352,25 +364,31 @@ case $basic_machine in # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ + | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ + | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ - | clipper-* | craynv-* | cydra-* \ + | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ + | k1om-* \ + | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ + | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ @@ -388,19 +406,20 @@ case $basic_machine in | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ - | nios-* | nios2-* \ + | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ - | romp-* | rs6000-* | rx-* \ + | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ @@ -408,10 +427,11 @@ case $basic_machine in | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ - | tile-* | tilegx-* \ + | tile*-* \ | tron-* \ | ubicom32-* \ - | v850-* | v850e-* | vax-* \ + | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ + | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ @@ -711,7 +731,6 @@ case $basic_machine in i370-ibm* | ibm*) basic_machine=i370-ibm ;; -# I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 @@ -769,11 +788,15 @@ case $basic_machine in basic_machine=ns32k-utek os=-sysv ;; - microblaze) + microblaze*) basic_machine=microblaze-xilinx ;; + mingw64) + basic_machine=x86_64-pc + os=-mingw64 + ;; mingw32) - basic_machine=i386-pc + basic_machine=i686-pc os=-mingw32 ;; mingw32ce) @@ -787,6 +810,24 @@ case $basic_machine in basic_machine=m68k-atari os=-mint ;; + mipsEE* | ee | ps2) + basic_machine=mips64r5900el-scei + case $os in + -linux*) + ;; + *) + os=-elf + ;; + esac + ;; + iop) + basic_machine=mipsel-scei + os=-irx + ;; + dvp) + basic_machine=dvp-scei + os=-elf + ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; @@ -808,10 +849,18 @@ case $basic_machine in ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; + msys) + basic_machine=i686-pc + os=-msys + ;; mvs) basic_machine=i370-ibm os=-mvs ;; + nacl) + basic_machine=le32-unknown + os=-nacl + ;; ncr3000) basic_machine=i486-ncr os=-sysv4 @@ -992,7 +1041,11 @@ case $basic_machine in basic_machine=i586-unknown os=-pw32 ;; - rdos) + rdos | rdos64) + basic_machine=x86_64-pc + os=-rdos + ;; + rdos32) basic_machine=i386-pc os=-rdos ;; @@ -1120,13 +1173,8 @@ case $basic_machine in basic_machine=t90-cray os=-unicos ;; - # This must be matched before tile*. - tilegx*) - basic_machine=tilegx-unknown - os=-linux-gnu - ;; tile*) - basic_machine=tile-unknown + basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) @@ -1324,25 +1372,25 @@ case $os in -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ - | -sym* | -kopensolaris* \ + | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -openbsd* | -solidbsd* \ + | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ - | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-android* \ - | -linux-newlib* | -linux-uclibc* \ + | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ + | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ - | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* | -irx* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ @@ -1470,9 +1518,6 @@ case $os in -aros*) os=-aros ;; - -kaos*) - os=-kaos - ;; -zvmoe) os=-zvmoe ;; @@ -1521,6 +1566,12 @@ case $basic_machine in c4x-* | tic4x-*) os=-coff ;; + c8051-*) + os=-elf + ;; + hexagon-*) + os=-elf + ;; tic54x-*) os=-coff ;; @@ -1548,9 +1599,6 @@ case $basic_machine in ;; m68000-sun) os=-sunos3 - # This also exists in the configure program, but was not the - # default. - # os=-sunos4 ;; m68*-cisco) os=-aout @@ -1564,6 +1612,9 @@ case $basic_machine in mips*-*) os=-elf ;; + or1k-*) + os=-elf + ;; or32-*) os=-coff ;; diff --git a/source/configure b/source/configure index e851d30..c81e140 100755 --- a/source/configure +++ b/source/configure @@ -1,13 +1,11 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for bforce 0.24. +# Generated by GNU Autoconf 2.69 for bforce 0.24. # # Report bugs to . # # -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software -# Foundation, Inc. +# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation @@ -136,6 +134,31 @@ export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +as_fn_exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh @@ -169,7 +192,8 @@ if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi -test x\$exitcode = x0 || exit 1" +test x\$exitcode = x0 || exit 1 +test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && @@ -214,21 +238,25 @@ IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : - # We cannot yet assume a decent shell, so we have to provide a - # neutralization value for shells without unset; and this also - # works around shells that cannot unset nonexistent variables. - # Preserve -v and -x to the replacement shell. - BASH_ENV=/dev/null - ENV=/dev/null - (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV - export CONFIG_SHELL - case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; - esac - exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} + export CONFIG_SHELL + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 fi if test x$as_have_required = xno; then : @@ -331,6 +359,14 @@ $as_echo X"$as_dir" | } # as_fn_mkdir_p + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take @@ -452,6 +488,10 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). @@ -486,16 +526,16 @@ if (echo >conf$$.file) 2>/dev/null; then # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. + # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' + as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null @@ -507,28 +547,8 @@ else as_mkdir_p=false fi -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x +as_test_x='test -x' +as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -604,6 +624,7 @@ ac_includes_default="\ ac_subst_vars='LTLIBOBJS LIBOBJS +CLOCK_LIB EGREP GREP CPP @@ -1156,8 +1177,6 @@ target=$target_alias if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe - $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used" >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi @@ -1418,9 +1437,9 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF bforce configure 0.24 -generated by GNU Autoconf 2.68 +generated by GNU Autoconf 2.69 -Copyright (C) 2010 Free Software Foundation, Inc. +Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -1496,7 +1515,7 @@ $as_echo "$ac_try_echo"; } >&5 test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext + test -x conftest$ac_exeext }; then : ac_retval=0 else @@ -1841,7 +1860,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by bforce $as_me 0.24, which was -generated by GNU Autoconf 2.68. Invocation command line was +generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2552,7 +2571,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_YACC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2599,7 +2618,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2639,7 +2658,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2692,7 +2711,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2733,7 +2752,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue @@ -2791,7 +2810,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2835,7 +2854,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3281,8 +3300,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include -#include -#include +struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); @@ -3404,7 +3422,7 @@ case $as_dir/ in #(( # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. @@ -3774,7 +3792,7 @@ do for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue + as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in @@ -3840,7 +3858,7 @@ do for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue + as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in @@ -4109,11 +4127,11 @@ else int main () { -/* FIXME: Include the comments suggested by Paul. */ + #ifndef __cplusplus - /* Ultrix mips cc rejects this. */ + /* Ultrix mips cc rejects this sort of thing. */ typedef int charset[2]; - const charset cs; + const charset cs = { 0, 0 }; /* SunOS 4.1.1 cc rejects this. */ char const *const *pcpcc; char **ppc; @@ -4130,8 +4148,9 @@ main () ++pcpcc; ppc = (char**) pcpcc; pcpcc = (char const *const *) ppc; - { /* SCO 3.2v4 cc rejects this. */ - char *t; + { /* SCO 3.2v4 cc rejects this sort of thing. */ + char tx; + char *t = &tx; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; @@ -4147,10 +4166,10 @@ main () iptr p = 0; ++p; } - { /* AIX XL C 1.02.0.0 rejects this saying + { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ - struct s { int j; const int *ap[3]; }; - struct s *b; b->j = 5; + struct s { int j; const int *ap[3]; } bx; + struct s *b = &bx; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; @@ -4440,6 +4459,58 @@ _ACEOF fi done +for ac_func in clock_gettime +do : + ac_fn_c_check_func "$LINENO" "clock_gettime" "ac_cv_func_clock_gettime" +if test "x$ac_cv_func_clock_gettime" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_CLOCK_GETTIME 1 +_ACEOF + CLOCK_LIB= +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lrt" >&5 +$as_echo_n "checking for clock_gettime in -lrt... " >&6; } +if ${ac_cv_lib_rt_clock_gettime+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lrt $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char clock_gettime (); +int +main () +{ +return clock_gettime (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_rt_clock_gettime=yes +else + ac_cv_lib_rt_clock_gettime=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_clock_gettime" >&5 +$as_echo "$ac_cv_lib_rt_clock_gettime" >&6; } +if test "x$ac_cv_lib_rt_clock_gettime" = xyes; then : + CLOCK_LIB=-lrt +fi + +fi +done + ac_config_files="$ac_config_files Makefile" @@ -4850,16 +4921,16 @@ if (echo >conf$$.file) 2>/dev/null; then # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. + # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' + as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null @@ -4919,28 +4990,16 @@ else as_mkdir_p=false fi -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -4962,7 +5021,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # values after options handling. ac_log=" This file was extended by bforce $as_me 0.24, which was -generated by GNU Autoconf 2.68. Invocation command line was +generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -5024,10 +5083,10 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ bforce config.status 0.24 -configured by $0, generated by GNU Autoconf 2.68, +configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" -Copyright (C) 2010 Free Software Foundation, Inc. +Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -5116,7 +5175,7 @@ fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then - set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' @@ -6142,16 +6201,16 @@ if (echo >conf$$.file) 2>/dev/null; then # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. + # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' + as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null @@ -6211,28 +6270,16 @@ else as_mkdir_p=false fi -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -6254,7 +6301,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # values after options handling. ac_log=" This file was extended by bforce $as_me 0.24, which was -generated by GNU Autoconf 2.68. Invocation command line was +generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -6316,10 +6363,10 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ bforce config.status 0.24 -configured by $0, generated by GNU Autoconf 2.68, +configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" -Copyright (C) 2010 Free Software Foundation, Inc. +Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -6408,7 +6455,7 @@ fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then - set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' diff --git a/source/configure.in b/source/configure.in index 6a8f4de..bed2b93 100644 --- a/source/configure.in +++ b/source/configure.in @@ -140,6 +140,7 @@ AC_TYPE_SIGNAL AC_FUNC_VPRINTF AC_CHECK_FUNCS(mkdir mktime select socket strspn strcasecmp mkstemp) AC_CHECK_FUNCS(rename statfs statvfs setproctitle) - +AC_CHECK_FUNCS([clock_gettime], [CLOCK_LIB=],[AC_CHECK_LIB([rt], [clock_gettime], [CLOCK_LIB=-lrt])]) +AC_SUBST([CLOCK_LIB]) AC_OUTPUT(Makefile) AC_OUTPUT(../debian/Makefile) diff --git a/source/install-sh b/source/install-sh index e9de238..377bb86 100755 --- a/source/install-sh +++ b/source/install-sh @@ -1,251 +1,527 @@ #!/bin/sh -# # install - install a program, script, or datafile -# This comes from X11R5 (mit/util/scripts/install.sh). + +scriptversion=2011-11-20.07; # UTC + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -# Copyright 1991 by the Massachusetts Institute of Technology +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. # -# Permission to use, copy, modify, distribute, and sell this software and its -# documentation for any purpose is hereby granted without fee, provided that -# the above copyright notice appear in all copies and that both that -# copyright notice and this permission notice appear in supporting -# documentation, and that the name of M.I.T. not be used in advertising or -# publicity pertaining to distribution of the software without specific, -# written prior permission. M.I.T. makes no representations about the -# suitability of this software for any purpose. It is provided "as is" -# without express or implied warranty. +# +# FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it +# 'make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written -# from scratch. It can only install one file at a time, a restriction -# shared with many OS's install programs. +# from scratch. +nl=' +' +IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -transformbasename="" -transform_arg="" -instcmd="$mvprog" -chmodcmd="$chmodprog 0755" -chowncmd="" -chgrpcmd="" -stripcmd="" -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src="" -dst="" -dir_arg="" - -while [ x"$1" != x ]; do - case $1 in - -c) instcmd="$cpprog" - shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - -s) stripcmd="$stripprog" - shift - continue;; - - -t=*) transformarg=`echo $1 | sed 's/-t=//'` - shift - continue;; - - -b=*) transformbasename=`echo $1 | sed 's/-b=//'` - shift - continue;; - - *) if [ x"$src" = x ] - then - src=$1 - else - # this colon is to work around a 386BSD /bin/sh bug - : - dst=$1 - fi - shift - continue;; - esac -done - -if [ x"$src" = x ] -then - echo "install: no input file specified" - exit 1 +doit=${DOITPROG-} +if test -z "$doit"; then + doit_exec=exec else - true + doit_exec=$doit fi -if [ x"$dir_arg" != x ]; then - dst=$src - src="" - - if [ -d $dst ]; then - instcmd=: - chmodcmd="" - else - instcmd=mkdir - fi -else +# Put in absolute file names if you don't have them in your path; +# or use environment vars. + +chgrpprog=${CHGRPPROG-chgrp} +chmodprog=${CHMODPROG-chmod} +chownprog=${CHOWNPROG-chown} +cmpprog=${CMPPROG-cmp} +cpprog=${CPPROG-cp} +mkdirprog=${MKDIRPROG-mkdir} +mvprog=${MVPROG-mv} +rmprog=${RMPROG-rm} +stripprog=${STRIPPROG-strip} + +posix_glob='?' +initialize_posix_glob=' + test "$posix_glob" != "?" || { + if (set -f) 2>/dev/null; then + posix_glob= + else + posix_glob=: + fi + } +' -# Waiting for this to be detected by the "$instcmd $src $dsttmp" command -# might cause directories to be created, which would be especially bad -# if $src (and thus $dsttmp) contains '*'. +posix_mkdir= - if [ -f $src -o -d $src ] - then - true - else - echo "install: $src does not exist" - exit 1 - fi - - if [ x"$dst" = x ] - then - echo "install: no destination specified" - exit 1 - else - true - fi +# Desired mode of installed file. +mode=0755 -# If destination is a directory, append the input filename; if your system -# does not like double slashes in filenames, you may need to add some logic +chgrpcmd= +chmodcmd=$chmodprog +chowncmd= +mvcmd=$mvprog +rmcmd="$rmprog -f" +stripcmd= - if [ -d $dst ] - then - dst="$dst"/`basename $src` - else - true - fi -fi +src= +dst= +dir_arg= +dst_arg= -## this sed command emulates the dirname command -dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` +copy_on_change=false +no_target_directory= -# Make sure that the destination directory exists. -# this part is taken from Noah Friedman's mkinstalldirs script +usage="\ +Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... -# Skip lots of stat calls in the usual case. -if [ ! -d "$dstdir" ]; then -defaultIFS=' -' -IFS="${IFS-${defaultIFS}}" +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. -oIFS="${IFS}" -# Some sh's can't handle IFS=/ for some reason. -IFS='%' -set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` -IFS="${oIFS}" +Options: + --help display this help and exit. + --version display version info and exit. -pathcomp='' + -c (ignored) + -C install only if different (preserve the last data modification time) + -d create directories instead of installing files. + -g GROUP $chgrpprog installed files to GROUP. + -m MODE $chmodprog installed files to MODE. + -o USER $chownprog installed files to USER. + -s $stripprog installed files. + -t DIRECTORY install into DIRECTORY. + -T report an error if DSTFILE is a directory. -while [ $# -ne 0 ] ; do - pathcomp="${pathcomp}${1}" - shift +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG + RMPROG STRIPPROG +" - if [ ! -d "${pathcomp}" ] ; - then - $mkdirprog "${pathcomp}" - else - true - fi +while test $# -ne 0; do + case $1 in + -c) ;; - pathcomp="${pathcomp}/" -done -fi + -C) copy_on_change=true;; -if [ x"$dir_arg" != x ] -then - $doit $instcmd $dst && + -d) dir_arg=true;; - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi -else + -g) chgrpcmd="$chgrpprog $2" + shift;; -# If we're going to rename the final executable, determine the name now. + --help) echo "$usage"; exit $?;; - if [ x"$transformarg" = x ] - then - dstfile=`basename $dst` - else - dstfile=`basename $dst $transformbasename | - sed $transformarg`$transformbasename - fi + -m) mode=$2 + case $mode in + *' '* | *' '* | *' +'* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + shift;; -# don't allow the sed command to completely eliminate the filename + -o) chowncmd="$chownprog $2" + shift;; - if [ x"$dstfile" = x ] - then - dstfile=`basename $dst` - else - true - fi + -s) stripcmd=$stripprog;; -# Make a temp file name in the proper directory. + -t) dst_arg=$2 + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + shift;; - dsttmp=$dstdir/#inst.$$# + -T) no_target_directory=true;; -# Move or copy the file name to the temp name + --version) echo "$0 $scriptversion"; exit $?;; - $doit $instcmd $src $dsttmp && + --) shift + break;; - trap "rm -f ${dsttmp}" 0 && + -*) echo "$0: invalid option: $1" >&2 + exit 1;; -# and set any options; do chmod last to preserve setuid bits + *) break;; + esac + shift +done -# If any of these fail, we abort the whole thing. If we want to -# ignore errors from any of these, just make sure not to ignore -# errors from the above "$doit $instcmd $src $dsttmp" command. +if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then + # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dst_arg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dst_arg" + shift # fnord + fi + shift # arg + dst_arg=$arg + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + done +fi - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && +if test $# -eq 0; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call 'install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi -# Now rename the file to the real destination. +if test -z "$dir_arg"; then + do_exit='(exit $ret); exit $ret' + trap "ret=129; $do_exit" 1 + trap "ret=130; $do_exit" 2 + trap "ret=141; $do_exit" 13 + trap "ret=143; $do_exit" 15 + + # Set umask so as not to create temps with too-generous modes. + # However, 'strip' requires both read and write access to temps. + case $mode in + # Optimize common cases. + *644) cp_umask=133;; + *755) cp_umask=22;; + + *[0-7]) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw='% 200' + fi + cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; + *) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw=,u+rw + fi + cp_umask=$mode$u_plus_rw;; + esac +fi - $doit $rmcmd -f $dstdir/$dstfile && - $doit $mvcmd $dsttmp $dstdir/$dstfile +for src +do + # Protect names problematic for 'test' and other utilities. + case $src in + -* | [=\(\)!]) src=./$src;; + esac + + if test -n "$dir_arg"; then + dst=$src + dstdir=$dst + test -d "$dstdir" + dstdir_status=$? + else + + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dst_arg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + dst=$dst_arg + + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + if test -n "$no_target_directory"; then + echo "$0: $dst_arg: Is a directory" >&2 + exit 1 + fi + dstdir=$dst + dst=$dstdir/`basename "$src"` + dstdir_status=0 + else + # Prefer dirname, but fall back on a substitute if dirname fails. + dstdir=` + (dirname "$dst") 2>/dev/null || + expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$dst" : 'X\(//\)[^/]' \| \ + X"$dst" : 'X\(//\)$' \| \ + X"$dst" : 'X\(/\)' \| . 2>/dev/null || + echo X"$dst" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q' + ` + + test -d "$dstdir" + dstdir_status=$? + fi + fi + + obsolete_mkdir_used=false + + if test $dstdir_status != 0; then + case $posix_mkdir in + '') + # Create intermediate dirs using mode 755 as modified by the umask. + # This is like FreeBSD 'install' as of 1997-10-28. + umask=`umask` + case $stripcmd.$umask in + # Optimize common cases. + *[2367][2367]) mkdir_umask=$umask;; + .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; + + *[0-7]) + mkdir_umask=`expr $umask + 22 \ + - $umask % 100 % 40 + $umask % 20 \ + - $umask % 10 % 4 + $umask % 2 + `;; + *) mkdir_umask=$umask,go-w;; + esac + + # With -d, create the new directory with the user-specified mode. + # Otherwise, rely on $mkdir_umask. + if test -n "$dir_arg"; then + mkdir_mode=-m$mode + else + mkdir_mode= + fi -fi && + posix_mkdir=false + case $umask in + *[123567][0-7][0-7]) + # POSIX mkdir -p sets u+wx bits regardless of umask, which + # is incompatible with FreeBSD 'install' when (umask & 300) != 0. + ;; + *) + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 + + if (umask $mkdir_umask && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + ls_ld_tmpdir=`ls -ld "$tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/d" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null + fi + trap '' 0;; + esac;; + esac + if + $posix_mkdir && ( + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + ) + then : + else + + # The umask is ridiculous, or mkdir does not conform to POSIX, + # or it failed possibly due to a race condition. Create the + # directory the slow way, step by step, checking for races as we go. + + case $dstdir in + /*) prefix='/';; + [-=\(\)!]*) prefix='./';; + *) prefix='';; + esac + + eval "$initialize_posix_glob" + + oIFS=$IFS + IFS=/ + $posix_glob set -f + set fnord $dstdir + shift + $posix_glob set +f + IFS=$oIFS + + prefixes= + + for d + do + test X"$d" = X && continue + + prefix=$prefix$d + if test -d "$prefix"; then + prefixes= + else + if $posix_mkdir; then + (umask=$mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break + # Don't fail if two instances are running concurrently. + test -d "$prefix" || exit 1 + else + case $prefix in + *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; + *) qprefix=$prefix;; + esac + prefixes="$prefixes '$qprefix'" + fi + fi + prefix=$prefix/ + done + + if test -n "$prefixes"; then + # Don't fail if two instances are running concurrently. + (umask $mkdir_umask && + eval "\$doit_exec \$mkdirprog $prefixes") || + test -d "$dstdir" || exit 1 + obsolete_mkdir_used=true + fi + fi + fi + + if test -n "$dir_arg"; then + { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && + { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || + test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 + else + + # Make a couple of temp file names in the proper directory. + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + + # Copy the file name to the temp name. + (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && + { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && + { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && + + # If -C, don't bother to copy if it wouldn't change the file. + if $copy_on_change && + old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && + new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && + + eval "$initialize_posix_glob" && + $posix_glob set -f && + set X $old && old=:$2:$4:$5:$6 && + set X $new && new=:$2:$4:$5:$6 && + $posix_glob set +f && + + test "$old" = "$new" && + $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 + then + rm -f "$dsttmp" + else + # Rename the file to the real destination. + $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || + + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + { + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + test ! -f "$dst" || + $doit $rmcmd -f "$dst" 2>/dev/null || + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && + { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } + } || + { echo "$0: cannot unlink or rename $dst" >&2 + (exit 1); exit 1 + } + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dst" + } + fi || exit 1 + + trap '' 0 + fi +done -exit 0 +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: From 52228a87bf4368b437e848d11ee63623856661de Mon Sep 17 00:00:00 2001 From: Alexander Skovpen Date: Tue, 10 Jun 2014 23:32:04 +0400 Subject: [PATCH 11/11] librt fix --- source/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/Makefile.in b/source/Makefile.in index 8de31a3..3464a18 100644 --- a/source/Makefile.in +++ b/source/Makefile.in @@ -12,7 +12,7 @@ exec_prefix=@exec_prefix@ CC = @CC@ INCLUDES = -I./include CFLAGS = @CFLAGS@ -fno-builtin -LIBS = @LIBS@ +LIBS = @LIBS@ @CLOCK_LIB@ YACC = @YACC@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@