From ee6d04f9feec5011da240a9e08704c775806c331 Mon Sep 17 00:00:00 2001 From: rsc Date: Wed, 21 Apr 2004 22:42:01 +0000 Subject: undo the madness. --- src/cmd/acme/look.c | 37 ++++++++----------------------------- 1 file changed, 8 insertions(+), 29 deletions(-) (limited to 'src/cmd/acme/look.c') diff --git a/src/cmd/acme/look.c b/src/cmd/acme/look.c index ce2f772f..f892640a 100644 --- a/src/cmd/acme/look.c +++ b/src/cmd/acme/look.c @@ -15,8 +15,6 @@ #include "dat.h" #include "fns.h" -#define debug 0 - FsFid *plumbsendfid; FsFid *plumbeditfid; @@ -458,12 +456,10 @@ dirname(Text *t, Rune *r, int n) b = nil; if(t==nil || t->w==nil) goto Rescue; - if(n>=1 && r[0]=='$') - expandenv(&r, &n); nt = t->w->tag.file->b.nc; if(nt == 0) goto Rescue; - if(n>=1 && r[0]=='/') + if(n>=1 && r[0]=='/') goto Rescue; b = runemalloc(nt+n+1); bufread(&t->w->tag.file->b, 0, b, nt); @@ -477,12 +473,9 @@ dirname(Text *t, Rune *r, int n) } if(slash < 0) goto Rescue; - slash++; - if(expandenv(&b, &slash)) - b = runerealloc(b, slash+n); - runemove(b+slash, r, n); + runemove(b+slash+1, r, n); free(r); - return cleanrname(runestr(b, slash+n)); + return cleanrname(runestr(b, slash+1+n)); Rescue: free(b); @@ -542,11 +535,9 @@ expandfile(Text *t, uint q0, uint q1, Expand *e) n = q1-q0; if(n == 0) return FALSE; - /* see if it's a file name */ - r = runemalloc(n+1); /* +1 for $ below */ + r = runemalloc(n); bufread(&t->file->b, q0, r, n); - /* first, does it have bad chars? */ nname = -1; for(i=0; i, and turn that into an include * file name if so. Should probably do it for "" too, but that's not @@ -582,18 +569,10 @@ expandfile(Text *t, uint q0, uint q1, Expand *e) else if(amin == q0) goto Isfile; else{ - if(debug) fprint(2, "x1 %.*S\n", nname, r); - if(r[0] != '$'){ - rs = dirname(t, r, nname); - r = rs.r; - nname = rs.nr; - if(debug) fprint(2, "x1.5 %.*S\n", nname, r); - } - if(r[0]=='$') - expandenv(&r, &nname); - if(debug) fprint(2, "x2 %.*S\n", nname, r); + rs = dirname(t, r, nname); + r = rs.r; + nname = rs.nr; } - e->bname = runetobyte(r, nname); /* if it's already a window name, it's a file */ w = lookfile(r, nname); -- cgit v1.2.3