]> sjero.net Git - wget/commitdiff
ISSPACE -> c_isspace
authorMicah Cowan <micah@cowan.name>
Sun, 14 Oct 2007 21:46:24 +0000 (14:46 -0700)
committerMicah Cowan <micah@cowan.name>
Sun, 14 Oct 2007 21:46:24 +0000 (14:46 -0700)
21 files changed:
src/ChangeLog
src/cmpt.c
src/cookies.c
src/ftp-basic.c
src/ftp-ls.c
src/ftp.c
src/hash.c
src/host.c
src/html-parse.c
src/html-url.c
src/http-ntlm.c
src/http.c
src/init.c
src/log.c
src/main.c
src/netrc.c
src/openssl.c
src/res.c
src/url.c
src/utils.c
src/wget.h

index 8044e1e0366dbf52b34ccfc565293ad3b19bfe16..112d914cbce893fa973857fe85e143d126031449 100644 (file)
@@ -1,3 +1,10 @@
+2007-10-14  Micah Cowan  <micah@cowan.name>
+
+       * cmpt.c, cookies.c, ftp-basic.c, ftp-ls.c, ftp.c, hash.c,
+       host.c, html-parse.c, html-url.c, http-ntlm.c, http.c, init.c,
+       log.c, main.c, netrc.c, openssl.c, res.c, url.c, utils.c,
+       wget.h: Replace uses of ISSPACE, etc with c_isspace, etc.
+
 2007-10-13  Micah Cowan  <micah@cowan.name>
 
        * Makefile.am: Make version.c depend on Wget dependencies (source
index 1977e8ea45be7e9a612c26afba34fbcb19c8cc3d..291056a4c20863296002f9c0e4e456bbb2112e59 100644 (file)
@@ -73,8 +73,8 @@ strcasecmp (const char *s1, const char *s2)
 
   do
     {
-      c1 = TOLOWER (*p1++);
-      c2 = TOLOWER (*p2++);
+      c1 = c_tolower (*p1++);
+      c2 = c_tolower (*p2++);
       if (c1 == '\0')
         break;
     }
@@ -102,8 +102,8 @@ strncasecmp (const char *s1, const char *s2, size_t n)
 
   do
     {
-      c1 = TOLOWER (*p1++);
-      c2 = TOLOWER (*p2++);
+      c1 = c_tolower (*p1++);
+      c2 = c_tolower (*p2++);
       if (c1 == '\0' || c1 != c2)
         return c1 - c2;
     } while (--n > 0);
@@ -432,9 +432,9 @@ strptime_internal (rp, fmt, tm, decided)
     {
       /* A white space in the format string matches 0 more or white
          space in the input string.  */
-      if (ISSPACE (*fmt))
+      if (c_isspace (*fmt))
         {
-          while (ISSPACE (*rp))
+          while (c_isspace (*rp))
             ++rp;
           ++fmt;
           continue;
@@ -654,7 +654,7 @@ strptime_internal (rp, fmt, tm, decided)
         case 'n':
         case 't':
           /* Match any white space.  */
-          while (ISSPACE (*rp))
+          while (c_isspace (*rp))
             ++rp;
           break;
         case 'p':
@@ -1367,7 +1367,7 @@ strtoll (const char *nptr, char **endptr, int base)
           nptr += 2;
           /* "0x" must be followed by at least one hex char.  If not,
              return 0 and place ENDPTR on 'x'. */
-          if (!ISXDIGIT (*nptr))
+          if (!c_isxdigit (*nptr))
             {
               --nptr;
               goto out;
index d3b64a9f031db79defb948bd39b4ce176e45ea54..0f54f665e9073b70f71015f3a50bf2a93b27cced 100644 (file)
@@ -456,9 +456,9 @@ parse_set_cookie (const char *set_cookie, bool silent)
 
 
 #define REQUIRE_DIGITS(p) do {                  \
-  if (!ISDIGIT (*p))                            \
+  if (!c_isdigit (*p))                            \
     return false;                               \
-  for (++p; ISDIGIT (*p); p++)                  \
+  for (++p; c_isdigit (*p); p++)                  \
     ;                                           \
 } while (0)
 
@@ -1102,7 +1102,7 @@ domain_port (const char *domain_b, const char *domain_e,
   const char *colon = memchr (domain_b, ':', domain_e - domain_b);
   if (!colon)
     return 0;
-  for (p = colon + 1; p < domain_e && ISDIGIT (*p); p++)
+  for (p = colon + 1; p < domain_e && c_isdigit (*p); p++)
     port = 10 * port + (*p - '0');
   if (p < domain_e)
     /* Garbage following port number. */
@@ -1153,7 +1153,7 @@ cookie_jar_load (struct cookie_jar *jar, const char *file)
       char *value_b   = NULL, *value_e   = NULL;
 
       /* Skip leading white-space. */
-      while (*p && ISSPACE (*p))
+      while (*p && c_isspace (*p))
         ++p;
       /* Ignore empty lines.  */
       if (!*p || *p == '#')
index 9df26849e5d3d010967a240deae0efe084735916..4920f72523052679d049103bf4d04e8f2f55654f 100644 (file)
@@ -82,7 +82,7 @@ ftp_response (int fd, char **ret_line)
         DEBUGP (("%s\n", escnonprint (line)));
 
       /* The last line of output is the one that begins with "ddd ". */
-      if (ISDIGIT (line[0]) && ISDIGIT (line[1]) && ISDIGIT (line[2])
+      if (c_isdigit (line[0]) && c_isdigit (line[1]) && c_isdigit (line[2])
           && line[3] == ' ')
         {
           strncpy (ftp_last_respline, line, sizeof (ftp_last_respline));
@@ -205,7 +205,7 @@ ftp_login (int csock, const char *acc, const char *pass)
         int skey_sequence = 0;
 
         /* Extract the sequence from SEED.  */
-        for (; ISDIGIT (*seed); seed++)
+        for (; c_isdigit (*seed); seed++)
           skey_sequence = 10 * skey_sequence + *seed - '0';
         if (*seed == ' ')
           ++seed;
@@ -521,14 +521,14 @@ ftp_pasv (int csock, ip_address *addr, int *port)
     }
   /* Parse the request.  */
   s = respline;
-  for (s += 4; *s && !ISDIGIT (*s); s++)
+  for (s += 4; *s && !c_isdigit (*s); s++)
     ;
   if (!*s)
     return FTPINVPASV;
   for (i = 0; i < 6; i++)
     {
       tmp[i] = 0;
-      for (; ISDIGIT (*s); s++)
+      for (; c_isdigit (*s); s++)
         tmp[i] = (*s - '0') + 10 * tmp[i];
       if (*s == ',')
         s++;
@@ -590,14 +590,14 @@ ftp_lpsv (int csock, ip_address *addr, int *port)
 
   /* Parse the response.  */
   s = respline;
-  for (s += 4; *s && !ISDIGIT (*s); s++)
+  for (s += 4; *s && !c_isdigit (*s); s++)
     ;
   if (!*s)
     return FTPINVPASV;
 
   /* First, get the address family */
   af = 0;
-  for (; ISDIGIT (*s); s++)
+  for (; c_isdigit (*s); s++)
     af = (*s - '0') + 10 * af;
 
   if (af != 4 && af != 6)
@@ -614,7 +614,7 @@ ftp_lpsv (int csock, ip_address *addr, int *port)
 
   /* Then, get the address length */
   addrlen = 0;
-  for (; ISDIGIT (*s); s++)
+  for (; c_isdigit (*s); s++)
     addrlen = (*s - '0') + 10 * addrlen;
 
   if (!*s || *s++ != ',')
@@ -640,7 +640,7 @@ ftp_lpsv (int csock, ip_address *addr, int *port)
   for (i = 0; i < addrlen; i++)
     {
       tmp[i] = 0;
-      for (; ISDIGIT (*s); s++)
+      for (; c_isdigit (*s); s++)
         tmp[i] = (*s - '0') + 10 * tmp[i];
       if (*s == ',')
         s++;
@@ -653,7 +653,7 @@ ftp_lpsv (int csock, ip_address *addr, int *port)
 
   /* Now, get the port length */
   portlen = 0;
-  for (; ISDIGIT (*s); s++)
+  for (; c_isdigit (*s); s++)
     portlen = (*s - '0') + 10 * portlen;
 
   if (!*s || *s++ != ',')
@@ -670,7 +670,7 @@ ftp_lpsv (int csock, ip_address *addr, int *port)
 
   /* Finally, we get the port number */
   tmpprt[0] = 0;
-  for (; ISDIGIT (*s); s++)
+  for (; c_isdigit (*s); s++)
     tmpprt[0] = (*s - '0') + 10 * tmpprt[0];
 
   if (!*s || *s++ != ',')
@@ -680,7 +680,7 @@ ftp_lpsv (int csock, ip_address *addr, int *port)
     }
 
   tmpprt[1] = 0;
-  for (; ISDIGIT (*s); s++)
+  for (; c_isdigit (*s); s++)
     tmpprt[1] = (*s - '0') + 10 * tmpprt[1];
 
   assert (s != NULL);
@@ -786,7 +786,7 @@ ftp_epsv (int csock, ip_address *ip, int *port)
 
   /* Finally, get the port number */
   tport = 0; 
-  for (i = 1; ISDIGIT (*s); s++) 
+  for (i = 1; c_isdigit (*s); s++) 
     {
       if (i > 5)
         {
@@ -1171,7 +1171,7 @@ ftp_process_type (const char *params)
   if (params
       && 0 == strncasecmp (params, "type=", 5)
       && params[5] != '\0')
-    return TOUPPER (params[5]);
+    return c_toupper (params[5]);
   else
     return 'I';
 }
index 97d725f635a9921dcfc9e6615595d97ef3318c0b..b056572ed6400ed334d4d32c5dd52adcb71fa5d8 100644 (file)
@@ -252,10 +252,10 @@ ftp_parse_unix_ls (const char *file, int ignore_perms)
               year = 0;
               min = hour = sec = 0;
               /* We must deal with digits.  */
-              if (ISDIGIT (*tok))
+              if (c_isdigit (*tok))
                 {
                   /* Suppose it's year.  */
-                  for (; ISDIGIT (*tok); tok++)
+                  for (; c_isdigit (*tok); tok++)
                     year = (*tok - '0') + 10 * year;
                   if (*tok == ':')
                     {
@@ -264,13 +264,13 @@ ftp_parse_unix_ls (const char *file, int ignore_perms)
                       year = 0;
                       ++tok;
                       /* Get the minutes...  */
-                      for (; ISDIGIT (*tok); tok++)
+                      for (; c_isdigit (*tok); tok++)
                         min = (*tok - '0') + 10 * min;
                       if (*tok == ':')
                         {
                           /* ...and the seconds.  */
                           ++tok;
-                          for (; ISDIGIT (*tok); tok++)
+                          for (; c_isdigit (*tok); tok++)
                             sec = (*tok - '0') + 10 * sec;
                         }
                     }
index e0d0777336453b53977843049daddb3739b5d0f7..302714afda99cd78bd0187ca7b8b8051d66f669c 100644 (file)
--- a/src/ftp.c
+++ b/src/ftp.c
@@ -88,11 +88,11 @@ ftp_expected_bytes (const char *s)
       res = str_to_wgint (s, (char **) &s, 10);
       if (!*s)
         return 0;
-      while (*s && ISSPACE (*s))
+      while (*s && c_isspace (*s))
         ++s;
       if (!*s)
         return 0;
-      if (TOLOWER (*s) != 'b')
+      if (c_tolower (*s) != 'b')
         continue;
       if (strncasecmp (s, "byte", 4))
         continue;
@@ -496,7 +496,7 @@ Error in server response, closing control connection.\n"));
 
           if (target[0] != '/'
               && !(con->rs != ST_UNIX
-                   && ISALPHA (target[0])
+                   && c_isalpha (target[0])
                    && target[1] == ':')
               && con->rs != ST_OS400)
             {
index 5d156da8ae8a2d94ea302a8c9c3961a589576feb..cb65c7f7661b4bcd6e770e1ff300e6111e8459a2 100644 (file)
@@ -54,7 +54,7 @@ so, delete this exception statement from your version.  */
 #  define countof(x) (sizeof (x) / sizeof ((x)[0]))
 # endif
 # include <ctype.h>
-# define TOLOWER(x) tolower ((unsigned char) (x))
+# define c_tolower(x) tolower ((unsigned char) (x))
 # if __STDC_VERSION__ >= 199901L
 #  include <stdint.h>  /* for uintptr_t */
 # else
@@ -680,11 +680,11 @@ static unsigned long
 hash_string_nocase (const void *key)
 {
   const char *p = key;
-  unsigned int h = TOLOWER (*p);
+  unsigned int h = c_tolower (*p);
   
   if (h)
     for (p += 1; *p != '\0'; p++)
-      h = (h << 5) - h + TOLOWER (*p);
+      h = (h << 5) - h + c_tolower (*p);
   
   return h;
 }
index fee5e40499f5a4ad13fbc66a1530d641c63fd4c6..f6b0f1636ee8e13654064a97f5625fae1b36c81e 100644 (file)
@@ -495,7 +495,7 @@ is_valid_ipv6_address (const char *str, const char *end)
       int ch = *str++;
 
       /* if ch is a number, add it to val. */
-      if (ISXDIGIT (ch))
+      if (c_isxdigit (ch))
         {
           val <<= 4;
           val |= XDIGIT_TO_NUM (ch);
@@ -848,7 +848,7 @@ sufmatch (const char **list, const char *what)
   for (i = 0; list[i]; i++)
     {
       for (j = strlen (list[i]), k = lw; j >= 0 && k >= 0; j--, k--)
-        if (TOLOWER (list[i][j]) != TOLOWER (what[k]))
+        if (c_tolower (list[i][j]) != c_tolower (what[k]))
           break;
       /* The domain must be first to reach to beginning.  */
       if (j == -1)
index 243ead236524d1465fcae4a79226190ea58b88a4..a72688e3fa4aeacb58c2de87ea02e5a84e674cef 100644 (file)
@@ -110,21 +110,21 @@ so, delete this exception statement from your version.  */
 # define xrealloc realloc
 # define xfree free
 
-# undef ISSPACE
-# undef ISDIGIT
-# undef ISXDIGIT
-# undef ISALPHA
-# undef ISALNUM
-# undef TOLOWER
-# undef TOUPPER
-
-# define ISSPACE(x) isspace (x)
-# define ISDIGIT(x) isdigit (x)
-# define ISXDIGIT(x) isxdigit (x)
-# define ISALPHA(x) isalpha (x)
-# define ISALNUM(x) isalnum (x)
-# define TOLOWER(x) tolower (x)
-# define TOUPPER(x) toupper (x)
+# undef c_isspace
+# undef c_isdigit
+# undef c_isxdigit
+# undef c_isalpha
+# undef c_isalnum
+# undef c_tolower
+# undef c_toupper
+
+# define c_isspace(x) isspace (x)
+# define c_isdigit(x) isdigit (x)
+# define c_isxdigit(x) isxdigit (x)
+# define c_isalpha(x) isalpha (x)
+# define c_isalnum(x) isalnum (x)
+# define c_tolower(x) tolower (x)
+# define c_toupper(x) toupper (x)
 
 struct hash_table {
   int dummy;
@@ -258,7 +258,7 @@ struct pool {
    However, "&lt;foo" will work, as will "&lt!foo", "&lt", etc.  In
    other words an entity needs to be terminated by either a
    non-alphanumeric or the end of string.  */
-#define FITS(p, n) (p + n == end || (p + n < end && !ISALNUM (p[n])))
+#define FITS(p, n) (p + n == end || (p + n < end && !c_isalnum (p[n])))
 
 /* Macros that test entity names by returning true if P is followed by
    the specified characters.  */
@@ -296,10 +296,10 @@ decode_entity (const char **ptr, const char *end)
         int digits = 0;
         value = 0;
         if (*p == 'x')
-          for (++p; value < 256 && p < end && ISXDIGIT (*p); p++, digits++)
+          for (++p; value < 256 && p < end && c_isxdigit (*p); p++, digits++)
             value = (value << 4) + XDIGIT_TO_NUM (*p);
         else
-          for (; value < 256 && p < end && ISDIGIT (*p); p++, digits++)
+          for (; value < 256 && p < end && c_isdigit (*p); p++, digits++)
             value = (value * 10) + (*p - '0');
         if (!digits)
           return -1;
@@ -368,9 +368,9 @@ convert_and_copy (struct pool *pool, const char *beg, const char *end, int flags
      `&#32;'.  */
   if (flags & AP_TRIM_BLANKS)
     {
-      while (beg < end && ISSPACE (*beg))
+      while (beg < end && c_isspace (*beg))
         ++beg;
-      while (end > beg && ISSPACE (end[-1]))
+      while (end > beg && c_isspace (end[-1]))
         --end;
     }
 
@@ -425,7 +425,7 @@ convert_and_copy (struct pool *pool, const char *beg, const char *end, int flags
     {
       char *p = pool->contents + old_tail;
       for (; *p; p++)
-        *p = TOLOWER (*p);
+        *p = c_tolower (*p);
     }
 }
 \f
@@ -705,7 +705,7 @@ name_allowed (const struct hash_table *ht, const char *b, const char *e)
 /* Skip whitespace, if any. */
 
 #define SKIP_WS(p) do {                         \
-  while (ISSPACE (*p)) {                        \
+  while (c_isspace (*p)) {                        \
     ADVANCE (p);                                \
   }                                             \
 } while (0)
@@ -713,7 +713,7 @@ name_allowed (const struct hash_table *ht, const char *b, const char *e)
 /* Skip non-whitespace, if any. */
 
 #define SKIP_NON_WS(p) do {                     \
-  while (!ISSPACE (*p)) {                       \
+  while (!c_isspace (*p)) {                       \
     ADVANCE (p);                                \
   }                                             \
 } while (0)
@@ -936,7 +936,7 @@ map_html_tags (const char *text, int size,
                    violated by, for instance, `%' in `width=75%'.
                    We'll be liberal and allow just about anything as
                    an attribute value.  */
-                while (!ISSPACE (*p) && *p != '>')
+                while (!c_isspace (*p) && *p != '>')
                   ADVANCE (p);
                 attr_value_end = p; /* <foo bar=baz qux=quix> */
                                     /*             ^          */
index 97443ea0e20cc9ac7f86bf9007ab173da8cb57c2..6a96f6c20ec0a66a825dfbcfcb1118692c6f8efe 100644 (file)
@@ -509,20 +509,20 @@ tag_handle_meta (int tagid, struct taginfo *tag, struct map_context *ctx)
       if (!refresh)
         return;
 
-      for (p = refresh; ISDIGIT (*p); p++)
+      for (p = refresh; c_isdigit (*p); p++)
         timeout = 10 * timeout + *p - '0';
       if (*p++ != ';')
         return;
 
-      while (ISSPACE (*p))
+      while (c_isspace (*p))
         ++p;
-      if (!(   TOUPPER (*p)       == 'U'
-            && TOUPPER (*(p + 1)) == 'R'
-            && TOUPPER (*(p + 2)) == 'L'
+      if (!(   c_toupper (*p)       == 'U'
+            && c_toupper (*(p + 1)) == 'R'
+            && c_toupper (*(p + 2)) == 'L'
             &&          *(p + 3)  == '='))
         return;
       p += 4;
-      while (ISSPACE (*p))
+      while (c_isspace (*p))
         ++p;
 
       entry = append_url (p, tag, attrind, ctx);
@@ -668,9 +668,9 @@ get_urls_file (const char *file)
       text = line_end;
 
       /* Strip whitespace from the beginning and end of line. */
-      while (line_beg < line_end && ISSPACE (*line_beg))
+      while (line_beg < line_end && c_isspace (*line_beg))
         ++line_beg;
-      while (line_end > line_beg && ISSPACE (*(line_end - 1)))
+      while (line_end > line_beg && c_isspace (*(line_end - 1)))
         --line_end;
 
       if (line_beg == line_end)
index 32bb3c59355b2180b13144e7ecb4b652926b650d..5ca8e85c11317ea39515a6945570c8b860daac34 100644 (file)
@@ -121,7 +121,7 @@ ntlm_input (struct ntlmdata *ntlm, const char *header)
     return false;
 
   header += 4;
-  while (*header && ISSPACE(*header))
+  while (*header && c_isspace(*header))
     header++;
 
   if (*header)
@@ -247,7 +247,7 @@ mkhash(const char *password,
     len = 14;
   
   for (i=0; i<len; i++)
-    pw[i] = TOUPPER (password[i]);
+    pw[i] = c_toupper (password[i]);
 
   for (; i<14; i++)
     pw[i] = 0;
index 67e9a989eae93fddfae02cdb73db16fb06656c74..e6f48aa2b2b8c1832d902461ae3069f567d0dd66 100644 (file)
@@ -279,7 +279,7 @@ request_set_user_header (struct request *req, const char *header)
     return;
   BOUNDED_TO_ALLOCA (header, p, name);
   ++p;
-  while (ISSPACE (*p))
+  while (c_isspace (*p))
     ++p;
   request_set_header (req, xstrdup (name), (char *) p, rel_name);
 }
@@ -653,9 +653,9 @@ resp_header_locate (const struct response *resp, const char *name, int start,
           && 0 == strncasecmp (b, name, name_len))
         {
           b += name_len + 1;
-          while (b < e && ISSPACE (*b))
+          while (b < e && c_isspace (*b))
             ++b;
-          while (b < e && ISSPACE (e[-1]))
+          while (b < e && c_isspace (e[-1]))
             --e;
           *begptr = b;
           *endptr = e;
@@ -754,17 +754,17 @@ resp_status (const struct response *resp, char **message)
   if (p < end && *p == '/')
     {
       ++p;
-      while (p < end && ISDIGIT (*p))
+      while (p < end && c_isdigit (*p))
         ++p;
       if (p < end && *p == '.')
         ++p; 
-      while (p < end && ISDIGIT (*p))
+      while (p < end && c_isdigit (*p))
         ++p;
     }
 
-  while (p < end && ISSPACE (*p))
+  while (p < end && c_isspace (*p))
     ++p;
-  if (end - p < 3 || !ISDIGIT (p[0]) || !ISDIGIT (p[1]) || !ISDIGIT (p[2]))
+  if (end - p < 3 || !c_isdigit (p[0]) || !c_isdigit (p[1]) || !c_isdigit (p[2]))
     return -1;
 
   status = 100 * (p[0] - '0') + 10 * (p[1] - '0') + (p[2] - '0');
@@ -772,9 +772,9 @@ resp_status (const struct response *resp, char **message)
 
   if (message)
     {
-      while (p < end && ISSPACE (*p))
+      while (p < end && c_isspace (*p))
         ++p;
-      while (p < end && ISSPACE (end[-1]))
+      while (p < end && c_isspace (end[-1]))
         --end;
       *message = strdupdelim (p, end);
     }
@@ -845,26 +845,26 @@ parse_content_range (const char *hdr, wgint *first_byte_ptr,
          HTTP spec. */
       if (*hdr == ':')
         ++hdr;
-      while (ISSPACE (*hdr))
+      while (c_isspace (*hdr))
         ++hdr;
       if (!*hdr)
         return false;
     }
-  if (!ISDIGIT (*hdr))
+  if (!c_isdigit (*hdr))
     return false;
-  for (num = 0; ISDIGIT (*hdr); hdr++)
+  for (num = 0; c_isdigit (*hdr); hdr++)
     num = 10 * num + (*hdr - '0');
-  if (*hdr != '-' || !ISDIGIT (*(hdr + 1)))
+  if (*hdr != '-' || !c_isdigit (*(hdr + 1)))
     return false;
   *first_byte_ptr = num;
   ++hdr;
-  for (num = 0; ISDIGIT (*hdr); hdr++)
+  for (num = 0; c_isdigit (*hdr); hdr++)
     num = 10 * num + (*hdr - '0');
-  if (*hdr != '/' || !ISDIGIT (*(hdr + 1)))
+  if (*hdr != '/' || !c_isdigit (*(hdr + 1)))
     return false;
   *last_byte_ptr = num;
   ++hdr;
-  for (num = 0; ISDIGIT (*hdr); hdr++)
+  for (num = 0; c_isdigit (*hdr); hdr++)
     num = 10 * num + (*hdr - '0');
   *entity_length_ptr = num;
   return true;
@@ -939,7 +939,7 @@ extract_param (const char **source, param_token *name, param_token *value,
 {
   const char *p = *source;
 
-  while (ISSPACE (*p)) ++p;
+  while (c_isspace (*p)) ++p;
   if (!*p)
     {
       *source = p;
@@ -948,11 +948,11 @@ extract_param (const char **source, param_token *name, param_token *value,
 
   /* Extract name. */
   name->b = p;
-  while (*p && !ISSPACE (*p) && *p != '=' && *p != separator) ++p;
+  while (*p && !c_isspace (*p) && *p != '=' && *p != separator) ++p;
   name->e = p;
   if (name->b == name->e)
     return false;               /* empty name: error */
-  while (ISSPACE (*p)) ++p;
+  while (c_isspace (*p)) ++p;
   if (*p == separator || !*p)           /* no value */
     {
       xzero (*value);
@@ -965,7 +965,7 @@ extract_param (const char **source, param_token *name, param_token *value,
 
   /* *p is '=', extract value */
   ++p;
-  while (ISSPACE (*p)) ++p;
+  while (c_isspace (*p)) ++p;
   if (*p == '"')                /* quoted */
     {
       value->b = ++p;
@@ -974,7 +974,7 @@ extract_param (const char **source, param_token *name, param_token *value,
         return false;
       value->e = p++;
       /* Currently at closing quote; find the end of param. */
-      while (ISSPACE (*p)) ++p;
+      while (c_isspace (*p)) ++p;
       while (*p && *p != separator) ++p;
       if (*p == separator)
         ++p;
@@ -987,7 +987,7 @@ extract_param (const char **source, param_token *name, param_token *value,
       value->b = p;
       while (*p && *p != separator) ++p;
       value->e = p;
-      while (value->e != value->b && ISSPACE (value->e[-1]))
+      while (value->e != value->b && c_isspace (value->e[-1]))
         --value->e;
       if (*p == separator) ++p;
     }
@@ -1315,7 +1315,7 @@ free_hstat (struct http_stat *hs)
 
 #define BEGINS_WITH(line, string_constant)                               \
   (!strncasecmp (line, string_constant, sizeof (string_constant) - 1)    \
-   && (ISSPACE (line[sizeof (string_constant) - 1])                      \
+   && (c_isspace (line[sizeof (string_constant) - 1])                      \
        || !line[sizeof (string_constant) - 1]))
 
 #define SET_USER_AGENT(req) do {                                         \
@@ -2021,7 +2021,7 @@ File `%s' already there; not retrieving.\n\n"), hs->local_file);
       char *tmp = strchr (type, ';');
       if (tmp)
         {
-          while (tmp > type && ISSPACE (tmp[-1]))
+          while (tmp > type && c_isspace (tmp[-1]))
             --tmp;
           *tmp = '\0';
         }
@@ -2796,11 +2796,11 @@ check_end (const char *p)
 {
   if (!p)
     return false;
-  while (ISSPACE (*p))
+  while (c_isspace (*p))
     ++p;
   if (!*p
       || (p[0] == 'G' && p[1] == 'M' && p[2] == 'T')
-      || ((p[0] == '+' || p[0] == '-') && ISDIGIT (p[1])))
+      || ((p[0] == '+' || p[0] == '-') && c_isdigit (p[1])))
     return true;
   else
     return false;
@@ -2916,7 +2916,7 @@ basic_authentication_encode (const char *user, const char *passwd)
 }
 
 #define SKIP_WS(x) do {                         \
-  while (ISSPACE (*(x)))                        \
+  while (c_isspace (*(x)))                        \
     ++(x);                                      \
 } while (0)
 
@@ -3048,7 +3048,7 @@ username=\"%s\", realm=\"%s\", nonce=\"%s\", uri=\"%s\", response=\"%s\"",
   ((e) - (b) >= STRSIZE (literal)                       \
    && 0 == strncasecmp (b, literal, STRSIZE (literal))  \
    && ((e) - (b) == STRSIZE (literal)                   \
-       || ISSPACE (b[STRSIZE (literal)])))
+       || c_isspace (b[STRSIZE (literal)])))
 
 static bool
 known_authentication_scheme_p (const char *hdrbeg, const char *hdrend)
@@ -3077,7 +3077,7 @@ create_authorization_line (const char *au, const char *user,
 {
   /* We are called only with known schemes, so we can dispatch on the
      first letter. */
-  switch (TOUPPER (*au))
+  switch (c_toupper (*au))
     {
     case 'B':                   /* Basic */
       *finished = true;
index 20ca99be41ddd010683f5b85522ee58d0361dfa3..8000d73cc50919abd7617f021bc49e1d276ef971 100644 (file)
@@ -576,9 +576,9 @@ parse_line (const char *line, char **com, char **val, int *comind)
   int ind;
 
   /* Skip leading and trailing whitespace.  */
-  while (*line && ISSPACE (*line))
+  while (*line && c_isspace (*line))
     ++line;
-  while (end > line && ISSPACE (end[-1]))
+  while (end > line && c_isspace (end[-1]))
     --end;
 
   /* Skip empty lines and comments.  */
@@ -588,17 +588,17 @@ parse_line (const char *line, char **com, char **val, int *comind)
   p = line;
 
   cmdstart = p;
-  while (p < end && (ISALNUM (*p) || *p == '_' || *p == '-'))
+  while (p < end && (c_isalnum (*p) || *p == '_' || *p == '-'))
     ++p;
   cmdend = p;
 
   /* Skip '=', as well as any space before or after it. */
-  while (p < end && ISSPACE (*p))
+  while (p < end && c_isspace (*p))
     ++p;
   if (p == end || *p != '=')
     return line_syntax_error;
   ++p;
-  while (p < end && ISSPACE (*p))
+  while (p < end && c_isspace (*p))
     ++p;
 
   valstart = p;
@@ -691,15 +691,15 @@ static bool decode_string (const char *, const struct decode_item *, int, int *)
 static bool simple_atoi (const char *, const char *, int *);
 static bool simple_atof (const char *, const char *, double *);
 
-#define CMP1(p, c0) (TOLOWER((p)[0]) == (c0) && (p)[1] == '\0')
+#define CMP1(p, c0) (c_tolower((p)[0]) == (c0) && (p)[1] == '\0')
 
-#define CMP2(p, c0, c1) (TOLOWER((p)[0]) == (c0)        \
-                         && TOLOWER((p)[1]) == (c1)     \
+#define CMP2(p, c0, c1) (c_tolower((p)[0]) == (c0)        \
+                         && c_tolower((p)[1]) == (c1)     \
                          && (p)[2] == '\0')
 
-#define CMP3(p, c0, c1, c2) (TOLOWER((p)[0]) == (c0)    \
-                     && TOLOWER((p)[1]) == (c1)         \
-                     && TOLOWER((p)[2]) == (c2)         \
+#define CMP3(p, c0, c1, c2) (c_tolower((p)[0]) == (c0)    \
+                     && c_tolower((p)[1]) == (c1)         \
+                     && c_tolower((p)[2]) == (c2)         \
                      && (p)[3] == '\0')
 
 
@@ -907,12 +907,12 @@ parse_bytes_helper (const char *val, double *result)
     }
 
   /* Strip trailing whitespace.  */
-  while (val < end && ISSPACE (end[-1]))
+  while (val < end && c_isspace (end[-1]))
     --end;
   if (val == end)
     return false;
 
-  switch (TOLOWER (end[-1]))
+  switch (c_tolower (end[-1]))
     {
     case 'k':
       --end, mult = 1024.0;
@@ -933,9 +933,9 @@ parse_bytes_helper (const char *val, double *result)
     }
 
   /* Skip leading and trailing whitespace. */
-  while (val < end && ISSPACE (*val))
+  while (val < end && c_isspace (*val))
     ++val;
-  while (val < end && ISSPACE (end[-1]))
+  while (val < end && c_isspace (end[-1]))
     --end;
   if (val == end)
     return false;
@@ -1005,7 +1005,7 @@ cmd_time (const char *com, const char *val, void *place)
   const char *end = val + strlen (val);
 
   /* Strip trailing whitespace.  */
-  while (val < end && ISSPACE (end[-1]))
+  while (val < end && c_isspace (end[-1]))
     --end;
 
   if (val == end)
@@ -1016,7 +1016,7 @@ cmd_time (const char *com, const char *val, void *place)
       return false;
     }
 
-  switch (TOLOWER (end[-1]))
+  switch (c_tolower (end[-1]))
     {
     case 's':
       --end, mult = 1;          /* seconds */
@@ -1040,9 +1040,9 @@ cmd_time (const char *com, const char *val, void *place)
     }
 
   /* Skip leading and trailing whitespace. */
-  while (val < end && ISSPACE (*val))
+  while (val < end && c_isspace (*val))
     ++val;
-  while (val < end && ISSPACE (end[-1]))
+  while (val < end && c_isspace (end[-1]))
     --end;
   if (val == end)
     goto err;
@@ -1321,7 +1321,7 @@ simple_atoi (const char *beg, const char *end, int *dest)
   bool negative = false;
   const char *p = beg;
 
-  while (p < end && ISSPACE (*p))
+  while (p < end && c_isspace (*p))
     ++p;
   if (p < end && (*p == '-' || *p == '+'))
     {
@@ -1335,7 +1335,7 @@ simple_atoi (const char *beg, const char *end, int *dest)
      negative integer cannot be represented as a positive number.  */
 
   if (!negative)
-    for (; p < end && ISDIGIT (*p); p++)
+    for (; p < end && c_isdigit (*p); p++)
       {
         int next = (10 * result) + (*p - '0');
         if (next < result)
@@ -1343,7 +1343,7 @@ simple_atoi (const char *beg, const char *end, int *dest)
         result = next;
       }
   else
-    for (; p < end && ISDIGIT (*p); p++)
+    for (; p < end && c_isdigit (*p); p++)
       {
         int next = (10 * result) - (*p - '0');
         if (next > result)
@@ -1375,7 +1375,7 @@ simple_atof (const char *beg, const char *end, double *dest)
 
   const char *p = beg;
 
-  while (p < end && ISSPACE (*p))
+  while (p < end && c_isspace (*p))
     ++p;
   if (p < end && (*p == '-' || *p == '+'))
     {
@@ -1386,7 +1386,7 @@ simple_atof (const char *beg, const char *end, double *dest)
   for (; p < end; p++)
     {
       char ch = *p;
-      if (ISDIGIT (ch))
+      if (c_isdigit (ch))
         {
           if (!seen_dot)
             result = (10 * result) + (ch - '0');
@@ -1422,7 +1422,7 @@ check_user_specified_header (const char *s)
 {
   const char *p;
 
-  for (p = s; *p && *p != ':' && !ISSPACE (*p); p++)
+  for (p = s; *p && *p != ':' && !c_isspace (*p); p++)
     ;
   /* The header MUST contain `:' preceded by at least one
      non-whitespace character.  */
index e3c4d452a05094fb0e93784c0901d2f5e620657d..5cce3513da0af0cc061051d5598f530382d56291 100644 (file)
--- a/src/log.c
+++ b/src/log.c
@@ -604,7 +604,7 @@ count_nonprint (const char *source)
   const char *p;
   int cnt;
   for (p = source, cnt = 0; *p; p++)
-    if (!ISPRINT (*p))
+    if (!c_isprint (*p))
       ++cnt;
   return cnt;
 }
@@ -644,7 +644,7 @@ copy_and_escape (const char *source, char *dest, char escape, int base)
     {
     case 8:
       while ((c = *from++) != '\0')
-        if (ISPRINT (c))
+        if (c_isprint (c))
           *to++ = c;
         else
           {
@@ -656,7 +656,7 @@ copy_and_escape (const char *source, char *dest, char escape, int base)
       break;
     case 16:
       while ((c = *from++) != '\0')
-        if (ISPRINT (c))
+        if (c_isprint (c))
           *to++ = c;
         else
           {
index 43889c5f1098e410dd62eb2157e00aed248a7372..fb07c1a44f6a23ea3f7f798cb2dd4774d25f2898 100644 (file)
@@ -811,9 +811,9 @@ main (int argc, char *const *argv)
                before passing the value to setoptval.  */
             bool flag = true;
             if (optarg)
-              flag = (*optarg == '1' || TOLOWER (*optarg) == 'y'
-                      || (TOLOWER (optarg[0]) == 'o'
-                          && TOLOWER (optarg[1]) == 'n'));
+              flag = (*optarg == '1' || c_tolower (*optarg) == 'y'
+                      || (c_tolower (optarg[0]) == 'o'
+                          && c_tolower (optarg[1]) == 'n'));
             setoptval (opt->type == OPT__PARENT ? "noparent" : "noclobber",
                        flag ? "0" : "1", opt->long_name);
             break;
index 87c8c94b8b5f55cf799efc68341ba591f03df662..485e0757cf28130d1d33b3178493336c74c6cf78 100644 (file)
@@ -283,7 +283,7 @@ parse_netrc (const char *path)
       quote = 0;
 
       /* Skip leading whitespace.  */
-      while (*p && ISSPACE (*p))
+      while (*p && c_isspace (*p))
         p ++;
 
       /* If the line is empty, then end any macro definition.  */
@@ -295,7 +295,7 @@ parse_netrc (const char *path)
       while (*p && last_token != tok_macdef)
         {
           /* Skip any whitespace.  */
-          while (*p && ISSPACE (*p))
+          while (*p && c_isspace (*p))
             p ++;
 
           /* Discard end-of-line comments; also, stop processing if
@@ -313,7 +313,7 @@ parse_netrc (const char *path)
           tok = p;
 
           /* Find the end of the token, handling quotes and escapes.  */
-          while (*p && (quote ? *p != '"' : !ISSPACE (*p))){
+          while (*p && (quote ? *p != '"' : !c_isspace (*p))){
             if (*p == '\\')
               shift_left (p);
             p ++;
index 7427f34ddd4c49f3c7fdf066b5d2eee3779afa7e..aa44cbaac52a0b5b2b5a80c461b928e4498ce3bd 100644 (file)
@@ -439,13 +439,13 @@ pattern_match (const char *pattern, const char *string)
 {
   const char *p = pattern, *n = string;
   char c;
-  for (; (c = TOLOWER (*p++)) != '\0'; n++)
+  for (; (c = c_tolower (*p++)) != '\0'; n++)
     if (c == '*')
       {
-        for (c = TOLOWER (*p); c == '*'; c = TOLOWER (*++p))
+        for (c = c_tolower (*p); c == '*'; c = c_tolower (*++p))
           ;
         for (; *n != '\0'; n++)
-          if (TOLOWER (*n) == c && pattern_match (p, n))
+          if (c_tolower (*n) == c && pattern_match (p, n))
             return true;
 #ifdef ASTERISK_EXCLUDES_DOT
           else if (*n == '.')
@@ -455,7 +455,7 @@ pattern_match (const char *pattern, const char *string)
       }
     else
       {
-        if (c != TOLOWER (*n))
+        if (c != c_tolower (*n))
           return false;
       }
   return *n == '\0';
index 56041229987ecdac88f99f0a5bbe95d972788ead..0aea66f35f177734ed043f94df58869ddcba4135 100644 (file)
--- a/src/res.c
+++ b/src/res.c
@@ -180,7 +180,7 @@ prune_non_exact (struct robot_specs *specs)
 #define EOL(p) ((p) >= lineend)
 
 #define SKIP_SPACE(p) do {              \
-  while (!EOL (p) && ISSPACE (*p))      \
+  while (!EOL (p) && c_isspace (*p))      \
     ++p;                                \
 } while (0)
 
@@ -266,18 +266,18 @@ res_parse (const char *source, int length)
          lineend to a location preceding the first comment.  Real line
          ending remains in lineend_real.  */
       for (lineend = p; lineend < lineend_real; lineend++)
-        if ((lineend == p || ISSPACE (*(lineend - 1)))
+        if ((lineend == p || c_isspace (*(lineend - 1)))
             && *lineend == '#')
           break;
 
       /* Ignore trailing whitespace in the same way. */
-      while (lineend > p && ISSPACE (*(lineend - 1)))
+      while (lineend > p && c_isspace (*(lineend - 1)))
         --lineend;
 
       assert (!EOL (p));
 
       field_b = p;
-      while (!EOL (p) && (ISALNUM (*p) || *p == '-'))
+      while (!EOL (p) && (c_isalnum (*p) || *p == '-'))
         ++p;
       field_e = p;
 
@@ -415,7 +415,7 @@ free_specs (struct robot_specs *specs)
    advance the pointer.  */
 
 #define DECODE_MAYBE(c, ptr) do {                               \
-  if (c == '%' && ISXDIGIT (ptr[1]) && ISXDIGIT (ptr[2]))       \
+  if (c == '%' && c_isxdigit (ptr[1]) && c_isxdigit (ptr[2]))       \
     {                                                           \
       char decoded = X2DIGITS_TO_NUM (ptr[1], ptr[2]);          \
       if (decoded != '/')                                       \
index 72bb7b90d735c6eca5a73a450dda6b0d4e60a1cf..31dc09f654220847ae10836a520d8b13e9815023 100644 (file)
--- a/src/url.c
+++ b/src/url.c
@@ -183,7 +183,7 @@ url_unescape (char *s)
         {
           char c;
           /* Do nothing if '%' is not followed by two hex digits. */
-          if (!h[1] || !h[2] || !(ISXDIGIT (h[1]) && ISXDIGIT (h[2])))
+          if (!h[1] || !h[2] || !(c_isxdigit (h[1]) && c_isxdigit (h[2])))
             goto copychar;
           c = X2DIGITS_TO_NUM (h[1], h[2]);
           /* Don't unescape %00 because there is no way to insert it
@@ -272,7 +272,7 @@ char_needs_escaping (const char *p)
 {
   if (*p == '%')
     {
-      if (ISXDIGIT (*(p + 1)) && ISXDIGIT (*(p + 2)))
+      if (c_isxdigit (*(p + 1)) && c_isxdigit (*(p + 2)))
         return false;
       else
         /* Garbled %.. sequence: encode `%'. */
@@ -428,7 +428,7 @@ url_scheme (const char *url)
   return SCHEME_INVALID;
 }
 
-#define SCHEME_CHAR(ch) (ISALNUM (ch) || (ch) == '-' || (ch) == '+')
+#define SCHEME_CHAR(ch) (c_isalnum (ch) || (ch) == '-' || (ch) == '+')
 
 /* Return 1 if the URL begins with any "scheme", 0 otherwise.  As
    currently implemented, it returns true if URL begins with
@@ -590,10 +590,10 @@ lowercase_str (char *str)
 {
   bool changed = false;
   for (; *str; str++)
-    if (ISUPPER (*str))
+    if (c_isupper (*str))
       {
         changed = true;
-        *str = TOLOWER (*str);
+        *str = c_tolower (*str);
       }
   return changed;
 }
@@ -769,7 +769,7 @@ url_parse (const char *url, int *error)
       if (port_b != port_e)
         for (port = 0, pp = port_b; pp < port_e; pp++)
           {
-            if (!ISDIGIT (*pp))
+            if (!c_isdigit (*pp))
               {
                 /* http://host:12randomgarbage/blah */
                 /*               ^                  */
@@ -1373,9 +1373,9 @@ append_uri_pathel (const char *b, const char *e, bool escaped,
       for (q = TAIL (dest); q < TAIL (dest) + outlen; ++q)
         {
           if (opt.restrict_files_case == restrict_lowercase)
-            *q = TOLOWER (*q);
+            *q = c_tolower (*q);
           else
-            *q = TOUPPER (*q);
+            *q = c_toupper (*q);
         }
     }
           
@@ -1940,7 +1940,7 @@ getchar_from_escaped_string (const char *str, char *c)
   
   if (p[0] == '%')
     {
-      if (!ISXDIGIT(p[1]) || !ISXDIGIT(p[2]))
+      if (!c_isxdigit(p[1]) || !c_isxdigit(p[2]))
         {
           *c = '%';
           return 1;
@@ -1982,7 +1982,7 @@ are_urls_equal (const char *u1, const char *u2)
   while (*p && *q
          && (pp = getchar_from_escaped_string (p, &ch1))
          && (qq = getchar_from_escaped_string (q, &ch2))
-         && (TOLOWER(ch1) == TOLOWER(ch2)))
+         && (c_tolower(ch1) == c_tolower(ch2)))
     {
       p += pp;
       q += qq;
index 63545a3274aec45b1067925c3453aa9b0411cf04..003b364029fc08ccb2b561941bcbc2d28f058c99 100644 (file)
@@ -96,7 +96,7 @@ xstrdup_lower (const char *s)
   char *copy = xstrdup (s);
   char *p = copy;
   for (; *p; p++)
-    *p = TOLOWER (*p);
+    *p = c_tolower (*p);
   return copy;
 }
 
@@ -135,7 +135,7 @@ sepstring (const char *s)
           res[++i] = NULL;
           ++s;
           /* Skip the blanks following the ','.  */
-          while (ISSPACE (*s))
+          while (c_isspace (*s))
             ++s;
           p = s;
         }
@@ -636,10 +636,10 @@ fnmatch_nocase (const char *pattern, const char *string, int flags)
   char *strcopy = (char *) alloca (strlen (string) + 1);
   char *p;
   for (p = patcopy; *pattern; pattern++, p++)
-    *p = TOLOWER (*pattern);
+    *p = c_tolower (*pattern);
   *p = '\0';
   for (p = strcopy; *string; string++, p++)
-    *p = TOLOWER (*string);
+    *p = c_tolower (*string);
   *p = '\0';
   return fnmatch (patcopy, strcopy, flags);
 #endif
@@ -681,7 +681,7 @@ subdir_p (const char *d1, const char *d2)
     for (; *d1 && *d2 && (*d1 == *d2); ++d1, ++d2)
       ;
   else
-    for (; *d1 && *d2 && (TOLOWER (*d1) == TOLOWER (*d2)); ++d1, ++d2)
+    for (; *d1 && *d2 && (c_tolower (*d1) == c_tolower (*d2)); ++d1, ++d2)
       ;
   
   return *d1 == '\0' && (*d2 == '\0' || *d2 == '/');
@@ -766,7 +766,7 @@ match_tail (const char *string, const char *tail, bool fold_case)
   else
     {
       for (i = strlen (string), j = strlen (tail); i >= 0 && j >= 0; i--, j--)
-        if (TOLOWER (string[i]) != TOLOWER (tail[j]))
+        if (c_tolower (string[i]) != c_tolower (tail[j]))
           break;
     }
 
@@ -1940,7 +1940,7 @@ base64_encode (const void *data, int length, char *dest)
    when end of string is reached.  */
 #define NEXT_CHAR(c, p) do {                    \
   c = (unsigned char) *p++;                     \
-} while (ISSPACE (c))
+} while (c_isspace (c))
 
 #define IS_ASCII(c) (((c) & 0x80) == 0)
 
index ac16504b4cc9bb789788a79020a14ea7e970133f..9d3020646f1647fcb23db5be83f955655f019099 100644 (file)
@@ -213,7 +213,7 @@ typedef double SUM_SIZE_INT;
 /* Convert an ASCII hex digit to the corresponding number between 0
    and 15.  H should be a hexadecimal digit that satisfies isxdigit;
    otherwise, the result is undefined.  */
-#define XDIGIT_TO_NUM(h) ((h) < 'A' ? (h) - '0' : TOUPPER (h) - 'A' + 10)
+#define XDIGIT_TO_NUM(h) ((h) < 'A' ? (h) - '0' : c_toupper (h) - 'A' + 10)
 #define X2DIGITS_TO_NUM(h1, h2) ((XDIGIT_TO_NUM (h1) << 4) + XDIGIT_TO_NUM (h2))
 
 /* The reverse of the above: convert a number in the [0, 16) range to