filtergen-0.12.4/0000777000175000017500000000000010111022504010544 500000000000000filtergen-0.12.4/doc/0000777000175000017500000000000010111022502011307 500000000000000filtergen-0.12.4/doc/flow0000644000175000017500000000020110051306774012131 00000000000000[parser] | v (AST) | v [translator] | v (IR) <-> [factoriser] | v [generator] | v (TR) <-> [optimiser] | v [emitter] filtergen-0.12.4/doc/generator.notes0000644000175000017500000000252210051306774014307 00000000000000DAG for rule generation a { b c d } e { f g } x; h { f g } z; i { b c } y; precompute common subexpressions == separate into chains caution: actions are commutative with subexpressions: { f g } x is not the same as { f g } z visit nodes in a dag: when the end of the path is reached, enter a rule into an assembler-like list of tuples chain | if | src ip | dst ip | proto | src port | dst port | options... | action ports ignored for non tcp/udp (i.e. they're NULL) NULL values are assumed to be any: if they were assumed to be none, then all rules missing a value would be no-ops. leaving a specifier out meaning less specifity seems more intuitive. options inclue icmp type, special flags, iptables modifiers apply peephole optimisations: * redundant rules that are more specific than later rules with the same action potential for shadowing warning * rule reordering with other rules having the same action pattern: "if" expression "then" action; ##factorisation common actions E1 A; = ( E1 | E2 ) A E2 A; sib specifiers S { I1 I2 } = ( P(S I1) | P(S I2) ) chains/braces { E } = ( E ) specifier lists S1 I1 S2 I2 = ( P(S1I1) & P(S2I2) ) negations ! {E} = ! ( E ) negations ! S = ! P(S) S { ! I } = ! P(SI) S { ! I1 I2 } = ( !P(SI1) & P(SI2) ) associativity ( E1 o E2 ) o E3 = E1 o ( E2 o E3 ) comutativity E1 o E2 = E2 o E1 filtergen-0.12.4/doc/notes0000644000175000017500000001021710051306774012322 00000000000000#http://www.securityfocus.com/infocus/1711 #http://coombs.anu.edu.au/ipfilter/examples.html #http://hr.uoregon.edu/davidrl/rc.icmp #http://www.cs.iupui.edu/~ddillow/N301/deMorgan.html #demorgans law: ~(a + b) = ~a . ~b and ~(a . b) = ~a + ~b #input eth0 proto tcp dport http:https accept; #input eth0 proto icmp icmptype { echo-request timestamp-request } accept; #input eth0 dest monitors.anchor.net.au accept; #input eth0 dest localhost accept; #input eth0 proto icmp icmptype host-unreachable accept; #input eth+ { # ! source { a b } proto icmp icmptype echo-request accept; # }; #input eth+ and ( source a or source b ) and proto icmp and icmptype echo-request and target accept; #input eth+ and not ( source a or source b ) and proto icmp and icmptypte er and accept; # demorgans: #input e and not source a and not source b and proto icmp and it er and a; # semicolons = OR # sibs = OR # braces and chains = () # implicit gap between specifier = AND # ! = NOT # specifiers are predicates # targets are actions to perform. actions have side effects, predicates do not # guarded expressions # filtergen: input eth0 source { c d } accept; input eth0 ! source { a b } accept; #|| # lisp-like: #(and (input eth0) (not ((source a) or (source b))) (accept)); # #input eth0 accept; #output eth0 accept; #|| #(or (and (input eth0) (accept)) (and (output eth0) (accept))) # also: #{input eth0; output eth0} accept; #|| #(and (or (input eth0) (output eth0)) (accept)) #which by factorisation of the above: #(or (and input accept) (and output accept)) #|| #(input eth0) * (accept) + (output eth0) * (accept) #|| #(accept) * ((input eth0) + (output eth0)) #|| #(and accept (or input output) # expands to: #input accept #output accept # # # ORDER MATTERS when factoring/expanding, e.g.: # # order of targets matters, actions on same predicates # are not swappable (commutative?) # # input eth0 { # proto icmp accept; # proto tcp dport auth reject; # proto { tcp udp } dport domain accept; #}; #= #(and input (or (and proto accept) (and proto dport reject) (and (or proto proto) dport accept))) #expands to: #input proto accept [1] #input proto dport reject [2] #input proto dport accept [3] #input proto dport accept [4] # where 3,4's target is explicitly after [2] target inthe initial input # # TODO: prove that reordering targets has congruence COMMUTATIVITY OF RULES if two consecutive rules are sufficiently different, i.e. they are non overlapping predicate sets (???) then their order may be swapped # expression reduction: # fold duplicates, e.g.: (list reduction) # (and x x) = x # (or x x) = x # pull out common factors, e.g.: # (or (and x y) (and y z)) = (and y (or x z)) # special case optimisations: # (or (host a) (host b)) = (host a+b) iff a and b are the sole elements of # a CIDR set # (or (port a) (port b)) = (port a:b) iff a and b are consecutive ports # common factor puller outerer # at each binary operator node (i.e. "and" or "or") # if both children are binary operators of the opposite kind (i.e. "or" or "and" respectively # for each item in the first list: # if item in second list # pull out item from both lists # reverse operators # place item in top list # place sublists in new #two list reductions # common factor extraction # (or (and x y) (and y z)) # y (or (and x) (and z)) # (and y (or (and x) (and z))) # (and y (or x z)) # (or (and x y z) (and a y z)) # ^^ ^ ^ # x in (a y z)? no # (or (and x y z) (and a y z)) # ^^ ^ ^ # y in (a y z)? yes # (and y (or (and x z) (and a z))) # ^ ^ ^ ^ # z in (a z)? yes # (and y (or (and x z) (and a z))) # ^ ^ ^ ^ # (and y z (or (and x) (and z) # (and y z (or x z)) # singles reduction #one list reductions # duplicate reduction # (and x x) # (and x) # # (or x y x) # (or x y) # # singles reduction # (and x) # x http://hopper.unco.edu/KARNAUGH/Algorithm.html http://134.193.15.25/vu/course/cs281/lectures/boolean-algebra/boolean-algebra.html http://sunsite.wits.ac.za/math/firewall.htm http://www.cisco.com/univercd/cc/td/doc/product/software/ http://arxiv.org/abs/cs.NI/0008006 filtergen-0.12.4/examples/0000777000175000017500000000000010111022503012361 500000000000000filtergen-0.12.4/examples/example.filter0000644000175000017500000000135110051306721015151 00000000000000# # Example filter for (for example) a mail server # $Id: example.filter,v 1.3 2001/10/06 19:07:17 matthew Exp $ # # Unfortunately, we don't have time to audit the # communications which go on locally {input lo; output lo} accept; # But we want to be a bit more careful when speaking # to the outside world input eth0 { proto tcp { dport { smtp pop-3 } accept; dport ssh source ournet/24 accept; # We don't answer this, but don't want to # cause timeouts by blocking it dport auth reject; log drop; }; # We don't run any UDP (or other non-TCP) # services log drop; }; output eth0 { proto tcp { dport { smtp auth } accept; log drop; }; # Outbound DNS is OK proto udp dport domain dest { ns0 ns1 } accept; log drop; }; filtergen-0.12.4/examples/host-sample.filter0000644000175000017500000000206710051306730015757 00000000000000## ## Sample filtergen ruleset for a host (DB server, in this case) ## ## $Id: host-sample.filter,v 1.1 2002/09/12 09:28:53 matthew Exp $ ## # Process this with the "-h" option # lo -- we haven't time to audit all local communication input lo accept; output lo accept; # eth0 -- DMZ interface input eth0 { # ignore bootp and broadcast noise proto udp sport bootpc dport bootps drop; dest {111.222.333.0 111.222.333.255 0.0.0.0 255.255.255.255} drop; # We only speak to other hosts on this LAN ... ! source 111.222.333.0/24 log drop; # ... and only on one IP ! dest db0 log drop; # Services we permit proto tcp dport {ssh sqlnet postgres} accept; # Everything else, we refuse log drop; }; output eth0 { # We only speak to other hosts on this LAN... ! dest 111.222.333.0/24 log drop; # ...and only from one IP ! source db0 log drop; # The usual outbound noise proto {tcp udp} dport domain dest {ns0 ns1} accept; proto tcp dport smtp dest {mail0 mail1} accept; # Don't know what else goes out, so for now we permit it, # but also log it log accept; }; filtergen-0.12.4/examples/icmp.filter0000644000175000017500000000451710051306750014457 00000000000000# The following information courtesy of Glen Turner: # David Fisher wrote: # > Would some kind person please try pinging the addresses xx.xx.xx.xx or # > xx.xx.xx.xx and let me know the results, please? # > # > I need to test the ICMP block on my router from external ping traffic. # # Great, another path MTU discovery black hole, another # undiagnosable network. # # Fellas, how about using rate limiting. Linux has marvellous # QoS features, enough to allow a few ICMP ECHOs for fault # diagnosis but to deny a ping flood. # # > Note that its probably not a good idea to block ICMP source quench # > packets. # # Nah, block those suckers. Source Quench is deprecated. # # The list is # # Block # Obsolete # Source Quench # Information Request/Reply # Datagram Conversion # Shouldn't cross network boundary # Address Mask Request/Reply # Redirect # Domain Name # Router Advertisment/Selection # Required for operation (rate limit these to, say, 10% of bandwidth) # Destination Unreachable # Time Exceeded # Security Failure # Parameter Problem # Required for diagnosis (rate limit these to, say, 1% of bandwidth) # Echo Request/Reply # Timestamp Request/Reply # # Regards, # Glen # # -- # Glen Turner Tel: (08) 8303 3936 or +61 8 8303 3936 # Network Engineer Email: glen.turner@aarnet.edu.au # Australian Academic & Research Network www.aarnet.edu.au # -- # linux.conf.au 2004, Adelaide lca2004.linux.org.au # Main conference 14-17 January 2004 Miniconfs from 12 Jan # # -- # SLUG - Sydney Linux User's Group - http://slug.org.au/ # More Info: http://lists.slug.org.au/listinfo/slug proto icmp { # these are obsolete drop icmptype { source-quench information-request information-reply datagram-conversion }; # these shouldn't cross network boundary drop icmptype { address-mask-request address-mask-reply redirect domain-name router-advertisement router-selection }; # required for operation accept icmptype { destination-unreachable time-exceeded security-failure parameter-problem } limit rate 20/s burst 10; # required for diagnosis accept icmptype { echo-request echo-reply timestamp-request timestamp-reply } limit rate 10/s burst 5; # drop anything we missed drop; } filtergen-0.12.4/examples/proxy-fw-sample.filter0000644000175000017500000000265410051306730016577 00000000000000## ## Sample filtergen ruleset for a proxy gateway host ## ## $Id: proxy-fw-sample.filter,v 1.1 2002/09/12 09:28:53 matthew Exp $ ## # process with this the "-h" option # everything on lo, ugh input lo accept; output lo accept; # # eth0 is the public interface # # It lives on our class C as 111.222.333.28 (aka gw-ext) # input eth0 { # ignore broadbcast / bootp noise dest {111.222.333.0 111.222.333.255 255.255.255.255} drop; proto icmp icmptype {ping pong destination-unreachable} accept; proto tcp dport ssh accept; # FTP data connections (from PORT sent to server) proto tcp dest gw-ext dport 40000:40400 accept; log drop; }; output eth0 { proto icmp icmptype {ping pong destination-unreachable} accept; proto {udp tcp} dport domain accept; proto tcp dport {ssh smtp http https pop-3 ftp} accept; }; # # eth1 is the internal interface # # It lives on 10.1.2.1/24 (aka gw-int) # output eth1 { proto icmp icmptype {ping pong destination-unreachable} accept; # management connections proto tcp dport ssh accept; log reject; }; input eth1 { proto icmp icmptype {ping pong destination-unreachable} accept; # ignore broadbcast / bootp noise dest {10.1.2.0 10.1.2.255 255.255.255.255} drop; # dns proto {udp tcp} dport domain accept; # transproxy stuff proto tcp dport {ssh smtp http https pop-3 nntp ftp} proxy; # FTP data connections (from PASV sent by client) proto tcp dport 30000:30400 accept; log reject; }; filtergen-0.12.4/examples/router-sample.filter0000644000175000017500000000410310051306730016313 00000000000000## ## Sample filtergen script for a filtering router ## ## $Id: router-sample.filter,v 1.1 2002/09/12 09:28:53 matthew Exp $ ## # The router has: # * a public interface (eth0) on 444.555.666.777 # * DMZ interface (eth1) on 111.222.333.254, behind which is a class C # eth0 is the public interface # # On this interface, we do martian filtering and not a lot else input eth0 forward { dest 111.222.333.0/24 accept; log drop; }; output eth0 forward { source 111.222.333.0/24 accept; log drop; }; input eth0 local { proto icmp accept; # Emergency management connection from outside proto tcp dport ssh source fw0-othersite accept; log drop; }; output eth0 local { proto icmp accept; log drop; }; # eth1 is the DMZ interface # # Here's where the real filtering happens. We split this # subnet into 4 logical groups of 64 IPs each to make this # easier output eth1 forward { # First quarter is infrastructure stuff -- nameservers, # mail, gateway, etc. All traffic is permitted, for now. dest 111.222.333.0/26 accept; # Deny everything to top 64 IPs -- DB servers, etc dest 111.222.333.186/26 log drop; # Web servers (real _and_ virtual) dest 111.222.333.128/26 { proto icmp accept; proto tcp dport { http https } accept; log text "to-web" accept; }; # FIXME: For now, we allow everything else, but log it. # Hopefully we can find time to restrict this log text "unmatched-inbound" accept; # log reject; }; # TODO: Filter outbound traffic, too input eth1 forward accept; # Inbound management connections, etc input eth1 local { # ignore broadcast dest {255.255.255.255 195.157.147.255} drop; # SSH and SNMP from management host source mgmt0 { proto tcp dport ssh accept; proto udp dport snmp accept; }; proto icmp accept; log reject; }; # Outbound stuff. Nothing interesting here: output eth1 local { proto icmp accept; # DNS and mail via ns0, ns1 dest {ns0 ns1} { proto {udp tcp} dport domain accept; proto tcp dport smtp accept; }; # Emergency ssh to gateway host proto tcp { dest gateway0 dport ssh; } accept; log text "from-dmz" reject; }; filtergen-0.12.4/README0000644000175000017500000001223610051307657011366 00000000000000 PACKET FILTER GENERATOR GENERAL This tool is for generating packet filtering rules from a fairly high- level description language. It doesn't support all of the whizz-bang features of the latest and greatest packet filters, but supports a decent subset which is sufficient for me. It currently supports only Linux iptables and ipchains. Cisco IOS has been begun, but is incomplete. Darren Reed's ipfilter may be supported at some stage. It doesn't generate optimal rulesets, and has a few limitations which need to be removed, but is still a useful tool. There's a basic webpage at http://hairy.beasts.org/filter/ WARNING! This package isn't perfect. Nevertheless, I don't believe that the ipchains or iptables drivers leak packets. LICENCE It was written, and is copyrighted by me , and made available you you under the terms of the GNU General Public Licence. WHY? Not many large softare projects are written entirely in assembly language these days. It's not difficult to be, and the results can often be more efficient, but it does take longer to implement and bugfix, and is not portable to other systems. It is also harder for others to understand, update and audit. Similarly, it seems odd that people continue to write packet filters in the equivalent of assembler, or in inflexible macro languages. Hence this package -- my intent is that "filter" will be to iptables and shell what a C compiler (but not a 4GL) is to assembly. USAGE The filter generator is called "filtergen". It can be invoked as: $ filtergen source.file > output.rules or as a filter itself: $ cat source.file | filtergen > output.rules The default output mode is for iptables, but you can override this by giving an extra argument on the command-line: $ filtergen oldbox.filter ipchains > oldbox.rules and using "-" to imply standard input: $ cat oldbox.filter | filtergen - ipchains > oldbox.rules Some of the backends (notably iptables and ipchains) generate a "skeleton" around the rules that they output. This can be disabled with "-n": $ filtergen -n tests/ticmp.filter ipchains The rulesets generated with this option may not be complete, but the flag is useful to allow one to see what sort of output is generated. SYNTAX The syntax looks not entirely unlike that of "fk"s ACL facility ("fk" is another project of mine which lives at http://hairy.beasts.org/fk/), and it might be worth familiarising yourself with that first (not least because it is rather less experimental). An example will probably show most of the basics. Here's a simple one for a single-interface host (perhaps a mail server): # Unfortunately, we don't have time to audit the # communications which go on locally {input lo; output lo} accept; # But we want to be a bit more careful when speaking # to the outside world input eth0 { proto tcp { dport { smtp pop-3 } accept; dport ssh source ournet/24 accept; # We don't answer this, but don't want to # cause timeouts by blocking it dport auth reject; log drop; }; # We don't run any UDP (or other non-TCP) # services log drop; }; output eth0 { proto tcp { dport { smtp auth } accept; log drop; }; # Outbound DNS is OK proto udp dport domain dest { ns0 ns1 } accept; log drop; }; At first sight, this might not look like much more than a shorthand for raw packet filtering rules, and indeed it isn't. However, the abbreviation is better than one might imagine because it also (again, as far as the underlying packet filter allows it) outputs appropriate rules for returning packets on a connection, and applies stateful rules where possible. So a simple rule like: output eth0 proto tcp dport http accept; might generate ipchains rules like: ipchains -A output -i eth0 -p tcp --dport=http -j ACCEPT ipchains -A input -i eth0 -p tcp ! --syn --sport=http -j ACCEPT to give simple "state" matching -- the second rule will block any packets which could initiate a connection. Otherwise, an attacker could connect to any port on your machine merely by binding the attack program to port 80 on his machine. The same rule might generate iptables rule resembling: iptables -A OUTPUT -o eth0 -p tcp -m state --state=NEW,ESTABLISHED \ --dport=http -j ACCEPT iptables -A INPUT -i eth0 -p tcp -m state --state=ESTABLISHED ! --syn \ --sport=http -j ACCEPT Note the explicit state checking here (which, in theory, makes the "! --syn" bit unnecessary, but a bit of defence in depth never hurt). SIGNIFICANT DIFFERENCES FROM ACL SYNTAX There are a number of places where the filter language differs from the ACL language. They are not (well, not all) as gratuitous as one might think at first. * ACL has "allow" and "deny", filter has "accept", "drop" and "reject". * ACL makes no distinction between the actual inbound and outbound connections which make up a proxied logical connection. These are essentially because a packet filter isn't really in a position to permit or refuse a connection -- it acts only on single packets, and is not really able to reason about connections (whatever the blurb claims). It also matches the terminology used by Linux's iptables. $Id: README,v 1.9 2002/08/20 22:54:38 matthew Exp $ filtergen-0.12.4/configure.in0000644000175000017500000000510610110551002012772 00000000000000AC_PREREQ(2.50) AC_INIT(filtergen, 0.12.4, jaq@spacepants.org) AM_INIT_AUTOMAKE([foreign dist-bzip2]) AC_CONFIG_AUX_DIR(.) AC_CONFIG_SRCDIR(filtergen.c) AM_CONFIG_HEADER(config.h) AM_MAINTAINER_MODE AC_SUBST(PROGRAM) AC_SUBST(VERSION) dnl -------------------------- dnl configuration success flag dnl -------------------------- filtergen_config_ok=yes dnl ------------------- dnl checks for programs dnl ------------------- AC_PROG_CC AC_PROG_LEX AC_PROG_YACC dnl ------------------- dnl check for libraries dnl ------------------- AC_CHECK_HEADERS([getopt.h]) HAVE_GETOPT=no AC_CHECK_LIB(getopt, getopt, HAVE_GETOPT=yes HAVE_GETOPT=no ) if test "x$HAVE_GETOPT" = xyes ; then GETOPT_LIBS="-lgetopt" AC_SUBST(GETOPT_LIBS) fi dnl ----------------- dnl set warning level dnl ----------------- if test "x$ac_cv_c_compiler_gnu" = xyes ; then CFLAGS="$CFLAGS -W -Wall -Werror -Waggregate-return" CFLAGS="$CFLAGS -Wcast-align -Wcast-qual -Wnested-externs" CFLAGS="$CFLAGS -Wshadow -Wbad-function-cast -Wwrite-strings" fi dnl --------------- dnl set debug level dnl --------------- AC_MSG_CHECKING([whether to enable debugging compiler options]) AC_ARG_ENABLE(debug, [ --enable-debug enable debugging compiler options], AC_MSG_RESULT(yes) tmp_CFLAGS=`echo $CFLAGS | sed 's/O2/O0/g'` CFLAGS="$tmp_CFLAGS", AC_MSG_RESULT(no) ) dnl ------------------------------ dnl fill in path variable expandos dnl ------------------------------ dnl $libdir usually gets set to ${exec_prefix}/lib, dnl $prefix and $exec_prefix is likely to be "NONE" dnl Autoconf usually sets pkglibdir correctly in the Makefile, but not in dnl the configure script :( test "$prefix" = "NONE" && prefix=/usr/local test "$exec_prefix" = "NONE" && exec_prefix=$prefix dnl Executable files eval BINDIR="$bindir" AC_SUBST(BINDIR) eval SBINDIR="$sbindir" AC_SUBST(SBINDIR) dnl Configuration files eval SYSCONFDIR="$sysconfdir" AC_SUBST(SYSCONFDIR) dnl Documentation eval pkgdocdir="$datadir/doc/$PACKAGE" AC_SUBST(pkgdocdir) dnl Example scripts eval pkgexdir="$pkgdocdir/examples" AC_SUBST(pkgexdir) dnl ---------------------------------------------------------- dnl configuration tests complete, provide a summary of results dnl ---------------------------------------------------------- if test "x$filtergen_config_ok" = xno ; then echo "nothing yet" else dnl Dump it out AC_CONFIG_FILES([ Makefile t/Makefile filtergen.spec fgadm fgadm.conf rules.filter ]) AC_OUTPUT AC_MSG_RESULT([ filtergen $VERSION: automatic configuration OK. Type 'make' to compile filtergen. Type 'make install' to install filtergen. ]) fi filtergen-0.12.4/aclocal.m40000644000175000017500000010772710110551011012335 00000000000000# generated automatically by aclocal 1.8.5 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 # Free Software Foundation, Inc. # This file 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. # -*- Autoconf -*- # Copyright (C) 2002, 2003 Free Software Foundation, Inc. # Generated from amversion.in; do not edit by hand. # 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, 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, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.8"]) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION so it can be traced. # This function is AC_REQUIREd by AC_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.8.5])]) # AM_AUX_DIR_EXPAND # Copyright (C) 2001, 2003 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 2, 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, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997, 2000, 2001, 2003 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 2, 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, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 6 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ(2.52)dnl ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE]) AC_SUBST([$1_FALSE]) if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]) fi])]) # serial 7 -*- Autoconf -*- # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 # 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 2, 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, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "GCJ", or "OBJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE(dependency-tracking, [ --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH]) ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 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 2, 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, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. #serial 2 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [for mf in $CONFIG_FILES; do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # So let's grep whole file. if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue # Extract the definition of DEP_FILES from the Makefile without # running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" # We invoke sed twice because it is the simplest approach to # changing $(DEPDIR) to its actual value in the expansion. for file in `sed -n ' /^DEP_FILES = .*\\\\$/ { s/^DEP_FILES = // :loop s/\\\\$// p n /\\\\$/ b loop p } /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each `.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Like AC_CONFIG_HEADER, but automatically create stamp file. -*- Autoconf -*- # Copyright (C) 1996, 1997, 2000, 2001, 2003 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 2, 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, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 7 # AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) # Do all the work for Automake. -*- Autoconf -*- # This macro actually does too much some checks are only needed if # your package does certain things. But this isn't really a big deal. # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 # 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 2, 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, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 11 # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.58])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl # test to see if srcdir already configured if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) AM_MISSING_PROG(AMTAR, tar) AM_PROG_INSTALL_SH AM_PROG_INSTALL_STRIP AC_REQUIRE([AM_PROG_MKDIR_P])dnl # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_CC], defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl ]) ]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $1 | $1:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. # Copyright (C) 2001, 2003 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 2, 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, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl install_sh=${install_sh-"$am_aux_dir/install-sh"} AC_SUBST(install_sh)]) # -*- Autoconf -*- # Copyright (C) 2003 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 2, 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, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 1 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Add --enable-maintainer-mode option to configure. # From Jim Meyering # Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004 # 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 2, 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, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 3 AC_DEFUN([AM_MAINTAINER_MODE], [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) dnl maintainer-mode is disabled by default AC_ARG_ENABLE(maintainer-mode, [ --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer], USE_MAINTAINER_MODE=$enableval, USE_MAINTAINER_MODE=no) AC_MSG_RESULT([$USE_MAINTAINER_MODE]) AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes]) MAINT=$MAINTAINER_MODE_TRUE AC_SUBST(MAINT)dnl ] ) AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003 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 2, 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, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 2 # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo done .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # We grep out `Entering directory' and `Leaving directory' # messages which can occur if `w' ends up in MAKEFLAGS. # In particular we don't look at `^make:' because GNU make might # be invoked under some other name (usually "gmake"), in which # case it prints its new name instead of `make'. if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU fi # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then am__include=.include am__quote="\"" _am_result=BSD fi fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # -*- Autoconf -*- # Copyright (C) 1997, 1999, 2000, 2001, 2003 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 2, 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, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 3 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN([`missing' script is too old or missing]) fi ]) # AM_PROG_MKDIR_P # --------------- # Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise. # Copyright (C) 2003, 2004 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 2, 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, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories # created by `make install' are always world readable, even if the # installer happens to have an overly restrictive umask (e.g. 077). # This was a mistake. There are at least two reasons why we must not # use `-m 0755': # - it causes special bits like SGID to be ignored, # - it may be too restrictive (some setups expect 775 directories). # # Do not use -m 0755 and let people choose whatever they expect by # setting umask. # # We cannot accept any implementation of `mkdir' that recognizes `-p'. # Some implementations (such as Solaris 8's) are not thread-safe: if a # parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c' # concurrently, both version can detect that a/ is missing, but only # one can create it and the other will error out. Consequently we # restrict ourselves to GNU make (using the --version option ensures # this.) AC_DEFUN([AM_PROG_MKDIR_P], [if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then # Keeping the `.' argument allows $(mkdir_p) to be used without # argument. Indeed, we sometimes output rules like # $(mkdir_p) $(somedir) # where $(somedir) is conditionally defined. # (`test -n '$(somedir)' && $(mkdir_p) $(somedir)' is a more # expensive solution, as it forces Make to start a sub-shell.) mkdir_p='mkdir -p -- .' else # On NextStep and OpenStep, the `mkdir' command does not # recognize any option. It will interpret all options as # directories to create, and then abort because `.' already # exists. for d in ./-p ./--version; do test -d $d && rmdir $d done # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. if test -f "$ac_aux_dir/mkinstalldirs"; then mkdir_p='$(mkinstalldirs)' else mkdir_p='$(install_sh) -d' fi fi AC_SUBST([mkdir_p])]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003 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 2, 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, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 2 # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # ------------------------------ # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) # _AM_SET_OPTIONS(OPTIONS) # ---------------------------------- # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # # Check to make sure that the build environment is sane. # # Copyright (C) 1996, 1997, 2000, 2001, 2003 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 2, 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, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 3 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftest.file` fi rm -f conftest.file if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) # AM_PROG_INSTALL_STRIP # Copyright (C) 2001, 2003 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 2, 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, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in `make install-strip', and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be `maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) filtergen-0.12.4/fgadm.conf0000644000175000017500000000051410110551030012405 00000000000000# /usr/local/etc/fgadm.conf # Set BACKEND to one of `iptables', `ipchains', `ipfilter', or `cisco', for # your particular packet filter target. The default is `iptables'. BACKEND=iptables # Set any other options you want to give to filtergen when it runs from the # initscript here. See filtergen(8) for more details. FGOPTS="" filtergen-0.12.4/rules.filter0000644000175000017500000000042510110551030013022 00000000000000# ${prefix}/etc/rules.filter # Please read /usr/local/share/doc/filtergen/examples/*.filter for # more comprehensive filter examples. # allow all traffic on the loopback interface {input lo; output lo } accept; # allow all traffic on eth0 {input eth0; output eth0 } accept; filtergen-0.12.4/Makefile.am0000644000175000017500000000132710061603501012525 00000000000000SUBDIRS = . t sbin_PROGRAMS = filtergen sbin_SCRIPTS = fgadm filtergen_SOURCES = \ filtergen.c \ gen.c \ filter.c \ fg-util.c \ fg-iptables.c \ fg-ipchains.c \ fg-ipfilter.c \ fg-cisco.c \ parser.y \ scanner.l \ glue.c \ resolver.c \ icmpent.c \ factoriser.c filtergen_LDADD = @GETOPT_LIBS@ headers = filter.h util.h ast.h resolver.h icmpent.h factoriser.h mans = filter_backends.7 filter_syntax.5 filtergen.8 fgadm.8 man_MANS = $(mans) dist_sysconf_DATA = fgadm.conf rules.filter dist_pkgex_DATA = $(top_srcdir)/examples/*.filter dist_pkgdoc_DATA = $(top_srcdir)/doc/* EXTRA_DIST = HISTORY HONESTY README TODO $(headers) $(mans) filtergen.spec AM_CFLAGS = -D_GNU_SOURCE AM_LDFLAGS = -g AM_YFLAGS = -d filtergen-0.12.4/Makefile.in0000644000175000017500000010220610110551016012532 00000000000000# Makefile.in generated by automake 1.8.5 from Makefile.am. # @configure_input@ # 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@ SOURCES = $(filtergen_SOURCES) srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = . am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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 = : sbin_PROGRAMS = filtergen$(EXEEXT) subdir = . DIST_COMMON = README $(am__configure_deps) $(dist_pkgdoc_DATA) \ $(dist_pkgex_DATA) $(dist_sysconf_DATA) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(srcdir)/fgadm.conf.in $(srcdir)/fgadm.in \ $(srcdir)/filtergen.spec.in $(srcdir)/rules.filter.in \ $(top_srcdir)/configure AUTHORS INSTALL THANKS TODO depcomp \ install-sh missing parser.c parser.h scanner.c ylwrap ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno configure.status.lineno mkinstalldirs = $(mkdir_p) CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = filtergen.spec fgadm fgadm.conf rules.filter am__installdirs = "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(man7dir)" "$(DESTDIR)$(man8dir)" "$(DESTDIR)$(pkgdocdir)" "$(DESTDIR)$(pkgexdir)" "$(DESTDIR)$(sysconfdir)" sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(sbin_PROGRAMS) am_filtergen_OBJECTS = filtergen.$(OBJEXT) gen.$(OBJEXT) \ filter.$(OBJEXT) fg-util.$(OBJEXT) fg-iptables.$(OBJEXT) \ fg-ipchains.$(OBJEXT) fg-ipfilter.$(OBJEXT) fg-cisco.$(OBJEXT) \ parser.$(OBJEXT) scanner.$(OBJEXT) glue.$(OBJEXT) \ resolver.$(OBJEXT) icmpent.$(OBJEXT) factoriser.$(OBJEXT) filtergen_OBJECTS = $(am_filtergen_OBJECTS) filtergen_DEPENDENCIES = sbinSCRIPT_INSTALL = $(INSTALL_SCRIPT) SCRIPTS = $(sbin_SCRIPTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I. depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/factoriser.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/fg-cisco.Po ./$(DEPDIR)/fg-ipchains.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/fg-ipfilter.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/fg-iptables.Po ./$(DEPDIR)/fg-util.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/filter.Po ./$(DEPDIR)/filtergen.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/gen.Po ./$(DEPDIR)/glue.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/icmpent.Po ./$(DEPDIR)/parser.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/resolver.Po ./$(DEPDIR)/scanner.Po COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ LEXCOMPILE = $(LEX) $(LFLAGS) $(AM_LFLAGS) YACCCOMPILE = $(YACC) $(YFLAGS) $(AM_YFLAGS) SOURCES = $(filtergen_SOURCES) DIST_SOURCES = $(filtergen_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-exec-recursive install-info-recursive \ install-recursive installcheck-recursive installdirs-recursive \ pdf-recursive ps-recursive uninstall-info-recursive \ uninstall-recursive man5dir = $(mandir)/man5 man7dir = $(mandir)/man7 man8dir = $(mandir)/man8 NROFF = nroff MANS = $(man_MANS) dist_pkgdocDATA_INSTALL = $(INSTALL_DATA) dist_pkgexDATA_INSTALL = $(INSTALL_DATA) dist_sysconfDATA_INSTALL = $(INSTALL_DATA) DATA = $(dist_pkgdoc_DATA) $(dist_pkgex_DATA) $(dist_sysconf_DATA) ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ { test ! -d $(distdir) \ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -fr $(distdir); }; } DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2 GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GETOPT_LIBS = @GETOPT_LIBS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PROGRAM = @PROGRAM@ SBINDIR = @SBINDIR@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SYSCONFDIR = @SYSCONFDIR@ VERSION = @VERSION@ YACC = @YACC@ ac_ct_CC = @ac_ct_CC@ ac_ct_STRIP = @ac_ct_STRIP@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ bindir = @bindir@ build_alias = @build_alias@ datadir = @datadir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pkgdocdir = @pkgdocdir@ pkgexdir = @pkgexdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ SUBDIRS = . t sbin_SCRIPTS = fgadm filtergen_SOURCES = \ filtergen.c \ gen.c \ filter.c \ fg-util.c \ fg-iptables.c \ fg-ipchains.c \ fg-ipfilter.c \ fg-cisco.c \ parser.y \ scanner.l \ glue.c \ resolver.c \ icmpent.c \ factoriser.c filtergen_LDADD = @GETOPT_LIBS@ headers = filter.h util.h ast.h resolver.h icmpent.h factoriser.h mans = filter_backends.7 filter_syntax.5 filtergen.8 fgadm.8 man_MANS = $(mans) dist_sysconf_DATA = fgadm.conf rules.filter dist_pkgex_DATA = $(top_srcdir)/examples/*.filter dist_pkgdoc_DATA = $(top_srcdir)/doc/* EXTRA_DIST = HISTORY HONESTY README TODO $(headers) $(mans) filtergen.spec AM_CFLAGS = -D_GNU_SOURCE AM_LDFLAGS = -g AM_YFLAGS = -d all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: .SUFFIXES: .c .l .o .obj .y am--refresh: @: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \ cd $(srcdir) && $(AUTOMAKE) --foreign \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) config.h: stamp-h1 @if test ! -f $@; then \ rm -f stamp-h1; \ $(MAKE) stamp-h1; \ else :; fi stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h $(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_srcdir) && $(AUTOHEADER) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 filtergen.spec: $(top_builddir)/config.status $(srcdir)/filtergen.spec.in cd $(top_builddir) && $(SHELL) ./config.status $@ fgadm: $(top_builddir)/config.status $(srcdir)/fgadm.in cd $(top_builddir) && $(SHELL) ./config.status $@ fgadm.conf: $(top_builddir)/config.status $(srcdir)/fgadm.conf.in cd $(top_builddir) && $(SHELL) ./config.status $@ rules.filter: $(top_builddir)/config.status $(srcdir)/rules.filter.in cd $(top_builddir) && $(SHELL) ./config.status $@ install-sbinPROGRAMS: $(sbin_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(sbindir)" || $(mkdir_p) "$(DESTDIR)$(sbindir)" @list='$(sbin_PROGRAMS)'; for p in $$list; do \ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ if test -f $$p \ ; then \ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ echo " $(INSTALL_PROGRAM_ENV) $(sbinPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(sbindir)/$$f'"; \ $(INSTALL_PROGRAM_ENV) $(sbinPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(sbindir)/$$f" || exit 1; \ else :; fi; \ done uninstall-sbinPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(sbin_PROGRAMS)'; for p in $$list; do \ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ echo " rm -f '$(DESTDIR)$(sbindir)/$$f'"; \ rm -f "$(DESTDIR)$(sbindir)/$$f"; \ done clean-sbinPROGRAMS: -test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS) parser.h: parser.c @if test ! -f $@; then \ rm -f parser.c; \ $(MAKE) parser.c; \ else :; fi filtergen$(EXEEXT): $(filtergen_OBJECTS) $(filtergen_DEPENDENCIES) @rm -f filtergen$(EXEEXT) $(LINK) $(filtergen_LDFLAGS) $(filtergen_OBJECTS) $(filtergen_LDADD) $(LIBS) install-sbinSCRIPTS: $(sbin_SCRIPTS) @$(NORMAL_INSTALL) test -z "$(sbindir)" || $(mkdir_p) "$(DESTDIR)$(sbindir)" @list='$(sbin_SCRIPTS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ if test -f $$d$$p; then \ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ echo " $(sbinSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(sbindir)/$$f'"; \ $(sbinSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(sbindir)/$$f"; \ else :; fi; \ done uninstall-sbinSCRIPTS: @$(NORMAL_UNINSTALL) @list='$(sbin_SCRIPTS)'; for p in $$list; do \ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ echo " rm -f '$(DESTDIR)$(sbindir)/$$f'"; \ rm -f "$(DESTDIR)$(sbindir)/$$f"; \ done mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/factoriser.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fg-cisco.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fg-ipchains.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fg-ipfilter.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fg-iptables.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fg-util.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filtergen.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gen.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glue.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/icmpent.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parser.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/resolver.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scanner.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .l.c: $(LEXCOMPILE) $< sed '/^#/ s|$(LEX_OUTPUT_ROOT)\.c|$@|' $(LEX_OUTPUT_ROOT).c >$@ rm -f $(LEX_OUTPUT_ROOT).c .y.c: $(YACCCOMPILE) $< if test -f y.tab.h; then \ to=`echo "$*_H" | sed \ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \ -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`; \ sed "/^#/ s/Y_TAB_H/$$to/g" y.tab.h >$*.ht; \ rm -f y.tab.h; \ if cmp -s $*.ht $*.h; then \ rm -f $*.ht ;\ else \ mv $*.ht $*.h; \ fi; \ fi if test -f y.output; then \ mv y.output $*.output; \ fi sed '/^#/ s|y\.tab\.c|$@|' y.tab.c >$@t && mv $@t $@ rm -f y.tab.c uninstall-info-am: install-man5: $(man5_MANS) $(man_MANS) @$(NORMAL_INSTALL) test -z "$(man5dir)" || $(mkdir_p) "$(DESTDIR)$(man5dir)" @list='$(man5_MANS) $(dist_man5_MANS) $(nodist_man5_MANS)'; \ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ for i in $$l2; do \ case "$$i" in \ *.5*) list="$$list $$i" ;; \ esac; \ done; \ for i in $$list; do \ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ else file=$$i; fi; \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ case "$$ext" in \ 5*) ;; \ *) ext='5' ;; \ esac; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed -e 's/^.*\///'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man5dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man5dir)/$$inst"; \ done uninstall-man5: @$(NORMAL_UNINSTALL) @list='$(man5_MANS) $(dist_man5_MANS) $(nodist_man5_MANS)'; \ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ for i in $$l2; do \ case "$$i" in \ *.5*) list="$$list $$i" ;; \ esac; \ done; \ for i in $$list; do \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ case "$$ext" in \ 5*) ;; \ *) ext='5' ;; \ esac; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed -e 's/^.*\///'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ echo " rm -f '$(DESTDIR)$(man5dir)/$$inst'"; \ rm -f "$(DESTDIR)$(man5dir)/$$inst"; \ done install-man7: $(man7_MANS) $(man_MANS) @$(NORMAL_INSTALL) test -z "$(man7dir)" || $(mkdir_p) "$(DESTDIR)$(man7dir)" @list='$(man7_MANS) $(dist_man7_MANS) $(nodist_man7_MANS)'; \ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ for i in $$l2; do \ case "$$i" in \ *.7*) list="$$list $$i" ;; \ esac; \ done; \ for i in $$list; do \ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ else file=$$i; fi; \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ case "$$ext" in \ 7*) ;; \ *) ext='7' ;; \ esac; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed -e 's/^.*\///'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man7dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man7dir)/$$inst"; \ done uninstall-man7: @$(NORMAL_UNINSTALL) @list='$(man7_MANS) $(dist_man7_MANS) $(nodist_man7_MANS)'; \ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ for i in $$l2; do \ case "$$i" in \ *.7*) list="$$list $$i" ;; \ esac; \ done; \ for i in $$list; do \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ case "$$ext" in \ 7*) ;; \ *) ext='7' ;; \ esac; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed -e 's/^.*\///'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ echo " rm -f '$(DESTDIR)$(man7dir)/$$inst'"; \ rm -f "$(DESTDIR)$(man7dir)/$$inst"; \ done install-man8: $(man8_MANS) $(man_MANS) @$(NORMAL_INSTALL) test -z "$(man8dir)" || $(mkdir_p) "$(DESTDIR)$(man8dir)" @list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ for i in $$l2; do \ case "$$i" in \ *.8*) list="$$list $$i" ;; \ esac; \ done; \ for i in $$list; do \ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ else file=$$i; fi; \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ case "$$ext" in \ 8*) ;; \ *) ext='8' ;; \ esac; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed -e 's/^.*\///'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst"; \ done uninstall-man8: @$(NORMAL_UNINSTALL) @list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ for i in $$l2; do \ case "$$i" in \ *.8*) list="$$list $$i" ;; \ esac; \ done; \ for i in $$list; do \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ case "$$ext" in \ 8*) ;; \ *) ext='8' ;; \ esac; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed -e 's/^.*\///'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ echo " rm -f '$(DESTDIR)$(man8dir)/$$inst'"; \ rm -f "$(DESTDIR)$(man8dir)/$$inst"; \ done install-dist_pkgdocDATA: $(dist_pkgdoc_DATA) @$(NORMAL_INSTALL) test -z "$(pkgdocdir)" || $(mkdir_p) "$(DESTDIR)$(pkgdocdir)" @list='$(dist_pkgdoc_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(dist_pkgdocDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgdocdir)/$$f'"; \ $(dist_pkgdocDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgdocdir)/$$f"; \ done uninstall-dist_pkgdocDATA: @$(NORMAL_UNINSTALL) @list='$(dist_pkgdoc_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f '$(DESTDIR)$(pkgdocdir)/$$f'"; \ rm -f "$(DESTDIR)$(pkgdocdir)/$$f"; \ done install-dist_pkgexDATA: $(dist_pkgex_DATA) @$(NORMAL_INSTALL) test -z "$(pkgexdir)" || $(mkdir_p) "$(DESTDIR)$(pkgexdir)" @list='$(dist_pkgex_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(dist_pkgexDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgexdir)/$$f'"; \ $(dist_pkgexDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgexdir)/$$f"; \ done uninstall-dist_pkgexDATA: @$(NORMAL_UNINSTALL) @list='$(dist_pkgex_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f '$(DESTDIR)$(pkgexdir)/$$f'"; \ rm -f "$(DESTDIR)$(pkgexdir)/$$f"; \ done install-dist_sysconfDATA: $(dist_sysconf_DATA) @$(NORMAL_INSTALL) test -z "$(sysconfdir)" || $(mkdir_p) "$(DESTDIR)$(sysconfdir)" @list='$(dist_sysconf_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(dist_sysconfDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(sysconfdir)/$$f'"; \ $(dist_sysconfDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(sysconfdir)/$$f"; \ done uninstall-dist_sysconfDATA: @$(NORMAL_UNINSTALL) @list='$(dist_sysconf_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f '$(DESTDIR)$(sysconfdir)/$$f'"; \ rm -f "$(DESTDIR)$(sysconfdir)/$$f"; \ done # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @set fnord $$MAKEFLAGS; amf=$$2; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: @set fnord $$MAKEFLAGS; amf=$$2; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) $(am__remove_distdir) mkdir $(distdir) $(mkdir_p) $(distdir)/. $(distdir)/doc $(distdir)/examples @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 list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || mkdir "$(distdir)/$$subdir" \ || exit 1; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="../$(top_distdir)" \ distdir="../$(distdir)/$$subdir" \ distdir) \ || exit 1; \ fi; \ done -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r $(distdir) dist-gzip: distdir $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir $(AMTAR) chof - $(distdir) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-tarZ: distdir $(AMTAR) chof - $(distdir) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(AMTAR) chof - $(distdir) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - ;;\ *.tar.bz2*) \ bunzip2 -c $(distdir).tar.bz2 | $(AMTAR) xf - ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(AMTAR) xf - ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && cd $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}' distuninstallcheck: @cd $(distuninstallcheck_dir) \ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile $(PROGRAMS) $(SCRIPTS) $(MANS) $(DATA) config.h installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(man7dir)" "$(DESTDIR)$(man8dir)" "$(DESTDIR)$(pkgdocdir)" "$(DESTDIR)$(pkgexdir)" "$(DESTDIR)$(sysconfdir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive 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." -rm -f scanner.c -rm -f parser.h -rm -f parser.c clean: clean-recursive clean-am: clean-generic clean-sbinPROGRAMS mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive info: info-recursive info-am: install-data-am: install-dist_pkgdocDATA install-dist_pkgexDATA \ install-man install-exec-am: install-dist_sysconfDATA install-sbinPROGRAMS \ install-sbinSCRIPTS install-info: install-info-recursive install-man: install-man5 install-man7 install-man8 installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-dist_pkgdocDATA uninstall-dist_pkgexDATA \ uninstall-dist_sysconfDATA uninstall-info-am uninstall-man \ uninstall-sbinPROGRAMS uninstall-sbinSCRIPTS uninstall-info: uninstall-info-recursive uninstall-man: uninstall-man5 uninstall-man7 uninstall-man8 .PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \ check-am clean clean-generic clean-recursive \ clean-sbinPROGRAMS ctags ctags-recursive dist dist-all \ dist-bzip2 dist-gzip dist-shar dist-tarZ dist-zip distcheck \ distclean distclean-compile distclean-generic distclean-hdr \ distclean-recursive distclean-tags distcleancheck distdir \ distuninstallcheck dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am \ install-dist_pkgdocDATA install-dist_pkgexDATA \ install-dist_sysconfDATA install-exec install-exec-am \ install-info install-info-am install-man install-man5 \ install-man7 install-man8 install-sbinPROGRAMS \ install-sbinSCRIPTS install-strip installcheck installcheck-am \ installdirs installdirs-am maintainer-clean \ maintainer-clean-generic maintainer-clean-recursive \ mostlyclean mostlyclean-compile mostlyclean-generic \ mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am uninstall-dist_pkgdocDATA \ uninstall-dist_pkgexDATA uninstall-dist_sysconfDATA \ uninstall-info-am uninstall-man uninstall-man5 uninstall-man7 \ uninstall-man8 uninstall-sbinPROGRAMS uninstall-sbinSCRIPTS # 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: filtergen-0.12.4/config.h.in0000644000175000017500000000303210110551032012503 00000000000000/* config.h.in. Generated from configure.in by autoheader. */ /* Define to 1 if you have the header file. */ #undef HAVE_GETOPT_H /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION /* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a `char[]'. */ #undef YYTEXT_POINTER filtergen-0.12.4/fgadm.conf.in0000644000175000017500000000051210061464477013037 00000000000000# @SYSCONFDIR@/fgadm.conf # Set BACKEND to one of `iptables', `ipchains', `ipfilter', or `cisco', for # your particular packet filter target. The default is `iptables'. BACKEND=iptables # Set any other options you want to give to filtergen when it runs from the # initscript here. See filtergen(8) for more details. FGOPTS="" filtergen-0.12.4/fgadm.in0000644000175000017500000000364110110541720012077 00000000000000#!/bin/sh FILTER=@SYSCONFDIR@/rules.filter CONF=@SYSCONFDIR@/filtergen.conf FILTERGEN=@SBINDIR@/filtergen # move to the config directory so relative includes work if ! test -d @SYSCONFDIR@ ; then echo @SYSCONFDIR@ not found exit 1 fi cd @SYSCONFDIR@ # load config options if [ -f $CONF ]; then . $CONF fi # sanity check config values case "$BACKEND" in iptables|ipchains|ipfilter|cisco) ;; *) BACKEND="iptables" ;; esac # check validity of input file check () { $FILTERGEN $FGOPTS -t $BACKEND $FILTER } reload () { if [ -f $FILTER ]; then echo "Generating $BACKEND packet filter." case "$BACKEND" in iptables|ipchains) if [ -x /sbin/$BACKEND ]; then if $FILTERGEN $FGOPTS -t $BACKEND $FILTER > /dev/null ; then $FILTERGEN $FGOPTS -t $BACKEND $FILTER | /bin/sh else echo "Errors found in $FILTER. Not reloading." RETVAL=1 fi else echo "/sbin/$BACKEND not found. Not reloading." RETVAL=1 fi ;; *) echo "Operation not supported for $BACKEND backend." ;; esac else echo "$RULES not found. Not reloading." RETVAL=1 fi } stop () { echo "Stopping current packet filter." case "$BACKEND" in iptables|ipchains) if [ -x /sbin/$BACKEND ]; then $FILTERGEN -t $BACKEND -F ACCEPT | /bin/sh else echo "/sbin/$BACKEND not found" RETVAL=1 fi ;; *) echo "Operation not supported for $BACKEND backend." ;; esac } save () { case "$BACKEND" in iptables) if [ -f /etc/redhat-release ]; then /sbin/service iptables save fi ;; ipchains) if [ -f /etc/redhat-release ]; then /sbin/service ipchains save fi ;; *) echo "Operation not supported for $BACKEND backend." ;; esac } usage () { echo < Source: http://spacepants.org/src/filtergen/download/%name-%version.tar.gz Buildroot: %{_tmppath}/%{name}-root BuildPrereq: rpm-build gcc flex make %description filtergen is a packet filter generator. It compiles a fairly high-level description language into iptables, ipchains, or ipfilter rules (and has bits of support for Cisco IOS access lists). %prep %setup -q ./configure %build make CFLAGS="${RPM_OPT_FLAGS}" %install rm -rf $RPM_BUILD_ROOT make PREFIX=${RPM_BUILD_ROOT}/usr BINDIR=${RPM_BUILD_ROOT}/sbin install %post /sbin/chkconfig --add filtergen /sbin/chkconfig filtergen off %preun /sbin/service filtergen accept /sbin/chkconfig --del filtergen %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root) /sbin/filtergen /etc/init.d/filtergen /etc/filter/ %{_mandir}/* %doc HISTORY HONESTY README TODO tests/*.filter %changelog * Wed Mar 10 2004 Jamie Wilkinson - 0.12-1 - New upstream release. * Wed Nov 13 2002 Matthew Kirkwood 0.11-1 - Release 0.11, rename init script from "filter" to "filtergen" * Mon Sep 2 2002 Matthew Kirkwood 0.10-1 - Add new sample and documentation stuff * Sun Aug 18 2002 Wil Cooley 0.8-1 - Initial RPM creation filtergen-0.12.4/rules.filter.in0000644000175000017500000000036710061464476013462 00000000000000# @sysconfdir@/rules.filter # Please read @pkgexdir@/*.filter for # more comprehensive filter examples. # allow all traffic on the loopback interface {input lo; output lo } accept; # allow all traffic on eth0 {input eth0; output eth0 } accept; filtergen-0.12.4/configure0000755000175000017500000047632010110551020012402 00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59 for filtergen 0.12.4. # # Report bugs to . # # Copyright (C) 2003 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # 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 sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # 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'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` exec 6>&1 # # Initializations. # ac_default_prefix=/usr/local ac_config_libobj_dir=. cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. # This variable seems obsolete. It should probably be removed, and # only ac_max_sed_lines should be used. : ${ac_max_here_lines=38} # Identity of this package. PACKAGE_NAME='filtergen' PACKAGE_TARNAME='filtergen' PACKAGE_VERSION='0.12.4' PACKAGE_STRING='filtergen 0.12.4' PACKAGE_BUGREPORT='jaq@spacepants.org' ac_unique_file="filtergen.c" # Factoring default headers for most tests. ac_includes_default="\ #include #if HAVE_SYS_TYPES_H # include #endif #if HAVE_SYS_STAT_H # include #endif #if STDC_HEADERS # include # include #else # if HAVE_STDLIB_H # include # endif #endif #if HAVE_STRING_H # if !STDC_HEADERS && HAVE_MEMORY_H # include # endif # include #endif #if HAVE_STRINGS_H # include #endif #if HAVE_INTTYPES_H # include #else # if HAVE_STDINT_H # include # endif #endif #if HAVE_UNISTD_H # include #endif" ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT PROGRAM CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE LEX LEXLIB LEX_OUTPUT_ROOT YACC CPP EGREP GETOPT_LIBS BINDIR SBINDIR SYSCONFDIR pkgdocdir pkgexdir LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_option in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/-/_/g'` eval "with_$ac_package=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` eval "$ac_envvar='$ac_optarg'" export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute paths. for ac_var in exec_prefix prefix do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* | NONE | '' ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe 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 fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_confdir=`(dirname "$0") 2>/dev/null || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 { (exit 1); exit 1; }; } else { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi fi (cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 { (exit 1); exit 1; }; } srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` ac_env_build_alias_set=${build_alias+set} ac_env_build_alias_value=$build_alias ac_cv_env_build_alias_set=${build_alias+set} ac_cv_env_build_alias_value=$build_alias ac_env_host_alias_set=${host_alias+set} ac_env_host_alias_value=$host_alias ac_cv_env_host_alias_set=${host_alias+set} ac_cv_env_host_alias_value=$host_alias ac_env_target_alias_set=${target_alias+set} ac_env_target_alias_value=$target_alias ac_cv_env_target_alias_set=${target_alias+set} ac_cv_env_target_alias_value=$target_alias ac_env_CC_set=${CC+set} ac_env_CC_value=$CC ac_cv_env_CC_set=${CC+set} ac_cv_env_CC_value=$CC ac_env_CFLAGS_set=${CFLAGS+set} ac_env_CFLAGS_value=$CFLAGS ac_cv_env_CFLAGS_set=${CFLAGS+set} ac_cv_env_CFLAGS_value=$CFLAGS ac_env_LDFLAGS_set=${LDFLAGS+set} ac_env_LDFLAGS_value=$LDFLAGS ac_cv_env_LDFLAGS_set=${LDFLAGS+set} ac_cv_env_LDFLAGS_value=$LDFLAGS ac_env_CPPFLAGS_set=${CPPFLAGS+set} ac_env_CPPFLAGS_value=$CPPFLAGS ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} ac_cv_env_CPPFLAGS_value=$CPPFLAGS ac_env_CPP_set=${CPP+set} ac_env_CPP_value=$CPP ac_cv_env_CPP_set=${CPP+set} ac_cv_env_CPP_value=$CPP # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures filtergen 0.12.4 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] _ACEOF cat <<_ACEOF Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --datadir=DIR read-only architecture-independent data [PREFIX/share] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --infodir=DIR info documentation [PREFIX/info] --mandir=DIR man documentation [PREFIX/man] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of filtergen 0.12.4:";; esac cat <<\_ACEOF Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-debug enable debugging compiler options Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. ac_popdir=`pwd` for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d $ac_dir || continue ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac cd $ac_dir # Check for guested configure; otherwise get Cygnus style configure. if test -f $ac_srcdir/configure.gnu; then echo $SHELL $ac_srcdir/configure.gnu --help=recursive elif test -f $ac_srcdir/configure; then echo $SHELL $ac_srcdir/configure --help=recursive elif test -f $ac_srcdir/configure.ac || test -f $ac_srcdir/configure.in; then echo $ac_configure --help else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi cd "$ac_popdir" done fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF filtergen configure 0.12.4 generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit 0 fi exec 5>config.log cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by filtergen $as_me 0.12.4, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ _ACEOF { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` hostinfo = `(hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_sep= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" # Get rid of the leading space. ac_sep=" " ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Be sure not to use single quotes in there, as some shells, # such as our DU 5.0 friend, will then `close' the trap. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, { (set) 2>&1 | case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------- ## ## Output files. ## ## ------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo sed "/^$/d" confdefs.h | sort echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core && rm -rf conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo >confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; *) . ./$cache_file;; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in `(set) 2>&1 | sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val="\$ac_cv_env_${ac_var}_value" eval ac_new_val="\$ac_env_${ac_var}_value" case $ac_old_set,$ac_new_set in set,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu am__api_version="1.8" ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f $ac_dir/install.sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f $ac_dir/shtool; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} { (exit 1); exit 1; }; } fi ac_config_guess="$SHELL $ac_aux_dir/config.guess" ac_config_sub="$SHELL $ac_aux_dir/config.sub" ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_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. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL=$ac_install_sh fi fi echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo "$as_me:$LINENO: checking whether build environment is sane" >&5 echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 # Just in case sleep 1 echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&5 echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&2;} { (exit 1); exit 1; }; } fi test "$2" = conftest.file ) then # Ok. : else { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! Check your system clock" >&5 echo "$as_me: error: newly created file is older than distributed files! Check your system clock" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 test "$program_prefix" != NONE && program_transform_name="s,^,$program_prefix,;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s,\$,$program_suffix,;$program_transform_name" # Double any \ or $. echo might interpret backslashes. # By default was `s,x,x', remove it if useless. cat <<\_ACEOF >conftest.sed s/[\\$]/&&/g;s/;s,x,x,$// _ACEOF program_transform_name=`echo $program_transform_name | sed -f conftest.sed` rm conftest.sed # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then # Keeping the `.' argument allows $(mkdir_p) to be used without # argument. Indeed, we sometimes output rules like # $(mkdir_p) $(somedir) # where $(somedir) is conditionally defined. # (`test -n '$(somedir)' && $(mkdir_p) $(somedir)' is a more # expensive solution, as it forces Make to start a sub-shell.) mkdir_p='mkdir -p -- .' else # On NextStep and OpenStep, the `mkdir' command does not # recognize any option. It will interpret all options as # directories to create, and then abort because `.' already # exists. for d in ./-p ./--version; do test -d $d && rmdir $d done # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. if test -f "$ac_aux_dir/mkinstalldirs"; then mkdir_p='$(mkinstalldirs)' else mkdir_p='$(install_sh) -d' fi fi for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_AWK+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then echo "$as_me:$LINENO: result: $AWK" >&5 echo "${ECHO_T}$AWK" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$AWK" && break done echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.make <<\_ACEOF all: @echo 'ac_maketemp="$(MAKE)"' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` if test -n "$ac_maketemp"; then eval ac_cv_prog_make_${ac_make}_set=yes else eval ac_cv_prog_make_${ac_make}_set=no fi rm -f conftest.make fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 SET_MAKE= else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null # test to see if srcdir already configured if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} { (exit 1); exit 1; }; } fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='filtergen' VERSION='0.12.4' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} AMTAR=${AMTAR-"${am_missing_run}tar"} install_sh=${install_sh-"$am_aux_dir/install-sh"} # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then echo "$as_me:$LINENO: result: $STRIP" >&5 echo "${ECHO_T}$STRIP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 echo "${ECHO_T}$ac_ct_STRIP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi STRIP=$ac_ct_STRIP else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" # We need awk for the "check" target. The system "awk" is bad on # some platforms. ac_aux_dir= for ac_dir in . $srcdir/.; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f $ac_dir/install.sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f $ac_dir/shtool; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in . $srcdir/." >&5 echo "$as_me: error: cannot find install-sh or install.sh in . $srcdir/." >&2;} { (exit 1); exit 1; }; } fi ac_config_guess="$SHELL $ac_aux_dir/config.guess" ac_config_sub="$SHELL $ac_aux_dir/config.sub" ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. ac_config_headers="$ac_config_headers config.h" echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5 echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6 # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then enableval="$enable_maintainer_mode" USE_MAINTAINER_MODE=$enableval else USE_MAINTAINER_MODE=no fi; echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5 echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6 if test $USE_MAINTAINER_MODE = yes; then MAINTAINER_MODE_TRUE= MAINTAINER_MODE_FALSE='#' else MAINTAINER_MODE_TRUE='#' MAINTAINER_MODE_FALSE= fi MAINT=$MAINTAINER_MODE_TRUE filtergen_config_ok=yes ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_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 fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CC" && break done CC=$ac_ct_CC fi fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO:" \ "checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Find the output, starting from the most likely. This scheme is # not robust to junk in `.', hence go to wildcards (a.*) only as a last # resort. # Be careful to initialize this variable, since it used to be cached. # Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. ac_cv_exeext= # b.out is created by i960 compilers. for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; conftest.$ac_ext ) # This is the source file. ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` # FIXME: I believe we export ac_cv_exeext for Libtool, # but it would be cool to find out if it's true. Does anybody # maintain Libtool? --akim. export ac_cv_exeext break;; * ) break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6 # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6 echo "$as_me:$LINENO: checking for suffix of executables" >&5 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` export ac_cv_exeext break;; * ) break;; esac done else { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6 rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT echo "$as_me:$LINENO: checking for suffix of object files" >&5 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS CFLAGS="-g" echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cc_g=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 if test "${ac_cv_prog_cc_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* 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); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std1 is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std1. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX 10.20 and later -Ae # HP-UX older versions -Aa -D_HPUX_SOURCE # SVR4 -Xc -D__EXTENSIONS__ for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_stdc=$ac_arg break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext done rm -f conftest.$ac_ext conftest.$ac_objext CC=$ac_save_CC fi case "x$ac_cv_prog_cc_stdc" in x|xno) echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6 ;; *) echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 CC="$CC $ac_cv_prog_cc_stdc" ;; esac # Some people use a C++ compiler to compile C. Since we use `exit', # in C++ we need to declare it. In case someone uses the same compiler # for both compiling C and C++ we need to have the C++ compiler decide # the declaration of exit, since it's the most demanding environment. cat >conftest.$ac_ext <<_ACEOF #ifndef __cplusplus choke me #endif _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration #include int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 continue fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo done .PHONY: am__doit END # If we don't find an include directive, just comment out the code. echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6 am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # We grep out `Entering directory' and `Leaving directory' # messages which can occur if `w' ends up in MAKEFLAGS. # In particular we don't look at `^make:' because GNU make might # be invoked under some other name (usually "gmake"), in which # case it prints its new name instead of `make'. if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU fi # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then am__include=.include am__quote="\"" _am_result=BSD fi fi echo "$as_me:$LINENO: result: $_am_result" >&5 echo "${ECHO_T}$_am_result" >&6 rm -f confinc confmf # Check whether --enable-dependency-tracking or --disable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then enableval="$enable_dependency_tracking" fi; if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CC" am_compiler_list= echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6 CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi for ac_prog in flex lex do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_LEX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$LEX"; then ac_cv_prog_LEX="$LEX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_LEX="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi LEX=$ac_cv_prog_LEX if test -n "$LEX"; then echo "$as_me:$LINENO: result: $LEX" >&5 echo "${ECHO_T}$LEX" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$LEX" && break done test -n "$LEX" || LEX=":" if test -z "$LEXLIB" then echo "$as_me:$LINENO: checking for yywrap in -lfl" >&5 echo $ECHO_N "checking for yywrap in -lfl... $ECHO_C" >&6 if test "${ac_cv_lib_fl_yywrap+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lfl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char yywrap (); int main () { yywrap (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_fl_yywrap=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_fl_yywrap=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_fl_yywrap" >&5 echo "${ECHO_T}$ac_cv_lib_fl_yywrap" >&6 if test $ac_cv_lib_fl_yywrap = yes; then LEXLIB="-lfl" else echo "$as_me:$LINENO: checking for yywrap in -ll" >&5 echo $ECHO_N "checking for yywrap in -ll... $ECHO_C" >&6 if test "${ac_cv_lib_l_yywrap+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ll $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char yywrap (); int main () { yywrap (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_l_yywrap=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_l_yywrap=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_l_yywrap" >&5 echo "${ECHO_T}$ac_cv_lib_l_yywrap" >&6 if test $ac_cv_lib_l_yywrap = yes; then LEXLIB="-ll" fi fi fi if test "x$LEX" != "x:"; then echo "$as_me:$LINENO: checking lex output file root" >&5 echo $ECHO_N "checking lex output file root... $ECHO_C" >&6 if test "${ac_cv_prog_lex_root+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # The minimal lex program is just a single line: %%. But some broken lexes # (Solaris, I think it was) want two %% lines, so accommodate them. cat >conftest.l <<_ACEOF %% %% _ACEOF { (eval echo "$as_me:$LINENO: \"$LEX conftest.l\"") >&5 (eval $LEX conftest.l) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } if test -f lex.yy.c; then ac_cv_prog_lex_root=lex.yy elif test -f lexyy.c; then ac_cv_prog_lex_root=lexyy else { { echo "$as_me:$LINENO: error: cannot find output from $LEX; giving up" >&5 echo "$as_me: error: cannot find output from $LEX; giving up" >&2;} { (exit 1); exit 1; }; } fi fi echo "$as_me:$LINENO: result: $ac_cv_prog_lex_root" >&5 echo "${ECHO_T}$ac_cv_prog_lex_root" >&6 rm -f conftest.l LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root echo "$as_me:$LINENO: checking whether yytext is a pointer" >&5 echo $ECHO_N "checking whether yytext is a pointer... $ECHO_C" >&6 if test "${ac_cv_prog_lex_yytext_pointer+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # POSIX says lex can declare yytext either as a pointer or an array; the # default is implementation-dependent. Figure out which it is, since # not all implementations provide the %pointer and %array declarations. ac_cv_prog_lex_yytext_pointer=no echo 'extern char *yytext;' >>$LEX_OUTPUT_ROOT.c ac_save_LIBS=$LIBS LIBS="$LIBS $LEXLIB" cat >conftest.$ac_ext <<_ACEOF `cat $LEX_OUTPUT_ROOT.c` _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_lex_yytext_pointer=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_save_LIBS rm -f "${LEX_OUTPUT_ROOT}.c" fi echo "$as_me:$LINENO: result: $ac_cv_prog_lex_yytext_pointer" >&5 echo "${ECHO_T}$ac_cv_prog_lex_yytext_pointer" >&6 if test $ac_cv_prog_lex_yytext_pointer = yes; then cat >>confdefs.h <<\_ACEOF #define YYTEXT_POINTER 1 _ACEOF fi fi for ac_prog in 'bison -y' byacc do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_YACC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$YACC"; then ac_cv_prog_YACC="$YACC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_YACC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi YACC=$ac_cv_prog_YACC if test -n "$YACC"; then echo "$as_me:$LINENO: result: $YACC" >&5 echo "${ECHO_T}$YACC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$YACC" && break done test -n "$YACC" || YACC="yacc" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi echo "$as_me:$LINENO: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6 ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking for egrep" >&5 echo $ECHO_N "checking for egrep... $ECHO_C" >&6 if test "${ac_cv_prog_egrep+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if echo a | (grep -E '(a|b)') >/dev/null 2>&1 then ac_cv_prog_egrep='grep -E' else ac_cv_prog_egrep='egrep' fi fi echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 echo "${ECHO_T}$ac_cv_prog_egrep" >&6 EGREP=$ac_cv_prog_egrep echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in getopt.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## --------------------------------- ## ## Report this to jaq@spacepants.org ## ## --------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done HAVE_GETOPT=no echo "$as_me:$LINENO: checking for getopt in -lgetopt" >&5 echo $ECHO_N "checking for getopt in -lgetopt... $ECHO_C" >&6 if test "${ac_cv_lib_getopt_getopt+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lgetopt $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char getopt (); int main () { getopt (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_getopt_getopt=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_getopt_getopt=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_getopt_getopt" >&5 echo "${ECHO_T}$ac_cv_lib_getopt_getopt" >&6 if test $ac_cv_lib_getopt_getopt = yes; then HAVE_GETOPT=yes HAVE_GETOPT=no fi if test "x$HAVE_GETOPT" = xyes ; then GETOPT_LIBS="-lgetopt" fi if test "x$ac_cv_c_compiler_gnu" = xyes ; then CFLAGS="$CFLAGS -W -Wall -Werror -Waggregate-return" CFLAGS="$CFLAGS -Wcast-align -Wcast-qual -Wnested-externs" CFLAGS="$CFLAGS -Wshadow -Wbad-function-cast -Wwrite-strings" fi echo "$as_me:$LINENO: checking whether to enable debugging compiler options" >&5 echo $ECHO_N "checking whether to enable debugging compiler options... $ECHO_C" >&6 # Check whether --enable-debug or --disable-debug was given. if test "${enable_debug+set}" = set; then enableval="$enable_debug" echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 tmp_CFLAGS=`echo $CFLAGS | sed 's/O2/O0/g'` CFLAGS="$tmp_CFLAGS" else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi; test "$prefix" = "NONE" && prefix=/usr/local test "$exec_prefix" = "NONE" && exec_prefix=$prefix eval BINDIR="$bindir" eval SBINDIR="$sbindir" eval SYSCONFDIR="$sysconfdir" eval pkgdocdir="$datadir/doc/$PACKAGE" eval pkgexdir="$pkgdocdir/examples" if test "x$filtergen_config_ok" = xno ; then echo "nothing yet" else ac_config_files="$ac_config_files Makefile t/Makefile filtergen.spec fgadm fgadm.conf rules.filter" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. { (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | sed ' t clear : clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ : end' >>confcache if diff $cache_file confcache >/dev/null 2>&1; then :; else if test -w $cache_file; then test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/; s/:*\${srcdir}:*/:/; s/:*@srcdir@:*/:/; s/^\([^=]*=[ ]*\):*/\1/; s/:*$//; s/^[^=]*=[ ]*$//; }' fi DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_i=`echo "$ac_i" | sed 's/\$U\././;s/\.o$//;s/\.obj$//'` # 2. Add them. ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} { (exit 1); exit 1; }; } # 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 sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # 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'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH exec 6>&1 # Open the log real soon, to keep \$[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. Logging --version etc. is OK. exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX } >&5 cat >&5 <<_CSEOF This file was extended by filtergen $as_me 0.12.4, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ _CSEOF echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 echo >&5 _ACEOF # Files that config.status was made for. if test -n "$ac_config_files"; then echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS fi if test -n "$ac_config_headers"; then echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS fi if test -n "$ac_config_links"; then echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS fi if test -n "$ac_config_commands"; then echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS fi cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ filtergen config.status 0.12.4 configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2003 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." srcdir=$srcdir INSTALL="$INSTALL" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "x$1" : 'x\([^=]*\)='` ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` ac_shift=: ;; -*) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; *) # This is not an option, so the user has probably given explicit # arguments. ac_option=$1 ac_need_defaults=false;; esac case $ac_option in # Handling of the options. _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --vers* | -V ) echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header { { echo "$as_me:$LINENO: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # INIT-COMMANDS section. # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_config_target in $ac_config_targets do case "$ac_config_target" in # Handling of arguments. "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; "t/Makefile" ) CONFIG_FILES="$CONFIG_FILES t/Makefile" ;; "filtergen.spec" ) CONFIG_FILES="$CONFIG_FILES filtergen.spec" ;; "fgadm" ) CONFIG_FILES="$CONFIG_FILES fgadm" ;; "fgadm.conf" ) CONFIG_FILES="$CONFIG_FILES fgadm.conf" ;; "rules.filter" ) CONFIG_FILES="$CONFIG_FILES rules.filter" ;; "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason to put it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Create a temporary directory, and hook for its removal unless debugging. $debug || { trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./confstat$$-$RANDOM (umask 077 && mkdir $tmp) } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h if test -n "\$CONFIG_FILES"; then # Protect against being on the right side of a sed subst in config.status. sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF s,@SHELL@,$SHELL,;t t s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t s,@exec_prefix@,$exec_prefix,;t t s,@prefix@,$prefix,;t t s,@program_transform_name@,$program_transform_name,;t t s,@bindir@,$bindir,;t t s,@sbindir@,$sbindir,;t t s,@libexecdir@,$libexecdir,;t t s,@datadir@,$datadir,;t t s,@sysconfdir@,$sysconfdir,;t t s,@sharedstatedir@,$sharedstatedir,;t t s,@localstatedir@,$localstatedir,;t t s,@libdir@,$libdir,;t t s,@includedir@,$includedir,;t t s,@oldincludedir@,$oldincludedir,;t t s,@infodir@,$infodir,;t t s,@mandir@,$mandir,;t t s,@build_alias@,$build_alias,;t t s,@host_alias@,$host_alias,;t t s,@target_alias@,$target_alias,;t t s,@DEFS@,$DEFS,;t t s,@ECHO_C@,$ECHO_C,;t t s,@ECHO_N@,$ECHO_N,;t t s,@ECHO_T@,$ECHO_T,;t t s,@LIBS@,$LIBS,;t t s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t s,@INSTALL_DATA@,$INSTALL_DATA,;t t s,@CYGPATH_W@,$CYGPATH_W,;t t s,@PACKAGE@,$PACKAGE,;t t s,@VERSION@,$VERSION,;t t s,@ACLOCAL@,$ACLOCAL,;t t s,@AUTOCONF@,$AUTOCONF,;t t s,@AUTOMAKE@,$AUTOMAKE,;t t s,@AUTOHEADER@,$AUTOHEADER,;t t s,@MAKEINFO@,$MAKEINFO,;t t s,@AMTAR@,$AMTAR,;t t s,@install_sh@,$install_sh,;t t s,@STRIP@,$STRIP,;t t s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t s,@mkdir_p@,$mkdir_p,;t t s,@AWK@,$AWK,;t t s,@SET_MAKE@,$SET_MAKE,;t t s,@am__leading_dot@,$am__leading_dot,;t t s,@MAINTAINER_MODE_TRUE@,$MAINTAINER_MODE_TRUE,;t t s,@MAINTAINER_MODE_FALSE@,$MAINTAINER_MODE_FALSE,;t t s,@MAINT@,$MAINT,;t t s,@PROGRAM@,$PROGRAM,;t t s,@CC@,$CC,;t t s,@CFLAGS@,$CFLAGS,;t t s,@LDFLAGS@,$LDFLAGS,;t t s,@CPPFLAGS@,$CPPFLAGS,;t t s,@ac_ct_CC@,$ac_ct_CC,;t t s,@EXEEXT@,$EXEEXT,;t t s,@OBJEXT@,$OBJEXT,;t t s,@DEPDIR@,$DEPDIR,;t t s,@am__include@,$am__include,;t t s,@am__quote@,$am__quote,;t t s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t s,@CCDEPMODE@,$CCDEPMODE,;t t s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t s,@LEX@,$LEX,;t t s,@LEXLIB@,$LEXLIB,;t t s,@LEX_OUTPUT_ROOT@,$LEX_OUTPUT_ROOT,;t t s,@YACC@,$YACC,;t t s,@CPP@,$CPP,;t t s,@EGREP@,$EGREP,;t t s,@GETOPT_LIBS@,$GETOPT_LIBS,;t t s,@BINDIR@,$BINDIR,;t t s,@SBINDIR@,$SBINDIR,;t t s,@SYSCONFDIR@,$SYSCONFDIR,;t t s,@pkgdocdir@,$pkgdocdir,;t t s,@pkgexdir@,$pkgexdir,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_lines=48 ac_sed_frag=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_lines # Line after last line for current file. ac_more_lines=: ac_sed_cmds= while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag else sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag fi if test ! -s $tmp/subs.frag; then ac_more_lines=false else # The purpose of the label and of the branching condition is to # speed up the sed processing (if there are no `@' at all, there # is no need to browse any of the substitutions). # These are the two extra sed commands mentioned above. (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_lines` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi fi # test -n "$CONFIG_FILES" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_builddir$INSTALL ;; esac # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then configure_input= else configure_input="$ac_file. " fi configure_input=$configure_input"Generated from `echo $ac_file_in | sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo "$f";; *) # Relative if test -f "$f"; then # Build tree echo "$f" elif test -f "$srcdir/$f"; then # Source tree echo "$srcdir/$f" else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } if test x"$ac_file" != x-; then { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s,@configure_input@,$configure_input,;t t s,@srcdir@,$ac_srcdir,;t t s,@abs_srcdir@,$ac_abs_srcdir,;t t s,@top_srcdir@,$ac_top_srcdir,;t t s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t s,@builddir@,$ac_builddir,;t t s,@abs_builddir@,$ac_abs_builddir,;t t s,@top_builddir@,$ac_top_builddir,;t t s,@abs_top_builddir@,$ac_abs_top_builddir,;t t s,@INSTALL@,$ac_INSTALL,;t t " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out rm -f $tmp/stdin if test x"$ac_file" != x-; then mv $tmp/out $ac_file else cat $tmp/out rm -f $tmp/out fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # # CONFIG_HEADER section. # # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' ac_dB='[ ].*$,\1#\2' ac_dC=' ' ac_dD=',;t' # ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='$,\1#\2define\3' ac_uC=' ' ac_uD=',;t' for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } # Do quote $f, to prevent DOS paths from being IFS'd. echo "$f";; *) # Relative if test -f "$f"; then # Build tree echo "$f" elif test -f "$srcdir/$f"; then # Source tree echo "$srcdir/$f" else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } # Remove the trailing spaces. sed 's/[ ]*$//' $ac_file_inputs >$tmp/in _ACEOF # Transform confdefs.h into two sed scripts, `conftest.defines' and # `conftest.undefs', that substitutes the proper values into # config.h.in to produce config.h. The first handles `#define' # templates, and the second `#undef' templates. # And first: Protect against being on the right side of a sed subst in # config.status. Protect against being in an unquoted here document # in config.status. rm -f conftest.defines conftest.undefs # Using a here document instead of a string reduces the quoting nightmare. # Putting comments in sed scripts is not portable. # # `end' is used to avoid that the second main sed command (meant for # 0-ary CPP macros) applies to n-ary macro definitions. # See the Autoconf documentation for `clear'. cat >confdef2sed.sed <<\_ACEOF s/[\\&,]/\\&/g s,[\\$`],\\&,g t clear : clear s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp t end s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp : end _ACEOF # If some macros were called several times there might be several times # the same #defines, which is useless. Nevertheless, we may not want to # sort them, since we want the *last* AC-DEFINE to be honored. uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs rm -f confdef2sed.sed # This sed command replaces #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. cat >>conftest.undefs <<\_ACEOF s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, _ACEOF # Break up conftest.defines because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS echo ' :' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.defines >/dev/null do # Write a limited-size here document to $tmp/defines.sed. echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#define' lines. echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/defines.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail rm -f conftest.defines mv conftest.tail conftest.defines done rm -f conftest.defines echo ' fi # grep' >>$CONFIG_STATUS echo >>$CONFIG_STATUS # Break up conftest.undefs because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #undef templates' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.undefs >/dev/null do # Write a limited-size here document to $tmp/undefs.sed. echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#undef' echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/undefs.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail rm -f conftest.undefs mv conftest.tail conftest.undefs done rm -f conftest.undefs cat >>$CONFIG_STATUS <<\_ACEOF # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then echo "/* Generated by configure. */" >$tmp/config.h else echo "/* $ac_file. Generated by configure. */" >$tmp/config.h fi cat $tmp/in >>$tmp/config.h rm -f $tmp/in if test x"$ac_file" != x-; then if diff $ac_file $tmp/config.h >/dev/null 2>&1; then { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } rm -f $ac_file mv $tmp/config.h $ac_file fi else cat $tmp/config.h rm -f $tmp/config.h fi # Compute $ac_file's index in $config_headers. _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $ac_file | $ac_file:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $ac_file" >`(dirname $ac_file) 2>/dev/null || $as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X$ac_file : 'X\(//\)[^/]' \| \ X$ac_file : 'X\(//\)$' \| \ X$ac_file : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X$ac_file | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'`/stamp-h$_am_stamp_count done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # # CONFIG_COMMANDS section. # for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue ac_dest=`echo "$ac_file" | sed 's,:.*,,'` ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_dir=`(dirname "$ac_dest") 2>/dev/null || $as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_dest" : 'X\(//\)[^/]' \| \ X"$ac_dest" : 'X\(//\)$' \| \ X"$ac_dest" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_dest" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 echo "$as_me: executing $ac_dest commands" >&6;} case $ac_dest in depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # So let's grep whole file. if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then dirpart=`(dirname "$mf") 2>/dev/null || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` else continue fi grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue # Extract the definition of DEP_FILES from the Makefile without # running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" # We invoke sed twice because it is the simplest approach to # changing $(DEPDIR) to its actual value in the expansion. for file in `sed -n ' /^DEP_FILES = .*\\\\$/ { s/^DEP_FILES = // :loop s/\\\\$// p n /\\\\$/ b loop p } /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`(dirname "$file") 2>/dev/null || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p $dirpart/$fdir else as_dir=$dirpart/$fdir as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5 echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;} { (exit 1); exit 1; }; }; } # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ;; esac done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi echo "$as_me:$LINENO: result: filtergen $VERSION: automatic configuration OK. Type 'make' to compile filtergen. Type 'make install' to install filtergen. " >&5 echo "${ECHO_T} filtergen $VERSION: automatic configuration OK. Type 'make' to compile filtergen. Type 'make install' to install filtergen. " >&6 fi filtergen-0.12.4/AUTHORS0000644000175000017500000000053710051307763011555 00000000000000filtergen AUTHORS ================= The following people are the primary authors of filtergen. See also the file THANKS for a list of all contributors. Discussion of development occurs on the fk@hairy.beasts.org mailing list (also an easy way to reach the authors). Jamie Wilkinson Matthew Kirkwood filtergen-0.12.4/INSTALL0000644000175000017500000000215110051307641011523 00000000000000INSTALLING filtergen ============== Installing filtergen is easy. If you're on a Red Hat-like RPM-based system, you should be able just to run "rpm -ta" on the tarball. Otherwise, just ensure that you have gcc and flex installed, type "make", then "make install". AT-BOOT ------- There are two files in the extras/ directory which make life easier in Red Hat-like systems. My usual installation makes an /etc/filter/ directory and puts the ruleset and a Makefile in there. The latter knows how to turn the filter script into an appropriate output file ("make" does this), and how to load the ruleset ("make install"). filter.init is a SysV init script which invokes make at boot to do these things. Run "/etc/init.d/filter help" to see what it can do. It supports chkconfig. Note that if you intend to load filters at boot, you should install filtergen in /sbin/, in case not all filesystems are mounted at that point. The RPM does all of these things. It does _not_ configure the init script to run at boot, though. You can do that with "chkconfig filter on". $Id: INSTALL,v 1.1 2002/09/12 09:56:25 matthew Exp $ filtergen-0.12.4/THANKS0000644000175000017500000000047010051307721011406 00000000000000filtergen THANKS ================ Many people further contributed to filtergen by reporting problems, suggesting various improvements or submitting actual code. Here is a list of these people, alphabetically by surname. Help me keep it complete and exempt of errors. Glen Turner filtergen-0.12.4/TODO0000644000175000017500000000432610110541717011170 00000000000000TODO for filtergen ================== * Better documentation. o [jaq] Support scripts, documentation * Better logging options. * Translate icmp names (at least for ipfilter and cisco) o [jaq] ICMP codes (--icmp-type x/y syntax for iptables) * "Loose" option to allow not-quite-correct rulesets to run, eg., using forward-only with ipchains * New backend: FreeBSD ipfw o [jaq] {iptables,ipchains}-restore target format o [jaq] handle resolver errors in resolve.c o [jaq] extra iptables-like commands: user, related state have them carry through to the generator and then have the generator discard rulesets it doesn't like (but be aware of them) * Fixup and maintain the cisco and ipfilter backends - Cisco needs testing, negation fixes and options for reflexive ACLs - ipfilter needs testing and masq, transproxy and grouping support * support sysctl tuning in iptables/ipchains (i.e. linux) targets o [jaq] "limit" rate limiting support * iproute2 "ip rule" backend * Testing and auditing of generated rulesets. o [jaq] Optimiser (de-pessimiser :-) for intermediate step, and also generated rulesets (the latter could be done with a peephole optimiser, I think). - equation factoriser should be simpler and quite good. factorising should be trivial, boolean factorisation never involves polynomials. must watch out for rules with side effects though. order matters. - optimise orthogonal rules by branch counts - future optimise orthogonal rules based on hit frequency * state ESTABLISHED on iptables rules for all rules * no conntrack (i.e. designed for large fast filters) option for iptables o [jaq] Implement a negation unroller for filters which can't negate a match. (For example, Ciscos can't say "match all but this host".) This gives us negation of {}-groups, too. * reject-with for reject target in iptables * ipac-friendly filters * New backend: iptables-save format * New frontend: iptables-save format * unit tests for recursive include * unit tests for all code paths in include directive * " characters in identifiers, do they need to exist? * forward/local specifiers in filtergen language removed. add them back? * generate icmp filters completely filtergen-0.12.4/depcomp0000755000175000017500000003541010051310175012047 00000000000000#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2004-04-25.13 # Copyright (C) 1999, 2000, 2003, 2004 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 2, 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, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # 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 Alexandre Oliva . case $1 in '') echo "$0: No command. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by `PROGRAMS ARGS'. object Object file output by `PROGRAMS ARGS'. depfile Dependency file to output. tmpdepfile Temporary file to use when outputing dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit 0 ;; -v | --v*) echo "depcomp $scriptversion" exit 0 ;; esac if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # `libtool' can also be set to `yes' or `no'. if test -z "$depfile"; then base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'` dir=`echo "$object" | sed 's,/.*$,/,'` if test "$dir" = "$object"; then dir= fi # FIXME: should be _deps on DOS. depfile="$dir.deps/$base" fi tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the `deleted header file' problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' ' ' < "$tmpdepfile" | ## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as ## well. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like `#:fec' to the end of the # dependency line. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr ' ' ' ' >> $depfile echo >> $depfile # The second pass generates a dummy entry for each header file. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> $depfile else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts `$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` tmpdepfile="$stripped.u" if test "$libtool" = yes; then "$@" -Wc,-M else "$@" -M fi stat=$? if test -f "$tmpdepfile"; then : else stripped=`echo "$stripped" | sed 's,^.*/,,'` tmpdepfile="$stripped.u" fi if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi if test -f "$tmpdepfile"; then outname="$stripped.o" # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; icc) # Intel's C compiler understands `-MD -MF file'. However on # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c # ICC 7.0 will fill foo.d with something like # foo.o: sub/foo.c # foo.o: sub/foo.h # which is wrong. We want: # sub/foo.o: sub/foo.c # sub/foo.o: sub/foo.h # sub/foo.c: # sub/foo.h: # ICC 7.1 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using \ : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in `foo.d' instead, so we check for that too. # Subdirectories are respected. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then # Dependencies are output in .lo.d with libtool 1.4. # They are output in .o.d with libtool 1.5. tmpdepfile1="$dir.libs/$base.lo.d" tmpdepfile2="$dir.libs/$base.o.d" tmpdepfile3="$dir.libs/$base.d" "$@" -Wc,-MD else tmpdepfile1="$dir$base.o.d" tmpdepfile2="$dir$base.d" tmpdepfile3="$dir$base.d" "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi if test -f "$tmpdepfile1"; then tmpdepfile="$tmpdepfile1" elif test -f "$tmpdepfile2"; then tmpdepfile="$tmpdepfile2" else tmpdepfile="$tmpdepfile3" fi if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for `:' # in the target name. This is to cope with DOS-style filenames: # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. "$@" $dashmflag | sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' ' ' < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # X makedepend shift cleared=no for arg in "$@"; do case $cleared in no) set ""; shift cleared=yes ;; esac case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix="`echo $object | sed 's/^.*\././'`" touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' ' ' | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E | sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. "$@" || exit $? IFS=" " for arg do case "$arg" in "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: filtergen-0.12.4/install-sh0000755000175000017500000002244110066147231012505 00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2004-04-01.17 # 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. # # 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. # # # 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 # 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. # 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= usage="Usage: $0 [OPTION]... SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 -d DIRECTORIES... In the first form, install SRCFILE to DSTFILE, removing SRCFILE by default. In the second, create the directory path DIR. Options: -b=TRANSFORMBASENAME -c copy source (using $cpprog) instead of moving (using $mvprog). -d create directories instead of installing files. -g GROUP $chgrp installed files to GROUP. -m MODE $chmod installed files to MODE. -o USER $chown installed files to USER. -s strip installed files (using $stripprog). -t=TRANSFORM --help display this help and exit. --version display version info and exit. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test -n "$1"; do case $1 in -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; -c) instcmd=$cpprog shift continue;; -d) dir_arg=true shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; --help) echo "$usage"; exit 0;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -s) stripcmd=$stripprog shift continue;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; --version) echo "$0 $scriptversion"; exit 0;; *) # When -d is used, all remaining arguments are directories to create. test -n "$dir_arg" && break # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dstarg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dstarg" shift # fnord fi shift # arg dstarg=$arg done break;; esac done if test -z "$1"; 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 for src do # Protect names starting with `-'. case $src in -*) src=./$src ;; esac if test -n "$dir_arg"; then dst=$src src= if test -d "$dst"; then instcmd=: chmodcmd= else instcmd=$mkdirprog fi else # 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 '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dstarg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dstarg # Protect names starting with `-'. case $dst in -*) dst=./$dst ;; esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then dst=$dst/`basename "$src"` fi fi # This sed command emulates the dirname command. dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # Skip lots of stat calls in the usual case. if test ! -d "$dstdir"; then defaultIFS=' ' IFS="${IFS-$defaultIFS}" oIFS=$IFS # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` IFS=$oIFS pathcomp= while test $# -ne 0 ; do pathcomp=$pathcomp$1 shift if test ! -d "$pathcomp"; then $mkdirprog "$pathcomp" || lasterr=$? # mkdir can fail with a `File exist' error in case several # install-sh are creating the directory concurrently. This # is OK. test ! -d "$pathcomp" && { (exit ${lasterr-1}); exit; } fi pathcomp=$pathcomp/ done fi if test -n "$dir_arg"; then $doit $instcmd "$dst" \ && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } else # If we're going to rename the final executable, determine the name now. if test -z "$transformarg"; then dstfile=`basename "$dst"` else dstfile=`basename "$dst" $transformbasename \ | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename. test -z "$dstfile" && dstfile=`basename "$dst"` # 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 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0 trap '(exit $?); exit' 1 2 13 15 # Move or copy the file name to the temp name $doit $instcmd "$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 $instcmd $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 "$dsttmp"; } && # Now rename the file to the real destination. { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 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. { if test -f "$dstdir/$dstfile"; then $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ || { echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 (exit 1); exit } else : fi } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" } } fi || { (exit 1); exit; } done # The final little trick to "correctly" pass the exit status to the exit trap. { (exit 0); exit } # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: filtergen-0.12.4/missing0000755000175000017500000002466610066147231012113 00000000000000#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2003-09-02.23 # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 # Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # 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, 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, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # 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. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi msg="missing on your system" case "$1" in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 # Exit code 63 means version mismatch. This often happens # when the user try to use an ancient version of a tool on # a file that requires a minimum version. In this case we # we should proceed has if the program had been absent, or # if --run hadn't been passed. if test $? = 63; then run=: msg="probably too old" fi ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case "$1" in -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch] Send bug reports to ." ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; aclocal*) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case "$f" in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison|yacc) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.h fi ;; esac fi if [ ! -f y.tab.h ]; then echo >y.tab.h fi if [ ! -f y.tab.c ]; then echo 'main() { return 0; }' >y.tab.c fi ;; lex|flex) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if [ ! -f lex.yy.c ]; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` fi if [ -f "$file" ]; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit 1 fi ;; makeinfo) if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then # We have makeinfo, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` fi touch $file ;; tar) shift if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 fi # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar "$@" && exit 0 fi firstarg="$1" if shift; then case "$firstarg" in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac case "$firstarg" in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac 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-end: "$" # End: filtergen-0.12.4/parser.c0000644000175000017500000015144110051310310012124 00000000000000/* A Bison parser, made by GNU Bison 1.875a. */ /* Skeleton parser for Yacc-like parsing with Bison, Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 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 2, 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, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* As a special exception, when this file is copied by Bison into a Bison output file, you may use that output file without restriction. This special exception was added by the Free Software Foundation in version 1.24 of Bison. */ /* 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 /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" /* Pure parsers. */ #define YYPURE 0 /* Using locations. */ #define YYLSP_NEEDED 0 /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { TOK_ACCEPT = 258, TOK_DEST = 259, TOK_DPORT = 260, TOK_DROP = 261, TOK_FORWARD = 262, TOK_ICMPTYPE = 263, TOK_INPUT = 264, TOK_LCURLY = 265, TOK_LOCAL = 266, TOK_LOG = 267, TOK_LSQUARE = 268, TOK_MASQ = 269, TOK_ONEWAY = 270, TOK_OUTPUT = 271, TOK_PROTO = 272, TOK_PROXY = 273, TOK_RCURLY = 274, TOK_REDIRECT = 275, TOK_REJECT = 276, TOK_RSQUARE = 277, TOK_SEMICOLON = 278, TOK_SOURCE = 279, TOK_SPORT = 280, TOK_TEXT = 281, TOK_IDENTIFIER = 282, TOK_DOT = 283, TOK_SLASH = 284, TOK_ERR = 285, TOK_BANG = 286, TOK_COLON = 287 }; #endif #define TOK_ACCEPT 258 #define TOK_DEST 259 #define TOK_DPORT 260 #define TOK_DROP 261 #define TOK_FORWARD 262 #define TOK_ICMPTYPE 263 #define TOK_INPUT 264 #define TOK_LCURLY 265 #define TOK_LOCAL 266 #define TOK_LOG 267 #define TOK_LSQUARE 268 #define TOK_MASQ 269 #define TOK_ONEWAY 270 #define TOK_OUTPUT 271 #define TOK_PROTO 272 #define TOK_PROXY 273 #define TOK_RCURLY 274 #define TOK_REDIRECT 275 #define TOK_REJECT 276 #define TOK_RSQUARE 277 #define TOK_SEMICOLON 278 #define TOK_SOURCE 279 #define TOK_SPORT 280 #define TOK_TEXT 281 #define TOK_IDENTIFIER 282 #define TOK_DOT 283 #define TOK_SLASH 284 #define TOK_ERR 285 #define TOK_BANG 286 #define TOK_COLON 287 /* Copy the first part of user declarations. */ #line 20 "parser.y" #include #include #include #include "ast.h" #define YYPARSE_PARAM parm void yyerror(const char * s); extern int yylex(void); #define YYPRINT(f, t, v) yyprint(f, t, v) /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 1 #endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE # undef YYERROR_VERBOSE # define YYERROR_VERBOSE 1 #else # define YYERROR_VERBOSE 0 #endif #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) #line 35 "parser.y" typedef union YYSTYPE { struct rule_list_s * u_rule_list; struct rule_s * u_rule; struct specifier_list_s * u_specifier_list; struct negated_specifier_s * u_negated_specifier; struct specifier_s * u_specifier; struct direction_specifier_s * u_direction_specifier; struct direction_argument_list_s * u_direction_argument_list; struct direction_argument_s * u_direction_argument; struct target_specifier_s * u_target_specifier; struct log_target_specifier_s * u_log_target_specifier; struct host_specifier_s * u_host_specifier; struct host_argument_list_s * u_host_argument_list; struct host_argument_s * u_host_argument; struct port_specifier_s * u_port_specifier; struct port_argument_list_s * u_port_argument_list; struct port_argument_s * u_port_argument; struct protocol_specifier_s * u_protocol_specifier; struct protocol_argument_list_s * u_protocol_argument_list; struct protocol_argument_s * u_protocol_argument; struct icmptype_specifier_s * u_icmptype_specifier; struct icmptype_argument_list_s * u_icmptype_argument_list; struct icmptype_argument_s * u_icmptype_argument; struct option_specifier_s * u_option_specifier; struct compound_specifier_s * u_compound_specifier; struct chaingroup_specifier_s * u_chaingroup_specifier; struct subrule_list_s * u_subrule_list; char * u_str; } YYSTYPE; /* Line 191 of yacc.c. */ #line 184 "parser.c" # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 #endif /* Copy the second part of user declarations. */ #line 126 "parser.y" int yyprint(FILE * f, int t, YYSTYPE v); /* Line 214 of yacc.c. */ #line 199 "parser.c" #if ! defined (yyoverflow) || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ # if YYSTACK_USE_ALLOCA # define YYSTACK_ALLOC alloca # else # ifndef YYSTACK_USE_ALLOCA # if defined (alloca) || defined (_ALLOCA_H) # define YYSTACK_ALLOC alloca # else # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca # endif # endif # endif # endif # ifdef YYSTACK_ALLOC /* Pacify GCC's `empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) # else # if defined (__STDC__) || defined (__cplusplus) # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # endif # define YYSTACK_ALLOC malloc # define YYSTACK_FREE free # endif #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ #if (! defined (yyoverflow) \ && (! defined (__cplusplus) \ || (YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { short yyss; YYSTYPE yyvs; }; /* 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 (short) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY # if 1 < __GNUC__ # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else # define YYCOPY(To, From, Count) \ do \ { \ register YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ while (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) \ do \ { \ YYSIZE_T yynewbytes; \ YYCOPY (&yyptr->Stack, Stack, yysize); \ Stack = &yyptr->Stack; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ while (0) #endif #if defined (__STDC__) || defined (__cplusplus) typedef signed char yysigned_char; #else typedef short yysigned_char; #endif /* YYFINAL -- State number of the termination state. */ #define YYFINAL 3 /* YYLAST -- Last index in YYTABLE. */ #define YYLAST 112 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 33 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 32 /* YYNRULES -- Number of rules. */ #define YYNRULES 69 /* YYNRULES -- Number of states. */ #define YYNSTATES 95 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 287 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ static const unsigned char 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 }; #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ static const unsigned char yyprhs[] = { 0, 0, 3, 5, 6, 9, 12, 13, 16, 18, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 42, 45, 47, 51, 52, 55, 57, 59, 61, 63, 65, 67, 69, 72, 75, 77, 81, 82, 85, 89, 91, 94, 97, 99, 103, 105, 108, 112, 114, 117, 119, 123, 124, 127, 129, 132, 134, 138, 139, 142, 144, 146, 148, 150, 154, 156, 160, 162, 166, 171 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yysigned_char yyrhs[] = { 34, 0, -1, 35, -1, -1, 35, 36, -1, 37, 23, -1, -1, 37, 38, -1, 39, -1, 31, 39, -1, 62, -1, 40, -1, 44, -1, 45, -1, 49, -1, 53, -1, 57, -1, 61, -1, 64, -1, 9, 41, -1, 16, 41, -1, 42, -1, 10, 42, 19, -1, -1, 42, 43, -1, 27, -1, 3, -1, 21, -1, 6, -1, 14, -1, 18, -1, 20, -1, 24, 46, -1, 4, 46, -1, 47, -1, 10, 47, 19, -1, -1, 47, 48, -1, 27, 29, 27, -1, 27, -1, 25, 50, -1, 5, 50, -1, 51, -1, 10, 50, 19, -1, 52, -1, 51, 52, -1, 27, 32, 27, -1, 27, -1, 17, 54, -1, 55, -1, 10, 55, 19, -1, -1, 55, 56, -1, 27, -1, 8, 58, -1, 59, -1, 10, 59, 19, -1, -1, 59, 60, -1, 27, -1, 11, -1, 7, -1, 15, -1, 12, 26, 27, -1, 12, -1, 10, 63, 19, -1, 37, -1, 63, 23, 37, -1, 13, 27, 63, 22, -1, 13, 63, 22, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const unsigned short yyrline[] = { 0, 131, 131, 139, 142, 150, 158, 161, 169, 175, 183, 189, 195, 201, 207, 213, 219, 225, 231, 239, 245, 253, 257, 264, 267, 275, 282, 287, 292, 297, 302, 307, 314, 320, 328, 332, 339, 342, 350, 356, 364, 370, 378, 382, 387, 393, 401, 407, 415, 422, 426, 433, 436, 444, 451, 458, 462, 469, 472, 480, 487, 493, 499, 505, 511, 519, 526, 532, 540, 546 }; #endif #if YYDEBUG || YYERROR_VERBOSE /* YYTNME[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", "TOK_ACCEPT", "TOK_DEST", "TOK_DPORT", "TOK_DROP", "TOK_FORWARD", "TOK_ICMPTYPE", "TOK_INPUT", "TOK_LCURLY", "TOK_LOCAL", "TOK_LOG", "TOK_LSQUARE", "TOK_MASQ", "TOK_ONEWAY", "TOK_OUTPUT", "TOK_PROTO", "TOK_PROXY", "TOK_RCURLY", "TOK_REDIRECT", "TOK_REJECT", "TOK_RSQUARE", "TOK_SEMICOLON", "TOK_SOURCE", "TOK_SPORT", "TOK_TEXT", "TOK_IDENTIFIER", "TOK_DOT", "TOK_SLASH", "TOK_ERR", "TOK_BANG", "TOK_COLON", "$accept", "ast", "rule_list", "rule", "specifier_list", "negated_specifier", "specifier", "direction_specifier", "direction_argument_list", "direction_argument_list_", "direction_argument", "target_specifier", "host_specifier", "host_argument_list", "host_argument_list_", "host_argument", "port_specifier", "port_argument_list", "port_argument_list_", "port_argument", "protocol_specifier", "protocol_argument_list", "protocol_argument_list_", "protocol_argument", "icmptype_specifier", "icmptype_argument_list", "icmptype_argument_list_", "icmptype_argument", "option_specifier", "compound_specifier", "subrule_list", "chaingroup_specifier", 0 }; #endif # ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ static const unsigned short 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 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const unsigned char yyr1[] = { 0, 33, 34, 35, 35, 36, 37, 37, 38, 38, 39, 39, 39, 39, 39, 39, 39, 39, 39, 40, 40, 41, 41, 42, 42, 43, 44, 44, 44, 44, 44, 44, 45, 45, 46, 46, 47, 47, 48, 48, 49, 49, 50, 50, 51, 51, 52, 52, 53, 54, 54, 55, 55, 56, 57, 58, 58, 59, 59, 60, 61, 61, 61, 61, 61, 62, 63, 63, 64, 64 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const unsigned char yyr2[] = { 0, 2, 1, 0, 2, 2, 0, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 3, 0, 2, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 3, 0, 2, 3, 1, 2, 2, 1, 3, 1, 2, 3, 1, 2, 1, 3, 0, 2, 1, 2, 1, 3, 0, 2, 1, 1, 1, 1, 3, 1, 3, 1, 3, 4, 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 unsigned char yydefact[] = { 3, 0, 6, 1, 4, 0, 26, 36, 0, 28, 61, 57, 23, 6, 60, 64, 6, 29, 62, 23, 51, 30, 31, 27, 5, 36, 0, 0, 7, 8, 11, 12, 13, 14, 15, 16, 17, 10, 18, 36, 33, 34, 0, 47, 41, 42, 44, 57, 54, 55, 23, 19, 21, 66, 0, 0, 6, 0, 20, 51, 48, 49, 32, 40, 9, 0, 39, 37, 0, 0, 45, 0, 59, 58, 0, 25, 24, 65, 6, 63, 0, 69, 0, 53, 52, 35, 0, 43, 46, 56, 22, 67, 68, 50, 38 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yysigned_char yydefgoto[] = { -1, 1, 2, 4, 53, 28, 29, 30, 51, 52, 76, 31, 32, 40, 41, 67, 33, 44, 45, 46, 34, 60, 61, 84, 35, 48, 49, 73, 36, 37, 54, 38 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ #define YYPACT_NINF -16 static const yysigned_char yypact[] = { -16, 27, 29, -16, -16, -1, -16, 22, 8, -16, -16, 28, 30, -16, -16, 32, 35, -16, -16, 30, 61, -16, -16, -16, -16, 22, 8, 74, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, 45, 8, 41, -16, 47, -16, -16, -16, 48, -16, -16, 66, 39, 42, 69, -16, 44, -16, -16, -16, 70, -16, -16, -16, 6, 71, -16, 82, 75, -16, 7, -16, -16, 9, -16, -16, -16, -16, -16, 46, -16, 12, -16, -16, -16, 76, -16, -16, -16, -16, 39, -16, -16, -16 }; /* YYPGOTO[NTERM-NUM]. */ static const yysigned_char yypgoto[] = { -16, -16, -16, -16, -2, -16, 77, -16, 86, 56, -16, -16, -16, 83, 68, -16, -16, -5, -16, 64, -16, -16, 51, -16, -16, -16, 65, -16, -16, -16, -15, -16 }; /* 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 -3 static const yysigned_char yytable[] = { 5, 57, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 42, 22, 23, 63, 24, 25, 26, 85, 89, 3, 90, -2, 27, 93, 39, 66, 72, 43, 75, 68, 47, 83, 50, 80, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 55, 22, 23, 77, 56, 25, 26, 78, 81, 78, 92, 78, 27, 59, 66, 69, 43, 72, 91, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 75, 22, 23, 79, 83, 25, 26, 86, 87, 88, 94, 64, 58, 74, 65, 62, 70, 82, 0, 71 }; static const yysigned_char yycheck[] = { 2, 16, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 10, 20, 21, 26, 23, 24, 25, 19, 19, 0, 19, 0, 31, 19, 10, 27, 27, 27, 27, 42, 10, 27, 10, 56, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 26, 20, 21, 19, 27, 24, 25, 23, 22, 23, 22, 23, 31, 10, 27, 32, 27, 27, 78, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 27, 20, 21, 27, 27, 24, 25, 29, 19, 27, 27, 27, 19, 50, 39, 25, 45, 59, -1, 47 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const unsigned char yystos[] = { 0, 34, 35, 0, 36, 37, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 21, 23, 24, 25, 31, 38, 39, 40, 44, 45, 49, 53, 57, 61, 62, 64, 10, 46, 47, 10, 27, 50, 51, 52, 10, 58, 59, 10, 41, 42, 37, 63, 26, 27, 63, 41, 10, 54, 55, 46, 50, 39, 47, 27, 48, 50, 32, 52, 59, 27, 60, 42, 27, 43, 19, 23, 27, 63, 22, 55, 27, 56, 19, 29, 19, 27, 19, 19, 37, 22, 19, 27 }; #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) # define YYSIZE_T __SIZE_TYPE__ #endif #if ! defined (YYSIZE_T) && defined (size_t) # define YYSIZE_T size_t #endif #if ! defined (YYSIZE_T) # if defined (__STDC__) || defined (__cplusplus) # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # endif #endif #if ! defined (YYSIZE_T) # define YYSIZE_T unsigned int #endif #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 yyerrlab1 /* 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. */ #define YYFAIL goto yyerrlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ { \ yychar = (Token); \ yylval = (Value); \ yytoken = YYTRANSLATE (yychar); \ YYPOPSTACK; \ goto yybackup; \ } \ else \ { \ yyerror ("syntax error: cannot back up");\ YYERROR; \ } \ while (0) #define YYTERROR 1 #define YYERRCODE 256 /* YYLLOC_DEFAULT -- Compute the default location (before the actions are run). */ #ifndef YYLLOC_DEFAULT # define YYLLOC_DEFAULT(Current, Rhs, N) \ Current.first_line = Rhs[1].first_line; \ Current.first_column = Rhs[1].first_column; \ Current.last_line = Rhs[N].last_line; \ Current.last_column = Rhs[N].last_column; #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 (0) # define YYDSYMPRINT(Args) \ do { \ if (yydebug) \ yysymprint Args; \ } while (0) # define YYDSYMPRINTF(Title, Token, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yysymprint (stderr, \ Token, Value); \ YYFPRINTF (stderr, "\n"); \ } \ } while (0) /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (cinluded). | `------------------------------------------------------------------*/ #if defined (__STDC__) || defined (__cplusplus) static void yy_stack_print (short *bottom, short *top) #else static void yy_stack_print (bottom, top) short *bottom; short *top; #endif { YYFPRINTF (stderr, "Stack now"); for (/* Nothing. */; bottom <= top; ++bottom) YYFPRINTF (stderr, " %d", *bottom); YYFPRINTF (stderr, "\n"); } # define YY_STACK_PRINT(Bottom, Top) \ do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ } while (0) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ #if defined (__STDC__) || defined (__cplusplus) static void yy_reduce_print (int yyrule) #else static void yy_reduce_print (yyrule) int yyrule; #endif { int yyi; unsigned int yylineno = yyrline[yyrule]; YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ", yyrule - 1, yylineno); /* Print the symbols being reduced, and their result. */ for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]); YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]); } # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ yy_reduce_print (Rule); \ } while (0) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) # define YYDSYMPRINT(Args) # define YYDSYMPRINTF(Title, Token, 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 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ #if YYMAXDEPTH == 0 # undef YYMAXDEPTH #endif #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. */ static YYSIZE_T # if defined (__STDC__) || defined (__cplusplus) yystrlen (const char *yystr) # else yystrlen (yystr) const char *yystr; # endif { register const char *yys = yystr; while (*yys++ != '\0') continue; return yys - yystr - 1; } # 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. */ static char * # if defined (__STDC__) || defined (__cplusplus) yystpcpy (char *yydest, const char *yysrc) # else yystpcpy (yydest, yysrc) char *yydest; const char *yysrc; # endif { register char *yyd = yydest; register const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; return yyd - 1; } # endif # endif #endif /* !YYERROR_VERBOSE */ #if YYDEBUG /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ #if defined (__STDC__) || defined (__cplusplus) static void yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) #else static void yysymprint (yyoutput, yytype, yyvaluep) FILE *yyoutput; int yytype; YYSTYPE *yyvaluep; #endif { /* Pacify ``unused variable'' warnings. */ (void) yyvaluep; if (yytype < YYNTOKENS) { YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); # ifdef YYPRINT YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); # endif } else YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); switch (yytype) { default: break; } YYFPRINTF (yyoutput, ")"); } #endif /* ! YYDEBUG */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ #if defined (__STDC__) || defined (__cplusplus) static void yydestruct (int yytype, YYSTYPE *yyvaluep) #else static void yydestruct (yytype, yyvaluep) int yytype; YYSTYPE *yyvaluep; #endif { /* Pacify ``unused variable'' warnings. */ (void) yyvaluep; 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. | `----------*/ #ifdef YYPARSE_PARAM # if defined (__STDC__) || defined (__cplusplus) int yyparse (void *YYPARSE_PARAM) # else int yyparse (YYPARSE_PARAM) void *YYPARSE_PARAM; # endif #else /* ! YYPARSE_PARAM */ #if defined (__STDC__) || defined (__cplusplus) int yyparse (void) #else int yyparse () #endif #endif { register int yystate; register int yyn; int yyresult; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* Lookahead token as an internal (translated) token number. */ int yytoken = 0; /* Three stacks and their tools: `yyss': related to states, `yyvs': related to semantic values, `yyls': related to locations. Refer to the stacks thru separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ short yyssa[YYINITDEPTH]; short *yyss = yyssa; register short *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs = yyvsa; register YYSTYPE *yyvsp; #define YYPOPSTACK (yyvsp--, yyssp--) YYSIZE_T yystacksize = YYINITDEPTH; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; /* When reducing, the number of symbols on the RHS of the reduced rule. */ int yylen; 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; short *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 ("parser stack overflow", &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yystacksize); yyss = yyss1; yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE goto yyoverflowlab; # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyoverflowlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { short *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyoverflowlab; YYSTACK_RELOCATE (yyss); YYSTACK_RELOCATE (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)); 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. */ /* yyresume: */ /* 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); YYDSYMPRINTF ("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; } if (yyn == YYFINAL) YYACCEPT; /* Shift the lookahead token. */ YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken])); /* Discard the token being shifted unless it is eof. */ if (yychar != YYEOF) yychar = YYEMPTY; *++yyvsp = yylval; /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; yystate = yyn; 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 132 "parser.y" { /* we expect parm to be already allocated, and that * it is of type (struct ast_s *) */ ((struct ast_s *) parm)->list = yyvsp[0].u_rule_list; } break; case 3: #line 139 "parser.y" { yyval.u_rule_list = NULL; } break; case 4: #line 143 "parser.y" { yyval.u_rule_list = malloc(sizeof(struct rule_list_s)); yyval.u_rule_list->list = yyvsp[-1].u_rule_list; yyval.u_rule_list->rule = yyvsp[0].u_rule; } break; case 5: #line 151 "parser.y" { yyval.u_rule = malloc(sizeof(struct rule_s)); yyval.u_rule->list = yyvsp[-1].u_specifier_list; } break; case 6: #line 158 "parser.y" { yyval.u_specifier_list = NULL; } break; case 7: #line 162 "parser.y" { yyval.u_specifier_list = malloc(sizeof(struct specifier_list_s)); yyval.u_specifier_list->list = yyvsp[-1].u_specifier_list; yyval.u_specifier_list->spec = yyvsp[0].u_negated_specifier; } break; case 8: #line 170 "parser.y" { yyval.u_negated_specifier = malloc(sizeof(struct negated_specifier_s)); yyval.u_negated_specifier->negated = 0; yyval.u_negated_specifier->spec = yyvsp[0].u_specifier; } break; case 9: #line 176 "parser.y" { yyval.u_negated_specifier = malloc(sizeof(struct negated_specifier_s)); yyval.u_negated_specifier->negated = 1; yyval.u_negated_specifier->spec = yyvsp[0].u_specifier; } break; case 10: #line 184 "parser.y" { yyval.u_specifier = malloc(sizeof(struct specifier_s)); memset(yyval.u_specifier, 0, sizeof(struct specifier_s)); yyval.u_specifier->compound = yyvsp[0].u_compound_specifier; } break; case 11: #line 190 "parser.y" { yyval.u_specifier = malloc(sizeof(struct specifier_s)); memset(yyval.u_specifier, 0, sizeof(struct specifier_s)); yyval.u_specifier->direction = yyvsp[0].u_direction_specifier; } break; case 12: #line 196 "parser.y" { yyval.u_specifier = malloc(sizeof(struct specifier_s)); memset(yyval.u_specifier, 0, sizeof(struct specifier_s)); yyval.u_specifier->target = yyvsp[0].u_target_specifier; } break; case 13: #line 202 "parser.y" { yyval.u_specifier = malloc(sizeof(struct specifier_s)); memset(yyval.u_specifier, 0, sizeof(struct specifier_s)); yyval.u_specifier->host = yyvsp[0].u_host_specifier; } break; case 14: #line 208 "parser.y" { yyval.u_specifier = malloc(sizeof(struct specifier_s)); memset(yyval.u_specifier, 0, sizeof(struct specifier_s)); yyval.u_specifier->port = yyvsp[0].u_port_specifier; } break; case 15: #line 214 "parser.y" { yyval.u_specifier = malloc(sizeof(struct specifier_s)); memset(yyval.u_specifier, 0, sizeof(struct specifier_s)); yyval.u_specifier->protocol = yyvsp[0].u_protocol_specifier; } break; case 16: #line 220 "parser.y" { yyval.u_specifier = malloc(sizeof(struct specifier_s)); memset(yyval.u_specifier, 0, sizeof(struct specifier_s)); yyval.u_specifier->icmptype = yyvsp[0].u_icmptype_specifier; } break; case 17: #line 226 "parser.y" { yyval.u_specifier = malloc(sizeof(struct specifier_s)); memset(yyval.u_specifier, 0, sizeof(struct specifier_s)); yyval.u_specifier->option = yyvsp[0].u_option_specifier; } break; case 18: #line 232 "parser.y" { yyval.u_specifier = malloc(sizeof(struct specifier_s)); memset(yyval.u_specifier, 0, sizeof(struct specifier_s)); yyval.u_specifier->chaingroup = yyvsp[0].u_chaingroup_specifier; } break; case 19: #line 240 "parser.y" { yyval.u_direction_specifier = malloc(sizeof(struct direction_specifier_s)); yyval.u_direction_specifier->type = TOK_INPUT; yyval.u_direction_specifier->list = yyvsp[0].u_direction_argument_list; } break; case 20: #line 246 "parser.y" { yyval.u_direction_specifier = malloc(sizeof(struct direction_specifier_s)); yyval.u_direction_specifier->type = TOK_OUTPUT; yyval.u_direction_specifier->list = yyvsp[0].u_direction_argument_list; } break; case 21: #line 254 "parser.y" { yyval.u_direction_argument_list = yyvsp[0].u_direction_argument_list; } break; case 22: #line 258 "parser.y" { yyval.u_direction_argument_list = yyvsp[-1].u_direction_argument_list; } break; case 23: #line 264 "parser.y" { yyval.u_direction_argument_list = NULL; } break; case 24: #line 268 "parser.y" { yyval.u_direction_argument_list = malloc(sizeof(struct direction_argument_list_s)); yyval.u_direction_argument_list->list = yyvsp[-1].u_direction_argument_list; yyval.u_direction_argument_list->arg = yyvsp[0].u_direction_argument; } break; case 25: #line 276 "parser.y" { yyval.u_direction_argument = malloc(sizeof(struct direction_argument_s)); yyval.u_direction_argument->direction = yyvsp[0].u_str; } break; case 26: #line 283 "parser.y" { yyval.u_target_specifier = malloc(sizeof(struct target_specifier_s)); yyval.u_target_specifier->type = TOK_ACCEPT; } break; case 27: #line 288 "parser.y" { yyval.u_target_specifier = malloc(sizeof(struct target_specifier_s)); yyval.u_target_specifier->type = TOK_REJECT; } break; case 28: #line 293 "parser.y" { yyval.u_target_specifier = malloc(sizeof(struct target_specifier_s)); yyval.u_target_specifier->type = TOK_DROP; } break; case 29: #line 298 "parser.y" { yyval.u_target_specifier = malloc(sizeof(struct target_specifier_s)); yyval.u_target_specifier->type = TOK_MASQ; } break; case 30: #line 303 "parser.y" { yyval.u_target_specifier = malloc(sizeof(struct target_specifier_s)); yyval.u_target_specifier->type = TOK_PROXY; } break; case 31: #line 308 "parser.y" { yyval.u_target_specifier = malloc(sizeof(struct target_specifier_s)); yyval.u_target_specifier->type = TOK_REDIRECT; } break; case 32: #line 315 "parser.y" { yyval.u_host_specifier = malloc(sizeof(struct host_specifier_s)); yyval.u_host_specifier->type = TOK_SOURCE; yyval.u_host_specifier->list = yyvsp[0].u_host_argument_list; } break; case 33: #line 321 "parser.y" { yyval.u_host_specifier = malloc(sizeof(struct host_specifier_s)); yyval.u_host_specifier->type = TOK_DEST; yyval.u_host_specifier->list = yyvsp[0].u_host_argument_list; } break; case 34: #line 329 "parser.y" { yyval.u_host_argument_list = yyvsp[0].u_host_argument_list; } break; case 35: #line 333 "parser.y" { yyval.u_host_argument_list = yyvsp[-1].u_host_argument_list; } break; case 36: #line 339 "parser.y" { yyval.u_host_argument_list = NULL; } break; case 37: #line 343 "parser.y" { yyval.u_host_argument_list = malloc(sizeof(struct host_argument_list_s)); yyval.u_host_argument_list->list = yyvsp[-1].u_host_argument_list; yyval.u_host_argument_list->arg = yyvsp[0].u_host_argument; } break; case 38: #line 351 "parser.y" { yyval.u_host_argument = malloc(sizeof(struct host_argument_s)); yyval.u_host_argument->host = yyvsp[-2].u_str; yyval.u_host_argument->mask = yyvsp[0].u_str; } break; case 39: #line 357 "parser.y" { yyval.u_host_argument = malloc(sizeof(struct host_argument_s)); yyval.u_host_argument->host = yyvsp[0].u_str; yyval.u_host_argument->mask = 0; } break; case 40: #line 365 "parser.y" { yyval.u_port_specifier = malloc(sizeof(struct port_specifier_s)); yyval.u_port_specifier->type = TOK_SPORT; yyval.u_port_specifier->list = yyvsp[0].u_port_argument_list; } break; case 41: #line 371 "parser.y" { yyval.u_port_specifier = malloc(sizeof(struct port_specifier_s)); yyval.u_port_specifier->type = TOK_DPORT; yyval.u_port_specifier->list = yyvsp[0].u_port_argument_list; } break; case 42: #line 379 "parser.y" { yyval.u_port_argument_list = yyvsp[0].u_port_argument_list; } break; case 43: #line 383 "parser.y" { yyval.u_port_argument_list = yyvsp[-1].u_port_argument_list; } break; case 44: #line 388 "parser.y" { yyval.u_port_argument_list = malloc(sizeof(struct port_argument_list_s)); yyval.u_port_argument_list->list = NULL; yyval.u_port_argument_list->arg = yyvsp[0].u_port_argument; } break; case 45: #line 394 "parser.y" { yyval.u_port_argument_list = malloc(sizeof(struct port_argument_list_s)); yyval.u_port_argument_list->list = yyvsp[-1].u_port_argument_list; yyval.u_port_argument_list->arg = yyvsp[0].u_port_argument; } break; case 46: #line 402 "parser.y" { yyval.u_port_argument = malloc(sizeof(struct port_argument_s)); yyval.u_port_argument->port_min = yyvsp[-2].u_str; yyval.u_port_argument->port_max = yyvsp[0].u_str; } break; case 47: #line 408 "parser.y" { yyval.u_port_argument = malloc(sizeof(struct port_argument_s)); yyval.u_port_argument->port_min = yyvsp[0].u_str; yyval.u_port_argument->port_max = NULL; } break; case 48: #line 416 "parser.y" { yyval.u_protocol_specifier = malloc(sizeof(struct protocol_specifier_s)); yyval.u_protocol_specifier->list = yyvsp[0].u_protocol_argument_list; } break; case 49: #line 423 "parser.y" { yyval.u_protocol_argument_list = yyvsp[0].u_protocol_argument_list; } break; case 50: #line 427 "parser.y" { yyval.u_protocol_argument_list = yyvsp[-1].u_protocol_argument_list; } break; case 51: #line 433 "parser.y" { yyval.u_protocol_argument_list = NULL; } break; case 52: #line 437 "parser.y" { yyval.u_protocol_argument_list = malloc(sizeof(struct protocol_argument_list_s)); yyval.u_protocol_argument_list->list = yyvsp[-1].u_protocol_argument_list; yyval.u_protocol_argument_list->arg = yyvsp[0].u_protocol_argument; } break; case 53: #line 445 "parser.y" { yyval.u_protocol_argument = malloc(sizeof(struct protocol_argument_s)); yyval.u_protocol_argument->proto = strdup(yyvsp[0].u_str); } break; case 54: #line 452 "parser.y" { yyval.u_icmptype_specifier = malloc(sizeof(struct icmptype_specifier_s)); yyval.u_icmptype_specifier->list = yyvsp[0].u_icmptype_argument_list; } break; case 55: #line 459 "parser.y" { yyval.u_icmptype_argument_list = yyvsp[0].u_icmptype_argument_list; } break; case 56: #line 463 "parser.y" { yyval.u_icmptype_argument_list = yyvsp[-1].u_icmptype_argument_list; } break; case 57: #line 469 "parser.y" { yyval.u_icmptype_argument_list = NULL; } break; case 58: #line 473 "parser.y" { yyval.u_icmptype_argument_list = malloc(sizeof(struct icmptype_argument_list_s)); yyval.u_icmptype_argument_list->list = yyvsp[-1].u_icmptype_argument_list; yyval.u_icmptype_argument_list->arg = yyvsp[0].u_icmptype_argument; } break; case 59: #line 481 "parser.y" { yyval.u_icmptype_argument = malloc(sizeof(struct icmptype_argument_s)); yyval.u_icmptype_argument->icmptype = yyvsp[0].u_str; } break; case 60: #line 488 "parser.y" { yyval.u_option_specifier = malloc(sizeof(struct option_specifier_s)); yyval.u_option_specifier->type = TOK_LOCAL; yyval.u_option_specifier->logmsg = 0; } break; case 61: #line 494 "parser.y" { yyval.u_option_specifier = malloc(sizeof(struct option_specifier_s)); yyval.u_option_specifier->type = TOK_FORWARD; yyval.u_option_specifier->logmsg = 0; } break; case 62: #line 500 "parser.y" { yyval.u_option_specifier = malloc(sizeof(struct option_specifier_s)); yyval.u_option_specifier->type = TOK_ONEWAY; yyval.u_option_specifier->logmsg = 0; } break; case 63: #line 506 "parser.y" { yyval.u_option_specifier = malloc(sizeof(struct option_specifier_s)); yyval.u_option_specifier->type = TOK_LOG; yyval.u_option_specifier->logmsg = yyvsp[0].u_str; } break; case 64: #line 512 "parser.y" { yyval.u_option_specifier = malloc(sizeof(struct option_specifier_s)); yyval.u_option_specifier->type = TOK_LOG; yyval.u_option_specifier->logmsg = 0; } break; case 65: #line 520 "parser.y" { yyval.u_compound_specifier = malloc(sizeof(struct compound_specifier_s)); yyval.u_compound_specifier->list = yyvsp[-1].u_subrule_list; } break; case 66: #line 527 "parser.y" { yyval.u_subrule_list = malloc(sizeof(struct subrule_list_s)); yyval.u_subrule_list->subrule_list = NULL; yyval.u_subrule_list->specifier_list = yyvsp[0].u_specifier_list; } break; case 67: #line 533 "parser.y" { yyval.u_subrule_list = malloc(sizeof(struct subrule_list_s)); yyval.u_subrule_list->subrule_list = yyvsp[-2].u_subrule_list; yyval.u_subrule_list->specifier_list = yyvsp[0].u_specifier_list; } break; case 68: #line 541 "parser.y" { yyval.u_chaingroup_specifier = malloc(sizeof(struct chaingroup_specifier_s)); yyval.u_chaingroup_specifier->name = yyvsp[-2].u_str; yyval.u_chaingroup_specifier->list = yyvsp[-1].u_subrule_list; } break; case 69: #line 547 "parser.y" { yyval.u_chaingroup_specifier = malloc(sizeof(struct chaingroup_specifier_s)); yyval.u_chaingroup_specifier->name = NULL; yyval.u_chaingroup_specifier->list = yyvsp[-1].u_subrule_list; } break; } /* Line 999 of yacc.c. */ #line 1744 "parser.c" yyvsp -= yylen; yyssp -= yylen; 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 yyn = yypact[yystate]; if (YYPACT_NINF < yyn && yyn < YYLAST) { YYSIZE_T yysize = 0; int yytype = YYTRANSLATE (yychar); char *yymsg; int yyx, yycount; yycount = 0; /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. */ for (yyx = yyn < 0 ? -yyn : 0; yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) yysize += yystrlen (yytname[yyx]) + 15, yycount++; yysize += yystrlen ("syntax error, unexpected ") + 1; yysize += yystrlen (yytname[yytype]); yymsg = (char *) YYSTACK_ALLOC (yysize); if (yymsg != 0) { char *yyp = yystpcpy (yymsg, "syntax error, unexpected "); yyp = yystpcpy (yyp, yytname[yytype]); if (yycount < 5) { yycount = 0; for (yyx = yyn < 0 ? -yyn : 0; yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) { const char *yyq = ! yycount ? ", expecting " : " or "; yyp = yystpcpy (yyp, yyq); yyp = yystpcpy (yyp, yytname[yyx]); yycount++; } } yyerror (yymsg); YYSTACK_FREE (yymsg); } else yyerror ("syntax error; also virtual memory exhausted"); } else #endif /* YYERROR_VERBOSE */ yyerror ("syntax error"); } if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an error, discard it. */ /* Return failure if at end of input. */ if (yychar == YYEOF) { /* Pop the error token. */ YYPOPSTACK; /* Pop the rest of the stack. */ while (yyss < yyssp) { YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); yydestruct (yystos[*yyssp], yyvsp); YYPOPSTACK; } YYABORT; } YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc); yydestruct (yytoken, &yylval); yychar = YYEMPTY; } /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; /*----------------------------------------------------. | yyerrlab1 -- error raised explicitly by an action. | `----------------------------------------------------*/ 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; YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); yydestruct (yystos[yystate], yyvsp); yyvsp--; yystate = *--yyssp; YY_STACK_PRINT (yyss, yyssp); } if (yyn == YYFINAL) YYACCEPT; YYDPRINTF ((stderr, "Shifting error token, ")); *++yyvsp = yylval; yystate = yyn; goto yynewstate; /*-------------------------------------. | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: yyresult = 0; goto yyreturn; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; goto yyreturn; #ifndef yyoverflow /*----------------------------------------------. | yyoverflowlab -- parser overflow comes here. | `----------------------------------------------*/ yyoverflowlab: yyerror ("parser stack overflow"); yyresult = 2; /* Fall through. */ #endif yyreturn: #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif return yyresult; } #line 554 "parser.y" char * filename(); long int lineno(); extern char * yytext; void yyerror(const char * s) { fprintf(stderr, "%s:%ld: %s\n", filename(), lineno(), s); } int yyprint(FILE * f, int type, YYSTYPE v) { fprintf(f, "%d:\"%s\":%p", type, yytext, &v); return 0; } filtergen-0.12.4/parser.h0000644000175000017500000001031710051310310012125 00000000000000/* A Bison parser, made by GNU Bison 1.875a. */ /* Skeleton parser for Yacc-like parsing with Bison, Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 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 2, 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, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* As a special exception, when this file is copied by Bison into a Bison output file, you may use that output file without restriction. This special exception was added by the Free Software Foundation in version 1.24 of Bison. */ /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { TOK_ACCEPT = 258, TOK_DEST = 259, TOK_DPORT = 260, TOK_DROP = 261, TOK_FORWARD = 262, TOK_ICMPTYPE = 263, TOK_INPUT = 264, TOK_LCURLY = 265, TOK_LOCAL = 266, TOK_LOG = 267, TOK_LSQUARE = 268, TOK_MASQ = 269, TOK_ONEWAY = 270, TOK_OUTPUT = 271, TOK_PROTO = 272, TOK_PROXY = 273, TOK_RCURLY = 274, TOK_REDIRECT = 275, TOK_REJECT = 276, TOK_RSQUARE = 277, TOK_SEMICOLON = 278, TOK_SOURCE = 279, TOK_SPORT = 280, TOK_TEXT = 281, TOK_IDENTIFIER = 282, TOK_DOT = 283, TOK_SLASH = 284, TOK_ERR = 285, TOK_BANG = 286, TOK_COLON = 287 }; #endif #define TOK_ACCEPT 258 #define TOK_DEST 259 #define TOK_DPORT 260 #define TOK_DROP 261 #define TOK_FORWARD 262 #define TOK_ICMPTYPE 263 #define TOK_INPUT 264 #define TOK_LCURLY 265 #define TOK_LOCAL 266 #define TOK_LOG 267 #define TOK_LSQUARE 268 #define TOK_MASQ 269 #define TOK_ONEWAY 270 #define TOK_OUTPUT 271 #define TOK_PROTO 272 #define TOK_PROXY 273 #define TOK_RCURLY 274 #define TOK_REDIRECT 275 #define TOK_REJECT 276 #define TOK_RSQUARE 277 #define TOK_SEMICOLON 278 #define TOK_SOURCE 279 #define TOK_SPORT 280 #define TOK_TEXT 281 #define TOK_IDENTIFIER 282 #define TOK_DOT 283 #define TOK_SLASH 284 #define TOK_ERR 285 #define TOK_BANG 286 #define TOK_COLON 287 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) #line 35 "parser.y" typedef union YYSTYPE { struct rule_list_s * u_rule_list; struct rule_s * u_rule; struct specifier_list_s * u_specifier_list; struct negated_specifier_s * u_negated_specifier; struct specifier_s * u_specifier; struct direction_specifier_s * u_direction_specifier; struct direction_argument_list_s * u_direction_argument_list; struct direction_argument_s * u_direction_argument; struct target_specifier_s * u_target_specifier; struct log_target_specifier_s * u_log_target_specifier; struct host_specifier_s * u_host_specifier; struct host_argument_list_s * u_host_argument_list; struct host_argument_s * u_host_argument; struct port_specifier_s * u_port_specifier; struct port_argument_list_s * u_port_argument_list; struct port_argument_s * u_port_argument; struct protocol_specifier_s * u_protocol_specifier; struct protocol_argument_list_s * u_protocol_argument_list; struct protocol_argument_s * u_protocol_argument; struct icmptype_specifier_s * u_icmptype_specifier; struct icmptype_argument_list_s * u_icmptype_argument_list; struct icmptype_argument_s * u_icmptype_argument; struct option_specifier_s * u_option_specifier; struct compound_specifier_s * u_compound_specifier; struct chaingroup_specifier_s * u_chaingroup_specifier; struct subrule_list_s * u_subrule_list; char * u_str; } YYSTYPE; /* Line 1240 of yacc.c. */ #line 131 "y.tab.h" # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 #endif extern YYSTYPE yylval; filtergen-0.12.4/scanner.c0000644000175000017500000015230310110542031012262 00000000000000 #line 3 "scanner.c" #define YY_INT_ALIGNED short int /* A lexical scanner generated by flex */ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 #define YY_FLEX_SUBMINOR_VERSION 31 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ #include #include #include #include /* end standard C headers. */ /* flex integer type definitions */ #ifndef FLEXINT_H #define FLEXINT_H /* C99 systems have . Non-C99 systems may or may not. */ #if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L #include typedef int8_t flex_int8_t; typedef uint8_t flex_uint8_t; typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; #else typedef signed char flex_int8_t; typedef short int flex_int16_t; typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; #endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN #define INT8_MIN (-128) #endif #ifndef INT16_MIN #define INT16_MIN (-32767-1) #endif #ifndef INT32_MIN #define INT32_MIN (-2147483647-1) #endif #ifndef INT8_MAX #define INT8_MAX (127) #endif #ifndef INT16_MAX #define INT16_MAX (32767) #endif #ifndef INT32_MAX #define INT32_MAX (2147483647) #endif #ifndef UINT8_MAX #define UINT8_MAX (255U) #endif #ifndef UINT16_MAX #define UINT16_MAX (65535U) #endif #ifndef UINT32_MAX #define UINT32_MAX (4294967295U) #endif #endif /* ! FLEXINT_H */ #ifdef __cplusplus /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST #else /* ! __cplusplus */ #if __STDC__ #define YY_USE_CONST #endif /* __STDC__ */ #endif /* ! __cplusplus */ #ifdef YY_USE_CONST #define yyconst const #else #define yyconst #endif /* Returned upon end-of-file. */ #define YY_NULL 0 /* Promotes a possibly negative, possibly signed char to an unsigned * integer for use as an array index. If the signed char is negative, * we want to instead treat it as an 8-bit unsigned char, hence the * double cast. */ #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN (yy_start) = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ #define YY_NEW_FILE yyrestart(yyin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #ifndef YY_BUF_SIZE #define YY_BUF_SIZE 16384 #endif #ifndef YY_TYPEDEF_YY_BUFFER_STATE #define YY_TYPEDEF_YY_BUFFER_STATE typedef struct yy_buffer_state *YY_BUFFER_STATE; #endif extern int yyleng; extern FILE *yyin, *yyout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 #define YY_LESS_LINENO(n) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ *yy_cp = (yy_hold_char); \ YY_RESTORE_YY_MORE_OFFSET \ (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) #define unput(c) yyunput( c, (yytext_ptr) ) /* The following is because we cannot portably get our hands on size_t * (without autoconf's help, which isn't available because we want * flex-generated scanners to compile on their own). */ #ifndef YY_TYPEDEF_YY_SIZE_T #define YY_TYPEDEF_YY_SIZE_T typedef unsigned int yy_size_t; #endif #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state { FILE *yy_input_file; char *yy_ch_buf; /* input buffer */ char *yy_buf_pos; /* current position in input buffer */ /* Size of input buffer in bytes, not including room for EOB * characters. */ yy_size_t yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to * delete it. */ int yy_is_our_buffer; /* Whether this is an "interactive" input source; if so, and * if we're using stdio for input, then we want to use getc() * instead of fread(), to make sure we stop fetching input after * each newline. */ int yy_is_interactive; /* Whether we're considered to be at the beginning of a line. * If so, '^' rules will be active on the next match, otherwise * not. */ int yy_at_bol; int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process * then we mark the buffer as YY_EOF_PENDING, to indicate that we * shouldn't try reading from the input source any more. We might * still have a bunch of tokens to match, though, because of * possible backing-up. * * When we actually see the EOF, we change the status to "new" * (via yyrestart()), so that the user can continue scanning by * just pointing yyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 }; #endif /* !YY_STRUCT_YY_BUFFER_STATE */ /* Stack of input buffers. */ static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". * * Returns the top of the stack, or NULL. */ #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ : NULL) /* Same as previous macro, but useful when we know that the buffer stack is not * NULL or when we need an lvalue. For internal use only. */ #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] /* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; static int yy_n_chars; /* number of characters read into yy_ch_buf */ int yyleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; static int yy_init = 1; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ /* Flag which is used to allow yywrap()'s to do buffer switches * instead of setting up a fresh yyin. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; void yyrestart (FILE *input_file ); void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); void yy_delete_buffer (YY_BUFFER_STATE b ); void yy_flush_buffer (YY_BUFFER_STATE b ); void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); void yypop_buffer_state (void ); static void yyensure_buffer_stack (void ); static void yy_load_buffer_state (void ); static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); void *yyalloc (yy_size_t ); void *yyrealloc (void *,yy_size_t ); void yyfree (void * ); #define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ yy_create_buffer(yyin,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ yy_create_buffer(yyin,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) /* Begin user sect3 */ #define yywrap(n) 1 #define YY_SKIP_YYWRAP typedef unsigned char YY_CHAR; FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; typedef int yy_state_type; extern int yylineno; int yylineno = 1; extern char *yytext; #define yytext_ptr yytext static yy_state_type yy_get_previous_state (void ); static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); static int yy_get_next_buffer (void ); static void yy_fatal_error (yyconst char msg[] ); /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ yyleng = (size_t) (yy_cp - yy_bp); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; #define YY_NUM_RULES 38 #define YY_END_OF_BUFFER 39 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info { flex_int32_t yy_verify; flex_int32_t yy_nxt; }; static yyconst flex_int16_t yy_accept[130] = { 0, 0, 0, 36, 36, 39, 35, 4, 5, 32, 35, 2, 34, 33, 31, 30, 28, 29, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 26, 27, 37, 36, 38, 4, 0, 2, 1, 33, 0, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 37, 36, 3, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 15, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 8, 33, 10, 33, 33, 33, 33, 33, 16, 33, 33, 33, 33, 33, 33, 33, 33, 25, 33, 9, 33, 33, 33, 13, 14, 33, 33, 19, 20, 33, 33, 33, 24, 7, 33, 33, 33, 17, 18, 33, 22, 23, 11, 33, 6, 33, 12, 21, 0 } ; static yyconst flex_int32_t yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 5, 6, 1, 1, 1, 1, 1, 1, 7, 8, 1, 8, 9, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 13, 1, 1, 1, 1, 1, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 14, 1, 15, 1, 11, 1, 16, 11, 17, 18, 19, 20, 21, 11, 22, 23, 11, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 11, 34, 35, 36, 11, 37, 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 } ; static yyconst flex_int32_t yy_meta[39] = { 0, 1, 2, 3, 1, 1, 1, 1, 4, 4, 1, 5, 1, 2, 1, 1, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 1, 1 } ; static yyconst flex_int16_t yy_base[137] = { 0, 0, 0, 37, 39, 256, 257, 253, 257, 257, 0, 0, 247, 244, 257, 257, 257, 257, 34, 35, 37, 36, 39, 40, 46, 38, 48, 49, 50, 257, 257, 0, 250, 257, 249, 245, 0, 257, 240, 0, 61, 51, 62, 64, 65, 71, 66, 76, 72, 79, 52, 77, 83, 78, 81, 90, 0, 246, 242, 237, 91, 96, 93, 98, 100, 103, 105, 104, 106, 236, 107, 108, 110, 109, 111, 121, 115, 118, 123, 235, 126, 230, 130, 229, 134, 137, 138, 140, 142, 223, 143, 144, 147, 148, 149, 151, 156, 154, 218, 155, 209, 152, 158, 167, 208, 207, 161, 166, 206, 205, 169, 171, 172, 204, 203, 174, 180, 181, 202, 201, 184, 200, 198, 197, 186, 195, 187, 193, 190, 257, 219, 224, 229, 231, 236, 116, 238 } ; static yyconst flex_int16_t yy_def[137] = { 0, 129, 1, 130, 130, 129, 129, 129, 129, 129, 131, 132, 129, 133, 129, 129, 129, 129, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 129, 129, 134, 129, 129, 129, 131, 132, 129, 133, 135, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 134, 129, 131, 136, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 136, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 0, 129, 129, 129, 129, 129, 129, 129 } ; static yyconst flex_int16_t yy_nxt[296] = { 0, 6, 7, 8, 9, 10, 11, 6, 6, 6, 12, 13, 14, 15, 16, 17, 18, 13, 19, 13, 20, 13, 21, 13, 22, 23, 13, 24, 25, 13, 26, 27, 28, 13, 13, 13, 13, 29, 30, 32, 33, 32, 33, 39, 39, 39, 39, 39, 39, 39, 33, 40, 33, 45, 41, 39, 48, 39, 39, 39, 39, 39, 46, 42, 44, 43, 47, 52, 51, 55, 39, 39, 49, 39, 39, 39, 53, 54, 60, 50, 39, 39, 61, 66, 72, 39, 39, 39, 39, 62, 39, 63, 39, 68, 67, 64, 65, 69, 71, 39, 39, 74, 39, 70, 73, 39, 75, 39, 77, 39, 80, 76, 39, 39, 39, 39, 39, 39, 39, 39, 39, 59, 88, 82, 39, 78, 83, 39, 81, 86, 39, 85, 39, 94, 84, 39, 89, 87, 91, 39, 95, 92, 90, 39, 93, 96, 39, 39, 97, 39, 101, 39, 39, 39, 99, 98, 39, 39, 39, 106, 39, 39, 100, 39, 39, 39, 105, 39, 111, 102, 39, 103, 104, 112, 108, 39, 39, 107, 39, 110, 39, 39, 115, 39, 109, 117, 113, 114, 120, 39, 39, 122, 123, 39, 116, 39, 39, 118, 119, 39, 125, 126, 39, 121, 39, 127, 39, 39, 124, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 128, 31, 31, 31, 31, 31, 35, 35, 39, 35, 35, 36, 36, 39, 36, 36, 38, 38, 56, 39, 39, 56, 56, 79, 79, 39, 39, 39, 58, 57, 39, 58, 34, 57, 39, 37, 34, 129, 5, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129 } ; static yyconst flex_int16_t yy_chk[296] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 4, 4, 18, 19, 21, 20, 25, 22, 23, 3, 18, 4, 21, 19, 24, 23, 26, 27, 28, 41, 50, 21, 19, 20, 19, 22, 26, 25, 28, 40, 42, 24, 43, 44, 46, 27, 27, 40, 24, 45, 48, 41, 46, 50, 47, 51, 53, 49, 42, 54, 43, 52, 47, 46, 44, 45, 47, 49, 55, 60, 52, 62, 48, 51, 61, 52, 63, 54, 64, 60, 53, 65, 67, 66, 68, 70, 71, 73, 72, 74, 135, 68, 62, 76, 55, 63, 77, 61, 66, 75, 65, 78, 74, 64, 80, 70, 67, 72, 82, 75, 73, 71, 84, 73, 76, 85, 86, 77, 87, 84, 88, 90, 91, 80, 78, 92, 93, 94, 90, 95, 101, 82, 97, 99, 96, 88, 102, 95, 85, 106, 86, 87, 96, 92, 107, 103, 91, 110, 94, 111, 112, 101, 115, 93, 103, 97, 99, 110, 116, 117, 112, 115, 120, 102, 124, 126, 106, 107, 128, 117, 120, 127, 111, 125, 124, 123, 122, 116, 121, 119, 118, 114, 113, 109, 108, 105, 104, 100, 126, 130, 130, 130, 130, 130, 131, 131, 98, 131, 131, 132, 132, 89, 132, 132, 133, 133, 134, 83, 81, 134, 134, 136, 136, 79, 69, 59, 58, 57, 38, 35, 34, 32, 13, 12, 7, 5, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129 } ; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; extern int yy_flex_debug; int yy_flex_debug = 0; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ #define REJECT reject_used_but_not_detected #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; #line 1 "scanner.l" #line 5 "scanner.l" /* input scanner for filtergen language * * Copyright (c) 2003 Jamie Wilkinson * * 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. * * 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, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include #include "parser.h" /* include file stack */ #define MAXINCLUDES 16 struct inc_stack_s { YY_BUFFER_STATE state; char * filename; long int lineno; }; struct inc_stack_s inc_stack[MAXINCLUDES] = { { state: 0, filename: NULL, lineno: 1 } }; int inc_stackptr = 0; long int lineno(); char * filename(); static void scan_err(const char * fmt, ...); void include_file(const char *); #line 596 "scanner.c" #define INITIAL 0 #define include 1 #ifndef YY_NO_UNISTD_H /* Special case for "unistd.h", since it is non-ANSI. We include it way * down here because we want the user's section 1 to have been scanned first. * The user has a chance to override it with an option. */ #include #endif #ifndef YY_EXTRA_TYPE #define YY_EXTRA_TYPE void * #endif /* Macros after this point can all be overridden by user definitions in * section 1. */ #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus extern "C" int yywrap (void ); #else extern int yywrap (void ); #endif #endif #ifndef yytext_ptr static void yy_flex_strncpy (char *,yyconst char *,int ); #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * ); #endif #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void ); #else static int input (void ); #endif #endif /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE #define YY_READ_BUF_SIZE 8192 #endif /* Copy whatever the last rule matched to the standard output. */ #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ #define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, * is returned in "result". */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ size_t n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ if ( c == EOF && ferror( yyin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else \ { \ errno=0; \ while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ { \ if( errno != EINTR) \ { \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ break; \ } \ errno=0; \ clearerr(yyin); \ } \ }\ \ #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - * we don't want an extra ';' after the "return" because that will cause * some compilers to complain about unreachable statements. */ #ifndef yyterminate #define yyterminate() return YY_NULL #endif /* Number of entries by which start-condition stack grows. */ #ifndef YY_START_STACK_INCR #define YY_START_STACK_INCR 25 #endif /* Report a fatal error. */ #ifndef YY_FATAL_ERROR #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) #endif /* end tables serialization structures and prototypes */ /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL #define YY_DECL_IS_OURS 1 extern int yylex (void); #define YY_DECL int yylex (void) #endif /* !YY_DECL */ /* Code executed at the beginning of each rule, after yytext and yyleng * have been set up. */ #ifndef YY_USER_ACTION #define YY_USER_ACTION #endif /* Code executed at the end of each rule. */ #ifndef YY_BREAK #define YY_BREAK break; #endif #define YY_RULE_SETUP \ YY_USER_ACTION /** The main scanner function which does all the work. */ YY_DECL { register yy_state_type yy_current_state; register char *yy_cp, *yy_bp; register int yy_act; #line 53 "scanner.l" #line 749 "scanner.c" if ( (yy_init) ) { (yy_init) = 0; #ifdef YY_USER_INIT YY_USER_INIT; #endif if ( ! (yy_start) ) (yy_start) = 1; /* first start state */ if ( ! yyin ) yyin = stdin; if ( ! yyout ) yyout = stdout; if ( ! YY_CURRENT_BUFFER ) { yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin,YY_BUF_SIZE ); } yy_load_buffer_state( ); } while ( 1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); /* Support of yytext. */ *yy_cp = (yy_hold_char); /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; yy_current_state = (yy_start); yy_match: do { register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 130 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } while ( yy_base[yy_current_state] != 257 ); yy_find_action: yy_act = yy_accept[yy_current_state]; if ( yy_act == 0 ) { /* have to back up */ yy_cp = (yy_last_accepting_cpos); yy_current_state = (yy_last_accepting_state); yy_act = yy_accept[yy_current_state]; } YY_DO_BEFORE_ACTION; do_action: /* This label is used only to access EOF actions. */ switch ( yy_act ) { /* beginning of action switch */ case 0: /* must back up */ /* undo the effects of YY_DO_BEFORE_ACTION */ *yy_cp = (yy_hold_char); yy_cp = (yy_last_accepting_cpos); yy_current_state = (yy_last_accepting_state); goto yy_find_action; case 1: YY_RULE_SETUP #line 55 "scanner.l" { /* strip c-style comments */ int c; do { while ((c = input()) != '*' && c != EOF && c != '\n') ; while (c == '*') c = input(); if (c == EOF) scan_err("comment reached end of file"); if (c == '\n') inc_stack[inc_stackptr].lineno++; } while (c != '/' && c != EOF); } YY_BREAK case 2: YY_RULE_SETUP #line 69 "scanner.l" /* strip shell style comments */ YY_BREAK case 3: YY_RULE_SETUP #line 71 "scanner.l" { /* we do not store the " characters in the string, so lop * them off. We can "safely" assume that the first and last * characters in this regex are ", otherwise there's a bug * in flex... The result is somethign that is syntactically * identical to an identifier for our purposes. */ yylval.u_str = strndup(yytext + 1, yyleng - 2); return TOK_IDENTIFIER; } YY_BREAK case 4: YY_RULE_SETUP #line 81 "scanner.l" /* ignore */ YY_BREAK case 5: /* rule 5 can match eol */ YY_RULE_SETUP #line 83 "scanner.l" inc_stack[inc_stackptr].lineno++; YY_BREAK case 6: YY_RULE_SETUP #line 85 "scanner.l" BEGIN(include); YY_BREAK case 7: YY_RULE_SETUP #line 87 "scanner.l" return TOK_ACCEPT; YY_BREAK case 8: YY_RULE_SETUP #line 88 "scanner.l" return TOK_DEST; YY_BREAK case 9: YY_RULE_SETUP #line 89 "scanner.l" return TOK_DPORT; YY_BREAK case 10: YY_RULE_SETUP #line 90 "scanner.l" return TOK_DROP; YY_BREAK case 11: YY_RULE_SETUP #line 91 "scanner.l" return TOK_FORWARD; YY_BREAK case 12: YY_RULE_SETUP #line 92 "scanner.l" return TOK_ICMPTYPE; YY_BREAK case 13: YY_RULE_SETUP #line 93 "scanner.l" return TOK_INPUT; YY_BREAK case 14: YY_RULE_SETUP #line 94 "scanner.l" return TOK_LOCAL; YY_BREAK case 15: YY_RULE_SETUP #line 95 "scanner.l" return TOK_LOG; YY_BREAK case 16: YY_RULE_SETUP #line 96 "scanner.l" return TOK_MASQ; YY_BREAK case 17: YY_RULE_SETUP #line 97 "scanner.l" return TOK_ONEWAY; YY_BREAK case 18: YY_RULE_SETUP #line 98 "scanner.l" return TOK_OUTPUT; YY_BREAK case 19: YY_RULE_SETUP #line 99 "scanner.l" return TOK_PROTO; YY_BREAK case 20: YY_RULE_SETUP #line 100 "scanner.l" return TOK_PROXY; YY_BREAK case 21: YY_RULE_SETUP #line 101 "scanner.l" return TOK_REDIRECT; YY_BREAK case 22: YY_RULE_SETUP #line 102 "scanner.l" return TOK_REJECT; YY_BREAK case 23: YY_RULE_SETUP #line 103 "scanner.l" return TOK_SOURCE; YY_BREAK case 24: YY_RULE_SETUP #line 104 "scanner.l" return TOK_SPORT; YY_BREAK case 25: YY_RULE_SETUP #line 105 "scanner.l" return TOK_TEXT; YY_BREAK case 26: YY_RULE_SETUP #line 107 "scanner.l" return TOK_LCURLY; YY_BREAK case 27: YY_RULE_SETUP #line 108 "scanner.l" return TOK_RCURLY; YY_BREAK case 28: YY_RULE_SETUP #line 109 "scanner.l" return TOK_LSQUARE; YY_BREAK case 29: YY_RULE_SETUP #line 110 "scanner.l" return TOK_RSQUARE; YY_BREAK case 30: YY_RULE_SETUP #line 111 "scanner.l" return TOK_SEMICOLON; YY_BREAK case 31: YY_RULE_SETUP #line 112 "scanner.l" return TOK_COLON; YY_BREAK case 32: YY_RULE_SETUP #line 113 "scanner.l" return TOK_BANG; YY_BREAK case 33: YY_RULE_SETUP #line 115 "scanner.l" { yylval.u_str = strndup(yytext, yyleng); return TOK_IDENTIFIER; } YY_BREAK case 34: YY_RULE_SETUP #line 120 "scanner.l" return TOK_SLASH; YY_BREAK case 35: YY_RULE_SETUP #line 122 "scanner.l" return TOK_ERR; YY_BREAK case 36: YY_RULE_SETUP #line 124 "scanner.l" /* eat whitespace after include */ YY_BREAK case 37: YY_RULE_SETUP #line 125 "scanner.l" { /* include file name */ if (inc_stackptr >= MAXINCLUDES) { scan_err("warning: too many nested includes"); scan_err("warning: skipping include of file %s", yytext); } else { char * name; name = strdup(yytext); include_file(name); free(name); } BEGIN(INITIAL); } YY_BREAK case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(include): #line 140 "scanner.l" { if (!inc_stackptr) { yyterminate(); } else { if (inc_stack[inc_stackptr].filename) { free(inc_stack[inc_stackptr].filename); inc_stack[inc_stackptr].filename = NULL; } inc_stackptr--; yy_delete_buffer(YY_CURRENT_BUFFER); yy_switch_to_buffer(inc_stack[inc_stackptr].state); } } YY_BREAK case 38: YY_RULE_SETUP #line 153 "scanner.l" ECHO; YY_BREAK #line 1076 "scanner.c" case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ *yy_cp = (yy_hold_char); YY_RESTORE_YY_MORE_OFFSET if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed yyin at a new source and called * yylex(). If so, then we have to assure * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position * of the first EOB in the buffer, since yy_c_buf_p will * already have been incremented past the NUL character * (since all states make transitions on EOB to the * end-of-buffer state). Contrast this with the test * in input(). */ if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) { /* This was really a NUL. */ yy_state_type yy_next_state; (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( ); /* Okay, we're now positioned to make the NUL * transition. We couldn't have * yy_get_previous_state() go ahead and do it * for us because it doesn't know how to deal * with the possibility of jamming (and we don't * want to build jamming into it because then it * will run more slowly). */ yy_next_state = yy_try_NUL_trans( yy_current_state ); yy_bp = (yytext_ptr) + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ yy_cp = ++(yy_c_buf_p); yy_current_state = yy_next_state; goto yy_match; } else { yy_cp = (yy_c_buf_p); goto yy_find_action; } } else switch ( yy_get_next_buffer( ) ) { case EOB_ACT_END_OF_FILE: { (yy_did_buffer_switch_on_eof) = 0; if ( yywrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up * yytext, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the * YY_NULL, it'll still work - another * YY_NULL will get returned. */ (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; } else { if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( ); yy_cp = (yy_c_buf_p); yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: (yy_c_buf_p) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; yy_current_state = yy_get_previous_state( ); yy_cp = (yy_c_buf_p); yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_find_action; } break; } default: YY_FATAL_ERROR( "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ } /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: * EOB_ACT_LAST_MATCH - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ static int yy_get_next_buffer (void) { register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; register char *source = (yytext_ptr); register int number_to_move, i; int ret_val; if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. */ return EOB_ACT_END_OF_FILE; } else { /* We matched some text prior to the EOB, first * process it. */ return EOB_ACT_LAST_MATCH; } } /* Try to read more data. */ /* First move last chars to start of buffer. */ number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; else { size_t num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ /* just a shorter name for the current buffer */ YY_BUFFER_STATE b = YY_CURRENT_BUFFER; int yy_c_buf_p_offset = (int) ((yy_c_buf_p) - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; else b->yy_buf_size *= 2; b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); } else /* Can't grow it, we don't own it. */ b->yy_ch_buf = 0; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), (yy_n_chars), num_to_read ); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } if ( (yy_n_chars) == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; yyrestart(yyin ); } else { ret_val = EOB_ACT_LAST_MATCH; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } else ret_val = EOB_ACT_CONTINUE_SCAN; (yy_n_chars) += number_to_move; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; return ret_val; } /* yy_get_previous_state - get the state just before the EOB char was reached */ static yy_state_type yy_get_previous_state (void) { register yy_state_type yy_current_state; register char *yy_cp; yy_current_state = (yy_start); for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 130 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; } return yy_current_state; } /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) { register int yy_is_jam; register char *yy_cp = (yy_c_buf_p); register YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 130 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_is_jam = (yy_current_state == 129); return yy_is_jam ? 0 : yy_current_state; } #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void) #else static int input (void) #endif { int c; *(yy_c_buf_p) = (yy_hold_char); if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) /* This was really a NUL. */ *(yy_c_buf_p) = '\0'; else { /* need more input */ int offset = (yy_c_buf_p) - (yytext_ptr); ++(yy_c_buf_p); switch ( yy_get_next_buffer( ) ) { case EOB_ACT_LAST_MATCH: /* This happens because yy_g_n_b() * sees that we've accumulated a * token and flags that we need to * try matching the token before * proceeding. But for input(), * there's no matching to consider. * So convert the EOB_ACT_LAST_MATCH * to EOB_ACT_END_OF_FILE. */ /* Reset buffer status. */ yyrestart(yyin ); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { if ( yywrap( ) ) return EOF; if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; #ifdef __cplusplus return yyinput(); #else return input(); #endif } case EOB_ACT_CONTINUE_SCAN: (yy_c_buf_p) = (yytext_ptr) + offset; break; } } } c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ *(yy_c_buf_p) = '\0'; /* preserve yytext */ (yy_hold_char) = *++(yy_c_buf_p); return c; } #endif /* ifndef YY_NO_INPUT */ /** Immediately switch to a different input stream. * @param input_file A readable stream. * * @note This function does not reset the start condition to @c INITIAL . */ void yyrestart (FILE * input_file ) { if ( ! YY_CURRENT_BUFFER ){ yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin,YY_BUF_SIZE ); } yy_init_buffer(YY_CURRENT_BUFFER,input_file ); yy_load_buffer_state( ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * */ void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) { /* TODO. We should be able to replace this entire function body * with * yypop_buffer_state(); * yypush_buffer_state(new_buffer); */ yyensure_buffer_stack (); if ( YY_CURRENT_BUFFER == new_buffer ) return; if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *(yy_c_buf_p) = (yy_hold_char); YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } YY_CURRENT_BUFFER_LVALUE = new_buffer; yy_load_buffer_state( ); /* We don't actually know whether we did this switch during * EOF (yywrap()) processing, but the only time this flag * is looked at is after yywrap() is called, so it's safe * to go ahead and always set it. */ (yy_did_buffer_switch_on_eof) = 1; } static void yy_load_buffer_state (void) { (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; (yy_hold_char) = *(yy_c_buf_p); } /** Allocate and initialize an input buffer state. * @param file A readable stream. * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. * * @return the allocated buffer state. */ YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) { YY_BUFFER_STATE b; b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_is_our_buffer = 1; yy_init_buffer(b,file ); return b; } /** Destroy the buffer. * @param b a buffer created with yy_create_buffer() * */ void yy_delete_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) yyfree((void *) b->yy_ch_buf ); yyfree((void *) b ); } #ifndef __cplusplus extern int isatty (int ); #endif /* __cplusplus */ /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a yyrestart() or at EOF. */ static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) { int oerrno = errno; yy_flush_buffer(b ); b->yy_input_file = file; b->yy_fill_buffer = 1; /* If b is the current buffer, then yy_init_buffer was _probably_ * called from yyrestart() or through yy_get_next_buffer. * In that case, we don't want to reset the lineno or column. */ if (b != YY_CURRENT_BUFFER){ b->yy_bs_lineno = 1; b->yy_bs_column = 0; } b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; errno = oerrno; } /** Discard all buffered characters. On the next scan, YY_INPUT will be called. * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. * */ void yy_flush_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; b->yy_n_chars = 0; /* We always need two end-of-buffer characters. The first causes * a transition to the end-of-buffer state. The second causes * a jam in that state. */ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; b->yy_buf_pos = &b->yy_ch_buf[0]; b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; if ( b == YY_CURRENT_BUFFER ) yy_load_buffer_state( ); } /** Pushes the new state onto the stack. The new state becomes * the current state. This function will allocate the stack * if necessary. * @param new_buffer The new state. * */ void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) { if (new_buffer == NULL) return; yyensure_buffer_stack(); /* This block is copied from yy_switch_to_buffer. */ if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *(yy_c_buf_p) = (yy_hold_char); YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } /* Only push if top exists. Otherwise, replace top. */ if (YY_CURRENT_BUFFER) (yy_buffer_stack_top)++; YY_CURRENT_BUFFER_LVALUE = new_buffer; /* copied from yy_switch_to_buffer. */ yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } /** Removes and deletes the top of the stack, if present. * The next element becomes the new top. * */ void yypop_buffer_state (void) { if (!YY_CURRENT_BUFFER) return; yy_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; if ((yy_buffer_stack_top) > 0) --(yy_buffer_stack_top); if (YY_CURRENT_BUFFER) { yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } } /* Allocates the stack if it does not exist. * Guarantees space for at least one push. */ static void yyensure_buffer_stack (void) { int num_to_alloc; if (!(yy_buffer_stack)) { /* First allocation is just for 2 elements, since we don't know if this * scanner will even need a stack. We use 2 instead of 1 to avoid an * immediate realloc on the next call. */ num_to_alloc = 1; (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); (yy_buffer_stack_max) = num_to_alloc; (yy_buffer_stack_top) = 0; return; } if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ /* Increase the buffer to prepare for a possible push. */ int grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc ((yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state*) ); /* zero only the new slots.*/ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); (yy_buffer_stack_max) = num_to_alloc; } } /** Setup the input buffer state to scan directly from a user-specified character buffer. * @param base the character buffer * @param size the size in bytes of the character buffer * * @return the newly allocated buffer state object. */ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) { YY_BUFFER_STATE b; if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ return 0; b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; b->yy_input_file = 0; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; yy_switch_to_buffer(b ); return b; } /** Setup the input buffer state to scan a string. The next call to yylex() will * scan from a @e copy of @a str. * @param str a NUL-terminated string to scan * * @return the newly allocated buffer state object. * @note If you want to scan bytes that may contain NUL values, then use * yy_scan_bytes() instead. */ YY_BUFFER_STATE yy_scan_string (yyconst char * yy_str ) { return yy_scan_bytes(yy_str,strlen(yy_str) ); } /** Setup the input buffer state to scan the given bytes. The next call to yylex() will * scan from a @e copy of @a bytes. * @param bytes the byte buffer to scan * @param len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ YY_BUFFER_STATE yy_scan_bytes (yyconst char * bytes, int len ) { YY_BUFFER_STATE b; char *buf; yy_size_t n; int i; /* Get memory for full buffer, including space for trailing EOB's. */ n = len + 2; buf = (char *) yyalloc(n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); for ( i = 0; i < len; ++i ) buf[i] = bytes[i]; buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; b = yy_scan_buffer(buf,n ); if ( ! b ) YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. */ b->yy_is_our_buffer = 1; return b; } #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif static void yy_fatal_error (yyconst char* msg ) { (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } /* Redefine yyless() so it works in section 3 code. */ #undef yyless #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ yytext[yyleng] = (yy_hold_char); \ (yy_c_buf_p) = yytext + yyless_macro_arg; \ (yy_hold_char) = *(yy_c_buf_p); \ *(yy_c_buf_p) = '\0'; \ yyleng = yyless_macro_arg; \ } \ while ( 0 ) /* Accessor methods (get/set functions) to struct members. */ /** Get the current line number. * */ int yyget_lineno (void) { return yylineno; } /** Get the input stream. * */ FILE *yyget_in (void) { return yyin; } /** Get the output stream. * */ FILE *yyget_out (void) { return yyout; } /** Get the length of the current token. * */ int yyget_leng (void) { return yyleng; } /** Get the current token. * */ char *yyget_text (void) { return yytext; } /** Set the current line number. * @param line_number * */ void yyset_lineno (int line_number ) { yylineno = line_number; } /** Set the input stream. This does not discard the current * input buffer. * @param in_str A readable stream. * * @see yy_switch_to_buffer */ void yyset_in (FILE * in_str ) { yyin = in_str ; } void yyset_out (FILE * out_str ) { yyout = out_str ; } int yyget_debug (void) { return yy_flex_debug; } void yyset_debug (int bdebug ) { yy_flex_debug = bdebug ; } /* yylex_destroy is for both reentrant and non-reentrant scanners. */ int yylex_destroy (void) { /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ yy_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; yypop_buffer_state(); } /* Destroy the stack itself. */ yyfree((yy_buffer_stack) ); (yy_buffer_stack) = NULL; return 0; } /* * Internal utility routines. */ #ifndef yytext_ptr static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) { register int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * s ) { register int n; for ( n = 0; s[n]; ++n ) ; return n; } #endif void *yyalloc (yy_size_t size ) { return (void *) malloc( size ); } void *yyrealloc (void * ptr, yy_size_t size ) { /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter * because both ANSI C and C++ allow castless assignment from * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ return (void *) realloc( (char *) ptr, size ); } void yyfree (void * ptr ) { free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" #undef YY_NEW_FILE #undef YY_FLUSH_BUFFER #undef yy_set_bol #undef yy_new_buffer #undef yy_set_interactive #undef yytext_ptr #undef YY_DO_BEFORE_ACTION #ifdef YY_DECL_IS_OURS #undef YY_DECL_IS_OURS #undef YY_DECL #endif #line 153 "scanner.l" long int lineno(void) { return inc_stack[inc_stackptr].lineno; } /* FIXME: make this return an immutable string */ char * filename(void) { return inc_stack[inc_stackptr].filename ?: strdup("(standard input)"); } static void scan_err(const char * fmt, ...) { va_list args; va_start(args, fmt); if (inc_stackptr >= 0) fprintf(stderr, "%s:%ld: ", filename(), lineno()); vfprintf(stderr, fmt, args); fprintf(stderr, "\n"); } void step_into_include_file(const char * fn) { FILE * f; if (!(f = fopen(fn, "r"))) { scan_err("warning: can't open file \"%s\"", fn); } else { inc_stack[inc_stackptr++].state = YY_CURRENT_BUFFER; inc_stack[inc_stackptr].lineno = 1; inc_stack[inc_stackptr].filename = strdup(fn); yyin = f; yy_switch_to_buffer(yy_create_buffer(yyin,YY_BUF_SIZE)); } } /* include a file or directory */ void include_file(const char * name) { struct stat st; DIR * d; struct dirent * r; char * fn; if (stat(name, &st)) { scan_err("warning: stat failed on %s: %s", name, strerror(errno)); } else { if (S_ISDIR(st.st_mode)) { if ((d = opendir(name)) == NULL) { scan_err("warning: opendir failed on %s: %s", name, strerror(errno)); } else { while ((r = readdir(d)) != NULL) { /* FIXME: assumes d_name */ if (r->d_name[0] == '.') continue; asprintf(&fn, "%s/%s", name, r->d_name); include_file(fn); free(fn); } closedir(d); } } else step_into_include_file(name); } } filtergen-0.12.4/ylwrap0000755000175000017500000001405710066147232011752 00000000000000#! /bin/sh # ylwrap - wrapper for lex/yacc invocations. scriptversion=2003-11-18.20 # Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003 # Free Software Foundation, Inc. # # Written by Tom Tromey . # # 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, 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, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # 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. # This file is maintained in Automake, please report # bugs to or send patches to # . case "$1" in '') echo "$0: No files given. Try \`$0 --help' for more information." 1>&2 exit 1 ;; --basedir) basedir=$2 shift 2 ;; -h|--h*) cat <<\EOF Usage: ylwrap [--help|--version] INPUT [OUTPUT DESIRED]... -- PROGRAM [ARGS]... Wrapper for lex/yacc invocations, renaming files as desired. INPUT is the input file OUTPUT is one file PROG generates DESIRED is the file we actually want instead of OUTPUT PROGRAM is program to run ARGS are passed to PROG Any number of OUTPUT,DESIRED pairs may be used. Report bugs to . EOF exit 0 ;; -v|--v*) echo "ylwrap $scriptversion" exit 0 ;; esac # The input. input="$1" shift case "$input" in [\\/]* | ?:[\\/]*) # Absolute path; do nothing. ;; *) # Relative path. Make it absolute. input="`pwd`/$input" ;; esac pairlist= while test "$#" -ne 0; do if test "$1" = "--"; then shift break fi pairlist="$pairlist $1" shift done # The program to run. prog="$1" shift # Make any relative path in $prog absolute. case "$prog" in [\\/]* | ?:[\\/]*) ;; *[\\/]*) prog="`pwd`/$prog" ;; esac # FIXME: add hostname here for parallel makes that run commands on # other machines. But that might take us over the 14-char limit. dirname=ylwrap$$ trap "cd `pwd`; rm -rf $dirname > /dev/null 2>&1" 1 2 3 15 mkdir $dirname || exit 1 cd $dirname case $# in 0) $prog "$input" ;; *) $prog "$@" "$input" ;; esac status=$? if test $status -eq 0; then set X $pairlist shift first=yes # Since DOS filename conventions don't allow two dots, # the DOS version of Bison writes out y_tab.c instead of y.tab.c # and y_tab.h instead of y.tab.h. Test to see if this is the case. y_tab_nodot="no" if test -f y_tab.c || test -f y_tab.h; then y_tab_nodot="yes" fi # The directory holding the input. input_dir=`echo "$input" | sed -e 's,\([\\/]\)[^\\/]*$,\1,'` # Quote $INPUT_DIR so we can use it in a regexp. # FIXME: really we should care about more than `.' and `\'. input_rx=`echo "$input_dir" | sed 's,\\\\,\\\\\\\\,g;s,\\.,\\\\.,g'` while test "$#" -ne 0; do from="$1" # Handle y_tab.c and y_tab.h output by DOS if test $y_tab_nodot = "yes"; then if test $from = "y.tab.c"; then from="y_tab.c" else if test $from = "y.tab.h"; then from="y_tab.h" fi fi fi if test -f "$from"; then # If $2 is an absolute path name, then just use that, # otherwise prepend `../'. case "$2" in [\\/]* | ?:[\\/]*) target="$2";; *) target="../$2";; esac # We do not want to overwrite a header file if it hasn't # changed. This avoid useless recompilations. However the # parser itself (the first file) should always be updated, # because it is the destination of the .y.c rule in the # Makefile. Divert the output of all other files to a temporary # file so we can compare them to existing versions. if test $first = no; then realtarget="$target" target="tmp-`echo $target | sed s/.*[\\/]//g`" fi # Edit out `#line' or `#' directives. # # We don't want the resulting debug information to point at # an absolute srcdir; it is better for it to just mention the # .y file with no path. # # We want to use the real output file name, not yy.lex.c for # instance. # # We want the include guards to be adjusted too. FROM=`echo "$from" | sed \ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\ -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'` TARGET=`echo "$2" | sed \ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\ -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'` sed -e "/^#/!b" -e "s,$input_rx,," -e "s,$from,$2," \ -e "s,$FROM,$TARGET," "$from" >"$target" || status=$? # Check whether header files must be updated. if test $first = no; then if test -f "$realtarget" && cmp -s "$realtarget" "$target"; then echo "$2" is unchanged rm -f "$target" else echo updating "$2" mv -f "$target" "$realtarget" fi fi else # A missing file is only an error for the first file. This # is a blatant hack to let us support using "yacc -d". If -d # is not specified, we don't want an error when the header # file is "missing". if test $first = yes; then status=1 fi fi shift shift first=no done else status=$? fi # Remove the directory. cd .. rm -rf $dirname exit $status # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: filtergen-0.12.4/filtergen.c0000644000175000017500000001452510061464477012641 00000000000000/* packet filter compiler * * Copyright (c) 2002 Matthew Kirkwood * Copyright (c) 2003,2004 Jamie Wilkinson * * 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. * * 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, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #ifdef HAVE_GETOPT_H #include #endif #include "filter.h" #include "ast.h" #include "resolver.h" int yyparse(void *); void yyrestart(FILE *); extern struct filter * convert(struct ast_s * n); static FILE *outfile; void usage(char * prog) { fprintf(stderr, "Usage: %s [-chV] [-t backend] [-o output] input\n", prog); fprintf(stderr, " %s [-chV] [-t backend] [-o output] -F policy\n\n", prog); fprintf(stderr, "Options:\n"); #ifdef HAVE_GETOPT_H fprintf(stderr, " --compile/-c compile only, no generate\n"); #else fprintf(stderr, " -c compile only, no generate\n"); #endif #ifdef HAVE_GETOPT_H fprintf(stderr, " --target/-t target generate for target (default: iptables)\n"); #else fprintf(stderr, " -t target generate for target (default: iptables)\n"); #endif #ifdef HAVE_GETOPT_H fprintf(stderr, " --flush/-F policy don't process input, generate flush rules\n"); #else fprintf(stderr, " -F policy don't process input, generate flush rules\n"); #endif #ifdef HAVE_GETOPT_H fprintf(stderr, " --output/-o filename write the generated packet filter to filename\n"); #else fprintf(stderr, " -o filename write the generated packet filter to filename\n"); #endif #ifdef HAVE_GETOPT_H fprintf(stderr, " --help/-h show this help\n"); #else fprintf(stderr, " -h show this help\n"); #endif #ifdef HAVE_GETOPT_H fprintf(stderr, " --version/-V show program version\n"); #else fprintf(stderr, " -V show program version\n"); #endif } int oputs(const char *s) { int r = 0; if(s) { r = fputs(s, outfile); if(r > 0) { fputc('\n', outfile); r++; } } return r; } int oprintf(const char *fmt, ...) { va_list args; va_start(args, fmt); return vfprintf(outfile, fmt, args); } struct filtyp { const char * name; filtergen * compiler; filter_flush * flusher; } filter_types[] = { { "iptables", fg_iptables, flush_iptables, }, { "ipchains", fg_ipchains, flush_ipchains, }, { "ipfilter", fg_ipfilter, NULL }, { "cisco", fg_cisco, NULL }, { NULL, NULL, NULL }, }; #ifdef HAVE_GETOPT_H static struct option long_options[] = { {"help", no_argument, 0, 'h'}, {"compile", no_argument, 0, 'c'}, {"target", required_argument, 0, 't'}, {"output", required_argument, 0, 'o'}, {"flush", required_argument, 0, 'F'}, {"version", no_argument, 0, 'V'}, {0, 0, 0, 0} }; # define GETOPT(x, y, z) getopt_long(x, y, z, long_options, NULL) #else # define GETOPT(x, y, z) getopt(x, y, z) #endif int main(int argc, char **argv) { struct filter *f; int l; time_t t; char buf[100]; char *filename = NULL, *ftn = NULL, *ofn = NULL; struct filtyp *ft = NULL; int flags = 0; char *progname; int arg; enum filtertype flushpol = T_ACCEPT; progname = argv[0]; while ((arg = GETOPT(argc, argv, "hco:t:F:V")) > 0) { switch (arg) { case ':': usage(progname); exit(1); break; case 'h': usage(progname); exit(0); break; case 'c': flags |= FF_NOSKEL; break; case 'o': ofn = strdup(optarg); break; case 't': ftn = strdup(optarg); break; case 'F': flags |= FF_FLUSH; if (!strcasecmp(optarg, "accept")) { flushpol = T_ACCEPT; } else if (!strcasecmp(optarg, "drop")) { flushpol = DROP; } else if (!strcasecmp(optarg, "reject")) { flushpol = T_REJECT; } else { fprintf(stderr, "%s: flush policy unrecofgnised: %s\n", progname, optarg); usage(progname); exit(1); } break; case 'V': printf(PACKAGE " " VERSION "\n"); exit(0); break; default: break; } } if (!(flags & FF_FLUSH)) { if (optind >= argc) { usage(progname); exit(1); } else filename = argv[optind++]; } if (ofn) { /* XXX - open a different tempfile, and rename on success */ outfile = fopen(ofn, "w"); if(!outfile) { fprintf(stderr, "%s: can't open output file \"%s\"\n", progname, ofn); return 1; } } else outfile = stdout; if(!ftn || !*ftn) ftn = strdup("iptables"); for (ft = filter_types; ft->name; ft++) if (!strcmp(ftn, ft->name)) break; if (!ft->name) { fprintf(stderr, "%s: target filter unrecognised: %s\n", progname, ftn); usage(progname); exit(1); } /* What to do, then? */ if(flags & FF_FLUSH) { /* Just flush it */ l = ft->flusher(flushpol); } else { /* Compile from a file */ if(filename && !strcmp(filename, "-")) filename = NULL; if(filter_fopen(filename)) return 1; { struct ast_s ast; if (yyparse((void *) &ast) == 0) { resolve(&ast); f = convert(&ast); if (!f) { fprintf(stderr, "couldn't convert file\n"); return 1; } } else { fprintf(stderr, "couldn't parse file\n"); return 1; } } strftime(buf, sizeof(buf)-1, "%a %b %e %H:%M:%S %Z %Y", localtime((time(&t),&t))); oprintf("# filter generated from %s via %s backend at %s\n", filename ?: "standard input", ft->name, buf); l = ft->compiler(f, flags); } if(ofn) fclose(outfile); if(l < 0) { fprintf(stderr, "an error occurred: most likely the filters defined make no sense\n"); if(ofn) unlink(ofn); return 1; } fprintf(stderr, "generated %d rules\n", l); return 0; } filtergen-0.12.4/gen.c0000644000175000017500000001174010051306766011422 00000000000000/* filter compilation routines * * Copyright (c) 2002 Matthew Kirkwood * Copyright (c) 2003,2004 Jamie Wilkinson * * 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. * * 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, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include "filter.h" void applydefaults(struct filterent *e, long flags) { if(!e->rtype) { if(flags & FF_LOCAL) e->rtype = LOCALONLY; else if(flags & FF_ROUTE) e->rtype = ROUTEDONLY; } } int checkmatch(const struct filterent *e) { int r = 0; #define MUST(t) \ do if(!(e->t)) { \ fprintf(stderr, "%s missing from filter\n", #t); \ r++; \ } while(0) if(!e->subgroup) MUST(target); if(!e->groupname) { MUST(direction); MUST(iface); } #undef MUST if((e->u.ports.src.minstr || e->u.ports.dst.minstr) && (e->proto.num != IPPROTO_TCP) && (e->proto.num != IPPROTO_UDP)) { fprintf(stderr, "can only use ports with tcp or udp\n"); r++; } if(e->u.icmp && (e->proto.num != IPPROTO_ICMP)) { fprintf(stderr, "icmptype can only be used with icmp\n"); r++; } if((e->rtype == LOCALONLY) && (e->target == MASQ)) { fprintf(stderr, "\"local\" and masquerading are incompatible\n"); r++; } return r; } int __fg_apply(struct filterent *e, const struct filter *f, fg_callback *cb, struct fg_misc *misc); int __fg_applylist(struct filterent *e, const struct filter *f, fg_callback *cb, struct fg_misc *misc) { /* This is the interesting one. The filters are * unrolled by now, so there's only one way to * follow it */ int c = 0; for(; f; f = f->next) { int _c = __fg_apply(e, f, cb, misc); if (_c < 0) return _c; c += _c; } return c; } int __fg_applyone(struct filterent *e, const struct filter *f, fg_callback *cb, struct fg_misc *misc) { #define _NA(t,f) \ if(f) { \ fprintf(stderr, "filter has already defined a %s\n", t); \ return -1; \ } #define NA(t) _NA(#t,e->t) #define NC(type, str) case F_ ## type: _NA(str, ESET(e, type)); e->whats_set |= (1 << F_ ## type); switch(f->type) { NC(TARGET, "target") e->target = f->u.target; break; NC(SUBGROUP, "subgroup") { struct filterent fe; int r; if(e->subgroup) { fprintf(stderr, "cannot compose subgroups\n"); return -1; } if(!cb->group) { fprintf(stderr, "backend doesn't support grouping, but hasn't removed groups\n"); abort(); } e->target = f->type; e->subgroup = f->u.sub.name; memset(&fe, 0, sizeof(fe)); fe.groupname = f->u.sub.name; /* direction is special -- we need to save it */ fe.direction = e->direction; cb->group(fe.groupname); if((r = __fg_applylist(&fe, f->u.sub.list, cb, misc)) < 0) return r; break; } NC(DIRECTION, "direction and interface") NA(iface); e->direction = f->u.ifinfo.direction; e->iface = f->u.ifinfo.iface; break; case F_LOG: e->whats_set |= (1 << F_LOG); e->logmsg = f->u.logmsg; break; #define _DV(tag, str, test, targ, source) \ case F_ ## tag: _NA(str, e->test); e->targ = f->u.source; break #define DV(tag, targ, source) _DV(tag, #targ, targ, targ, source) _DV(PROTO, "protocol", proto.name, proto, proto); _DV(SOURCE, "source address", srcaddr.addrstr, srcaddr, addrs); _DV(DEST, "destination address", dstaddr.addrstr, dstaddr, addrs); _DV(SPORT, "source port", u.ports.src.minstr, u.ports.src, ports); _DV(DPORT, "destination port", u.ports.src.maxstr, u.ports.dst, ports); DV(ICMPTYPE, u.icmp, icmp); DV(RTYPE, rtype, rtype); case F_ONEWAY: e->oneway = 1; break; case F_SIBLIST: return __fg_applylist(e, f->u.sib, cb, misc); default: abort(); } if(f->negate) e->whats_negated |= (1 << f->type); return 0; } int __fg_apply(struct filterent *_e, const struct filter *f, fg_callback *cb, struct fg_misc *misc) { struct filterent e = *_e; /* Looks like we're all done */ if(!f) { applydefaults(&e, misc->flags); if (checkmatch(&e)) { fprintf(stderr, "filter definition incomplete\n"); return -1; } return cb->rule(&e, misc); } return __fg_applyone(&e, f, cb, misc) ?: __fg_apply(&e, f->child, cb, misc); } int filtergen_cprod(struct filter *filter, fg_callback *cb, struct fg_misc *misc) { struct filterent e; memset(&e, 0, sizeof(e)); return __fg_applylist(&e, filter, cb, misc); } filtergen-0.12.4/filter.c0000644000175000017500000002234310061603507012131 00000000000000/* data structure building routines * * Copyright (c) 2002,2003 Matthew Kirkwood * * 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. * * 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, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "filter.h" #include #include #include #include #include static struct filter *__new_filter(enum filtertype type) { struct filter *f; if ((f = calloc(1, sizeof(*f)))) { f->type = type; } return f; } struct filter *new_filter_oneway(void) { return __new_filter(F_ONEWAY); } struct filter *new_filter_target(enum filtertype target) { struct filter *f; if ((f = __new_filter(F_TARGET))) { f->u.target = target; } return f; } struct filter *new_filter_log(enum filtertype type, const char *text) { struct filter *f; if ((f = __new_filter(type))) { f->u.logmsg = text ? strdup(text) : NULL; } return f; } struct filter *new_filter_rtype(enum filtertype rtype) { struct filter *f; if ((f = __new_filter(F_RTYPE))) { f->u.rtype = rtype; } return f; } struct filter *new_filter_neg(struct filter *sub) { struct filter *f; if ((f = __new_filter(F_NEG))) { f->u.neg = sub; } return f; } struct filter *new_filter_sibs(struct filter *list) { struct filter *f; if ((f = __new_filter(F_SIBLIST))) { f->u.sib = list; } return f; } struct filter *new_filter_subgroup(char *name, struct filter *list) { struct filter *f; if ((f = __new_filter(F_SUBGROUP))) { f->u.sub.name = name; f->u.sub.list = list; } return f; } struct filter *new_filter_proto(enum filtertype type, const char *name) { struct filter *f; struct protoent *e; int pn; if(!str_to_int(name, &pn)) e = getprotobynumber(pn); else e = getprotobyname(name); if(!e) { fprintf(stderr, "don't know protocol \"%s\"\n", name); return NULL; } if ((f = __new_filter(type))) { f->u.proto.num = e->p_proto; f->u.proto.name = strdup(e->p_name); } return f; } struct filter *new_filter_device(enum filtertype type, const char *iface) { struct filter *f; if ((f = __new_filter(F_DIRECTION))) { f->u.ifinfo.direction = type; f->u.ifinfo.iface = strdup(iface); } return f; } struct filter *new_filter_host(enum filtertype type, const char *matchstr) { struct filter *f; char *mask; int i; if (!(f = __new_filter(type))) return f; f->u.addrs.addrstr = strdup(matchstr); if((mask = strchr(f->u.addrs.addrstr, '/'))) { *mask++ = 0; if(!str_to_int(mask, &i)) { /* Netmask like foo/24 */ uint32_t l = 0xffffffff; if(i < 0 || i > 32) { fprintf(stderr, "can't parse netmask \"%s\"\n", mask); return NULL; } if(!i) l = 0; else { i = 32 - i; l >>= i; l <<= i; } f->u.addrs.mask.s_addr = htonl(l); } else { /* Better be a /255.255.255.0 mask */ if(!inet_aton(mask, &f->u.addrs.mask)) { fprintf(stderr, "can't parse netmask \"%s\"\n", mask); return NULL; } } f->u.addrs.maskstr = strdup(inet_ntoa(f->u.addrs.mask)); } return f; } struct filter *new_filter_ports(enum filtertype type, const char *matchstr) { struct filter *f; struct servent *s; char *min, *max; int imin, imax; min = strdup(matchstr); if((max = strchr(min, ':'))) { *max++ = 0; max = strdup(max); } if(str_to_int(min, &imin)) { if(!(s = getservbyname(min, NULL))) imin = -1; else { free(min); min = strdup(s->s_name); imin = ntohs(s->s_port); } } if(max) { if(str_to_int(max, &imax)) { if(!(s = getservbyname(max, NULL))) imax = -1; else { free(max); max = strdup(s->s_name); imax = ntohs(s->s_port); } } } else imax = imin; if ((f = __new_filter(type))) { f->u.ports.min = imin; f->u.ports.max = imax; f->u.ports.minstr = min; f->u.ports.maxstr = max; } return f; } struct filter *new_filter_icmp(enum filtertype type, const char *matchstr) { struct filter *f; if ((f = __new_filter(type))) { f->u.icmp = strdup(matchstr); } return f; } /* * These functions DAGify the parsed filter structure. * This means that we can walk all paths down the DAG * merely by following ->child and ->next. */ static void filter_append(struct filter *f, struct filter *x) { if(!f) abort(); if(!x) return; /* We have to be paranoid about making loops here */ while((f->type != F_SIBLIST) && f->child) { if(f == x) return; f = f->child; } if(f == x) return; if(f->type == F_SIBLIST) { if(f->child) abort(); for(f=f->u.sib;f;f=f->next) filter_append(f,x); } else f->child = x; } /* * The easy bit of a cross-product. Basically we ensure that no * filter node has more than one path out. * 1. We push sibling->child down to the end of the component * sub-lists, and * 2. Ensure that negated entries have only a single component * hanging off them. */ void __filter_unroll(struct filter *f) { struct filter *c, *s; if(!f) return; /* depth first */ __filter_unroll(c = f->child); /* check this node */ switch(f->type) { case F_SIBLIST: for(s = f->u.sib; s; s = s->next) { __filter_unroll(s); filter_append(s, c); } f->child = NULL; break; case F_SUBGROUP: __filter_unroll(f->u.sub.list); break; case F_NEG: abort(); default: break; } /* lastly, go sideways */ __filter_unroll(f->next); } void __filter_neg_expand(struct filter **f, int neg) { if(!*f) return; __filter_neg_expand(&(*f)->child, neg); __filter_neg_expand(&(*f)->next, neg); switch((*f)->type) { case F_SIBLIST: if(neg && (*f)->u.sib && (*f)->u.sib->next) { fprintf(stderr, "error: can't negate conjunctions\n"); exit(1); } __filter_neg_expand(&(*f)->u.sib, neg); break; case F_SUBGROUP: if(neg) { fprintf(stderr, "error: can't negate subgroups\n"); exit(1); } __filter_neg_expand(&(*f)->u.sub.list, neg); break; case F_NEG: { struct filter *c = (*f)->child, *n = (*f)->next; *f = (*f)->u.neg; neg = !neg; __filter_neg_expand(f, neg); if(c) filter_append(*f, c); (*f)->next = n; break; } default: break; } (*f)->negate = neg; } /* Move targets to end of each list */ void __filter_targets_to_end(struct filter **f) { if(!*f) return; if(((*f)->type == F_TARGET) && (*f)->child) { struct filter *c = (*f)->child; /* Unlink this one */ (*f)->child = NULL; /* Append ourselves */ filter_append(c, (*f)); /* Tell them upstairs */ *f = c; } else { __filter_targets_to_end(&(*f)->child); __filter_targets_to_end(&(*f)->next); } } void filter_unroll(struct filter **f) { __filter_neg_expand(f, 0); __filter_targets_to_end(f); __filter_unroll(*f); } void filter_nogroup(struct filter *f) { if(!f) return; switch(f->type) { case F_SUBGROUP: f->u.sib = f->u.sub.list; f->type = F_SIBLIST; /* fall through */ case F_SIBLIST: filter_nogroup(f->u.sib); break; default:; } filter_nogroup(f->child); filter_nogroup(f->next); } /* Remove negations by reordering tree: * NEG(ent)->child,next * becomes * ent->next,child,next */ void filter_noneg(struct filter **f) { if (f) {}; return; } /* * Apply flags to the tree */ void filter_apply_flags(struct filter *f, long flags) { struct filter *s; if(!f) return; switch(f->type) { /* Structural things */ case F_SIBLIST: for(s = f->u.sib; s; s = s->next) filter_apply_flags(s, flags); break; case F_SUBGROUP: filter_apply_flags(f->u.sub.list, flags); break; case F_NEG: filter_apply_flags(f->u.neg, flags); break; /* Real things */ case F_SPORT: case F_DPORT: if(flags & FF_LOOKUP) { struct port_spec *p = &f->u.ports; if(p->min == -1) { fprintf(stderr, "warning: couldn't lookup service \"%s\"\n", p->minstr); break; } free(p->minstr); p->minstr = int_to_str_dup(p->min); if(p->maxstr) { if(p->max == -1) { fprintf(stderr, "warning: couldn't lookup service \"%s\"\n", p->minstr); break; } free(p->maxstr); p->maxstr = int_to_str_dup(p->max); } } break; case F_SOURCE: case F_DEST: if(flags & FF_LOOKUP) { struct addr_spec *a = &f->u.addrs; struct hostent *h; if(!(inet_aton(a->addrstr, &f->u.addrs.addr))) { /* Not already in IP format */ if(!(h = gethostbyname(a->addrstr))) { fprintf(stderr, "warning: can't lookup name \"%s\"\n", a->addrstr); } else { free(a->addrstr); a->addrstr = strdup(h->h_addr_list[0]); } } } break; default: break; } filter_apply_flags(f->child, flags); filter_apply_flags(f->next, flags); } filtergen-0.12.4/fg-util.c0000644000175000017500000000250110051306771012207 00000000000000/* utility functions for filter generation * * Copyright (c) 2002 Matthew Kirkwood * * 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. * * 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, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include char *strapp(char *s, const char *n) { size_t l; if(!n) return s; if(!s) return strdup(n); l = strlen(s) + strlen(n) + 1; s = realloc(s, l); return strcat(s, n); } int str_to_int(const char *s, int *i) { long m; char *e; m = strtol(s, &e, 10); if(*e) return -1; *i = m; return 0; } char *int_to_str_dup(int i) { char buf[100]; snprintf(buf, sizeof(buf)-1, "%d", i); buf[sizeof(buf)-1] = 0; return strdup(buf); } filtergen-0.12.4/fg-iptables.c0000644000175000017500000002660710051306773013054 00000000000000/* filter generator, iptables driver * * Copyright (c) 2002 Matthew Kirkwood * * 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. * * 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, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* * Description of generated filter * * 1. Policy: * + "filter" chains DROP. * + "nat" chains ACCEPT. * 2. State: * + Non-TCP/UDP rules don't include state. * + Allow rules include state. * + Deny rules don't. * 3. NAT is done in PRE- and POSTROUTING, as required. * However, we also must add rules to INPUT (for * transproxy) and OUTPUT (for masquerading). * 4. Reject rules need to go into FORWARD as well as * INPUT or OUTPUT. * 5. INPUT rules also get added to FORWARD. * 6. If LOCALONLY is set, no FORWARD rules are output. * * The above means that each rulechain can generate up to * three rules -- nat, in and out. */ #include #include #include #include "filter.h" #include "util.h" /* bitfields for features used */ #define REJECT 0x01 #define A_TCP 0x10 #define A_UDP 0x20 /* full path to iptables executable */ #define IPTABLES "/sbin/iptables" static char *appip(char *r, const struct addr_spec *h) { APPS(r, h->addrstr); if(h->maskstr) APP2(r, "/", h->maskstr); return r; } #define APPIP(r, h) (r = appip(r, h)) #define APPIP2(f, r, h) (APPS(r, f), APPIP(r, h)) static char *appport(char *r, const struct port_spec *h) { APPS(r, h->minstr); if(h->maxstr) APP2(r, ":", h->maxstr); return r; } #define APPPORT(r, h) (r = appport(r, h)) #define APPPORT2(f, r, h) (APPS(r, f), APPPORT(r, h)) static int cb_iptables_rule(const struct filterent *ent, struct fg_misc *misc) { char *rulechain = NULL, *revchain = NULL, *natchain = NULL; char *ruletarget = NULL, *revtarget = NULL, *nattarget = NULL; char *natrule = NULL, *rule = NULL, *rule_r = NULL; char *forchain = NULL, *forrevchain = NULL; char *fortarget = NULL, *forrevtarget = NULL; char *subchain = NULL, *subtarget = NULL; int neednat = 0, needret = 0; int islocal = (ent->rtype != ROUTEDONLY); int isforward = (ent->rtype != LOCALONLY); long *feat = (long*)misc->misc; enum filtertype target = ent->target; int orules = 0; /* nat rule? */ if((target == MASQ) || (target == REDIRECT)) { neednat = 1; if((target == MASQ) && (ent->direction == INPUT)) { fprintf(stderr, "can't masquerade on input\n"); return -1; } else if((target == REDIRECT) && (ent->direction == OUTPUT)) { fprintf(stderr, "can't redirect on output\n"); return -1; } } /* sub-stuff? */ if(target == F_SUBGROUP) { subtarget = strapp(strdup(ent->subgroup), "-"); needret = 1; } else subtarget = strdup(""); if(ent->groupname) subchain = strapp(strdup(ent->groupname), "-"); else subchain = strdup(""); switch(ent->direction) { case INPUT: natchain = strdup("PREROUTING"); rulechain = strdup("INPUT"); revchain = strdup("OUTPUT"); forchain = strdup("FORWARD"); forrevchain = strdup("FORW_OUT"); if(ent->iface) { if(NEG(DIRECTION)) { APPS(natrule, "!"); APPS(rule, "!"); APPS(rule_r, "!"); } APPSS2(natrule, "-i", ent->iface); APPSS2(rule, "-i", ent->iface); APPSS2(rule_r, "-o", ent->iface); } break; case OUTPUT: natchain = strdup("POSTROUTING"); rulechain = strdup("OUTPUT"); revchain = strdup("INPUT"); forchain = strdup("FORW_OUT"); forrevchain = strdup("FORWARD"); if(ent->iface) { if(NEG(DIRECTION)) { APPS(natrule, "!"); APPS(rule, "!"); APPS(rule_r, "!"); } APPSS2(natrule, "-o", ent->iface); APPSS2(rule, "-o", ent->iface); APPSS2(rule_r, "-i", ent->iface); } break; default: fprintf(stderr, "unknown direction\n"); abort(); } /* state and reverse rules here */ /* FIXME: state established on reverse for every rule, not just * specifically udp and tcp */ if(ent->proto.name) { int needstate = 0; APPSS2(natrule, "-p", ent->proto.name); APPSS2(rule, "-p", ent->proto.name); APPSS2(rule_r, "-p", ent->proto.name); switch(ent->proto.num) { case IPPROTO_TCP: needret++; needstate++; *feat |= A_TCP; APPS(rule_r, "! --syn"); break; case IPPROTO_UDP: needret++; needstate++; *feat |= A_UDP; break; } if(needstate) { APPS(rule, "-m state --state NEW,ESTABLISHED"); APPS(rule_r, "-m state --state ESTABLISHED"); } } if(ent->srcaddr.addrstr) { NEGA(natrule, SOURCE); NEGA(rule, SOURCE); NEGA(rule_r, SOURCE); APPIP2("-s", natrule, &ent->srcaddr); APPIP2("-s", rule, &ent->srcaddr); APPIP2("-d", rule_r, &ent->srcaddr); } if(ent->dstaddr.addrstr) { NEGA(natrule, DEST); NEGA(rule, DEST); NEGA(rule_r, DEST); APPIP2("-d", natrule, &ent->dstaddr); APPIP2("-d", rule, &ent->dstaddr); APPIP2("-s", rule_r, &ent->dstaddr); } switch(ent->proto.num) { case 0: break; case IPPROTO_UDP: case IPPROTO_TCP: if(ent->u.ports.src.minstr) { NEGA(natrule, SPORT); NEGA(rule, SPORT); NEGA(rule_r, SPORT); APPPORT2("--sport", natrule, &ent->u.ports.src); APPPORT2("--sport", rule, &ent->u.ports.src); APPPORT2("--dport", rule_r, &ent->u.ports.src); } if(ent->u.ports.dst.minstr) { NEGA(natrule, DPORT); NEGA(rule, DPORT); NEGA(rule_r, DPORT); APPPORT2("--dport", natrule, &ent->u.ports.dst); APPPORT2("--dport", rule, &ent->u.ports.dst); APPPORT2("--sport", rule_r, &ent->u.ports.dst); } break; case IPPROTO_ICMP: if(ent->u.icmp) { NEGA(natrule, ICMPTYPE); APPSS2(natrule, "--icmp-type", ent->u.icmp); NEGA(rule, ICMPTYPE); APPSS2(rule, "--icmp-type", ent->u.icmp); } break; default:; } APPS(natrule, "-j"); APPS(rule, "-j"); APPS(rule_r, "-j"); /* The "rule+1" in the printfs below are an ugly hack to * prevent a double-space in the output rule */ /* Yuck, separate rules for logging packets. Be still my * beating lunch. * * Logging and target rules have to be the last bits * before output, or this doesn't work. This will also * fail if any mangling has been done above. */ if(ESET(ent, LOG)) { char *lc, *la, *ls; if(ent->logmsg) { lc = strdup(" --log-prefix="); la = ent->logmsg; ls = strdup("\" \""); } else lc = la = ls = strdup(""); if(islocal) orules++,oprintf(IPTABLES" -A %s %s LOG%s%s%s\n", rulechain, rule+1, lc, la, ls); if(isforward) orules++,oprintf(IPTABLES" -A %s %s LOG%s%s%s\n", forchain, rule+1, lc, la, ls); } /* Do this twice, once for NAT, once for filter */ if(neednat) { switch(target) { case MASQ: nattarget = strdup("MASQUERADE"); break; case REDIRECT: nattarget = strdup("REDIRECT"); break; default: abort(); } } switch(target) { case MASQ: case REDIRECT: case T_ACCEPT: ruletarget = revtarget = fortarget = forrevtarget = strdup("ACCEPT"); switch(ent->direction) { case INPUT: fortarget = strdup("FORW_OUT"); break; case OUTPUT: forrevtarget = strdup("FORW_OUT"); break; default: abort(); } break; case DROP: ruletarget = fortarget = strdup("DROP"); needret = 0; break; case T_REJECT: ruletarget = fortarget = strdup("REJECT"); needret = 0; *feat |= T_REJECT; break; case F_SUBGROUP: switch(ent->direction) { case INPUT: ruletarget = strdup("INPUT"); revtarget = strdup("OUTPUT"); fortarget = strdup("FORWARD"); forrevtarget = strdup("FORW_OUT"); break; case OUTPUT: ruletarget = strdup("OUTPUT"); revtarget = strdup("INPUT"); fortarget = strdup("FORW_OUT"); forrevtarget = strdup("FORWARD"); break; default: abort(); } break; default: abort(); } if((misc->flags & FF_LSTATE) && (target != T_REJECT)) needret = 0; if(ent->oneway) needret = 0; if(neednat) orules++,oprintf(IPTABLES" -t nat -A %s%s %s %s%s\n", subchain, natchain, natrule+1, subtarget, nattarget); if(islocal) orules++,oprintf(IPTABLES" -A %s%s %s %s%s\n", subchain, rulechain, rule+1, subtarget, ruletarget); if(needret) orules++,oprintf(IPTABLES" -I %s%s %s %s%s\n", subchain, revchain, rule_r+1, subtarget, revtarget); if(isforward) { orules++,oprintf(IPTABLES" -A %s%s %s %s%s\n", subchain, forchain, rule+1, subtarget, fortarget); if(needret) orules++,oprintf(IPTABLES" -I %s%s %s %s%s\n", subchain, forrevchain, rule_r+1, subtarget, forrevtarget); } free(natrule); free(rule); free(rule_r); free(subchain); free(subtarget); return orules; } static int cb_iptables_group(const char *name) { oprintf("for f in INPUT OUTPUT FORWARD FORW_OUT; do "IPTABLES" -N %s-$f; done\n", name); return 4; } int fg_iptables(struct filter *filter, int flags) { long feat = 0; int r; struct fg_misc misc = { flags, &feat }; fg_callback cb_iptables = { rule: cb_iptables_rule, group: cb_iptables_group, }; const int nchains = 3; filter_unroll(&filter); filter_apply_flags(filter, flags); if(!(flags & FF_NOSKEL)) { oputs("CHAINS=\"INPUT OUTPUT FORWARD\""); oputs(""); oputs("# Flush/remove rules, set policy"); oputs("for f in $CHAINS; do "IPTABLES" -P $f DROP; done"); oputs(IPTABLES" -F; "IPTABLES" -X"); oputs(IPTABLES" -t nat -F; "IPTABLES" -t nat -X"); oputs(""); oputs("# Create FORW_OUT chain"); oputs(IPTABLES" -N FORW_OUT"); oputs(""); oputs("# Setup INVALID chain"); oputs(IPTABLES" -N INVALID"); #if 0 oputs(IPTABLES" -A INVALID -j LOG --log-prefix \"invalid \""); #endif oputs(IPTABLES" -A INVALID -j DROP"); oputs("for f in $CHAINS; do\n" "\t"IPTABLES" -I $f -m state --state INVALID -j INVALID;\n" "done"); oputs(""); r += nchains; } if((r = filtergen_cprod(filter, &cb_iptables, &misc)) < 0) return r; if(!(flags & FF_NOSKEL)) { if((flags & FF_LSTATE) && (feat & (A_TCP|A_UDP))) { oputs("for f in $CHAINS; do"); if(feat & A_TCP) { r += nchains; oputs("\t"IPTABLES" -I $f -p tcp ! --syn -m state --state ESTABLISHED -j ACCEPT;"); } if(feat & A_UDP) { r += nchains; oputs("\t"IPTABLES" -I $f -p udp -m state --state ESTABLISHED -j ACCEPT;"); } oputs("done"); } #if 0 oputs("for f in $CHAINS; do "IPTABLES" -A $f -j LOG; done"); r += nchains; #endif } return r; } /* Rules which just flush the packet filter */ int flush_iptables(enum filtertype policy) { char * ostr; oputs("CHAINS=\"INPUT OUTPUT FORWARD\""); oputs(""); switch (policy) { case T_ACCEPT: ostr = strdup("ACCEPT"); break; case DROP: ostr = strdup("DROP"); break; case T_REJECT: ostr = strdup("REJECT"); break; default: fprintf(stderr, "invalid filtertype %d\n", policy); abort(); } oprintf("for f in $CHAINS; do "IPTABLES" -P $f %s; done\n", ostr); oputs(IPTABLES" -F; "IPTABLES" -X"); oputs(IPTABLES" -t nat -F; "IPTABLES" -t nat -X"); return 0; } filtergen-0.12.4/fg-ipchains.c0000644000175000017500000001716710051306771013046 00000000000000/* filter generator, ipchains driver * * Copyright (c) 2002 Matthew Kirkwood * * 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. * * 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, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* * XXX - maybe some of this could be shared with the iptables one? */ #include #include #include #include "filter.h" #include "util.h" /* full path to ipchains executable */ #define IPCHAINS "/sbin/ipchains" static char *appip(char *r, const struct addr_spec *h) { APPS(r, h->addrstr); if(h->maskstr) APP2(r, "/", h->maskstr); return r; } #define APPIP(r, h) (r = appip(r, h)) #define APPIP2(f, r, h) (APPS(r, f), APPIP(r, h)) static char *appport(char *r, const struct port_spec *h) { APPS(r, h->minstr); if(h->maxstr) APP2(r, ":", h->maxstr); return r; } #define APPPORT(r, h) (r = appport(r, h)) #define APPPORT2(f, r, h) (APPS(r, f), APPPORT(r, h)) static int cb_ipchains_rule(const struct filterent *ent, struct fg_misc *misc __attribute__((unused))) { char *rule = NULL, *rule_r = NULL; char *rulechain = NULL, *revchain = NULL; char *ruletarget = NULL, *revtarget = NULL; char *forchain = NULL, *forrevchain = NULL; char *fortarget = NULL, *forrevtarget = NULL; char *subchain = NULL, *subtarget = NULL; int needret = 0; int isforward = (ent->rtype != LOCALONLY); int orules = 0; /* nat rule */ if((ent->target == MASQ) || (ent->target == REDIRECT)) { if((ent->target == MASQ) && (ent->direction == INPUT)) { fprintf(stderr, "can't masquerade on input\n"); return -1; } else if((ent->target == REDIRECT) && (ent->direction == OUTPUT)) { fprintf(stderr, "can't redirect on output\n"); return -1; } } /* sub-stuff? */ if(ent->target == F_SUBGROUP) { subtarget = strapp(strdup(ent->subgroup), "-"); needret = 1; } else subtarget = strdup(""); if(ent->groupname) subchain = strapp(strdup(ent->groupname), "-"); else subchain = strdup(""); if(ent->rtype == ROUTEDONLY) { fprintf(stderr, "ipchains can't do forward-only rules\n"); return -1; } switch(ent->direction) { case INPUT: rulechain = strdup("input"); revchain = strdup("output"); forchain = strdup("forward"); forrevchain = strdup("forw_out"); break; case OUTPUT: rulechain = (ent->target == MASQ) ? strdup("forw_out") : strdup("output") ; revchain = strdup("input"); forchain = strdup("forw_out"); forrevchain = strdup("forward"); break; default: fprintf(stderr, "unknown direction\n"); abort(); } if(ent->iface) { if(NEG(DIRECTION)) { APPS(rule, "!"); APPS(rule_r, "!"); } APPSS2(rule, "-i", ent->iface); APPSS2(rule_r, "-i", ent->iface); } /* state and reverse rules here */ if(ent->proto.name) { APPSS2(rule, "-p", ent->proto.name); APPSS2(rule_r, "-p", ent->proto.name); switch(ent->proto.num) { case IPPROTO_TCP: APPS(rule_r, "! --syn"); /* fall through */ case IPPROTO_UDP: needret++; } } if(ent->srcaddr.addrstr) { NEGA(rule, SOURCE); NEGA(rule_r, SOURCE); APPIP2("-s", rule, &ent->srcaddr); APPIP2("-d", rule_r, &ent->srcaddr); } if(ent->dstaddr.addrstr) { NEGA(rule, DEST); NEGA(rule_r, DEST); APPIP2("-d", rule, &ent->dstaddr); APPIP2("-s", rule_r, &ent->dstaddr); } switch(ent->proto.num) { case 0: break; case IPPROTO_UDP: case IPPROTO_TCP: if(ent->u.ports.src.minstr) { NEGA(rule, SPORT); NEGA(rule_r, SPORT); APPPORT2("--sport", rule, &ent->u.ports.src); APPPORT2("--dport", rule_r, &ent->u.ports.src); } if(ent->u.ports.dst.minstr) { NEGA(rule, DPORT); NEGA(rule_r, DPORT); APPPORT2("--dport", rule, &ent->u.ports.dst); APPPORT2("--sport", rule_r, &ent->u.ports.dst); } break; case IPPROTO_ICMP: if(ent->u.icmp) { NEGA(rule, ICMPTYPE); APPSS2(rule, "--icmp-type", ent->u.icmp); } break; default:; } if(ESET(ent,LOG)) APPS(rule, "-l"); APPS(rule, "-j"); APPS(rule_r, "-j"); switch(ent->target) { case T_ACCEPT: ruletarget = revtarget = fortarget = forrevtarget = strdup("ACCEPT"); switch(ent->direction) { case INPUT: fortarget = strdup("forw_out"); break; case OUTPUT: forrevtarget = strdup("forw_out"); break; default: abort(); } break; case DROP: ruletarget = fortarget = strdup("DENY"); needret = 0; break; case T_REJECT: ruletarget = fortarget = strdup("REJECT"); needret = 0; break; case MASQ: ruletarget = strdup("MASQ"); revtarget = strdup("ACCEPT"); break; case REDIRECT: ruletarget = strdup("REDIRECT"); revtarget = strdup("ACCEPT"); break; case F_SUBGROUP: switch(ent->direction) { case INPUT: ruletarget = strdup("input"); revtarget = strdup("output"); fortarget = strdup("forward"); forrevtarget = strdup("forw_out"); break; case OUTPUT: ruletarget = strdup("output"); revtarget = strdup("input"); fortarget = strdup("forw_out"); forrevtarget = strdup("forward"); break; default: abort(); } break; default: abort(); } if(ent->oneway) needret = 0; orules++, oprintf(IPCHAINS" -A %s%s %s %s%s\n", subchain, rulechain, rule+1, subtarget, ruletarget); if(needret) orules++, oprintf(IPCHAINS" -I %s%s %s %s%s\n", subchain, revchain, rule_r+1, subtarget, revtarget); if(isforward) { orules++, oprintf(IPCHAINS" -A %s%s %s %s%s\n", subchain, forchain, rule+1, subtarget, fortarget); if(needret) orules++, oprintf(IPCHAINS" -I %s%s %s %s%s\n", subchain, forrevchain, rule_r+1, subtarget, forrevtarget); } free(rule); free(rule_r); free(subchain); free(subtarget); return orules; } static int cb_ipchains_group(const char *name) { oprintf("for f in input output forward forw_out; do "IPCHAINS" -N %s-${f}; done\n", name); return 1; } int fg_ipchains(struct filter *filter, int flags) { int r; struct fg_misc misc = { flags, NULL }; fg_callback cb_ipchains = { rule: cb_ipchains_rule, group: cb_ipchains_group, }; filter_unroll(&filter); filter_apply_flags(filter, flags); if(!(flags & FF_NOSKEL)) { oputs("for f in INPUT OUTPUT FORWARD; do "IPCHAINS" -P $f DENY; done"); oputs(IPCHAINS" -F; "IPCHAINS" -X"); oputs(IPCHAINS" -N forw_out"); } if((r = filtergen_cprod(filter, &cb_ipchains, &misc)) < 0) return r; #if 0 if(!(flags & FF_NOSKEL)) { oputs("for f in INPUT OUTPUT FORWARD forw_out; do "IPCHAINS" -A $f -l -j DENY; done"); r += 3; } #endif return r; } /* Rules which just flush the packet filter */ int flush_ipchains(enum filtertype policy) { char *ostr; oputs("CHAINS=\"INPUT OUTPUT FORWARD\""); oputs(""); switch(policy) { case T_ACCEPT: ostr = strdup("ACCEPT"); break; case DROP: ostr = strdup("DENY"); break; case T_REJECT: ostr = strdup("REJECT"); break; default: fprintf(stderr, "invalid filtertype %d\n", policy); abort(); } oprintf("for f in $CHAINS; do "IPCHAINS" -P $f %s; done\n", ostr); oputs(IPCHAINS" -F; "IPCHAINS" -X"); return 0; } filtergen-0.12.4/fg-ipfilter.c0000644000175000017500000000666310061606125013062 00000000000000/* filter generator, ipfilter driver * * Copyright (c) 2002 Matthew Kirkwood * * 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. * * 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, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* TODO: * - does this need skeleton routines? * - implement grouping */ #include #include #include #include "filter.h" #include "util.h" static char *appip(char *r, const struct addr_spec *h) { if(!h->addrstr) return APPS(r, "any"); APPS(r, h->addrstr); if(h->maskstr) APP2(r, "/", h->maskstr); return r; } static char *appport(char *r, const struct port_spec *p, int neg) { if(!p->minstr) return r; APPS(r, "port"); if(!p->maxstr) return APPSS2(r, neg ? "!=" : "=", p->minstr); APPS(r, p->minstr); APPSS2(r, neg ? "><" : "<>", p->maxstr); return r; } static char *appicmp(char *r, const char *h, int neg) { if(!h) return r; if(neg) APPS(r, "!"); return APPSS2(r, "icmp-type", h); } static int cb_ipfilter_rule(const struct filterent *ent, struct fg_misc *misc __attribute__((unused))) { char *rule = NULL; /* target first */ switch(ent->target) { case T_ACCEPT: APP(rule, "pass"); break; case DROP: APP(rule, "block"); break; case T_REJECT: /* XXX - can this violate the rule about icmp errors * about icmp errors? */ if (ent->proto.num == IPPROTO_TCP) APP(rule, "block return-rst"); else APP(rule, "block return-icmp-as-dest(port-unr)"); break; default: abort(); } /* in or out? */ switch(ent->direction) { case INPUT: APPS(rule, "in"); break; case OUTPUT: APPS(rule, "out"); break; default: fprintf(stderr, "unknown direction\n"); abort(); } if(ESET(ent,LOG)) APPS(rule, "log"); /* XXX - All our rules have to be "quick", but ipfilter * people seem to prefer having defaults at the top. * It would be nice to improve the output readability. */ APPS(rule, "quick"); /* access list name */ if(ent->iface) APPSS2(rule, "on", ent->iface); /* protocol */ if(ent->proto.name) APPSS2(rule, "proto", ent->proto.name); APPS(rule, "from"); rule = appip(rule, &ent->srcaddr); rule = appport(rule, &ent->u.ports.src, NEG(SPORT)); APPS(rule, "to"); rule = appip(rule, &ent->dstaddr); rule = appport(rule, &ent->u.ports.dst, NEG(DPORT)); rule = appicmp(rule, ent->u.icmp, NEG(ICMPTYPE)); if(ent->proto.name && (ent->target == T_ACCEPT) && !ent->oneway) APPS(rule, "keep state"); oputs(rule); free(rule); return 1; } int fg_ipfilter(struct filter *filter, int flags) { struct fg_misc misc = { flags, NULL }; fg_callback cb_ipfilter = { rule: cb_ipfilter_rule, NULL }; filter_nogroup(filter); filter_unroll(&filter); filter_apply_flags(filter, flags); return filtergen_cprod(filter, &cb_ipfilter, &misc); } filtergen-0.12.4/fg-cisco.c0000644000175000017500000000722010061606153012333 00000000000000/* filter generator, Cisco IOS driver * * Copyright (c) 2002 Matthew Kirkwood * * 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. * * 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, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* XXX - does this need skeleton rules? */ #include #include #include #include "filter.h" #include "util.h" static char *appip(char *r, const struct addr_spec *h) { if(!h->addrstr) return APPS(r, "any"); if(!h->maskstr) return APPS2(r, "host ", h->addrstr); return APPSS2(r, h->addrstr, h->maskstr); } static char *appport(char *r, const struct port_spec *p, int neg) { if(!p->minstr) return APPS(r, "any"); if(!p->maxstr) return APPS2(r, neg ? "ne " : "eq ", p->minstr); if(neg) abort(); APPS(r, "range"); APPSS2(r, p->minstr, p->maxstr); return r; } static int cb_cisco_rule(const struct filterent *ent, struct fg_misc *misc __attribute__((unused))) { char *rule = NULL, *rule_r = NULL; int needret = 0, needports = 1; APP(rule, "access-list "); APP(rule_r, "access-list "); /* access list name */ if(ent->iface) { APP2(rule, ent->iface, "-"); APP2(rule_r, ent->iface, "-"); } switch(ent->direction) { case INPUT: APP(rule, "IN"); APP(rule_r, "OUT"); break; case OUTPUT: APP(rule, "OUT"); APP(rule_r, "IN"); break; default: fprintf(stderr, "unknown direction\n"); abort(); } /* target */ switch(ent->target) { case T_ACCEPT: APPS(rule, "permit"); APPS(rule_r, "permit"); break; case DROP: APPS(rule, "deny"); APPS(rule_r, "deny"); break; case T_REJECT: fprintf(stderr, "warning: Cisco IOS does not support REJECT\n"); APPS(rule, "deny"); APPS(rule_r, "deny"); break; default: abort(); } /* protocol */ if(ent->proto.name) { APPS(rule, ent->proto.name); APPS(rule_r, ent->proto.name); switch(ent->proto.num) { case IPPROTO_TCP: case IPPROTO_UDP: needret++; break; default: needports = 0; } } else { APPS(rule, "ip"); APPS(rule_r, "ip"); } rule = appip(rule, &ent->srcaddr); rule = appip(rule, &ent->dstaddr); rule_r = appip(rule_r, &ent->dstaddr); rule_r = appip(rule_r, &ent->srcaddr); if(needports) { rule = appport(rule, &ent->u.ports.src, NEG(SPORT)); rule = appport(rule, &ent->u.ports.dst, NEG(DPORT)); rule_r = appport(rule_r, &ent->u.ports.dst, NEG(DPORT)); rule_r = appport(rule_r, &ent->u.ports.src, NEG(SPORT)); } if(ent->proto.num == IPPROTO_TCP) APPS(rule_r, "established"); if(ESET(ent,LOG)) APPS(rule, "log"); if(ent->oneway) needret = 0; oputs(rule); if(needret) oputs(rule_r); free(rule); free(rule_r); return 1 + !!needret; } int fg_cisco(struct filter *filter, int flags) { struct fg_misc misc = { flags, NULL }; fg_callback cb_cisco = { rule: cb_cisco_rule, NULL }; oputs("# Warning: This backend is not complete and " "can generate broken rulesets."); filter_nogroup(filter); filter_unroll(&filter); filter_apply_flags(filter, flags); return filtergen_cprod(filter, &cb_cisco, &misc); } filtergen-0.12.4/parser.y0000644000175000017500000002776210051306770012201 00000000000000/* parser for filtergen * * Copyright (c) 2003 Jamie Wilkinson * * 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. * * 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, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ %{ #include #include #include #include "ast.h" #define YYPARSE_PARAM parm void yyerror(const char * s); extern int yylex(void); #define YYPRINT(f, t, v) yyprint(f, t, v) %} %debug %union { struct rule_list_s * u_rule_list; struct rule_s * u_rule; struct specifier_list_s * u_specifier_list; struct negated_specifier_s * u_negated_specifier; struct specifier_s * u_specifier; struct direction_specifier_s * u_direction_specifier; struct direction_argument_list_s * u_direction_argument_list; struct direction_argument_s * u_direction_argument; struct target_specifier_s * u_target_specifier; struct log_target_specifier_s * u_log_target_specifier; struct host_specifier_s * u_host_specifier; struct host_argument_list_s * u_host_argument_list; struct host_argument_s * u_host_argument; struct port_specifier_s * u_port_specifier; struct port_argument_list_s * u_port_argument_list; struct port_argument_s * u_port_argument; struct protocol_specifier_s * u_protocol_specifier; struct protocol_argument_list_s * u_protocol_argument_list; struct protocol_argument_s * u_protocol_argument; struct icmptype_specifier_s * u_icmptype_specifier; struct icmptype_argument_list_s * u_icmptype_argument_list; struct icmptype_argument_s * u_icmptype_argument; struct option_specifier_s * u_option_specifier; struct compound_specifier_s * u_compound_specifier; struct chaingroup_specifier_s * u_chaingroup_specifier; struct subrule_list_s * u_subrule_list; char * u_str; } %type rule_list %type rule %type specifier_list %type negated_specifier %type specifier %type direction_specifier %type direction_argument_list %type direction_argument_list_ %type direction_argument %type target_specifier %type host_specifier %type host_argument_list %type host_argument_list_ %type host_argument %type port_specifier %type port_argument_list %type port_argument_list_ %type port_argument %type protocol_specifier %type protocol_argument_list %type protocol_argument_list_ %type protocol_argument %type icmptype_specifier %type icmptype_argument_list %type icmptype_argument_list_ %type icmptype_argument %type option_specifier %type compound_specifier %type chaingroup_specifier %type subrule_list %defines %token TOK_ACCEPT %token TOK_DEST %token TOK_DPORT %token TOK_DROP %token TOK_FORWARD %token TOK_ICMPTYPE %token TOK_INPUT %token TOK_LCURLY %token TOK_LOCAL %token TOK_LOG %token TOK_LSQUARE %token TOK_MASQ %token TOK_ONEWAY %token TOK_OUTPUT %token TOK_PROTO %token TOK_PROXY %token TOK_RCURLY %token TOK_REDIRECT %token TOK_REJECT %token TOK_RSQUARE %token TOK_SEMICOLON %token TOK_SOURCE %token TOK_SPORT %token TOK_TEXT %token TOK_IDENTIFIER %token TOK_DOT %token TOK_SLASH %token TOK_ERR %token TOK_BANG %token TOK_COLON %{ int yyprint(FILE * f, int t, YYSTYPE v); %} %start ast %% ast: rule_list { /* we expect parm to be already allocated, and that * it is of type (struct ast_s *) */ ((struct ast_s *) parm)->list = $1; } rule_list: /* empty */ { $$ = NULL; } | rule_list rule { $$ = malloc(sizeof(struct rule_list_s)); $$->list = $1; $$->rule = $2; } ; rule: specifier_list TOK_SEMICOLON { $$ = malloc(sizeof(struct rule_s)); $$->list = $1; } ; specifier_list: /* empty */ { $$ = NULL; } | specifier_list negated_specifier { $$ = malloc(sizeof(struct specifier_list_s)); $$->list = $1; $$->spec = $2; } ; negated_specifier: specifier { $$ = malloc(sizeof(struct negated_specifier_s)); $$->negated = 0; $$->spec = $1; } | TOK_BANG specifier { $$ = malloc(sizeof(struct negated_specifier_s)); $$->negated = 1; $$->spec = $2; } ; specifier: compound_specifier { $$ = malloc(sizeof(struct specifier_s)); memset($$, 0, sizeof(struct specifier_s)); $$->compound = $1; } | direction_specifier { $$ = malloc(sizeof(struct specifier_s)); memset($$, 0, sizeof(struct specifier_s)); $$->direction = $1; } | target_specifier { $$ = malloc(sizeof(struct specifier_s)); memset($$, 0, sizeof(struct specifier_s)); $$->target = $1; } | host_specifier { $$ = malloc(sizeof(struct specifier_s)); memset($$, 0, sizeof(struct specifier_s)); $$->host = $1; } | port_specifier { $$ = malloc(sizeof(struct specifier_s)); memset($$, 0, sizeof(struct specifier_s)); $$->port = $1; } | protocol_specifier { $$ = malloc(sizeof(struct specifier_s)); memset($$, 0, sizeof(struct specifier_s)); $$->protocol = $1; } | icmptype_specifier { $$ = malloc(sizeof(struct specifier_s)); memset($$, 0, sizeof(struct specifier_s)); $$->icmptype = $1; } | option_specifier { $$ = malloc(sizeof(struct specifier_s)); memset($$, 0, sizeof(struct specifier_s)); $$->option = $1; } | chaingroup_specifier { $$ = malloc(sizeof(struct specifier_s)); memset($$, 0, sizeof(struct specifier_s)); $$->chaingroup = $1; } ; direction_specifier: TOK_INPUT direction_argument_list { $$ = malloc(sizeof(struct direction_specifier_s)); $$->type = TOK_INPUT; $$->list = $2; } | TOK_OUTPUT direction_argument_list { $$ = malloc(sizeof(struct direction_specifier_s)); $$->type = TOK_OUTPUT; $$->list = $2; } ; direction_argument_list: direction_argument_list_ { $$ = $1; } | TOK_LCURLY direction_argument_list_ TOK_RCURLY { $$ = $2; } ; direction_argument_list_: /* empty */ { $$ = NULL; } | direction_argument_list_ direction_argument { $$ = malloc(sizeof(struct direction_argument_list_s)); $$->list = $1; $$->arg = $2; } ; direction_argument: TOK_IDENTIFIER { $$ = malloc(sizeof(struct direction_argument_s)); $$->direction = $1; } ; target_specifier: TOK_ACCEPT { $$ = malloc(sizeof(struct target_specifier_s)); $$->type = TOK_ACCEPT; } | TOK_REJECT { $$ = malloc(sizeof(struct target_specifier_s)); $$->type = TOK_REJECT; } | TOK_DROP { $$ = malloc(sizeof(struct target_specifier_s)); $$->type = TOK_DROP; } | TOK_MASQ { $$ = malloc(sizeof(struct target_specifier_s)); $$->type = TOK_MASQ; } | TOK_PROXY { $$ = malloc(sizeof(struct target_specifier_s)); $$->type = TOK_PROXY; } | TOK_REDIRECT { $$ = malloc(sizeof(struct target_specifier_s)); $$->type = TOK_REDIRECT; } ; host_specifier: TOK_SOURCE host_argument_list { $$ = malloc(sizeof(struct host_specifier_s)); $$->type = TOK_SOURCE; $$->list = $2; } | TOK_DEST host_argument_list { $$ = malloc(sizeof(struct host_specifier_s)); $$->type = TOK_DEST; $$->list = $2; } ; host_argument_list: host_argument_list_ { $$ = $1; } | TOK_LCURLY host_argument_list_ TOK_RCURLY { $$ = $2; } ; host_argument_list_: /* empty */ { $$ = NULL; } | host_argument_list_ host_argument { $$ = malloc(sizeof(struct host_argument_list_s)); $$->list = $1; $$->arg = $2; } ; host_argument: TOK_IDENTIFIER TOK_SLASH TOK_IDENTIFIER { $$ = malloc(sizeof(struct host_argument_s)); $$->host = $1; $$->mask = $3; } | TOK_IDENTIFIER { $$ = malloc(sizeof(struct host_argument_s)); $$->host = $1; $$->mask = 0; } ; port_specifier: TOK_SPORT port_argument_list { $$ = malloc(sizeof(struct port_specifier_s)); $$->type = TOK_SPORT; $$->list = $2; } | TOK_DPORT port_argument_list { $$ = malloc(sizeof(struct port_specifier_s)); $$->type = TOK_DPORT; $$->list = $2; } ; port_argument_list: port_argument_list_ { $$ = $1; } | TOK_LCURLY port_argument_list TOK_RCURLY { $$ = $2; } port_argument_list_: port_argument { $$ = malloc(sizeof(struct port_argument_list_s)); $$->list = NULL; $$->arg = $1; } | port_argument_list_ port_argument { $$ = malloc(sizeof(struct port_argument_list_s)); $$->list = $1; $$->arg = $2; } ; port_argument: TOK_IDENTIFIER TOK_COLON TOK_IDENTIFIER { $$ = malloc(sizeof(struct port_argument_s)); $$->port_min = $1; $$->port_max = $3; } | TOK_IDENTIFIER { $$ = malloc(sizeof(struct port_argument_s)); $$->port_min = $1; $$->port_max = NULL; } ; protocol_specifier: TOK_PROTO protocol_argument_list { $$ = malloc(sizeof(struct protocol_specifier_s)); $$->list = $2; } ; protocol_argument_list: protocol_argument_list_ { $$ = $1; } | TOK_LCURLY protocol_argument_list_ TOK_RCURLY { $$ = $2; } ; protocol_argument_list_: /* empty */ { $$ = NULL; } | protocol_argument_list_ protocol_argument { $$ = malloc(sizeof(struct protocol_argument_list_s)); $$->list = $1; $$->arg = $2; } ; protocol_argument: TOK_IDENTIFIER { $$ = malloc(sizeof(struct protocol_argument_s)); $$->proto = strdup($1); } ; icmptype_specifier: TOK_ICMPTYPE icmptype_argument_list { $$ = malloc(sizeof(struct icmptype_specifier_s)); $$->list = $2; } ; icmptype_argument_list: icmptype_argument_list_ { $$ = $1; } | TOK_LCURLY icmptype_argument_list_ TOK_RCURLY { $$ = $2; } ; icmptype_argument_list_: /* empty */ { $$ = NULL; } | icmptype_argument_list_ icmptype_argument { $$ = malloc(sizeof(struct icmptype_argument_list_s)); $$->list = $1; $$->arg = $2; } ; icmptype_argument: TOK_IDENTIFIER { $$ = malloc(sizeof(struct icmptype_argument_s)); $$->icmptype = $1; } ; option_specifier: TOK_LOCAL { $$ = malloc(sizeof(struct option_specifier_s)); $$->type = TOK_LOCAL; $$->logmsg = 0; } | TOK_FORWARD { $$ = malloc(sizeof(struct option_specifier_s)); $$->type = TOK_FORWARD; $$->logmsg = 0; } | TOK_ONEWAY { $$ = malloc(sizeof(struct option_specifier_s)); $$->type = TOK_ONEWAY; $$->logmsg = 0; } | TOK_LOG TOK_TEXT TOK_IDENTIFIER { $$ = malloc(sizeof(struct option_specifier_s)); $$->type = TOK_LOG; $$->logmsg = $3; } | TOK_LOG { $$ = malloc(sizeof(struct option_specifier_s)); $$->type = TOK_LOG; $$->logmsg = 0; } ; compound_specifier: TOK_LCURLY subrule_list TOK_RCURLY { $$ = malloc(sizeof(struct compound_specifier_s)); $$->list = $2; } ; subrule_list: specifier_list { $$ = malloc(sizeof(struct subrule_list_s)); $$->subrule_list = NULL; $$->specifier_list = $1; } | subrule_list TOK_SEMICOLON specifier_list { $$ = malloc(sizeof(struct subrule_list_s)); $$->subrule_list = $1; $$->specifier_list = $3; } ; chaingroup_specifier: TOK_LSQUARE TOK_IDENTIFIER subrule_list TOK_RSQUARE { $$ = malloc(sizeof(struct chaingroup_specifier_s)); $$->name = $2; $$->list = $3; } | TOK_LSQUARE subrule_list TOK_RSQUARE { $$ = malloc(sizeof(struct chaingroup_specifier_s)); $$->name = NULL; $$->list = $2; } ; %% char * filename(); long int lineno(); extern char * yytext; void yyerror(const char * s) { fprintf(stderr, "%s:%ld: %s\n", filename(), lineno(), s); } int yyprint(FILE * f, int type, YYSTYPE v) { fprintf(f, "%d:\"%s\":%p", type, yytext, &v); return 0; } filtergen-0.12.4/scanner.l0000644000175000017500000001374310110541720012303 00000000000000%option noyywrap %option nounput %x include %{ /* input scanner for filtergen language * * Copyright (c) 2003 Jamie Wilkinson * * 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. * * 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, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include #include "parser.h" /* include file stack */ #define MAXINCLUDES 16 struct inc_stack_s { YY_BUFFER_STATE state; char * filename; long int lineno; }; struct inc_stack_s inc_stack[MAXINCLUDES] = { { state: 0, filename: NULL, lineno: 1 } }; int inc_stackptr = 0; long int lineno(); char * filename(); static void scan_err(const char * fmt, ...); void include_file(const char *); %} string \"[^\n]+\" space [ \t]+ id [[:alnum:]_][[:alnum:]_+-]* %% "/*" { /* strip c-style comments */ int c; do { while ((c = input()) != '*' && c != EOF && c != '\n') ; while (c == '*') c = input(); if (c == EOF) scan_err("comment reached end of file"); if (c == '\n') inc_stack[inc_stackptr].lineno++; } while (c != '/' && c != EOF); } #[^\n]* /* strip shell style comments */ {string} { /* we do not store the " characters in the string, so lop * them off. We can "safely" assume that the first and last * characters in this regex are ", otherwise there's a bug * in flex... The result is somethign that is syntactically * identical to an identifier for our purposes. */ yylval.u_str = strndup(yytext + 1, yyleng - 2); return TOK_IDENTIFIER; } {space} /* ignore */ \n inc_stack[inc_stackptr].lineno++; include BEGIN(include); accept return TOK_ACCEPT; dest return TOK_DEST; dport return TOK_DPORT; drop return TOK_DROP; forward return TOK_FORWARD; icmptype return TOK_ICMPTYPE; input return TOK_INPUT; local return TOK_LOCAL; log return TOK_LOG; masq return TOK_MASQ; oneway return TOK_ONEWAY; output return TOK_OUTPUT; proto return TOK_PROTO; proxy return TOK_PROXY; redirect return TOK_REDIRECT; reject return TOK_REJECT; source return TOK_SOURCE; sport return TOK_SPORT; text return TOK_TEXT; "{" return TOK_LCURLY; "}" return TOK_RCURLY; "[" return TOK_LSQUARE; "]" return TOK_RSQUARE; ";" return TOK_SEMICOLON; ":" return TOK_COLON; "!" return TOK_BANG; {id}(\.{id})* { yylval.u_str = strndup(yytext, yyleng); return TOK_IDENTIFIER; } "/" return TOK_SLASH; . return TOK_ERR; [ \t]* /* eat whitespace after include */ [^ \t\n;]+ { /* include file name */ if (inc_stackptr >= MAXINCLUDES) { scan_err("warning: too many nested includes"); scan_err("warning: skipping include of file %s", yytext); } else { char * name; name = strdup(yytext); include_file(name); free(name); } BEGIN(INITIAL); } <> { if (!inc_stackptr) { yyterminate(); } else { if (inc_stack[inc_stackptr].filename) { free(inc_stack[inc_stackptr].filename); inc_stack[inc_stackptr].filename = NULL; } inc_stackptr--; yy_delete_buffer(YY_CURRENT_BUFFER); yy_switch_to_buffer(inc_stack[inc_stackptr].state); } } %% long int lineno(void) { return inc_stack[inc_stackptr].lineno; } /* FIXME: make this return an immutable string */ char * filename(void) { return inc_stack[inc_stackptr].filename ?: strdup("(standard input)"); } static void scan_err(const char * fmt, ...) { va_list args; va_start(args, fmt); if (inc_stackptr >= 0) fprintf(stderr, "%s:%ld: ", filename(), lineno()); vfprintf(stderr, fmt, args); fprintf(stderr, "\n"); } void step_into_include_file(const char * fn) { FILE * f; if (!(f = fopen(fn, "r"))) { scan_err("warning: can't open file \"%s\"", fn); } else { inc_stack[inc_stackptr++].state = YY_CURRENT_BUFFER; inc_stack[inc_stackptr].lineno = 1; inc_stack[inc_stackptr].filename = strdup(fn); yyin = f; yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE)); } } /* include a file or directory */ void include_file(const char * name) { struct stat st; DIR * d; struct dirent * r; char * fn; if (stat(name, &st)) { scan_err("warning: stat failed on %s: %s", name, strerror(errno)); } else { if (S_ISDIR(st.st_mode)) { if ((d = opendir(name)) == NULL) { scan_err("warning: opendir failed on %s: %s", name, strerror(errno)); } else { while ((r = readdir(d)) != NULL) { /* FIXME: assumes d_name */ if (r->d_name[0] == '.') continue; asprintf(&fn, "%s/%s", name, r->d_name); include_file(fn); free(fn); } closedir(d); } } else step_into_include_file(name); } } filtergen-0.12.4/glue.c0000644000175000017500000003451210051306771011603 00000000000000/* conversion glue between ast and filter structures * * Copyright (c) 2003,2004 Jamie Wilkinson * * 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. * * 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, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include "filter.h" #include "ast.h" #include "parser.h" int yyparse(void *); int yyrestart(FILE *); int convtrace = 0; int filter_fopen(const char * filename) { FILE * file; if (filename) { /* XXX - make more effort to find file */ if (!(file = fopen(filename, "r"))) { printf("can't open file \"%s\"", filename); return -1; } } else { file = stdin; } yyrestart(file); return 0; } #define eprint(x) if (convtrace) fprintf(stderr, x) struct filter * convert_specifier_list(struct specifier_list_s * n); struct filter * convert_subrule_list(struct subrule_list_s * n) { struct filter * res = NULL, * end = NULL; eprint("converting subrule_list\n"); if (n->subrule_list) { res = convert_subrule_list(n->subrule_list); if (res) { end = res; while (end->next) { end = end->next; } if (n->specifier_list) { end->next = convert_specifier_list(n->specifier_list); } } else { printf("warning: convert_subrule_list returned NULL\n"); } } else if (n->specifier_list) { res = convert_specifier_list(n->specifier_list); } else { printf("error: no content in subrule_list\n"); } return res; } struct filter * convert_compound_specifier(struct compound_specifier_s * r) { struct filter * res = NULL; eprint("converting compound_specifier\n"); if (r->list) { res = new_filter_sibs(convert_subrule_list(r->list)); } return res; } struct filter * convert_direction_argument(struct direction_argument_s * n, int type) { struct filter * res = NULL; if (n->direction) { res = new_filter_device(type, n->direction); } else { printf("error: no direction argument contents\n"); } return res; } struct filter * convert_direction_argument_list(struct direction_argument_list_s * n, int type) { struct filter * res = NULL, * end = NULL; eprint("converting direction argument list\n"); if (n->list) { res = convert_direction_argument_list(n->list, type); if (res) { end = res; while (end->next) { end = end->next; } if (n->arg) { end->next = convert_direction_argument(n->arg, type); } } else { printf("warning: convert_direction_argument_list returned NULL\n"); } } else { res = convert_direction_argument(n->arg, type); } return res; } struct filter * convert_direction(struct direction_specifier_s * n) { struct filter * res = NULL; int type; eprint("converting direction specifier\n"); switch (n->type) { case TOK_INPUT: type = INPUT; break; case TOK_OUTPUT: type = OUTPUT; break; default: printf("error: incorrect direction type encountered\n"); type = YYEOF; break; } if (n->list) { res = new_filter_sibs(convert_direction_argument_list(n->list, type)); } else { printf("error: no direction argument list\n"); } return res; } struct filter * convert_host_argument(struct host_argument_s * n, int type) { struct filter * res = NULL; char * h; eprint("converting host_argument\n"); if (n->host) { if (n->mask) { asprintf(&h, "%s/%s", n->host, n->mask); res = new_filter_host(type, h); } else { res = new_filter_host(type, n->host); } } else { printf("error: no host part\n"); } return res; } struct filter * convert_host_argument_list(struct host_argument_list_s * n, int type) { struct filter * res = NULL, * end = NULL; eprint("converting host argument list\n"); if (n->list) { res = convert_host_argument_list(n->list, type); if (res) { end = res; while (end->next) { end = end->next; } if (n->arg) { end->next = convert_host_argument(n->arg, type); } } else { printf("warning: convert_host_argument_list returned NULL\n"); } } else { res = convert_host_argument(n->arg, type); } return res; } struct filter * convert_host_specifier(struct host_specifier_s * n) { struct filter * res = NULL; enum filtertype type; eprint("converting host specifier\n"); switch (n->type) { case TOK_SOURCE: type = F_SOURCE; break; case TOK_DEST: type = F_DEST; break; default: printf("error: incorrect host type encountered\n"); type = YYEOF; break; } if (n->list) { res = new_filter_sibs(convert_host_argument_list(n->list, type)); } else { printf("error: no host argument list\n"); } return res; } struct filter * convert_protocol_argument(struct protocol_argument_s * n) { struct filter * res = NULL; eprint("converting protocol argument\n"); if (n->proto) { res = new_filter_proto(F_PROTO, n->proto); } else { printf("error: no protocol argument contents\n"); } return res; } struct filter * convert_protocol_argument_list(struct protocol_argument_list_s * n) { struct filter * res = NULL, * end = NULL; eprint("converting protocol argument list\n"); if (n->list) { res = convert_protocol_argument_list(n->list); if (res) { end = res; while (end->next) { end = end->next; } if (n->arg) { end->next = convert_protocol_argument(n->arg); } } else { printf("warning: convert_protocol_argument_list returned NULL\n"); } } else { res = convert_protocol_argument(n->arg); } return res; } struct filter * convert_protocol_specifier(struct protocol_specifier_s * n) { struct filter * res = NULL; eprint("converting protocol specifier\n"); if (n->list) { res = new_filter_sibs(convert_protocol_argument_list(n->list)); } else { printf("error: no protocol argument list\n"); } return res; } struct filter * convert_port_argument(struct port_argument_s * n, int type) { struct filter * res = NULL; char * p; eprint("converting port argument\n"); if (n->port_min) { if (n->port_max) { asprintf(&p, "%s:%s", n->port_min, n->port_max); res = new_filter_ports(type, p); } else { res = new_filter_ports(type, n->port_min); } } else { printf("error: no port argument contents\n"); } return res; } struct filter * convert_port_argument_list(struct port_argument_list_s * n, int type) { struct filter * res = NULL, * end = NULL; eprint("converting port argument list\n"); if (n->list) { res = convert_port_argument_list(n->list, type); if (res) { end = res; while (end->next) { end = end->next; } if (n->arg) { end->next = convert_port_argument(n->arg, type); } } else { printf("warning: convert_port_argument_list returned NULL\n"); } } else { res = convert_port_argument(n->arg, type); } return res; } struct filter * convert_port_specifier(struct port_specifier_s * n) { struct filter * res = NULL; enum filtertype type; eprint("converting port specifier\n"); switch (n->type) { case TOK_SPORT: type = F_SPORT; break; case TOK_DPORT: type = F_DPORT; break; default: printf("error: incorrect port type encountered\n"); type = YYEOF; break; } if (n->list) { res = new_filter_sibs(convert_port_argument_list(n->list, type)); } else { printf("error: no port argument list\n"); } return res; } struct filter * convert_icmptype_argument(struct icmptype_argument_s * n) { struct filter * res = NULL; eprint("converting icmptype_argument\n"); if (n->icmptype) { res = new_filter_icmp(F_ICMPTYPE, n->icmptype); } else { printf("error: no icmptype argument contents\n"); } return res; } struct filter * convert_icmptype_argument_list(struct icmptype_argument_list_s * n) { struct filter * res = NULL, * end = NULL; eprint("converting icmptype argument list\n"); if (n->list) { res = convert_icmptype_argument_list(n->list); if (res) { end = res; while (end->next) { end = end->next; } if (n->arg) { end->next = convert_icmptype_argument(n->arg); } } else { printf("warning: convert_icmptype_argument_list returned NULL\n"); } } else { res = convert_icmptype_argument(n->arg); } return res; } struct filter * convert_icmptype_specifier(struct icmptype_specifier_s * n) { struct filter * res = NULL; eprint("converting icmptype specifier\n"); if (n->list) { res = new_filter_sibs(convert_icmptype_argument_list(n->list)); } else { printf("error: no icmptype argument list\n"); } return res; } struct filter * convert_option_specifier(struct option_specifier_s * n) { struct filter * res = NULL; eprint("converting option specifier\n"); switch (n->type) { case TOK_LOCAL: res = new_filter_rtype(LOCALONLY); break; case TOK_FORWARD: res = new_filter_rtype(ROUTEDONLY); break; case TOK_ONEWAY: res = new_filter_rtype(F_ONEWAY); break; case TOK_LOG: res = new_filter_log(F_LOG, n->logmsg); break; default: printf("error: incorrect option type encountered\n"); break; } return res; } struct filter * convert_chaingroup_specifier(struct chaingroup_specifier_s * n) { struct filter * res = NULL, * sub = NULL; char * name = NULL; if (n->name) { name = n->name; } else { /* Allocate a filter name */ static int ccount = 0; asprintf(&name, "chain_%d", ccount++); } if (n->list) { sub = convert_subrule_list(n->list); res = new_filter_subgroup(name, sub); } else { printf("error: no list in chaingroup\n"); } return res; } struct filter * convert_specifier(struct specifier_s * r) { struct filter * res = NULL; eprint("converting specifier\n"); if (r->compound) { eprint("converting compound specifier\n"); res = convert_compound_specifier(r->compound); } else if (r->direction) { res = convert_direction(r->direction); } else if (r->target) { enum filtertype type; eprint("converting target specifier\n"); switch (r->target->type) { case TOK_ACCEPT: type = T_ACCEPT; break; case TOK_REJECT: type = T_REJECT; break; case TOK_DROP: type = DROP; break; case TOK_MASQ: type = MASQ; break; case TOK_PROXY: type = REDIRECT; break; case TOK_REDIRECT: type = REDIRECT; break; default: printf("error: incorrect target type encountered\n"); type = YYEOF; break; } res = new_filter_target(type); } else if (r->host) { res = convert_host_specifier(r->host); } else if (r->protocol) { res = convert_protocol_specifier(r->protocol); } else if (r->port) { res = convert_port_specifier(r->port); } else if (r->icmptype) { res = convert_icmptype_specifier(r->icmptype); } else if (r->option) { res = convert_option_specifier(r->option); } else if (r->chaingroup) { res = convert_chaingroup_specifier(r->chaingroup); } else printf("error: no specifiers\n"); return res; } struct filter * convert_negated_specifier(struct negated_specifier_s * r) { struct filter * spec = NULL; struct filter * res = NULL; eprint("converting negated specifier\n"); if (r->spec) { spec = convert_specifier(r->spec); if (spec && r->negated) { eprint("negating\n"); res = new_filter_neg(spec); } else { res = spec; } } return res; } struct filter * convert_specifier_list(struct specifier_list_s * n) { struct filter * res = NULL, * end = NULL; eprint("converting specifier_list\n"); if (n->list) { res = convert_specifier_list(n->list); if (res) { end = res; while (end->child) { end = end->child; } if (n->spec) { end->child = convert_negated_specifier(n->spec); } } else { printf("warning: convert_specifier_list returned NULL\n"); } } else { res = convert_negated_specifier(n->spec); } return res; } struct filter * convert_rule(struct rule_s * r) { struct filter * res = NULL; eprint("converting rule\n"); if (r->list) res = convert_specifier_list(r->list); return res; } struct filter * convert_rule_list(struct rule_list_s * n) { struct filter * res = NULL, * end = NULL; eprint("converting rule_list\n"); if (n->list) { res = convert_rule_list(n->list); end = res; while (end->next) { end = end->next; } if (n->rule) { end->next = convert_rule(n->rule); } } else { res = convert_rule(n->rule); } return res; } struct filter * convert(struct ast_s * ast) { struct filter * res = NULL; eprint("converting ast\n"); if (ast->list) res = convert_rule_list(ast->list); return res; } struct filter * filter_parse_list(void) { struct filter * f = NULL; struct ast_s ast; int r; /* parse the input */ r = yyparse((void *) &ast); if (r != 0) { printf("parser failed: %d\n", r); } /* convert our new style AST into the old style struct */ if (!(f = convert(&ast))) { printf("conversion failed!\n"); } return f; } filtergen-0.12.4/resolver.c0000644000175000017500000002120510065737404012511 00000000000000/* argument name resolver * * Copyright (c) 2004 Jamie Wilkinson * * 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. * * 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, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include #include #include #include #include "resolver.h" #include "ast.h" #include "icmpent.h" void resolve_option_specifier(struct option_specifier_s * n __attribute__((unused))) { } void resolve_icmptype_argument(struct icmptype_argument_s * n) { struct icmpent_s * i; if (n->icmptype) { if ((i = geticmpbyname(n->icmptype))) { free(n->icmptype); asprintf(&n->icmptype, "%s", i->i_type); } else { /* check that the icmptype is a number if we can't resolve it */ long m; char * e; m = strtol(n->icmptype, &e, 10); if (*e) { fprintf(stderr, "warning: suspicious icmp type encountered: %s\n", n->icmptype); } } } } void resolve_icmptype_argument_list(struct icmptype_argument_list_s * n) { if (n->list) { resolve_icmptype_argument_list(n->list); } if (n->arg) { resolve_icmptype_argument(n->arg); } } void resolve_icmptype_specifier(struct icmptype_specifier_s * n) { if (n->list) { resolve_icmptype_argument_list(n->list); } } void resolve_port_argument(struct port_argument_s * n) { struct servent * s; if (n->port_min) { /* try to resolve the port name */ if ((s = getservbyname(n->port_min, NULL))) { free(n->port_min); asprintf(&n->port_min, "%d", ntohs(s->s_port)); } else { /* check that the port is a number if we can't resolve it */ long m; char * e; m = strtol(n->port_min, &e, 10); if (*e) { fprintf(stderr, "warning: suspicious port name encountered: %s\n", n->port_min); } } } if (n->port_max) { /* try to resolve the port name */ if ((s = getservbyname(n->port_max, NULL))) { free(n->port_max); asprintf(&n->port_max, "%d", ntohs(s->s_port)); } else { /* check that the port is a number if we can't resolve it */ long m; char * e; m = strtol(n->port_max, &e, 10); if (*e) { fprintf(stderr, "warning: suspicious port name encountered: %s\n", n->port_max); } } } } void resolve_port_argument_list(struct port_argument_list_s * n) { if (n->list) { resolve_port_argument_list(n->list); } if (n->arg) { resolve_port_argument(n->arg); } } void resolve_port_specifier(struct port_specifier_s * n) { if (n->list) { resolve_port_argument_list(n->list); } } void resolve_protocol_argument(struct protocol_argument_s * n) { struct protoent * p; if (n->proto) { if ((p = getprotobyname(n->proto))) { free(n->proto); asprintf(&n->proto, "%d", p->p_proto); } else { /* check that the proto is a number if we can't resolve it */ long m; char * e; m = strtol(n->proto, &e, 10); if (*e) { fprintf(stderr, "warning: suspicious protocol name encountered: %s\n", n->proto); } } } } void resolve_protocol_argument_list(struct protocol_argument_list_s * n) { if (n->list) { resolve_protocol_argument_list(n->list); } if (n->arg) { resolve_protocol_argument(n->arg); } } void resolve_protocol_specifier(struct protocol_specifier_s * n) { if (n->list) { resolve_protocol_argument_list(n->list); } } void resolve_host_argument(struct host_argument_s * n __attribute__((unused))) { } void resolve_host_argument_list(struct host_argument_list_s * n) { struct addrinfo * a = NULL, * i; struct addrinfo hints; int r; struct host_argument_list_s * list = NULL; struct host_argument_s * host = NULL; if (n->list) { resolve_host_argument_list(n->list); } if (n->arg) { memset(&hints, 0, sizeof(struct addrinfo)); /* any address family is good */ hints.ai_family = PF_UNSPEC; /* return hostname, though we don't use it, for debugging */ hints.ai_flags = AI_CANONNAME; /* limit so duplicate hosts aren't returned for each socktype */ hints.ai_socktype = SOCK_STREAM; if (n->arg->host) { r = getaddrinfo(n->arg->host, NULL, &hints, &a); switch (r) { case 0: /* replace the hostname with the IP */ free(n->arg->host); /* getnameinfo does no allocation. */ n->arg->host = malloc(NI_MAXHOST + 1); if (getnameinfo(a->ai_addr, a->ai_addrlen, n->arg->host, NI_MAXHOST, NULL, 0, NI_NUMERICHOST) == 0) { /* if there's more, create some more hosts */ for (i = a->ai_next; i; i = i->ai_next) { list = malloc(sizeof(struct host_argument_list_s)); host = malloc(sizeof(struct host_argument_s)); host->host = malloc(NI_MAXHOST + 1); if (getnameinfo(i->ai_addr, i->ai_addrlen, host->host, NI_MAXHOST, NULL, 0, NI_NUMERICHOST) == 0) { if (n->arg->mask) { host->mask = strdup(n->arg->mask); } /* insert the new node */ list->arg = host; list->list = n->list; n->list = list; } else { fprintf(stderr, "warning: %s\n", strerror(errno)); } } } else { fprintf(stderr, "warning: %s\n", strerror(errno)); } freeaddrinfo(a); break; default: fprintf(stderr, "warning: %s: %s\n", gai_strerror(r), n->arg->host); break; } } } } void resolve_host_specifier(struct host_specifier_s * n) { if (n->list) { resolve_host_argument_list(n->list); } } void resolve_target_specifier(struct target_specifier_s * n __attribute__((unused))) { } void resolve_direction_argument(struct direction_argument_s * n __attribute__((unused))) { } void resolve_direction_argument_list(struct direction_argument_list_s * n) { if (n->list) { resolve_direction_argument_list(n->list); } if (n->arg) { resolve_direction_argument(n->arg); } } void resolve_direction_specifier(struct direction_specifier_s * n) { if (n->list) { resolve_direction_argument_list(n->list); } } void resolve_specifier_list(struct specifier_list_s * n); void resolve_subrule_list(struct subrule_list_s * n) { if (n->subrule_list) { resolve_subrule_list(n->subrule_list); } if (n->specifier_list) { resolve_specifier_list(n->specifier_list); } } void resolve_chaingroup_specifier(struct chaingroup_specifier_s * n) { if (n->list) { resolve_subrule_list(n->list); } } void resolve_compound_specifier(struct compound_specifier_s * n) { if (n->list) { resolve_subrule_list(n->list); } } void resolve_specifier(struct specifier_s * n) { if (n->compound) { resolve_compound_specifier(n->compound); } else if (n->direction) { resolve_direction_specifier(n->direction); } else if (n->target) { resolve_target_specifier(n->target); } else if (n->host) { resolve_host_specifier(n->host); } else if (n->port) { resolve_port_specifier(n->port); } else if (n->protocol) { resolve_protocol_specifier(n->protocol); } else if (n->icmptype) { resolve_icmptype_specifier(n->icmptype); } else if (n->option) { resolve_option_specifier(n->option); } else if (n->chaingroup) { resolve_chaingroup_specifier(n->chaingroup); } } void resolve_negated_specifier(struct negated_specifier_s * n) { if (n->spec) { resolve_specifier(n->spec); } } void resolve_specifier_list(struct specifier_list_s * n) { if (n->list) { resolve_specifier_list(n->list); } if (n->spec) { resolve_negated_specifier(n->spec); } } void resolve_rule(struct rule_s * n) { if (n->list) { resolve_specifier_list(n->list); } } void resolve_rule_list(struct rule_list_s * n) { if (n->list) { resolve_rule_list(n->list); } if (n->rule) { resolve_rule(n->rule); } } void resolve_ast(struct ast_s * n) { if (n->list) { resolve_rule_list(n->list); } } void resolve(struct ast_s * n) { if (n) { resolve_ast(n); } } filtergen-0.12.4/icmpent.c0000644000175000017500000000721510051306771012306 00000000000000/* argument name resolver * * Copyright (c) 2004 Jamie Wilkinson * * 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. * * 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, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include "icmpent.h" /* icmp codes from RFC1700 */ struct icmpent_s icmpcodes[] = { { "0", "echo-reply" }, /* 1-2 unassigned */ { "3", "destination-unreachable" }, { "3/0", "network-unreachable" }, { "3/1", "host-unreachable" }, { "3/2", "protocol-unreachable" }, { "3/3", "port-unreachable" }, { "3/4", "fragmentation-needed" }, { "3/5", "source-route-failed" }, { "3/6", "network-unknown" }, { "3/7", "host-unknown" }, { "3/8", "source-host-isolated" }, { "3/9", "network-prohibited" }, { "3/10", "host-prohibited" }, { "3/11", "tos-network-unreachable" }, { "3/12", "tos-host-unreachable" }, /* RFC1812 defines the next three */ { "3/13", "communication-prohibited" }, { "3/14", "host-precedence-violation" }, { "3/15", "precedence-cutoff" }, { "4", "source-quench" }, { "5", "redirect" }, { "5/0", "redirect-network" }, { "5/1", "redirect-host" }, { "5/2", "redirect-tos-network" }, { "5/3", "redirect-tos-host" }, { "6", "alternate-host-address" }, /* 7 unassigned */ { "8", "echo-request" }, { "9", "router-advertisement" }, { "9/0", "router-advertisement-normal" }, /* RFC2002 */ { "9/16", "router-advertisement-uncommon" }, { "10", "router-selection" }, { "11", "time-exceeded" }, { "11/0", "time-exceeded-in-transmit" }, { "11/1", "time-exceeded-fragment-reassembly" }, { "12", "parameter-problem" }, { "12/0", "parameter-problem-pointer" }, /* RFC1108 */ { "12/1", "parameter-problem-missing-option" }, { "12/2", "parameter-problem-bad-length" }, { "13", "timestamp-request" }, { "14", "timestamp-reply" }, { "15", "information-request" }, { "16", "information-reply" }, { "17", "address-mask-request" }, { "18", "address-mask-reply" }, /* 19-29 reserved */ { "30", "traceroute" }, { "31", "datagram-conversion-error" }, { "32", "mobile-host-redirect" }, { "33", "ipv6-where-are-you" }, { "34", "ipv6-i-am-here" }, { "35", "mobile-registration-request" }, { "36", "mobile-registration-reply" }, { "37", "domain-name-request" }, { "38", "domain-name-reply" }, { "39", "skip" }, { "40", "photuris"}, { "40/0", "photuris-bad-spi" }, { "40/1", "photuris-authn-failed" }, { "40/2", "photuris-decompression-failed" }, { "40/3", "photuris-decryption-failed" }, { "40/4", "photuris-need-authn" }, { "40/5", "photuris-need-authz" }, /* 41-255 reserved */ { NULL, NULL } }; /* fake netdb-like function for icmp types */ struct icmpent_s * geticmpbyname(char * name) { struct icmpent_s * icmpent; for (icmpent = icmpcodes; icmpent->i_type != NULL; icmpent++) { if (!strcmp(name, icmpent->name)) break; } if (icmpent->i_type == NULL) icmpent = NULL; return icmpent; } filtergen-0.12.4/factoriser.c0000644000175000017500000000160710051306774013012 00000000000000/* factorise the syntax tree for optimisation * * Copyright (c) 2004 Jamie Wilkinson * * 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. * * 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, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "factoriser.h" filtergen-0.12.4/HISTORY0000644000175000017500000000641210110541720011554 000000000000000.12.4: Added directory include support. Fixed relative-path include error in fgadm. Improved tests for include file parsing. 0.12.3: Fix critical resolver bug. 0.12.2: New resolver code removes need for struct casting Altered test suite to be more robust minor cosmetic bugs 0.12.1: fixed some dumb bugs fixed some compile bugs on 64 bit platforms 0.12: converted build system to automake rewrote parser added test suite add "oneway" option fix iptables log message format (append a space) add "fgadm" command multi-homed host support 0.11: fixed non-working example in filter_syntax man page fix 64-bit warning in filter.c netmask calculation add "-F [policy]" flush option better feedback on parse errors 0.10: some cleanups, slight memory usage reduction add log messages: 'log text "foo etc"' fixed iptables and ipchains brace-grouping fix filter_unroll loop-making bug add RPM spec file from Wil Cooley rename package to "filtergen" add init scripts and makefile add samples for router, host and proxy firewall 0.9: fix install target to install section 7 manpages too do protocol lookups properly, support protocol numbers lookup/normalise service names force normalisation of netmasks add "-m" to force service and host names and to be turned into port numbers and IP addresses 0.8: cleanup for iptables and ipchains to save reallocs fix input vs output thing in forwarding support for iptables and ipchains 0.7: add "local" and "forward" syntax to state that packets are only for local or remote consumption (and "-h" option to default rules to the former) begin manpages add "-o" option to specify output file fix "make install" getopt()ify filtergen.c add "-l" option to minimise the number of rules for established connections, implemented for iptables backend add more stuff to the iptables skeleton warning fixups implement "local" and "forward" for iptables backend add "-r" option to mirror "-h" cleanup ipchains driver somewhat implement "local" for ipchains backend ("forward" is not possible) fix bug where accept would get lost from: input eth0 { ! dest bar drop; accept; }; iptables and ipchains add "established packet" rules to head of chain add "proxy" as an alias for "redirect" 0.6: disable negation of conjunctions ("or"s, aka brace-grouping) for now add "no skeleton" option fix a couple of segfaults/aborts where input filter is invalid allow literal +, ", and _ signs in input add sub-groups -- where supported, large sub-sections can be moved out-of-line to improve performance 0.5: that's better much fixing of iptables driver. Now shouldn't leak like the proverbial sieve 0.4: testing begins add transproxy and masquerading support fix syntax problems with iptables and ipchains output simple logging support (logs only initiating packets) rule checking -- ports only allowed with tcp or udp initial icmp support 0.3: add ipfilter backend fix yet another silly bug in main() add warning notice to cisco driver cisco driver supports port ranges now 0.2: Various improvements rewrote iptables driver added ipchains driver added beginnings of Cisco IOS ACL driver (see TODO for why this doesn't work yet) added TODO and HONESTY files 0.1: Initial release iptables driver a few bugs filtergen-0.12.4/HONESTY0000644000175000017500000000215310051306726011553 00000000000000 FULL-DISCLOSURE (or HONESTY) WHAT'S THIS? Here, I explain the status of the package in non-salesman mode. It might help you to decide whether this package is currently useful to you (though shouldn't put you off contributing). STATUS The language is likely to evolve as more features are implemented. Specifically, I'd like it to express fundamental networking and filtering concepts, rather than being an iptables macro language. The transparent proxying, masquerading and logging support is not as flexible as I'd like it to be. "Grouping" (sub-chain) support is a fairly recent addition and, even in backends which support it (iptables, ipchains), isn't quite right yet. I have been using it on my home gateway for around a year now, and have a dozen or so production servers, and a production router using it too (all via the iptables backend). It has all worked very well. But "working well" does not imply security, and I have not expended a great deal of effort in auditing. See the filter_backends(7) man page for more details on backend- specific issues. $Id: HONESTY,v 1.9 2002/07/21 13:32:23 matthew Exp $ filtergen-0.12.4/filter.h0000644000175000017500000001236610051310061012127 00000000000000/* types and functions used throughout filtergen * * Copyright (c) 2002 Matthew Kirkwood * * 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. * * 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, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _FK_FILTER_H #define _FK_FILTER_H #include #include #include #ifdef __GNUC__ #define _PRINTF_ATTR(s,e) __attribute__ ((__format__(__printf__, (s), (e)))) #else #define _PRINTF_ATTR(s,e) #endif /* * If it doesn't begin with "F_", it's a simple token, not an * filter type */ enum filtertype { YYEOF = 0, F_DIRECTION, F_TARGET, F_SOURCE, F_DEST, F_SPORT, F_DPORT, F_ICMPTYPE, F_PROTO, F_NEG, F_SIBLIST, F_SUBGROUP, F_LOG, F_RTYPE, F_ONEWAY, /* this must be the last real filter type */ F_FILTER_MAX, /* parser use only */ INPUT, OUTPUT, /* lex uses "ACCEPT" and "REJECT" */ T_ACCEPT, DROP, T_REJECT, MASQ, REDIRECT, OPENBRACE, CLOSEBRACE, OPENBRACKET, CLOSEBRACKET, SEMICOLON, STRING, INCLUDE, LOCALONLY, ROUTEDONLY, /* for F_RTYPE */ TEXT, /* for F_LOG */ }; /* Structures which appear in both the parse tree and the output rule */ struct proto_spec { int num; char *name; }; struct addr_spec { struct in_addr addr, mask; char *addrstr, *maskstr; }; struct port_spec { int min, max; char *minstr, *maxstr; }; /* This is basically just a parse tree */ struct filter { enum filtertype type; union { struct { enum filtertype direction; char *iface; } ifinfo; enum filtertype target; char *logmsg; enum filtertype rtype; struct addr_spec addrs; struct port_spec ports; char *icmp; struct proto_spec proto; struct filter *neg; struct filter *sib; struct { char *name; struct filter *list; } sub; } u; struct filter *child, *next; /* infernal use only */ int negate; }; /* from filter.c */ typedef struct filter *filter_tctor(enum filtertype); filter_tctor new_filter_target, new_filter_rtype; struct filter *new_filter_neg(struct filter *sub); struct filter *new_filter_sibs(struct filter *list); struct filter *new_filter_subgroup(char *name, struct filter *list); typedef struct filter *filter_ctor(enum filtertype, const char*); filter_ctor new_filter_device, new_filter_host, new_filter_ports, new_filter_icmp, new_filter_proto, new_filter_log; struct filter *new_filter_oneway(void); /* filter manipulations */ void filter_unroll(struct filter **f); void filter_nogroup(struct filter *f); void filter_noneg(struct filter **f); void filter_apply_flags(struct filter *f, long flags); /* from generated lexer and parer in filterlex.l */ int filter_fopen(const char *filename); struct filter *filter_parse_list(void); /* from gen.c */ #define ESET(e,f) (e->whats_set & (1 << F_ ##f)) struct filterent { /* Either direction+iface or groupname must be set */ enum filtertype direction; char *iface; char *groupname; /* One of these must be set */ enum filtertype target; char *subgroup; /* These may or may not be set */ int whats_set:F_FILTER_MAX; int whats_negated:F_FILTER_MAX; struct addr_spec srcaddr, dstaddr; enum filtertype rtype; struct proto_spec proto; char *logmsg; int oneway; /* We need this not to be a union, for error-checking reasons */ struct { struct { struct port_spec src, dst; } ports; char *icmp; } u; }; struct fg_misc { int flags; void *misc; }; typedef int fg_cb_rule(const struct filterent *ent, struct fg_misc *misc); typedef int fg_cb_group(const char *name); typedef struct { fg_cb_rule *rule; fg_cb_group *group; } fg_callback; int filtergen_cprod(struct filter *filter, fg_callback *cb, struct fg_misc *misc); /* fg-util.c */ char *strapp(char *s, const char *n); #define strapp2(s,n1,n2) strapp(strapp(s,n1),n2) int str_to_int(const char *s, int *i); char *int_to_str_dup(int i); /* various drivers */ typedef int filtergen(struct filter *filter, int flags); filtergen fg_iptables, fg_ipchains, fg_ipfilter, fg_cisco; typedef int filter_flush(enum filtertype policy); filter_flush flush_iptables, flush_ipchains; /* ("flags" arguments) */ #define FF_NOSKEL (1 << 0) /* omit any "skeleton" rules */ #define FF_LSTATE (1 << 1) /* lightweight state matching */ #define FF_LOCAL (1 << 2) /* assume packets are local only */ #define FF_ROUTE (1 << 3) /* assume packets are forwarded */ #define FF_LOOKUP (1 << 4) /* translate host and service names into * IP addresses and port numbers */ #define FF_FLUSH (1 << 5) /* just flush the ruleset instead */ /* filtergen.c */ int oputs(const char *s); int oprintf(const char *fmt, ...) _PRINTF_ATTR(1,2); #endif /* _FK_FILTER_H */ filtergen-0.12.4/util.h0000644000175000017500000000224510051306757011633 00000000000000/* utility functions for filter output * * Copyright (c) 2001 Matthew Kirkwood * * 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. * * 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, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _FILTER_UTIL_H #define _FILTER_UTIL_H 1 #define APP(l,s) (l = strapp(l,s)) #define APP2(l,s1,s2) (l = strapp2(l,s1,s2)) #define APPS(l,s) APP2(l, " ", s) #define APPS2(l,s1,s2) (APPS(l,s1), APP(l,s2)) #define APPSS2(l,s1,s2) (APPS(l,s1), APPS(l,s2)) #define NEG(t) (ent->whats_negated & (1< * * 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. * * 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, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __AST_H__ #define __AST_H__ struct specifier_list_s; struct subrule_list_s { struct subrule_list_s * subrule_list; struct specifier_list_s * specifier_list; }; struct chaingroup_specifier_s { char * name; struct subrule_list_s * list; }; struct compound_specifier_s { struct subrule_list_s * list; }; struct option_specifier_s { int type; char * logmsg; }; struct icmptype_argument_s { char * icmptype; }; struct icmptype_argument_list_s { struct icmptype_argument_list_s * list; struct icmptype_argument_s * arg; }; struct icmptype_specifier_s { struct icmptype_argument_list_s * list; }; struct protocol_argument_s { char * proto; }; struct protocol_argument_list_s { struct protocol_argument_list_s * list; struct protocol_argument_s * arg; }; struct protocol_specifier_s { struct protocol_argument_list_s * list; }; struct port_argument_s { char * port_min; char * port_max; }; struct port_argument_list_s { struct port_argument_list_s * list; struct port_argument_s * arg; }; struct port_specifier_s { int type; struct port_argument_list_s * list; }; struct host_argument_s { char * host; char * mask; }; struct host_argument_list_s { struct host_argument_list_s * list; struct host_argument_s * arg; }; struct host_specifier_s { int type; struct host_argument_list_s * list; }; struct target_specifier_s { int type; }; struct direction_argument_s { char * direction; }; struct direction_argument_list_s { struct direction_argument_list_s * list; struct direction_argument_s * arg; }; struct direction_specifier_s { int type; struct direction_argument_list_s * list; }; struct specifier_s { struct compound_specifier_s * compound; struct direction_specifier_s * direction; struct target_specifier_s * target; struct host_specifier_s * host; struct port_specifier_s * port; struct protocol_specifier_s * protocol; struct icmptype_specifier_s * icmptype; struct option_specifier_s * option; struct chaingroup_specifier_s * chaingroup; }; struct negated_specifier_s { int negated; struct specifier_s * spec; }; struct specifier_list_s { struct specifier_list_s * list; struct negated_specifier_s * spec; }; struct rule_s { struct specifier_list_s * list; }; struct rule_list_s { struct rule_list_s * list; struct rule_s * rule; }; struct ast_s { struct rule_list_s * list; }; #endif /* __AST_H__ */ filtergen-0.12.4/resolver.h0000644000175000017500000000164710051306760012516 00000000000000/* argument name resolver * * Copyright (c) 2004 Jamie Wilkinson * * 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. * * 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, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __RESOLVER_H__ #define __RESOLVER_H__ #include "ast.h" void resolve(struct ast_s * n); #endif /* __RESOLVER_H__ */ filtergen-0.12.4/icmpent.h0000644000175000017500000000027710051306770012313 00000000000000#ifndef __ICMPENT_H__ #define __ICMPENT_H__ struct icmpent_s { const char * i_type; const char * name; }; struct icmpent_s * geticmpbyname(char * name); #endif /* __ICMPENT_H__ */ filtergen-0.12.4/factoriser.h0000644000175000017500000000160610051306765013016 00000000000000/* factorise the ast for optimisation * * Copyright (c) 2004 Jamie Wilkinson then rewrote a lot of the internals, added some features, and took on maintenance of the project. filtergen-0.12.4/fgadm.80000644000175000017500000000454410061464477011665 00000000000000.\" -*- nroff -*- .TH FGADM 8 "June 7, 2004" .SH NAME fgadm \- filtergen command program .SH SYNOPSIS \fBfgadm\fR [ \fBcheck\fR | \fBreload\fR | \fBsave\fR | \fBstop\fR ] .SH DESCRIPTION \fBfgadm\fR is a simple command interface for managing \fBfiltergen\fR(8) based packet filters. .SH USAGE \fBfgadm\fR can be used to stop existing filters (thus turning them off), reload new packet filters, save currently running filters for longevity, and to check filter scripts for errors before reloading. .PP The following commands are accepted by \fBfgadm\fR: .TP \fBcheck\fR Check the filter script \fI/etc/filtergen/rules.filter\fR for errors. The generated filter will be printed on standard output, and errors printed to standard error. .TP \fBreload\fR Replace the current live packet filter with the one in \fI/etc/filtergen/rules.filter\fR. The script will be tested for errors before reloading. .TP \fBsave\fR The current live packet filter will be saved in a distribution-friendly way. On Red Hat systems, this will save the iptables or ipchains firewall that is currently loaded into the kernel to load at boot with the \fIiptables\fR or \fIipchains\fR initscript. .TP \fBstop\fR This command will flush the current live packet filter out and put it in a default accept mode, thus no firewalling will be in place. This is useful to abort firewalls in an emergency. .SH EXAMPLES One may find the following sequence of commands useful for making firewall changes on live servers: .br # \fBat now + 2 min\fR .br warning: commands will be executed using (in order) a) $SHELL b) login shell c) /bin/sh .br at> \fBfgadm stop\fR .br at> \fB^D\fR .br job 53 at 2004-06-07 17:25 .br # \fBfgadm check\fR .br # \fBfgadm reload\fR .br # \fBatq\fR .br 53 .br # \fBatrm 53\fR .br # \fBfgadm save\fR .SH FILES .SS /etc/filtergen/rules.filter Packet filter descriptions are read from this file when \fBfgadm\fR is used. .SS /etc/filtergen/fgadm.conf This file alters the behaviour of \fBfiltergen\fR as called from \fBfgadm\fR. .SH BUGS \fBfgadm save\fR does not work on Debian systems with iptables due to a lack of common sense in the iptables package. .SH SEE ALSO \fBfiltergen\fR(8), \fBfilter_syntax\fR(5), \fBfilter_backends\fR(5) .SH AUTHOR \fBfgadm\fR was written by Jamie Wilkinson for the filtergen package, to ease maintenance of filtergen-based firewalls. filtergen-0.12.4/filtergen.spec0000644000175000017500000000273610110551030013323 00000000000000Summary: packet filter generator for various firewall systems Name: filtergen Version: 0.12.4 Release: 1 License: GPL Group: Applications/System URL: http://spacepants.org/src/filtergen Packager: Jamie Wilkinson Source: http://spacepants.org/src/filtergen/download/%name-%version.tar.gz Buildroot: %{_tmppath}/%{name}-root BuildPrereq: rpm-build gcc flex make %description filtergen is a packet filter generator. It compiles a fairly high-level description language into iptables, ipchains, or ipfilter rules (and has bits of support for Cisco IOS access lists). %prep %setup -q ./configure %build make CFLAGS="${RPM_OPT_FLAGS}" %install rm -rf $RPM_BUILD_ROOT make PREFIX=${RPM_BUILD_ROOT}/usr BINDIR=${RPM_BUILD_ROOT}/sbin install %post /sbin/chkconfig --add filtergen /sbin/chkconfig filtergen off %preun /sbin/service filtergen accept /sbin/chkconfig --del filtergen %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root) /sbin/filtergen /etc/init.d/filtergen /etc/filter/ %{_mandir}/* %doc HISTORY HONESTY README TODO tests/*.filter %changelog * Wed Mar 10 2004 Jamie Wilkinson - 0.12-1 - New upstream release. * Wed Nov 13 2002 Matthew Kirkwood 0.11-1 - Release 0.11, rename init script from "filter" to "filtergen" * Mon Sep 2 2002 Matthew Kirkwood 0.10-1 - Add new sample and documentation stuff * Sun Aug 18 2002 Wil Cooley 0.8-1 - Initial RPM creation filtergen-0.12.4/t/0000777000175000017500000000000010111022512011006 500000000000000filtergen-0.12.4/t/data/0000777000175000017500000000000010111022511011716 500000000000000filtergen-0.12.4/t/data/converter10.in0000644000175000017500000000027410062027731014353 00000000000000# convert compound specifiers { input lo; output lo} accept; # chunky input eth0 source foo dest bar proto tcp { dport echo; dport https; dport nntp; sport 1:1023 dport ssh; } accept; filtergen-0.12.4/t/data/converter11.in0000644000175000017500000000012610062027731014350 00000000000000# nested sibs input eth0 proto tcp { dport { echo https smtp }; sport 53; } accept; filtergen-0.12.4/t/data/converter12.in0000644000175000017500000000055710062027731014361 00000000000000# big ugly filter input eth0 source foo dest bar [ proto tcp { dport {echo https nntp}; sport 1:1023 dport ssh; } accept; ]; input eth0 source baz dest quux [ proto tcp { dport {1264 1521 1984 8008 8080 26000}; } accept; ]; filtergen-0.12.4/t/data/converter13.in0000644000175000017500000000011110051306754014347 00000000000000# convert log options input eth0 log drop; input eth0 log text foo drop; filtergen-0.12.4/t/data/converter14.in0000644000175000017500000000011010051306755014350 00000000000000# check multiple options together input eth0 local log text "foo" drop; filtergen-0.12.4/t/data/converter1.in0000644000175000017500000000006510051306750014270 00000000000000# check "child" chains input eth0 ! dest foo reject; filtergen-0.12.4/t/data/converter2.in0000644000175000017500000000011510051306750014265 00000000000000# check "next" chains input eth0 reject; input eth1 accept; input eth2 drop; filtergen-0.12.4/t/data/converter3.in0000644000175000017500000000015410051306751014272 00000000000000# check directions input eth0 reject; output eth0 reject; # compound directions input { eth0 eth1 } reject; filtergen-0.12.4/t/data/converter4.in0000644000175000017500000000031410051306754014274 00000000000000# check hosts input eth0 dest foo accept; input eth0 source foo reject; # compound input eth0 dest { foo bar } accept; # with mask input eth0 dest foo/255.255.255.0 accept; input eth0 dest foo/32 accept; filtergen-0.12.4/t/data/converter5.in0000644000175000017500000000015010051306752014271 00000000000000# convert protocols input eth0 dest foo proto tcp accept; input eth0 dest foo proto { tcp udp } accept; filtergen-0.12.4/t/data/converter6.in0000644000175000017500000000061710062027731014301 00000000000000# convert ports input eth0 dest foo proto tcp dport echo accept; input eth0 dest foo proto tcp sport echo accept; input eth0 dest foo proto tcp sport 53 accept; input eth0 dest foo proto tcp dport 53 accept; # ranges input eth0 dest foo proto tcp dport 53:54 accept; input eth0 dest foo proto tcp sport echo:https accept; # compound input eth0 dest foo proto tcp dport { 53 echo smtp 3128 } accept; filtergen-0.12.4/t/data/converter7.in0000644000175000017500000000023410051306753014277 00000000000000# convert icmptype input eth0 dest foo proto icmp icmptype echo-request accept; input eth0 dest foo proto icmp icmptype { echo-request echo-reply } accept; filtergen-0.12.4/t/data/converter8.in0000644000175000017500000000020610051306767014304 00000000000000# convert routing specifiers input eth0 dest foo local accept; input eth0 dest foo forward accept; input eth0 dest foo oneway accept; filtergen-0.12.4/t/data/converter9.in0000644000175000017500000000022010062027731014272 00000000000000# convert chain groups input eth0 source foo dest bar [ proto tcp dport {echo https nntp} accept; proto tcp sport 1:1023 dport ssh accept; ]; filtergen-0.12.4/t/data/emitter10.in0000644000175000017500000000040610051306745014015 00000000000000dport 1; dport foo; dport 1:1024; dport foo:bar; dport 1:bar; dport foo:1024; sport 1; sport foo; sport 1:1024; sport foo:bar; sport 1:bar; sport foo:1024; dport { 1 foo 1:1024 foo:bar 1:bar foo:1024 }; sport { 1 foo 1:1024 foo:bar 1:bar foo:1024 }; filtergen-0.12.4/t/data/emitter11.in0000644000175000017500000000011310051306745014011 00000000000000# test protocol and arguments proto tcp; proto { tcp udp icmp }; proto {}; filtergen-0.12.4/t/data/emitter12.in0000644000175000017500000000012110051306746014012 00000000000000icmptype echo-request; icmptype { echo-request port-unreachable }; icmptype {};filtergen-0.12.4/t/data/emitter13.in0000644000175000017500000000005510051306767014024 00000000000000# routing specifiers local; forward; oneway; filtergen-0.12.4/t/data/emitter14.in0000644000175000017500000000023110051306746014016 00000000000000# test subrule lists {}; # subrule list with a single specifier in it { proto tcp }; # more specifiers { proto tcp; accept; icmptype echo-request; }; filtergen-0.12.4/t/data/emitter15.in0000644000175000017500000000025210051306746014022 00000000000000# chain groups [ ]; [ proto tcp ]; [ accept; reject; ]; [ "foo" ]; [ "foo" proto tcp; ]; [ "foo" accept; reject; ]; [ foo ]; [ foo proto tcp; ]; [ foo accept; reject; ]; filtergen-0.12.4/t/data/emitter1.in0000644000175000017500000000000010051306742013720 00000000000000filtergen-0.12.4/t/data/emitter2.in0000644000175000017500000000000210051306743013724 00000000000000; filtergen-0.12.4/t/data/emitter3.in0000644000175000017500000000001610051306744013733 00000000000000accept; drop; filtergen-0.12.4/t/data/emitter4.in0000644000175000017500000000005710051306743013740 00000000000000# test specifier_list input eth0 accept; drop; filtergen-0.12.4/t/data/emitter5.in0000644000175000017500000000030710051306744013740 00000000000000# test for each of the specifier types input eth0; output ppp0; dest foo; source bar; dport 0; sport 1; icmptype echo-request; accept; reject; drop; redirect; masq; local; forward; log text "pants"; filtergen-0.12.4/t/data/emitter6.in0000644000175000017500000000012210051306744013734 00000000000000# parse and emit negated specifiers dest foo; ! dest foo; sport bar; ! sport bar; filtergen-0.12.4/t/data/emitter7.in0000644000175000017500000000014310051306745013741 00000000000000# test directions and direction arguments input eth0; output ppp0; input { ppp0 eth0 }; output {}; filtergen-0.12.4/t/data/emitter8.in0000644000175000017500000000031110051306745013737 00000000000000# test target specifiers and arguments accept; drop; reject; masq; redirect; log drop; log text "invalid - " drop; log text "accept" accept; log text blurble reject; log text foo; log text "bar"; log; filtergen-0.12.4/t/data/emitter9.in0000644000175000017500000000121610051306745013745 00000000000000# test hosts and arguments source foo; source foo/32; source foo/255.0; source foo/255.255.0; source foo/255.255.255.0; source 127.0.0.1; source 127.0.0.1/24; source 127.0.0.1/255.255; source 127.0.0.1/255.255.0; source 127.0.0.1/255.255.255.255; dest foo; dest foo/32; dest foo/255.0; dest foo/255.255.0; dest foo/255.255.255.0; dest 127.0.0.1; dest 127.0.0.1/24; dest 127.0.0.1/255.255; dest 127.0.0.1/255.255.0; dest 127.0.0.1/255.255.255.255; dest { foo foo/32 foo/255.0 foo/255.255.255.0 127.0.0.1 127.0.0.1/24 127.0.0.1/255.255.255.0 }; source { foo foo/32 foo/255.0 foo/255.255.255.0 127.0.0.1 127.0.0.1/24 127.0.0.1/255.255.255.0 };filtergen-0.12.4/t/data/example1.in0000644000175000017500000000561710051306741013724 00000000000000# this file contains all the examples from the filter_syntax.7 manpage # MATCHES input eth0 ! dest 10.0.0.3 reject; # OPTIONS input eth0 source { 10.0.0.0/8 192.168.0.0/16 } log text "private addresses" drop; # GROUPING input eth0 source foo dest bar proto tcp dport http accept; input eth0 source foo dest bar proto tcp dport https accept; input eth0 source foo dest bar proto tcp dport nntp accept; input eth0 source foo dest bar proto tcp sport 1:1023 dport ssh accept; input eth0 source foo dest bar proto tcp { dport http; dport https; dport nntp; sport 1:1023 dport ssh; } accept; input eth0 source foo dest bar proto tcp { dport {http https nntp}; sport 1:1023 dport ssh; } accept; # OUT-OF-LINE GROUPS input eth0 source foo dest bar proto tcp { dport {http https nntp}; sport 1:1023 dport ssh; } accept; input eth0 source baz dest quux proto tcp { dport {1264 1521 1984 8008 8080 26000}; } accept; input eth0 source foo dest bar [ proto tcp { dport {http https nntp}; sport 1:1023 dport ssh; } accept; ]; input eth0 source baz dest quux [ proto tcp { dport {1264 1521 1984 8008 8080 26000}; } accept; ]; # EXAMPLE # # Example filter for (for example) a mail server # # Unfortunately, we don't have time to audit the # communications which go on locally {input lo; output lo} accept; # But we want to be a bit more careful when speaking # to the outside world input eth0 { # Sadly, we share a DMZ with Windows machines. # Don't log their netbios noise proto {tcp udp} source ournet/24 dport 137:139 drop; proto tcp { dport { smtp pop-3 } accept; dport ssh source ournet/24 accept; # We don't answer this, but don't want to # cause timeouts by blocking it dport auth reject; log drop; }; # We don't run any UDP (or other non-TCP) # services log drop; }; output eth0 { proto tcp { dport { smtp auth } accept; log drop; }; # Outbound DNS is OK proto udp dport domain dest { ns0 ns1 } accept; log drop; }; filtergen-0.12.4/t/data/parser10.in0000644000175000017500000000006710051306740013636 00000000000000# filter targets accept; reject; drop; redirect; masq; filtergen-0.12.4/t/data/parser11.in0000644000175000017500000000022310051306740013631 00000000000000# negation of some specifiers ! source foo; ! dest foo; ! sport 80; ! dport 80; ! proto udp; ! input eth0; ! output eth0; ! icmptype echo-request; filtergen-0.12.4/t/data/parser12.in0000644000175000017500000000102110051306741013630 00000000000000# compound specifiers { dport http; }; { dport http dest www }; dest www { dport http; sport https }; # specifier lists inside subrule group source foo { dport http; dport ssh dest bar; } accept; # big nested one input eth0 { dest foo { dport { ssh http } accept; dport ntp sport ntp proto udp accept; dport bootps drop; }; drop; }; # empty subrules {}; # nested empty { { proto tcp; proto udp } dport domain; }; { { proto tcp } }; # with and without final semicolon { proto foo; proto bar; }; { proto foo; proto bar }; filtergen-0.12.4/t/data/parser13.in0000644000175000017500000000004510051306740013635 00000000000000# routing specifiers local; forward; filtergen-0.12.4/t/data/parser14.in0000644000175000017500000000124510051306744013645 00000000000000# chained subgroup, named [ "thingy" accept; ]; # unnamed [ accept; ]; # empty [ ]; # named empty [ "blarg" ]; # a big one from tgroup.filter input eth0 source wwwserv dest dbserv [ "web_to_dbserv" proto tcp sport 137:139 reject; accept; ]; # from tgroup2.filter input eth0 source wwwserv dest dbserv [ "web_to_dbserv" proto tcp dport 1521 accept; proto tcp dport appserv1 accept; proto tcp dport appserv2 accept; proto tcp dport appserv3 accept; drop; ]; # from tgroup3.filter input eth0 source wwwserv dest dbserv [ "web_to_dbserv" proto tcp dport { 1521 appserv1 appserv2 appserv3 } accept; drop; ]; # now try with a keyword as the chain label [ "input" accept; ]; filtergen-0.12.4/t/data/parser15.in0000644000175000017500000000014710051306744013646 00000000000000# using an unquoted string as a chain label is okay as long as it's # not a keyword. [ snot accept; ]; filtergen-0.12.4/t/data/parser16.in0000644000175000017500000000016110051306742013641 00000000000000# parse a file, see how well includes cope with nested sections input eth0 dest { include include.conf } accept; filtergen-0.12.4/t/data/parser1.in0000644000175000017500000000002310051306735013552 00000000000000# the empty filter filtergen-0.12.4/t/data/parser2.in0000644000175000017500000000002310051306735013553 00000000000000# one empty rule ; filtergen-0.12.4/t/data/parser3.in0000644000175000017500000000004010051306735013553 00000000000000# list of empty rules ;; ; ; ;; filtergen-0.12.4/t/data/parser4.in0000644000175000017500000000004310051306736013560 00000000000000# parse a very simple rule accept; filtergen-0.12.4/t/data/parser5.in0000644000175000017500000000023110051306736013560 00000000000000# a full rule with all specifiers - doesn't need to make sense input eth0 source foo dest bar proto udp sport 37000 dport 80 icmptype echo-request drop; filtergen-0.12.4/t/data/parser6.in0000644000175000017500000000077310051306736013574 00000000000000# a rule with a compound direction argument input { eth0 eth1 }; output { ppp0 wlan0 }; input { lo }; # a rule with a compound host argument dest { foo bar }; source { baz quux }; source { localhost }; # a rule with a compound port argument dport { ssh http }; sport { https ftp-data }; sport { ntp }; # a rule with a compound protocol argument proto { udp tcp icmp }; proto { all }; # a rule with a compound icmptype argument icmptype { echo-request echo-reply source-quench }; icmptype { time-exceeded }; filtergen-0.12.4/t/data/parser7.in0000644000175000017500000000033510051306736013567 00000000000000# test hostname variations source foo; source bar/24; source baz/255.255.255.248; source meep/0; source sod/255.0 source 127.0.0.1/32; source 127.0.0.1/255.255.255.255; source mail.example.com; source mail.example.com/24;filtergen-0.12.4/t/data/parser8.in0000644000175000017500000000011410051306736013563 00000000000000dport 80; dport http; dport 37000:38000; dport sod:blerg; dport 1:infinity; filtergen-0.12.4/t/data/parser9.in0000644000175000017500000000012710051306737013571 00000000000000# different forms of the log command log drop; log text "foo" drop; log text foo drop; filtergen-0.12.4/t/data/scanner10.in0000644000175000017500000000002610051306732013767 00000000000000/* this /* is okay */ filtergen-0.12.4/t/data/scanner11.in0000644000175000017500000000006610051306733013775 00000000000000/* test include directive */ include data/scanner7.in filtergen-0.12.4/t/data/scanner12.in0000644000175000017500000000003210051306733013767 00000000000000include data/scanner12.in filtergen-0.12.4/t/data/scanner13.in0000644000175000017500000000020110051306734013767 00000000000000/* test double includes with other directives */ input include data/scanner7.in accept ; output include data/scanner7.in accept; filtergen-0.12.4/t/data/scanner14.in0000644000175000017500000000021110051306734013771 00000000000000/* test includes that are inline with other directives */ input include data/scanner7.in accept; output include data/scanner7.in accept; filtergen-0.12.4/t/data/scanner15.in0000644000175000017500000000003010051306734013771 00000000000000include nonexistentfile filtergen-0.12.4/t/data/scanner16.in0000644000175000017500000000005310051306741013775 00000000000000/* open ended comment just doesn't end. filtergen-0.12.4/t/data/scanner1.in0000644000175000017500000000004610051306732013711 00000000000000/* scan and ignore c-style comments */filtergen-0.12.4/t/data/scanner2.in0000644000175000017500000000004610051306732013712 00000000000000# scan and ignore hash style comments filtergen-0.12.4/t/data/scanner3.in0000644000175000017500000000007610051306732013716 00000000000000# scan and ignore hash style comments -- no newline at the endfiltergen-0.12.4/t/data/scanner4.in0000644000175000017500000000017110051306767013723 00000000000000accept dest dport drop forward icmptype input local log masq oneway output proto proxy redirect reject source sport text filtergen-0.12.4/t/data/scanner5.in0000644000175000017500000000002010051306752013707 00000000000000{ } [ ] ; / : ! filtergen-0.12.4/t/data/scanner6.in0000644000175000017500000000003610051306732013715 00000000000000/* test numerals */ 37 69 255 filtergen-0.12.4/t/data/scanner7.in0000644000175000017500000000010110051306736013713 00000000000000/* test identifiers (names) */ foo bar baz quux mail.example.com filtergen-0.12.4/t/data/scanner8.in0000644000175000017500000000020610051306732013716 00000000000000/* test some names and numbers in common networking arrangements */ 0.0.0.0 127.0.0.1/255.255.255.255 http bar/29 bar/255.255.255.248 filtergen-0.12.4/t/data/scanner9.in0000644000175000017500000000004010051306732013713 00000000000000/* c comments can't nest */ ***/filtergen-0.12.4/t/data/converter10.out0000644000175000017500000000205010062027731014546 00000000000000( siblist ( siblist ( input lo ) next ( siblist ( output lo ) ) ) child ( accept ) next ( siblist ( input eth0 ) child ( siblist ( source foo ) child ( siblist ( dest bar ) child ( siblist ( proto tcp ) child ( siblist ( siblist ( dport echo ) next ( siblist ( dport https ) next ( siblist ( dport nntp ) next ( siblist ( sport 1:1023 ) child ( siblist ( dport ssh ) ) ) ) ) ) child ( accept ) ) ) ) ) ) ) filtergen-0.12.4/t/data/converter11.out0000644000175000017500000000060610062027731014554 00000000000000( siblist ( input eth0 ) child ( siblist ( proto tcp ) child ( siblist ( siblist ( dport echo next ( dport https next ( dport smtp ) ) ) next ( siblist ( sport 53 ) ) ) child ( accept ) ) ) ) filtergen-0.12.4/t/data/converter12.out0000644000175000017500000000332510062027731014556 00000000000000( siblist ( input eth0 ) child ( siblist ( source foo ) child ( siblist ( dest bar ) child ( subgroup "chain_0" ( siblist ( proto tcp ) child ( siblist ( siblist ( dport echo next ( dport https next ( dport nntp ) ) ) next ( siblist ( sport 1:1023 ) child ( siblist ( dport ssh ) ) ) ) child ( accept ) ) ) ) ) ) next ( siblist ( input eth0 ) child ( siblist ( source baz ) child ( siblist ( dest quux ) child ( subgroup "chain_1" ( siblist ( proto tcp ) child ( siblist ( siblist ( dport 1264 next ( dport 1521 next ( dport 1984 next ( dport 8008 next ( dport 8080 next ( dport 26000 ) ) ) ) ) ) ) child ( accept ) ) ) ) ) ) ) ) filtergen-0.12.4/t/data/converter13.out0000644000175000017500000000031010051306762014550 00000000000000( siblist ( input eth0 ) child ( log "" child ( drop ) ) next ( siblist ( input eth0 ) child ( log "foo" child ( drop ) ) ) ) filtergen-0.12.4/t/data/converter14.out0000644000175000017500000000017310051306762014560 00000000000000( siblist ( input eth0 ) child ( local child ( log "foo" child ( drop ) ) ) ) filtergen-0.12.4/t/data/converter1.out0000644000175000017500000000020310051306762014466 00000000000000( siblist ( input eth0 ) child ( neg ( siblist ( dest foo ) ) child ( reject ) ) ) filtergen-0.12.4/t/data/converter2.out0000644000175000017500000000034310051306762014474 00000000000000( siblist ( input eth0 ) child ( reject ) next ( siblist ( input eth1 ) child ( accept ) next ( siblist ( input eth2 ) child ( drop ) ) ) ) filtergen-0.12.4/t/data/converter3.out0000644000175000017500000000042310051306762014474 00000000000000( siblist ( input eth0 ) child ( reject ) next ( siblist ( output eth0 ) child ( reject ) next ( siblist ( input eth0 next ( input eth1 ) ) child ( reject ) ) ) ) filtergen-0.12.4/t/data/converter4.out0000644000175000017500000000161710051306762014503 00000000000000( siblist ( input eth0 ) child ( siblist ( dest foo ) child ( accept ) ) next ( siblist ( input eth0 ) child ( siblist ( source foo ) child ( reject ) ) next ( siblist ( input eth0 ) child ( siblist ( dest foo next ( dest bar ) ) child ( accept ) ) next ( siblist ( input eth0 ) child ( siblist ( dest foo/255.255.255.0 ) child ( accept ) ) next ( siblist ( input eth0 ) child ( siblist ( dest foo/255.255.255.255 ) child ( accept ) ) ) ) ) ) ) filtergen-0.12.4/t/data/converter5.out0000644000175000017500000000066710051306762014510 00000000000000( siblist ( input eth0 ) child ( siblist ( dest foo ) child ( siblist ( proto tcp ) child ( accept ) ) ) next ( siblist ( input eth0 ) child ( siblist ( dest foo ) child ( siblist ( proto tcp next ( proto udp ) ) child ( accept ) ) ) ) ) filtergen-0.12.4/t/data/converter6.out0000644000175000017500000000571310062027732014505 00000000000000( siblist ( input eth0 ) child ( siblist ( dest foo ) child ( siblist ( proto tcp ) child ( siblist ( dport echo ) child ( accept ) ) ) ) next ( siblist ( input eth0 ) child ( siblist ( dest foo ) child ( siblist ( proto tcp ) child ( siblist ( sport echo ) child ( accept ) ) ) ) next ( siblist ( input eth0 ) child ( siblist ( dest foo ) child ( siblist ( proto tcp ) child ( siblist ( sport 53 ) child ( accept ) ) ) ) next ( siblist ( input eth0 ) child ( siblist ( dest foo ) child ( siblist ( proto tcp ) child ( siblist ( dport 53 ) child ( accept ) ) ) ) next ( siblist ( input eth0 ) child ( siblist ( dest foo ) child ( siblist ( proto tcp ) child ( siblist ( dport 53:54 ) child ( accept ) ) ) ) next ( siblist ( input eth0 ) child ( siblist ( dest foo ) child ( siblist ( proto tcp ) child ( siblist ( sport echo:https ) child ( accept ) ) ) ) next ( siblist ( input eth0 ) child ( siblist ( dest foo ) child ( siblist ( proto tcp ) child ( siblist ( dport 53 next ( dport echo next ( dport smtp next ( dport 3128 ) ) ) ) child ( accept ) ) ) ) ) ) ) ) ) ) ) filtergen-0.12.4/t/data/converter7.out0000644000175000017500000000117710051306762014507 00000000000000( siblist ( input eth0 ) child ( siblist ( dest foo ) child ( siblist ( proto icmp ) child ( siblist ( icmptype echo-request ) child ( accept ) ) ) ) next ( siblist ( input eth0 ) child ( siblist ( dest foo ) child ( siblist ( proto icmp ) child ( siblist ( icmptype echo-request next ( icmptype echo-reply ) ) child ( accept ) ) ) ) ) ) filtergen-0.12.4/t/data/converter8.out0000644000175000017500000000104010051306767014502 00000000000000( siblist ( input eth0 ) child ( siblist ( dest foo ) child ( local child ( accept ) ) ) next ( siblist ( input eth0 ) child ( siblist ( dest foo ) child ( forward child ( accept ) ) ) next ( siblist ( input eth0 ) child ( siblist ( dest foo ) child ( oneway child ( accept ) ) ) ) ) ) filtergen-0.12.4/t/data/converter9.out0000644000175000017500000000157110062027731014505 00000000000000( siblist ( input eth0 ) child ( siblist ( source foo ) child ( siblist ( dest bar ) child ( subgroup "chain_0" ( siblist ( proto tcp ) child ( siblist ( dport echo next ( dport https next ( dport nntp ) ) ) child ( accept ) ) next ( siblist ( proto tcp ) child ( siblist ( sport 1:1023 ) child ( siblist ( dport ssh ) child ( accept ) ) ) ) ) ) ) ) ) filtergen-0.12.4/t/data/emitter10.out0000644000175000017500000000045210051306762014216 00000000000000dport { 1 }; dport { foo }; dport { 1:1024 }; dport { foo:bar }; dport { 1:bar }; dport { foo:1024 }; sport { 1 }; sport { foo }; sport { 1:1024 }; sport { foo:bar }; sport { 1:bar }; sport { foo:1024 }; dport { 1 foo 1:1024 foo:bar 1:bar foo:1024 }; sport { 1 foo 1:1024 foo:bar 1:bar foo:1024 }; filtergen-0.12.4/t/data/emitter11.out0000644000175000017500000000006310051306762014215 00000000000000proto { tcp }; proto { tcp udp icmp }; proto { }; filtergen-0.12.4/t/data/emitter12.out0000644000175000017500000000012610051306762014216 00000000000000icmptype { echo-request }; icmptype { echo-request port-unreachable }; icmptype { }; filtergen-0.12.4/t/data/emitter13.out0000644000175000017500000000003010051306767014216 00000000000000local; forward; oneway; filtergen-0.12.4/t/data/emitter14.out0000644000175000017500000000011310051306762014214 00000000000000{}; {proto { tcp }}; {proto { tcp }; accept; icmptype { echo-request }; }; filtergen-0.12.4/t/data/emitter15.out0000644000175000017500000000025410051306762014223 00000000000000[ ]; [ proto { tcp }]; [ accept; reject; ]; [ "foo" ]; [ "foo" proto { tcp }; ]; [ "foo" accept; reject; ]; [ "foo" ]; [ "foo" proto { tcp }; ]; [ "foo" accept; reject; ]; filtergen-0.12.4/t/data/emitter1.out0000644000175000017500000000000010051306743014122 00000000000000filtergen-0.12.4/t/data/emitter2.out0000644000175000017500000000000210051306743014125 00000000000000; filtergen-0.12.4/t/data/emitter3.out0000644000175000017500000000001610051306744014134 00000000000000accept; drop; filtergen-0.12.4/t/data/emitter4.out0000644000175000017500000000003510051306762014136 00000000000000input { eth0 } accept; drop; filtergen-0.12.4/t/data/emitter5.out0000644000175000017500000000027410051306762014144 00000000000000input { eth0 }; output { ppp0 }; dest { foo }; source { bar }; dport { 0 }; sport { 1 }; icmptype { echo-request }; accept; reject; drop; redirect; masq; local; forward; log text "pants"; filtergen-0.12.4/t/data/emitter6.out0000644000175000017500000000007610051306762014145 00000000000000dest { foo }; ! dest { foo }; sport { bar }; ! sport { bar }; filtergen-0.12.4/t/data/emitter7.out0000644000175000017500000000010310051306762014135 00000000000000input { eth0 }; output { ppp0 }; input { ppp0 eth0 }; output { }; filtergen-0.12.4/t/data/emitter8.out0000644000175000017500000000024610051306745014147 00000000000000accept; drop; reject; masq; redirect; log drop; log text "invalid - " drop; log text "accept" accept; log text "blurble" reject; log text "foo"; log text "bar"; log; filtergen-0.12.4/t/data/emitter9.out0000644000175000017500000000126610051306762014152 00000000000000source { foo }; source { foo/32 }; source { foo/255.0 }; source { foo/255.255.0 }; source { foo/255.255.255.0 }; source { 127.0.0.1 }; source { 127.0.0.1/24 }; source { 127.0.0.1/255.255 }; source { 127.0.0.1/255.255.0 }; source { 127.0.0.1/255.255.255.255 }; dest { foo }; dest { foo/32 }; dest { foo/255.0 }; dest { foo/255.255.0 }; dest { foo/255.255.255.0 }; dest { 127.0.0.1 }; dest { 127.0.0.1/24 }; dest { 127.0.0.1/255.255 }; dest { 127.0.0.1/255.255.0 }; dest { 127.0.0.1/255.255.255.255 }; dest { foo foo/32 foo/255.0 foo/255.255.255.0 127.0.0.1 127.0.0.1/24 127.0.0.1/255.255.255.0 }; source { foo foo/32 foo/255.0 foo/255.255.255.0 127.0.0.1 127.0.0.1/24 127.0.0.1/255.255.255.0 }; filtergen-0.12.4/t/data/example1.out0000644000175000017500000000000010051306741014102 00000000000000filtergen-0.12.4/t/data/parser10.out0000644000175000017500000000000010051306740014022 00000000000000filtergen-0.12.4/t/data/parser11.out0000644000175000017500000000000010051306740014023 00000000000000filtergen-0.12.4/t/data/parser12.out0000644000175000017500000000000010051306740014024 00000000000000filtergen-0.12.4/t/data/parser13.out0000644000175000017500000000000010051306740014025 00000000000000filtergen-0.12.4/t/data/parser14.out0000644000175000017500000000000010051306741014027 00000000000000filtergen-0.12.4/t/data/parser15.out0000644000175000017500000000000010051306744014033 00000000000000filtergen-0.12.4/t/data/parser16.out0000644000175000017500000000000010051306742014032 00000000000000filtergen-0.12.4/t/data/parser1.out0000644000175000017500000000000010051306735013746 00000000000000filtergen-0.12.4/t/data/parser2.out0000644000175000017500000000000010051306735013747 00000000000000filtergen-0.12.4/t/data/parser3.out0000644000175000017500000000000010051306735013750 00000000000000filtergen-0.12.4/t/data/parser4.out0000644000175000017500000000000010051306736013752 00000000000000filtergen-0.12.4/t/data/parser5.out0000644000175000017500000000000010051306736013753 00000000000000filtergen-0.12.4/t/data/parser6.out0000644000175000017500000000000010051306736013754 00000000000000filtergen-0.12.4/t/data/parser7.out0000644000175000017500000000000010051306736013755 00000000000000filtergen-0.12.4/t/data/parser8.out0000644000175000017500000000000010051306736013756 00000000000000filtergen-0.12.4/t/data/parser9.out0000644000175000017500000000000010051306737013760 00000000000000filtergen-0.12.4/t/data/scanner10.out0000644000175000017500000000000010051306732014160 00000000000000filtergen-0.12.4/t/data/scanner11.out0000644000175000017500000000057310051306752014202 00000000000000kind = identifier, spelling = "foo", file = "data/scanner7.in", line = 2 kind = identifier, spelling = "bar", file = "data/scanner7.in", line = 3 kind = identifier, spelling = "baz", file = "data/scanner7.in", line = 4 kind = identifier, spelling = "quux", file = "data/scanner7.in", line = 5 kind = identifier, spelling = "mail.example.com", file = "data/scanner7.in", line = 6 filtergen-0.12.4/t/data/scanner12.out0000644000175000017500000000020010051306734014166 00000000000000data/scanner12.in:1: warning: too many nested includes data/scanner12.in:1: warning: skipping include of file data/scanner12.in filtergen-0.12.4/t/data/scanner13.out0000644000175000017500000000224010051306752014175 00000000000000kind = input, spelling = "input", file = "(standard input)", line = 2 kind = identifier, spelling = "foo", file = "data/scanner7.in", line = 2 kind = identifier, spelling = "bar", file = "data/scanner7.in", line = 3 kind = identifier, spelling = "baz", file = "data/scanner7.in", line = 4 kind = identifier, spelling = "quux", file = "data/scanner7.in", line = 5 kind = identifier, spelling = "mail.example.com", file = "data/scanner7.in", line = 6 kind = accept, spelling = "accept", file = "(standard input)", line = 4 kind = semicolon, spelling = ";", file = "(standard input)", line = 5 kind = output, spelling = "output", file = "(standard input)", line = 6 kind = identifier, spelling = "foo", file = "data/scanner7.in", line = 2 kind = identifier, spelling = "bar", file = "data/scanner7.in", line = 3 kind = identifier, spelling = "baz", file = "data/scanner7.in", line = 4 kind = identifier, spelling = "quux", file = "data/scanner7.in", line = 5 kind = identifier, spelling = "mail.example.com", file = "data/scanner7.in", line = 6 kind = accept, spelling = "accept", file = "(standard input)", line = 8 kind = semicolon, spelling = ";", file = "(standard input)", line = 8 filtergen-0.12.4/t/data/scanner14.out0000644000175000017500000000224010051306752014176 00000000000000kind = input, spelling = "input", file = "(standard input)", line = 2 kind = identifier, spelling = "foo", file = "data/scanner7.in", line = 2 kind = identifier, spelling = "bar", file = "data/scanner7.in", line = 3 kind = identifier, spelling = "baz", file = "data/scanner7.in", line = 4 kind = identifier, spelling = "quux", file = "data/scanner7.in", line = 5 kind = identifier, spelling = "mail.example.com", file = "data/scanner7.in", line = 6 kind = accept, spelling = "accept", file = "(standard input)", line = 2 kind = semicolon, spelling = ";", file = "(standard input)", line = 2 kind = output, spelling = "output", file = "(standard input)", line = 3 kind = identifier, spelling = "foo", file = "data/scanner7.in", line = 2 kind = identifier, spelling = "bar", file = "data/scanner7.in", line = 3 kind = identifier, spelling = "baz", file = "data/scanner7.in", line = 4 kind = identifier, spelling = "quux", file = "data/scanner7.in", line = 5 kind = identifier, spelling = "mail.example.com", file = "data/scanner7.in", line = 6 kind = accept, spelling = "accept", file = "(standard input)", line = 3 kind = semicolon, spelling = ";", file = "(standard input)", line = 3 filtergen-0.12.4/t/data/scanner15.out0000644000175000017500000000012710074643763014214 00000000000000(standard input):1: warning: stat failed on nonexistentfile: No such file or directory filtergen-0.12.4/t/data/scanner16.out0000644000175000017500000000006010051306741014174 00000000000000(standard input):3: comment reached end of file filtergen-0.12.4/t/data/scanner1.out0000644000175000017500000000000010051306732014100 00000000000000filtergen-0.12.4/t/data/scanner2.out0000644000175000017500000000000010051306732014101 00000000000000filtergen-0.12.4/t/data/scanner3.out0000644000175000017500000000000010051306732014102 00000000000000filtergen-0.12.4/t/data/scanner4.out0000644000175000017500000000251210051306767014125 00000000000000kind = accept, spelling = "accept", file = "(standard input)", line = 1 kind = dest, spelling = "dest", file = "(standard input)", line = 2 kind = dport, spelling = "dport", file = "(standard input)", line = 3 kind = drop, spelling = "drop", file = "(standard input)", line = 4 kind = forward, spelling = "forward", file = "(standard input)", line = 5 kind = icmptype, spelling = "icmptype", file = "(standard input)", line = 6 kind = input, spelling = "input", file = "(standard input)", line = 7 kind = local, spelling = "local", file = "(standard input)", line = 8 kind = log, spelling = "log", file = "(standard input)", line = 9 kind = masq, spelling = "masq", file = "(standard input)", line = 10 kind = oneway, spelling = "oneway", file = "(standard input)", line = 11 kind = output, spelling = "output", file = "(standard input)", line = 12 kind = proto, spelling = "proto", file = "(standard input)", line = 13 kind = proxy, spelling = "proxy", file = "(standard input)", line = 14 kind = redirect, spelling = "redirect", file = "(standard input)", line = 15 kind = reject, spelling = "reject", file = "(standard input)", line = 16 kind = source, spelling = "source", file = "(standard input)", line = 17 kind = sport, spelling = "sport", file = "(standard input)", line = 18 kind = text, spelling = "text", file = "(standard input)", line = 19 filtergen-0.12.4/t/data/scanner5.out0000644000175000017500000000103110051306752014113 00000000000000kind = lcurly, spelling = "{", file = "(standard input)", line = 1 kind = rcurly, spelling = "}", file = "(standard input)", line = 2 kind = lsquare, spelling = "[", file = "(standard input)", line = 3 kind = rsquare, spelling = "]", file = "(standard input)", line = 4 kind = semicolon, spelling = ";", file = "(standard input)", line = 5 kind = slash, spelling = "/", file = "(standard input)", line = 6 kind = colon, spelling = ":", file = "(standard input)", line = 7 kind = bang, spelling = "!", file = "(standard input)", line = 8 filtergen-0.12.4/t/data/scanner6.out0000644000175000017500000000033110051306752014116 00000000000000kind = identifier, spelling = "37", file = "(standard input)", line = 2 kind = identifier, spelling = "69", file = "(standard input)", line = 3 kind = identifier, spelling = "255", file = "(standard input)", line = 4 filtergen-0.12.4/t/data/scanner7.out0000644000175000017500000000057310051306752014127 00000000000000kind = identifier, spelling = "foo", file = "(standard input)", line = 2 kind = identifier, spelling = "bar", file = "(standard input)", line = 3 kind = identifier, spelling = "baz", file = "(standard input)", line = 4 kind = identifier, spelling = "quux", file = "(standard input)", line = 5 kind = identifier, spelling = "mail.example.com", file = "(standard input)", line = 6 filtergen-0.12.4/t/data/scanner8.out0000644000175000017500000000146010051306752014124 00000000000000kind = identifier, spelling = "0.0.0.0", file = "(standard input)", line = 2 kind = identifier, spelling = "127.0.0.1", file = "(standard input)", line = 3 kind = slash, spelling = "/", file = "(standard input)", line = 3 kind = identifier, spelling = "255.255.255.255", file = "(standard input)", line = 3 kind = identifier, spelling = "http", file = "(standard input)", line = 4 kind = identifier, spelling = "bar", file = "(standard input)", line = 5 kind = slash, spelling = "/", file = "(standard input)", line = 5 kind = identifier, spelling = "29", file = "(standard input)", line = 5 kind = identifier, spelling = "bar", file = "(standard input)", line = 6 kind = slash, spelling = "/", file = "(standard input)", line = 6 kind = identifier, spelling = "255.255.255.248", file = "(standard input)", line = 6 filtergen-0.12.4/t/data/scanner9.out0000644000175000017500000000043510051306735014127 00000000000000kind = UNRECOGNISED, spelling = "*", file = "(standard input)", line = 1 kind = UNRECOGNISED, spelling = "*", file = "(standard input)", line = 1 kind = UNRECOGNISED, spelling = "*", file = "(standard input)", line = 1 kind = slash, spelling = "/", file = "(standard input)", line = 1 filtergen-0.12.4/t/Makefile.am0000644000175000017500000000361310110541720012767 00000000000000TESTS = t_01_ccomment \ t_02_hashcomment \ t_03_hashnonewline \ t_04_keywords \ t_05_punct \ t_06_numbers \ t_07_names \ t_08_networknames \ t_09_badcomment \ t_10_goodcomment \ t_11_includeone \ t_12_includeloop \ t_13_includetwo \ t_14_includeinline \ t_15_includenotfound \ t_16_emptyfilter \ t_17_oneemptyrule \ t_18_manyemptyrules \ t_19_simplerule \ t_20_fullrule \ t_21_compoundarg \ t_22_hostnames \ t_23_ports \ t_24_log \ t_25_target \ t_26_negation \ t_27_compoundspecifier \ t_28_routing \ t_29_nocommentend \ t_30_chaingroup \ t_31_chaingroupbad \ t_32_syntaxexamples \ t_33_nestedparse \ t_34_ast \ t_35_rule_list \ t_36_rule \ t_37_specifier_list \ t_38_specifier \ t_39_negated_specifier \ t_40_direction \ t_41_target \ t_42_host \ t_43_port \ t_44_protocol \ t_45_icmptype \ t_46_routing \ t_47_subrule_list \ t_48_chaingroup \ t_49_convertspeclist \ t_50_convertrulelist \ t_51_convertdirection \ t_52_converthost \ t_53_convertproto \ t_54_convertport \ t_55_converticmptype \ t_56_convertrouting \ t_57_convertchains \ t_58_convertcompound \ t_59_convertnested \ t_60_bigugly \ t_61_convertlog \ t_62_convertoptions \ t_63_includedir \ t_64_includedirwfile \ t_65_includedirwdir \ t_66_includedirtwofiles \ t_67_includeemptyfile \ t_68_noop \ t_69_includeemptynoop \ t_70_includesemicolon check_PROGRAMS = scan parse emit convert factorise scan_SOURCES = scan.c scan_LDADD = ../scanner.o ../parser.o parse_SOURCES = parse.c parse_LDADD = ../scanner.o ../parser.o emit_SOURCES = emit.c emit_LDADD = ../scanner.o ../parser.o convert_SOURCES = convert.c convert_LDADD = ../scanner.o ../parser.o ../glue.o ../filter.o ../fg-util.o factorise_SOURCES = factorise.c factorise_LDADD = ../scanner.o ../parser.o EXTRA_DIST = $(top_srcdir)/t/data/*.in $(top_srcdir)/t/data/*.out \ testlib $(TESTS) AM_CFLAGS = -g -Wall -Werror -I$(top_srcdir) filtergen-0.12.4/t/Makefile.in0000644000175000017500000004233710110551017013006 00000000000000# Makefile.in generated by automake 1.8.5 from Makefile.am. # @configure_input@ # 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@ SOURCES = $(convert_SOURCES) $(emit_SOURCES) $(factorise_SOURCES) $(parse_SOURCES) $(scan_SOURCES) srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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 = : check_PROGRAMS = scan$(EXEEXT) parse$(EXEEXT) emit$(EXEEXT) \ convert$(EXEEXT) factorise$(EXEEXT) subdir = t DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(mkdir_p) CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = am_convert_OBJECTS = convert.$(OBJEXT) convert_OBJECTS = $(am_convert_OBJECTS) convert_DEPENDENCIES = ../scanner.o ../parser.o ../glue.o ../filter.o \ ../fg-util.o am_emit_OBJECTS = emit.$(OBJEXT) emit_OBJECTS = $(am_emit_OBJECTS) emit_DEPENDENCIES = ../scanner.o ../parser.o am_factorise_OBJECTS = factorise.$(OBJEXT) factorise_OBJECTS = $(am_factorise_OBJECTS) factorise_DEPENDENCIES = ../scanner.o ../parser.o am_parse_OBJECTS = parse.$(OBJEXT) parse_OBJECTS = $(am_parse_OBJECTS) parse_DEPENDENCIES = ../scanner.o ../parser.o am_scan_OBJECTS = scan.$(OBJEXT) scan_OBJECTS = $(am_scan_OBJECTS) scan_DEPENDENCIES = ../scanner.o ../parser.o DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/convert.Po ./$(DEPDIR)/emit.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/factorise.Po ./$(DEPDIR)/parse.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/scan.Po COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(convert_SOURCES) $(emit_SOURCES) $(factorise_SOURCES) \ $(parse_SOURCES) $(scan_SOURCES) DIST_SOURCES = $(convert_SOURCES) $(emit_SOURCES) $(factorise_SOURCES) \ $(parse_SOURCES) $(scan_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GETOPT_LIBS = @GETOPT_LIBS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PROGRAM = @PROGRAM@ SBINDIR = @SBINDIR@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SYSCONFDIR = @SYSCONFDIR@ VERSION = @VERSION@ YACC = @YACC@ ac_ct_CC = @ac_ct_CC@ ac_ct_STRIP = @ac_ct_STRIP@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ bindir = @bindir@ build_alias = @build_alias@ datadir = @datadir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pkgdocdir = @pkgdocdir@ pkgexdir = @pkgexdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ TESTS = t_01_ccomment \ t_02_hashcomment \ t_03_hashnonewline \ t_04_keywords \ t_05_punct \ t_06_numbers \ t_07_names \ t_08_networknames \ t_09_badcomment \ t_10_goodcomment \ t_11_includeone \ t_12_includeloop \ t_13_includetwo \ t_14_includeinline \ t_15_includenotfound \ t_16_emptyfilter \ t_17_oneemptyrule \ t_18_manyemptyrules \ t_19_simplerule \ t_20_fullrule \ t_21_compoundarg \ t_22_hostnames \ t_23_ports \ t_24_log \ t_25_target \ t_26_negation \ t_27_compoundspecifier \ t_28_routing \ t_29_nocommentend \ t_30_chaingroup \ t_31_chaingroupbad \ t_32_syntaxexamples \ t_33_nestedparse \ t_34_ast \ t_35_rule_list \ t_36_rule \ t_37_specifier_list \ t_38_specifier \ t_39_negated_specifier \ t_40_direction \ t_41_target \ t_42_host \ t_43_port \ t_44_protocol \ t_45_icmptype \ t_46_routing \ t_47_subrule_list \ t_48_chaingroup \ t_49_convertspeclist \ t_50_convertrulelist \ t_51_convertdirection \ t_52_converthost \ t_53_convertproto \ t_54_convertport \ t_55_converticmptype \ t_56_convertrouting \ t_57_convertchains \ t_58_convertcompound \ t_59_convertnested \ t_60_bigugly \ t_61_convertlog \ t_62_convertoptions \ t_63_includedir \ t_64_includedirwfile \ t_65_includedirwdir \ t_66_includedirtwofiles \ t_67_includeemptyfile \ t_68_noop \ t_69_includeemptynoop \ t_70_includesemicolon scan_SOURCES = scan.c scan_LDADD = ../scanner.o ../parser.o parse_SOURCES = parse.c parse_LDADD = ../scanner.o ../parser.o emit_SOURCES = emit.c emit_LDADD = ../scanner.o ../parser.o convert_SOURCES = convert.c convert_LDADD = ../scanner.o ../parser.o ../glue.o ../filter.o ../fg-util.o factorise_SOURCES = factorise.c factorise_LDADD = ../scanner.o ../parser.o EXTRA_DIST = $(top_srcdir)/t/data/*.in $(top_srcdir)/t/data/*.out \ testlib $(TESTS) AM_CFLAGS = -g -Wall -Werror -I$(top_srcdir) all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(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) --foreign t/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign t/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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh clean-checkPROGRAMS: -test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS) convert$(EXEEXT): $(convert_OBJECTS) $(convert_DEPENDENCIES) @rm -f convert$(EXEEXT) $(LINK) $(convert_LDFLAGS) $(convert_OBJECTS) $(convert_LDADD) $(LIBS) emit$(EXEEXT): $(emit_OBJECTS) $(emit_DEPENDENCIES) @rm -f emit$(EXEEXT) $(LINK) $(emit_LDFLAGS) $(emit_OBJECTS) $(emit_LDADD) $(LIBS) factorise$(EXEEXT): $(factorise_OBJECTS) $(factorise_DEPENDENCIES) @rm -f factorise$(EXEEXT) $(LINK) $(factorise_LDFLAGS) $(factorise_OBJECTS) $(factorise_LDADD) $(LIBS) parse$(EXEEXT): $(parse_OBJECTS) $(parse_DEPENDENCIES) @rm -f parse$(EXEEXT) $(LINK) $(parse_LDFLAGS) $(parse_OBJECTS) $(parse_LDADD) $(LIBS) scan$(EXEEXT): $(scan_OBJECTS) $(scan_DEPENDENCIES) @rm -f scan$(EXEEXT) $(LINK) $(scan_LDFLAGS) $(scan_OBJECTS) $(scan_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/convert.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/emit.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/factorise.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parse.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scan.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` uninstall-info-am: ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags check-TESTS: $(TESTS) @failed=0; all=0; xfail=0; xpass=0; skip=0; \ srcdir=$(srcdir); export srcdir; \ list='$(TESTS)'; \ if test -n "$$list"; then \ for tst in $$list; do \ if test -f ./$$tst; then dir=./; \ elif test -f $$tst; then dir=; \ else dir="$(srcdir)/"; fi; \ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *" $$tst "*) \ xpass=`expr $$xpass + 1`; \ failed=`expr $$failed + 1`; \ echo "XPASS: $$tst"; \ ;; \ *) \ echo "PASS: $$tst"; \ ;; \ esac; \ elif test $$? -ne 77; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *" $$tst "*) \ xfail=`expr $$xfail + 1`; \ echo "XFAIL: $$tst"; \ ;; \ *) \ failed=`expr $$failed + 1`; \ echo "FAIL: $$tst"; \ ;; \ esac; \ else \ skip=`expr $$skip + 1`; \ echo "SKIP: $$tst"; \ fi; \ done; \ if test "$$failed" -eq 0; then \ if test "$$xfail" -eq 0; then \ banner="All $$all tests passed"; \ else \ banner="All $$all tests behaved as expected ($$xfail expected failures)"; \ fi; \ else \ if test "$$xpass" -eq 0; then \ banner="$$failed of $$all tests failed"; \ else \ banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \ fi; \ fi; \ dashes="$$banner"; \ skipped=""; \ if test "$$skip" -ne 0; then \ skipped="($$skip tests were not run)"; \ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$skipped"; \ fi; \ report=""; \ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ report="Please report to $(PACKAGE_BUGREPORT)"; \ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$report"; \ fi; \ dashes=`echo "$$dashes" | sed s/./=/g`; \ echo "$$dashes"; \ echo "$$banner"; \ test -z "$$skipped" || echo "$$skipped"; \ test -z "$$report" || echo "$$report"; \ echo "$$dashes"; \ test "$$failed" -eq 0; \ else :; fi distdir: $(DISTFILES) $(mkdir_p) $(distdir)/$(top_srcdir)/t/data @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 $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS 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-checkPROGRAMS clean-generic mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags 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 -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-info-am .PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ clean-checkPROGRAMS clean-generic ctags distclean \ distclean-compile distclean-generic distclean-tags 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-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags 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: filtergen-0.12.4/t/convert.c0000644000175000017500000000714110051306770012567 00000000000000#include #include "stdlib.h" #include "../filter.h" #include "../ast.h" int indent = -2; #ifndef FILTER_EMIT extern int convtrace; int yyparse(void *); struct filter * convert(struct ast_s *); #endif void emit_filter(struct filter * f) { int i; indent+=2; for (i = 0; i < indent; i++) { printf(" "); }; printf("( "); if (!f) { printf("error: emit_filter called with NULL\n"); return; } switch (f->type) { case F_DIRECTION: switch (f->u.ifinfo.direction) { case INPUT: printf("input"); break; case OUTPUT: printf("output"); break; default: printf("error: encountered a direction %d\n", (int) f->u.ifinfo.direction); break; } printf(" %s\n", f->u.ifinfo.iface); break; case F_TARGET: switch(f->u.target) { case T_ACCEPT: printf("accept\n"); break; case DROP: printf("drop\n"); break; case T_REJECT: printf("reject\n"); break; case MASQ: printf("masq\n"); break; case REDIRECT: printf("redirect\n"); break; default: printf("error: encountered a target %d\n", (int) f->u.target); break; } break; case F_SOURCE: printf("source %s", f->u.addrs.addrstr); if (f->u.addrs.maskstr) printf("/%s", f->u.addrs.maskstr); printf("\n"); break; case F_DEST: printf("dest %s", f->u.addrs.addrstr); if (f->u.addrs.maskstr) printf("/%s", f->u.addrs.maskstr); printf("\n"); break; case F_SPORT: printf("sport %s", f->u.ports.minstr); if (f->u.ports.maxstr) printf(":%s", f->u.ports.maxstr); printf("\n"); break; case F_DPORT: printf("dport %s", f->u.ports.minstr); if (f->u.ports.maxstr) printf(":%s", f->u.ports.maxstr); printf("\n"); break; case F_ICMPTYPE: printf("icmptype %s\n", f->u.icmp); break; case F_PROTO: printf("proto %s\n", f->u.proto.name); break; case F_NEG: printf("neg\n"); emit_filter(f->u.neg); break; case F_SIBLIST: printf("siblist\n"); emit_filter(f->u.sib); break; case F_SUBGROUP: printf("subgroup \"%s\"\n", f->u.sub.name); emit_filter(f->u.sub.list); break; case F_LOG: if (f->u.logmsg) { printf("log \"%s\"\n", f->u.logmsg); } else { printf("log \"\"\n"); } break; case F_RTYPE: switch (f->u.rtype) { case ROUTEDONLY: printf("forward\n"); break; case LOCALONLY: printf("local\n"); break; case F_ONEWAY: printf("oneway\n"); break; default: printf("error: encountered a rtype %d\n", (int) f->u.rtype); break; } break; default: printf("error: encountered a token %d\n", (int) f->type); break; } if (f->child) { for (i = 0; i < indent; i++) printf(" "); printf(" child\n"); emit_filter(f->child); } if (f->next) { for (i = 0; i < indent; i++) printf(" "); printf(" next\n"); emit_filter(f->next); } /* for (i = 0; i < indent; i++) printf(" "); printf(" negate: %d\n", f->negate); */ for (i = 0; i < indent; i++) printf(" "); printf(" )\n"); indent -= 2; } int main(int argc __attribute__((unused)), char ** argv __attribute__((unused))) { struct filter * f = NULL; #ifndef FILTER_EMIT char * CONVTRACE; struct ast_s ast; int r; CONVTRACE = getenv("CONVTRACE"); convtrace = CONVTRACE ? atoi(CONVTRACE) : 0; r = yyparse((void *) &ast); if (r != 0) { printf("yyparse returned %d\n", r); return 1; } f = convert(&ast); #else filter_fopen(NULL); f = filter_parse_list(); #endif if (!f) { printf("convert returned NULL\n"); return 1; } emit_filter(f); return 0; } filtergen-0.12.4/t/emit.c0000644000175000017500000001456610051306770012056 00000000000000/* ast emitter * output should be identical (syntactically) to the input */ #include #include #include "../ast.h" #include "../parser.h" int yyparse(void *); int emittrace = 0; #define EMIT(x) void emit_##x(struct x##_s * n) #define eprint(x) if (emittrace) fprintf(stderr, x) EMIT(specifier_list); EMIT(subrule_list) { if (n->subrule_list) { eprint("emitting subrule_list\n"); emit_subrule_list(n->subrule_list); printf(";\n"); } if (n->specifier_list) { eprint("emitting specifier_list\n"); emit_specifier_list(n->specifier_list); } } EMIT(chaingroup_specifier) { printf("["); if (n->name) { printf(" \"%s\"", n->name); } printf("\n"); eprint("emitting subrule_list\n"); emit_subrule_list(n->list); printf("]"); } EMIT(compound_specifier) { printf("{"); if (n->list) { eprint("emitting subrule_list\n"); emit_subrule_list(n->list); } printf("}"); } EMIT(option_specifier) { switch (n->type) { case TOK_LOCAL: printf("local"); break; case TOK_FORWARD: printf("forward"); break; case TOK_ONEWAY: printf("oneway"); break; case TOK_LOG: if (n->logmsg) { printf("log text \"%s\"", n->logmsg); } else { printf("log"); } break; default: printf("error"); break; } } EMIT(icmptype_argument) { printf("%s", n->icmptype); } EMIT(icmptype_argument_list) { if (n->list) { emit_icmptype_argument_list(n->list); printf(" "); } emit_icmptype_argument(n->arg); } EMIT(icmptype_specifier) { printf("icmptype { "); if (n->list) emit_icmptype_argument_list(n->list); printf(" }"); } EMIT(protocol_argument) { printf("%s", n->proto); } EMIT(protocol_argument_list) { if (n->list) { eprint("emitting protocol_argument_list\n"); emit_protocol_argument_list(n->list); printf(" "); } eprint("emitting protocol_argument\n"); emit_protocol_argument(n->arg); } EMIT(protocol_specifier) { printf("proto { "); if (n->list) { eprint("emitting protocol_argument\n"); emit_protocol_argument_list(n->list); } printf(" }"); } EMIT(port_argument) { if (n->port_min) { printf("%s", n->port_min); } if (n->port_max) { printf(":%s", n->port_max); } } EMIT(port_argument_list) { if (n->list) { eprint("emitting port_argument_list\n"); emit_port_argument_list(n->list); printf(" "); } eprint("emitting port_argument\n"); emit_port_argument(n->arg); } EMIT(port_specifier) { if (n->type == TOK_DPORT) { printf("dport "); } else if (n->type == TOK_SPORT) { printf("sport "); } printf("{ "); if (n->list) emit_port_argument_list(n->list); printf(" }"); } EMIT(host_argument) { if (n->host) { printf("%s", n->host); } if (n->mask) { printf("/%s", n->mask); } } EMIT(host_argument_list) { if (n->list) { emit_host_argument_list(n->list); printf(" "); } emit_host_argument(n->arg); } EMIT(host_specifier) { if (n->type == TOK_SOURCE) { printf("source "); } else if (n->type == TOK_DEST) { printf("dest "); } printf("{ "); if (n->list) emit_host_argument_list(n->list); printf(" }"); } EMIT(target_specifier) { switch (n->type) { case TOK_ACCEPT: printf("accept"); break; case TOK_REJECT: printf("reject"); break; case TOK_DROP: printf("drop"); break; case TOK_REDIRECT: printf("redirect"); break; case TOK_MASQ: printf("masq"); break; break; default: printf("error"); break; } } EMIT(direction_argument) { eprint("emitting direction\n"); if (n->direction) printf("%s", n->direction); else printf("error: n->direction is NULL\n"); } EMIT(direction_argument_list) { if (n->list) { eprint("emitting direction_argument_list\n"); emit_direction_argument_list(n->list); printf(" "); } if (n->arg) { eprint("emitting direction_argument\n"); emit_direction_argument(n->arg); } } EMIT(direction_specifier) { if (n->type == TOK_INPUT) { printf("input "); } else { printf("output "); } printf("{ "); if (n->list) { eprint("emitting direction_argument\n"); emit_direction_argument_list(n->list); } printf(" }"); } EMIT(specifier) { if (n->compound) { eprint("emitting compound_specifier\n"); emit_compound_specifier(n->compound); } else if (n->direction) { eprint("emitting direction_specifier\n"); emit_direction_specifier(n->direction); } else if (n->target) { eprint("emitting target_specifier\n"); emit_target_specifier(n->target); } else if (n->host) { eprint("emitting host_specifier\n"); emit_host_specifier(n->host); } else if (n->port) { eprint("emitting port_specifier\n"); emit_port_specifier(n->port); } else if (n->protocol) { eprint("emitting protocol_specifier\n"); emit_protocol_specifier(n->protocol); } else if (n->icmptype) { eprint("emitting icmptype_specifier\n"); emit_icmptype_specifier(n->icmptype); } else if (n->option) { eprint("emitting routing_specifier\n"); emit_option_specifier(n->option); } else { eprint("emitting chaingroup_specifier\n"); emit_chaingroup_specifier(n->chaingroup); } } EMIT(negated_specifier) { if (n->negated) { printf("! "); } eprint("emitting specifier\n"); emit_specifier(n->spec); } EMIT(specifier_list) { if (n->list) { eprint("emitting specifier_list\n"); emit_specifier_list(n->list); /* specifiers are separated by spaces */ printf(" "); } eprint("emitting negated_specifier\n"); emit_negated_specifier(n->spec); } EMIT(rule) { if (n->list) { eprint("emitting specifier_list\n"); emit_specifier_list(n->list); } /* rules end in a semicolon and newline */ printf(";\n"); } EMIT(rule_list) { if (n->list) { eprint("emitting rule_list\n"); emit_rule_list(n->list); } if (n->rule) { eprint("emitting rule\n"); emit_rule(n->rule); } } EMIT(ast) { if (n->list) { eprint("emitting rule_list\n"); emit_rule_list(n->list); } } int main(int argc __attribute__((unused)), char ** argv __attribute__((unused))) { char * EMITTRACE; struct ast_s ast; int res; EMITTRACE = getenv("EMITTRACE"); emittrace = EMITTRACE ? atoi(EMITTRACE) : 0; res = yyparse((void *)&ast); if (res != 0) { printf("yyparse returned %d\n", res); return 1; } eprint("emitting ast\n"); emit_ast(&ast); return 0; } filtergen-0.12.4/t/factorise.c0000644000175000017500000000750110051306770013066 00000000000000/* factorise test */ #include #include #include "../ast.h" #include "../factoriser.h" int yyparse(void *); int facttrace; int nesting = 0; void nest() { int i; for (i = 0; i < nesting; i++) printf(" "); printf("("); nesting++; } void unnest() { int i; for (i = 0; i < nesting; i++) printf(" "); printf(")\n"); nesting--; } void emit_negated_specifier(struct negated_specifier_s * n); void emit_compound_specifier(struct compound_specifier_s * n) { struct subrule_list_s * s; struct specifier_list_s * t; if (n->list) { int count = 0; for (s = n->list; s; s = s->subrule_list) count++; if (count > 1) { nest(); printf("or\n"); } for (s = n->list; s; s = s->subrule_list) { if (s->specifier_list) { int count0 = 0; for (t = s->specifier_list; t; t = t->list) count0++; if (count0 > 1) { nest(); printf("and\n"); } for (t = s->specifier_list; t; t = t->list) { if (t->spec) emit_negated_specifier(t->spec); } if (count0 > 1) unnest(); } } if (count > 1) unnest(); } } void emit_specifier(struct specifier_s * n) { if (n->direction) { if (n->direction->list) { struct direction_argument_list_s * l; int count = 0; for (l = n->direction->list; l; l = l->list) count++; if (count > 1) { nest(); printf("or\n"); } for (l = n->direction->list; l; l = l->list) { if (l->arg) { nest(); printf("direction %s\n", l->arg->direction); unnest(); } } if (count > 1) unnest(); } } else if (n->target) { nest(); printf("target\n"); unnest(); } else if (n->host) { if (n->host->list) { struct host_argument_list_s * l; int count = 0; for (l = n->host->list; l; l = l->list) count++; if (count > 1) { nest(); printf("or\n"); } for (l = n->host->list; l; l = l->list) { if (l->arg) { nest(); printf("host %s\n", l->arg->host); unnest(); } } if (count > 1) unnest(); } } else if (n->port) { nest(); printf("port\n"); unnest(); } else if (n->protocol) { nest(); printf("protocol\n"); unnest(); } else if (n->icmptype) { nest(); printf("icmptype\n"); unnest(); } else if (n->option) { nest(); printf("option\n"); unnest(); } else if (n->chaingroup) { nest(); printf("chaingroup FIXME\n"); unnest(); } else if (n->compound) { emit_compound_specifier(n->compound); } } void emit_negated_specifier(struct negated_specifier_s * n) { if (n->spec) { if (n->negated) { nest(); printf("not\n"); } emit_specifier(n->spec); if (n->negated) { unnest(); } } } void emit_rule(struct rule_s * n) { struct specifier_list_s * s; if (n->list) { int count = 0; for (s = n->list; s; s = s->list) count++; if (count > 1) { nest(); /* specifiers have implicit AND */ printf("and\n"); } for (s = n->list; s; s = s->list) { if (s->spec) { emit_negated_specifier(s->spec); } } if (count > 1) unnest(); } } void emit_ast(struct ast_s * n) { struct rule_list_s * r; if (n->list) { int count = 0; for (r = n->list; r; r = r->list) count++; if (count > 1) { nest(); /* semicolons are OR */ printf("or\n"); } for (r = n->list; r; r = r->list) { if (r->rule) { emit_rule(r->rule); } } if (count > 1) unnest(); } } int main(int argc __attribute__((unused)), char ** argv __attribute__((unused))) { char * FACTTRACE; struct ast_s ast; int r; FACTTRACE = getenv("FACTTRACE"); facttrace = FACTTRACE ? atoi(FACTTRACE) : 0; r = yyparse((void *) &ast); if (r != 0) { printf("yyparse returned %d\n", r); return 1; } /* do magic */ /* factorise(&ast); */ emit_ast(&ast); return 0; } filtergen-0.12.4/t/parse.c0000644000175000017500000000056210051306770012221 00000000000000#include #include "../ast.h" extern char * yytext; int yyparse(void *); extern int yydebug; int main(int argc __attribute__((unused)), char ** argv __attribute__((unused))) { char * YYDEBUGTRACE; struct ast_s ast; YYDEBUGTRACE = getenv("YYDEBUGTRACE"); yydebug = YYDEBUGTRACE ? atoi(YYDEBUGTRACE) : 0; yyparse(&ast); return 0; } filtergen-0.12.4/t/scan.c0000644000175000017500000000425610051306770012037 00000000000000#include #include #include #include #include "../parser.h" extern char * yytext; int yylex(); long int lineno(); char * filename(); char * tok_map(int c) { char * r; switch (c) { case TOK_ACCEPT: r = strdup("accept"); break; case TOK_DEST: r = strdup("dest"); break; case TOK_DPORT: r = strdup("dport"); break; case TOK_DROP: r = strdup("drop"); break; case TOK_FORWARD: r = strdup("forward"); break; case TOK_ICMPTYPE: r = strdup("icmptype"); break; case TOK_INPUT: r = strdup("input"); break; case TOK_LCURLY: r = strdup("lcurly"); break; case TOK_LOCAL: r = strdup("local"); break; case TOK_LOG: r = strdup("log"); break; case TOK_LSQUARE: r = strdup("lsquare"); break; case TOK_MASQ: r = strdup("masq"); break; case TOK_ONEWAY: r = strdup("oneway"); break; case TOK_OUTPUT: r = strdup("output"); break; case TOK_PROTO: r = strdup("proto"); break; case TOK_PROXY: r = strdup("proxy"); break; case TOK_RCURLY: r = strdup("rcurly"); break; case TOK_REDIRECT: r = strdup("redirect"); break; case TOK_REJECT: r = strdup("reject"); break; case TOK_RSQUARE: r = strdup("rsquare"); break; case TOK_SEMICOLON: r = strdup("semicolon"); break; case TOK_SOURCE: r = strdup("source"); break; case TOK_SPORT: r = strdup("sport"); break; case TOK_TEXT: r = strdup("text"); break; case TOK_IDENTIFIER: r = strdup("identifier"); break; case TOK_DOT: r = strdup("dot"); break; case TOK_SLASH: r = strdup("slash"); break; case TOK_BANG: r = strdup("bang"); break; case TOK_COLON: r = strdup("colon"); break; default: r = strdup("UNRECOGNISED"); break; } return r; } int main(int argc __attribute__((unused)), char ** argv __attribute__((unused))) { int c; /* if running in make distcheck the cwd isn't the same as the srcdir */ if (getenv("srcdir")) { chdir(getenv("srcdir")); } while ((c = yylex())) { printf("kind = %s, spelling = \"%s\", file = \"%s\", line = %ld\n", tok_map(c), yytext, filename(), lineno()); } return 0; } filtergen-0.12.4/t/testlib0000755000175000017500000000215610051306742012337 00000000000000# -*- sh -*- # source this file for a few useful functions that get repeated at the top # of every test here=`pwd` if test $? -ne 0 ; then exit 77 ; fi work=${TMP_DIR-/tmp}/filtergen-test-$$ pass () { set +x cd $here rm -rf $work exit 0 } fail () { set +x cd $here rm -rf $work echo "FAILED testing $TEST" exit 1 } no_result () { set +x cd $here rm -rf $work echo "NO RESULT when testing $TEST" #exit 77 exit 1 } trap no_result 1 2 3 15 # function for comparing files compare () { cmp "$1" "$2" >/dev/null 2>&1 case "$?" in 0) ;; 1) # only print diff if not run by automake test suite test "x$srcdir" = "x" && diff -u "$1" "$2" fail ;; *) no_result ;; esac } mkdir $work if test $? -ne 0 ; then no_result ; fi # srcdir gets defined by the automake test caller, assume it's not defined # by the user's environment, so set debug trace on when run manually test "x$srcdir" = "x" && set -x # fix testdir testdir=`pwd`/$testdir if test -d $testdir/t/data ; then echo "testlib error: testdir not in $testdir" fail fi filtergen-0.12.4/t/t_01_ccomment0000755000175000017500000000044310051306735013320 00000000000000#!/bin/sh TEST="that c style comments are scanned and ignored" testdir=`dirname $0` . $testdir/testlib ./scan < $testdir/data/scanner1.in > $work/out if test $? -ne 0 ; then no_result ; fi cmp $testdir/data/scanner1.out $work/out if test $? -ne 0 ; then fail ; fi # got this far? pass filtergen-0.12.4/t/t_02_hashcomment0000755000175000017500000000044610051306735014025 00000000000000#!/bin/sh TEST="that hash style comments are scanned and ignored" testdir=`dirname $0` . $testdir/testlib ./scan < $testdir/data/scanner2.in > $work/out if test $? -ne 0 ; then no_result ; fi cmp $testdir/data/scanner2.out $work/out if test $? -ne 0 ; then fail ; fi # got this far? pass filtergen-0.12.4/t/t_03_hashnonewline0000755000175000017500000000046610051306735014364 00000000000000#!/bin/sh TEST="that hash style comments with no newline are scanned and ignored" testdir=`dirname $0` . $testdir/testlib ./scan < $testdir/data/scanner3.in > $work/out if test $? -ne 0 ; then no_result ; fi cmp $testdir/data/scanner3.out $work/out if test $? -ne 0 ; then fail ; fi # got this far? pass filtergen-0.12.4/t/t_04_keywords0000755000175000017500000000052610051306735013367 00000000000000#!/bin/sh TEST="that filtergen keywords are scanned correctly" testdir=`dirname $0` . $testdir/testlib ./scan < $testdir/data/scanner4.in > $work/out if test $? -ne 0 ; then no_result ; fi cmp $testdir/data/scanner4.out $work/out if test $? -ne 0 ; then diff -u $testdir/data/scanner4.out $work/out fail fi # got this far? pass filtergen-0.12.4/t/t_05_punct0000755000175000017500000000052510051306735012651 00000000000000#!/bin/sh TEST="that filtergen punctuation scanned correctly" testdir=`dirname $0` . $testdir/testlib ./scan < $testdir/data/scanner5.in > $work/out if test $? -ne 0 ; then no_result ; fi cmp $testdir/data/scanner5.out $work/out if test $? -ne 0 ; then diff -u $testdir/data/scanner5.out $work/out fail fi # got this far? pass filtergen-0.12.4/t/t_06_numbers0000755000175000017500000000051310051306735013171 00000000000000#!/bin/sh TEST="that numbers are scanned correctly" testdir=`dirname $0` . $testdir/testlib ./scan < $testdir/data/scanner6.in > $work/out if test $? -ne 0 ; then no_result ; fi cmp $testdir/data/scanner6.out $work/out if test $? -ne 0 ; then diff -u $testdir/data/scanner6.out $work/out fail fi # got this far? pass filtergen-0.12.4/t/t_07_names0000755000175000017500000000053310051306735012624 00000000000000#!/bin/sh TEST="that non-keyword identifiers are scanned correctly" testdir=`dirname $0` . $testdir/testlib ./scan < $testdir/data/scanner7.in > $work/out if test $? -ne 0 ; then no_result ; fi cmp $testdir/data/scanner7.out $work/out if test $? -ne 0 ; then diff -u $testdir/data/scanner7.out $work/out fail fi # got this far? pass filtergen-0.12.4/t/t_08_networknames0000755000175000017500000000042110051306735014233 00000000000000#!/bin/sh TEST="that network addresses and services are scanned correctly" testdir=`dirname $0` . $testdir/testlib ./scan < $testdir/data/scanner8.in > $work/out if test $? -ne 0 ; then no_result ; fi compare $testdir/data/scanner8.out $work/out # got this far? pass filtergen-0.12.4/t/t_09_badcomment0000755000175000017500000000040510051306735013632 00000000000000#!/bin/sh TEST="that bad comments are scanned and flag errors" testdir=`dirname $0` . $testdir/testlib ./scan < $testdir/data/scanner9.in > $work/out if test $? -ne 0 ; then no_result ; fi compare $testdir/data/scanner9.out $work/out # got this far? pass filtergen-0.12.4/t/t_10_goodcomment0000755000175000017500000000042410051306735014025 00000000000000#!/bin/sh TEST="that c style comments with nested /* are scanned correctly" testdir=`dirname $0` . $testdir/testlib ./scan < $testdir/data/scanner10.in > $work/out if test $? -ne 0 ; then no_result ; fi compare $testdir/data/scanner10.out $work/out # got this far? pass filtergen-0.12.4/t/t_11_includeone0000755000175000017500000000040710051306735013641 00000000000000#!/bin/sh TEST="that c style comments are scanned and ignored" testdir=`dirname $0` . $testdir/testlib ./scan < $testdir/data/scanner11.in > $work/out if test $? -ne 0 ; then no_result ; fi compare $testdir/data/scanner11.out $work/out # got this far? pass filtergen-0.12.4/t/t_12_includeloop0000755000175000017500000000041410051306735014030 00000000000000#!/bin/sh TEST="that c style comments are scanned and ignored" testdir=`dirname $0` . $testdir/testlib ./scan < $testdir/data/scanner12.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/scanner12.out $work/out # got this far? pass filtergen-0.12.4/t/t_13_includetwo0000755000175000017500000000040610051306735013672 00000000000000#!/bin/sh TEST="that including more than one file works" testdir=`dirname $0` . $testdir/testlib ./scan < $testdir/data/scanner13.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/scanner13.out $work/out # got this far? pass filtergen-0.12.4/t/t_14_includeinline0000755000175000017500000000040610051306735014340 00000000000000#!/bin/sh TEST="that including more than one file works" testdir=`dirname $0` . $testdir/testlib ./scan < $testdir/data/scanner14.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/scanner14.out $work/out # got this far? pass filtergen-0.12.4/t/t_15_includenotfound0000755000175000017500000000043210110551002014677 00000000000000#!/bin/sh TEST="that including a non-existent file is handled correctly" testdir=`dirname $0` . $testdir/testlib $here/scan < $testdir/data/scanner15.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/scanner15.out $work/out # got this far? pass filtergen-0.12.4/t/t_16_emptyfilter0000755000175000017500000000040010051306742014054 00000000000000#!/bin/sh TEST="that parsing the empty program works" testdir=`dirname $0` . $testdir/testlib ./parse < $testdir/data/parser1.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/parser1.out $work/out # got this far? pass filtergen-0.12.4/t/t_17_oneemptyrule0000755000175000017500000000041710051306742014251 00000000000000#!/bin/sh TEST="that parsing a single empty rule works" DATA=parser2 testdir=`dirname $0` . $testdir/testlib ./parse < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.4/t/t_18_manyemptyrules0000755000175000017500000000042110051306742014613 00000000000000#!/bin/sh TEST="that parsing a list of empty rules works" DATA=parser3 testdir=`dirname $0` . $testdir/testlib ./parse < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.4/t/t_19_simplerule0000755000175000017500000000041110051306742013676 00000000000000#!/bin/sh TEST="that parsing a simple rule works" DATA=parser4 testdir=`dirname $0` . $testdir/testlib ./parse < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.4/t/t_20_fullrule0000755000175000017500000000042710051306742013346 00000000000000#!/bin/sh TEST="that parsing a full rule with specifiers works" DATA=parser5 testdir=`dirname $0` . $testdir/testlib ./parse < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.4/t/t_21_compoundarg0000755000175000017500000000044010051306742014026 00000000000000#!/bin/sh TEST="that parsing a rule with a compound port argument works" DATA=parser6 testdir=`dirname $0` . $testdir/testlib ./parse < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.4/t/t_22_hostnames0000755000175000017500000000043310051306742013514 00000000000000#!/bin/sh TEST="that parsing hostname and netmask variations works" DATA=parser7 testdir=`dirname $0` . $testdir/testlib ./parse < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.4/t/t_23_ports0000755000175000017500000000042110051306742012660 00000000000000#!/bin/sh TEST="that parsing ports and port ranges works" DATA=parser8 testdir=`dirname $0` . $testdir/testlib ./parse < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.4/t/t_24_log0000755000175000017500000000041510051306742012276 00000000000000#!/bin/sh TEST="that parsing the log directive works" DATA=parser9 testdir=`dirname $0` . $testdir/testlib ./parse < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.4/t/t_25_target0000755000175000017500000000041710051306742013006 00000000000000#!/bin/sh TEST="that parsing the filter targets works" DATA=parser10 testdir=`dirname $0` . $testdir/testlib ./parse < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.4/t/t_26_negation0000755000175000017500000000041610051306742013324 00000000000000#!/bin/sh TEST="that parsing negated specfiers works" DATA=parser11 testdir=`dirname $0` . $testdir/testlib ./parse < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.4/t/t_27_compoundspecifier0000755000175000017500000000041710051306742015240 00000000000000#!/bin/sh TEST="that parsing compound specfiers works" DATA=parser12 testdir=`dirname $0` . $testdir/testlib ./parse < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.4/t/t_28_routing0000755000175000017500000000041610051306742013211 00000000000000#!/bin/sh TEST="that parsing routing specfiers works" DATA=parser13 testdir=`dirname $0` . $testdir/testlib ./parse < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.4/t/t_29_nocommentend0000755000175000017500000000041610051306741014210 00000000000000#!/bin/sh TEST="that open ended comments are handled" DATA=scanner16 testdir=`dirname $0` . $testdir/testlib ./scan < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.4/t/t_30_chaingroup0000755000175000017500000000042510051306742013652 00000000000000#!/bin/sh TEST="that chained subgroups are parsed correctly" DATA=parser14 testdir=`dirname $0` . $testdir/testlib ./parse < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.4/t/t_31_chaingroupbad0000755000175000017500000000041510051306741014320 00000000000000#!/bin/sh TEST="that parsing bad chain groups fails" DATA=parser15 testdir=`dirname $0` . $testdir/testlib ./parse < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.4/t/t_32_syntaxexamples0000755000175000017500000000043710051306742014605 00000000000000#!/bin/sh TEST="that the examples from the filter_syntax(7) page work" DATA=example1 testdir=`dirname $0` . $testdir/testlib ./parse < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.4/t/t_33_nestedparse0000755000175000017500000000063110051306742014032 00000000000000#!/bin/sh TEST="that the parser can cope with included files" DATA=parser16 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi cat > include.conf < $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.4/t/t_34_ast0000755000175000017500000000074410051306743012313 00000000000000#!/bin/sh TEST="that the parser reads an ast correctly" DATA=emitter1 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi $here/emit < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # now see if the emitter is now idempotent $here/emit < $work/out > $work/out.out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $work/out $work/out.out # got this far? pass filtergen-0.12.4/t/t_35_rule_list0000755000175000017500000000075110051306743013525 00000000000000#!/bin/sh TEST="that the parser reads a rule list correctly" DATA=emitter2 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi $here/emit < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # now see if the emitter is now idempotent $here/emit < $work/out > $work/out.out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $work/out $work/out.out # got this far? pass filtergen-0.12.4/t/t_36_rule0000755000175000017500000000074410051306743012475 00000000000000#!/bin/sh TEST="that the parser reads a rule correctly" DATA=emitter3 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi $here/emit < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # now see if the emitter is now idempotent $here/emit < $work/out > $work/out.out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $work/out $work/out.out # got this far? pass filtergen-0.12.4/t/t_37_specifier_list0000755000175000017500000000075610051306743014536 00000000000000#!/bin/sh TEST="that the parser reads a specifier_list correctly" DATA=emitter4 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi $here/emit < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # now see if the emitter is now idempotent $here/emit < $work/out > $work/out.out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $work/out $work/out.out # got this far? pass filtergen-0.12.4/t/t_38_specifier0000755000175000017500000000074710051306744013505 00000000000000#!/bin/sh TEST="that the parser reads all the specifiers" DATA=emitter5 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi $here/emit < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # now see if the emitter is now idempotent $here/emit < $work/out > $work/out.out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $work/out $work/out.out # got this far? pass filtergen-0.12.4/t/t_39_negated_specifier0000755000175000017500000000074610051306744015174 00000000000000#!/bin/sh TEST="that the parser reads negated specifiers" DATA=emitter6 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi $here/emit < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # now see if the emitter is now idempotent $here/emit < $work/out > $work/out.out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $work/out $work/out.out # got this far? pass filtergen-0.12.4/t/t_40_direction0000755000175000017500000000075410051306745013504 00000000000000#!/bin/sh TEST="that the parser reads directions and arguments" DATA=emitter7 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi $here/emit < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # now see if the emitter is now idempotent $here/emit < $work/out > $work/out.out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $work/out $work/out.out # got this far? pass filtergen-0.12.4/t/t_41_target0000755000175000017500000000075110051306745013010 00000000000000#!/bin/sh TEST="that the parser reads targets and arguments" DATA=emitter8 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi $here/emit < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # now see if the emitter is now idempotent $here/emit < $work/out > $work/out.out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $work/out $work/out.out # got this far? pass filtergen-0.12.4/t/t_42_host0000755000175000017500000000075010051306745012477 00000000000000#!/bin/sh TEST="that the parser reads ghosts and arguments" DATA=emitter9 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi $here/emit < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # now see if the emitter is now idempotent $here/emit < $work/out > $work/out.out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $work/out $work/out.out # got this far? pass filtergen-0.12.4/t/t_43_port0000755000175000017500000000075510051306745012514 00000000000000#!/bin/sh TEST="that the parser reads ports and port arguments" DATA=emitter10 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi $here/emit < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # now see if the emitter is now idempotent $here/emit < $work/out > $work/out.out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $work/out $work/out.out # got this far? pass filtergen-0.12.4/t/t_44_protocol0000755000175000017500000000077610051306745013375 00000000000000#!/bin/sh TEST="that the parser reads protocol specifier and protocol arguments" DATA=emitter11 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi $here/emit < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # now see if the emitter is now idempotent $here/emit < $work/out > $work/out.out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $work/out $work/out.out # got this far? pass filtergen-0.12.4/t/t_45_icmptype0000755000175000017500000000075410051306746013364 00000000000000#!/bin/sh TEST="that the parser reads icmptypes and arguments" DATA=emitter12 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi $here/emit < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # now see if the emitter is now idempotent $here/emit < $work/out > $work/out.out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $work/out $work/out.out # got this far? pass filtergen-0.12.4/t/t_46_routing0000755000175000017500000000074710051306746013224 00000000000000#!/bin/sh TEST="that the parser reads routing specifiers" DATA=emitter13 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi $here/emit < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # now see if the emitter is now idempotent $here/emit < $work/out > $work/out.out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $work/out $work/out.out # got this far? pass filtergen-0.12.4/t/t_47_subrule_list0000755000175000017500000000075410051306746014250 00000000000000#!/bin/sh TEST="that the parser reads subrule lists correctly" DATA=emitter14 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi $here/emit < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # now see if the emitter is now idempotent $here/emit < $work/out > $work/out.out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $work/out $work/out.out # got this far? pass filtergen-0.12.4/t/t_48_chaingroup0000755000175000017500000000075310051306746013673 00000000000000#!/bin/sh TEST="that the parser reads chain groups correctly" DATA=emitter15 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi $here/emit < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # now see if the emitter is now idempotent $here/emit < $work/out > $work/out.out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $work/out $work/out.out # got this far? pass filtergen-0.12.4/t/t_49_convertspeclist0000755000175000017500000000062510051306750014755 00000000000000#!/bin/sh TEST="that the converter works" DATA=converter1 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi if ! test -x $here/convert ; then echo "convert program not found" no_result fi $here/convert < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.4/t/t_50_convertrulelist0000755000175000017500000000066510051306750014766 00000000000000#!/bin/sh TEST="that the converter can convert rule lists to next chains" DATA=converter2 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi if ! test -x $here/convert ; then echo "convert program not found" no_result fi $here/convert < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.4/t/t_51_convertdirection0000755000175000017500000000064610051306751015104 00000000000000#!/bin/sh TEST="that the converter can convert directions" DATA=converter3 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi if ! test -x $here/convert ; then echo "convert program not found" no_result fi $here/convert < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.4/t/t_52_converthost0000755000175000017500000000064110051306751014075 00000000000000#!/bin/sh TEST="that the converter can convert hosts" DATA=converter4 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi if ! test -x $here/convert ; then echo "convert program not found" no_result fi $here/convert < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.4/t/t_53_convertproto0000755000175000017500000000064510051306752014271 00000000000000#!/bin/sh TEST="that the converter can convert protocols" DATA=converter5 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi if ! test -x $here/convert ; then echo "convert program not found" no_result fi $here/convert < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.4/t/t_54_convertport0000755000175000017500000000064110051306753014110 00000000000000#!/bin/sh TEST="that the converter can convert ports" DATA=converter6 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi if ! test -x $here/convert ; then echo "convert program not found" no_result fi $here/convert < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.4/t/t_55_converticmptype0000755000175000017500000000064610051306753014764 00000000000000#!/bin/sh TEST="that the converter can convert icmp types" DATA=converter7 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi if ! test -x $here/convert ; then echo "convert program not found" no_result fi $here/convert < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.4/t/t_56_convertrouting0000755000175000017500000000065110051306753014616 00000000000000#!/bin/sh TEST="that the converter can convert routing types" DATA=converter8 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi if ! test -x $here/convert ; then echo "convert program not found" no_result fi $here/convert < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.4/t/t_57_convertchains0000755000175000017500000000065010051306753014374 00000000000000#!/bin/sh TEST="that the converter can convert chain groups" DATA=converter9 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi if ! test -x $here/convert ; then echo "convert program not found" no_result fi $here/convert < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.4/t/t_58_convertcompound0000755000175000017500000000066010051306754014756 00000000000000#!/bin/sh TEST="that the converter can convert compound specifiers" DATA=converter10 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi if ! test -x $here/convert ; then echo "convert program not found" no_result fi $here/convert < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.4/t/t_59_convertnested0000755000175000017500000000065610051306754014422 00000000000000#!/bin/sh TEST="that the converter can convert nested specifiers" DATA=converter11 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi if ! test -x $here/convert ; then echo "convert program not found" no_result fi $here/convert < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.4/t/t_60_bigugly0000755000175000017500000000065610051306754013171 00000000000000#!/bin/sh TEST="that the converter can convert a mess of filters" DATA=converter12 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi if ! test -x $here/convert ; then echo "convert program not found" no_result fi $here/convert < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.4/t/t_61_convertlog0000755000175000017500000000065010051306754013704 00000000000000#!/bin/sh TEST="that the converter can convert log options" DATA=converter13 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi if ! test -x $here/convert ; then echo "convert program not found" no_result fi $here/convert < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.4/t/t_62_convertoptions0000755000175000017500000000065510051306755014625 00000000000000#!/bin/sh TEST="that the converter can convert multiple options" DATA=converter14 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi if ! test -x $here/convert ; then echo "convert program not found" no_result fi $here/convert < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.4/t/t_63_includedir0000755000175000017500000000060710110551002013630 00000000000000#!/bin/sh TEST="that directory inclusion works" testdir=`dirname $0` . $testdir/testlib mkdir $work/include.d if test $? -ne 0 ; then no_result; fi cat >$work/in < $work/out 2>&1 if test $? -ne 0 ; then fail ; fi cat >$work/good < $work/include.d/foo <$work/in < $work/out 2>&1 if test $? -ne 0 ; then fail ; fi cat >$work/good <$work/in < $work/include.d/foo < $work/include.d/quux.d/bar < $work/out 2>&1 if test $? -ne 0 ; then fail ; fi test "x$srcdir" = "x" && cat $work/out # can't compare this against a known good output because ordering # on the disk, and the way opendir()/readdir() iterates over dirents # isn't guaranteed # so grep for each file and make sure they got included grep -q 'include.d/foo' $work/out && \ grep -q 'include.d/quux.d/bar' $work/out && \ pass # didn't match? fail filtergen-0.12.4/t/t_66_includedirtwofiles0000755000175000017500000000134710111022477015424 00000000000000#!/bin/sh TEST="that directory inclusion works with files" testdir=`dirname $0` . $testdir/testlib mkdir $work/include.d if test $? -ne 0 ; then no_result; fi cat > $work/include.d/foo < $work/include.d/bar <$work/in < $work/out 2>&1 if test $? -ne 0 ; then fail ; fi # can't compare this against a known good output because ordering # on the disk, and the way opendir()/readdir() iterates over dirents # isn't guaranteed # so grep for each file and make sure they got included grep -q 'include.d/bar' $work/out && \ grep -q 'include.d/foo' $work/out && \ pass # didn't match? fail filtergen-0.12.4/t/t_67_includeemptyfile0000755000175000017500000000062410110551002015053 00000000000000#!/bin/sh TEST="that inclusion of empty files works" testdir=`dirname $0` . $testdir/testlib cat > $work/rules < $work/empty < $work/out if test $? -ne 0 ; then fail ; fi cat > $work/good < $work/rules < $work/out if test $? -ne 0 ; then fail ; fi cat > $work/good < $work/rules < $work/empty < $work/out if test $? -ne 0 ; then fail ; fi cat > $work/good < $work/rules < $work/empty < $work/out if test $? -ne 0 ; then fail ; fi cat > $work/good <