treopen plumber, build mail - plan9port - [fork] Plan 9 from user space
 (HTM) git clone git://src.adamsgaard.dk/plan9port
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit ced6fd340e1a93fe87eac906d749a1989729e1ce
 (DIR) parent 98df7c80d83005ec6e4403a13014451c5dbfae3e
 (HTM) Author: rsc <devnull@localhost>
       Date:   Sun, 25 Jun 2006 23:51:10 +0000
       
       reopen plumber, build mail
       
       Diffstat:
         M src/cmd/acme/look.c                 |      56 +++++++++++++++++++++++--------
         M src/cmd/acme/mkfile                 |       4 ++--
       
       2 files changed, 44 insertions(+), 16 deletions(-)
       ---
 (DIR) diff --git a/src/cmd/acme/look.c b/src/cmd/acme/look.c
       t@@ -21,32 +21,60 @@ Window*        openfile(Text*, Expand*, int);
        int        nuntitled;
        
        void
       -plumbproc(void *v)
       +plumbthread(void *v)
        {
       +        CFid *fid;
                Plumbmsg *m;
       +        Timer *t;
        
                USED(v);
                threadsetname("plumbproc");
       +        
       +        /*
       +         * Loop so that if plumber is restarted, acme need not be.
       +         */
                for(;;){
       -                m = plumbrecvfid(plumbeditfid);
       -                if(m == nil)
       -                        threadexits(nil);
       -                sendp(cplumb, m);
       +                /*
       +                 * Connect to plumber.
       +                 */
       +                plumbunmount();
       +                while((fid = plumbopenfid("edit", OREAD|OCEXEC)) == nil){
       +                        t = timerstart(2000);
       +                        recv(t->c, nil);
       +                        timerstop(t);
       +                }
       +                plumbeditfid = fid;
       +                plumbsendfid = plumbopenfid("send", OWRITE|OCEXEC);
       +        
       +                /*
       +                 * Relay messages.
       +                 */
       +                for(;;){
       +                        m = plumbrecvfid(plumbeditfid);
       +                        if(m == nil)
       +                                break;
       +                        sendp(cplumb, m);
       +                }
       +
       +                /*
       +                 * Lost connection.
       +                 */
       +                fid = plumbsendfid;
       +                plumbsendfid = nil;
       +                fsclose(fid);
       +
       +                fid = plumbeditfid;
       +                plumbeditfid = nil;
       +                fsclose(fid);
                }
        }
        
        void
        startplumbing(void)
        {
       -        plumbeditfid = plumbopenfid("edit", OREAD|OCEXEC);
       -        if(plumbeditfid == nil)
       -                fprint(2, "acme: can't initialize plumber: %r\n");
       -        else{
       -                cplumb = chancreate(sizeof(Plumbmsg*), 0);
       -                chansetname(cplumb, "cplumb");
       -                threadcreate(plumbproc, nil, STACK);
       -        }
       -        plumbsendfid = plumbopenfid("send", OWRITE|OCEXEC);
       +        cplumb = chancreate(sizeof(Plumbmsg*), 0);
       +        chansetname(cplumb, "cplumb");
       +        threadcreate(plumbthread, nil, STACK);
        }
        
        
 (DIR) diff --git a/src/cmd/acme/mkfile b/src/cmd/acme/mkfile
       t@@ -1,7 +1,7 @@
        <$PLAN9/src/mkhdr
        
        TARG=acme
       -# DIRS=mail
       +DIRS=mail
        
        OFILES=\
                acme.$O\
       t@@ -30,6 +30,6 @@ HFILES=dat.h\
                fns.h\
        
        <$PLAN9/src/mkone
       -# <$PLAN9/src/mkdirs
       +<$PLAN9/src/mkdirs
        
        edit.$O ecmd.$O elog.$O:        edit.h