1 2#line 3 "lex.ifyy.c" 3 4#define YY_INT_ALIGNED short int 5 6/* A lexical scanner generated by flex */ 7 8#define yy_create_buffer ifyy_create_buffer 9#define yy_delete_buffer ifyy_delete_buffer 10#define yy_flex_debug ifyy_flex_debug 11#define yy_init_buffer ifyy_init_buffer 12#define yy_flush_buffer ifyy_flush_buffer 13#define yy_load_buffer_state ifyy_load_buffer_state 14#define yy_switch_to_buffer ifyy_switch_to_buffer 15#define yyin ifyyin 16#define yyleng ifyyleng 17#define yylex ifyylex 18#define yylineno ifyylineno 19#define yyout ifyyout 20#define yyrestart ifyyrestart 21#define yytext ifyytext 22#define yywrap ifyywrap 23#define yyalloc ifyyalloc 24#define yyrealloc ifyyrealloc 25#define yyfree ifyyfree 26 27#define FLEX_SCANNER 28#define YY_FLEX_MAJOR_VERSION 2 29#define YY_FLEX_MINOR_VERSION 5 30#define YY_FLEX_SUBMINOR_VERSION 35 31#if YY_FLEX_SUBMINOR_VERSION > 0 32#define FLEX_BETA 33#endif 34 35/* First, we deal with platform-specific or compiler-specific issues. */ 36 37/* begin standard C headers. */ 38#include <stdio.h> 39#include <string.h> 40#include <errno.h> 41#include <stdlib.h> 42 43/* end standard C headers. */ 44 45/* flex integer type definitions */ 46 47#ifndef FLEXINT_H 48#define FLEXINT_H 49 50/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ 51 52#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L 53 54/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, 55 * if you want the limit (max/min) macros for int types. 56 */ 57#ifndef __STDC_LIMIT_MACROS 58#define __STDC_LIMIT_MACROS 1 59#endif 60 61#include <inttypes.h> 62typedef int8_t flex_int8_t; 63typedef uint8_t flex_uint8_t; 64typedef int16_t flex_int16_t; 65typedef uint16_t flex_uint16_t; 66typedef int32_t flex_int32_t; 67typedef uint32_t flex_uint32_t; 68#else 69typedef signed char flex_int8_t; 70typedef short int flex_int16_t; 71typedef int flex_int32_t; 72typedef unsigned char flex_uint8_t; 73typedef unsigned short int flex_uint16_t; 74typedef unsigned int flex_uint32_t; 75#endif /* ! C99 */ 76 77/* Limits of integral types. */ 78#ifndef INT8_MIN 79#define INT8_MIN (-128) 80#endif 81#ifndef INT16_MIN 82#define INT16_MIN (-32767-1) 83#endif 84#ifndef INT32_MIN 85#define INT32_MIN (-2147483647-1) 86#endif 87#ifndef INT8_MAX 88#define INT8_MAX (127) 89#endif 90#ifndef INT16_MAX 91#define INT16_MAX (32767) 92#endif 93#ifndef INT32_MAX 94#define INT32_MAX (2147483647) 95#endif 96#ifndef UINT8_MAX 97#define UINT8_MAX (255U) 98#endif 99#ifndef UINT16_MAX 100#define UINT16_MAX (65535U) 101#endif 102#ifndef UINT32_MAX 103#define UINT32_MAX (4294967295U) 104#endif 105 106#endif /* ! FLEXINT_H */ 107 108#ifdef __cplusplus 109 110/* The "const" storage-class-modifier is valid. */ 111#define YY_USE_CONST 112 113#else /* ! __cplusplus */ 114 115/* C99 requires __STDC__ to be defined as 1. */ 116#if defined (__STDC__) 117 118#define YY_USE_CONST 119 120#endif /* defined (__STDC__) */ 121#endif /* ! __cplusplus */ 122 123#ifdef YY_USE_CONST 124#define yyconst const 125#else 126#define yyconst 127#endif 128 129/* Returned upon end-of-file. */ 130#define YY_NULL 0 131 132/* Promotes a possibly negative, possibly signed char to an unsigned 133 * integer for use as an array index. If the signed char is negative, 134 * we want to instead treat it as an 8-bit unsigned char, hence the 135 * double cast. 136 */ 137#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) 138 139/* Enter a start condition. This macro really ought to take a parameter, 140 * but we do it the disgusting crufty way forced on us by the ()-less 141 * definition of BEGIN. 142 */ 143#define BEGIN (yy_start) = 1 + 2 * 144 145/* Translate the current start state into a value that can be later handed 146 * to BEGIN to return to the state. The YYSTATE alias is for lex 147 * compatibility. 148 */ 149#define YY_START (((yy_start) - 1) / 2) 150#define YYSTATE YY_START 151 152/* Action number for EOF rule of a given start state. */ 153#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) 154 155/* Special action meaning "start processing a new file". */ 156#define YY_NEW_FILE ifyyrestart(ifyyin ) 157 158#define YY_END_OF_BUFFER_CHAR 0 159 160/* Size of default input buffer. */ 161#ifndef YY_BUF_SIZE 162#define YY_BUF_SIZE 16384 163#endif 164 165/* The state buf must be large enough to hold one state per character in the main buffer. 166 */ 167#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) 168 169#ifndef YY_TYPEDEF_YY_BUFFER_STATE 170#define YY_TYPEDEF_YY_BUFFER_STATE 171typedef struct yy_buffer_state *YY_BUFFER_STATE; 172#endif 173 174extern int ifyyleng; 175 176extern FILE *ifyyin, *ifyyout; 177 178#define EOB_ACT_CONTINUE_SCAN 0 179#define EOB_ACT_END_OF_FILE 1 180#define EOB_ACT_LAST_MATCH 2 181 182 #define YY_LESS_LINENO(n) 183 184/* Return all but the first "n" matched characters back to the input stream. */ 185#define yyless(n) \ 186 do \ 187 { \ 188 /* Undo effects of setting up ifyytext. */ \ 189 int yyless_macro_arg = (n); \ 190 YY_LESS_LINENO(yyless_macro_arg);\ 191 *yy_cp = (yy_hold_char); \ 192 YY_RESTORE_YY_MORE_OFFSET \ 193 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ 194 YY_DO_BEFORE_ACTION; /* set up ifyytext again */ \ 195 } \ 196 while ( 0 ) 197 198#define unput(c) yyunput( c, (yytext_ptr) ) 199 200#ifndef YY_TYPEDEF_YY_SIZE_T 201#define YY_TYPEDEF_YY_SIZE_T 202typedef size_t yy_size_t; 203#endif 204 205#ifndef YY_STRUCT_YY_BUFFER_STATE 206#define YY_STRUCT_YY_BUFFER_STATE 207struct yy_buffer_state 208 { 209 FILE *yy_input_file; 210 211 char *yy_ch_buf; /* input buffer */ 212 char *yy_buf_pos; /* current position in input buffer */ 213 214 /* Size of input buffer in bytes, not including room for EOB 215 * characters. 216 */ 217 yy_size_t yy_buf_size; 218 219 /* Number of characters read into yy_ch_buf, not including EOB 220 * characters. 221 */ 222 int yy_n_chars; 223 224 /* Whether we "own" the buffer - i.e., we know we created it, 225 * and can realloc() it to grow it, and should free() it to 226 * delete it. 227 */ 228 int yy_is_our_buffer; 229 230 /* Whether this is an "interactive" input source; if so, and 231 * if we're using stdio for input, then we want to use getc() 232 * instead of fread(), to make sure we stop fetching input after 233 * each newline. 234 */ 235 int yy_is_interactive; 236 237 /* Whether we're considered to be at the beginning of a line. 238 * If so, '^' rules will be active on the next match, otherwise 239 * not. 240 */ 241 int yy_at_bol; 242 243 int yy_bs_lineno; /**< The line count. */ 244 int yy_bs_column; /**< The column count. */ 245 246 /* Whether to try to fill the input buffer when we reach the 247 * end of it. 248 */ 249 int yy_fill_buffer; 250 251 int yy_buffer_status; 252 253#define YY_BUFFER_NEW 0 254#define YY_BUFFER_NORMAL 1 255 /* When an EOF's been seen but there's still some text to process 256 * then we mark the buffer as YY_EOF_PENDING, to indicate that we 257 * shouldn't try reading from the input source any more. We might 258 * still have a bunch of tokens to match, though, because of 259 * possible backing-up. 260 * 261 * When we actually see the EOF, we change the status to "new" 262 * (via ifyyrestart()), so that the user can continue scanning by 263 * just pointing ifyyin at a new input file. 264 */ 265#define YY_BUFFER_EOF_PENDING 2 266 267 }; 268#endif /* !YY_STRUCT_YY_BUFFER_STATE */ 269 270/* Stack of input buffers. */ 271static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ 272static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ 273static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ 274 275/* We provide macros for accessing buffer states in case in the 276 * future we want to put the buffer states in a more general 277 * "scanner state". 278 * 279 * Returns the top of the stack, or NULL. 280 */ 281#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ 282 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ 283 : NULL) 284 285/* Same as previous macro, but useful when we know that the buffer stack is not 286 * NULL or when we need an lvalue. For internal use only. 287 */ 288#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] 289 290/* yy_hold_char holds the character lost when ifyytext is formed. */ 291static char yy_hold_char; 292static int yy_n_chars; /* number of characters read into yy_ch_buf */ 293int ifyyleng; 294 295/* Points to current character in buffer. */ 296static char *yy_c_buf_p = (char *) 0; 297static int yy_init = 0; /* whether we need to initialize */ 298static int yy_start = 0; /* start state number */ 299 300/* Flag which is used to allow ifyywrap()'s to do buffer switches 301 * instead of setting up a fresh ifyyin. A bit of a hack ... 302 */ 303static int yy_did_buffer_switch_on_eof; 304 305void ifyyrestart (FILE *input_file ); 306void ifyy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); 307YY_BUFFER_STATE ifyy_create_buffer (FILE *file,int size ); 308void ifyy_delete_buffer (YY_BUFFER_STATE b ); 309void ifyy_flush_buffer (YY_BUFFER_STATE b ); 310void ifyypush_buffer_state (YY_BUFFER_STATE new_buffer ); 311void ifyypop_buffer_state (void ); 312 313static void ifyyensure_buffer_stack (void ); 314static void ifyy_load_buffer_state (void ); 315static void ifyy_init_buffer (YY_BUFFER_STATE b,FILE *file ); 316 317#define YY_FLUSH_BUFFER ifyy_flush_buffer(YY_CURRENT_BUFFER ) 318 319YY_BUFFER_STATE ifyy_scan_buffer (char *base,yy_size_t size ); 320YY_BUFFER_STATE ifyy_scan_string (yyconst char *yy_str ); 321YY_BUFFER_STATE ifyy_scan_bytes (yyconst char *bytes,int len ); 322 323void *ifyyalloc (yy_size_t ); 324void *ifyyrealloc (void *,yy_size_t ); 325void ifyyfree (void * ); 326 327#define yy_new_buffer ifyy_create_buffer 328 329#define yy_set_interactive(is_interactive) \ 330 { \ 331 if ( ! YY_CURRENT_BUFFER ){ \ 332 ifyyensure_buffer_stack (); \ 333 YY_CURRENT_BUFFER_LVALUE = \ 334 ifyy_create_buffer(ifyyin,YY_BUF_SIZE ); \ 335 } \ 336 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ 337 } 338 339#define yy_set_bol(at_bol) \ 340 { \ 341 if ( ! YY_CURRENT_BUFFER ){\ 342 ifyyensure_buffer_stack (); \ 343 YY_CURRENT_BUFFER_LVALUE = \ 344 ifyy_create_buffer(ifyyin,YY_BUF_SIZE ); \ 345 } \ 346 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ 347 } 348 349#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) 350 351/* Begin user sect3 */ 352 353#define ifyywrap(n) 1 354#define YY_SKIP_YYWRAP 355 356typedef unsigned char YY_CHAR; 357 358FILE *ifyyin = (FILE *) 0, *ifyyout = (FILE *) 0; 359 360typedef int yy_state_type; 361 362extern int ifyylineno; 363 364int ifyylineno = 1; 365 366extern char *ifyytext; 367#define yytext_ptr ifyytext 368 369static yy_state_type yy_get_previous_state (void ); 370static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); 371static int yy_get_next_buffer (void ); 372static void yy_fatal_error (yyconst char msg[] ); 373 374/* Done after the current pattern has been matched and before the 375 * corresponding action - sets up ifyytext. 376 */ 377#define YY_DO_BEFORE_ACTION \ 378 (yytext_ptr) = yy_bp; \ 379 ifyyleng = (size_t) (yy_cp - yy_bp); \ 380 (yy_hold_char) = *yy_cp; \ 381 *yy_cp = '\0'; \ 382 (yy_c_buf_p) = yy_cp; 383 384#define YY_NUM_RULES 9 385#define YY_END_OF_BUFFER 10 386/* This struct is not used in this scanner, 387 but its presence is necessary. */ 388struct yy_trans_info 389 { 390 flex_int32_t yy_verify; 391 flex_int32_t yy_nxt; 392 }; 393static yyconst flex_int16_t yy_accept[64] = 394 { 0, 395 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 396 0, 0, 0, 0, 10, 9, 8, 7, 9, 9, 397 9, 9, 9, 9, 8, 0, 6, 0, 2, 3, 398 4, 5, 0, 0, 0, 0, 0, 0, 0, 0, 399 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 400 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 401 0, 1, 0 402 } ; 403 404static yyconst flex_int32_t yy_ec[256] = 405 { 0, 406 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 407 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 408 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 409 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 410 1, 1, 1, 1, 1, 1, 1, 4, 4, 4, 411 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 412 1, 1, 1, 1, 5, 5, 5, 5, 5, 5, 413 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 414 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 415 1, 1, 1, 1, 1, 1, 7, 7, 7, 7, 416 417 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 418 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 419 6, 6, 1, 1, 1, 1, 1, 1, 1, 1, 420 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 421 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 422 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 423 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 424 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 425 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 426 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 427 428 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 429 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 430 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 431 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 432 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 433 1, 1, 1, 1, 1 434 } ; 435 436static yyconst flex_int32_t yy_meta[8] = 437 { 0, 438 1, 1, 1, 2, 2, 2, 2 439 } ; 440 441static yyconst flex_int16_t yy_base[66] = 442 { 0, 443 0, 2, 2, 0, 5, 0, 9, 0, 13, 0, 444 17, 0, 21, 0, 35, 171, 29, 171, 25, 23, 445 29, 33, 37, 41, 21, 45, 15, 11, 171, 171, 446 171, 171, 49, 53, 57, 61, 65, 69, 73, 77, 447 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 448 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 449 161, 171, 171, 168, 6 450 } ; 451 452static yyconst flex_int16_t yy_def[66] = 453 { 0, 454 64, 64, 2, 3, 2, 5, 2, 7, 7, 9, 455 9, 11, 11, 13, 63, 63, 63, 63, 63, 65, 456 63, 63, 63, 63, 63, 63, 63, 65, 63, 63, 457 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 458 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 459 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 460 63, 63, 0, 63, 63 461 } ; 462 463static yyconst flex_int16_t yy_nxt[179] = 464 { 0, 465 63, 17, 18, 17, 18, 19, 19, 28, 19, 20, 466 20, 20, 21, 21, 27, 21, 22, 22, 27, 22, 467 23, 23, 25, 23, 24, 24, 27, 24, 26, 26, 468 25, 26, 29, 29, 63, 29, 30, 30, 63, 30, 469 31, 31, 63, 31, 32, 32, 63, 32, 33, 33, 470 63, 33, 34, 34, 63, 34, 35, 35, 63, 35, 471 36, 36, 63, 36, 37, 37, 63, 37, 38, 38, 472 63, 38, 39, 39, 63, 39, 40, 40, 63, 40, 473 41, 41, 63, 41, 42, 42, 63, 42, 43, 43, 474 63, 43, 44, 44, 63, 44, 45, 45, 63, 45, 475 476 46, 46, 63, 46, 47, 47, 63, 47, 48, 48, 477 63, 48, 49, 49, 63, 49, 50, 50, 63, 50, 478 51, 51, 63, 51, 52, 52, 63, 52, 53, 53, 479 63, 53, 54, 54, 63, 54, 55, 55, 63, 55, 480 56, 56, 63, 56, 57, 57, 63, 57, 58, 58, 481 63, 58, 59, 59, 63, 59, 60, 60, 63, 60, 482 61, 61, 63, 61, 62, 62, 63, 62, 16, 16, 483 15, 63, 63, 63, 63, 63, 63, 63 484 } ; 485 486static yyconst flex_int16_t yy_chk[179] = 487 { 0, 488 0, 1, 1, 2, 2, 3, 3, 65, 3, 5, 489 5, 5, 7, 7, 28, 7, 9, 9, 27, 9, 490 11, 11, 25, 11, 13, 13, 20, 13, 19, 19, 491 17, 19, 21, 21, 15, 21, 22, 22, 0, 22, 492 23, 23, 0, 23, 24, 24, 0, 24, 26, 26, 493 0, 26, 33, 33, 0, 33, 34, 34, 0, 34, 494 35, 35, 0, 35, 36, 36, 0, 36, 37, 37, 495 0, 37, 38, 38, 0, 38, 39, 39, 0, 39, 496 40, 40, 0, 40, 41, 41, 0, 41, 42, 42, 497 0, 42, 43, 43, 0, 43, 44, 44, 0, 44, 498 499 45, 45, 0, 45, 46, 46, 0, 46, 47, 47, 500 0, 47, 48, 48, 0, 48, 49, 49, 0, 49, 501 50, 50, 0, 50, 51, 51, 0, 51, 52, 52, 502 0, 52, 53, 53, 0, 53, 54, 54, 0, 54, 503 55, 55, 0, 55, 56, 56, 0, 56, 57, 57, 504 0, 57, 58, 58, 0, 58, 59, 59, 0, 59, 505 60, 60, 0, 60, 61, 61, 0, 61, 64, 64, 506 63, 63, 63, 63, 63, 63, 63, 63 507 } ; 508 509static yy_state_type yy_last_accepting_state; 510static char *yy_last_accepting_cpos; 511 512extern int ifyy_flex_debug; 513int ifyy_flex_debug = 0; 514 515/* The intent behind this definition is that it'll catch 516 * any uses of REJECT which flex missed. 517 */ 518#define REJECT reject_used_but_not_detected 519#define yymore() yymore_used_but_not_detected 520#define YY_MORE_ADJ 0 521#define YY_RESTORE_YY_MORE_OFFSET 522char *ifyytext; 523#line 1 "dad_token.l" 524/* $Id: dad_token.l,v 1.1.1.1 2006/12/04 00:45:29 Exp $ */ 525/* 526 * Copyright (C) International Business Machines Corp., 2003 527 * All rights reserved. 528 * 529 * Redistribution and use in source and binary forms, with or without 530 * modification, are permitted provided that the following conditions 531 * are met: 532 * 1. Redistributions of source code must retain the above copyright 533 * notice, this list of conditions and the following disclaimer. 534 * 2. Redistributions in binary form must reproduce the above copyright 535 * notice, this list of conditions and the following disclaimer in the 536 * documentation and/or other materials provided with the distribution. 537 * 3. Neither the name of the project nor the names of its contributors 538 * may be used to endorse or promote products derived from this software 539 * without specific prior written permission. 540 * 541 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND 542 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 543 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 544 * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE 545 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 546 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 547 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 548 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 549 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 550 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 551 */ 552#line 34 "dad_token.l" 553#include <stdio.h> 554#include <string.h> 555#include <sys/types.h> 556#include <netinet/in.h> 557#include <arpa/inet.h> 558#include <net/if.h> 559 560#include <errno.h> 561#include <syslog.h> 562#include <string.h> 563 564#include "queue.h" 565#include "dhcp6.h" 566#include "config.h" 567#include "common.h" 568#include "lease.h" 569 570#define YYABORT(msg) dprintf(LOG_ERR, msg " %s lineno %d.", \ 571 ifyytext, num_lines) 572 573#define ABORT do { \ 574 YYABORT("/proc/net/if_inet6 file parse error"); \ 575 exit(1); \ 576} while (0) 577 578#define DAD_FLAGS 0xc0 579 580struct ifproc_info { 581 struct ifproc_info *next; 582 struct in6_addr addr; 583 char name[IFNAMSIZ]; 584 int index; 585 int plen; 586 int scope; 587 int flags; 588}; 589 590extern struct dhcp6_if *dhcp6_if; 591extern struct dhcp6_list request_list; 592const char *ifproc_file = "/proc/net/if_inet6"; 593struct ifproc_info *dadlist = NULL; 594 595static struct ifproc_info *ifinfo; 596static int num_lines = 0; 597 598 599#line 600 "lex.ifyy.c" 600 601#define INITIAL 0 602#define S_CNF 1 603#define S_NAME 2 604#define S_INDEX 3 605#define S_PLEN 4 606#define S_SCOPE 5 607#define S_FLAGS 6 608 609#ifndef YY_NO_UNISTD_H 610/* Special case for "unistd.h", since it is non-ANSI. We include it way 611 * down here because we want the user's section 1 to have been scanned first. 612 * The user has a chance to override it with an option. 613 */ 614#include <unistd.h> 615#endif 616 617#ifndef YY_EXTRA_TYPE 618#define YY_EXTRA_TYPE void * 619#endif 620 621static int yy_init_globals (void ); 622 623/* Accessor methods to globals. 624 These are made visible to non-reentrant scanners for convenience. */ 625 626int ifyylex_destroy (void ); 627 628int ifyyget_debug (void ); 629 630void ifyyset_debug (int debug_flag ); 631 632YY_EXTRA_TYPE ifyyget_extra (void ); 633 634void ifyyset_extra (YY_EXTRA_TYPE user_defined ); 635 636FILE *ifyyget_in (void ); 637 638void ifyyset_in (FILE * in_str ); 639 640FILE *ifyyget_out (void ); 641 642void ifyyset_out (FILE * out_str ); 643 644int ifyyget_leng (void ); 645 646char *ifyyget_text (void ); 647 648int ifyyget_lineno (void ); 649 650void ifyyset_lineno (int line_number ); 651 652/* Macros after this point can all be overridden by user definitions in 653 * section 1. 654 */ 655 656#ifndef YY_SKIP_YYWRAP 657#ifdef __cplusplus 658extern "C" int ifyywrap (void ); 659#else 660extern int ifyywrap (void ); 661#endif 662#endif 663 664 static void yyunput (int c,char *buf_ptr ); 665 666#ifndef yytext_ptr 667static void yy_flex_strncpy (char *,yyconst char *,int ); 668#endif 669 670#ifdef YY_NEED_STRLEN 671static int yy_flex_strlen (yyconst char * ); 672#endif 673 674#ifndef YY_NO_INPUT 675 676#ifdef __cplusplus 677static int yyinput (void ); 678#else 679static int input (void ); 680#endif 681 682#endif 683 684/* Amount of stuff to slurp up with each read. */ 685#ifndef YY_READ_BUF_SIZE 686#define YY_READ_BUF_SIZE 8192 687#endif 688 689/* Copy whatever the last rule matched to the standard output. */ 690#ifndef ECHO 691/* This used to be an fputs(), but since the string might contain NUL's, 692 * we now use fwrite(). 693 */ 694#define ECHO fwrite( ifyytext, ifyyleng, 1, ifyyout ) 695#endif 696 697/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, 698 * is returned in "result". 699 */ 700#ifndef YY_INPUT 701#define YY_INPUT(buf,result,max_size) \ 702 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ 703 { \ 704 int c = '*'; \ 705 unsigned n; \ 706 for ( n = 0; n < max_size && \ 707 (c = getc( ifyyin )) != EOF && c != '\n'; ++n ) \ 708 buf[n] = (char) c; \ 709 if ( c == '\n' ) \ 710 buf[n++] = (char) c; \ 711 if ( c == EOF && ferror( ifyyin ) ) \ 712 YY_FATAL_ERROR( "input in flex scanner failed" ); \ 713 result = n; \ 714 } \ 715 else \ 716 { \ 717 errno=0; \ 718 while ( (result = fread(buf, 1, max_size, ifyyin))==0 && ferror(ifyyin)) \ 719 { \ 720 if( errno != EINTR) \ 721 { \ 722 YY_FATAL_ERROR( "input in flex scanner failed" ); \ 723 break; \ 724 } \ 725 errno=0; \ 726 clearerr(ifyyin); \ 727 } \ 728 }\ 729\ 730 731#endif 732 733/* No semi-colon after return; correct usage is to write "yyterminate();" - 734 * we don't want an extra ';' after the "return" because that will cause 735 * some compilers to complain about unreachable statements. 736 */ 737#ifndef yyterminate 738#define yyterminate() return YY_NULL 739#endif 740 741/* Number of entries by which start-condition stack grows. */ 742#ifndef YY_START_STACK_INCR 743#define YY_START_STACK_INCR 25 744#endif 745 746/* Report a fatal error. */ 747#ifndef YY_FATAL_ERROR 748#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) 749#endif 750 751/* end tables serialization structures and prototypes */ 752 753/* Default declaration of generated scanner - a define so the user can 754 * easily add parameters. 755 */ 756#ifndef YY_DECL 757#define YY_DECL_IS_OURS 1 758 759extern int ifyylex (void); 760 761#define YY_DECL int ifyylex (void) 762#endif /* !YY_DECL */ 763 764/* Code executed at the beginning of each rule, after ifyytext and ifyyleng 765 * have been set up. 766 */ 767#ifndef YY_USER_ACTION 768#define YY_USER_ACTION 769#endif 770 771/* Code executed at the end of each rule. */ 772#ifndef YY_BREAK 773#define YY_BREAK break; 774#endif 775 776#define YY_RULE_SETUP \ 777 YY_USER_ACTION 778 779/** The main scanner function which does all the work. 780 */ 781YY_DECL 782{ 783 register yy_state_type yy_current_state; 784 register char *yy_cp, *yy_bp; 785 register int yy_act; 786 787#line 91 "dad_token.l" 788 789 790 791 BEGIN S_CNF; 792 793 794#line 795 "lex.ifyy.c" 795 796 if ( !(yy_init) ) 797 { 798 (yy_init) = 1; 799 800#ifdef YY_USER_INIT 801 YY_USER_INIT; 802#endif 803 804 if ( ! (yy_start) ) 805 (yy_start) = 1; /* first start state */ 806 807 if ( ! ifyyin ) 808 ifyyin = stdin; 809 810 if ( ! ifyyout ) 811 ifyyout = stdout; 812 813 if ( ! YY_CURRENT_BUFFER ) { 814 ifyyensure_buffer_stack (); 815 YY_CURRENT_BUFFER_LVALUE = 816 ifyy_create_buffer(ifyyin,YY_BUF_SIZE ); 817 } 818 819 ifyy_load_buffer_state( ); 820 } 821 822 while ( 1 ) /* loops until end-of-file is reached */ 823 { 824 yy_cp = (yy_c_buf_p); 825 826 /* Support of ifyytext. */ 827 *yy_cp = (yy_hold_char); 828 829 /* yy_bp points to the position in yy_ch_buf of the start of 830 * the current run. 831 */ 832 yy_bp = yy_cp; 833 834 yy_current_state = (yy_start); 835yy_match: 836 do 837 { 838 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; 839 if ( yy_accept[yy_current_state] ) 840 { 841 (yy_last_accepting_state) = yy_current_state; 842 (yy_last_accepting_cpos) = yy_cp; 843 } 844 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 845 { 846 yy_current_state = (int) yy_def[yy_current_state]; 847 if ( yy_current_state >= 64 ) 848 yy_c = yy_meta[(unsigned int) yy_c]; 849 } 850 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 851 ++yy_cp; 852 } 853 while ( yy_base[yy_current_state] != 171 ); 854 855yy_find_action: 856 yy_act = yy_accept[yy_current_state]; 857 if ( yy_act == 0 ) 858 { /* have to back up */ 859 yy_cp = (yy_last_accepting_cpos); 860 yy_current_state = (yy_last_accepting_state); 861 yy_act = yy_accept[yy_current_state]; 862 } 863 864 YY_DO_BEFORE_ACTION; 865 866do_action: /* This label is used only to access EOF actions. */ 867 868 switch ( yy_act ) 869 { /* beginning of action switch */ 870 case 0: /* must back up */ 871 /* undo the effects of YY_DO_BEFORE_ACTION */ 872 *yy_cp = (yy_hold_char); 873 yy_cp = (yy_last_accepting_cpos); 874 yy_current_state = (yy_last_accepting_state); 875 goto yy_find_action; 876 877case 1: 878YY_RULE_SETUP 879#line 97 "dad_token.l" 880{struct in6_addr addr; 881 char buff[64]; 882 int i, len = 0; 883 for (i = 0; i < 32; i += 4) { 884 strncpy(buff+len, &ifyytext[i], 4); 885 len += 4; 886 if (i < 28) { 887 strcpy(buff+len, ":"); 888 len += 1; 889 } else 890 strcpy(buff+len, "\0"); 891 } 892 if (inet_pton(AF_INET6, buff, &addr) < 1) { 893 dprintf(LOG_ERR, "parse address failed"); 894 ABORT; 895 } else { 896 ifinfo = (struct ifproc_info *)malloc(sizeof(*ifinfo)); 897 if (ifinfo == NULL) 898 ABORT; 899 memcpy(&ifinfo->addr, &addr, sizeof(ifinfo->addr)); 900 BEGIN S_INDEX;} 901 } 902 YY_BREAK 903case 2: 904YY_RULE_SETUP 905#line 119 "dad_token.l" 906{ifinfo->index = strtol(ifyytext, NULL, 16); 907 BEGIN S_PLEN;} 908 YY_BREAK 909case 3: 910YY_RULE_SETUP 911#line 121 "dad_token.l" 912{ifinfo->plen = strtol(ifyytext, NULL, 16); 913 BEGIN S_SCOPE;} 914 YY_BREAK 915case 4: 916YY_RULE_SETUP 917#line 123 "dad_token.l" 918{ifinfo->scope = strtol(ifyytext, NULL, 16); 919 BEGIN S_FLAGS;} 920 YY_BREAK 921case 5: 922YY_RULE_SETUP 923#line 125 "dad_token.l" 924{ifinfo->flags = strtol(ifyytext, NULL, 16); 925 if (ifinfo->flags == DAD_FLAGS) { 926 dprintf(LOG_INFO, "duplicated ipv6 address %s detected", 927 in6addr2str(&ifinfo->addr, 0)); 928 BEGIN S_NAME; 929 } else { 930 free(ifinfo); 931 BEGIN S_CNF; 932 } 933 } 934 YY_BREAK 935case 6: 936YY_RULE_SETUP 937#line 135 "dad_token.l" 938{ 939 if (strcmp(ifyytext, dhcp6_if->ifname)) { 940 free(ifinfo); 941 BEGIN S_CNF; 942 } else { 943 struct dhcp6_listval *lv; 944 struct dhcp6_lease *cl; 945 strncpy(ifinfo->name, ifyytext, IFNAMSIZ); 946 ifinfo->next = NULL; 947 if (dadlist == NULL) { 948 TAILQ_INIT(&request_list); 949 dadlist = ifinfo; 950 } else 951 dadlist->next = ifinfo; 952 953 /* check address on client6_iaidaddr list */ 954 if ((lv = (struct dhcp6_listval *)malloc(sizeof(*lv))) 955 == NULL) { 956 dprintf(LOG_ERR, "failed to allocate memory"); 957 return (-1); 958 } 959 960 for (cl = TAILQ_FIRST(&client6_iaidaddr.lease_list); cl; 961 cl = TAILQ_NEXT(cl, link)) { 962 if (cl->lease_addr.type != IAPD && 963 IN6_ARE_ADDR_EQUAL(&cl->lease_addr.addr, &ifinfo->addr)) 964 break; 965 else 966 BEGIN S_CNF; 967 } 968 /* deconfigure the interface's the address assgined by dhcpv6 */ 969 if (dhcp6_remove_lease(cl) != 0) { 970 dprintf(LOG_INFO, 971 "remove duplicated address failed: %s", 972 in6addr2str(&lv->val_dhcp6addr.addr, 0)); 973 return (-1); 974 } 975 memcpy(&lv->val_dhcp6addr.addr, &ifinfo->addr, 976 sizeof(lv->val_dhcp6addr.addr)); 977 lv->val_dhcp6addr.type = IANA; 978 lv->val_dhcp6addr.plen = ifinfo->plen; 979 lv->val_dhcp6addr.status_code = DH6OPT_STCODE_UNDEFINE; 980 lv->val_dhcp6addr.preferlifetime = 0; 981 lv->val_dhcp6addr.validlifetime = 0; 982 TAILQ_INSERT_TAIL(&request_list, lv, link); 983 BEGIN S_CNF; 984 } 985 } 986 YY_BREAK 987case 7: 988/* rule 7 can match eol */ 989YY_RULE_SETUP 990#line 184 "dad_token.l" 991{num_lines++;} 992 YY_BREAK 993case 8: 994YY_RULE_SETUP 995#line 185 "dad_token.l" 996{;} 997 YY_BREAK 998case 9: 999YY_RULE_SETUP 1000#line 186 "dad_token.l" 1001ECHO; 1002 YY_BREAK 1003#line 1004 "lex.ifyy.c" 1004case YY_STATE_EOF(INITIAL): 1005case YY_STATE_EOF(S_CNF): 1006case YY_STATE_EOF(S_NAME): 1007case YY_STATE_EOF(S_INDEX): 1008case YY_STATE_EOF(S_PLEN): 1009case YY_STATE_EOF(S_SCOPE): 1010case YY_STATE_EOF(S_FLAGS): 1011 yyterminate(); 1012 1013 case YY_END_OF_BUFFER: 1014 { 1015 /* Amount of text matched not including the EOB char. */ 1016 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; 1017 1018 /* Undo the effects of YY_DO_BEFORE_ACTION. */ 1019 *yy_cp = (yy_hold_char); 1020 YY_RESTORE_YY_MORE_OFFSET 1021 1022 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) 1023 { 1024 /* We're scanning a new file or input source. It's 1025 * possible that this happened because the user 1026 * just pointed ifyyin at a new source and called 1027 * ifyylex(). If so, then we have to assure 1028 * consistency between YY_CURRENT_BUFFER and our 1029 * globals. Here is the right place to do so, because 1030 * this is the first action (other than possibly a 1031 * back-up) that will match for the new input source. 1032 */ 1033 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; 1034 YY_CURRENT_BUFFER_LVALUE->yy_input_file = ifyyin; 1035 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; 1036 } 1037 1038 /* Note that here we test for yy_c_buf_p "<=" to the position 1039 * of the first EOB in the buffer, since yy_c_buf_p will 1040 * already have been incremented past the NUL character 1041 * (since all states make transitions on EOB to the 1042 * end-of-buffer state). Contrast this with the test 1043 * in input(). 1044 */ 1045 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) 1046 { /* This was really a NUL. */ 1047 yy_state_type yy_next_state; 1048 1049 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; 1050 1051 yy_current_state = yy_get_previous_state( ); 1052 1053 /* Okay, we're now positioned to make the NUL 1054 * transition. We couldn't have 1055 * yy_get_previous_state() go ahead and do it 1056 * for us because it doesn't know how to deal 1057 * with the possibility of jamming (and we don't 1058 * want to build jamming into it because then it 1059 * will run more slowly). 1060 */ 1061 1062 yy_next_state = yy_try_NUL_trans( yy_current_state ); 1063 1064 yy_bp = (yytext_ptr) + YY_MORE_ADJ; 1065 1066 if ( yy_next_state ) 1067 { 1068 /* Consume the NUL. */ 1069 yy_cp = ++(yy_c_buf_p); 1070 yy_current_state = yy_next_state; 1071 goto yy_match; 1072 } 1073 1074 else 1075 { 1076 yy_cp = (yy_c_buf_p); 1077 goto yy_find_action; 1078 } 1079 } 1080 1081 else switch ( yy_get_next_buffer( ) ) 1082 { 1083 case EOB_ACT_END_OF_FILE: 1084 { 1085 (yy_did_buffer_switch_on_eof) = 0; 1086 1087 if ( ifyywrap( ) ) 1088 { 1089 /* Note: because we've taken care in 1090 * yy_get_next_buffer() to have set up 1091 * ifyytext, we can now set up 1092 * yy_c_buf_p so that if some total 1093 * hoser (like flex itself) wants to 1094 * call the scanner after we return the 1095 * YY_NULL, it'll still work - another 1096 * YY_NULL will get returned. 1097 */ 1098 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; 1099 1100 yy_act = YY_STATE_EOF(YY_START); 1101 goto do_action; 1102 } 1103 1104 else 1105 { 1106 if ( ! (yy_did_buffer_switch_on_eof) ) 1107 YY_NEW_FILE; 1108 } 1109 break; 1110 } 1111 1112 case EOB_ACT_CONTINUE_SCAN: 1113 (yy_c_buf_p) = 1114 (yytext_ptr) + yy_amount_of_matched_text; 1115 1116 yy_current_state = yy_get_previous_state( ); 1117 1118 yy_cp = (yy_c_buf_p); 1119 yy_bp = (yytext_ptr) + YY_MORE_ADJ; 1120 goto yy_match; 1121 1122 case EOB_ACT_LAST_MATCH: 1123 (yy_c_buf_p) = 1124 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; 1125 1126 yy_current_state = yy_get_previous_state( ); 1127 1128 yy_cp = (yy_c_buf_p); 1129 yy_bp = (yytext_ptr) + YY_MORE_ADJ; 1130 goto yy_find_action; 1131 } 1132 break; 1133 } 1134 1135 default: 1136 YY_FATAL_ERROR( 1137 "fatal flex scanner internal error--no action found" ); 1138 } /* end of action switch */ 1139 } /* end of scanning one token */ 1140} /* end of ifyylex */ 1141 1142/* yy_get_next_buffer - try to read in a new buffer 1143 * 1144 * Returns a code representing an action: 1145 * EOB_ACT_LAST_MATCH - 1146 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position 1147 * EOB_ACT_END_OF_FILE - end of file 1148 */ 1149static int yy_get_next_buffer (void) 1150{ 1151 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; 1152 register char *source = (yytext_ptr); 1153 register int number_to_move, i; 1154 int ret_val; 1155 1156 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) 1157 YY_FATAL_ERROR( 1158 "fatal flex scanner internal error--end of buffer missed" ); 1159 1160 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) 1161 { /* Don't try to fill the buffer, so this is an EOF. */ 1162 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) 1163 { 1164 /* We matched a single character, the EOB, so 1165 * treat this as a final EOF. 1166 */ 1167 return EOB_ACT_END_OF_FILE; 1168 } 1169 1170 else 1171 { 1172 /* We matched some text prior to the EOB, first 1173 * process it. 1174 */ 1175 return EOB_ACT_LAST_MATCH; 1176 } 1177 } 1178 1179 /* Try to read more data. */ 1180 1181 /* First move last chars to start of buffer. */ 1182 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; 1183 1184 for ( i = 0; i < number_to_move; ++i ) 1185 *(dest++) = *(source++); 1186 1187 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) 1188 /* don't do the read, it's not guaranteed to return an EOF, 1189 * just force an EOF 1190 */ 1191 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; 1192 1193 else 1194 { 1195 int num_to_read = 1196 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; 1197 1198 while ( num_to_read <= 0 ) 1199 { /* Not enough room in the buffer - grow it. */ 1200 1201 /* just a shorter name for the current buffer */ 1202 YY_BUFFER_STATE b = YY_CURRENT_BUFFER; 1203 1204 int yy_c_buf_p_offset = 1205 (int) ((yy_c_buf_p) - b->yy_ch_buf); 1206 1207 if ( b->yy_is_our_buffer ) 1208 { 1209 int new_size = b->yy_buf_size * 2; 1210 1211 if ( new_size <= 0 ) 1212 b->yy_buf_size += b->yy_buf_size / 8; 1213 else 1214 b->yy_buf_size *= 2; 1215 1216 b->yy_ch_buf = (char *) 1217 /* Include room in for 2 EOB chars. */ 1218 ifyyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); 1219 } 1220 else 1221 /* Can't grow it, we don't own it. */ 1222 b->yy_ch_buf = 0; 1223 1224 if ( ! b->yy_ch_buf ) 1225 YY_FATAL_ERROR( 1226 "fatal error - scanner input buffer overflow" ); 1227 1228 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; 1229 1230 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - 1231 number_to_move - 1; 1232 1233 } 1234 1235 if ( num_to_read > YY_READ_BUF_SIZE ) 1236 num_to_read = YY_READ_BUF_SIZE; 1237 1238 /* Read in more data. */ 1239 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), 1240 (yy_n_chars), (size_t) num_to_read ); 1241 1242 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); 1243 } 1244 1245 if ( (yy_n_chars) == 0 ) 1246 { 1247 if ( number_to_move == YY_MORE_ADJ ) 1248 { 1249 ret_val = EOB_ACT_END_OF_FILE; 1250 ifyyrestart(ifyyin ); 1251 } 1252 1253 else 1254 { 1255 ret_val = EOB_ACT_LAST_MATCH; 1256 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = 1257 YY_BUFFER_EOF_PENDING; 1258 } 1259 } 1260 1261 else 1262 ret_val = EOB_ACT_CONTINUE_SCAN; 1263 1264 if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { 1265 /* Extend the array by 50%, plus the number we really need. */ 1266 yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); 1267 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) ifyyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); 1268 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) 1269 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); 1270 } 1271 1272 (yy_n_chars) += number_to_move; 1273 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; 1274 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; 1275 1276 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; 1277 1278 return ret_val; 1279} 1280 1281/* yy_get_previous_state - get the state just before the EOB char was reached */ 1282 1283 static yy_state_type yy_get_previous_state (void) 1284{ 1285 register yy_state_type yy_current_state; 1286 register char *yy_cp; 1287 1288 yy_current_state = (yy_start); 1289 1290 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) 1291 { 1292 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); 1293 if ( yy_accept[yy_current_state] ) 1294 { 1295 (yy_last_accepting_state) = yy_current_state; 1296 (yy_last_accepting_cpos) = yy_cp; 1297 } 1298 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 1299 { 1300 yy_current_state = (int) yy_def[yy_current_state]; 1301 if ( yy_current_state >= 64 ) 1302 yy_c = yy_meta[(unsigned int) yy_c]; 1303 } 1304 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 1305 } 1306 1307 return yy_current_state; 1308} 1309 1310/* yy_try_NUL_trans - try to make a transition on the NUL character 1311 * 1312 * synopsis 1313 * next_state = yy_try_NUL_trans( current_state ); 1314 */ 1315 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) 1316{ 1317 register int yy_is_jam; 1318 register char *yy_cp = (yy_c_buf_p); 1319 1320 register YY_CHAR yy_c = 1; 1321 if ( yy_accept[yy_current_state] ) 1322 { 1323 (yy_last_accepting_state) = yy_current_state; 1324 (yy_last_accepting_cpos) = yy_cp; 1325 } 1326 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 1327 { 1328 yy_current_state = (int) yy_def[yy_current_state]; 1329 if ( yy_current_state >= 64 ) 1330 yy_c = yy_meta[(unsigned int) yy_c]; 1331 } 1332 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 1333 yy_is_jam = (yy_current_state == 63); 1334 1335 return yy_is_jam ? 0 : yy_current_state; 1336} 1337 1338 static void yyunput (int c, register char * yy_bp ) 1339{ 1340 register char *yy_cp; 1341 1342 yy_cp = (yy_c_buf_p); 1343 1344 /* undo effects of setting up ifyytext */ 1345 *yy_cp = (yy_hold_char); 1346 1347 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) 1348 { /* need to shift things up to make room */ 1349 /* +2 for EOB chars. */ 1350 register int number_to_move = (yy_n_chars) + 2; 1351 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ 1352 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; 1353 register char *source = 1354 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; 1355 1356 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) 1357 *--dest = *--source; 1358 1359 yy_cp += (int) (dest - source); 1360 yy_bp += (int) (dest - source); 1361 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = 1362 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; 1363 1364 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) 1365 YY_FATAL_ERROR( "flex scanner push-back overflow" ); 1366 } 1367 1368 *--yy_cp = (char) c; 1369 1370 (yytext_ptr) = yy_bp; 1371 (yy_hold_char) = *yy_cp; 1372 (yy_c_buf_p) = yy_cp; 1373} 1374 1375#ifndef YY_NO_INPUT 1376#ifdef __cplusplus 1377 static int yyinput (void) 1378#else 1379 static int input (void) 1380#endif 1381 1382{ 1383 int c; 1384 1385 *(yy_c_buf_p) = (yy_hold_char); 1386 1387 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) 1388 { 1389 /* yy_c_buf_p now points to the character we want to return. 1390 * If this occurs *before* the EOB characters, then it's a 1391 * valid NUL; if not, then we've hit the end of the buffer. 1392 */ 1393 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) 1394 /* This was really a NUL. */ 1395 *(yy_c_buf_p) = '\0'; 1396 1397 else 1398 { /* need more input */ 1399 int offset = (yy_c_buf_p) - (yytext_ptr); 1400 ++(yy_c_buf_p); 1401 1402 switch ( yy_get_next_buffer( ) ) 1403 { 1404 case EOB_ACT_LAST_MATCH: 1405 /* This happens because yy_g_n_b() 1406 * sees that we've accumulated a 1407 * token and flags that we need to 1408 * try matching the token before 1409 * proceeding. But for input(), 1410 * there's no matching to consider. 1411 * So convert the EOB_ACT_LAST_MATCH 1412 * to EOB_ACT_END_OF_FILE. 1413 */ 1414 1415 /* Reset buffer status. */ 1416 ifyyrestart(ifyyin ); 1417 1418 /*FALLTHROUGH*/ 1419 1420 case EOB_ACT_END_OF_FILE: 1421 { 1422 if ( ifyywrap( ) ) 1423 return EOF; 1424 1425 if ( ! (yy_did_buffer_switch_on_eof) ) 1426 YY_NEW_FILE; 1427#ifdef __cplusplus 1428 return yyinput(); 1429#else 1430 return input(); 1431#endif 1432 } 1433 1434 case EOB_ACT_CONTINUE_SCAN: 1435 (yy_c_buf_p) = (yytext_ptr) + offset; 1436 break; 1437 } 1438 } 1439 } 1440 1441 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ 1442 *(yy_c_buf_p) = '\0'; /* preserve ifyytext */ 1443 (yy_hold_char) = *++(yy_c_buf_p); 1444 1445 return c; 1446} 1447#endif /* ifndef YY_NO_INPUT */ 1448 1449/** Immediately switch to a different input stream. 1450 * @param input_file A readable stream. 1451 * 1452 * @note This function does not reset the start condition to @c INITIAL . 1453 */ 1454 void ifyyrestart (FILE * input_file ) 1455{ 1456 1457 if ( ! YY_CURRENT_BUFFER ){ 1458 ifyyensure_buffer_stack (); 1459 YY_CURRENT_BUFFER_LVALUE = 1460 ifyy_create_buffer(ifyyin,YY_BUF_SIZE ); 1461 } 1462 1463 ifyy_init_buffer(YY_CURRENT_BUFFER,input_file ); 1464 ifyy_load_buffer_state( ); 1465} 1466 1467/** Switch to a different input buffer. 1468 * @param new_buffer The new input buffer. 1469 * 1470 */ 1471 void ifyy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) 1472{ 1473 1474 /* TODO. We should be able to replace this entire function body 1475 * with 1476 * ifyypop_buffer_state(); 1477 * ifyypush_buffer_state(new_buffer); 1478 */ 1479 ifyyensure_buffer_stack (); 1480 if ( YY_CURRENT_BUFFER == new_buffer ) 1481 return; 1482 1483 if ( YY_CURRENT_BUFFER ) 1484 { 1485 /* Flush out information for old buffer. */ 1486 *(yy_c_buf_p) = (yy_hold_char); 1487 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); 1488 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); 1489 } 1490 1491 YY_CURRENT_BUFFER_LVALUE = new_buffer; 1492 ifyy_load_buffer_state( ); 1493 1494 /* We don't actually know whether we did this switch during 1495 * EOF (ifyywrap()) processing, but the only time this flag 1496 * is looked at is after ifyywrap() is called, so it's safe 1497 * to go ahead and always set it. 1498 */ 1499 (yy_did_buffer_switch_on_eof) = 1; 1500} 1501 1502static void ifyy_load_buffer_state (void) 1503{ 1504 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; 1505 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; 1506 ifyyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; 1507 (yy_hold_char) = *(yy_c_buf_p); 1508} 1509 1510/** Allocate and initialize an input buffer state. 1511 * @param file A readable stream. 1512 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. 1513 * 1514 * @return the allocated buffer state. 1515 */ 1516 YY_BUFFER_STATE ifyy_create_buffer (FILE * file, int size ) 1517{ 1518 YY_BUFFER_STATE b; 1519 1520 b = (YY_BUFFER_STATE) ifyyalloc(sizeof( struct yy_buffer_state ) ); 1521 if ( ! b ) 1522 YY_FATAL_ERROR( "out of dynamic memory in ifyy_create_buffer()" ); 1523 1524 b->yy_buf_size = size; 1525 1526 /* yy_ch_buf has to be 2 characters longer than the size given because 1527 * we need to put in 2 end-of-buffer characters. 1528 */ 1529 b->yy_ch_buf = (char *) ifyyalloc(b->yy_buf_size + 2 ); 1530 if ( ! b->yy_ch_buf ) 1531 YY_FATAL_ERROR( "out of dynamic memory in ifyy_create_buffer()" ); 1532 1533 b->yy_is_our_buffer = 1; 1534 1535 ifyy_init_buffer(b,file ); 1536 1537 return b; 1538} 1539 1540/** Destroy the buffer. 1541 * @param b a buffer created with ifyy_create_buffer() 1542 * 1543 */ 1544 void ifyy_delete_buffer (YY_BUFFER_STATE b ) 1545{ 1546 1547 if ( ! b ) 1548 return; 1549 1550 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ 1551 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; 1552 1553 if ( b->yy_is_our_buffer ) 1554 ifyyfree((void *) b->yy_ch_buf ); 1555 1556 ifyyfree((void *) b ); 1557} 1558 1559#ifndef __cplusplus 1560extern int isatty (int ); 1561#endif /* __cplusplus */ 1562 1563/* Initializes or reinitializes a buffer. 1564 * This function is sometimes called more than once on the same buffer, 1565 * such as during a ifyyrestart() or at EOF. 1566 */ 1567 static void ifyy_init_buffer (YY_BUFFER_STATE b, FILE * file ) 1568 1569{ 1570 int oerrno = errno; 1571 1572 ifyy_flush_buffer(b ); 1573 1574 b->yy_input_file = file; 1575 b->yy_fill_buffer = 1; 1576 1577 /* If b is the current buffer, then ifyy_init_buffer was _probably_ 1578 * called from ifyyrestart() or through yy_get_next_buffer. 1579 * In that case, we don't want to reset the lineno or column. 1580 */ 1581 if (b != YY_CURRENT_BUFFER){ 1582 b->yy_bs_lineno = 1; 1583 b->yy_bs_column = 0; 1584 } 1585 1586 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; 1587 1588 errno = oerrno; 1589} 1590 1591/** Discard all buffered characters. On the next scan, YY_INPUT will be called. 1592 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. 1593 * 1594 */ 1595 void ifyy_flush_buffer (YY_BUFFER_STATE b ) 1596{ 1597 if ( ! b ) 1598 return; 1599 1600 b->yy_n_chars = 0; 1601 1602 /* We always need two end-of-buffer characters. The first causes 1603 * a transition to the end-of-buffer state. The second causes 1604 * a jam in that state. 1605 */ 1606 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; 1607 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; 1608 1609 b->yy_buf_pos = &b->yy_ch_buf[0]; 1610 1611 b->yy_at_bol = 1; 1612 b->yy_buffer_status = YY_BUFFER_NEW; 1613 1614 if ( b == YY_CURRENT_BUFFER ) 1615 ifyy_load_buffer_state( ); 1616} 1617 1618/** Pushes the new state onto the stack. The new state becomes 1619 * the current state. This function will allocate the stack 1620 * if necessary. 1621 * @param new_buffer The new state. 1622 * 1623 */ 1624void ifyypush_buffer_state (YY_BUFFER_STATE new_buffer ) 1625{ 1626 if (new_buffer == NULL) 1627 return; 1628 1629 ifyyensure_buffer_stack(); 1630 1631 /* This block is copied from ifyy_switch_to_buffer. */ 1632 if ( YY_CURRENT_BUFFER ) 1633 { 1634 /* Flush out information for old buffer. */ 1635 *(yy_c_buf_p) = (yy_hold_char); 1636 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); 1637 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); 1638 } 1639 1640 /* Only push if top exists. Otherwise, replace top. */ 1641 if (YY_CURRENT_BUFFER) 1642 (yy_buffer_stack_top)++; 1643 YY_CURRENT_BUFFER_LVALUE = new_buffer; 1644 1645 /* copied from ifyy_switch_to_buffer. */ 1646 ifyy_load_buffer_state( ); 1647 (yy_did_buffer_switch_on_eof) = 1; 1648} 1649 1650/** Removes and deletes the top of the stack, if present. 1651 * The next element becomes the new top. 1652 * 1653 */ 1654void ifyypop_buffer_state (void) 1655{ 1656 if (!YY_CURRENT_BUFFER) 1657 return; 1658 1659 ifyy_delete_buffer(YY_CURRENT_BUFFER ); 1660 YY_CURRENT_BUFFER_LVALUE = NULL; 1661 if ((yy_buffer_stack_top) > 0) 1662 --(yy_buffer_stack_top); 1663 1664 if (YY_CURRENT_BUFFER) { 1665 ifyy_load_buffer_state( ); 1666 (yy_did_buffer_switch_on_eof) = 1; 1667 } 1668} 1669 1670/* Allocates the stack if it does not exist. 1671 * Guarantees space for at least one push. 1672 */ 1673static void ifyyensure_buffer_stack (void) 1674{ 1675 int num_to_alloc; 1676 1677 if (!(yy_buffer_stack)) { 1678 1679 /* First allocation is just for 2 elements, since we don't know if this 1680 * scanner will even need a stack. We use 2 instead of 1 to avoid an 1681 * immediate realloc on the next call. 1682 */ 1683 num_to_alloc = 1; 1684 (yy_buffer_stack) = (struct yy_buffer_state**)ifyyalloc 1685 (num_to_alloc * sizeof(struct yy_buffer_state*) 1686 ); 1687 if ( ! (yy_buffer_stack) ) 1688 YY_FATAL_ERROR( "out of dynamic memory in ifyyensure_buffer_stack()" ); 1689 1690 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); 1691 1692 (yy_buffer_stack_max) = num_to_alloc; 1693 (yy_buffer_stack_top) = 0; 1694 return; 1695 } 1696 1697 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ 1698 1699 /* Increase the buffer to prepare for a possible push. */ 1700 int grow_size = 8 /* arbitrary grow size */; 1701 1702 num_to_alloc = (yy_buffer_stack_max) + grow_size; 1703 (yy_buffer_stack) = (struct yy_buffer_state**)ifyyrealloc 1704 ((yy_buffer_stack), 1705 num_to_alloc * sizeof(struct yy_buffer_state*) 1706 ); 1707 if ( ! (yy_buffer_stack) ) 1708 YY_FATAL_ERROR( "out of dynamic memory in ifyyensure_buffer_stack()" ); 1709 1710 /* zero only the new slots.*/ 1711 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); 1712 (yy_buffer_stack_max) = num_to_alloc; 1713 } 1714} 1715 1716/** Setup the input buffer state to scan directly from a user-specified character buffer. 1717 * @param base the character buffer 1718 * @param size the size in bytes of the character buffer 1719 * 1720 * @return the newly allocated buffer state object. 1721 */ 1722YY_BUFFER_STATE ifyy_scan_buffer (char * base, yy_size_t size ) 1723{ 1724 YY_BUFFER_STATE b; 1725 1726 if ( size < 2 || 1727 base[size-2] != YY_END_OF_BUFFER_CHAR || 1728 base[size-1] != YY_END_OF_BUFFER_CHAR ) 1729 /* They forgot to leave room for the EOB's. */ 1730 return 0; 1731 1732 b = (YY_BUFFER_STATE) ifyyalloc(sizeof( struct yy_buffer_state ) ); 1733 if ( ! b ) 1734 YY_FATAL_ERROR( "out of dynamic memory in ifyy_scan_buffer()" ); 1735 1736 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ 1737 b->yy_buf_pos = b->yy_ch_buf = base; 1738 b->yy_is_our_buffer = 0; 1739 b->yy_input_file = 0; 1740 b->yy_n_chars = b->yy_buf_size; 1741 b->yy_is_interactive = 0; 1742 b->yy_at_bol = 1; 1743 b->yy_fill_buffer = 0; 1744 b->yy_buffer_status = YY_BUFFER_NEW; 1745 1746 ifyy_switch_to_buffer(b ); 1747 1748 return b; 1749} 1750 1751/** Setup the input buffer state to scan a string. The next call to ifyylex() will 1752 * scan from a @e copy of @a str. 1753 * @param yystr a NUL-terminated string to scan 1754 * 1755 * @return the newly allocated buffer state object. 1756 * @note If you want to scan bytes that may contain NUL values, then use 1757 * ifyy_scan_bytes() instead. 1758 */ 1759YY_BUFFER_STATE ifyy_scan_string (yyconst char * yystr ) 1760{ 1761 1762 return ifyy_scan_bytes(yystr,strlen(yystr) ); 1763} 1764 1765/** Setup the input buffer state to scan the given bytes. The next call to ifyylex() will 1766 * scan from a @e copy of @a bytes. 1767 * @param bytes the byte buffer to scan 1768 * @param len the number of bytes in the buffer pointed to by @a bytes. 1769 * 1770 * @return the newly allocated buffer state object. 1771 */ 1772YY_BUFFER_STATE ifyy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) 1773{ 1774 YY_BUFFER_STATE b; 1775 char *buf; 1776 yy_size_t n; 1777 int i; 1778 1779 /* Get memory for full buffer, including space for trailing EOB's. */ 1780 n = _yybytes_len + 2; 1781 buf = (char *) ifyyalloc(n ); 1782 if ( ! buf ) 1783 YY_FATAL_ERROR( "out of dynamic memory in ifyy_scan_bytes()" ); 1784 1785 for ( i = 0; i < _yybytes_len; ++i ) 1786 buf[i] = yybytes[i]; 1787 1788 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; 1789 1790 b = ifyy_scan_buffer(buf,n ); 1791 if ( ! b ) 1792 YY_FATAL_ERROR( "bad buffer in ifyy_scan_bytes()" ); 1793 1794 /* It's okay to grow etc. this buffer, and we should throw it 1795 * away when we're done. 1796 */ 1797 b->yy_is_our_buffer = 1; 1798 1799 return b; 1800} 1801 1802#ifndef YY_EXIT_FAILURE 1803#define YY_EXIT_FAILURE 2 1804#endif 1805 1806static void yy_fatal_error (yyconst char* msg ) 1807{ 1808 (void) fprintf( stderr, "%s\n", msg ); 1809 exit( YY_EXIT_FAILURE ); 1810} 1811 1812/* Redefine yyless() so it works in section 3 code. */ 1813 1814#undef yyless 1815#define yyless(n) \ 1816 do \ 1817 { \ 1818 /* Undo effects of setting up ifyytext. */ \ 1819 int yyless_macro_arg = (n); \ 1820 YY_LESS_LINENO(yyless_macro_arg);\ 1821 ifyytext[ifyyleng] = (yy_hold_char); \ 1822 (yy_c_buf_p) = ifyytext + yyless_macro_arg; \ 1823 (yy_hold_char) = *(yy_c_buf_p); \ 1824 *(yy_c_buf_p) = '\0'; \ 1825 ifyyleng = yyless_macro_arg; \ 1826 } \ 1827 while ( 0 ) 1828 1829/* Accessor methods (get/set functions) to struct members. */ 1830 1831/** Get the current line number. 1832 * 1833 */ 1834int ifyyget_lineno (void) 1835{ 1836 1837 return ifyylineno; 1838} 1839 1840/** Get the input stream. 1841 * 1842 */ 1843FILE *ifyyget_in (void) 1844{ 1845 return ifyyin; 1846} 1847 1848/** Get the output stream. 1849 * 1850 */ 1851FILE *ifyyget_out (void) 1852{ 1853 return ifyyout; 1854} 1855 1856/** Get the length of the current token. 1857 * 1858 */ 1859int ifyyget_leng (void) 1860{ 1861 return ifyyleng; 1862} 1863 1864/** Get the current token. 1865 * 1866 */ 1867 1868char *ifyyget_text (void) 1869{ 1870 return ifyytext; 1871} 1872 1873/** Set the current line number. 1874 * @param line_number 1875 * 1876 */ 1877void ifyyset_lineno (int line_number ) 1878{ 1879 1880 ifyylineno = line_number; 1881} 1882 1883/** Set the input stream. This does not discard the current 1884 * input buffer. 1885 * @param in_str A readable stream. 1886 * 1887 * @see ifyy_switch_to_buffer 1888 */ 1889void ifyyset_in (FILE * in_str ) 1890{ 1891 ifyyin = in_str ; 1892} 1893 1894void ifyyset_out (FILE * out_str ) 1895{ 1896 ifyyout = out_str ; 1897} 1898 1899int ifyyget_debug (void) 1900{ 1901 return ifyy_flex_debug; 1902} 1903 1904void ifyyset_debug (int bdebug ) 1905{ 1906 ifyy_flex_debug = bdebug ; 1907} 1908 1909static int yy_init_globals (void) 1910{ 1911 /* Initialization is the same as for the non-reentrant scanner. 1912 * This function is called from ifyylex_destroy(), so don't allocate here. 1913 */ 1914 1915 (yy_buffer_stack) = 0; 1916 (yy_buffer_stack_top) = 0; 1917 (yy_buffer_stack_max) = 0; 1918 (yy_c_buf_p) = (char *) 0; 1919 (yy_init) = 0; 1920 (yy_start) = 0; 1921 1922/* Defined in main.c */ 1923#ifdef YY_STDINIT 1924 ifyyin = stdin; 1925 ifyyout = stdout; 1926#else 1927 ifyyin = (FILE *) 0; 1928 ifyyout = (FILE *) 0; 1929#endif 1930 1931 /* For future reference: Set errno on error, since we are called by 1932 * ifyylex_init() 1933 */ 1934 return 0; 1935} 1936 1937/* ifyylex_destroy is for both reentrant and non-reentrant scanners. */ 1938int ifyylex_destroy (void) 1939{ 1940 1941 /* Pop the buffer stack, destroying each element. */ 1942 while(YY_CURRENT_BUFFER){ 1943 ifyy_delete_buffer(YY_CURRENT_BUFFER ); 1944 YY_CURRENT_BUFFER_LVALUE = NULL; 1945 ifyypop_buffer_state(); 1946 } 1947 1948 /* Destroy the stack itself. */ 1949 ifyyfree((yy_buffer_stack) ); 1950 (yy_buffer_stack) = NULL; 1951 1952 /* Reset the globals. This is important in a non-reentrant scanner so the next time 1953 * ifyylex() is called, initialization will occur. */ 1954 yy_init_globals( ); 1955 1956 return 0; 1957} 1958 1959/* 1960 * Internal utility routines. 1961 */ 1962 1963#ifndef yytext_ptr 1964static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) 1965{ 1966 register int i; 1967 for ( i = 0; i < n; ++i ) 1968 s1[i] = s2[i]; 1969} 1970#endif 1971 1972#ifdef YY_NEED_STRLEN 1973static int yy_flex_strlen (yyconst char * s ) 1974{ 1975 register int n; 1976 for ( n = 0; s[n]; ++n ) 1977 ; 1978 1979 return n; 1980} 1981#endif 1982 1983void *ifyyalloc (yy_size_t size ) 1984{ 1985 return (void *) malloc( size ); 1986} 1987 1988void *ifyyrealloc (void * ptr, yy_size_t size ) 1989{ 1990 /* The cast to (char *) in the following accommodates both 1991 * implementations that use char* generic pointers, and those 1992 * that use void* generic pointers. It works with the latter 1993 * because both ANSI C and C++ allow castless assignment from 1994 * any pointer type to void*, and deal with argument conversions 1995 * as though doing an assignment. 1996 */ 1997 return (void *) realloc( (char *) ptr, size ); 1998} 1999 2000void ifyyfree (void * ptr ) 2001{ 2002 free( (char *) ptr ); /* see ifyyrealloc() for (char *) cast */ 2003} 2004 2005#define YYTABLES_NAME "yytables" 2006 2007#line 186 "dad_token.l" 2008 2009 2010 2011int 2012dad_parse(const char *file) 2013{ 2014 if ((ifyyin = fopen(file, "r")) == NULL) { 2015 if (errno == ENOENT) 2016 return (0); 2017 dprintf(LOG_ERR, "dad_parse: fopen(%s): %s", 2018 file, strerror(errno)); 2019 return (-1); 2020 } 2021 ifyylex(); 2022 return 0; 2023} 2024 2025