Updated PCI IDs to latest snapshot.
[tangerine.git] / workbench / libs / muimaster / buildincludes.c
blobbf5e581a5c5db3c8873a624f73bb5f3e80d0de48
1 /*
2 Copyright © 2002, The AROS Development Team.
3 All rights reserved.
5 $Id$
6 */
8 #include <string.h>
9 #include <stdio.h>
10 #include <stdlib.h>
12 /**************************************************************************
13 This file build the libraries/mui.h file it output it to stdout
14 so you can redirect them
16 Currently it merges some files but later version might do more
17 things
18 **************************************************************************/
20 static char linebuf[2048];
22 /* array of already included files */
23 char **included;
24 int included_num;
26 static int need_to_be_included(char *filename)
28 int i;
29 for (i=0;i<included_num;i++)
31 if (!strcmp(included[i],filename)) return 0;
33 return 1;
36 static void readfile(FILE *in)
38 while (fgets(linebuf,2048,in))
40 if (!strstr(linebuf,"PRIV"))
42 if (strchr(linebuf,'#') && strstr(linebuf,"include"))
44 char *start = strchr(linebuf,'"');
45 if (start)
47 char *end;
48 start++;
49 end = strchr(start,'"');
50 if (end)
52 *end = 0;
53 if (need_to_be_included(start))
55 FILE *in2;
56 if (!(included = realloc(included,sizeof(char*)*(included_num+1)))) return;
57 included[included_num++] = strdup(start);
58 if ((in2 = fopen(start,"r")))
60 readfile(in2);
61 fclose(in2);
66 else printf("%s", linebuf);
67 } else printf("%s",linebuf);
72 int main(void)
74 int i;
76 /* Open the mui.h file */
77 FILE *in = fopen("mui.h","r");
78 if (in)
80 readfile(in);
81 fclose(in);
84 return 0;