commit 9d01e221783e7706fd1d3dadfc8a7f678004929c from: rsc date: Sun Jan 30 16:34:12 2005 UTC add errors file commit - 3fef2ed0565e831549b43153751c81e9ee2e7e86 commit + 9d01e221783e7706fd1d3dadfc8a7f678004929c blob - 40143a44b0d103c61a8cccbb68d06fb8bdb55525 blob + 1312904a3752457f691549292b3d23293dc14134 --- man/man4/acme.4 +++ man/man4/acme.4 @@ -279,6 +279,17 @@ at the beginning of the address (the end of the address has no effect) and sets the address to the null string at the end of the returned characters. +.TP +.B errors +Writing to the +.B errors +file appends to the body of the +.IB dir /+Errors +window, where +.I dir +is the directory currently named in the tag. +The window is created if necessary, +but not until text is actually written. .TP .B event When a window's @@ -395,6 +406,13 @@ holds contents of the window tag. It may be read at a Text written to .B tag is always appended; the file offset is ignored. +.TP +.B xdata +The +.B xdata +file like +.B data +except that reads stop at the end address. .SH SOURCE .B \*9/src/cmd/acme .SH SEE ALSO blob - 4ac0d676245ad02fbcf0f5f7e8503fcad7b085e1 blob + 19229e7a44b3c7247610bb164ba44bf3e3d7bdf0 --- src/cmd/acme/dat.h +++ src/cmd/acme/dat.h @@ -15,6 +15,7 @@ enum QWctl, QWdata, QWeditout, + QWerrors, QWevent, QWrdsel, QWwrsel, blob - c61f96ecf1b98ca54e502ab525e08176d38f82c9 blob + 74a381e23937bfc46daa0b4b1a707dbc672099ff --- src/cmd/acme/fns.h +++ src/cmd/acme/fns.h @@ -28,6 +28,7 @@ void allwindows(void(*)(Window*, void*), void*); uint loadfile(int, uint, int*, int(*)(void*, uint, Rune*, int), void*); Window* errorwin(Mntdir*, int); +Window* errorwinforwin(Window*); Runestr cleanrname(Runestr); void run(Window*, char*, Rune*, int, int, char*, char*, int); void fsysclose(void); blob - 536a3334996d21b0ed2363930f6721f1a2f391c1 blob + 31236082d1d8019f439eccf5fa3f52c0d90c4586 --- src/cmd/acme/fsys.c +++ src/cmd/acme/fsys.c @@ -83,6 +83,7 @@ Dirtab dirtabw[]= { "ctl", QTFILE, QWctl, 0600 }, { "data", QTFILE, QWdata, 0600 }, { "editout", QTFILE, QWeditout, 0200 }, + { "errors", QTFILE, QWerrors, 0200 }, { "event", QTFILE, QWevent, 0600 }, { "rdsel", QTFILE, QWrdsel, 0400 }, { "wrsel", QTFILE, QWwrsel, 0200 }, blob - f9387df5e29dc1e7eb896347b95f67fc7e262e98 blob + c224cce594bfd75cfa1e7f7f8decc026ac9ea150 --- src/cmd/acme/util.c +++ src/cmd/acme/util.c @@ -129,6 +129,49 @@ errorwin(Mntdir *md, int owner) return w; } +/* + * Incoming window should be locked. + * It will be unlocked and returned window + * will be locked in its place. + */ +Window* +errorwinforwin(Window *w) +{ + int i, n, nincl, owner; + Rune **incl; + Runestr dir; + Text *t; + + t = &w->body; + dir = dirname(t, nil, 0); + if(dir.nr==1 && dir.r[0]=='.'){ /* sigh */ + free(dir.r); + dir.r = nil; + dir.nr = 0; + } + incl = nil; + nincl = w->nincl; + if(nincl > 0){ + incl = emalloc(nincl*sizeof(Rune*)); + for(i=0; iincl[i]); + incl[i] = runemalloc(n+1); + runemove(incl[i], w->incl[i], n); + } + } + owner = w->owner; + winunlock(w); + for(;;){ + w = errorwin1(dir.r, dir.nr, incl, nincl); + winlock(w, owner); + if(w->col != nil) + break; + /* window deleted too fast */ + winunlock(w); + } + return w; +} + typedef struct Warning Warning; struct Warning{ blob - 579f19446b12e4b4eb470867e19df3560e4cf350 blob + 126a5fe9ef921ba34d6d651c19172861276dd5d8 --- src/cmd/acme/xfid.c +++ src/cmd/acme/xfid.c @@ -444,6 +444,11 @@ xfidwrite(Xfid *x) respond(x, &fc, nil); break; + case QWerrors: + w = errorwinforwin(w); + t = &w->body; + goto BodyTag; + case QWbody: case QWwrsel: t = &w->body;