diff options
author | rsc <devnull@localhost> | 2004-04-21 22:42:01 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2004-04-21 22:42:01 +0000 |
commit | ee6d04f9feec5011da240a9e08704c775806c331 (patch) | |
tree | 6c1bbb4ef110ccebe04dfae0fd71605bab815366 /src/cmd/acme/look.c | |
parent | 99f40290902d69956f7ef57b33599c4092021d01 (diff) | |
download | plan9port-ee6d04f9feec5011da240a9e08704c775806c331.tar.gz plan9port-ee6d04f9feec5011da240a9e08704c775806c331.tar.bz2 plan9port-ee6d04f9feec5011da240a9e08704c775806c331.zip |
undo the madness.
Diffstat (limited to 'src/cmd/acme/look.c')
-rw-r--r-- | src/cmd/acme/look.c | 37 |
1 files changed, 8 insertions, 29 deletions
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<n; i++){ @@ -561,13 +552,9 @@ expandfile(Text *t, uint q0, uint q1, Expand *e) } if(nname == -1) nname = n; - for(i=0; i<nname; i++){ - if(i==0 && r[0]=='$') - continue; + for(i=0; i<nname; i++) if(!isfilec(r[i])) goto Isntfile; - } - /* * See if it's a file name in <>, 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); |