- if (file->flags & FILE_BUSY) {
- printf("recursive scan (%s)?\n", name);
- exit(1);
- }
- if (file->flags & FILE_SCANNED) {
- printf("file %s already scanned?\n", name);
- exit(1);
+ for (i = files.gl_pathc-1; i != (size_t)-1; --i) {
+ filename = files.gl_pathv[i];
+
+ file = file_lookup(filename);
+ buf = malloc(sizeof(*buf));
+ memset(buf, 0, sizeof(*buf));
+ current_buf->state = YY_CURRENT_BUFFER;
+ zconfin = zconf_fopen(filename);
+ if (!zconfin) {
+ printf("%s:%d: can't open file \"%s\"\n",
+ zconf_curname(), zconf_lineno(), filename);
+ exit(1);
+ }
+ zconf_switch_to_buffer(zconf_create_buffer(zconfin,YY_BUF_SIZE));
+ buf->parent = current_buf;
+ current_buf = buf;
+
+ if (file->flags & FILE_BUSY) {
+ printf("recursive scan (%s)?\n", filename);
+ exit(1);
+ }
+ if (file->flags & FILE_SCANNED) {
+ printf("file %s already scanned?\n", filename);
+ exit(1);
+ }
+ file->flags |= FILE_BUSY;
+ file->lineno = 1;
+ file->parent = current_file;
+ current_file = file;