1
0

more cleaning

This commit is contained in:
dtb
2022-09-18 00:34:03 -04:00
parent fbdaf55d1c
commit 05c3fad56e
8 changed files with 0 additions and 0 deletions

27
streq/streq.c Normal file
View File

@@ -0,0 +1,27 @@
#include <sysexits.h>
#include <unistd.h>
#include "libio.h"
static char *program_name = "streq";
int main(int argc, char *argv[]){
int i;
int j;
if(argc < 3){
write(2, "Usage: ", 7);
if(argv[0] == NULL)
argv[0] = program_name;
fdprint(2, argv[0]);
write(2, " [strings...]\n", 14);
return EX_USAGE;
}
/* i is the arg index, j is the char index */
for(j = 0; argv[1][j] != '\0'; ++j)
for(i = 2; i < argc; ++i)
if(argv[i-1][j] != argv[i][j])
return 1;
return 0;
}