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 /* Parse the setup.ini files. inilex.l provides the tokens for this. */
27 #define YYERROR_VERBOSE 1
32 extern unsigned int setup_timestamp;
33 extern char *setup_version;
36 #define cpt (cp->info+trust)
41 %token SETUP_TIMESTAMP SETUP_VERSION VERSION INSTALL SOURCE SDESC LDESC
42 %token T_PREV T_CURR T_TEST T_UNKNOWN
47 : setup_headers packages
51 : setup_header setup_headers
56 : SETUP_TIMESTAMP STRING '\n' { setup_timestamp = strtoul ($2, 0, 0); }
57 | SETUP_VERSION STRING '\n' { setup_version = _strdup ($2); }
59 | error { yyerror ("unrecognized line in setup.ini headers (do you have the latest setup?)"); } '\n'
68 : '@' STRING '\n' { new_package($2); }
73 : simple_line '\n' lines
78 : VERSION STRING { cpt->version = $2; }
79 | SDESC STRING { cp->sdesc = $2; }
80 | LDESC STRING { cp->ldesc = $2; }
81 | INSTALL STRING STRING { cpt->install = $2;
82 cpt->install_size = atoi($3); }
83 | SOURCE STRING STRING { cpt->source = $2;
84 cpt->source_size = atoi($3); }
85 | T_PREV { trust = TRUST_PREV; }
86 | T_CURR { trust = TRUST_CURR; }
87 | T_TEST { trust = TRUST_TEST; }
88 | T_UNKNOWN { trust = TRUST_UNKNOWN; }
90 | error '\n' { yylineno --;
91 yyerror ("unrecognized line in package %s (do you have the latest setup?)", cp->name);
100 static int maxpackages = 0;
103 new_package (char *name)
105 if (npackages >= maxpackages)
109 package = (Package *) realloc (package, maxpackages * sizeof (Package));
111 package = (Package *) malloc (maxpackages * sizeof (Package));
113 cp = package + npackages;
116 memset (cp, 0, sizeof (Package));