add errors file

This commit is contained in:
rsc 2005-01-30 16:34:12 +00:00
parent 3fef2ed056
commit 9d01e22178
6 changed files with 69 additions and 0 deletions

View file

@ -280,6 +280,17 @@ address (the end of the address has no effect)
and sets the address to the null string at the end of the returned and sets the address to the null string at the end of the returned
characters. characters.
.TP .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 .B event
When a window's When a window's
.B event .B event
@ -395,6 +406,13 @@ holds contents of the window tag. It may be read at any byte offset.
Text written to Text written to
.B tag .B tag
is always appended; the file offset is ignored. 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 .SH SOURCE
.B \*9/src/cmd/acme .B \*9/src/cmd/acme
.SH SEE ALSO .SH SEE ALSO

View file

@ -15,6 +15,7 @@ enum
QWctl, QWctl,
QWdata, QWdata,
QWeditout, QWeditout,
QWerrors,
QWevent, QWevent,
QWrdsel, QWrdsel,
QWwrsel, QWwrsel,

View file

@ -28,6 +28,7 @@ void allwindows(void(*)(Window*, void*), void*);
uint loadfile(int, uint, int*, int(*)(void*, uint, Rune*, int), void*); uint loadfile(int, uint, int*, int(*)(void*, uint, Rune*, int), void*);
Window* errorwin(Mntdir*, int); Window* errorwin(Mntdir*, int);
Window* errorwinforwin(Window*);
Runestr cleanrname(Runestr); Runestr cleanrname(Runestr);
void run(Window*, char*, Rune*, int, int, char*, char*, int); void run(Window*, char*, Rune*, int, int, char*, char*, int);
void fsysclose(void); void fsysclose(void);

View file

@ -83,6 +83,7 @@ Dirtab dirtabw[]=
{ "ctl", QTFILE, QWctl, 0600 }, { "ctl", QTFILE, QWctl, 0600 },
{ "data", QTFILE, QWdata, 0600 }, { "data", QTFILE, QWdata, 0600 },
{ "editout", QTFILE, QWeditout, 0200 }, { "editout", QTFILE, QWeditout, 0200 },
{ "errors", QTFILE, QWerrors, 0200 },
{ "event", QTFILE, QWevent, 0600 }, { "event", QTFILE, QWevent, 0600 },
{ "rdsel", QTFILE, QWrdsel, 0400 }, { "rdsel", QTFILE, QWrdsel, 0400 },
{ "wrsel", QTFILE, QWwrsel, 0200 }, { "wrsel", QTFILE, QWwrsel, 0200 },

View file

@ -129,6 +129,49 @@ errorwin(Mntdir *md, int owner)
return w; 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; i<nincl; i++){
n = runestrlen(w->incl[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; typedef struct Warning Warning;
struct Warning{ struct Warning{

View file

@ -444,6 +444,11 @@ xfidwrite(Xfid *x)
respond(x, &fc, nil); respond(x, &fc, nil);
break; break;
case QWerrors:
w = errorwinforwin(w);
t = &w->body;
goto BodyTag;
case QWbody: case QWbody:
case QWwrsel: case QWwrsel:
t = &w->body; t = &w->body;