Allow host part of sam to be built independently. - sam - An updated version of… | |
git clone git://vernunftzentrum.de/sam.git | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit 9c1beacd363c68e2a85a9ebc94e28ace320958fa | |
parent 5c95796f29ca0fff4bf83b4c414278c0863eff32 | |
Author: Rob King <[email protected]> | |
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(-) | |
--- | |
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 *); | |
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) | |
{ | |
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 | |
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); |