2 /* A Bison parser, made from nlmheader.y
3 by GNU Bison version 1.28 */
5 #define YYBISON 1 /* Identify Bison output. */
13 #define DESCRIPTION 263
28 #define PSEUDOPREEMPTION 278
30 #define SCREENNAME 280
34 #define SYNCHRONIZE 284
35 #define THREADNAME 285
41 #define QUOTED_STRING 291
44 /* nlmheader.y - parse NLM header specification keywords.
45 Copyright (C) 1993, 94, 95, 97, 1998 Free Software Foundation, Inc.
47 This file is part of GNU Binutils.
49 This program is free software; you can redistribute it and/or modify
50 it under the terms of the GNU General Public License as published by
51 the Free Software Foundation; either version 2 of the License, or
52 (at your option) any later version.
54 This program is distributed in the hope that it will be useful,
55 but WITHOUT ANY WARRANTY; without even the implied warranty of
56 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
57 GNU General Public License for more details.
59 You should have received a copy of the GNU General Public License
60 along with this program; if not, write to the Free Software
61 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
63 /* Written by Ian Lance Taylor <ian@cygnus.com>.
65 This bison file parses the commands recognized by the NetWare NLM
66 linker, except for lists of object files. It stores the
67 information in global variables.
69 This implementation is based on the description in the NetWare Tool
70 Maker Specification manual, edition 1.0. */
77 #include "nlm/common.h"
78 #include "nlm/internal.h"
81 /* Information is stored in the structures pointed to by these
84 Nlm_Internal_Fixed_Header
*fixed_hdr
;
85 Nlm_Internal_Variable_Header
*var_hdr
;
86 Nlm_Internal_Version_Header
*version_hdr
;
87 Nlm_Internal_Copyright_Header
*copyright_hdr
;
88 Nlm_Internal_Extended_Header
*extended_hdr
;
90 /* Procedure named by CHECK. */
91 char *check_procedure
;
92 /* File named by CUSTOM. */
94 /* Whether to generate debugging information (DEBUG). */
96 /* Procedure named by EXIT. */
98 /* Exported symbols (EXPORT). */
99 struct string_list
*export_symbols
;
100 /* List of files from INPUT. */
101 struct string_list
*input_files
;
102 /* Map file name (MAP, FULLMAP). */
104 /* Whether a full map has been requested (FULLMAP). */
106 /* File named by HELP. */
108 /* Imported symbols (IMPORT). */
109 struct string_list
*import_symbols
;
110 /* File named by MESSAGES. */
112 /* Autoload module list (MODULE). */
113 struct string_list
*modules
;
114 /* File named by OUTPUT. */
116 /* File named by SHARELIB. */
118 /* Start procedure name (START). */
119 char *start_procedure
;
122 /* RPC description file (XDCDATA). */
125 /* The number of serious errors that have occurred. */
128 /* The current symbol prefix when reading a list of import or export
130 static char *symbol_prefix
;
132 /* Parser error message handler. */
133 #define yyerror(msg) nlmheader_error (msg);
135 /* Local functions. */
136 static int yylex
PARAMS ((void));
137 static void nlmlex_file_push
PARAMS ((const char *));
138 static boolean nlmlex_file_open
PARAMS ((const char *));
139 static int nlmlex_buf_init
PARAMS ((void));
140 static char nlmlex_buf_add
PARAMS ((int));
141 static long nlmlex_get_number
PARAMS ((const char *));
142 static void nlmheader_identify
PARAMS ((void));
143 static void nlmheader_warn
PARAMS ((const char *, int));
144 static void nlmheader_error
PARAMS ((const char *));
145 static struct string_list
* string_list_cons
PARAMS ((char *,
146 struct string_list
*));
147 static struct string_list
* string_list_append
PARAMS ((struct string_list
*,
148 struct string_list
*));
149 static struct string_list
* string_list_append1
PARAMS ((struct string_list
*,
151 static char *xstrdup
PARAMS ((const char *));
154 #line 112 "nlmheader.y"
158 struct string_list
*list
;
171 #define YYFLAG -32768
174 #define YYTRANSLATE(x) ((unsigned)(x) <= 291 ? yytranslate[x] : 50)
176 static const char yytranslate
[] = { 0,
177 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
178 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
179 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
180 2, 2, 2, 2, 2, 2, 2, 2, 2, 38,
181 39, 2, 2, 2, 2, 2, 2, 2, 2, 2,
182 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
183 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
184 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
185 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
186 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
187 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
188 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
189 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
190 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
191 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
192 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
193 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
194 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
195 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
196 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
197 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
198 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
199 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
200 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
201 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
202 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
203 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
204 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
205 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
210 static const short yyprhs
[] = { 0,
211 0, 2, 3, 6, 9, 12, 15, 18, 23, 25,
212 28, 31, 32, 36, 39, 42, 44, 47, 50, 51,
213 55, 58, 60, 63, 66, 69, 71, 73, 76, 78,
214 80, 83, 86, 89, 92, 94, 97, 100, 102, 107,
215 111, 114, 115, 117, 119, 121, 124, 127, 131, 133,
219 static const short yyrhs
[] = { 41,
220 0, 0, 42, 41, 0, 3, 36, 0, 4, 36,
221 0, 5, 37, 0, 6, 36, 0, 7, 36, 36,
222 36, 0, 8, 0, 9, 37, 0, 10, 36, 0,
223 0, 11, 43, 45, 0, 12, 36, 0, 13, 36,
224 0, 14, 0, 14, 36, 0, 15, 36, 0, 0,
225 16, 44, 45, 0, 17, 49, 0, 18, 0, 18,
226 36, 0, 19, 36, 0, 20, 49, 0, 21, 0,
227 22, 0, 23, 36, 0, 24, 0, 25, 0, 26,
228 37, 0, 27, 36, 0, 28, 36, 0, 29, 36,
229 0, 30, 0, 31, 37, 0, 32, 36, 0, 33,
230 0, 34, 36, 36, 36, 0, 34, 36, 36, 0,
231 35, 36, 0, 0, 46, 0, 48, 0, 47, 0,
232 46, 48, 0, 46, 47, 0, 38, 36, 39, 0,
239 static const short yyrline
[] = { 0,
240 143, 149, 151, 156, 161, 166, 183, 187, 205, 209,
241 225, 229, 234, 237, 242, 247, 252, 257, 261, 266,
242 269, 273, 277, 281, 285, 289, 293, 297, 304, 308,
243 312, 328, 332, 337, 341, 345, 361, 366, 370, 394,
244 410, 418, 423, 433, 438, 442, 446, 454, 465, 481,
250 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
252 static const char * const yytname
[] = { "$","error","$undefined.","CHECK",
253 "CODESTART","COPYRIGHT","CUSTOM","DATE","DEBUG","DESCRIPTION","EXIT","EXPORT",
254 "FLAG_ON","FLAG_OFF","FULLMAP","HELP","IMPORT","INPUT","MAP","MESSAGES","MODULE",
255 "MULTIPLE","OS_DOMAIN","OUTPUT","PSEUDOPREEMPTION","REENTRANT","SCREENNAME",
256 "SHARELIB","STACK","START","SYNCHRONIZE","THREADNAME","TYPE","VERBOSE","VERSIONK",
257 "XDCDATA","STRING","QUOTED_STRING","'('","')'","file","commands","command","@1",
258 "@2","symbol_list_opt","symbol_list","symbol_prefix","symbol","string_list", NULL
262 static const short yyr1
[] = { 0,
263 40, 41, 41, 42, 42, 42, 42, 42, 42, 42,
264 42, 43, 42, 42, 42, 42, 42, 42, 44, 42,
265 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
266 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
267 42, 45, 45, 46, 46, 46, 46, 47, 48, 49,
271 static const short yyr2
[] = { 0,
272 1, 0, 2, 2, 2, 2, 2, 4, 1, 2,
273 2, 0, 3, 2, 2, 1, 2, 2, 0, 3,
274 2, 1, 2, 2, 2, 1, 1, 2, 1, 1,
275 2, 2, 2, 2, 1, 2, 2, 1, 4, 3,
276 2, 0, 1, 1, 1, 2, 2, 3, 1, 0,
280 static const short yydefact
[] = { 2,
281 0, 0, 0, 0, 0, 9, 0, 0, 12, 0,
282 0, 16, 0, 19, 50, 22, 0, 50, 26, 27,
283 0, 29, 30, 0, 0, 0, 0, 35, 0, 0,
284 38, 0, 0, 1, 2, 4, 5, 6, 7, 0,
285 10, 11, 42, 14, 15, 17, 18, 42, 50, 21,
286 23, 24, 25, 28, 31, 32, 33, 34, 36, 37,
287 0, 41, 3, 0, 49, 0, 13, 43, 45, 44,
288 20, 51, 40, 8, 0, 47, 46, 39, 48, 0,
292 static const short yydefgoto
[] = { 80,
293 34, 35, 43, 48, 67, 68, 69, 70, 50
296 static const short yypact
[] = { -3,
297 -1, 1, 2, 4, 5,-32768, 6, 8,-32768, 9,
298 10, 11, 12,-32768, 13, 14, 16, 13,-32768,-32768,
299 17,-32768,-32768, 18, 20, 21, 22,-32768, 23, 25,
300 -32768, 26, 27,-32768, -3,-32768,-32768,-32768,-32768, 29,
301 -32768,-32768, -2,-32768,-32768,-32768,-32768, -2, 13,-32768,
302 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
303 30,-32768,-32768, 31,-32768, 32,-32768, -2,-32768,-32768,
304 -32768,-32768, 33,-32768, 3,-32768,-32768,-32768,-32768, 38,
308 static const short yypgoto
[] = {-32768,
309 19,-32768,-32768,-32768, 24,-32768, -9, 7, 15
316 static const short yytable
[] = { 1,
317 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
318 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
319 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
320 32, 33, 53, 65, 36, 66, 37, 81, 38, 39,
321 40, 79, 41, 42, 44, 45, 46, 47, 49, 51,
322 82, 52, 54, 63, 55, 56, 57, 58, 76, 59,
323 60, 61, 62, 72, 64, 73, 74, 75, 78, 0,
327 static const short yycheck
[] = { 3,
328 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
329 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
330 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
331 34, 35, 18, 36, 36, 38, 36, 0, 37, 36,
332 36, 39, 37, 36, 36, 36, 36, 36, 36, 36,
333 0, 36, 36, 35, 37, 36, 36, 36, 68, 37,
334 36, 36, 36, 49, 36, 36, 36, 36, 36, -1,
337 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
338 #line 3 "/usr/share/misc/bison.simple"
339 /* This file comes from bison-1.28. */
341 /* Skeleton output parser for bison,
342 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
344 This program is free software; you can redistribute it and/or modify
345 it under the terms of the GNU General Public License as published by
346 the Free Software Foundation; either version 2, or (at your option)
349 This program is distributed in the hope that it will be useful,
350 but WITHOUT ANY WARRANTY; without even the implied warranty of
351 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
352 GNU General Public License for more details.
354 You should have received a copy of the GNU General Public License
355 along with this program; if not, write to the Free Software
356 Foundation, Inc., 59 Temple Place - Suite 330,
357 Boston, MA 02111-1307, USA. */
359 /* As a special exception, when this file is copied by Bison into a
360 Bison output file, you may use that output file without restriction.
361 This special exception was added by the Free Software Foundation
362 in version 1.24 of Bison. */
364 /* This is the parser code that is written into each bison parser
365 when the %semantic_parser declaration is not specified in the grammar.
366 It was written by Richard Stallman by simplifying the hairy parser
367 used when %semantic_parser is specified. */
369 #ifndef YYSTACK_USE_ALLOCA
371 #define YYSTACK_USE_ALLOCA
372 #else /* alloca not defined */
374 #define YYSTACK_USE_ALLOCA
375 #define alloca __builtin_alloca
376 #else /* not GNU C. */
377 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
378 #define YYSTACK_USE_ALLOCA
380 #else /* not sparc */
381 /* We think this test detects Watcom and Microsoft C. */
382 /* This used to test MSDOS, but that is a bad idea
383 since that symbol is in the user namespace. */
384 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
385 #if 0 /* No need for malloc.h, which pollutes the namespace;
386 instead, just don't use alloca. */
389 #else /* not MSDOS, or __TURBOC__ */
391 /* I don't know what this was needed for, but it pollutes the namespace.
392 So I turned it off. rms, 2 May 1997. */
393 /* #include <malloc.h> */
395 #define YYSTACK_USE_ALLOCA
396 #else /* not MSDOS, or __TURBOC__, or _AIX */
398 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
399 and on HPUX 10. Eventually we can turn this on. */
400 #define YYSTACK_USE_ALLOCA
401 #define alloca __builtin_alloca
404 #endif /* not _AIX */
405 #endif /* not MSDOS, or __TURBOC__ */
406 #endif /* not sparc */
407 #endif /* not GNU C */
408 #endif /* alloca not defined */
409 #endif /* YYSTACK_USE_ALLOCA not defined */
411 #ifdef YYSTACK_USE_ALLOCA
412 #define YYSTACK_ALLOC alloca
414 #define YYSTACK_ALLOC malloc
417 /* Note: there must be only one dollar sign in this file.
418 It is replaced by the list of actions, each action
419 as one case of the switch. */
421 #define yyerrok (yyerrstatus = 0)
422 #define yyclearin (yychar = YYEMPTY)
425 #define YYACCEPT goto yyacceptlab
426 #define YYABORT goto yyabortlab
427 #define YYERROR goto yyerrlab1
428 /* Like YYERROR except do call yyerror.
429 This remains here temporarily to ease the
430 transition to the new meaning of YYERROR, for GCC.
431 Once GCC version 2 has supplanted version 1, this can go. */
432 #define YYFAIL goto yyerrlab
433 #define YYRECOVERING() (!!yyerrstatus)
434 #define YYBACKUP(token, value) \
436 if (yychar == YYEMPTY && yylen == 1) \
437 { yychar = (token), yylval = (value); \
438 yychar1 = YYTRANSLATE (yychar); \
443 { yyerror ("syntax error: cannot back up"); YYERROR; } \
447 #define YYERRCODE 256
450 #define YYLEX yylex()
456 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
458 #define YYLEX yylex(&yylval, &yylloc)
460 #else /* not YYLSP_NEEDED */
462 #define YYLEX yylex(&yylval, YYLEX_PARAM)
464 #define YYLEX yylex(&yylval)
466 #endif /* not YYLSP_NEEDED */
469 /* If nonreentrant, generate the variables here */
473 int yychar
; /* the lookahead symbol */
474 YYSTYPE yylval
; /* the semantic value of the */
475 /* lookahead symbol */
478 YYLTYPE yylloc
; /* location data for the lookahead */
482 int yynerrs
; /* number of parse errors so far */
483 #endif /* not YYPURE */
486 int yydebug
; /* nonzero means print parse trace */
487 /* Since this is uninitialized, it does not stop multiple parsers
491 /* YYINITDEPTH indicates the initial size of the parser's stacks */
494 #define YYINITDEPTH 200
497 /* YYMAXDEPTH is the maximum size the stacks can grow to
498 (effective only if the built-in stack extension method is used). */
505 #define YYMAXDEPTH 10000
508 /* Define __yy_memcpy. Note that the size argument
509 should be passed with type unsigned int, because that is what the non-GCC
510 definitions require. With GCC, __builtin_memcpy takes an arg
511 of type size_t, but it can handle unsigned int. */
513 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
514 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
515 #else /* not GNU C or C++ */
518 /* This is the most reliable way to avoid incompatibilities
519 in available built-in functions on various systems. */
521 __yy_memcpy (to
, from
, count
)
526 register char *f
= from
;
527 register char *t
= to
;
528 register int i
= count
;
534 #else /* __cplusplus */
536 /* This is the most reliable way to avoid incompatibilities
537 in available built-in functions on various systems. */
539 __yy_memcpy (char *to
, char *from
, unsigned int count
)
541 register char *t
= to
;
542 register char *f
= from
;
543 register int i
= count
;
552 #line 217 "/usr/share/misc/bison.simple"
554 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
555 into yyparse. The argument should have type void *.
556 It should actually point to an object.
557 Grammar actions can access the variable by casting it
558 to the proper pointer type. */
562 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
563 #define YYPARSE_PARAM_DECL
564 #else /* not __cplusplus */
565 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
566 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
567 #endif /* not __cplusplus */
568 #else /* not YYPARSE_PARAM */
569 #define YYPARSE_PARAM_ARG
570 #define YYPARSE_PARAM_DECL
571 #endif /* not YYPARSE_PARAM */
573 /* Prevent warning if -Wstrict-prototypes. */
576 int yyparse (void *);
583 yyparse(YYPARSE_PARAM_ARG
)
586 register int yystate
;
588 register short *yyssp
;
589 register YYSTYPE
*yyvsp
;
590 int yyerrstatus
; /* number of tokens to shift before error messages enabled */
591 int yychar1
= 0; /* lookahead token as an internal (translated) token number */
593 short yyssa
[YYINITDEPTH
]; /* the state stack */
594 YYSTYPE yyvsa
[YYINITDEPTH
]; /* the semantic value stack */
596 short *yyss
= yyssa
; /* refer to the stacks thru separate pointers */
597 YYSTYPE
*yyvs
= yyvsa
; /* to allow yyoverflow to reallocate them elsewhere */
600 YYLTYPE yylsa
[YYINITDEPTH
]; /* the location stack */
601 YYLTYPE
*yyls
= yylsa
;
604 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
606 #define YYPOPSTACK (yyvsp--, yyssp--)
609 int yystacksize
= YYINITDEPTH
;
610 int yyfree_stacks
= 0;
621 YYSTYPE yyval
; /* the variable used to return */
622 /* semantic values from the action */
629 fprintf(stderr
, "Starting parse\n");
635 yychar
= YYEMPTY
; /* Cause a token to be read. */
637 /* Initialize stack pointers.
638 Waste one element of value and location stack
639 so that they stay on the same level as the state stack.
640 The wasted elements are never initialized. */
648 /* Push a new state, which is found in yystate . */
649 /* In all cases, when you get here, the value and location stacks
650 have just been pushed. so pushing a state here evens the stacks. */
655 if (yyssp
>= yyss
+ yystacksize
- 1)
657 /* Give user a chance to reallocate the stack */
658 /* Use copies of these so that the &'s don't force the real ones into memory. */
659 YYSTYPE
*yyvs1
= yyvs
;
662 YYLTYPE
*yyls1
= yyls
;
665 /* Get the current used size of the three stacks, in elements. */
666 int size
= yyssp
- yyss
+ 1;
669 /* Each stack pointer address is followed by the size of
670 the data in use in that stack, in bytes. */
672 /* This used to be a conditional around just the two extra args,
673 but that might be undefined if yyoverflow is a macro. */
674 yyoverflow("parser stack overflow",
675 &yyss1
, size
* sizeof (*yyssp
),
676 &yyvs1
, size
* sizeof (*yyvsp
),
677 &yyls1
, size
* sizeof (*yylsp
),
680 yyoverflow("parser stack overflow",
681 &yyss1
, size
* sizeof (*yyssp
),
682 &yyvs1
, size
* sizeof (*yyvsp
),
686 yyss
= yyss1
; yyvs
= yyvs1
;
690 #else /* no yyoverflow */
691 /* Extend the stack our own way. */
692 if (yystacksize
>= YYMAXDEPTH
)
694 yyerror("parser stack overflow");
706 if (yystacksize
> YYMAXDEPTH
)
707 yystacksize
= YYMAXDEPTH
;
708 #ifndef YYSTACK_USE_ALLOCA
711 yyss
= (short *) YYSTACK_ALLOC (yystacksize
* sizeof (*yyssp
));
712 __yy_memcpy ((char *)yyss
, (char *)yyss1
,
713 size
* (unsigned int) sizeof (*yyssp
));
714 yyvs
= (YYSTYPE
*) YYSTACK_ALLOC (yystacksize
* sizeof (*yyvsp
));
715 __yy_memcpy ((char *)yyvs
, (char *)yyvs1
,
716 size
* (unsigned int) sizeof (*yyvsp
));
718 yyls
= (YYLTYPE
*) YYSTACK_ALLOC (yystacksize
* sizeof (*yylsp
));
719 __yy_memcpy ((char *)yyls
, (char *)yyls1
,
720 size
* (unsigned int) sizeof (*yylsp
));
722 #endif /* no yyoverflow */
724 yyssp
= yyss
+ size
- 1;
725 yyvsp
= yyvs
+ size
- 1;
727 yylsp
= yyls
+ size
- 1;
732 fprintf(stderr
, "Stack size increased to %d\n", yystacksize
);
735 if (yyssp
>= yyss
+ yystacksize
- 1)
741 fprintf(stderr
, "Entering state %d\n", yystate
);
747 /* Do appropriate processing given the current state. */
748 /* Read a lookahead token if we need one and don't already have one. */
751 /* First try to decide what to do without reference to lookahead token. */
753 yyn
= yypact
[yystate
];
757 /* Not known => get a lookahead token if don't already have one. */
759 /* yychar is either YYEMPTY or YYEOF
760 or a valid token in external form. */
762 if (yychar
== YYEMPTY
)
766 fprintf(stderr
, "Reading a token: ");
771 /* Convert token to internal form (in yychar1) for indexing tables with */
773 if (yychar
<= 0) /* This means end of input. */
776 yychar
= YYEOF
; /* Don't call YYLEX any more */
780 fprintf(stderr
, "Now at end of input.\n");
785 yychar1
= YYTRANSLATE(yychar
);
790 fprintf (stderr
, "Next token is %d (%s", yychar
, yytname
[yychar1
]);
791 /* Give the individual parser a way to print the precise meaning
792 of a token, for further debugging info. */
794 YYPRINT (stderr
, yychar
, yylval
);
796 fprintf (stderr
, ")\n");
802 if (yyn
< 0 || yyn
> YYLAST
|| yycheck
[yyn
] != yychar1
)
807 /* yyn is what to do for this token type in this state.
808 Negative => reduce, -yyn is rule number.
809 Positive => shift, yyn is new state.
810 New state is final state => don't bother to shift,
812 0, or most negative number => error. */
827 /* Shift the lookahead token. */
831 fprintf(stderr
, "Shifting token %d (%s), ", yychar
, yytname
[yychar1
]);
834 /* Discard the token being shifted unless it is eof. */
843 /* count tokens shifted since error; after three, turn off error status. */
844 if (yyerrstatus
) yyerrstatus
--;
849 /* Do the default action for the current state. */
852 yyn
= yydefact
[yystate
];
856 /* Do a reduction. yyn is the number of a rule to reduce with. */
860 yyval
= yyvsp
[1-yylen
]; /* implement default value of the action */
867 fprintf (stderr
, "Reducing via rule %d (line %d), ",
870 /* Print the symbols being reduced, and their result. */
871 for (i
= yyprhs
[yyn
]; yyrhs
[i
] > 0; i
++)
872 fprintf (stderr
, "%s ", yytname
[yyrhs
[i
]]);
873 fprintf (stderr
, " -> %s\n", yytname
[yyr1
[yyn
]]);
881 #line 158 "nlmheader.y"
883 check_procedure
= yyvsp
[0].string
;
887 #line 162 "nlmheader.y"
889 nlmheader_warn (_("CODESTART is not implemented; sorry"), -1);
890 free (yyvsp
[0].string
);
894 #line 167 "nlmheader.y"
898 strncpy (copyright_hdr
->stamp
, "CoPyRiGhT=", 10);
899 len
= strlen (yyvsp
[0].string
);
900 if (len
>= NLM_MAX_COPYRIGHT_MESSAGE_LENGTH
)
902 nlmheader_warn (_("copyright string is too long"),
903 NLM_MAX_COPYRIGHT_MESSAGE_LENGTH
- 1);
904 len
= NLM_MAX_COPYRIGHT_MESSAGE_LENGTH
- 1;
906 copyright_hdr
->copyrightMessageLength
= len
;
907 strncpy (copyright_hdr
->copyrightMessage
, yyvsp
[0].string
, len
);
908 copyright_hdr
->copyrightMessage
[len
] = '\0';
909 free (yyvsp
[0].string
);
913 #line 184 "nlmheader.y"
915 custom_file
= yyvsp
[0].string
;
919 #line 188 "nlmheader.y"
921 /* We don't set the version stamp here, because we use the
922 version stamp to detect whether the required VERSION
923 keyword was given. */
924 version_hdr
->month
= nlmlex_get_number (yyvsp
[-2].string
);
925 version_hdr
->day
= nlmlex_get_number (yyvsp
[-1].string
);
926 version_hdr
->year
= nlmlex_get_number (yyvsp
[0].string
);
927 free (yyvsp
[-2].string
);
928 free (yyvsp
[-1].string
);
929 free (yyvsp
[0].string
);
930 if (version_hdr
->month
< 1 || version_hdr
->month
> 12)
931 nlmheader_warn (_("illegal month"), -1);
932 if (version_hdr
->day
< 1 || version_hdr
->day
> 31)
933 nlmheader_warn (_("illegal day"), -1);
934 if (version_hdr
->year
< 1900 || version_hdr
->year
> 3000)
935 nlmheader_warn (_("illegal year"), -1);
939 #line 206 "nlmheader.y"
945 #line 210 "nlmheader.y"
949 len
= strlen (yyvsp
[0].string
);
950 if (len
> NLM_MAX_DESCRIPTION_LENGTH
)
952 nlmheader_warn (_("description string is too long"),
953 NLM_MAX_DESCRIPTION_LENGTH
);
954 len
= NLM_MAX_DESCRIPTION_LENGTH
;
956 var_hdr
->descriptionLength
= len
;
957 strncpy (var_hdr
->descriptionText
, yyvsp
[0].string
, len
);
958 var_hdr
->descriptionText
[len
] = '\0';
959 free (yyvsp
[0].string
);
963 #line 226 "nlmheader.y"
965 exit_procedure
= yyvsp
[0].string
;
969 #line 230 "nlmheader.y"
971 symbol_prefix
= NULL
;
975 #line 234 "nlmheader.y"
977 export_symbols
= string_list_append (export_symbols
, yyvsp
[0].list
);
981 #line 238 "nlmheader.y"
983 fixed_hdr
->flags
|= nlmlex_get_number (yyvsp
[0].string
);
984 free (yyvsp
[0].string
);
988 #line 243 "nlmheader.y"
990 fixed_hdr
->flags
&=~ nlmlex_get_number (yyvsp
[0].string
);
991 free (yyvsp
[0].string
);
995 #line 248 "nlmheader.y"
1002 #line 253 "nlmheader.y"
1004 map_file
= yyvsp
[0].string
;
1009 #line 258 "nlmheader.y"
1011 help_file
= yyvsp
[0].string
;
1015 #line 262 "nlmheader.y"
1017 symbol_prefix
= NULL
;
1021 #line 266 "nlmheader.y"
1023 import_symbols
= string_list_append (import_symbols
, yyvsp
[0].list
);
1027 #line 270 "nlmheader.y"
1029 input_files
= string_list_append (input_files
, yyvsp
[0].list
);
1033 #line 274 "nlmheader.y"
1039 #line 278 "nlmheader.y"
1041 map_file
= yyvsp
[0].string
;
1045 #line 282 "nlmheader.y"
1047 message_file
= yyvsp
[0].string
;
1051 #line 286 "nlmheader.y"
1053 modules
= string_list_append (modules
, yyvsp
[0].list
);
1057 #line 290 "nlmheader.y"
1059 fixed_hdr
->flags
|= 0x2;
1063 #line 294 "nlmheader.y"
1065 fixed_hdr
->flags
|= 0x10;
1069 #line 298 "nlmheader.y"
1071 if (output_file
== NULL
)
1072 output_file
= yyvsp
[0].string
;
1074 nlmheader_warn (_("ignoring duplicate OUTPUT statement"), -1);
1078 #line 305 "nlmheader.y"
1080 fixed_hdr
->flags
|= 0x8;
1084 #line 309 "nlmheader.y"
1086 fixed_hdr
->flags
|= 0x1;
1090 #line 313 "nlmheader.y"
1094 len
= strlen (yyvsp
[0].string
);
1095 if (len
>= NLM_MAX_SCREEN_NAME_LENGTH
)
1097 nlmheader_warn (_("screen name is too long"),
1098 NLM_MAX_SCREEN_NAME_LENGTH
);
1099 len
= NLM_MAX_SCREEN_NAME_LENGTH
;
1101 var_hdr
->screenNameLength
= len
;
1102 strncpy (var_hdr
->screenName
, yyvsp
[0].string
, len
);
1103 var_hdr
->screenName
[NLM_MAX_SCREEN_NAME_LENGTH
] = '\0';
1104 free (yyvsp
[0].string
);
1108 #line 329 "nlmheader.y"
1110 sharelib_file
= yyvsp
[0].string
;
1114 #line 333 "nlmheader.y"
1116 var_hdr
->stackSize
= nlmlex_get_number (yyvsp
[0].string
);
1117 free (yyvsp
[0].string
);
1121 #line 338 "nlmheader.y"
1123 start_procedure
= yyvsp
[0].string
;
1127 #line 342 "nlmheader.y"
1129 fixed_hdr
->flags
|= 0x4;
1133 #line 346 "nlmheader.y"
1137 len
= strlen (yyvsp
[0].string
);
1138 if (len
>= NLM_MAX_THREAD_NAME_LENGTH
)
1140 nlmheader_warn (_("thread name is too long"),
1141 NLM_MAX_THREAD_NAME_LENGTH
);
1142 len
= NLM_MAX_THREAD_NAME_LENGTH
;
1144 var_hdr
->threadNameLength
= len
;
1145 strncpy (var_hdr
->threadName
, yyvsp
[0].string
, len
);
1146 var_hdr
->threadName
[len
] = '\0';
1147 free (yyvsp
[0].string
);
1151 #line 362 "nlmheader.y"
1153 fixed_hdr
->moduleType
= nlmlex_get_number (yyvsp
[0].string
);
1154 free (yyvsp
[0].string
);
1158 #line 367 "nlmheader.y"
1164 #line 371 "nlmheader.y"
1168 strncpy (version_hdr
->stamp
, "VeRsIoN#", 8);
1169 version_hdr
->majorVersion
= nlmlex_get_number (yyvsp
[-2].string
);
1170 val
= nlmlex_get_number (yyvsp
[-1].string
);
1171 if (val
< 0 || val
> 99)
1172 nlmheader_warn (_("illegal minor version number (must be between 0 and 99)"),
1175 version_hdr
->minorVersion
= val
;
1176 val
= nlmlex_get_number (yyvsp
[0].string
);
1178 nlmheader_warn (_("illegal revision number (must be between 0 and 26)"),
1181 version_hdr
->revision
= 0;
1183 version_hdr
->revision
= val
;
1184 free (yyvsp
[-2].string
);
1185 free (yyvsp
[-1].string
);
1186 free (yyvsp
[0].string
);
1190 #line 395 "nlmheader.y"
1194 strncpy (version_hdr
->stamp
, "VeRsIoN#", 8);
1195 version_hdr
->majorVersion
= nlmlex_get_number (yyvsp
[-1].string
);
1196 val
= nlmlex_get_number (yyvsp
[0].string
);
1197 if (val
< 0 || val
> 99)
1198 nlmheader_warn (_("illegal minor version number (must be between 0 and 99)"),
1201 version_hdr
->minorVersion
= val
;
1202 version_hdr
->revision
= 0;
1203 free (yyvsp
[-1].string
);
1204 free (yyvsp
[0].string
);
1208 #line 411 "nlmheader.y"
1210 rpc_file
= yyvsp
[0].string
;
1214 #line 420 "nlmheader.y"
1220 #line 424 "nlmheader.y"
1222 yyval
.list
= yyvsp
[0].list
;
1226 #line 435 "nlmheader.y"
1228 yyval
.list
= string_list_cons (yyvsp
[0].string
, NULL
);
1232 #line 439 "nlmheader.y"
1238 #line 443 "nlmheader.y"
1240 yyval
.list
= string_list_append1 (yyvsp
[-1].list
, yyvsp
[0].string
);
1244 #line 447 "nlmheader.y"
1246 yyval
.list
= yyvsp
[-1].list
;
1250 #line 456 "nlmheader.y"
1252 if (symbol_prefix
!= NULL
)
1253 free (symbol_prefix
);
1254 symbol_prefix
= yyvsp
[-1].string
;
1258 #line 467 "nlmheader.y"
1260 if (symbol_prefix
== NULL
)
1261 yyval
.string
= yyvsp
[0].string
;
1264 yyval
.string
= xmalloc (strlen (symbol_prefix
) + strlen (yyvsp
[0].string
) + 2);
1265 sprintf (yyval
.string
, "%s@%s", symbol_prefix
, yyvsp
[0].string
);
1266 free (yyvsp
[0].string
);
1271 #line 483 "nlmheader.y"
1277 #line 487 "nlmheader.y"
1279 yyval
.list
= string_list_cons (yyvsp
[-1].string
, yyvsp
[0].list
);
1283 /* the action file gets copied in in place of this dollarsign */
1284 #line 543 "/usr/share/misc/bison.simple"
1295 short *ssp1
= yyss
- 1;
1296 fprintf (stderr
, "state stack now");
1297 while (ssp1
!= yyssp
)
1298 fprintf (stderr
, " %d", *++ssp1
);
1299 fprintf (stderr
, "\n");
1309 yylsp
->first_line
= yylloc
.first_line
;
1310 yylsp
->first_column
= yylloc
.first_column
;
1311 yylsp
->last_line
= (yylsp
-1)->last_line
;
1312 yylsp
->last_column
= (yylsp
-1)->last_column
;
1317 yylsp
->last_line
= (yylsp
+yylen
-1)->last_line
;
1318 yylsp
->last_column
= (yylsp
+yylen
-1)->last_column
;
1322 /* Now "shift" the result of the reduction.
1323 Determine what state that goes to,
1324 based on the state we popped back to
1325 and the rule number reduced by. */
1329 yystate
= yypgoto
[yyn
- YYNTBASE
] + *yyssp
;
1330 if (yystate
>= 0 && yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
1331 yystate
= yytable
[yystate
];
1333 yystate
= yydefgoto
[yyn
- YYNTBASE
];
1337 yyerrlab
: /* here on detecting error */
1340 /* If not already recovering from an error, report this error. */
1344 #ifdef YYERROR_VERBOSE
1345 yyn
= yypact
[yystate
];
1347 if (yyn
> YYFLAG
&& yyn
< YYLAST
)
1354 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
1355 for (x
= (yyn
< 0 ? -yyn
: 0);
1356 x
< (sizeof(yytname
) / sizeof(char *)); x
++)
1357 if (yycheck
[x
+ yyn
] == x
)
1358 size
+= strlen(yytname
[x
]) + 15, count
++;
1359 msg
= (char *) malloc(size
+ 15);
1362 strcpy(msg
, "parse error");
1367 for (x
= (yyn
< 0 ? -yyn
: 0);
1368 x
< (sizeof(yytname
) / sizeof(char *)); x
++)
1369 if (yycheck
[x
+ yyn
] == x
)
1371 strcat(msg
, count
== 0 ? ", expecting `" : " or `");
1372 strcat(msg
, yytname
[x
]);
1381 yyerror ("parse error; also virtual memory exceeded");
1384 #endif /* YYERROR_VERBOSE */
1385 yyerror("parse error");
1389 yyerrlab1
: /* here on error raised explicitly by an action */
1391 if (yyerrstatus
== 3)
1393 /* if just tried and failed to reuse lookahead token after an error, discard it. */
1395 /* return failure if at end of input */
1396 if (yychar
== YYEOF
)
1401 fprintf(stderr
, "Discarding token %d (%s).\n", yychar
, yytname
[yychar1
]);
1407 /* Else will try to reuse lookahead token
1408 after shifting the error token. */
1410 yyerrstatus
= 3; /* Each real token shifted decrements this */
1414 yyerrdefault
: /* current state does not do anything special for the error token. */
1417 /* This is wrong; only states that explicitly want error tokens
1418 should shift them. */
1419 yyn
= yydefact
[yystate
]; /* If its default is to accept any token, ok. Otherwise pop it.*/
1420 if (yyn
) goto yydefault
;
1423 yyerrpop
: /* pop the current state because it cannot handle the error token */
1425 if (yyssp
== yyss
) YYABORT
;
1435 short *ssp1
= yyss
- 1;
1436 fprintf (stderr
, "Error: state stack now");
1437 while (ssp1
!= yyssp
)
1438 fprintf (stderr
, " %d", *++ssp1
);
1439 fprintf (stderr
, "\n");
1445 yyn
= yypact
[yystate
];
1450 if (yyn
< 0 || yyn
> YYLAST
|| yycheck
[yyn
] != YYTERROR
)
1469 fprintf(stderr
, "Shifting error token, ");
1481 /* YYACCEPT comes here. */
1493 /* YYABORT comes here. */
1504 #line 492 "nlmheader.y"
1507 /* If strerror is just a macro, we want to use the one from libiberty
1508 since it will handle undefined values. */
1510 extern char *strerror ();
1512 /* The lexer is simple, too simple for flex. Keywords are only
1513 recognized at the start of lines. Everything else must be an
1514 argument. A comma is treated as whitespace. */
1516 /* The states the lexer can be in. */
1520 /* At the beginning of a line. */
1522 /* In the middle of a line. */
1526 /* We need to keep a stack of files to handle file inclusion. */
1530 /* The file to read from. */
1532 /* The name of the file. */
1534 /* The current line number. */
1536 /* The current state. */
1537 enum lex_state state
;
1538 /* The next file on the stack. */
1542 /* The current input file. */
1544 static struct input current
;
1546 /* The character which introduces comments. */
1547 #define COMMENT_CHAR '#'
1549 /* Start the lexer going on the main input file. */
1555 current
.next
= NULL
;
1556 return nlmlex_file_open (name
);
1559 /* Start the lexer going on a subsidiary input file. */
1562 nlmlex_file_push (name
)
1567 push
= (struct input
*) xmalloc (sizeof (struct input
));
1569 if (nlmlex_file_open (name
))
1570 current
.next
= push
;
1578 /* Start lexing from a file. */
1581 nlmlex_file_open (name
)
1584 current
.file
= fopen (name
, "r");
1585 if (current
.file
== NULL
)
1587 fprintf (stderr
, "%s:%s: %s\n", program_name
, name
, strerror (errno
));
1591 current
.name
= xstrdup (name
);
1593 current
.state
= BEGINNING_OF_LINE
;
1597 /* Table used to turn keywords into tokens. */
1599 struct keyword_tokens_struct
1601 const char *keyword
;
1605 struct keyword_tokens_struct keyword_tokens
[] =
1608 { "CODESTART", CODESTART
},
1609 { "COPYRIGHT", COPYRIGHT
},
1610 { "CUSTOM", CUSTOM
},
1613 { "DESCRIPTION", DESCRIPTION
},
1615 { "EXPORT", EXPORT
},
1616 { "FLAG_ON", FLAG_ON
},
1617 { "FLAG_OFF", FLAG_OFF
},
1618 { "FULLMAP", FULLMAP
},
1620 { "IMPORT", IMPORT
},
1623 { "MESSAGES", MESSAGES
},
1624 { "MODULE", MODULE
},
1625 { "MULTIPLE", MULTIPLE
},
1626 { "OS_DOMAIN", OS_DOMAIN
},
1627 { "OUTPUT", OUTPUT
},
1628 { "PSEUDOPREEMPTION", PSEUDOPREEMPTION
},
1629 { "REENTRANT", REENTRANT
},
1630 { "SCREENNAME", SCREENNAME
},
1631 { "SHARELIB", SHARELIB
},
1633 { "STACKSIZE", STACK
},
1635 { "SYNCHRONIZE", SYNCHRONIZE
},
1636 { "THREADNAME", THREADNAME
},
1638 { "VERBOSE", VERBOSE
},
1639 { "VERSION", VERSIONK
},
1640 { "XDCDATA", XDCDATA
}
1643 #define KEYWORD_COUNT (sizeof (keyword_tokens) / sizeof (keyword_tokens[0]))
1645 /* The lexer accumulates strings in these variables. */
1646 static char *lex_buf
;
1647 static int lex_size
;
1650 /* Start accumulating strings into the buffer. */
1651 #define BUF_INIT() \
1652 ((void) (lex_buf != NULL ? lex_pos = 0 : nlmlex_buf_init ()))
1658 lex_buf
= xmalloc (lex_size
+ 1);
1663 /* Finish a string in the buffer. */
1664 #define BUF_FINISH() ((void) (lex_buf[lex_pos] = '\0'))
1666 /* Accumulate a character into the buffer. */
1667 #define BUF_ADD(c) \
1668 ((void) (lex_pos < lex_size \
1669 ? lex_buf[lex_pos++] = (c) \
1670 : nlmlex_buf_add (c)))
1676 if (lex_pos
>= lex_size
)
1679 lex_buf
= xrealloc (lex_buf
, lex_size
+ 1);
1682 return lex_buf
[lex_pos
++] = c
;
1685 /* The lexer proper. This is called by the bison generated parsing
1695 c
= getc (current
.file
);
1697 /* Commas are treated as whitespace characters. */
1698 while (isspace ((unsigned char) c
) || c
== ',')
1700 current
.state
= IN_LINE
;
1704 current
.state
= BEGINNING_OF_LINE
;
1706 c
= getc (current
.file
);
1709 /* At the end of the file we either pop to the previous file or
1713 fclose (current
.file
);
1714 free (current
.name
);
1715 if (current
.next
== NULL
)
1721 next
= current
.next
;
1728 /* A comment character always means to drop everything until the
1730 if (c
== COMMENT_CHAR
)
1734 c
= getc (current
.file
);
1738 current
.state
= BEGINNING_OF_LINE
;
1742 /* An '@' introduces an include file. */
1747 c
= getc (current
.file
);
1751 while (isspace ((unsigned char) c
));
1753 while (! isspace ((unsigned char) c
) && c
!= EOF
)
1756 c
= getc (current
.file
);
1760 ungetc (c
, current
.file
);
1762 nlmlex_file_push (lex_buf
);
1766 /* A non-space character at the start of a line must be the start of
1768 if (current
.state
== BEGINNING_OF_LINE
)
1771 while (isalnum ((unsigned char) c
) || c
== '_')
1773 if (islower ((unsigned char) c
))
1774 BUF_ADD (toupper ((unsigned char) c
));
1777 c
= getc (current
.file
);
1781 if (c
!= EOF
&& ! isspace ((unsigned char) c
) && c
!= ',')
1783 nlmheader_identify ();
1784 fprintf (stderr
, _("%s:%d: illegal character in keyword: %c\n"),
1785 current
.name
, current
.lineno
, c
);
1791 for (i
= 0; i
< KEYWORD_COUNT
; i
++)
1793 if (lex_buf
[0] == keyword_tokens
[i
].keyword
[0]
1794 && strcmp (lex_buf
, keyword_tokens
[i
].keyword
) == 0)
1796 /* Pushing back the final whitespace avoids worrying
1798 ungetc (c
, current
.file
);
1799 current
.state
= IN_LINE
;
1800 return keyword_tokens
[i
].token
;
1804 nlmheader_identify ();
1805 fprintf (stderr
, _("%s:%d: unrecognized keyword: %s\n"),
1806 current
.name
, current
.lineno
, lex_buf
);
1810 /* Treat the rest of this line as a comment. */
1811 ungetc (COMMENT_CHAR
, current
.file
);
1815 /* Parentheses just represent themselves. */
1816 if (c
== '(' || c
== ')')
1819 /* Handle quoted strings. */
1820 if (c
== '"' || c
== '\'')
1826 start_lineno
= current
.lineno
;
1828 c
= getc (current
.file
);
1830 while (c
!= quote
&& c
!= EOF
)
1835 c
= getc (current
.file
);
1841 nlmheader_identify ();
1842 fprintf (stderr
, _("%s:%d: end of file in quoted string\n"),
1843 current
.name
, start_lineno
);
1847 /* FIXME: Possible memory leak. */
1848 yylval
.string
= xstrdup (lex_buf
);
1849 return QUOTED_STRING
;
1852 /* Gather a generic argument. */
1854 while (! isspace (c
)
1856 && c
!= COMMENT_CHAR
1861 c
= getc (current
.file
);
1865 ungetc (c
, current
.file
);
1867 /* FIXME: Possible memory leak. */
1868 yylval
.string
= xstrdup (lex_buf
);
1872 /* Get a number from a string. */
1875 nlmlex_get_number (s
)
1881 ret
= strtol (s
, &send
, 10);
1883 nlmheader_warn (_("bad number"), -1);
1887 /* Prefix the nlmconv warnings with a note as to where they come from.
1888 We don't use program_name on every warning, because then some
1889 versions of the emacs next-error function can't recognize the line
1893 nlmheader_identify ()
1899 fprintf (stderr
, _("%s: problems in NLM command language input:\n"),
1905 /* Issue a warning. */
1908 nlmheader_warn (s
, imax
)
1912 nlmheader_identify ();
1913 fprintf (stderr
, "%s:%d: %s", current
.name
, current
.lineno
, s
);
1915 fprintf (stderr
, " (max %d)", imax
);
1916 fprintf (stderr
, "\n");
1919 /* Report an error. */
1925 nlmheader_warn (s
, -1);
1929 /* Add a string to a string list. */
1931 static struct string_list
*
1932 string_list_cons (s
, l
)
1934 struct string_list
*l
;
1936 struct string_list
*ret
;
1938 ret
= (struct string_list
*) xmalloc (sizeof (struct string_list
));
1944 /* Append a string list to another string list. */
1946 static struct string_list
*
1947 string_list_append (l1
, l2
)
1948 struct string_list
*l1
;
1949 struct string_list
*l2
;
1951 register struct string_list
**pp
;
1953 for (pp
= &l1
; *pp
!= NULL
; pp
= &(*pp
)->next
)
1959 /* Append a string to a string list. */
1961 static struct string_list
*
1962 string_list_append1 (l
, s
)
1963 struct string_list
*l
;
1966 struct string_list
*n
;
1967 register struct string_list
**pp
;
1969 n
= (struct string_list
*) xmalloc (sizeof (struct string_list
));
1972 for (pp
= &l
; *pp
!= NULL
; pp
= &(*pp
)->next
)
1978 /* Duplicate a string in memory. */
1988 ret
= xmalloc (len
+ 1);