X-Git-Url: https://git.distorted.org.uk/~mdw/catacomb/blobdiff_plain/24e2740222dcebd76c8c5340298d4dbf7660c935..1519ef6617fd7351bd40026b9eeb47c7f7f42234:/progs/hashsum.c diff --git a/progs/hashsum.c b/progs/hashsum.c index df1fdaea..deb27d50 100644 --- a/progs/hashsum.c +++ b/progs/hashsum.c @@ -39,6 +39,7 @@ #include #include +#include #include #include #include @@ -97,7 +98,7 @@ static int checkhash(fhashstate *fh, const char *file, const encodeops *e) unsigned long n = 0, nfail = 0; int hf; - if (!file || strcmp(file, "-") == 0) + if (!file || STRCMP(file, ==, "-")) hfp.fp = stdin; else if ((hfp.fp = fopen(file, fh->f & GSF_RAW ? "r" : "rb")) == 0) { moan("couldn't open `%s': %s", file, strerror(errno)); @@ -124,8 +125,8 @@ static int checkhash(fhashstate *fh, const char *file, const encodeops *e) rc = EXIT_FAILURE; continue; } - if (memcmp(hfp.hbuf, hfp.hbuf + hfp.gch->hashsz, - hfp.gch->hashsz) != 0) { + if (MEMCMP(hfp.hbuf, !=, hfp.hbuf + hfp.gch->hashsz, + hfp.gch->hashsz)) { if (hfp.f & f_verbose) fprintf(stderr, "FAIL %s\n", df.buf); else @@ -190,7 +191,7 @@ static int hashfiles(fhashstate *fh, const char *file, const encodeops *e) int rc = 0; int rrc; - if (!file || strcmp(file, "-") == 0) + if (!file || STRCMP(file, ==, "-")) fp = stdin; else if ((fp = fopen(file, fh->f & GSF_RAW ? "r" : "rb")) == 0) { moan("couldn't open `%s': %s", file, strerror(errno)); @@ -278,7 +279,7 @@ int main(int argc, char *argv[]) { char *q = xstrdup(QUIS); size_t len = strlen(q); - if (len > 3 && strcmp(q + len - 3, "sum") == 0) { + if (len > 3 && STRCMP(q + len - 3, ==, "sum")) { q[len - 3] = 0; fh.gch = gethash(q); }