Deploy the new <ctype.h> and `foocmp' macros from mLib.
[catacomb] / progs / dsig.c
index 1377bca..3f217da 100644 (file)
@@ -39,6 +39,7 @@
 
 #include <mLib/alloc.h>
 #include <mLib/base64.h>
+#include <mLib/macros.h>
 #include <mLib/mdwopt.h>
 #include <mLib/quis.h>
 #include <mLib/report.h>
@@ -204,7 +205,7 @@ static int bget(block *b, FILE *fp, unsigned bin)
     if (getstring(fp, &d, GSF_FILE))
       return (E_EOF);
     for (tag = 0; tagtab[tag]; tag++) {
-      if (strcmp(tagtab[tag], d.buf) == 0)
+      if (STRCMP(tagtab[tag], ==, d.buf))
        goto done;
     }
     return (E_TAG);
@@ -239,7 +240,7 @@ static int bget(block *b, FILE *fp, unsigned bin)
       } else {
        if (getstring(fp, &b->d, GSF_FILE))
          return (E_EOF);
-       if (strcmp(b->d.buf, "forever") == 0)
+       if (STRCMP(b->d.buf, ==, "forever"))
          b->t = KEXP_FOREVER;
        else if ((b->t = get_date(b->d.buf, 0)) == -1)
          return (E_DATE);
@@ -536,7 +537,7 @@ static int sign(int argc, char *argv[])
        ki = optarg;
        break;
       case 'e':
-       if (strcmp(optarg, "forever") == 0)
+       if (STRCMP(optarg, ==, "forever"))
          exp = KEXP_FOREVER;
        else if ((exp = get_date(optarg, 0)) == -1)
          die(EXIT_FAILURE, "bad expiry time");
@@ -572,14 +573,14 @@ static int sign(int argc, char *argv[])
   /* --- Open files --- */
 
   if (hfile) ifile = hfile;
-  if (!ifile || strcmp(ifile, "-") == 0)
+  if (!ifile || STRCMP(ifile, ==, "-"))
     ifp = stdin;
   else if ((ifp = fopen(ifile, (f & f_bin) ? "rb" : "r")) == 0) {
     die(EXIT_FAILURE, "couldn't open input file `%s': %s",
        ifile, strerror(errno));
   }
 
-  if (!ofile || strcmp(ofile, "-") == 0)
+  if (!ofile || STRCMP(ofile, ==, "-"))
     ofp = stdout;
   else if ((ofp = fopen(ofile, (f & f_bin) ? "wb" : "w")) == 0) {
     die(EXIT_FAILURE, "couldn't open output file `%s': %s",
@@ -908,7 +909,7 @@ static int verify(int argc, char *argv[])
          }
          f |= f_bogus;
        } else if (b.b.len != GH_CLASS(s->h)->hashsz ||
-                  memcmp(d.buf, b.b.buf, b.b.len) != 0) {
+                  MEMCMP(d.buf, !=, b.b.buf, b.b.len)) {
          if (verb > 1)
            printf("BAD file `%s' has incorrect hash\n", b.d.buf);
          f |= f_bogus;