URI: 
       twin: add cook/nocook - 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 875351f44f2fa7d79e3cd69ef8862cb9c822ab66
   DIR parent 77929f826177f51f26c8d58f29dc40b988d6f15d
  HTML Author: Russ Cox <rsc@swtch.com>
       Date:   Fri, 10 Sep 2010 09:31:56 -0400
       
       win: add cook/nocook
       
       R=rsc
       http://codereview.appspot.com/2162042
       
       Diffstat:
         M src/cmd/9term/win.c                 |      19 ++++++++++++++-----
       
       1 file changed, 14 insertions(+), 5 deletions(-)
       ---
   DIR diff --git a/src/cmd/9term/win.c b/src/cmd/9term/win.c
       t@@ -54,6 +54,7 @@ int        ntyper;
        int        ntypebreak;
        int        debug;
        int        rcfd;
       +int        cook;
        
        char *name;
        
       t@@ -178,7 +179,7 @@ threadmain(int argc, char **argv)
                putenv("winid", buf);
                sprint(buf, "%d/tag", id);
                fd = fsopenfd(fs, buf, OWRITE|OCEXEC);
       -        write(fd, " Send Noscroll", 1+4+1+8);
       +        write(fd, " Send Nocook Noscroll", 1+4+1+6+1+8);
                close(fd);
                sprint(buf, "%d/event", id);
                eventfd = fsopen(fs, buf, ORDWR|OCEXEC);
       t@@ -414,7 +415,7 @@ stdinproc(void *v)
                                case 'D':
                                        n = delete(&e);
                                        q.p -= n;
       -                                if(!isecho(fd0))
       +                                if(!cook && !isecho(fd0))
                                                sendbs(fd0, n);
                                        break;
        
       t@@ -445,6 +446,14 @@ stdinproc(void *v)
                                                fsprint(ctlfd, "noscroll");
                                                break;
                                        }
       +                                if(cistrcmp(buf, "cook") == 0) {
       +                                        cook = 1;
       +                                        break;
       +                                }
       +                                if(cistrcmp(buf, "nocook") == 0) {
       +                                        cook = 0;
       +                                        break;
       +                                }
                                        if(e.flag & 8){
                                                if(e.q1 != e.q0){
                                                        sende(&e, fd0, cfd, afd, dfd, 0);
       t@@ -676,7 +685,7 @@ sendtype(int fd0)
        {
                int i, n, nr, raw;
                
       -        raw = !isecho(fd0);
       +        raw = !cook && !isecho(fd0);
                while(ntypebreak || (raw && ntypeb > 0)){
                        for(i=0; i<ntypeb; i++)
                                if(typing[i]=='\n' || typing[i]==0x04 || (i==ntypeb-1 && raw)){
       t@@ -684,7 +693,7 @@ sendtype(int fd0)
                                                ntypebreak--;
                                        n = i+1;
                                        i++;
       -                                if(isecho(fd0))
       +                                if(!raw)
                                                echoed(typing, n);
                                        if(write(fd0, typing, n) != n)
                                                error("sending to program");
       t@@ -772,7 +781,7 @@ type(Event *e, int fd0, CFid *afd, CFid *dfd)
                                m += nr;
                        }
                }
       -        if(!isecho(fd0)) {
       +        if(!cook && !isecho(fd0)) {
                        n = sprint(buf, "#%d,#%d", e->q0, e->q1);
                        fswrite(afd, buf, n);
                        fswrite(dfd, "", 0);