tclean up when finished. - 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 b4a659b6cffd452fbdf54a81210f0540426b678a
 (DIR) parent 98cd2746cff82ab359de6d6ce2c3f87b2c4166a8
 (HTM) Author: rsc <devnull@localhost>
       Date:   Mon, 19 Apr 2004 23:03:46 +0000
       
       clean up when finished.
       
       Diffstat:
         M INSTALL                             |       1 +
         M src/cmd/9term/9term.c               |       2 ++
         M src/cmd/9term/FreeBSD.c             |      59 +------------------------------
         M src/cmd/9term/bsdpty.c              |       5 ++++-
         M src/cmd/9term/mkfile                |       3 +--
         M src/cmd/9term/rcstart.c             |       7 +++----
         M src/cmd/9term/term.h                |       1 +
         M src/cmd/9term/win.c                 |       2 ++
         M src/cmd/acid/main.c                 |      12 ++++++++----
         M src/cmd/acid/mkfile                 |       1 -
         M src/cmd/acid/proc.c                 |       3 +--
         M src/cmd/acidtypes/mkfile            |       2 +-
         M src/cmd/acme/fns.h                  |       2 ++
         M src/cmd/acme/mkfile                 |       1 -
         M src/cmd/bzip2/lib/mkfile            |       1 -
         M src/cmd/bzip2/mkfile                |       1 -
         M src/cmd/idiff.c                     |       8 ++++----
         M src/cmd/look.c                      |       7 +++++++
         M src/cmd/mkfile                      |       3 +--
         M src/cmd/strings.c                   |       2 ++
         M src/mkfile                          |       2 +-
       
       21 files changed, 42 insertions(+), 83 deletions(-)
       ---
 (DIR) diff --git a/INSTALL b/INSTALL
       t@@ -7,6 +7,7 @@ cd src
        make
        mk clean
        mk install
       +mk clean
        
        echo "Set PLAN9=$PLAN9 in your profile environment."
        echo 'Add $PLAN9/bin to your PATH.'
 (DIR) diff --git a/src/cmd/9term/9term.c b/src/cmd/9term/9term.c
       t@@ -11,6 +11,8 @@
        #include <complete.h>
        #include "term.h"
        
       +int noecho = 0;
       +
        typedef struct Text        Text;
        typedef struct Readbuf        Readbuf;
        
 (DIR) diff --git a/src/cmd/9term/FreeBSD.c b/src/cmd/9term/FreeBSD.c
       t@@ -1,58 +1 @@
       -#include <u.h>
       -#include <sys/types.h>
       -#include <termios.h>
       -#include <sys/termios.h>
       -#include <libutil.h>
       -#include <libc.h>
       -#include "term.h"
       -
       -int
       -getpts(int fd[], char *slave)
       -{
       -        return openpty(&fd[1], &fd[0], slave, 0, 0);
       -}
       -
       -int
       -childpty(int fd[], char *slave)
       -{
       -        int sfd;
       -
       -        close(fd[1]);
       -        setsid();
       -        sfd = open(slave, ORDWR);
       -        if(sfd < 0)
       -                sysfatal("open %s: %r\n", slave);
       -        if(ioctl(sfd, TIOCSCTTY, 0) < 0)
       -                fprint(2, "ioctl TIOCSCTTY: %r\n");
       -        return sfd;
       -}
       -
       -struct winsize ows;
       -
       -void
       -updatewinsize(int row, int col, int dx, int dy)
       -{
       -        struct winsize ws;
       -
       -        ws.ws_row = row;
       -        ws.ws_col = col;
       -        ws.ws_xpixel = dx;
       -        ws.ws_ypixel = dy;
       -        if(ws.ws_row != ows.ws_row || ws.ws_col != ows.ws_col)
       -        if(ioctl(rcfd[0], TIOCSWINSZ, &ws) < 0)
       -                fprint(2, "ioctl: %r\n");
       -        ows = ws;
       -}
       -
       -int
       -israw(int fd)
       -{
       -        return 0;
       -}
       -
       -int
       -setecho(int fd, int on)
       -{
       -        return 0;
       -}
       -
       +#include "bsdpty.c"
 (DIR) diff --git a/src/cmd/9term/bsdpty.c b/src/cmd/9term/bsdpty.c
       t@@ -1,9 +1,13 @@
        #include <u.h>
       +#include <sys/types.h>
       +#include <sys/stat.h>
        #include <errno.h>
        #include <grp.h>
        #include <termios.h>
        #include <sys/termios.h>
       +#ifdef __linux__
        #include <pty.h>
       +#endif
        #include <fcntl.h>
        #include <libc.h>
        #include "term.h"
       t@@ -30,7 +34,6 @@ getpts(int fd[], char *slave)
                        pty[8] = *a;
                        pty[9] = *z;
                        if((fd[1] = open(pty, ORDWR)) < 0){
       -fprint(2, "try %s: %r\n", pty);
                                if(errno == ENOENT)
                                        break;
                        }else{
 (DIR) diff --git a/src/cmd/9term/mkfile b/src/cmd/9term/mkfile
       t@@ -1,4 +1,3 @@
       -PLAN9=../../..
        <$PLAN9/src/mkhdr
        
        TARG=9term win
       t@@ -13,5 +12,5 @@ SHORTLIB=complete frame draw plumb fs mux thread 9
        
        LDFLAGS=-L$X11/lib -lX11
        
       -Linux.$O: bsdpty.c
       +Linux.$O FreeBSD.$O: bsdpty.c
        
 (DIR) diff --git a/src/cmd/9term/rcstart.c b/src/cmd/9term/rcstart.c
       t@@ -1,9 +1,6 @@
        #include <u.h>
       -#include <libc.h>
       -#if 0
       -#include <sys/wait.h>
       -#endif
        #include <signal.h>
       +#include <libc.h>
        #include "term.h"
        
        int
       t@@ -37,6 +34,8 @@ rcstart(int argc, char **argv, int *pfd, int *tfd)
                        dup(sfd, 1);
                        dup(sfd, 2);
                        system("stty tabs -onlcr onocr icanon echo erase '^h' intr '^?'");
       +                if(noecho)
       +                        system("stty -echo");
                        for(i=3; i<100; i++)
                                close(i);
                        execvp(argv[0], argv);
 (DIR) diff --git a/src/cmd/9term/term.h b/src/cmd/9term/term.h
       t@@ -5,3 +5,4 @@ extern int rcfd;
        extern int rcstart(int, char*[], int*, int*);
        extern int isecho(int);
        extern int setecho(int, int);
       +extern int noecho;
 (DIR) diff --git a/src/cmd/9term/win.c b/src/cmd/9term/win.c
       t@@ -5,6 +5,8 @@
        #include <fs.h>
        #include "term.h"
        
       +int noecho = 1;
       +
        #define        EVENTSIZE        256
        #define        STACK        32768
        
 (DIR) diff --git a/src/cmd/acid/main.c b/src/cmd/acid/main.c
       t@@ -112,10 +112,12 @@ main(int argc, char *argv[])
        
                l = look("acidmap");
                if(l && l->proc) {
       -                n = an(ONAME, ZN, ZN);
       -                n->sym = l;
       -                n = an(OCALL, n, ZN);
       -                execute(n);
       +                if(setjmp(err) == 0){
       +                        n = an(ONAME, ZN, ZN);
       +                        n->sym = l;
       +                        n = an(OCALL, n, ZN);
       +                        execute(n);
       +                }
                }
        
                interactive = 1;
       t@@ -146,12 +148,14 @@ main(int argc, char *argv[])
        static int
        attachfiles(int argc, char **argv)
        {
       +        int pid;
                char *s;
                int i, omode;
                Fhdr *hdr;
                Lsym *l;
                Value *v;
        
       +        pid = 0;
                interactive = 0;
                if(setjmp(err))
                        return -1;
 (DIR) diff --git a/src/cmd/acid/mkfile b/src/cmd/acid/mkfile
       t@@ -18,7 +18,6 @@ OFILES=$UOFILES y.tab.$O
        YFILES=dbg.y
        HFILES=acid.h
        
       -BIN=/home/rsc/bin
        
        SHORTLIB=mach regexp9 bio 9
        
 (DIR) diff --git a/src/cmd/acid/proc.c b/src/cmd/acid/proc.c
       t@@ -51,8 +51,7 @@ sproc(int xpid)
        int
        nproc(char **argv)
        {
       -        char buf[128];
       -        int pid, i, fd;
       +        int pid, i;
        
                pid = fork();
                switch(pid) {
 (DIR) diff --git a/src/cmd/acidtypes/mkfile b/src/cmd/acidtypes/mkfile
       t@@ -11,7 +11,7 @@ OFILES=\
        
        HFILES=\
                dat.h\
       -        ../../libmach/mach.h\
       +        $PLAN9/include/mach.h\
                ../../libmach/elf.h\
                ../../libmach/dwarf.h\
                ../../libmach/stabs.h\
 (DIR) diff --git a/src/cmd/acme/fns.h b/src/cmd/acme/fns.h
       t@@ -55,6 +55,8 @@ void        get(Text*, Text*, Text*, int, int, Rune*, int);
        void        put(Text*, Text*, Text*, int, int, Rune*, int);
        void        putfile(File*, int, int, Rune*, int);
        void        fontx(Text*, Text*, Text*, int, int, Rune*, int);
       +#undef isalnum
       +#define isalnum acmeisalnum
        int        isalnum(Rune);
        void        execute(Text*, uint, uint, int, Text*);
        int        search(Text*, Rune*, uint);
 (DIR) diff --git a/src/cmd/acme/mkfile b/src/cmd/acme/mkfile
       t@@ -1,6 +1,5 @@
        # Acme is up-to-date w.r.t. sources as of 29 February 2004
        
       -PLAN9=../../..
        <$PLAN9/src/mkhdr
        
        TARG=acme
 (DIR) diff --git a/src/cmd/bzip2/lib/mkfile b/src/cmd/bzip2/lib/mkfile
       t@@ -1,4 +1,3 @@
       -PLAN9=../../../..
        <$PLAN9/src/mkhdr
        
        OFILES=\
 (DIR) diff --git a/src/cmd/bzip2/mkfile b/src/cmd/bzip2/mkfile
       t@@ -1,4 +1,3 @@
       -PLAN9=../../..
        <$PLAN9/src/mkhdr
        
        OFILES=
 (DIR) diff --git a/src/cmd/idiff.c b/src/cmd/idiff.c
       t@@ -104,7 +104,7 @@ rundiff(char *arg1, char *arg2, int outfd)
                Waitmsg *w;
        
                narg = 0;
       -        arg[narg++] = "/bin/diff";
       +        arg[narg++] = "diff";
                arg[narg++] = "-n";
                if(diffbflag)
                        arg[narg++] = "-b";
       t@@ -121,7 +121,7 @@ rundiff(char *arg1, char *arg2, int outfd)
                case 0:
                        dup(outfd, 1);
                        close(0);
       -                exec("/bin/diff", arg);
       +                exec("diff", arg);
                        sysfatal("exec: %r");
        
                default:
       t@@ -143,7 +143,7 @@ runcmd(char *cmd)
                int narg, pid, wpid;
        
                narg = 0;
       -        arg[narg++] = "/bin/rc";
       +        arg[narg++] = "rc";
                arg[narg++] = "-c";
                arg[narg++] = cmd;
                arg[narg] = nil;
       t@@ -153,7 +153,7 @@ runcmd(char *cmd)
                        sysfatal("fork: %r");
        
                case 0:
       -                exec("/bin/rc", arg);
       +                exec("rc", arg);
                        sysfatal("exec: %r");
        
                default:
 (DIR) diff --git a/src/cmd/look.c b/src/cmd/look.c
       t@@ -3,6 +3,13 @@
        #include <bio.h>
                /* Macros for Rune support of ctype.h-like functions */
        
       +#undef isupper
       +#undef islower
       +#undef isalpha
       +#undef isdigit
       +#undef isalnum
       +#undef isspace
       +#undef tolower
        #define        isupper(r)        (L'A' <= (r) && (r) <= L'Z')
        #define        islower(r)        (L'a' <= (r) && (r) <= L'z')
        #define        isalpha(r)        (isupper(r) || islower(r))
 (DIR) diff --git a/src/cmd/mkfile b/src/cmd/mkfile
       t@@ -1,4 +1,3 @@
       -PLAN9=../..
        <$PLAN9/src/mkhdr
        
        TARG=`ls *.c | sed 's/\.c//'`
       t@@ -7,7 +6,7 @@ SHORTLIB=sec fs mux regexp9 draw thread bio 9
        
        <$PLAN9/src/mkmany
        
       -BUGGERED='CVS|faces|factotum|htmlfmt|mk|upas|vac|venti'
       +BUGGERED='CVS|faces|factotum|mk|upas|vac|venti'
        DIRS=`ls -l |sed -n 's/^d.* //p' |egrep -v "^($BUGGERED)$"`
        
        <$PLAN9/src/mkdirs
 (DIR) diff --git a/src/cmd/strings.c b/src/cmd/strings.c
       t@@ -10,6 +10,8 @@ Biobuf        fout;
        #define BUFSIZE                70
        
        void stringit(char *);
       +#undef isprint
       +#define isprint risprint
        int isprint(Rune);
        
        void
 (DIR) diff --git a/src/mkfile b/src/mkfile
       t@@ -1,6 +1,6 @@
        <mkhdr
        
       -BUGGERED='9p|fmt|html|httpd|ip|utf|venti'
       +BUGGERED='9p|fmt|httpd|ip|utf|venti'
        LIBDIRS=`ls -ld lib* | sed -n 's/^d.* //p' |egrep -v "^lib($BUGGERED)$"`
        
        DIRS=\