2
#line 3 "tokenparser.c"
4
#define YY_INT_ALIGNED short int
6
/* A lexical scanner generated by flex */
9
#define YY_FLEX_MAJOR_VERSION 2
10
#define YY_FLEX_MINOR_VERSION 5
11
#define YY_FLEX_SUBMINOR_VERSION 31
12
#if YY_FLEX_SUBMINOR_VERSION > 0
16
/* First, we deal with platform-specific or compiler-specific issues. */
18
/* begin standard C headers. */
24
/* end standard C headers. */
26
/* flex integer type definitions */
31
/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
33
#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
35
typedef int8_t flex_int8_t;
36
typedef uint8_t flex_uint8_t;
37
typedef int16_t flex_int16_t;
38
typedef uint16_t flex_uint16_t;
39
typedef int32_t flex_int32_t;
40
typedef uint32_t flex_uint32_t;
42
typedef signed char flex_int8_t;
43
typedef short int flex_int16_t;
44
typedef int flex_int32_t;
45
typedef unsigned char flex_uint8_t;
46
typedef unsigned short int flex_uint16_t;
47
typedef unsigned int flex_uint32_t;
50
/* Limits of integral types. */
52
#define INT8_MIN (-128)
55
#define INT16_MIN (-32767-1)
58
#define INT32_MIN (-2147483647-1)
61
#define INT8_MAX (127)
64
#define INT16_MAX (32767)
67
#define INT32_MAX (2147483647)
70
#define UINT8_MAX (255U)
73
#define UINT16_MAX (65535U)
76
#define UINT32_MAX (4294967295U)
79
#endif /* ! FLEXINT_H */
83
/* The "const" storage-class-modifier is valid. */
86
#else /* ! __cplusplus */
93
#endif /* ! __cplusplus */
101
/* Returned upon end-of-file. */
104
/* Promotes a possibly negative, possibly signed char to an unsigned
105
* integer for use as an array index. If the signed char is negative,
106
* we want to instead treat it as an 8-bit unsigned char, hence the
109
#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
111
/* Enter a start condition. This macro really ought to take a parameter,
112
* but we do it the disgusting crufty way forced on us by the ()-less
113
* definition of BEGIN.
115
#define BEGIN (yy_start) = 1 + 2 *
117
/* Translate the current start state into a value that can be later handed
118
* to BEGIN to return to the state. The YYSTATE alias is for lex
121
#define YY_START (((yy_start) - 1) / 2)
122
#define YYSTATE YY_START
124
/* Action number for EOF rule of a given start state. */
125
#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
127
/* Special action meaning "start processing a new file". */
128
#define YY_NEW_FILE tprestart(tpin )
130
#define YY_END_OF_BUFFER_CHAR 0
132
/* Size of default input buffer. */
134
#define YY_BUF_SIZE 16384
137
#ifndef YY_TYPEDEF_YY_BUFFER_STATE
138
#define YY_TYPEDEF_YY_BUFFER_STATE
139
typedef struct yy_buffer_state *YY_BUFFER_STATE;
144
extern FILE *tpin, *tpout;
146
#define EOB_ACT_CONTINUE_SCAN 0
147
#define EOB_ACT_END_OF_FILE 1
148
#define EOB_ACT_LAST_MATCH 2
150
#define YY_LESS_LINENO(n)
152
/* Return all but the first "n" matched characters back to the input stream. */
156
/* Undo effects of setting up tptext. */ \
157
int yyless_macro_arg = (n); \
158
YY_LESS_LINENO(yyless_macro_arg);\
159
*yy_cp = (yy_hold_char); \
160
YY_RESTORE_YY_MORE_OFFSET \
161
(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
162
YY_DO_BEFORE_ACTION; /* set up tptext again */ \
166
#define unput(c) yyunput( c, (yytext_ptr) )
168
/* The following is because we cannot portably get our hands on size_t
169
* (without autoconf's help, which isn't available because we want
170
* flex-generated scanners to compile on their own).
173
#ifndef YY_TYPEDEF_YY_SIZE_T
174
#define YY_TYPEDEF_YY_SIZE_T
175
typedef unsigned int yy_size_t;
178
#ifndef YY_STRUCT_YY_BUFFER_STATE
179
#define YY_STRUCT_YY_BUFFER_STATE
180
struct yy_buffer_state
184
char *yy_ch_buf; /* input buffer */
185
char *yy_buf_pos; /* current position in input buffer */
187
/* Size of input buffer in bytes, not including room for EOB
190
yy_size_t yy_buf_size;
192
/* Number of characters read into yy_ch_buf, not including EOB
197
/* Whether we "own" the buffer - i.e., we know we created it,
198
* and can realloc() it to grow it, and should free() it to
201
int yy_is_our_buffer;
203
/* Whether this is an "interactive" input source; if so, and
204
* if we're using stdio for input, then we want to use getc()
205
* instead of fread(), to make sure we stop fetching input after
208
int yy_is_interactive;
210
/* Whether we're considered to be at the beginning of a line.
211
* If so, '^' rules will be active on the next match, otherwise
216
int yy_bs_lineno; /**< The line count. */
217
int yy_bs_column; /**< The column count. */
219
/* Whether to try to fill the input buffer when we reach the
224
int yy_buffer_status;
226
#define YY_BUFFER_NEW 0
227
#define YY_BUFFER_NORMAL 1
228
/* When an EOF's been seen but there's still some text to process
229
* then we mark the buffer as YY_EOF_PENDING, to indicate that we
230
* shouldn't try reading from the input source any more. We might
231
* still have a bunch of tokens to match, though, because of
232
* possible backing-up.
234
* When we actually see the EOF, we change the status to "new"
235
* (via tprestart()), so that the user can continue scanning by
236
* just pointing tpin at a new input file.
238
#define YY_BUFFER_EOF_PENDING 2
241
#endif /* !YY_STRUCT_YY_BUFFER_STATE */
243
/* Stack of input buffers. */
244
static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
245
static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
246
static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
248
/* We provide macros for accessing buffer states in case in the
249
* future we want to put the buffer states in a more general
252
* Returns the top of the stack, or NULL.
254
#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
255
? (yy_buffer_stack)[(yy_buffer_stack_top)] \
258
/* Same as previous macro, but useful when we know that the buffer stack is not
259
* NULL or when we need an lvalue. For internal use only.
261
#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
263
/* yy_hold_char holds the character lost when tptext is formed. */
264
static char yy_hold_char;
265
static int yy_n_chars; /* number of characters read into yy_ch_buf */
268
/* Points to current character in buffer. */
269
static char *yy_c_buf_p = (char *) 0;
270
static int yy_init = 1; /* whether we need to initialize */
271
static int yy_start = 0; /* start state number */
273
/* Flag which is used to allow tpwrap()'s to do buffer switches
274
* instead of setting up a fresh tpin. A bit of a hack ...
276
static int yy_did_buffer_switch_on_eof;
278
void tprestart (FILE *input_file );
279
void tp_switch_to_buffer (YY_BUFFER_STATE new_buffer );
280
YY_BUFFER_STATE tp_create_buffer (FILE *file,int size );
281
void tp_delete_buffer (YY_BUFFER_STATE b );
282
void tp_flush_buffer (YY_BUFFER_STATE b );
283
void tppush_buffer_state (YY_BUFFER_STATE new_buffer );
284
void tppop_buffer_state (void );
286
static void tpensure_buffer_stack (void );
287
static void tp_load_buffer_state (void );
288
static void tp_init_buffer (YY_BUFFER_STATE b,FILE *file );
290
#define YY_FLUSH_BUFFER tp_flush_buffer(YY_CURRENT_BUFFER )
292
YY_BUFFER_STATE tp_scan_buffer (char *base,yy_size_t size );
293
YY_BUFFER_STATE tp_scan_string (yyconst char *yy_str );
294
YY_BUFFER_STATE tp_scan_bytes (yyconst char *bytes,int len );
296
void *tpalloc (yy_size_t );
297
void *tprealloc (void *,yy_size_t );
298
void tpfree (void * );
300
#define yy_new_buffer tp_create_buffer
302
#define yy_set_interactive(is_interactive) \
304
if ( ! YY_CURRENT_BUFFER ){ \
305
tpensure_buffer_stack (); \
306
YY_CURRENT_BUFFER_LVALUE = \
307
tp_create_buffer(tpin,YY_BUF_SIZE ); \
309
YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
312
#define yy_set_bol(at_bol) \
314
if ( ! YY_CURRENT_BUFFER ){\
315
tpensure_buffer_stack (); \
316
YY_CURRENT_BUFFER_LVALUE = \
317
tp_create_buffer(tpin,YY_BUF_SIZE ); \
319
YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
322
#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
324
/* Begin user sect3 */
326
typedef unsigned char YY_CHAR;
328
FILE *tpin = (FILE *) 0, *tpout = (FILE *) 0;
330
typedef int yy_state_type;
337
#define yytext_ptr tptext
339
static yy_state_type yy_get_previous_state (void );
340
static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
341
static int yy_get_next_buffer (void );
342
static void yy_fatal_error (yyconst char msg[] );
344
/* Done after the current pattern has been matched and before the
345
* corresponding action - sets up tptext.
347
#define YY_DO_BEFORE_ACTION \
348
(yytext_ptr) = yy_bp; \
349
tpleng = (size_t) (yy_cp - yy_bp); \
350
(yy_hold_char) = *yy_cp; \
352
(yy_c_buf_p) = yy_cp;
354
#define YY_NUM_RULES 7
355
#define YY_END_OF_BUFFER 8
356
/* This struct is not used in this scanner,
357
but its presence is necessary. */
360
flex_int32_t yy_verify;
363
static yyconst flex_int16_t yy_accept[39] =
365
0, 0, 8, 6, 4, 2, 1, 6, 1, 0,
366
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
367
0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
368
0, 0, 0, 0, 0, 0, 5, 0
371
static yyconst flex_int32_t yy_ec[256] =
373
1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
374
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
375
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
376
1, 2, 4, 4, 5, 4, 4, 4, 4, 4,
377
4, 4, 4, 4, 4, 4, 6, 7, 7, 7,
378
7, 7, 7, 7, 7, 7, 7, 4, 1, 8,
379
4, 9, 4, 4, 10, 10, 10, 10, 10, 10,
380
10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
381
10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
382
1, 1, 1, 4, 4, 1, 11, 11, 11, 11,
384
12, 11, 13, 11, 14, 11, 15, 11, 11, 16,
385
11, 11, 11, 17, 18, 19, 11, 11, 11, 11,
386
20, 11, 1, 1, 1, 4, 1, 1, 1, 1,
387
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
388
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
389
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
390
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
391
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
392
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
393
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
395
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
396
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
397
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
398
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
399
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
403
static yyconst flex_int32_t yy_meta[21] =
405
1, 2, 3, 4, 4, 4, 2, 1, 1, 2,
406
2, 2, 2, 2, 2, 2, 2, 2, 2, 2
409
static yyconst flex_int16_t yy_base[43] =
411
0, 7, 49, 50, 50, 50, 0, 1, 0, 36,
412
28, 26, 28, 35, 29, 0, 26, 33, 27, 33,
413
29, 22, 0, 24, 27, 14, 27, 23, 13, 50,
414
10, 9, 4, 1, 0, 2, 50, 50, 19, 23,
418
static yyconst flex_int16_t yy_def[43] =
420
39, 39, 38, 38, 38, 38, 40, 38, 40, 38,
421
38, 38, 38, 38, 38, 41, 38, 41, 38, 38,
422
38, 38, 42, 38, 42, 38, 38, 38, 38, 38,
423
38, 38, 38, 38, 38, 38, 38, 0, 38, 38,
427
static yyconst flex_int16_t yy_nxt[71] =
429
38, 5, 6, 18, 7, 38, 38, 8, 5, 6,
430
37, 7, 36, 38, 8, 10, 35, 34, 11, 4,
431
4, 4, 4, 9, 9, 33, 9, 25, 32, 25,
432
31, 30, 29, 28, 27, 26, 24, 23, 22, 21,
433
20, 19, 17, 16, 15, 14, 13, 12, 38, 3,
434
38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
435
38, 38, 38, 38, 38, 38, 38, 38, 38, 38
438
static yyconst flex_int16_t yy_chk[71] =
440
0, 1, 1, 41, 1, 0, 0, 1, 2, 2,
441
36, 2, 35, 0, 2, 8, 34, 33, 8, 39,
442
39, 39, 39, 40, 40, 32, 40, 42, 31, 42,
443
29, 28, 27, 26, 25, 24, 22, 21, 20, 19,
444
18, 17, 15, 14, 13, 12, 11, 10, 3, 38,
445
38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
446
38, 38, 38, 38, 38, 38, 38, 38, 38, 38
449
static yy_state_type yy_last_accepting_state;
450
static char *yy_last_accepting_cpos;
452
extern int tp_flex_debug;
453
int tp_flex_debug = 0;
455
/* The intent behind this definition is that it'll catch
456
* any uses of REJECT which flex missed.
458
#define REJECT reject_used_but_not_detected
459
#define yymore() yymore_used_but_not_detected
460
#define YY_MORE_ADJ 0
461
#define YY_RESTORE_YY_MORE_OFFSET
463
#line 1 "tokenparser.l"
465
* Reads lexical config files and updates database.
467
* MUSCLE SmartCard Development ( http://www.linuxnet.com )
469
* Copyright (C) 2001-2003
470
* David Corcoran <corcoran@linuxnet.com>
471
* Ludovic Rousseau <ludovic.rousseau@free.fr>
473
* $Id: tokenparser.l,v 1.18 2005/02/22 14:40:26 rousseau Exp $
475
#line 14 "tokenparser.l"
482
#include "debuglog.h"
484
#include "strlcpycat.h"
486
void tpevalToken(char *pcToken, int tokType);
488
static char *pcDesiredKey = 0;
489
static char pcKey[TOKEN_MAX_KEY_SIZE];
490
static char pcValue[TOKEN_MAX_VALUE_SIZE];
491
static char pcFinValue[TOKEN_MAX_VALUE_SIZE];
492
static int valueIndex = 0;
493
static int desiredIndex = 0;
495
void tperrorCheck (char *pcToken_error);
497
#line 498 "tokenparser.c"
501
#ifndef YY_NO_UNISTD_H
502
/* Special case for "unistd.h", since it is non-ANSI. We include it way
503
* down here because we want the user's section 1 to have been scanned first.
504
* The user has a chance to override it with an option.
509
#ifndef YY_EXTRA_TYPE
510
#define YY_EXTRA_TYPE void *
513
/* Macros after this point can all be overridden by user definitions in
517
#ifndef YY_SKIP_YYWRAP
519
extern "C" int tpwrap (void );
521
extern int tpwrap (void );
526
static void yy_flex_strncpy (char *,yyconst char *,int );
529
#ifdef YY_NEED_STRLEN
530
static int yy_flex_strlen (yyconst char * );
536
static int yyinput (void );
538
static int input (void );
543
/* Amount of stuff to slurp up with each read. */
544
#ifndef YY_READ_BUF_SIZE
545
#define YY_READ_BUF_SIZE 8192
548
/* Copy whatever the last rule matched to the standard output. */
550
/* This used to be an fputs(), but since the string might contain NUL's,
551
* we now use fwrite().
553
#define ECHO (void) fwrite( tptext, tpleng, 1, tpout )
556
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
557
* is returned in "result".
560
#define YY_INPUT(buf,result,max_size) \
561
if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
565
for ( n = 0; n < max_size && \
566
(c = getc( tpin )) != EOF && c != '\n'; ++n ) \
569
buf[n++] = (char) c; \
570
if ( c == EOF && ferror( tpin ) ) \
571
YY_FATAL_ERROR( "input in flex scanner failed" ); \
577
while ( (result = fread(buf, 1, max_size, tpin))==0 && ferror(tpin)) \
579
if( errno != EINTR) \
581
YY_FATAL_ERROR( "input in flex scanner failed" ); \
592
/* No semi-colon after return; correct usage is to write "yyterminate();" -
593
* we don't want an extra ';' after the "return" because that will cause
594
* some compilers to complain about unreachable statements.
597
#define yyterminate() return YY_NULL
600
/* Number of entries by which start-condition stack grows. */
601
#ifndef YY_START_STACK_INCR
602
#define YY_START_STACK_INCR 25
605
/* Report a fatal error. */
606
#ifndef YY_FATAL_ERROR
607
#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
610
/* end tables serialization structures and prototypes */
612
/* Default declaration of generated scanner - a define so the user can
613
* easily add parameters.
616
#define YY_DECL_IS_OURS 1
618
extern int tplex (void);
620
#define YY_DECL int tplex (void)
621
#endif /* !YY_DECL */
623
/* Code executed at the beginning of each rule, after tptext and tpleng
626
#ifndef YY_USER_ACTION
627
#define YY_USER_ACTION
630
/* Code executed at the end of each rule. */
632
#define YY_BREAK break;
635
#define YY_RULE_SETUP \
638
/** The main scanner function which does all the work.
642
register yy_state_type yy_current_state;
643
register char *yy_cp, *yy_bp;
646
#line 39 "tokenparser.l"
649
#line 650 "tokenparser.c"
660
(yy_start) = 1; /* first start state */
668
if ( ! YY_CURRENT_BUFFER ) {
669
tpensure_buffer_stack ();
670
YY_CURRENT_BUFFER_LVALUE =
671
tp_create_buffer(tpin,YY_BUF_SIZE );
674
tp_load_buffer_state( );
677
while ( 1 ) /* loops until end-of-file is reached */
679
yy_cp = (yy_c_buf_p);
681
/* Support of tptext. */
682
*yy_cp = (yy_hold_char);
684
/* yy_bp points to the position in yy_ch_buf of the start of
689
yy_current_state = (yy_start);
693
register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
694
if ( yy_accept[yy_current_state] )
696
(yy_last_accepting_state) = yy_current_state;
697
(yy_last_accepting_cpos) = yy_cp;
699
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
701
yy_current_state = (int) yy_def[yy_current_state];
702
if ( yy_current_state >= 39 )
703
yy_c = yy_meta[(unsigned int) yy_c];
705
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
708
while ( yy_base[yy_current_state] != 50 );
711
yy_act = yy_accept[yy_current_state];
713
{ /* have to back up */
714
yy_cp = (yy_last_accepting_cpos);
715
yy_current_state = (yy_last_accepting_state);
716
yy_act = yy_accept[yy_current_state];
721
do_action: /* This label is used only to access EOF actions. */
724
{ /* beginning of action switch */
725
case 0: /* must back up */
726
/* undo the effects of YY_DO_BEFORE_ACTION */
727
*yy_cp = (yy_hold_char);
728
yy_cp = (yy_last_accepting_cpos);
729
yy_current_state = (yy_last_accepting_state);
734
#line 41 "tokenparser.l"
738
/* rule 2 can match eol */
740
#line 42 "tokenparser.l"
745
#line 43 "tokenparser.l"
746
{ valueIndex = 0; tpevalToken(tptext, TOKEN_TYPE_KEY); }
750
#line 44 "tokenparser.l"
755
#line 45 "tokenparser.l"
756
{tpevalToken(tptext, TOKEN_TYPE_STRING); valueIndex += 1;}
760
#line 46 "tokenparser.l"
761
{ tperrorCheck(tptext); }
765
#line 47 "tokenparser.l"
768
#line 769 "tokenparser.c"
769
case YY_STATE_EOF(INITIAL):
772
case YY_END_OF_BUFFER:
774
/* Amount of text matched not including the EOB char. */
775
int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
777
/* Undo the effects of YY_DO_BEFORE_ACTION. */
778
*yy_cp = (yy_hold_char);
779
YY_RESTORE_YY_MORE_OFFSET
781
if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
783
/* We're scanning a new file or input source. It's
784
* possible that this happened because the user
785
* just pointed tpin at a new source and called
786
* tplex(). If so, then we have to assure
787
* consistency between YY_CURRENT_BUFFER and our
788
* globals. Here is the right place to do so, because
789
* this is the first action (other than possibly a
790
* back-up) that will match for the new input source.
792
(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
793
YY_CURRENT_BUFFER_LVALUE->yy_input_file = tpin;
794
YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
797
/* Note that here we test for yy_c_buf_p "<=" to the position
798
* of the first EOB in the buffer, since yy_c_buf_p will
799
* already have been incremented past the NUL character
800
* (since all states make transitions on EOB to the
801
* end-of-buffer state). Contrast this with the test
804
if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
805
{ /* This was really a NUL. */
806
yy_state_type yy_next_state;
808
(yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
810
yy_current_state = yy_get_previous_state( );
812
/* Okay, we're now positioned to make the NUL
813
* transition. We couldn't have
814
* yy_get_previous_state() go ahead and do it
815
* for us because it doesn't know how to deal
816
* with the possibility of jamming (and we don't
817
* want to build jamming into it because then it
818
* will run more slowly).
821
yy_next_state = yy_try_NUL_trans( yy_current_state );
823
yy_bp = (yytext_ptr) + YY_MORE_ADJ;
827
/* Consume the NUL. */
828
yy_cp = ++(yy_c_buf_p);
829
yy_current_state = yy_next_state;
835
yy_cp = (yy_c_buf_p);
840
else switch ( yy_get_next_buffer( ) )
842
case EOB_ACT_END_OF_FILE:
844
(yy_did_buffer_switch_on_eof) = 0;
848
/* Note: because we've taken care in
849
* yy_get_next_buffer() to have set up
850
* tptext, we can now set up
851
* yy_c_buf_p so that if some total
852
* hoser (like flex itself) wants to
853
* call the scanner after we return the
854
* YY_NULL, it'll still work - another
855
* YY_NULL will get returned.
857
(yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
859
yy_act = YY_STATE_EOF(YY_START);
865
if ( ! (yy_did_buffer_switch_on_eof) )
871
case EOB_ACT_CONTINUE_SCAN:
873
(yytext_ptr) + yy_amount_of_matched_text;
875
yy_current_state = yy_get_previous_state( );
877
yy_cp = (yy_c_buf_p);
878
yy_bp = (yytext_ptr) + YY_MORE_ADJ;
881
case EOB_ACT_LAST_MATCH:
883
&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
885
yy_current_state = yy_get_previous_state( );
887
yy_cp = (yy_c_buf_p);
888
yy_bp = (yytext_ptr) + YY_MORE_ADJ;
896
"fatal flex scanner internal error--no action found" );
897
} /* end of action switch */
898
} /* end of scanning one token */
901
/* yy_get_next_buffer - try to read in a new buffer
903
* Returns a code representing an action:
904
* EOB_ACT_LAST_MATCH -
905
* EOB_ACT_CONTINUE_SCAN - continue scanning from current position
906
* EOB_ACT_END_OF_FILE - end of file
908
static int yy_get_next_buffer (void)
910
register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
911
register char *source = (yytext_ptr);
912
register int number_to_move, i;
915
if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
917
"fatal flex scanner internal error--end of buffer missed" );
919
if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
920
{ /* Don't try to fill the buffer, so this is an EOF. */
921
if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
923
/* We matched a single character, the EOB, so
924
* treat this as a final EOF.
926
return EOB_ACT_END_OF_FILE;
931
/* We matched some text prior to the EOB, first
934
return EOB_ACT_LAST_MATCH;
938
/* Try to read more data. */
940
/* First move last chars to start of buffer. */
941
number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
943
for ( i = 0; i < number_to_move; ++i )
944
*(dest++) = *(source++);
946
if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
947
/* don't do the read, it's not guaranteed to return an EOF,
950
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
955
YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
957
while ( num_to_read <= 0 )
958
{ /* Not enough room in the buffer - grow it. */
960
/* just a shorter name for the current buffer */
961
YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
963
int yy_c_buf_p_offset =
964
(int) ((yy_c_buf_p) - b->yy_ch_buf);
966
if ( b->yy_is_our_buffer )
968
int new_size = b->yy_buf_size * 2;
971
b->yy_buf_size += b->yy_buf_size / 8;
975
b->yy_ch_buf = (char *)
976
/* Include room in for 2 EOB chars. */
977
tprealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
980
/* Can't grow it, we don't own it. */
983
if ( ! b->yy_ch_buf )
985
"fatal error - scanner input buffer overflow" );
987
(yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
989
num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
994
if ( num_to_read > YY_READ_BUF_SIZE )
995
num_to_read = YY_READ_BUF_SIZE;
997
/* Read in more data. */
998
YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
999
(yy_n_chars), num_to_read );
1001
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1004
if ( (yy_n_chars) == 0 )
1006
if ( number_to_move == YY_MORE_ADJ )
1008
ret_val = EOB_ACT_END_OF_FILE;
1014
ret_val = EOB_ACT_LAST_MATCH;
1015
YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1016
YY_BUFFER_EOF_PENDING;
1021
ret_val = EOB_ACT_CONTINUE_SCAN;
1023
(yy_n_chars) += number_to_move;
1024
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1025
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1027
(yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1032
/* yy_get_previous_state - get the state just before the EOB char was reached */
1034
static yy_state_type yy_get_previous_state (void)
1036
register yy_state_type yy_current_state;
1037
register char *yy_cp;
1039
yy_current_state = (yy_start);
1041
for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1043
register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1044
if ( yy_accept[yy_current_state] )
1046
(yy_last_accepting_state) = yy_current_state;
1047
(yy_last_accepting_cpos) = yy_cp;
1049
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1051
yy_current_state = (int) yy_def[yy_current_state];
1052
if ( yy_current_state >= 39 )
1053
yy_c = yy_meta[(unsigned int) yy_c];
1055
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1058
return yy_current_state;
1061
/* yy_try_NUL_trans - try to make a transition on the NUL character
1064
* next_state = yy_try_NUL_trans( current_state );
1066
static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1068
register int yy_is_jam;
1069
register char *yy_cp = (yy_c_buf_p);
1071
register YY_CHAR yy_c = 1;
1072
if ( yy_accept[yy_current_state] )
1074
(yy_last_accepting_state) = yy_current_state;
1075
(yy_last_accepting_cpos) = yy_cp;
1077
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1079
yy_current_state = (int) yy_def[yy_current_state];
1080
if ( yy_current_state >= 39 )
1081
yy_c = yy_meta[(unsigned int) yy_c];
1083
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1084
yy_is_jam = (yy_current_state == 38);
1086
return yy_is_jam ? 0 : yy_current_state;
1091
static int yyinput (void)
1093
static int input (void)
1099
*(yy_c_buf_p) = (yy_hold_char);
1101
if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1103
/* yy_c_buf_p now points to the character we want to return.
1104
* If this occurs *before* the EOB characters, then it's a
1105
* valid NUL; if not, then we've hit the end of the buffer.
1107
if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1108
/* This was really a NUL. */
1109
*(yy_c_buf_p) = '\0';
1112
{ /* need more input */
1113
int offset = (yy_c_buf_p) - (yytext_ptr);
1116
switch ( yy_get_next_buffer( ) )
1118
case EOB_ACT_LAST_MATCH:
1119
/* This happens because yy_g_n_b()
1120
* sees that we've accumulated a
1121
* token and flags that we need to
1122
* try matching the token before
1123
* proceeding. But for input(),
1124
* there's no matching to consider.
1125
* So convert the EOB_ACT_LAST_MATCH
1126
* to EOB_ACT_END_OF_FILE.
1129
/* Reset buffer status. */
1134
case EOB_ACT_END_OF_FILE:
1139
if ( ! (yy_did_buffer_switch_on_eof) )
1148
case EOB_ACT_CONTINUE_SCAN:
1149
(yy_c_buf_p) = (yytext_ptr) + offset;
1155
c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1156
*(yy_c_buf_p) = '\0'; /* preserve tptext */
1157
(yy_hold_char) = *++(yy_c_buf_p);
1161
#endif /* ifndef YY_NO_INPUT */
1163
/** Immediately switch to a different input stream.
1164
* @param input_file A readable stream.
1166
* @note This function does not reset the start condition to @c INITIAL .
1168
void tprestart (FILE * input_file )
1171
if ( ! YY_CURRENT_BUFFER ){
1172
tpensure_buffer_stack ();
1173
YY_CURRENT_BUFFER_LVALUE =
1174
tp_create_buffer(tpin,YY_BUF_SIZE );
1177
tp_init_buffer(YY_CURRENT_BUFFER,input_file );
1178
tp_load_buffer_state( );
1181
/** Switch to a different input buffer.
1182
* @param new_buffer The new input buffer.
1185
void tp_switch_to_buffer (YY_BUFFER_STATE new_buffer )
1188
/* TODO. We should be able to replace this entire function body
1190
* tppop_buffer_state();
1191
* tppush_buffer_state(new_buffer);
1193
tpensure_buffer_stack ();
1194
if ( YY_CURRENT_BUFFER == new_buffer )
1197
if ( YY_CURRENT_BUFFER )
1199
/* Flush out information for old buffer. */
1200
*(yy_c_buf_p) = (yy_hold_char);
1201
YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1202
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1205
YY_CURRENT_BUFFER_LVALUE = new_buffer;
1206
tp_load_buffer_state( );
1208
/* We don't actually know whether we did this switch during
1209
* EOF (tpwrap()) processing, but the only time this flag
1210
* is looked at is after tpwrap() is called, so it's safe
1211
* to go ahead and always set it.
1213
(yy_did_buffer_switch_on_eof) = 1;
1216
static void tp_load_buffer_state (void)
1218
(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1219
(yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1220
tpin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1221
(yy_hold_char) = *(yy_c_buf_p);
1224
/** Allocate and initialize an input buffer state.
1225
* @param file A readable stream.
1226
* @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1228
* @return the allocated buffer state.
1230
YY_BUFFER_STATE tp_create_buffer (FILE * file, int size )
1234
b = (YY_BUFFER_STATE) tpalloc(sizeof( struct yy_buffer_state ) );
1236
YY_FATAL_ERROR( "out of dynamic memory in tp_create_buffer()" );
1238
b->yy_buf_size = size;
1240
/* yy_ch_buf has to be 2 characters longer than the size given because
1241
* we need to put in 2 end-of-buffer characters.
1243
b->yy_ch_buf = (char *) tpalloc(b->yy_buf_size + 2 );
1244
if ( ! b->yy_ch_buf )
1245
YY_FATAL_ERROR( "out of dynamic memory in tp_create_buffer()" );
1247
b->yy_is_our_buffer = 1;
1249
tp_init_buffer(b,file );
1254
/** Destroy the buffer.
1255
* @param b a buffer created with tp_create_buffer()
1258
void tp_delete_buffer (YY_BUFFER_STATE b )
1264
if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1265
YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1267
if ( b->yy_is_our_buffer )
1268
tpfree((void *) b->yy_ch_buf );
1270
tpfree((void *) b );
1274
extern int isatty (int );
1275
#endif /* __cplusplus */
1277
/* Initializes or reinitializes a buffer.
1278
* This function is sometimes called more than once on the same buffer,
1279
* such as during a tprestart() or at EOF.
1281
static void tp_init_buffer (YY_BUFFER_STATE b, FILE * file )
1286
tp_flush_buffer(b );
1288
b->yy_input_file = file;
1289
b->yy_fill_buffer = 1;
1291
/* If b is the current buffer, then tp_init_buffer was _probably_
1292
* called from tprestart() or through yy_get_next_buffer.
1293
* In that case, we don't want to reset the lineno or column.
1295
if (b != YY_CURRENT_BUFFER){
1296
b->yy_bs_lineno = 1;
1297
b->yy_bs_column = 0;
1300
b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1305
/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1306
* @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1309
void tp_flush_buffer (YY_BUFFER_STATE b )
1316
/* We always need two end-of-buffer characters. The first causes
1317
* a transition to the end-of-buffer state. The second causes
1318
* a jam in that state.
1320
b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1321
b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1323
b->yy_buf_pos = &b->yy_ch_buf[0];
1326
b->yy_buffer_status = YY_BUFFER_NEW;
1328
if ( b == YY_CURRENT_BUFFER )
1329
tp_load_buffer_state( );
1332
/** Pushes the new state onto the stack. The new state becomes
1333
* the current state. This function will allocate the stack
1335
* @param new_buffer The new state.
1338
void tppush_buffer_state (YY_BUFFER_STATE new_buffer )
1340
if (new_buffer == NULL)
1343
tpensure_buffer_stack();
1345
/* This block is copied from tp_switch_to_buffer. */
1346
if ( YY_CURRENT_BUFFER )
1348
/* Flush out information for old buffer. */
1349
*(yy_c_buf_p) = (yy_hold_char);
1350
YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1351
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1354
/* Only push if top exists. Otherwise, replace top. */
1355
if (YY_CURRENT_BUFFER)
1356
(yy_buffer_stack_top)++;
1357
YY_CURRENT_BUFFER_LVALUE = new_buffer;
1359
/* copied from tp_switch_to_buffer. */
1360
tp_load_buffer_state( );
1361
(yy_did_buffer_switch_on_eof) = 1;
1364
/** Removes and deletes the top of the stack, if present.
1365
* The next element becomes the new top.
1368
void tppop_buffer_state (void)
1370
if (!YY_CURRENT_BUFFER)
1373
tp_delete_buffer(YY_CURRENT_BUFFER );
1374
YY_CURRENT_BUFFER_LVALUE = NULL;
1375
if ((yy_buffer_stack_top) > 0)
1376
--(yy_buffer_stack_top);
1378
if (YY_CURRENT_BUFFER) {
1379
tp_load_buffer_state( );
1380
(yy_did_buffer_switch_on_eof) = 1;
1384
/* Allocates the stack if it does not exist.
1385
* Guarantees space for at least one push.
1387
static void tpensure_buffer_stack (void)
1391
if (!(yy_buffer_stack)) {
1393
/* First allocation is just for 2 elements, since we don't know if this
1394
* scanner will even need a stack. We use 2 instead of 1 to avoid an
1395
* immediate realloc on the next call.
1398
(yy_buffer_stack) = (struct yy_buffer_state**)tpalloc
1399
(num_to_alloc * sizeof(struct yy_buffer_state*)
1402
memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1404
(yy_buffer_stack_max) = num_to_alloc;
1405
(yy_buffer_stack_top) = 0;
1409
if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1411
/* Increase the buffer to prepare for a possible push. */
1412
int grow_size = 8 /* arbitrary grow size */;
1414
num_to_alloc = (yy_buffer_stack_max) + grow_size;
1415
(yy_buffer_stack) = (struct yy_buffer_state**)tprealloc
1417
num_to_alloc * sizeof(struct yy_buffer_state*)
1420
/* zero only the new slots.*/
1421
memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1422
(yy_buffer_stack_max) = num_to_alloc;
1426
/** Setup the input buffer state to scan directly from a user-specified character buffer.
1427
* @param base the character buffer
1428
* @param size the size in bytes of the character buffer
1430
* @return the newly allocated buffer state object.
1432
YY_BUFFER_STATE tp_scan_buffer (char * base, yy_size_t size )
1437
base[size-2] != YY_END_OF_BUFFER_CHAR ||
1438
base[size-1] != YY_END_OF_BUFFER_CHAR )
1439
/* They forgot to leave room for the EOB's. */
1442
b = (YY_BUFFER_STATE) tpalloc(sizeof( struct yy_buffer_state ) );
1444
YY_FATAL_ERROR( "out of dynamic memory in tp_scan_buffer()" );
1446
b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1447
b->yy_buf_pos = b->yy_ch_buf = base;
1448
b->yy_is_our_buffer = 0;
1449
b->yy_input_file = 0;
1450
b->yy_n_chars = b->yy_buf_size;
1451
b->yy_is_interactive = 0;
1453
b->yy_fill_buffer = 0;
1454
b->yy_buffer_status = YY_BUFFER_NEW;
1456
tp_switch_to_buffer(b );
1461
/** Setup the input buffer state to scan a string. The next call to tplex() will
1462
* scan from a @e copy of @a str.
1463
* @param str a NUL-terminated string to scan
1465
* @return the newly allocated buffer state object.
1466
* @note If you want to scan bytes that may contain NUL values, then use
1467
* tp_scan_bytes() instead.
1469
YY_BUFFER_STATE tp_scan_string (yyconst char * yy_str )
1472
return tp_scan_bytes(yy_str,strlen(yy_str) );
1475
/** Setup the input buffer state to scan the given bytes. The next call to tplex() will
1476
* scan from a @e copy of @a bytes.
1477
* @param bytes the byte buffer to scan
1478
* @param len the number of bytes in the buffer pointed to by @a bytes.
1480
* @return the newly allocated buffer state object.
1482
YY_BUFFER_STATE tp_scan_bytes (yyconst char * bytes, int len )
1489
/* Get memory for full buffer, including space for trailing EOB's. */
1491
buf = (char *) tpalloc(n );
1493
YY_FATAL_ERROR( "out of dynamic memory in tp_scan_bytes()" );
1495
for ( i = 0; i < len; ++i )
1498
buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
1500
b = tp_scan_buffer(buf,n );
1502
YY_FATAL_ERROR( "bad buffer in tp_scan_bytes()" );
1504
/* It's okay to grow etc. this buffer, and we should throw it
1505
* away when we're done.
1507
b->yy_is_our_buffer = 1;
1512
#ifndef YY_EXIT_FAILURE
1513
#define YY_EXIT_FAILURE 2
1516
static void yy_fatal_error (yyconst char* msg )
1518
(void) fprintf( stderr, "%s\n", msg );
1519
exit( YY_EXIT_FAILURE );
1522
/* Redefine yyless() so it works in section 3 code. */
1528
/* Undo effects of setting up tptext. */ \
1529
int yyless_macro_arg = (n); \
1530
YY_LESS_LINENO(yyless_macro_arg);\
1531
tptext[tpleng] = (yy_hold_char); \
1532
(yy_c_buf_p) = tptext + yyless_macro_arg; \
1533
(yy_hold_char) = *(yy_c_buf_p); \
1534
*(yy_c_buf_p) = '\0'; \
1535
tpleng = yyless_macro_arg; \
1539
/* Accessor methods (get/set functions) to struct members. */
1541
/** Get the current line number.
1544
int tpget_lineno (void)
1550
/** Get the input stream.
1553
FILE *tpget_in (void)
1558
/** Get the output stream.
1561
FILE *tpget_out (void)
1566
/** Get the length of the current token.
1569
int tpget_leng (void)
1574
/** Get the current token.
1578
char *tpget_text (void)
1583
/** Set the current line number.
1584
* @param line_number
1587
void tpset_lineno (int line_number )
1590
tplineno = line_number;
1593
/** Set the input stream. This does not discard the current
1595
* @param in_str A readable stream.
1597
* @see tp_switch_to_buffer
1599
void tpset_in (FILE * in_str )
1604
void tpset_out (FILE * out_str )
1609
int tpget_debug (void)
1611
return tp_flex_debug;
1614
void tpset_debug (int bdebug )
1616
tp_flex_debug = bdebug ;
1619
/* tplex_destroy is for both reentrant and non-reentrant scanners. */
1620
int tplex_destroy (void)
1623
/* Pop the buffer stack, destroying each element. */
1624
while(YY_CURRENT_BUFFER){
1625
tp_delete_buffer(YY_CURRENT_BUFFER );
1626
YY_CURRENT_BUFFER_LVALUE = NULL;
1627
tppop_buffer_state();
1630
/* Destroy the stack itself. */
1631
tpfree((yy_buffer_stack) );
1632
(yy_buffer_stack) = NULL;
1638
* Internal utility routines.
1642
static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
1645
for ( i = 0; i < n; ++i )
1650
#ifdef YY_NEED_STRLEN
1651
static int yy_flex_strlen (yyconst char * s )
1654
for ( n = 0; s[n]; ++n )
1661
void *tpalloc (yy_size_t size )
1663
return (void *) malloc( size );
1666
void *tprealloc (void * ptr, yy_size_t size )
1668
/* The cast to (char *) in the following accommodates both
1669
* implementations that use char* generic pointers, and those
1670
* that use void* generic pointers. It works with the latter
1671
* because both ANSI C and C++ allow castless assignment from
1672
* any pointer type to void*, and deal with argument conversions
1673
* as though doing an assignment.
1675
return (void *) realloc( (char *) ptr, size );
1678
void tpfree (void * ptr )
1680
free( (char *) ptr ); /* see tprealloc() for (char *) cast */
1683
#define YYTABLES_NAME "yytables"
1686
#undef YY_FLUSH_BUFFER
1688
#undef yy_new_buffer
1689
#undef yy_set_interactive
1691
#undef YY_DO_BEFORE_ACTION
1693
#ifdef YY_DECL_IS_OURS
1694
#undef YY_DECL_IS_OURS
1697
#line 47 "tokenparser.l"
1708
void tpevalToken(char *pcToken, int tokType)
1713
if (tokType == TOKEN_TYPE_KEY)
1715
/* <key>foobar</key>
1716
* 012345 : 5 is the first key character index */
1718
/* calculate the argument length */
1719
for (len=0; pcToken[len+5] != '<'; len++)
1721
len++; /* final NULL byte */
1723
if (len > sizeof(pcKey))
1724
strlcpy(pcKey, &pcToken[5], sizeof(pcKey));
1726
strlcpy(pcKey, &pcToken[5], len);
1729
if (tokType == TOKEN_TYPE_STRING)
1731
/* <string>foobar</string>
1732
* 012345678 : 8 is the first string character index */
1734
/* calculate the argument length */
1735
for (len=0; pcToken[len+8] != '<'; len++)
1737
len++; /* final NULL byte */
1739
if (len > sizeof(pcValue))
1740
strlcpy(pcValue, &pcToken[8], sizeof(pcValue));
1742
strlcpy(pcValue, &pcToken[8], len);
1744
if (strcmp(pcKey, pcDesiredKey) == 0)
1745
if (desiredIndex == valueIndex)
1746
strlcpy(pcFinValue, pcValue, sizeof(pcFinValue));
1750
void tperrorCheck (char *token_error)
1754
int LTPBundleFindValueWithKey(char *fileName, char *tokenKey,
1755
char *tokenValue, int tokenIndice)
1760
desiredIndex = tokenIndice;
1761
pcDesiredKey = tokenKey;
1762
pcFinValue[0] = '\0';
1764
file = fopen(fileName, "r");
1768
Log3(PCSC_LOG_CRITICAL, "Could not open bundle file %s: %s",
1769
fileName, strerror(errno));
1778
} while (!feof(file));
1780
if (pcFinValue[0] == 0)
1782
if (tokenIndice == 0)
1784
/* Not defined at all */
1785
Log3(PCSC_LOG_CRITICAL, "Value/Key not defined for: %s in %s",
1786
tokenKey, fileName);
1791
strlcpy(tokenValue, pcFinValue, TOKEN_MAX_VALUE_SIZE);