X-Git-Url: https://git.distorted.org.uk/~mdw/catacomb/blobdiff_plain/352783dd9f520bf49986d403ea24861d0da85302..141c12847a1c2f8cc8db03d420551584e689fb87:/progs/mkphrase.c diff --git a/progs/mkphrase.c b/progs/mkphrase.c index b84d850b..db27ba26 100644 --- a/progs/mkphrase.c +++ b/progs/mkphrase.c @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -99,7 +100,7 @@ static void wordlist_scan(FILE *fp, void *p) for (;;) { int ch = getc(fp); - if (ch == EOF || isspace(ch)) { + if (ch == EOF || ISSPACE(ch)) { DPUTZ(&d); if (f && d.len >= min && d.len <= max) sym_find(&w->tab, d.buf, d.len + 1, sizeof(sym_base), 0); @@ -109,7 +110,7 @@ static void wordlist_scan(FILE *fp, void *p) break; continue; } - ch = tolower(ch); + ch = TOLOWER(ch); if (strchr(wchars, ch)) { DPUTC(&d, ch); f = 1; @@ -204,7 +205,7 @@ static void markov_scan(FILE *fp, void *p) const char *q; node *n = &(*model)[i][j][k]; - if (ch == EOF || isspace(ch)) { + if (ch == EOF || ISSPACE(ch)) { if (l != C_END) { l = C_END; n->count++; @@ -216,7 +217,7 @@ static void markov_scan(FILE *fp, void *p) continue; } - if ((q = strchr(wchars, tolower(ch))) == 0) + if ((q = strchr(wchars, TOLOWER(ch))) == 0) continue; l = q - wchars; n->count++; @@ -362,7 +363,7 @@ int main(int argc, char *argv[]) size_t n = strlen(optarg); ops = 0; for (p = ppgentab; *p; p++) { - if (strncmp(optarg, (*p)->name, n) == 0) { + if (STRNCMP(optarg, ==, (*p)->name, n)) { if (!(*p)->name[n]) { ops = *p; break; @@ -414,7 +415,7 @@ int main(int argc, char *argv[]) ctx = ops->init(); while (*argv) { - if (strcmp(*argv, "-") == 0) + if (STRCMP(*argv, ==, "-")) ops->scan(stdin, ctx); else { FILE *fp = fopen(*argv, "r");