common.c (Q_strncasecmp): fix it so that it properly returns negative and

positive values.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@87 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
Ozkan Sezer 2010-02-27 08:00:57 +00:00
parent b1881ba609
commit f0c318cafe
2 changed files with 9 additions and 7 deletions

View file

@ -275,6 +275,9 @@ int Q_strncasecmp (const char *s1, const char *s2, int n)
{
int c1, c2;
if (s1 == s2 || n <= 0)
return 0;
while (1)
{
c1 = *s1++;
@ -289,16 +292,14 @@ int Q_strncasecmp (const char *s1, const char *s2, int n)
c1 -= ('a' - 'A');
if (c2 >= 'a' && c2 <= 'z')
c2 -= ('a' - 'A');
if (c1 != c2)
return -1; // strings not equal
}
if (!c1)
return 0; // strings are equal
// s1++;
// s2++;
return (c2 == 0) ? 0 : -1;
if (c1 < c2)
return -1;
if (c1 > c2)
return 1;
}
return -1;
}
int Q_strcasecmp (const char *s1, const char *s2)

View file

@ -2214,6 +2214,7 @@ void Host_InitCommands (void)
Cmd_AddCommand ("maps", Host_Maps_f); //johnfitz
Cmd_AddCommand ("game", Host_Game_f); //johnfitz
Cmd_AddCommand ("mods", Host_Mods_f); //johnfitz
Cmd_AddCommand ("games", Host_Mods_f); // as an alias to "mods" -- S.A.
Cmd_AddCommand ("mapname", Host_Mapname_f); //johnfitz
Cmd_AddCommand ("status", Host_Status_f);