aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2005-01-30 16:34:12 +0000
committerrsc <devnull@localhost>2005-01-30 16:34:12 +0000
commit9d01e221783e7706fd1d3dadfc8a7f678004929c (patch)
treeab3ca9688a6b41f27d40d65d431048edd65fd25d
parent3fef2ed0565e831549b43153751c81e9ee2e7e86 (diff)
downloadplan9port-9d01e221783e7706fd1d3dadfc8a7f678004929c.tar.gz
plan9port-9d01e221783e7706fd1d3dadfc8a7f678004929c.tar.bz2
plan9port-9d01e221783e7706fd1d3dadfc8a7f678004929c.zip
add errors file
-rw-r--r--man/man4/acme.418
-rw-r--r--src/cmd/acme/dat.h1
-rw-r--r--src/cmd/acme/fns.h1
-rw-r--r--src/cmd/acme/fsys.c1
-rw-r--r--src/cmd/acme/util.c43
-rw-r--r--src/cmd/acme/xfid.c5
6 files changed, 69 insertions, 0 deletions
diff --git a/man/man4/acme.4 b/man/man4/acme.4
index 40143a44..1312904a 100644
--- a/man/man4/acme.4
+++ b/man/man4/acme.4
@@ -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
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
.B event
@@ -395,6 +406,13 @@ holds contents of the window tag. It may be read at any byte offset.
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
diff --git a/src/cmd/acme/dat.h b/src/cmd/acme/dat.h
index 4ac0d676..19229e7a 100644
--- a/src/cmd/acme/dat.h
+++ b/src/cmd/acme/dat.h
@@ -15,6 +15,7 @@ enum
QWctl,
QWdata,
QWeditout,
+ QWerrors,
QWevent,
QWrdsel,
QWwrsel,
diff --git a/src/cmd/acme/fns.h b/src/cmd/acme/fns.h
index c61f96ec..74a381e2 100644
--- a/src/cmd/acme/fns.h
+++ b/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);
diff --git a/src/cmd/acme/fsys.c b/src/cmd/acme/fsys.c
index 536a3334..31236082 100644
--- a/src/cmd/acme/fsys.c
+++ b/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 },
diff --git a/src/cmd/acme/util.c b/src/cmd/acme/util.c
index f9387df5..c224cce5 100644
--- a/src/cmd/acme/util.c
+++ b/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; 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;
struct Warning{
diff --git a/src/cmd/acme/xfid.c b/src/cmd/acme/xfid.c
index 579f1944..126a5fe9 100644
--- a/src/cmd/acme/xfid.c
+++ b/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;