#include <string.h>
#include "cm_config.h"
+#include <WINNT\afssw.h>
#ifdef AFS_AFSDB_ENV
#include "cm_dns.h"
#include <afs/afsint.h>
"SYSTEM\\CurrentControlSet\\Services\\TransarcAFSDaemon\\Parameters";
/* TODO: these should be pulled in from dirpath.h */
+#if !defined(DJGPP) && !defined(AFS_WIN95_ENV)
#define AFS_THISCELL "ThisCell"
+#endif
#define AFS_CELLSERVDB_UNIX "CellServDB"
#define AFS_CELLSERVDB_NT "afsdcell.ini"
#ifndef AFSDIR_CLIENT_ETC_DIRPATH
extern int errno;
#endif /* DJGPP */
#else
-#define AFS_CELLSERVDB AFS_CELLSERVDB_NT
+#define AFS_CELLSERVDB AFS_CELLSERVDB_UNIX
#endif /* DJGPP || WIN95 */
#ifdef DEBUG
{
char wdir[257];
int tlen;
- FILE *tfilep, *bestp, *tempp;
+ FILE *tfilep = NULL, *bestp, *tempp;
char *tp;
char lineBuffer[257];
struct hostent *thp;
char *valuep;
struct sockaddr_in vlSockAddr;
int inRightCell;
- int foundCell;
+ int foundCell = 0;
long code;
int tracking = 1, partial = 0;
#if defined(DJGPP) || defined(AFS_WIN95_ENV)
char *afsconf_path;
#endif
- foundCell = 0;
-
#if !defined(DJGPP)
- code = GetWindowsDirectory(wdir, sizeof(wdir));
- if (code == 0 || code > sizeof(wdir))
- return -1;
+ strcpy(wdir, AFSDIR_CLIENT_ETC_DIRPATH);
- /* add trailing backslash, if required */
+ /* add trailing backslash, if required */
tlen = strlen(wdir);
if (wdir[tlen-1] != '\\') strcat(wdir, "\\");
#else
#endif /* !DJGPP */
strcat(wdir, AFS_CELLSERVDB);
-
tfilep = fopen(wdir, "r");
#if defined(DJGPP) || defined(AFS_WIN95_ENV)
else
strcpy(wdir, afsconf_path);
strcat(wdir, "/");
- strcat(wdir, AFS_CELLSERVDB_UNIX);
+ strcat(wdir, AFS_CELLSERVDB);
/*fprintf(stderr, "opening cellservdb file %s\n", wdir);*/
tfilep = fopen(wdir, "r");
if (!tfilep) return -2;
FILE *tfilep;
#if !defined(DJGPP) && !defined(AFS_WIN95_ENV)
- code = GetWindowsDirectory(wdir, sizeof(wdir));
- if (code == 0 || code > sizeof(wdir))
- return 0;
+ strcpy(wdir, AFSDIR_CLIENT_ETC_DIRPATH);
/* add trailing backslash, if required */
tlen = strlen(wdir);
closeCode = fclose((FILE *)filep);
#if !defined(DJGPP) && !defined(AFS_WIN95_ENV)
- code = GetWindowsDirectory(wdir, sizeof(wdir));
- if (code == 0 || code > sizeof(wdir))
- return closeCode;
+ strcpy(wdir, AFSDIR_CLIENT_ETC_DIRPATH);
/* add trailing backslash, if required */
- tlen = strlen(wdir);
- if (wdir[tlen-1] != '\\') strcat(wdir, "\\");
+ tlen = strlen(wdir);
+ if (wdir[tlen-1] != '\\') strcat(wdir, "\\");
#else
#ifdef DJGPP
- strcpy(wdir,cm_confDir);
+ strcpy(wdir,cm_confDir);
#else
- afsconf_path = getenv("AFSCONF");
- if (!afsconf_path)
- strcpy(wdir, AFSDIR_CLIENT_ETC_DIRPATH);
- else
- strcpy(wdir, afsconf_path);
+ afsconf_path = getenv("AFSCONF");
+ if (!afsconf_path)
+ strcpy(wdir, AFSDIR_CLIENT_ETC_DIRPATH);
+ else
+ strcpy(wdir, afsconf_path);
#endif /* !DJGPP */
- strcat(wdir,"/");
+ strcat(wdir,"/");
#endif /* DJGPP || WIN95 */
- strcpy(sdir, wdir);
+ strcpy(sdir, wdir);
if (closeCode != 0) {
/* something went wrong, preserve original database */
- strcat(wdir, "afsdcel2.ini");
- unlink(wdir);
- return closeCode;
- }
+ strcat(wdir, "afsdcel2.ini");
+ unlink(wdir);
+ return closeCode;
+ }
- strcat(wdir, AFS_CELLSERVDB);
- strcat(sdir, "afsdcel2.ini"); /* new file */
-
- unlink(wdir); /* delete old file */
-
- code = rename(sdir, wdir); /* do the rename */
-
- if (code)
- code = errno;
-
- return code;
-}
+ strcat(wdir, AFS_CELLSERVDB);
+ strcat(sdir, "afsdcel2.ini"); /* new file */
+
+ unlink(wdir); /* delete old file */
+
+ code = rename(sdir, wdir); /* do the rename */
+
+ if (code)
+ code = errno;
+
+ return code;
+}
void cm_GetConfigDir(char *dir)
{
#endif
#if !defined(DJGPP) && !defined(AFS_WIN95_ENV)
- code = GetWindowsDirectory(wdir, sizeof(wdir));
- if (code == 0 || code > sizeof(wdir)) wdir[0] = 0;
+ strcpy(wdir, AFSDIR_CLIENT_ETC_DIRPATH);
/* add trailing backslash, if required */
- tlen = strlen(wdir);
- if (wdir[tlen-1] != '\\') strcat(wdir, "\\");
+ tlen = strlen(wdir);
+ if (wdir[tlen-1] != '\\') strcat(wdir, "\\");
#else
#ifdef DJGPP
- strcpy(wdir,cm_confDir);
+ strcpy(wdir,cm_confDir);
#else
- afsconf_path = getenv("AFSCONF");
- if (!afsconf_path)
- strcpy(wdir, AFSDIR_CLIENT_ETC_DIRPATH);
- else
- strcpy(wdir, afsconf_path);
+ afsconf_path = getenv("AFSCONF");
+ if (!afsconf_path)
+ strcpy(wdir, AFSDIR_CLIENT_ETC_DIRPATH);
+ else
+ strcpy(wdir, afsconf_path);
#endif /* !DJGPP */
- strcat(wdir,"\\");
+ strcat(wdir,"\\");
#endif /* DJGPP || WIN95 */
- strcpy(dir, wdir);
+ strcpy(dir, wdir);
}