summaryrefslogtreecommitdiff
path: root/src/irc
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2002-01-27 20:45:59 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2002-01-27 20:45:59 +0000
commitf4897860b50e2d1cc3b97a00d1f5a2e9e9c04faa (patch)
treea9d1400865e53ac8e5b68ca37b1cb9d081bd8467 /src/irc
parent820c9d3d8288c8d6dfb3172750bc26adea76f66c (diff)
downloadirssi-f4897860b50e2d1cc3b97a00d1f5a2e9e9c04faa.zip
toupper(), tolower(), isspace(), is..etc..() aren't safe with chars in some
systems, use our own is_...() functions now instead. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2348 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/irc')
-rw-r--r--src/irc/bot/botnet-connection.c2
-rw-r--r--src/irc/bot/botnet.c2
-rw-r--r--src/irc/core/bans.c18
-rw-r--r--src/irc/core/irc-masks.c2
-rw-r--r--src/irc/core/irc-nicklist.c4
-rw-r--r--src/irc/core/irc.c6
-rw-r--r--src/irc/core/netsplit.c4
-rw-r--r--src/irc/core/servers-redirect.c4
-rw-r--r--src/irc/dcc/dcc-chat.c2
9 files changed, 22 insertions, 22 deletions
diff --git a/src/irc/bot/botnet-connection.c b/src/irc/bot/botnet-connection.c
index 59da48f6..7b2b3161 100644
--- a/src/irc/bot/botnet-connection.c
+++ b/src/irc/bot/botnet-connection.c
@@ -342,7 +342,7 @@ static void botnet_connect_event_uplink(BOT_REC *bot, const char *data)
/* nick already in use, change it by adding a number
at the end of it */
p = botnet->nick+strlen(botnet->nick);
- while (p > botnet->nick && isdigit(p[-1])) p--;
+ while (p > botnet->nick && i_isdigit(p[-1])) p--;
num = *p == '\0' ? 2 : atoi(p)+1; *p = '\0';
str = g_strdup_printf("%s%d", botnet->nick, num);
g_free(botnet->nick); botnet->nick = str;
diff --git a/src/irc/bot/botnet.c b/src/irc/bot/botnet.c
index 15c64b80..d1bd4141 100644
--- a/src/irc/bot/botnet.c
+++ b/src/irc/bot/botnet.c
@@ -266,7 +266,7 @@ GNode *bot_find_path(BOTNET_REC *botnet, const char *nick)
static int is_ip_mask(const char *addr)
{
while (*addr != '\0') {
- if (!isdigit(*addr) && *addr != '.' &&
+ if (!i_isdigit(*addr) && *addr != '.' &&
*addr != '*' && *addr != '?') return FALSE;
addr++;
}
diff --git a/src/irc/core/bans.c b/src/irc/core/bans.c
index 5583d63a..ea3203c9 100644
--- a/src/irc/core/bans.c
+++ b/src/irc/core/bans.c
@@ -208,13 +208,13 @@ static int parse_custom_ban(const char *type)
ban_type = 0;
list = g_strsplit(type, " ", -1);
for (n = 0; list[n] != NULL; n++) {
- if (toupper(list[n][0]) == 'N')
+ if (i_toupper(list[n][0]) == 'N')
ban_type |= IRC_MASK_NICK;
- else if (toupper(list[n][0]) == 'U')
+ else if (i_toupper(list[n][0]) == 'U')
ban_type |= IRC_MASK_USER;
- else if (toupper(list[n][0]) == 'H')
+ else if (i_toupper(list[n][0]) == 'H')
ban_type |= IRC_MASK_HOST | IRC_MASK_DOMAIN;
- else if (toupper(list[n][0]) == 'D')
+ else if (i_toupper(list[n][0]) == 'D')
ban_type |= IRC_MASK_DOMAIN;
}
g_strfreev(list);
@@ -228,15 +228,15 @@ static int parse_ban_type(const char *type)
g_return_val_if_fail(type != NULL, 0);
- if (toupper(type[0]) == 'N')
+ if (i_toupper(type[0]) == 'N')
return BAN_TYPE_NORMAL;
- if (toupper(type[0]) == 'U')
+ if (i_toupper(type[0]) == 'U')
return BAN_TYPE_USER;
- if (toupper(type[0]) == 'H')
+ if (i_toupper(type[0]) == 'H')
return BAN_TYPE_HOST;
- if (toupper(type[0]) == 'D')
+ if (i_toupper(type[0]) == 'D')
return BAN_TYPE_DOMAIN;
- if (toupper(type[0]) == 'C') {
+ if (i_toupper(type[0]) == 'C') {
pos = strchr(type, ' ');
if (pos != NULL)
return parse_custom_ban(pos+1);
diff --git a/src/irc/core/irc-masks.c b/src/irc/core/irc-masks.c
index 345b1b77..824a3b84 100644
--- a/src/irc/core/irc-masks.c
+++ b/src/irc/core/irc-masks.c
@@ -41,7 +41,7 @@ static char *get_domain_mask(char *host)
if (is_ipv4_address(host)) {
/* it's an IP address, change last digit to * */
ptr = strrchr(host, '.');
- if (ptr != NULL && isdigit(ptr[1]))
+ if (ptr != NULL && i_isdigit(ptr[1]))
strcpy(ptr+1, "*");
} else {
/* if more than one dot, skip the first
diff --git a/src/irc/core/irc-nicklist.c b/src/irc/core/irc-nicklist.c
index 97538487..4b661e88 100644
--- a/src/irc/core/irc-nicklist.c
+++ b/src/irc/core/irc-nicklist.c
@@ -51,7 +51,7 @@ NICK_REC *irc_nicklist_insert(IRC_CHANNEL_REC *channel, const char *nick,
}
#define isnickchar(a) \
- (isalnum((int) (a)) || (a) == '`' || (a) == '-' || (a) == '_' || \
+ (i_isalnum(a) || (a) == '`' || (a) == '-' || (a) == '_' || \
(a) == '[' || (a) == ']' || (a) == '{' || (a) == '}' || \
(a) == '|' || (a) == '\\' || (a) == '^')
@@ -64,7 +64,7 @@ char *irc_nick_strip(const char *nick)
spos = stripped = g_strdup(nick);
while (isnickchar(*nick)) {
- if (isalnum((int) *nick))
+ if (i_isalnum(*nick))
*spos++ = *nick;
nick++;
}
diff --git a/src/irc/core/irc.c b/src/irc/core/irc.c
index 7757db84..88816404 100644
--- a/src/irc/core/irc.c
+++ b/src/irc/core/irc.c
@@ -152,19 +152,19 @@ static char *split_nicks(const char *cmd, char **pre, char **nicks, char **post,
*pre = g_strdup(cmd);
*post = *nicks = NULL;
for (p = *pre; *p != '\0'; p++) {
- if (!isspace(*p))
+ if (!i_isspace(*p))
continue;
if (arg == 1) {
/* text after nicks */
*p++ = '\0';
- while (isspace(*p)) p++;
+ while (i_isspace(*p)) p++;
*post = p;
break;
}
/* find nicks */
- while (isspace(p[1])) p++;
+ while (i_isspace(p[1])) p++;
if (--arg == 1) {
*p = '\0';
*nicks = p+1;
diff --git a/src/irc/core/netsplit.c b/src/irc/core/netsplit.c
index abdfb49f..b0fcb08d 100644
--- a/src/irc/core/netsplit.c
+++ b/src/irc/core/netsplit.c
@@ -282,7 +282,7 @@ int quitmsg_is_split(const char *msg)
/* top-domain1 must be 2+ chars long and contain only alphabets */
p = host2-1;
while (p[-1] != '.') {
- if (!isalpha(p[-1]))
+ if (!i_isalpha(p[-1]))
return FALSE;
p--;
}
@@ -291,7 +291,7 @@ int quitmsg_is_split(const char *msg)
/* top-domain2 must be 2+ chars long and contain only alphabets */
p = host2+strlen(host2);
while (p[-1] != '.') {
- if (!isalpha(p[-1]))
+ if (!i_isalpha(p[-1]))
return FALSE;
p--;
}
diff --git a/src/irc/core/servers-redirect.c b/src/irc/core/servers-redirect.c
index 389c892d..1a1d159d 100644
--- a/src/irc/core/servers-redirect.c
+++ b/src/irc/core/servers-redirect.c
@@ -311,7 +311,7 @@ static int redirect_args_match(const char *event_args,
start = event_args;
while (*arg != '\0') {
while (*arg != '\0' && *arg != ' ' && *event_args != '\0') {
- if (toupper(*arg) != toupper(*event_args))
+ if (i_toupper(*arg) != i_toupper(*event_args))
break;
arg++; event_args++;
}
@@ -505,7 +505,7 @@ server_redirect_get(IRC_SERVER_REC *server, const char *event,
if (signal == NULL) {
/* unknown event - redirect to the default signal. */
if (strncmp(event, "event ", 6) == 0 &&
- isdigit(event[6])) {
+ i_isdigit(event[6])) {
signal = (*redirect)->default_signal;
if (*match == MATCH_NONE)
*match = MATCH_START;
diff --git a/src/irc/dcc/dcc-chat.c b/src/irc/dcc/dcc-chat.c
index dd9159c3..370d8ac5 100644
--- a/src/irc/dcc/dcc-chat.c
+++ b/src/irc/dcc/dcc-chat.c
@@ -456,7 +456,7 @@ static void cmd_mircdcc(const char *data, SERVER_REC *server,
dcc = item_get_dcc((WI_ITEM_REC *) item);
if (dcc == NULL) return;
- dcc->mirc_ctcp = toupper(*data) != 'N' &&
+ dcc->mirc_ctcp = i_toupper(*data) != 'N' &&
g_strncasecmp(data, "OF", 2) != 0;
}