summaryrefslogtreecommitdiff
path: root/comp/lucas-standen-NEA/code2/stdlib
diff options
context:
space:
mode:
authorthing 1 <thing1@seacrossedlovers.xyz>2024-11-14 08:11:18 +0000
committerthing 1 <thing1@seacrossedlovers.xyz>2024-11-14 08:11:18 +0000
commit2e1ccff01cf89539b621ac786898229307847f4b (patch)
tree88f91a94a58e6452288ed3145de51cb73c9f249b /comp/lucas-standen-NEA/code2/stdlib
parentbca6aeb86a3ca5d33cf1f33a81fcce2220d97a5a (diff)
made too many changes to note
Diffstat (limited to 'comp/lucas-standen-NEA/code2/stdlib')
-rw-r--r--comp/lucas-standen-NEA/code2/stdlib/Makefile28
-rw-r--r--comp/lucas-standen-NEA/code2/stdlib/String/String.c6
-rw-r--r--comp/lucas-standen-NEA/code2/stdlib/zpylib.c2
3 files changed, 21 insertions, 15 deletions
diff --git a/comp/lucas-standen-NEA/code2/stdlib/Makefile b/comp/lucas-standen-NEA/code2/stdlib/Makefile
index 9d4bfd6..c69992c 100644
--- a/comp/lucas-standen-NEA/code2/stdlib/Makefile
+++ b/comp/lucas-standen-NEA/code2/stdlib/Makefile
@@ -1,17 +1,23 @@
CC=cc
CFLAGS=-O3
-stdlib:
- cd String && make
- ${CC} zpylib.c -c -o zpylib.o ${CFLAGS}
+SRC = zpylib.c
+OBJ = ${SRC:.c=.o}
-clean:
- rm -rf *.o
- cd String && make clean
+all: zpy
-install:
- cp *.o /usr/local/share/zpylib/
- cp *.h /usr/local/share/zpylib/include/
- cp String/String.o /usr/local/share/zpylib
- cp String/String.h /usr/local/share/zpylib/include
+.c.o:
+ ${CC} -c ${CFLAGS} $<
+ cd String && make
+install: all
+ cp zpy /usr/local/bin/zpy
+ cd stdlib && make install
+ cd zpypkg && make install
+clean:
+ rm -rf zpy*.o
+ cd stdlib && make clean
+ cd examples && make clean
+uninstall:
+ rm /usr/local/bin/zpy
+.PHONY: all clean install uninstall
diff --git a/comp/lucas-standen-NEA/code2/stdlib/String/String.c b/comp/lucas-standen-NEA/code2/stdlib/String/String.c
index 6f11119..c273351 100644
--- a/comp/lucas-standen-NEA/code2/stdlib/String/String.c
+++ b/comp/lucas-standen-NEA/code2/stdlib/String/String.c
@@ -16,7 +16,7 @@ void __stringprint(string *self){
}
void __stringinput(string *self, size_t len){
- char *tmp = calloc(0, len);
+ char *tmp = calloc(1, len);
fgets(tmp, len, stdin);
self->fromcstring(self, tmp);
}
@@ -109,7 +109,7 @@ string **__stringsplit(string *self, char delim){
int j = 0;
for (int i = 0; i < splitcount; i++){
- char *str = calloc(0, self->_len);
+ char *str = calloc(1, self->_len);
int charcount = 0;
for (; self->_str[j] != delim && j < self->_len; j++){
str[charcount] = self->_str[j];
@@ -129,7 +129,7 @@ string *String(char *cstring){ // returns an allocated String from a C string in
size_t len = strlen(cstring);
string *str = malloc(sizeof(string));
- str->_str = calloc(0, len);
+ str->_str = calloc(1, len);
memcpy(str->_str, cstring, len);
str->_len = len;
diff --git a/comp/lucas-standen-NEA/code2/stdlib/zpylib.c b/comp/lucas-standen-NEA/code2/stdlib/zpylib.c
index 86f0dc3..7b512dd 100644
--- a/comp/lucas-standen-NEA/code2/stdlib/zpylib.c
+++ b/comp/lucas-standen-NEA/code2/stdlib/zpylib.c
@@ -21,7 +21,7 @@ void printfloat(double f){
}
char *readstr(){
- char *str = calloc(0, 256);
+ char *str = calloc(1, 256);
fgets(str, 256, stdin);
return str;
}