diff --git a/Makefile b/Makefile index 5024389..c45e218 100644 --- a/Makefile +++ b/Makefile @@ -89,8 +89,11 @@ roll: libio sysexits roll.o runlength: sysexits src/runlength.c usefulmacros $(CC) $(CFLAGS) -o bin/runlength src/runlength.c -simexec: sysexits src/simexec.c usefulmacros - $(CC) $(CFLAGS) -o bin/simexec src/simexec.c +simexec.o: libio sysexits src/simexec.c + $(CC) $(CFLAGS) -c -o build/simexec.o src/simexec.c + +simexec: libio simexec.o + $(CC) $(CFLAGS) -o bin/simexec build/libio.o build/simexec.o streq: sysexits src/streq.c usefulmacros $(CC) $(CFLAGS) -o bin/streq src/streq.c diff --git a/lib/libio.c b/lib/libio.c index 4bc9623..9b2291f 100644 --- a/lib/libio.c +++ b/lib/libio.c @@ -1,5 +1,6 @@ #include #include +#include "libio.h" static int _strlen(char *s){ @@ -50,6 +51,8 @@ put: while(s > 0){ if((s /= 10) == 0) r += write1(1, '\n'); } + + return r; } int diff --git a/lib/libio.h b/lib/libio.h index 0dedf40..6083e0a 100644 --- a/lib/libio.h +++ b/lib/libio.h @@ -3,5 +3,5 @@ int fdprint(int fd, char *s); int fdputd(int fd, int d); int fdputs(int fd, char *s); -int parse_uint(char *s); +unsigned int parse_uint(char *s); #endif /* ifndef _LIBIO_H */ diff --git a/src/simexec.c b/src/simexec.c index 14a35dd..fe98992 100644 --- a/src/simexec.c +++ b/src/simexec.c @@ -12,7 +12,7 @@ int main(int argc, char *argv[]){ if(argv[0] == NULL) argv[0] = program_name; fdprint(2, argv[0]); - write(2, " [pathname], [argv...]\n", 23); + write(2, " [pathname] [argv...]\n", 22); return EX_USAGE; }