diff --git a/Makefile b/Makefile index c45e218..653fe72 100644 --- a/Makefile +++ b/Makefile @@ -95,8 +95,11 @@ simexec.o: libio sysexits 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 +streq.o: libio sysexits src/streq.c + $(CC) $(CFLAGS) -c -o build/streq.o src/streq.c + +streq: libio streq.o + $(CC) $(CFLAGS) -o bin/streq build/libio.o build/streq.o str.o: src/str.c $(CC) $(CFLAGS) -o build/str.o src/str.c diff --git a/src/streq.c b/src/streq.c index d230a85..248649f 100644 --- a/src/streq.c +++ b/src/streq.c @@ -1,16 +1,18 @@ #include #include -#include "noargvzero.h" +#include "libio.h" + +static char *program_name = "streq"; int main(int argc, char *argv[]){ int i; int j; - NOARGVZERO(argv); if(argc < 3){ write(2, "Usage: ", 7); - for(i = 0; argv[0][i] != '\0'; ++i); - write(2, argv[0], i); + if(argv[0] == NULL) + argv[0] = program_name; + fdprint(2, argv[0]); write(2, " [strings...]\n", 14); return EX_USAGE; }