Various <ctype.h> fixes.
[u/mdw/catacomb] / hashsum.c
index 051fdb1..db7d7f7 100644 (file)
--- a/hashsum.c
+++ b/hashsum.c
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: hashsum.c,v 1.3 2000/07/29 17:02:43 mdw Exp $
+ * $Id: hashsum.c,v 1.4 2000/08/04 23:23:44 mdw Exp $
  *
  * Hash files using some secure hash function
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: hashsum.c,v $
+ * Revision 1.4  2000/08/04 23:23:44  mdw
+ * Various <ctype.h> fixes.
+ *
  * Revision 1.3  2000/07/29 17:02:43  mdw
  * (checkhash): Be pettier about spaces between the hash and filename, for
  * compatiblity with `md5sum'.
@@ -225,7 +228,7 @@ static int getstring(FILE *fp, const char *p, dstr *d, unsigned raw)
 
   /* --- Raw: just read exactly what's written up to a null byte --- */
 
-#define NEXTCH (fp ? getc(fp) : *p++)
+#define NEXTCH (fp ? getc(fp) : (unsigned char)*p++)
 #define EOFCH (fp ? EOF : 0)
 
   if (raw) {
@@ -249,7 +252,7 @@ static int getstring(FILE *fp, const char *p, dstr *d, unsigned raw)
 
 again:
   ch = NEXTCH;
-  while (isspace((unsigned char)ch))
+  while (isspace(ch))
     ch = NEXTCH;
   if (ch == '#') {
     do ch = NEXTCH; while (ch != '\n' && ch != EOFCH);
@@ -298,7 +301,7 @@ again:
 
     if (ch == q)
       break;
-    if (!q && isspace((unsigned char)ch))
+    if (!q && isspace(ch))
       break;
 
     /* --- Otherwise contribute and continue --- */