URI: 
       tadd errors file - plan9port - [fork] Plan 9 from user space
  HTML git clone git://src.adamsgaard.dk/plan9port
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
   DIR commit 9d01e221783e7706fd1d3dadfc8a7f678004929c
   DIR parent 3fef2ed0565e831549b43153751c81e9ee2e7e86
  HTML Author: rsc <devnull@localhost>
       Date:   Sun, 30 Jan 2005 16:34:12 +0000
       
       add errors file
       
       Diffstat:
         M man/man4/acme.4                     |      18 ++++++++++++++++++
         M src/cmd/acme/dat.h                  |       1 +
         M src/cmd/acme/fns.h                  |       1 +
         M src/cmd/acme/fsys.c                 |       1 +
         M src/cmd/acme/util.c                 |      43 ++++++++++++++++++++++++++++++
         M src/cmd/acme/xfid.c                 |       5 +++++
       
       6 files changed, 69 insertions(+), 0 deletions(-)
       ---
   DIR diff --git a/man/man4/acme.4 b/man/man4/acme.4
       t@@ -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
       t@@ -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
   DIR diff --git a/src/cmd/acme/dat.h b/src/cmd/acme/dat.h
       t@@ -15,6 +15,7 @@ enum
                QWctl,
                QWdata,
                QWeditout,
       +        QWerrors,
                QWevent,
                QWrdsel,
                QWwrsel,
   DIR diff --git a/src/cmd/acme/fns.h b/src/cmd/acme/fns.h
       t@@ -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);
   DIR diff --git a/src/cmd/acme/fsys.c b/src/cmd/acme/fsys.c
       t@@ -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 },
   DIR diff --git a/src/cmd/acme/util.c b/src/cmd/acme/util.c
       t@@ -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{
   DIR diff --git a/src/cmd/acme/xfid.c b/src/cmd/acme/xfid.c
       t@@ -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;