aboutsummaryrefslogtreecommitdiff
path: root/src/bind-lex.l
diff options
context:
space:
mode:
Diffstat (limited to 'src/bind-lex.l')
-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
@@ -189,17 +189,30 @@ yywrap()
int
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 1;
}
if (_push_context(name, st.st_ino, st.st_dev)) {

Return to:

Send suggestions and report system problems to the System administrator.