Allow host part of sam to be built independently. - 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 9c1beacd363c68e2a85a9ebc94e28ace320958fa
 (DIR) parent 5c95796f29ca0fff4bf83b4c414278c0863eff32
 (HTM) Author: Rob King <jking@deadpixi.com>
       Date:   Thu, 20 Oct 2016 16:40:01 -0500
       
       Allow host part of sam to be built independently.
       
       Diffstat:
         include/u.h                         |       1 +
         libXg/rune.c                        |       2 --
         sam/Makefile                        |       5 ++---
         sam/cmd.c                           |       3 ++-
       
       4 files changed, 5 insertions(+), 6 deletions(-)
       ---
 (DIR) diff --git a/include/u.h b/include/u.h
       @@ -17,5 +17,6 @@
        #define fullrune(s, n)   (mbtowc(NULL, (s), (n)) >= 0)
        #define runetochar(s, r) (wctomb((s), (r)))
        #define runelen(r)       (wctomb(NULL, (r)))
       +#define UNICODE_REPLACEMENT_CHAR 0xfffd
        
        int chartorune(wchar_t *, char *);
 (DIR) diff --git a/libXg/rune.c b/libXg/rune.c
       @@ -2,8 +2,6 @@
        #include <u.h>
        #include <string.h>
        
       -#define UNICODE_REPLACEMENT_CHAR 0xfffd
       -
        int
        chartorune(wchar_t *rune, char *str)
        {
 (DIR) diff --git a/sam/Makefile b/sam/Makefile
       @@ -30,7 +30,6 @@ RXSAMNAME=rsam
        
        CFLAGS=$(STANDARDS) $(INCS) $(INCLUDES) -DRXPATH='"$(RXPATH)"'
        
       -LIB=../libXg/libXg.a
        CC?=c99
        
        OBJ=sam.o address.o buffer.o cmd.o error.o file.o io.o \
       @@ -39,8 +38,8 @@ OBJ=sam.o address.o buffer.o cmd.o error.o file.o io.o \
        
        all:    sam
        
       -sam:        $(OBJ) $(LIB)
       -        $(CC) -o sam $(OBJ) $(LIB) $(LDFLAGS)
       +sam:        $(OBJ)
       +        $(CC) -o sam $(OBJ) $(LDFLAGS)
        
        clean:
                rm -f *.o core sam
 (DIR) diff --git a/sam/cmd.c b/sam/cmd.c
       @@ -114,7 +114,8 @@ inputc(void)
                        return -1;
                    nbuf += n;
                }while(!fullrune(buf, nbuf));
       -        chartorune(&r, buf);
       +        if (mbtowc(&r, buf, strlen(buf)) < 0)
       +            r = UNICODE_REPLACEMENT_CHAR;
            }
            if(r == 0){
                warn(Wnulls);