streq(1)
This commit is contained in:
parent
6004d654ea
commit
f6633f05db
7
Makefile
7
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
|
||||
|
10
src/streq.c
10
src/streq.c
@ -1,16 +1,18 @@
|
||||
#include <sysexits.h>
|
||||
#include <unistd.h>
|
||||
#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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user