aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFranklin Wei <git@fwei.tk>2015-11-24 18:44:44 -0500
committerFranklin Wei <git@fwei.tk>2015-11-24 18:44:44 -0500
commit3c13f12ac8279ddccf2a20fbc072d6b918ea2096 (patch)
tree6cc7f11e1d6029fdbd84ffe1179c870057b76af5
parentc7c1bd7641581e2a0b84dcecdab61ed7c43268e9 (diff)
downloadducky-3c13f12ac8279ddccf2a20fbc072d6b918ea2096.zip
ducky-3c13f12ac8279ddccf2a20fbc072d6b918ea2096.tar.gz
ducky-3c13f12ac8279ddccf2a20fbc072d6b918ea2096.tar.bz2
ducky-3c13f12ac8279ddccf2a20fbc072d6b918ea2096.tar.xz
remove BSD dependency
-rw-r--r--Makefile2
-rw-r--r--src/compile.c2
-rw-r--r--src/interp.c2
-rw-r--r--target/unix/platform.h3
4 files changed, 4 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index f02858c..2a9afd4 100644
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,7 @@ PLATFORM = unix
DUCKY_OBJ = src/interp.o src/compile.o src/vm.o src/emitc.o
-CFLAGS = -lbsd -lm -Og -g -I src/ -I target/$(PLATFORM)
+CFLAGS = -lm -Og -g -I src/ -I target/$(PLATFORM)
all: $(OUT)/$(PLATFORM).bin
diff --git a/src/compile.c b/src/compile.c
index 2e95092..20de9b1 100644
--- a/src/compile.c
+++ b/src/compile.c
@@ -90,7 +90,7 @@ varid_t get_varid(const char *name)
for(int i = 0; i < last_assigned_var; ++i)
if(strcmp(name, vars[i].name) == 0)
return i;
- strlcpy(vars[last_assigned_var].name, name, VARNAME_MAX);
+ strncpy(vars[last_assigned_var].name, name, VARNAME_MAX);
++last_assigned_var;
return last_assigned_var - 1;
}
diff --git a/src/interp.c b/src/interp.c
index 8ecf630..c49d13e 100644
--- a/src/interp.c
+++ b/src/interp.c
@@ -105,7 +105,7 @@ static struct varnode_t *lookup_var(const char *name)
struct varnode_t *new = malloc(sizeof(struct varnode_t));
memset(new, 0, sizeof(struct varnode_t));
- strlcpy(new->name, name, sizeof(new->name));
+ strncpy(new->name, name, sizeof(new->name));
new->val = 0;
new->constant = false;
new->next = NULL;
diff --git a/target/unix/platform.h b/target/unix/platform.h
index 328d35b..4a7553f 100644
--- a/target/unix/platform.h
+++ b/target/unix/platform.h
@@ -1,5 +1,3 @@
-#include <bsd/string.h>
-
#include <fcntl.h>
#include <math.h>
#include <setjmp.h>
@@ -8,5 +6,6 @@
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <time.h>
#include <unistd.h>