Refactored 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 4fc20405021028c8d1354b9a7502edb981f5611d
 (DIR) parent 3faf10fec3196e42b6ca31cd216091d73475944a
 (HTM) Author: Rob King <jking@deadpixi.com>
       Date:   Tue,  4 Oct 2016 11:19:09 -0500
       
       Refactored code.
       
       Diffstat:
         include/u.h                         |       1 -
         sam/sam.c                           |      14 +++++++++++++-
         sam/unix.c                          |      15 ---------------
       
       3 files changed, 13 insertions(+), 17 deletions(-)
       ---
 (DIR) diff --git a/include/u.h b/include/u.h
       @@ -19,4 +19,3 @@
        #define runelen(r)       (wctomb(NULL, (r)))
        
        int chartorune(wchar_t *, char *);
       -void notify(void);
 (DIR) diff --git a/sam/sam.c b/sam/sam.c
       @@ -2,6 +2,7 @@
        #include "sam.h"
        
        #include <libgen.h>
       +#include <signal.h>
        #include <stdbool.h>
        #include <unistd.h>
        
       @@ -39,6 +40,13 @@ wchar_t    baddir[] = { '<', 'b', 'a', 'd', 'd', 'i', 'r', '>', '\n'};
        
        void    usage(void);
        
       +static void
       +hup(int sig)
       +{
       +    rescue();
       +    exit(EXIT_FAILURE);
       +}
       +
        int
        main(int argc, char *argv[])
        {
       @@ -106,7 +114,11 @@ main(int argc, char *argv[])
            if(!dflag)
                startup(machine, Rflag, arg, ap);
            Fstart();
       -    notify();
       +
       +    signal(SIGINT, SIG_IGN);
       +    signal(SIGHUP, hup);
       +    signal(SIGPIPE, SIG_IGN);
       +
            if(argc > 0){
                for(i=0; i<argc; i++)
                    if(!setjmp(mainloop)){
 (DIR) diff --git a/sam/unix.c b/sam/unix.c
       @@ -96,21 +96,6 @@ statfd(int fd, uint64_t *dev, uint64_t *id, int64_t *time, int64_t *length, int6
            return 1;
        }
        
       -static void
       -hup(int sig)
       -{
       -    rescue();
       -    exit(1);
       -}
       -
       -void
       -notify(void)
       -{
       -    signal(SIGINT, SIG_IGN);
       -    signal(SIGHUP, hup);
       -    signal(SIGPIPE, SIG_IGN);
       -}
       -
        int
        newtmp(void)
        {