From c838c0b3046437c3a2c1b4523320c3dd01ecfb95 Mon Sep 17 00:00:00 2001 From: dtb Date: Tue, 23 Aug 2022 11:40:13 -0400 Subject: [PATCH] more fixes --- src/sleep.c | 4 +--- src/str.c | 5 ----- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/src/sleep.c b/src/sleep.c index ab5921c..6c0cdf3 100644 --- a/src/sleep.c +++ b/src/sleep.c @@ -10,9 +10,7 @@ int main(int argc, char **argv){ int s; if(argc != 2){ usage: write(2, "Usage: ", 7); - if(argv[0] == NULL) - argv[0] = program_name; - fdprint(2, argv[0]); + fdprint(2, argv[0] == NULL ? program_name : argv[0]); write(2, " [seconds]\n", 11); return EX_USAGE; } diff --git a/src/str.c b/src/str.c index 3a9c1ed..5e063ad 100644 --- a/src/str.c +++ b/src/str.c @@ -37,11 +37,6 @@ error: write(2, "Usage: ", 7); 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) if(strcmp(argv[1], ctypes[ctype].name) == 0) goto pass;