37
|
1 |
/**
|
|
2 |
* test/demos/parser/c_compiler/main.c
|
|
3 |
* Copyright (C) 2008 Markus Broeker
|
|
4 |
*/
|
|
5 |
|
|
6 |
#include <stdio.h>
|
|
7 |
#include <stdlib.h>
|
|
8 |
#include <string.h>
|
|
9 |
|
|
10 |
#include <prototypes.h>
|
|
11 |
|
|
12 |
extern FILE *yyin;
|
|
13 |
|
|
14 |
void usage (char *cmd)
|
|
15 |
{
|
|
16 |
printf ("Usage: %s <options> <source files>\n", cmd);
|
|
17 |
}
|
|
18 |
|
|
19 |
int main (int argc, char **argv)
|
|
20 |
{
|
|
21 |
FILE *fp;
|
|
22 |
|
|
23 |
if (argc < 2) {
|
|
24 |
usage (argv[0]);
|
|
25 |
return EXIT_SUCCESS;
|
|
26 |
}
|
|
27 |
|
|
28 |
if ((fp = fopen (argv[1], "r")) == NULL) {
|
|
29 |
perror ("FOPEN");
|
|
30 |
return EXIT_FAILURE;
|
|
31 |
}
|
|
32 |
|
|
33 |
yyin = fp;
|
|
34 |
yyparse ();
|
|
35 |
|
|
36 |
fclose (fp);
|
|
37 |
|
|
38 |
return EXIT_SUCCESS;
|
|
39 |
}
|