curtok = src;
saw_xdigit = 0;
val = 0;
- while((ch = tolower(*src++)) != '\0')
+ while((ch = tolower((unsigned char)*src++)) != '\0')
{
const char *pch;
conf_report_warning(ce, "uplink's server name %s should not be the same as our server name, continuing anyway", ce->vardata);
else if (!strchr(ce->vardata, '.'))
conf_report_warning(ce, "uplink's server name %s is invalid, continuing anyway", ce->vardata);
- else if (isdigit(ce->vardata[0]))
+ else if (isdigit((unsigned char)ce->vardata[0]))
conf_report_warning(ce, "uplink's server name %s starts with a digit, probably invalid (continuing anyway)", ce->vardata);
name = ce->vardata;
return false;
}
- if (isdigit(me.name[0]))
+ if (isdigit((unsigned char)me.name[0]))
slog(LG_ERROR, "conf_check(): `name' in %s starts with a digit, probably invalid (continuing anyway)", config_file);
if (!me.desc)
/* no mail to IP addresses, this should be done using [10.2.3.4]
* like syntax but we do not allow that either
*/
- if (isdigit(lastdot[1]))
+ if (isdigit((unsigned char)lastdot[1]))
return 0;
/* make sure there are at least 4 characters besides the above
else if (*in == 3)
{
in++;
- while (isdigit(*in))
+ while (isdigit((unsigned char)*in))
in++;
}
}
int ToLower(int c)
{
if (match_mapping == MATCH_ASCII)
- return tolower(c);
+ return tolower((unsigned char)c);
/* else */
return (ToLowerTab[(unsigned char)(c)]);
}
int ToUpper(int c)
{
if (match_mapping == MATCH_ASCII)
- return toupper(c);
+ return toupper((unsigned char)c);
/* else */
return (ToUpperTab[(unsigned char)(c)]);
}
{
while (*str)
{
- *str = toupper(*str);
+ *str = toupper((unsigned char)*str);
str++;
}
return;
bool backslash = false;
c = *pattern;
- if (isalnum(c) || isspace(c) || c == '\\')
+ if (isalnum((unsigned char)c) || isspace((unsigned char)c) || c == '\\')
return NULL;
p = pattern + 1;
while (*p != c || backslash)
*pflags |= AREGEX_PCRE;
else if (*p == 'K')
*pflags |= AREGEX_KLINE;
- else if (!isalnum(*p))
+ else if (!isalnum((unsigned char)*p))
return NULL;
p++;
}
notice(target_u->nick, si->su->nick, "This is a registered nick enforcer, and not a real user.");
return;
}
- if (!is_notice && (isalnum(target[0]) || strchr("[\\]^_`{|}~", target[0])))
+ if (!is_notice && (isalnum((unsigned char)target[0]) || strchr("[\\]^_`{|}~", target[0])))
{
/* If it's not a notice and looks like a nick or
* user@server, send back an error message */
- if (strchr(target, '@') || !ircd->uses_uid || (!ircd->uses_p10 && !isdigit(target[0])))
+ if (strchr(target, '@') || !ircd->uses_uid || (!ircd->uses_p10 && !isdigit((unsigned char)target[0])))
numeric_sts(me.me, 401, si->su, "%s :No such nick", target);
else
numeric_sts(me.me, 401, si->su, "* :Target left IRC. Failed to deliver: [%.20s]", message);
p = input;
/* skip until something thats not a space is seen */
- while (isspace(*p))
+ while (isspace((unsigned char)*p))
p++;
/* if at this point, have a '\0' then continue */
if (*p == '\0')
/* skip until a space is found */
opt = p;
- while (!isspace(*p) && *p != '\0')
+ while (!isspace((unsigned char)*p) && *p != '\0')
p++;
if (*p == '\0')
continue; /* no arguments?.. ignore this line */
*p++ = '\0';
/* skip these spaces that are before the argument */
- while (isspace(*p))
+ while (isspace((unsigned char)*p))
p++;
/* Now arg should be right where p is pointing */
arg = p;
return false;
}
p = strrchr(host, '/');
- if (p != NULL && isdigit(p[1]))
+ if (p != NULL && isdigit((unsigned char)p[1]))
{
command_fail(si, fault_badparams, _("The vhost provided looks like a CIDR mask."));
return false;
if ((sptr = service_find("chanserv")) == NULL)
return;
- if (strlen(cmd) >= 2 && strchr(prefix, cmd[0]) && isalpha(*++cmd))
+ if (strlen(cmd) >= 2 && strchr(prefix, cmd[0]) && isalpha((unsigned char)*++cmd))
{
const char *realcmd = service_resolve_alias(chansvs.me, NULL, cmd);
if (s)
{
duration = (atol(s) * 60);
- while (isdigit(*s))
+ while (isdigit((unsigned char)*s))
s++;
if (*s == 'h' || *s == 'H')
duration *= 60;
time_t duration;
duration = (atol(s) * 60);
- while (isdigit(*s))
+ while (isdigit((unsigned char)*s))
s++;
if (*s == 'h' || *s == 'H')
metadata_t *md = metadata_find(mc, "private:prefix");
const char *prefix = (md ? md->value : chansvs.trigger);
- if (strlen(cmd) >= 2 && strchr(prefix, cmd[0]) && isalpha(*++cmd))
+ if (strlen(cmd) >= 2 && strchr(prefix, cmd[0]) && isalpha((unsigned char)*++cmd))
{
const char *realcmd = service_resolve_alias(si->service, NULL, cmd);
command_exec_split(si->service, si, realcmd, newargs, si->service->commands);
mc->flags &= ~MC_FORCEVERBOSE;
}
- else if (!ircncasecmp(cmd, chansvs.nick, strlen(chansvs.nick)) && !isalnum(cmd[strlen(chansvs.nick)]) && (cmd = strtok(NULL, "")) != NULL)
+ else if (!ircncasecmp(cmd, chansvs.nick, strlen(chansvs.nick)) && !isalnum((unsigned char)cmd[strlen(chansvs.nick)]) && (cmd = strtok(NULL, "")) != NULL)
{
const char *realcmd;
char *pptr;
int hasnonprint = 0;
for (i = 0; p[i]; i++) {
- if (!isspace(p[i])) { haschar = 1; }
- if (!isprint(p[i])) { hasnonprint = 1; }
+ if (!isspace((unsigned char)p[i])) { haschar = 1; }
+ if (!isprint((unsigned char)p[i])) { hasnonprint = 1; }
}
return haschar && !hasnonprint;
}
// Skip leading whitespace
- while (*ci && isspace(*ci))
+ while (*ci && isspace((unsigned char)*ci))
ci++;
if (!*ci)
if (--braces < 0)
break; // mismatched!
}
- else if (!isspace(*ci) && !isdigit(*ci) && *ci != '.' && !is_calcoper(*ci))
+ else if (!isspace((unsigned char)*ci) && !isdigit((unsigned char)*ci) && *ci != '.' && !is_calcoper(*ci))
{
command_fail(si, fault_badparams, _("Error: You typed an invalid expression."));
return false;
return 1;
}
// skip whitespace
- while (*cur && isspace(*cur))
+ while (*cur && isspace((unsigned char)*cur))
cur++;
}
unsigned int dice, roll, x, y, z = 0;
double total;
- while (*c && isspace(*c))
+ while (*c && isspace((unsigned char)*c))
++c;
- if (!*c || !isdigit(*c))
+ if (!*c || !isdigit((unsigned char)*c))
{
gs_command_report(si, _("Syntax: XdY [ {-|+|*|/} Z ]"));
return false;
}
x = strtoul(c, &c, 10);
- if (x == 0 || c == NULL || ToLower(*c++) != 'd' || !isdigit(*c))
+ if (x == 0 || c == NULL || ToLower(*c++) != 'd' || !isdigit((unsigned char)*c))
{
if (x < 1 || x > DICE_MAX_DICE)
{
y = strtoul(c, &c, 10);
if (c != NULL)
{
- while (*c && isspace(*c))
+ while (*c && isspace((unsigned char)*c))
++c;
if (*c && strchr("-+*/", *c) == NULL)
z = strtoul(c, &c, 10);
- while (*c && isspace(*c))
+ while (*c && isspace((unsigned char)*c))
++c;
if (*c)
p = name;
while (*p != '\0')
{
- if (isdigit(*p))
+ if (isdigit((unsigned char)*p))
digit++;
- else if (isupper(*p))
+ else if (isupper((unsigned char)*p))
upper++;
- else if (islower(*p))
+ else if (islower((unsigned char)*p))
lower++;
p++;
}
prevdot = p;
havedigits = false;
}
- else if (isdigit(*p))
+ else if (isdigit((unsigned char)*p))
havedigits = true;
p++;
}
if ((p[0] != '0' || p[1] != '.') && ((i = atoi(p)) < 1 || i > 255))
return false;
- while (isdigit(*p))
+ while (isdigit((unsigned char)*p))
p++;
if (*p++ != '.')
return false;
if ((p[0] != '0' || p[1] != '.') && ((i = atoi(p)) < 1 || i > 255))
return false;
- while (isdigit(*p))
+ while (isdigit((unsigned char)*p))
p++;
if (*p++ != '.')
return false;
if ((p[0] != '0' || p[1] != '.') && ((i = atoi(p)) < 1 || i > 255))
return false;
- while (isdigit(*p))
+ while (isdigit((unsigned char)*p))
p++;
if (*p++ != '.')
return false;
p = mask;
while (*p != '\0')
{
- if (!isprint(*p) || *p == ' ' || *p == '!')
+ if (!isprint((unsigned char)*p) || *p == ' ' || *p == '!')
{
command_fail(si, fault_badparams, _("Invalid mask \2%s\2."), parv[1]);
return;
}
else if ((p = strrchr(host, '/')) != NULL)
{
- if (isdigit(p[1]) && (atoi(p + 1) < 16 || (mask[0] == '*' && mask[1] == '@')))
+ if (isdigit((unsigned char)p[1]) && (atoi(p + 1) < 16 || (mask[0] == '*' && mask[1] == '@')))
{
command_fail(si, fault_badparams, _("Too wide mask \2%s\2."), parv[1]);
return;
p = host;
/* No wildcarded IPs */
- if (isdigit(p[1]) && (strchr(host, '*') || strchr(host, '?')))
+ if (isdigit((unsigned char)p[1]) && (strchr(host, '*') || strchr(host, '?')))
{
command_fail(si, fault_badparams, _("Too wide mask \2%s\2."), parv[1]);
return;
if (hdata->approved)
return;
- if (!strncasecmp(hdata->account, nicksvs.enforce_prefix, prefixlen) && isdigit(hdata->account[prefixlen]))
+ if (!strncasecmp(hdata->account, nicksvs.enforce_prefix, prefixlen) && isdigit((unsigned char)hdata->account[prefixlen]))
{
command_fail(hdata->si, fault_badparams, "The nick \2%s\2 is reserved and cannot be registered.", hdata->account);
hdata->approved = 1;
time_t duration;
duration = (atol(s) * 60);
- while (isdigit(*s))
+ while (isdigit((unsigned char)*s))
s++;
if (*s == 'h' || *s == 'H')
if (s)
{
duration = (atol(s) * 60);
- while (isdigit(*s))
+ while (isdigit((unsigned char)*s))
s++;
if (*s == 'h' || *s == 'H')
duration *= 60;
host = param;
full = true;
}
- else if (isdigit(param[0]) &&
+ else if (isdigit((unsigned char)param[0]) &&
(num = strtoul(param, NULL, 10)) != 0)
full = true;
else
wallops("\2%s\2 disabled CLONES klines", get_oper_name(si));
logcommand(si, CMDLOG_ADMIN, "CLONES:KLINE:OFF");
}
- else if (isdigit(arg[0]))
+ else if (isdigit((unsigned char)arg[0]))
{
unsigned int newgrace = atol(arg);
if (kline_enabled && grace_count == newgrace)
expiry += 3;
duration = (atol(expiry) * 60);
- while (isdigit(*expiry))
+ while (isdigit((unsigned char)*expiry))
++expiry;
if (*expiry == 'h' || *expiry == 'H')
duration *= 60;
else
{
duration = (atol(expiry) * 60);
- while (isdigit(*expiry))
+ while (isdigit((unsigned char)*expiry))
++expiry;
if (*expiry == 'h' || *expiry == 'H')
duration *= 60;
}
duration = (atol(s) * 60);
- while (isdigit(*s))
+ while (isdigit((unsigned char)*s))
s++;
if (*s == 'h' || *s == 'H')
duration *= 60;
if (s)
{
duration = (atol(s) * 60);
- while (isdigit(*s))
+ while (isdigit((unsigned char)*s))
s++;
if (*s == 'h' || *s == 'H')
duration *= 60;
if (s)
{
duration = (atol(s) * 60);
- while (isdigit(*s))
+ while (isdigit((unsigned char)*s))
s++;
if (*s == 'h' || *s == 'H')
duration *= 60;
return false;
arg2 = p + 1;
}
- else if (!isdigit(*p))
+ else if (!isdigit((unsigned char)*p))
return false;
p++;
}
return false;
arg2 = p + 1;
}
- else if (!isdigit(*p))
+ else if (!isdigit((unsigned char)*p))
return false;
p++;
}
return false;
arg2 = p + 1;
}
- else if (!isdigit(*p))
+ else if (!isdigit((unsigned char)*p))
return false;
p++;
}
while (*ch)
{
- if (!isdigit(*ch))
+ if (!isdigit((unsigned char)*ch))
return false;
ch++;
}
while (*ch)
{
- if (!isdigit(*ch))
+ if (!isdigit((unsigned char)*ch))
return false;
ch++;
}
ircd->uses_uid = false;
ret = sts("PASS %s :TS", curr_uplink->send_pass);
}
- else if (strlen(me.numeric) == 3 && isdigit(*me.numeric))
+ else if (strlen(me.numeric) == 3 && isdigit((unsigned char)*me.numeric))
{
ircd->uses_uid = true;
ret = sts("PASS %s TS 6 :%s", curr_uplink->send_pass, me.numeric);
return false;
arg2 = p + 1;
}
- else if (!isdigit(*p))
+ else if (!isdigit((unsigned char)*p))
return false;
p++;
}
{
if (*value == '*' && !found_colon)
found_colon = true;
- else if (!isdigit(*value))
+ else if (!isdigit((unsigned char)*value))
return false;
value++;
for (p = strtok(ep, ","); p != NULL; p = strtok(NULL, ","))
{
- while (isdigit(*p))
+ while (isdigit((unsigned char)*p))
p++;
if (!VALID_FLOOD_CHAR(*p))
/* Color ctrl char */
case 3:
/* If the next character is a digit, its also removed */
- if (isdigit(buf[i + 1]))
+ if (isdigit((unsigned char)buf[i + 1]))
{
i++;
* which are two digit but no worse then
* how the Unreal does with +S - TSL
*/
- if (isdigit(buf[i + 1]))
+ if (isdigit((unsigned char)buf[i + 1]))
{
i++;
}
{
i++;
- if (isdigit(buf[i + 1]))
+ if (isdigit((unsigned char)buf[i + 1]))
{
i++;
}
* which are two digit but no worse then
* how the Unreal does with +S - TSL
*/
- if (isdigit(buf[i + 1]))
+ if (isdigit((unsigned char)buf[i + 1]))
{
i++;
}
/* Color ctrl char */
case 3:
/* If the next character is a digit, its also removed */
- if (isdigit(buf[i + 1]))
+ if (isdigit((unsigned char)buf[i + 1]))
{
i++;
* which are two digit but no worse then
* how the Unreal does with +S - TSL
*/
- if (isdigit(buf[i + 1]))
+ if (isdigit((unsigned char)buf[i + 1]))
{
i++;
}
{
i++;
- if (isdigit(buf[i + 1]))
+ if (isdigit((unsigned char)buf[i + 1]))
{
i++;
}
* which are two digit but no worse then
* how the Unreal does with +S - TSL
*/
- if (isdigit(buf[i + 1]))
+ if (isdigit((unsigned char)buf[i + 1]))
{
i++;
}