diff options
Diffstat (limited to 'contrib/libpcap/scanner.l')
-rw-r--r-- | contrib/libpcap/scanner.l | 62 |
1 files changed, 41 insertions, 21 deletions
diff --git a/contrib/libpcap/scanner.l b/contrib/libpcap/scanner.l index 6b973fb..b3f7ba1 100644 --- a/contrib/libpcap/scanner.l +++ b/contrib/libpcap/scanner.l @@ -22,7 +22,11 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/libpcap/scanner.l,v 1.60 1999/11/17 04:09:58 assar Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/libpcap/scanner.l,v 1.70 2000/10/28 10:18:40 guy Exp $ (LBL)"; +#endif + +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include <sys/types.h> @@ -39,10 +43,13 @@ static const char rcsid[] = #ifdef INET6 #include <netdb.h> #include <sys/socket.h> +/* Workaround for AIX 4.3 */ +#if !defined(AI_NUMERICHOST) +#define AI_NUMERICHOST 0x04 +#endif #endif /*INET6*/ #include "tokdefs.h" -#include "gnuc.h" #ifdef HAVE_OS_PROTO_H #include "os-proto.h" #endif @@ -52,22 +59,10 @@ static inline int xdtoi(int); #ifdef FLEX_SCANNER #define YY_NO_UNPUT -#undef YY_INPUT -#define YY_INPUT(buf, result, max)\ - {\ - char *src = in_buffer;\ - int i;\ -\ - if (*src == 0)\ - result = YY_NULL;\ - else {\ - for (i = 0; *src && i < max; ++i)\ - buf[i] = *src++;\ - in_buffer += i;\ - result = i;\ - }\ - } +static YY_BUFFER_STATE in_buffer; #else +static char *in_buffer; + #undef getc #define getc(fp) (*in_buffer == 0 ? EOF : *in_buffer++) #endif @@ -75,8 +70,6 @@ static inline int xdtoi(int); #define yylval pcap_lval extern YYSTYPE yylval; -static char *in_buffer; - %} N ([0-9]+|(0X|0x)[0-9A-Fa-f]+) @@ -88,6 +81,7 @@ W ([0-9A-Fa-f][0-9A-Fa-f]?[0-9A-Fa-f]?[0-9A-Fa-f]?) %e 6000 %k 4000 %p 19000 +%n 2000 V680 {W}:{W}:{W}:{W}:{W}:{W}:{W}:{W} @@ -172,7 +166,7 @@ dst return DST; src return SRC; link|ether|ppp|slip return LINK; -fddi return LINK; +fddi|tr return LINK; arp return ARP; rarp return RARP; ip return IP; @@ -189,12 +183,20 @@ ah return AH; esp return ESP; atalk return ATALK; +aarp return AARP; decnet return DECNET; lat return LAT; sca return SCA; moprc return MOPRC; mopdl return MOPDL; +iso return ISO; +esis return ESIS; +es-is return ESIS; +isis return ISIS; +is-is return ISIS; +clnp return CLNP; + host return HOST; net return NET; mask return MASK; @@ -224,6 +226,8 @@ len|length return LEN; inbound return INBOUND; outbound return OUTBOUND; +vlan return VLAN; + [ \n\t] ; [+\-*/:\[\]!<>()&|=] return yytext[0]; ">=" return GEQ; @@ -264,7 +268,24 @@ void lex_init(buf) char *buf; { +#ifdef FLEX_SCANNER + in_buffer = yy_scan_string(buf); +#else in_buffer = buf; +#endif +} + +/* + * Do any cleanup necessary after parsing. + */ +void +lex_cleanup() +{ +#ifdef FLEX_SCANNER + if (in_buffer != NULL) + yy_delete_buffer(in_buffer); + in_buffer = NULL; +#endif } /* @@ -316,4 +337,3 @@ stoi(s) return n; } - |