X-Git-Url: https://git.distorted.org.uk/~mdw/catacomb/blobdiff_plain/0f00dc4c8eb47e67bc0f148c2dd109f73a451e0a..141c12847a1c2f8cc8db03d420551584e689fb87:/progs/factorial.c diff --git a/progs/factorial.c b/progs/factorial.c index a46debd1..ece0b305 100644 --- a/progs/factorial.c +++ b/progs/factorial.c @@ -34,6 +34,7 @@ #include #include +#include #include #include #include @@ -130,12 +131,12 @@ int main(int argc, char *argv[]) } ulmax = mp_fromulong(MP_NEW, ULONG_MAX); p = argv[optind]; - while (isspace((unsigned char)*p)) + while (ISSPACE(*p)) p++; xx = mp_readstring(MP_NEW, argv[optind], &p, 0); - while (isspace((unsigned char)*p)) + while (ISSPACE(*p)) p++; - if (!xx || *p || MP_CMP(xx, >, ulmax)) + if (!xx || *p || MP_CMP(xx, <, MP_ZERO) || MP_CMP(xx, >, ulmax)) die(EXIT_FAILURE, "bad integer `%s'", argv[optind]); x = mp_toulong(xx); mp_drop(xx);