/*
* Copyright 2000, International Business Machines Corporation and others.
* All Rights Reserved.
- *
+ *
* This software has been released under the terms of the IBM Public
* License. For details, see the LICENSE file in the top-level source
* directory or online at http://www.openafs.org/dl/license10.html
#include <afsconfig.h>
#include <afs/param.h>
-RCSID
- ("$Header$");
+#include <roken.h>
+#include <afs/opr.h>
#include <stddef.h>
-#include <stdlib.h>
-#include <string.h>
#include <ctype.h>
#include <limits.h>
-#include <errno.h>
-#include <stdio.h>
-#include "assert.h"
+
#include "afsutil.h"
#include "fileutil.h"
+
+#include <afs/opr.h>
+
#ifdef AFS_PTHREAD_ENV
#include <pthread.h>
static pthread_once_t dirInit_once = PTHREAD_ONCE_INIT;
#endif
+
#ifdef AFS_NT40_ENV
-#include <windows.h>
#include <WINNT\afssw.h>
#endif
-#ifdef AFS_DARWIN_ENV
-#include <unistd.h>
-#endif
/* local vars */
/* static storage for path strings */
}
-/* initDirPathArray() -- Initializes the afs dir paths for the
+/* initDirPathArray() -- Initializes the afs dir paths for the
* server and client installations.
*
* For NT these are determined dynamically; for Unix they are static.
FilepathNormalize(ntServerInstallDirShort);
/* get the afs client configuration directory (/usr/vice/etc equivalent) */
- if (afssw_GetClientInstallDir(&buf)) {
+ if (afssw_GetClientCellServDBDir(&buf)) {
/* failed */
status = GetWindowsDirectory(ntClientConfigDirLong, AFSDIR_PATH_MAX);
if (status == 0 || status > AFSDIR_PATH_MAX) {
AFSDIR_CLIENT_DIRPATH(pathp, AFSDIR_CLIENT_ETC_DIR);
#endif /* AFS_NT40_ENV */
+#ifndef AFS_NT40_ENV
+ pathp = dirPathArray[AFSDIR_CLIENT_DATA_DIRPATH_ID];
+#ifdef AFS_DARWIN_ENV
+ if (access(AFSDIR_ALTERNATE_CLIENT_DATA_DIR, F_OK) == 0)
+ AFSDIR_CLIENT_DIRPATH(pathp, AFSDIR_ALTERNATE_CLIENT_DATA_DIR);
+ else
+#endif
+ AFSDIR_CLIENT_DIRPATH(pathp, AFSDIR_DATA_DIR);
+#endif
+
/* server file paths */
pathp = dirPathArray[AFSDIR_SERVER_THISCELL_FILEPATH_ID];
AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_SERVER_ETC_DIR,
pathp = dirPathArray[AFSDIR_SERVER_BOZINIT_FILEPATH_ID];
AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_BOSCONFIG_DIR, AFSDIR_BOZINIT_FILE);
+ pathp = dirPathArray[AFSDIR_SERVER_BOZRXBIND_FILEPATH_ID];
+ AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_BOSCONFIG_DIR, AFSDIR_BOZRXBIND_FILE);
+
pathp = dirPathArray[AFSDIR_SERVER_BOSVR_FILEPATH_ID];
AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_BOSSERVER_DIR, AFSDIR_BOSVR_FILE);
/* getDirPath - returns a const char pointer to the requested string
* from the internal path array.
- * string_id - index into the path array
+ * string_id - index into the path array
*/
const char *
getDirPath(afsdir_id_t string_id)
LocalizePathHead(const char **path, const char **relativeTo)
{
struct canonmapping *map;
-
+
if (**path == '/') {
for (map = CanonicalTranslations; map->local != NULL; map++) {
int canonlength = strlen(map->canonical);
status = EINVAL;
} else {
/* fully qualified path; just make a copy */
- newPath = (char *)malloc(strlen(cpath) + 1);
- if (!newPath) {
+ newPath = strdup(cpath);
+ if (!newPath)
status = ENOMEM;
- } else {
- (void)strcpy(newPath, cpath);
- }
}
} else {
LocalizePathHead(&cpath, &relativeTo);
if (*cpath == '/') {
- newPath = (char *)malloc(strlen(cpath) + 1);
- if (!newPath) {
- status = ENOMEM;
- } else {
- strcpy(newPath, cpath);
- }
+ newPath = strdup(cpath);
} else {
- newPath = (char *)malloc(strlen(relativeTo) + 1 + strlen(cpath) + 1);
- if (!newPath) {
- status = ENOMEM;
- } else {
- sprintf(newPath, "%s/%s", relativeTo, cpath);
- }
+ asprintf(&newPath, "%s/%s", relativeTo, cpath);
}
+ if (newPath == NULL)
+ status = ENOMEM;
if (status == 0) {
FilepathNormalize(newPath);