summaryrefslogtreecommitdiffabout
path: root/src/bind-lex.l
Side-by-side diff
Diffstat (limited to 'src/bind-lex.l') (more/less context) (ignore whitespace changes)
-rw-r--r--src/bind-lex.l17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/bind-lex.l b/src/bind-lex.l
index 12dddf7..a5cf644 100644
--- a/src/bind-lex.l
+++ b/src/bind-lex.l
@@ -192,11 +192,24 @@ grecs_bind_new_source(const char *name)
grecs_locus_t *loc = grecs_current_locus.file ?
&grecs_current_locus : NULL;
struct stat st;
- FILE *fp = fopen(name, "r");
+ FILE *fp;
+
+ if (access(name, F_OK)) {
+ int ec = errno;
+ char *tmp = grecs_find_include_file(name, 0);
+ if (!tmp) {
+ grecs_error(loc, ec, _("cannot open `%s'"), name);
+ return 1;
+ }
+ name = grecs_install_text(tmp);
+ free(tmp);
+ }
+
+ fp = fopen(name, "r");
if (!fp) {
grecs_error(loc, errno, _("cannot open `%s'"), name);
return 1;
- }
+ }
if (fstat(fileno(fp), &st)) {
grecs_error(loc, errno, _("can't state %s"), name);
fclose(fp);

Return to:

Send suggestions and report system problems to the System administrator.