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