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. */
25 #define YYERROR_VERBOSE 1
30 extern unsigned int setup_timestamp;
33 #define cpt (cp->info+trust)
38 %token SETUP_TIMESTAMP VERSION INSTALL SOURCE SDESC LDESC
39 %token T_PREV T_CURR T_TEST T_UNKNOWN
44 : setup_headers packages
48 : setup_header setup_headers
53 : SETUP_TIMESTAMP STRING '\n' { setup_timestamp = strtoul ($2, 0, 0); }
54 | error { yyerror ("unrecognized line in setup.ini headers"); } '\n'
63 : '@' STRING '\n' { new_package($2); }
69 : simple_line '\n' lines
74 : VERSION STRING { cpt->version = $2; }
75 | SDESC STRING { cp->sdesc = $2; }
76 | LDESC STRING { cp->ldesc = $2; }
77 | INSTALL STRING STRING { cpt->install = $2;
78 cpt->install_size = atoi($3); }
79 | SOURCE STRING STRING { cpt->source = $2;
80 cpt->source_size = atoi($3); }
81 | T_PREV { trust = TRUST_PREV; }
82 | T_CURR { trust = TRUST_CURR; }
83 | T_TEST { trust = TRUST_TEST; }
84 | T_UNKNOWN { trust = TRUST_UNKNOWN; }
86 | error '\n' { yylineno --;
87 yyerror ("unrecognized line in package %s", cp->name);
96 static int maxpackages = 0;
99 new_package (char *name)
101 if (npackages >= maxpackages)
105 package = (Package *) realloc (package, maxpackages * sizeof (Package));
107 package = (Package *) malloc (maxpackages * sizeof (Package));
109 cp = package + npackages;
112 memset (cp, 0, sizeof (Package));