From a8c15b08ca39ae9fa8d50f9e338d341c09fa57dd Mon Sep 17 00:00:00 2001 From: rsc Date: Wed, 21 Apr 2004 05:34:37 +0000 Subject: Include looks in #9/acid now. Acid works harder at not falling over. --- src/cmd/acid/builtin.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/cmd/acid/builtin.c') diff --git a/src/cmd/acid/builtin.c b/src/cmd/acid/builtin.c index 290b3c69..787e2e51 100644 --- a/src/cmd/acid/builtin.c +++ b/src/cmd/acid/builtin.c @@ -478,6 +478,8 @@ interpret(Node *r, Node *args) void include(Node *r, Node *args) { + char *file, *libfile; + static char buf[1024]; Node res; int isave; @@ -488,7 +490,19 @@ include(Node *r, Node *args) error("include(string): arg type"); Bflush(bout); - pushfile(res.store.u.string->string); + + libfile = nil; + file = res.store.u.string->string; + if(access(file, AREAD) < 0 && file[0] != '/'){ + snprint(buf, sizeof buf, "#9/acid/%s", file); + libfile = unsharp(buf); + if(access(libfile, AREAD) >= 0){ + strecpy(buf, buf+sizeof buf, libfile); + file = buf; + } + free(libfile); + } + pushfile(file); isave = interactive; interactive = 0; -- cgit v1.2.3