From 146d293272606f08aa32e2221fd68ac55611b6d6 Mon Sep 17 00:00:00 2001 From: Lance Date: Wed, 15 Mar 2006 15:27:58 +0000 Subject: * Emulated strtok_r functions to work strictly with ANSI compilers. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5611 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog-Trunk.txt | 1 + src/map/irc.c | 16 +++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 71b83bc78..36cd71758 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -5,6 +5,7 @@ IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. EV GOES INTO TRUNK AND WILL BE MERGED INTO STABLE BY VALARIS AND WIZPUTER. -- VALARIS 2006/03/15 + * Emulated strtok_r functions to work strictly with ANSI compilers. [Lance] * Added battle config options item_rate_adddrop, item_drop_add_min and item_drop_add_max to control drop rate of card-acquired loot bonuses. (conf/battle/drops.conf) [Skotlex] diff --git a/src/map/irc.c b/src/map/irc.c index 33e90669f..b3cd74468 100644 --- a/src/map/irc.c +++ b/src/map/irc.c @@ -208,9 +208,10 @@ void irc_parse_sub(int fd, char *incoming_string) sscanf(incoming_string, ":%255s %255s %255s :%4095[^\n]", source, command, target, message); if (source != NULL) { if (strstr(source,"!") != NULL) { - source_nick = strtok_r(source,"!",&state_mgr); - source_ident = strtok_r(NULL,"@",&state_mgr); - source_host = strtok_r(NULL,"%%",&state_mgr); + sscanf(source,"%s!%s@$s",source_nick, source_ident, source_host); + //source_nick = strtok_r(source,"!",&state_mgr); + //source_ident = strtok_r(NULL,"@",&state_mgr); + //source_host = strtok_r(NULL,"%%",&state_mgr); } } if (irc_si->state == 0){ @@ -249,15 +250,20 @@ void irc_parse_sub(int fd, char *incoming_string) int send_to_parser(int fd, char *input,char key[2]) { + char format[4]; char *temp_string=NULL; + char *next_string=NULL; char *state_mgr=NULL; int total_loops=0; - temp_string = strtok_r(input,key,&state_mgr); + //temp_string = strtok_r(input,key,&state_mgr); + sprintf(format,"%s%s%s","%s",key,"%s"); + sscanf(input, format, temp_string, next_string); while (temp_string != NULL){ total_loops = total_loops+1; irc_parse_sub(fd,temp_string); - temp_string = strtok_r(NULL,key,&state_mgr); + //temp_string = strtok_r(NULL,key,&state_mgr); + sscanf(next_string, format, temp_string, next_string); } return total_loops; } -- cgit v1.2.3-70-g09d2