[Sphere-axis-commits] CVS: axissvr gwhogsvr.cpp,1.27.2.4,1.27.2.5
Brought to you by:
pesterle
From: Philip E. <pes...@us...> - 2003-10-16 21:01:28
|
Update of /cvsroot/sphere-axis/axissvr In directory sc8-pr-cvs1:/tmp/cvs-serv9110 Modified Files: Tag: v0_13-Stable gwhogsvr.cpp Log Message: Incorporated herby's stristr patch. Index: gwhogsvr.cpp =================================================================== RCS file: /cvsroot/sphere-axis/axissvr/gwhogsvr.cpp,v retrieving revision 1.27.2.4 retrieving revision 1.27.2.5 diff -C2 -r1.27.2.4 -r1.27.2.5 *** gwhogsvr.cpp 14 Oct 2003 05:12:54 -0000 1.27.2.4 --- gwhogsvr.cpp 16 Oct 2003 21:01:21 -0000 1.27.2.5 *************** *** 71,74 **** --- 71,82 ---- char g_szSpherePath[MAX_BUFFER]; + //herby: + //added a little function which compares strings not case sensitive + //not written very fast but isn't called often! + char *stristr( char szString[] char szCharSet[]) + { + return strstr( _strupr(szString), _strupr(szCharSet)); + } + #ifdef WIN32 int service_main(int argc, char *argv[]) *************** *** 1104,1110 **** { // comment herby: I should write a stristr (not case sensitive) function ! if ((strstr(szLine, "WORLDSAVE=") == szLine) && (szPath[0] == 0x00)) memcpy(&szPath[0], &szLine[10], strlen(szLine) - 10); ! if (strstr(szLine, "ACCTFILES=") == szLine) { memset(szPath, 0x00, sizeof(szPath)); --- 1112,1118 ---- { // comment herby: I should write a stristr (not case sensitive) function ! if ((stristr(szLine, "WORLDSAVE=") == szLine) && (szPath[0] == 0x00)) memcpy(&szPath[0], &szLine[10], strlen(szLine) - 10); ! if (stristr(szLine, "ACCTFILES=") == szLine) { memset(szPath, 0x00, sizeof(szPath)); *************** *** 1167,1171 **** { stoupper(&szBuffer[0], strlen(szBuffer)); ! if (strstr(szBuffer, szTargetAcct) != NULL) { // Found the account --- 1175,1179 ---- { stoupper(&szBuffer[0], strlen(szBuffer)); ! if (stristr(szBuffer, szTargetAcct) != NULL) { // Found the account *************** *** 1178,1182 **** stoupper(&szUCBuffer[0], strlen(szBuffer)); // Check for either PRIVS or PASSWORD ! if (strstr(szUCBuffer, "PASSWORD=") == szUCBuffer) { // Compare it to the real password --- 1186,1190 ---- stoupper(&szUCBuffer[0], strlen(szBuffer)); // Check for either PRIVS or PASSWORD ! if (stristr(szUCBuffer, "PASSWORD=") == szUCBuffer) { // Compare it to the real password *************** *** 1185,1189 **** bBadPassword = false; } ! if (strstr(szUCBuffer, "PLEVEL=") != NULL) { char szLevel[20]; --- 1193,1197 ---- bBadPassword = false; } ! if (stristr(szUCBuffer, "PLEVEL=") != NULL) { char szLevel[20]; *************** *** 1400,1409 **** if (strcmp( pszFileName, g_szAccuFile) == 0) { ! if (strstr(szLine, "ACCTFILES=") == szLine) { memcpy(&szScriptPath[0], &szLine[9], strlen(szLine) - 9); break; } ! else if ( szScriptPath[0] == 0x00 && (strstr(szLine, "WORLDSAVE=") == szLine) ) { memcpy(&szScriptPath[0], &szLine[9], strlen(szLine) - 9); --- 1408,1417 ---- if (strcmp( pszFileName, g_szAccuFile) == 0) { ! if (stristr(szLine, "ACCTFILES=") == szLine) { memcpy(&szScriptPath[0], &szLine[9], strlen(szLine) - 9); break; } ! else if ( szScriptPath[0] == 0x00 && (stristr(szLine, "WORLDSAVE=") == szLine) ) { memcpy(&szScriptPath[0], &szLine[9], strlen(szLine) - 9); *************** *** 1413,1417 **** else { ! if (strstr(szLine, "SCPFILES=") == szLine) { memcpy(&szScriptPath[0], &szLine[9], strlen(szLine) - 9); --- 1421,1425 ---- else { ! if (stristr(szLine, "SCPFILES=") == szLine) { memcpy(&szScriptPath[0], &szLine[9], strlen(szLine) - 9); *************** *** 1529,1533 **** if (szLine[0] != 0x00) { ! if (strstr(szLine, "SCPFILES=") == szLine) { memcpy(&szScriptPath[0], &szLine[9], strlen(szLine) - 9); --- 1537,1541 ---- if (szLine[0] != 0x00) { ! if (stristr(szLine, "SCPFILES=") == szLine) { memcpy(&szScriptPath[0], &szLine[9], strlen(szLine) - 9); *************** *** 2041,2045 **** if (szLine[0] != 0x00) { ! if (strstr(szLine, "WORLDSAVE=") == szLine && ( strlen(szLine) > 10 )) { //memset(&szPath[0], 0x00, sizeof(szPath)); --- 2049,2053 ---- if (szLine[0] != 0x00) { ! if (stristr(szLine, "WORLDSAVE=") == szLine && ( strlen(szLine) > 10 )) { //memset(&szPath[0], 0x00, sizeof(szPath)); *************** *** 2105,2116 **** //the other problem is spawnpoint don't appear only as i_worldgem_bit as I can see they might be i_pet_somewhat - maybe problem //I use the flag bWorldGem which is init above ! if ( (strstr(szLine, "[WORLDITEM I_WORLDGEM_BIT") != NULL ) || (strstr(szLine, "[WORLDITEM I_PET_") != NULL ) || (strstr(szLine, "[WORLDITEM I_SPAWNBIT") != NULL ) ) bWorldGem = TRUE; else if ( strstr(szLine, "[") != NULL ) bWorldGem = FALSE; ! if (strstr(szLine, "P=") == szLine && (strlen(szLine) > 2) && (bWorldGem)) sprintf(szCoords, &szLine[2]); ! if (strstr(szLine, "TYPE=34") != NULL || strstr(szLine, "TYPE=T_SPAWN_CHAR") != NULL || strstr(szLine, "TYPE=034") != NULL || ( strstr(szLine, "DISPID=I_PET_") != NULL && bWorldGem ) ) { // this is a NPC spawn point --- 2113,2124 ---- //the other problem is spawnpoint don't appear only as i_worldgem_bit as I can see they might be i_pet_somewhat - maybe problem //I use the flag bWorldGem which is init above ! if ( (stristr(szLine, "[WORLDITEM I_WORLDGEM_BIT") != NULL ) || (stristr(szLine, "[WORLDITEM I_PET_") != NULL ) || (stristr(szLine, "[WORLDITEM I_SPAWNBIT") != NULL ) ) bWorldGem = TRUE; else if ( strstr(szLine, "[") != NULL ) bWorldGem = FALSE; ! if (stristr(szLine, "P=") == szLine && (strlen(szLine) > 2) && (bWorldGem)) sprintf(szCoords, &szLine[2]); ! if (stristr(szLine, "TYPE=34") != NULL || stristr(szLine, "TYPE=T_SPAWN_CHAR") != NULL || stristr(szLine, "TYPE=034") != NULL || ( stristr(szLine, "DISPID=I_PET_") != NULL && bWorldGem ) ) { // this is a NPC spawn point *************** *** 2150,2165 **** break; } ! if (strstr(szLine, "MORE1=") != NULL && (strlen(szLine) > 6)) sprintf(szID, &szLine[6]); ! if (strstr(szLine, "MORE=") != NULL && (strlen(szLine) > 5)) sprintf(szID, &szLine[5]); ! if (strstr(szLine, "P=") != NULL && (strlen(szLine) > 2)) { ! if (strstr(szLine, "MOREP=") == NULL) sprintf(szCoords, &szLine[2]); } } } ! if (strstr(szLine, "TYPE=69") != NULL || strstr(szLine, "TYPE=T_SPAWN_ITEM") != NULL || strstr(szLine, "TYPE=069") != NULL) { // This is an item spawn point --- 2158,2173 ---- break; } ! if (stristr(szLine, "MORE1=") != NULL && (strlen(szLine) > 6)) sprintf(szID, &szLine[6]); ! if (stristr(szLine, "MORE=") != NULL && (strlen(szLine) > 5)) sprintf(szID, &szLine[5]); ! if (stristr(szLine, "P=") != NULL && (strlen(szLine) > 2)) { ! if (stristr(szLine, "MOREP=") == NULL) sprintf(szCoords, &szLine[2]); } } } ! if (stristr(szLine, "TYPE=69") != NULL || stristr(szLine, "TYPE=T_SPAWN_ITEM") != NULL || stristr(szLine, "TYPE=069") != NULL) { // This is an item spawn point *************** *** 2199,2209 **** break; } ! if (strstr(szLine, "MORE1=") != NULL && (strlen(szLine) > 6)) sprintf(szID, &szLine[6]); ! if (strstr(szLine, "MORE=") != NULL && (strlen(szLine) > 5)) sprintf(szID, &szLine[5]); ! //if (strstr(szLine, "P=") != NULL && (strlen(szLine) > 2)) //{ ! // if (strstr(szLine, "MOREP=") == NULL) // sprintf(szCoords, &szLine[2]); //} --- 2207,2217 ---- break; } ! if (stristr(szLine, "MORE1=") != NULL && (strlen(szLine) > 6)) sprintf(szID, &szLine[6]); ! if (stristr(szLine, "MORE=") != NULL && (strlen(szLine) > 5)) sprintf(szID, &szLine[5]); ! //if (stristr(szLine, "P=") != NULL && (strlen(szLine) > 2)) //{ ! // if (stristr(szLine, "MOREP=") == NULL) // sprintf(szCoords, &szLine[2]); //} *************** *** 2272,2276 **** { fReadLine(pFile, szLine, sizeof(szLine)); ! if ( strstr(szLine, "[RESOURCES]") != NULL ) { bInResources = TRUE; --- 2280,2284 ---- { fReadLine(pFile, szLine, sizeof(szLine)); ! if ( stristr(szLine, "[RESOURCES]") != NULL ) { bInResources = TRUE; *************** *** 2575,2584 **** } // First check the IP Address against the test host ! if ( strstr(pszIPAddr, pszTestHost) != NULL ) return 1; // Next check the hostname against the test host if ( pHostent != NULL ) { ! if ( strstr(pHostent->h_name, pszTestHost) != NULL ) return 1; } --- 2583,2592 ---- } // First check the IP Address against the test host ! if ( stristr(pszIPAddr, pszTestHost) != NULL ) return 1; // Next check the hostname against the test host if ( pHostent != NULL ) { ! if ( stristr(pHostent->h_name, pszTestHost) != NULL ) return 1; } |