1 |
/* This file is part of GNU RADIUS. |
/* This file is part of GNU Radius. |
2 |
Copyright (C) 2000,2001, Sergey Poznyakoff |
Copyright (C) 2000,2001,2002,2003 Sergey Poznyakoff |
3 |
|
|
4 |
This program is free software; you can redistribute it and/or modify |
GNU Radius is free software; you can redistribute it and/or modify |
5 |
it under the terms of the GNU General Public License as published by |
it under the terms of the GNU General Public License as published by |
6 |
the Free Software Foundation; either version 2 of the License, or |
the Free Software Foundation; either version 2 of the License, or |
7 |
(at your option) any later version. |
(at your option) any later version. |
8 |
|
|
9 |
This program is distributed in the hope that it will be useful, |
GNU Radius is distributed in the hope that it will be useful, |
10 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 |
GNU General Public License for more details. |
GNU General Public License for more details. |
13 |
|
|
14 |
You should have received a copy of the GNU General Public License |
You should have received a copy of the GNU General Public License |
15 |
along with this program; if not, write to the Free Software |
along with GNU Radius; if not, write to the Free Software Foundation, |
16 |
Foundation, Inc., 59 Temple Place - Suite 330, Boston, |
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ |
|
MA 02111-1307, USA. */ |
|
17 |
%e 8000 |
%e 8000 |
18 |
%p 15000 |
%p 15000 |
19 |
%x in_string |
%x in_string |
124 |
} while (0) |
} while (0) |
125 |
|
|
126 |
void |
void |
127 |
lex_set_buffer(fp) |
lex_set_buffer(FILE *fp) |
|
FILE *fp; |
|
128 |
{ |
{ |
129 |
char *buf; |
char *buf; |
130 |
size_t size; |
size_t size; |
147 |
} |
} |
148 |
|
|
149 |
void |
void |
150 |
lex_delete_buffer(buf) |
lex_delete_buffer(LEX_BUFFER_STATE buf) |
|
LEX_BUFFER_STATE buf; |
|
151 |
{ |
{ |
152 |
efree(buf.buffer); |
efree(buf.buffer); |
153 |
if (buf.putback) |
if (buf.putback) |
179 |
} |
} |
180 |
|
|
181 |
int |
int |
182 |
xunput(c) |
xunput(int c) |
|
int c; |
|
183 |
{ |
{ |
184 |
if (current_buffer.pb_level == current_buffer.pb_size) { |
if (current_buffer.pb_level == current_buffer.pb_size) { |
185 |
char *putback; |
char *putback; |
212 |
static int pop_source(); |
static int pop_source(); |
213 |
|
|
214 |
struct buffer_ctx * |
struct buffer_ctx * |
215 |
ctx_lookup(ino) |
ctx_lookup(ino_t ino) |
|
ino_t ino; |
|
216 |
{ |
{ |
217 |
struct buffer_ctx *ctx; |
struct buffer_ctx *ctx; |
218 |
|
|
223 |
} |
} |
224 |
|
|
225 |
int |
int |
226 |
push_source(name) |
push_source(char *name) |
|
char *name; |
|
227 |
{ |
{ |
228 |
FILE *fp; |
FILE *fp; |
229 |
struct buffer_ctx *ctx; |
struct buffer_ctx *ctx; |
417 |
} |
} |
418 |
|
|
419 |
char * |
char * |
420 |
addstring(s) |
addstring(char *s) |
|
char *s; |
|
421 |
{ |
{ |
422 |
int length = strlen(s); |
int length = strlen(s); |
423 |
obstack_grow(&stack, s, length+1); |
obstack_grow(&stack, s, length+1); |
425 |
} |
} |
426 |
|
|
427 |
char * |
char * |
428 |
addquote(s) |
addquote(char *s) |
|
char *s; |
|
429 |
{ |
{ |
430 |
int length = strlen(s); |
int length = strlen(s); |
431 |
if (length-2 > 0) |
if (length-2 > 0) |
435 |
} |
} |
436 |
|
|
437 |
int |
int |
438 |
init_lex(name) |
init_lex(char *name) |
|
char *name; |
|
439 |
{ |
{ |
440 |
obstack_init(&stack); |
obstack_init(&stack); |
441 |
|
|
553 |
#define to_num(c) (isdigit(c) ? c - '0' : (isxdigit(c) ? toupper(c) - 'A' + 10 : -1 )) |
#define to_num(c) (isdigit(c) ? c - '0' : (isxdigit(c) ? toupper(c) - 'A' + 10 : -1 )) |
554 |
|
|
555 |
void |
void |
556 |
read_number (text, len, base) |
read_number(char *text, int len, int base) |
|
char *text; |
|
|
int len; |
|
|
int base; |
|
557 |
{ |
{ |
558 |
int i; |
int i; |
559 |
int c = 0; |
int c = 0; |