Remove more unused code. - sam - An updated version of the sam text editor.
 (HTM) git clone git://vernunftzentrum.de/sam.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
 (DIR) commit 168ca94a5098b443f6ae1c4b81ba9bdb09dcd372
 (DIR) parent 0141a9eb504b9de8d76ad08f0dd1606c9b24da9a
 (HTM) Author: Rob King <jking@deadpixi.com>
       Date:   Tue,  4 Oct 2016 10:45:29 -0500
       
       Remove more unused code.
       
       Diffstat:
         include/libc.h                      |       8 ++------
         sam/cmd.c                           |       2 +-
         sam/io.c                            |      10 +++++-----
         sam/mesg.c                          |       4 ++--
         sam/sam.c                           |       6 +++---
         sam/shell.c                         |       8 ++++----
         sam/sys.c                           |       2 +-
         sam/unix.c                          |      15 ++-------------
         samterm/io.c                        |       2 +-
         samterm/mesg.c                      |       6 +++---
         samterm/unix.c                      |      26 --------------------------
       
       11 files changed, 24 insertions(+), 65 deletions(-)
       ---
 (DIR) diff --git a/include/libc.h b/include/libc.h
       @@ -16,18 +16,14 @@
        #define create(name, mode, perm)    creat(name, perm)
        #define exec(a,b)           execv(a,b)
        
       -#define _exits(v)           _exit((v) ? 1 : 0)
       -
        #define getuser() (getenv("LOGNAME") ? getenv("LOGNAME") : "unknown")
        
        /*
         * new rune routines
         */
       -extern  int chartorune(wchar_t*, char*);
       +int chartorune(wchar_t*, char*);
        
        /*
         *  Miscellaneous functions
         */
       -extern  int notify (void);
       -extern  void    exits(char*);
       -
       +void notify (void);
 (DIR) diff --git a/sam/cmd.c b/sam/cmd.c
       @@ -206,7 +206,7 @@ cmdloop(void)
                if((cmdp = parsecmd(0))==0){
                    if(downloaded){
                        rescue();
       -                exits("eof");
       +                exit(EXIT_FAILURE);
                    }
                    break;
                }
 (DIR) diff --git a/sam/io.c b/sam/io.c
       @@ -169,7 +169,7 @@ bootterm(char *machine, char **argv, char **end)
                execvp(samterm, argv);
                fprintf(stderr, "can't exec: ");
                perror(samterm);
       -        _exits("damn");
       +        exit(EXIT_FAILURE);
            }
            if(pipe(ph2t)==-1 || pipe(pt2h)==-1)
                panic("pipe");
       @@ -186,7 +186,7 @@ bootterm(char *machine, char **argv, char **end)
                execvp(samterm, argv);
                fprintf(stderr, "can't exec: ");
                perror(samterm);
       -        _exits("damn");
       +        exit(EXIT_FAILURE);
            case -1:
                panic("can't fork samterm");
            }
       @@ -205,7 +205,7 @@ connectto(char *machine)
        
            if(pipe(p1)<0 || pipe(p2)<0){
                dprint("can't pipe\n");
       -        exits("pipe");
       +        exit(EXIT_FAILURE);
            }
            remotefd0 = p1[0];
            remotefd1 = p2[1];
       @@ -219,11 +219,11 @@ connectto(char *machine)
                close(p2[1]);
                execlp(getenv("RSH") ? getenv("RSH") : RXPATH, getenv("RSH") ? getenv("RSH") : RXPATH, machine, rsamname, "-R", (char*)0);
                dprint("can't exec %s\n", RXPATH);
       -        exits("exec");
       +        exit(EXIT_FAILURE);
        
            case -1:
                dprint("can't fork\n");
       -        exits("fork");
       +        exit(EXIT_FAILURE);
            }
            close(p1[1]);
            close(p2[0]);
 (DIR) diff --git a/sam/mesg.c b/sam/mesg.c
       @@ -491,7 +491,7 @@ inmesg(Tmesg type)
                break;
        
            case Texit:
       -        exits(0);
       +        exit(EXIT_SUCCESS);
            }
            return true;
        }
       @@ -739,7 +739,7 @@ outflush(void)
            do
                if(rcv() == 0){
                    rescue();
       -            exits("eof");
       +            exit(EXIT_FAILURE);
                }
            while(waitack);
            outmsg = outdata;
 (DIR) diff --git a/sam/sam.c b/sam/sam.c
       @@ -126,14 +126,14 @@ main(int argc, char *argv[])
            setjmp(mainloop);
            cmdloop();
            trytoquit();    /* if we already q'ed, quitok will be true */
       -    exits(0);
       +    exit(EXIT_SUCCESS);
        }
        
        void
        usage(void)
        {
            dprint("usage: sam [-r machine] [-d] [-f] [-e] [-t samterm] [-s samname] FILE...\n");
       -    exits("usage");
       +    exit(EXIT_FAILURE);
        }
        
        void
       @@ -198,7 +198,7 @@ void
        hiccough(char *s)
        {
            if(rescuing)
       -        exits("rescue");
       +        exit(EXIT_FAILURE);
        
            if(s)
                dprint("%s\n", s);
 (DIR) diff --git a/sam/shell.c b/sam/shell.c
       @@ -61,7 +61,7 @@ plan9(File *f, int type, String *s, int nest)
                }
                if(type == '|'){
                    if(pipe(pipe2) == -1)
       -                exits("pipe");
       +                exit(EXIT_FAILURE);
                    if((pid = fork())==0){
                        /*
                         * It's ok if we get SIGPIPE here
       @@ -81,11 +81,11 @@ plan9(File *f, int type, String *s, int nest)
                                free(c);
                            }
                        }
       -                exits(retcode? "error" : 0);
       +                exit(retcode? EXIT_FAILURE : EXIT_SUCCESS);
                    }
                    if(pid==-1){
                        fprintf(stderr, "Can't fork?!\n");
       -                exits("fork");
       +                exit(EXIT_FAILURE);
                    }
                    dup(pipe2[0], 0);
                    close(pipe2[0]);
       @@ -96,7 +96,7 @@ plan9(File *f, int type, String *s, int nest)
                    open("/dev/null", 0);
                }
                execl(shpath, sh, "-c", Strtoc(&plan9cmd), NULL);
       -        exits("exec");
       +        exit(EXIT_FAILURE);
            }
            if(pid == -1)
                error(Efork);
 (DIR) diff --git a/sam/sys.c b/sam/sys.c
       @@ -44,7 +44,7 @@ Read(int f, void *a, int n)
                if (downloaded)
                    fprintf(stderr, "read error: %s\n", buf);
                rescue();
       -        exits("read");
       +        exit(EXIT_FAILURE);
            }
            return n;
        }
 (DIR) diff --git a/sam/unix.c b/sam/unix.c
       @@ -96,20 +96,19 @@ statfd(int fd, uint64_t *dev, uint64_t *id, int64_t *time, int64_t *length, int6
            return 1;
        }
        
       -void
       +static void
        hup(int sig)
        {
            rescue();
            exit(1);
        }
        
       -int
       +void
        notify(void)
        {
            signal(SIGINT, SIG_IGN);
            signal(SIGHUP, hup);
            signal(SIGPIPE, SIG_IGN);
       -    return 1;
        }
        
        int
       @@ -162,16 +161,6 @@ erealloc(void *p, uint64_t n)
        }
        
        void
       -exits(char *message)
       -{
       -
       -    if (message == 0)
       -        exit(0);
       -    else
       -        exit(1);
       -}
       -
       -void
        dprint(char *z, ...)
        {
            va_list args;
 (DIR) diff --git a/samterm/io.c b/samterm/io.c
       @@ -200,5 +200,5 @@ RESHAPED(void)
        void
        mouseexit(void)
        {
       -    exits(0);
       +    exit(EXIT_SUCCESS);
        }
 (DIR) diff --git a/samterm/mesg.c b/samterm/mesg.c
       @@ -496,7 +496,7 @@ outsend(void)
            outdata[1]=outcount;
            outdata[2]=outcount>>8;
            if(write(1, (char *)outdata, outcount+HSIZE)!=outcount+HSIZE)
       -        exits("write error");
       +        exit(EXIT_FAILURE);
        }
        
        
       @@ -637,12 +637,12 @@ hsetsnarf(int nc)
                    n = SNARFSIZE-1;
                s1 = realloc(s1, n+1);
                if (!s1)
       -            exits("malloc");
       +            exit(EXIT_FAILURE);
                s1[n] = 0;
                snarflen = n;
                outTs(Tsetsnarf, n);
                if(n>0 && write(1, s1, n)!=n)
       -            exits("write error");
       +            exit(EXIT_FAILURE);
                free(s1);
            }else
                outTs(Tsetsnarf, 0);
 (DIR) diff --git a/samterm/unix.c b/samterm/unix.c
       @@ -10,14 +10,6 @@
        #include <errno.h>
        #include <signal.h>
        
       -#ifdef APOLLO
       -#define O_NONBLOCK  O_NDELAY
       -#endif
       -
       -#if defined(UMIPS) || defined(SUNOS)
       -#define atexit(p)       /* sigh */
       -#endif
       -
        char *exname = NULL;
        static char *fallbacks[] = {
            "*scrollForwardR: true",
       @@ -139,21 +131,3 @@ extstart(void)
            atexit(removeextern);
        #endif
        }
       -
       -/*
       - *  we have to supply a dummy exit function, because some vendors can't be
       - *  bothered to provide atexit().  we clean up the named pipes on a normal
       - *  exit, but leave them laying around on abnormal exits.
       - */
       -void
       -exits(char *message)
       -{
       -    if (exname) {
       -        unlink(exname);
       -        exname = 0;
       -    }
       -    if (message == 0)
       -        exit (0);
       -    else
       -        exit(1);
       -}