summaryrefslogtreecommitdiffstats
path: root/usr.sbin/config
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2004-10-24 09:38:41 +0000
committerdes <des@FreeBSD.org>2004-10-24 09:38:41 +0000
commitdaaffcb3c061e1523c2245f266f8c0db24683e04 (patch)
tree66b03d905fba74255773f605269278ffeb832448 /usr.sbin/config
parent3f4ffafdb85820a3012fbf24ced4759a986b7628 (diff)
downloadFreeBSD-src-daaffcb3c061e1523c2245f266f8c0db24683e04.zip
FreeBSD-src-daaffcb3c061e1523c2245f266f8c0db24683e04.tar.gz
If the file specified in an "include" line does not exist in the current
directory, and its name does not begin with a period or a forward slash, go look for it in ../../conf. Wished for by: scottl MFC after: 2 weeks
Diffstat (limited to 'usr.sbin/config')
-rw-r--r--usr.sbin/config/lang.l10
1 files changed, 9 insertions, 1 deletions
diff --git a/usr.sbin/config/lang.l b/usr.sbin/config/lang.l
index 801d508..f433220 100644
--- a/usr.sbin/config/lang.l
+++ b/usr.sbin/config/lang.l
@@ -215,10 +215,18 @@ include(const char *fname, int ateof)
{
FILE *fp;
struct incl *in;
+ char *fnamebuf;
fp = fopen(fname, "r");
+ if (fp == NULL && fname[0] != '.' && fname[0] != '/') {
+ asprintf(&fnamebuf, "../../conf/%s", fname);
+ if (fnamebuf != NULL) {
+ fp = fopen(fnamebuf, "r");
+ free(fnamebuf);
+ }
+ }
if (fp == NULL) {
- yyerror("cannot open file");
+ yyerror("cannot open included file");
return (-1);
}
in = malloc(sizeof(*in));
OpenPOWER on IntegriCloud