1
0

more fixes

This commit is contained in:
dtb 2022-08-23 11:40:13 -04:00
parent 3e2cc98337
commit c838c0b304
2 changed files with 1 additions and 8 deletions

View File

@ -10,9 +10,7 @@ int main(int argc, char **argv){
int s; int s;
if(argc != 2){ if(argc != 2){
usage: write(2, "Usage: ", 7); usage: write(2, "Usage: ", 7);
if(argv[0] == NULL) fdprint(2, argv[0] == NULL ? program_name : argv[0]);
argv[0] = program_name;
fdprint(2, argv[0]);
write(2, " [seconds]\n", 11); write(2, " [seconds]\n", 11);
return EX_USAGE; return EX_USAGE;
} }

View File

@ -37,11 +37,6 @@ error: write(2, "Usage: ", 7);
return EX_USAGE; return EX_USAGE;
} }
/* We could skip checking the first two characters and replace it with
* a single if(argv[1][0] == 'i' && argv[1][1] == 's') or something
* but it's simpler to just waste the cycles. Plus this doesn't assume
* every ctype starts with "is". */
for(ctype = 0; ctype < ARRAYLEN(ctypes); ++ctype) for(ctype = 0; ctype < ARRAYLEN(ctypes); ++ctype)
if(strcmp(argv[1], ctypes[ctype].name) == 0) if(strcmp(argv[1], ctypes[ctype].name) == 0)
goto pass; goto pass;