diff options
author | rsc <devnull@localhost> | 2004-04-21 05:34:37 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2004-04-21 05:34:37 +0000 |
commit | a8c15b08ca39ae9fa8d50f9e338d341c09fa57dd (patch) | |
tree | ffe19f2f3aaebc2dfe03d32d1614082aa9f85e8f /src/cmd/acid/builtin.c | |
parent | eaf56db5bc78cfec908db84dc792c53ac8ffb90e (diff) | |
download | plan9port-a8c15b08ca39ae9fa8d50f9e338d341c09fa57dd.tar.gz plan9port-a8c15b08ca39ae9fa8d50f9e338d341c09fa57dd.tar.bz2 plan9port-a8c15b08ca39ae9fa8d50f9e338d341c09fa57dd.zip |
Include looks in #9/acid now.
Acid works harder at not falling over.
Diffstat (limited to 'src/cmd/acid/builtin.c')
-rw-r--r-- | src/cmd/acid/builtin.c | 16 |
1 files changed, 15 insertions, 1 deletions
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; |