tstr(n)casecmp calls replaced with their GLib equivalents, for extra portabilit… | |
git clone git://src.adamsgaard.dk/vaccinewars | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit b97f07e9aabedfec9365d87fb8566aae993adff5 | |
parent a281eabbbacadf5343bd655f36a5e5c300e5696b | |
Author: Ben Webb <[email protected]> | |
Date: Fri, 12 Oct 2001 16:33:53 +0000 | |
str(n)casecmp calls replaced with their GLib equivalents, for extra portability | |
Diffstat: | |
M src/curses_client.c | 6 +++--- | |
M src/dopewars.c | 26 +++++++++++++------------- | |
M src/gtk_client.c | 10 +++++----- | |
M src/serverside.c | 12 ++++++------ | |
4 files changed, 27 insertions(+), 27 deletions(-) | |
--- | |
diff --git a/src/curses_client.c b/src/curses_client.c | |
t@@ -342,14 +342,14 @@ static gboolean ConnectToServer(Player *Play) { | |
errstr = g_string_new(""); | |
- if (strcasecmp(ServerName,SN_META)==0 || ConnectMethod==CM_META) { | |
+ if (g_strcasecmp(ServerName,SN_META)==0 || ConnectMethod==CM_META) { | |
ConnectMethod=CM_META; | |
MetaOK=SelectServerFromMetaServer(Play,errstr); | |
- } else if (strcasecmp(ServerName,SN_PROMPT)==0 || | |
+ } else if (g_strcasecmp(ServerName,SN_PROMPT)==0 || | |
ConnectMethod==CM_PROMPT) { | |
ConnectMethod=CM_PROMPT; | |
SelectServerManually(); | |
- } else if (strcasecmp(ServerName,SN_SINGLE)==0 || | |
+ } else if (g_strcasecmp(ServerName,SN_SINGLE)==0 || | |
ConnectMethod==CM_SINGLE) { | |
ConnectMethod=CM_SINGLE; | |
g_string_free(errstr,TRUE); | |
diff --git a/src/dopewars.c b/src/dopewars.c | |
t@@ -1009,18 +1009,18 @@ int GetNextDrugIndex(int OldIndex,Player *Play) { | |
if (Play->Drugs[i].Price!=0 && i!=OldIndex && i!=MaxIndex && | |
(MaxIndex==-1 || | |
(DrugSortMethod==DS_ATOZ && | |
- strcasecmp(Drug[MaxIndex].Name,Drug[i].Name)>0) || | |
+ g_strcasecmp(Drug[MaxIndex].Name,Drug[i].Name)>0) || | |
(DrugSortMethod==DS_ZTOA && | |
- strcasecmp(Drug[MaxIndex].Name,Drug[i].Name)<0) || | |
+ g_strcasecmp(Drug[MaxIndex].Name,Drug[i].Name)<0) || | |
(DrugSortMethod==DS_CHEAPFIRST && | |
Play->Drugs[MaxIndex].Price > Play->Drugs[i].Price) || | |
(DrugSortMethod==DS_CHEAPLAST && | |
Play->Drugs[MaxIndex].Price < Play->Drugs[i].Price)) && | |
(OldIndex==-1 || | |
(DrugSortMethod==DS_ATOZ && | |
- strcasecmp(Drug[OldIndex].Name,Drug[i].Name)<=0) || | |
+ g_strcasecmp(Drug[OldIndex].Name,Drug[i].Name)<=0) || | |
(DrugSortMethod==DS_ZTOA && | |
- strcasecmp(Drug[OldIndex].Name,Drug[i].Name)>=0) || | |
+ g_strcasecmp(Drug[OldIndex].Name,Drug[i].Name)>=0) || | |
(DrugSortMethod==DS_CHEAPFIRST && | |
Play->Drugs[OldIndex].Price <= Play->Drugs[i].Price) || | |
(DrugSortMethod==DS_CHEAPLAST && | |
t@@ -1398,12 +1398,12 @@ int GetGlobalIndex(gchar *ID1,gchar *ID2) { | |
const int NumGlob=sizeof(Globals)/sizeof(Globals[0]); | |
if (!ID1) return -1; | |
for (i=0;i<NumGlob;i++) { | |
- if (strcasecmp(ID1,Globals[i].Name)==0 && !Globals[i].NameStruct[0]) { | |
+ if (g_strcasecmp(ID1,Globals[i].Name)==0 && !Globals[i].NameStruct[0]) { | |
/* Just a bog-standard ID1=value */ | |
return i; | |
} | |
- if (strcasecmp(ID1,Globals[i].NameStruct)==0 && ID2 && | |
- strcasecmp(ID2,Globals[i].Name)==0 && | |
+ if (g_strcasecmp(ID1,Globals[i].NameStruct)==0 && ID2 && | |
+ g_strcasecmp(ID2,Globals[i].Name)==0 && | |
Globals[i].StructStaticPt && Globals[i].StructListPt) { | |
/* ID1[index].ID2=value */ | |
return i; | |
t@@ -1552,15 +1552,15 @@ void SetConfigValue(int GlobalIndex,int StructIndex,gb… | |
G_CSET_a_2_z "._0123456789" G_CSET_A_2_Z; | |
parsed=FALSE; | |
if (token==G_TOKEN_IDENTIFIER) { | |
- if (strcasecmp(scanner->value.v_identifier,_("TRUE"))==0 || | |
- strcasecmp(scanner->value.v_identifier,_("YES"))==0 || | |
- strcasecmp(scanner->value.v_identifier,_("ON"))==0 || | |
+ if (g_strcasecmp(scanner->value.v_identifier,_("TRUE"))==0 || | |
+ g_strcasecmp(scanner->value.v_identifier,_("YES"))==0 || | |
+ g_strcasecmp(scanner->value.v_identifier,_("ON"))==0 || | |
strcmp(scanner->value.v_identifier,"1")==0) { | |
parsed=TRUE; | |
*((gboolean *)GetGlobalPointer(GlobalIndex,StructIndex))=TRUE; | |
- } else if (strcasecmp(scanner->value.v_identifier,_("FALSE"))==0 || | |
- strcasecmp(scanner->value.v_identifier,_("NO"))==0 || | |
- strcasecmp(scanner->value.v_identifier,_("OFF"))==0 || | |
+ } else if (g_strcasecmp(scanner->value.v_identifier,_("FALSE"))==0 || | |
+ g_strcasecmp(scanner->value.v_identifier,_("NO"))==0 || | |
+ g_strcasecmp(scanner->value.v_identifier,_("OFF"))==0 || | |
strcmp(scanner->value.v_identifier,"0")==0) { | |
parsed=TRUE; | |
*((gboolean *)GetGlobalPointer(GlobalIndex,StructIndex))=FALSE; | |
diff --git a/src/gtk_client.c b/src/gtk_client.c | |
t@@ -1610,9 +1610,9 @@ static gint DrugSortFunc(GtkCList *clist,gconstpointer p… | |
switch(DrugSortMethod) { | |
case DS_ATOZ: | |
- return strcasecmp(Drug[index1].Name,Drug[index2].Name); | |
+ return g_strcasecmp(Drug[index1].Name,Drug[index2].Name); | |
case DS_ZTOA: | |
- return strcasecmp(Drug[index2].Name,Drug[index1].Name); | |
+ return g_strcasecmp(Drug[index2].Name,Drug[index1].Name); | |
case DS_CHEAPFIRST: | |
pricediff=ClientData.Play->Drugs[index1].Price- | |
ClientData.Play->Drugs[index2].Price; | |
t@@ -2250,11 +2250,11 @@ void NewGameDialog(void) { | |
entry=widgets.hostname=gtk_entry_new(); | |
ServerEntry = "localhost"; | |
- if (strcasecmp(ServerName,SN_META)==0) { | |
+ if (g_strcasecmp(ServerName,SN_META)==0) { | |
NewGameType=2; | |
UpdateMeta=TRUE; | |
- } else if (strcasecmp(ServerName,SN_PROMPT)==0) NewGameType=0; | |
- else if (strcasecmp(ServerName,SN_SINGLE)==0) NewGameType=1; | |
+ } else if (g_strcasecmp(ServerName,SN_PROMPT)==0) NewGameType=0; | |
+ else if (g_strcasecmp(ServerName,SN_SINGLE)==0) NewGameType=1; | |
else ServerEntry = ServerName; | |
gtk_entry_set_text(GTK_ENTRY(entry),ServerEntry); | |
diff --git a/src/serverside.c b/src/serverside.c | |
t@@ -755,14 +755,14 @@ void HandleServerCommand(char *string) { | |
Player *tmp; | |
g_scanner_input_text(Scanner,string,strlen(string)); | |
if (!ParseNextConfig(Scanner)) { | |
- if (strcasecmp(string,"help")==0 || strcasecmp(string,"h")==0 || | |
+ if (g_strcasecmp(string,"help")==0 || g_strcasecmp(string,"h")==0 || | |
strcmp(string,"?")==0) { | |
ServerHelp(); | |
- } else if (strcasecmp(string,"quit")==0) { | |
+ } else if (g_strcasecmp(string,"quit")==0) { | |
RequestServerShutdown(); | |
- } else if (strncasecmp(string,"msg:",4)==0) { | |
+ } else if (g_strncasecmp(string,"msg:",4)==0) { | |
BroadcastToClients(C_NONE,C_MSG,string+4,NULL,NULL); | |
- } else if (strcasecmp(string,"list")==0) { | |
+ } else if (g_strcasecmp(string,"list")==0) { | |
if (FirstServer) { | |
g_print(_("Users currently logged on:-\n")); | |
for (list=FirstServer;list;list=g_slist_next(list)) { | |
t@@ -770,13 +770,13 @@ void HandleServerCommand(char *string) { | |
if (!IsCop(tmp)) g_print("%s\n",GetPlayerName(tmp)); | |
} | |
} else g_print(_("No users currently logged on!\n")); | |
- } else if (strncasecmp(string,"push ",5)==0) { | |
+ } else if (g_strncasecmp(string,"push ",5)==0) { | |
tmp=GetPlayerByName(string+5,FirstServer); | |
if (tmp) { | |
dopelog(0,_("Pushing %s"),GetPlayerName(tmp)); | |
SendServerMessage(NULL,C_NONE,C_PUSH,tmp,NULL); | |
} else g_warning(_("No such user!")); | |
- } else if (strncasecmp(string,"kill ",5)==0) { | |
+ } else if (g_strncasecmp(string,"kill ",5)==0) { | |
tmp=GetPlayerByName(string+5,FirstServer); | |
if (tmp) { | |
dopelog(0,_("%s killed"),GetPlayerName(tmp)); |