3 * Copyright (c) 2000, Red Hat, Inc.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * A copy of the GNU General Public License can be found at
13 * Written by DJ Delorie <dj@cygnus.com>
17 /* tokenize the setup.ini files. We parse a string which we've
18 previously downloaded. The program must call ini_init() to specify
28 #define YY_INPUT(buf,result,max_size) { result = ini_getchar(buf, max_size); }
30 static int ini_getchar(char *buf, int max_size);
31 static void ignore_line (void);
38 %option never-interactive
44 \"[^"]*\" { yylval = new char [strlen (yytext+1) + 1];
45 strcpy (yylval, yytext+1);
46 yylval[strlen (yylval)-1] = 0;
49 "setup-timestamp:" return SETUP_TIMESTAMP;
50 "setup-version:" return SETUP_VERSION;
51 "version:" return VERSION;
52 "install:" return INSTALL;
53 "source:" return SOURCE;
54 "sdesc:" return SDESC;
55 "ldesc:" return LDESC;
57 "category:" return CATEGORY;
58 "requires:" return REQUIRES;
60 "apath:" return APATH;
61 "ppath:" return PPATH;
63 "include-setup:" return INCLUDE_SETUP;
65 "download-url:" return DOWNLOAD_URL;
67 ^{STR}":" ignore_line ();
69 "[curr]" return T_CURR;
70 "[test]" return T_TEST;
71 "[exp]" return T_TEST;
72 "[prev]" return T_PREV;
73 "["{STR}"]" return T_UNKNOWN;
75 {STR} { yylval = new char [strlen(yytext) + 1];
76 strcpy (yylval, yytext);
79 [ \t\r]+ /* do nothing */;
81 "#".*\n { return '\n'; }
83 \n { return *yytext; }
88 #include "io_stream.h"
90 static io_stream *input_stream = 0;
91 extern char *parse_mirror;
94 ini_init(io_stream *stream, String const &mirror)
96 input_stream = stream;
98 delete[] parse_mirror;
99 parse_mirror = mirror.cstr();
103 ini_getchar(char *buf, int max_size)
107 ssize_t len = input_stream->read (buf, max_size);
122 while ((c = yyinput ()))