summaryrefslogtreecommitdiffstats
path: root/test cases/frameworks/8 flex/prog.c
diff options
context:
space:
mode:
Diffstat (limited to 'test cases/frameworks/8 flex/prog.c')
-rw-r--r--test cases/frameworks/8 flex/prog.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/test cases/frameworks/8 flex/prog.c b/test cases/frameworks/8 flex/prog.c
new file mode 100644
index 0000000..ae481d0
--- /dev/null
+++ b/test cases/frameworks/8 flex/prog.c
@@ -0,0 +1,30 @@
+#include"parser.tab.h"
+#include<unistd.h>
+#include<sys/types.h>
+#include<sys/stat.h>
+#include<fcntl.h>
+#include<stdio.h>
+#include<stdlib.h>
+
+extern int yyparse();
+
+int main(int argc, char **argv) {
+ int input;
+ if(argc != 2) {
+ printf("%s <input file>\n", argv[0]);
+ return 1;
+ }
+ input = open(argv[1], O_RDONLY);
+ dup2(input, STDIN_FILENO);
+ close(input);
+ return yyparse();
+}
+
+int yywrap(void) {
+ return 0;
+}
+
+int yyerror(void) {
+ printf("Parse error\n");
+ exit(1);
+}