Update Windows strcmpi call
[openafs.git] / src / WINNT / client_config / cellservdb.c
index 47b4d23..55d472c 100644 (file)
 #include <memory.h>
 #include <malloc.h>
 #include "cellservdb.h"
+#include <afs/cm_config.h>
 
-#ifdef AFS_NT40_ENV
 #include <windows.h>
 #include <winsock2.h>
-#else
-#include <sys/socket.h>
-#endif
-
 
 /*
  * PROTOTYPES _________________________________________________________________
@@ -66,21 +62,7 @@ static void strzcpy (char *pszTarget, const char *pszSource, size_t cch)
 
 void CSDB_GetFileName (char *pszFilename)
 {
-#ifdef AFS_NT40_ENV
-   /* Find the appropriate CellServDB */
-    char * clientdir = 0;
-       afssw_GetClientInstallDir(&clientdir);
-       if (clientdir) {
-               strncpy(pszFilename, clientdir, MAX_CSDB_PATH);
-               pszFilename[MAX_CSDB_PATH - 1] = '\0';
-       }
-    if (pszFilename[ strlen(pszFilename)-1 ] != '\\')
-      strcat (pszFilename, "\\");
-
-   strcat (pszFilename, "CellServDB");
-#else
-   strcpy (pszFilename, "/usr/vice/etc/CellServDB");
-#endif
+    cm_GetCellServDB(pszFilename, MAX_CSDB_PATH);
 }
 
 
@@ -174,11 +156,7 @@ BOOL CSDB_WriteFile (PCELLSERVDB pCellServDB)
          {
          for (pLine = pCellServDB->pFirst; pLine; pLine = pLine->pNext)
             {
-#ifdef AFS_NT40_ENV
             sprintf (szLine, "%s\r\n", pLine->szLine);
-#else
-            sprintf (szLine, "%s\n", pLine->szLine);
-#endif
             fwrite (szLine, 1, strlen(szLine), pFile);
             }
 
@@ -299,7 +277,7 @@ PCELLDBLINE CSDB_FindCell (PCELLSERVDB pCellServDB, const char *pszCell)
       CELLDBLINEINFO Info;
       if (!CSDB_CrackLine (&Info, pLine->szLine))
          continue;
-      if (!strcmpi (Info.szCell, pszCell))
+      if (!_stricmp (Info.szCell, pszCell))
          return pLine;
       }
    return NULL;