#endif
if (wpath) {
strcpy(pbuf, pbuffer);
- ptr = (char *)strrchr(pbuf, '/');
+ ptr = (char *)strrchr(pbuf, OS_DIRSEPC);
if (ptr) {
*ptr = '\0';
strcpy(wpath, pbuf);
} else
return NULL;
}
- ptr = (char *)strrchr(pbuffer, '/');
+ ptr = (char *)strrchr(pbuffer, OS_DIRSEPC);
if (ptr) {
strcpy(pbuffer, ptr + 1);
return pbuffer;
i = strlen(devfile);
while (i >= 0) {
strcpy(rawname, devfile);
- if (devfile[i] == '/') {
+ if (devfile[i] == OS_DIRSEPC) {
rawname[i + 1] = 'r';
rawname[i + 2] = 0;
strcat(rawname, &devfile[i + 1]);
if (!code && S_ISCHR(statbuf.st_mode))
return rawname;
- while ((--i >= 0) && (devfile[i] != '/'));
+ while ((--i >= 0) && (devfile[i] != OS_DIRSEPC));
}
return NULL;
VDeregisterVolOp_r(vp);
}
#else /* !AFS_DEMAND_ATTACH_FS */
- tvolName[0] = '/';
+ tvolName[0] = OS_DIRSEPC;
snprintf(&tvolName[1], sizeof(tvolName)-1, VFORMAT, afs_printable_uint32_lu(vcom->vop->volume));
tvolName[sizeof(tvolName)-1] = '\0';
Volume *vp;
- tvolName[0] = '/';
+ tvolName[0] = OS_DIRSEPC;
sprintf(&tvolName[1], VFORMAT, afs_printable_uint32_lu(p[i].volumeID));
vp = VAttachVolumeByName_r(&error, p[i].partName, tvolName,
V_VOLUPD);
{
char pbuf[128], *ptr;
strcpy(pbuf, pbuffer);
- ptr = (char *)strrchr(pbuf, '/');
+ ptr = (char *)strrchr(pbuf, OS_DIRSEPC);
if (ptr) {
*ptr = '\0';
strcpy(wpath, pbuf);
} else
return NULL;
- ptr = (char *)strrchr(pbuffer, '/');
+ ptr = (char *)strrchr(pbuffer, OS_DIRSEPC);
if (ptr) {
strcpy(pbuffer, ptr + 1);
return pbuffer;
int i;
*created = 0;
- afs_snprintf(tmp, 256, "%s\\%s", name->n_drive, name->n_voldir);
+ afs_snprintf(tmp, 256, "%s" OS_DIRSEP "%s", name->n_drive, name->n_voldir);
if (mkdir(tmp) < 0) {
if (errno != EEXIST)
s = tmp;
s += strlen(tmp);
- *s++ = '\\';
+ *s++ = OS_DIRSEPC;
*(s + 1) = '\0';
for (i = 'A'; i <= 'R'; i++) {
*s = (char)i;
#define create_nextdir(A) \
do { \
- strcat(tmp, "/"); strcat(tmp, A); create_dir(); \
+ strcat(tmp, OS_DIRSEP); strcat(tmp, A); create_dir(); \
} while(0)
static int
if (*tree) {
/* delete the children first */
- cp = strchr(tree, '/');
+ cp = strchr(tree, OS_DIRSEPC);
if (cp) {
delTree(root, cp + 1, errp);
*cp = '\0';
/* since root is big enough, we reuse the space to
* concatenate the dirname to the current tree
*/
- strcat(root, "/");
+ strcat(root, OS_DIRSEP);
strcat(root, dirp->d_name);
if (afs_stat(root, &st) == 0 && S_ISDIR(st.st_mode)) {
/* delete this subtree */
char tmp[256];
int i;
- afs_snprintf(tmp, 256, "%s\\%s", name->n_drive, name->n_voldir);
+ afs_snprintf(tmp, 256, "%s" OS_DIRSEP "%s", name->n_drive, name->n_voldir);
path = tmp;
path += strlen(path);
- *path++ = '\\';
+ *path++ = OS_DIRSEPC;
*(path + 1) = '\0';
for (i = 'A'; i <= 'R'; i++) {
*path = (char)i;
dp2->d_name);
#else
/* Now we've got to the actual data */
- afs_snprintf(path3, sizeof(path3), "%s\\%s", path1,
+ afs_snprintf(path3, sizeof(path3), "%s" OS_DIRSEP "%s", path1,
dp1->d_name);
#endif
dirp3 = opendir(path3);
FdHandle_t linkHandle;
char dirl;
- afs_snprintf(fpath, sizeof(fpath), "%s\\%s", dpath, name);
+ afs_snprintf(fpath, sizeof(fpath), "%s" OS_DIRSEP "%s", dpath, name);
dirH = FindFirstFileEx(fpath, FindExInfoStandard, &data,
FindExSearchNameMatch, NULL,
else {
/* Open this handle */
char lpath[1024];
- (void)sprintf(lpath, "%s\\%s", fpath, data.cFileName);
- linkHandle.fd_fd = nt_open(lpath, O_RDONLY, 0666);
+ (void)sprintf(lpath, "%s" OS_DIRSEP "%s", fpath, data.cFileName);
+ linkHandle.fd_fd = afs_open(lpath, O_RDONLY, 0666);
info->linkCount =
namei_GetLinkCount(&linkHandle, (Inode) 0, 0, 0, 0);
}
namei_GetLinkCount(&linkHandle, info->inodeNumber, 0, 0, 0);
if (info->linkCount == 0) {
#ifdef DELETE_ZLC
- Log("Found 0 link count file %s\\%s, deleting it.\n",
+ Log("Found 0 link count file %s" OS_DIRSEP "%s, deleting it.\n",
fpath, data.cFileName);
AddToZLCDeleteList(dirl, data.cFileName);
#else
- Log("Found 0 link count file %s\\%s.\n", path,
+ Log("Found 0 link count file %s" OS_DIRSEP "%s.\n", path,
data.cFileName);
#endif
} else {
}
if (dir)
- (void)sprintf(zlcCur->zlc_names[zlcCur->zlc_n], "%c\\%s", dir, name);
+ (void)sprintf(zlcCur->zlc_names[zlcCur->zlc_n], "%c" OS_DIRSEP "%s", dir, name);
else
(void)sprintf(zlcCur->zlc_names[zlcCur->zlc_n], "%s", name);
for (z = zlcAnchor; z; z = z->zlc_next) {
for (i = 0; i < z->zlc_n; i++) {
if (path)
- (void)sprintf(fname, "%s\\%s", path, z->zlc_names[i]);
+ (void)sprintf(fname, "%s" OS_DIRSEP "%s", path, z->zlc_names[i]);
else
(void)sprintf(fname, "%s", z->zlc_names[i]);
if (namei_unlink(fname) < 0) {
strcpy(devName, tfile); /* save this from the static buffer */
}
/* aim lastDevComp at the 'foo' of '/dev/foo' */
- lastDevComp = strrchr(devName, '/');
+ lastDevComp = strrchr(devName, OS_DIRSEPC);
/* either points at slash, or there is no slash; adjust appropriately */
if (lastDevComp)
lastDevComp++;
/* Create a lockfile for the partition, of the form /vicepa/Lock/vicepa */
dp->devName = (char *)malloc(2 * strlen(path) + 6);
strcpy(dp->devName, path);
- strcat(dp->devName, "/");
+ strcat(dp->devName, OS_DIRSEP);
strcat(dp->devName, "Lock");
mkdir(dp->devName, 0700);
strcat(dp->devName, path);
}
strncpy(checkfile, part, 100);
- strcat(checkfile, "/");
+ strcat(checkfile, OS_DIRSEP);
strcat(checkfile, VICE_ALWAYSATTACH_FILE);
ret = afs_stat(checkfile, &st);
char pname[32];
int wouldattach;
- dirp = opendir("/");
+ dirp = opendir(OS_DIRSEP);
while ((de = readdir(dirp))) {
- strcpy(pname, "/");
+ strcpy(pname, OS_DIRSEP);
strncat(pname, de->d_name, 20);
pname[sizeof(pname) - 1] = '\0';
perror("pwd");
exit(1);
}
- p = strchr(&partName[1], '/');
+ p = strchr(&partName[1], OS_DIRSEPC);
if (p) {
tmp = *p;
*p = '\0';
ShowLog = 0;
for (fd = 0; fd < 16; fd++)
close(fd);
- open("/", 0);
+ open(OS_DIRSEP, 0);
dup2(0, 1);
dup2(0, 2);
#ifndef AFS_NT40_ENV
{
char pbuf[128], *ptr;
strcpy(pbuf, pbuffer);
- ptr = (char *)strrchr(pbuf, '/');
+ ptr = (char *)strrchr(pbuf, OS_DIRSEPC);
if (ptr) {
*ptr = '\0';
strcpy(wpath, pbuf);
} else
return NULL;
- ptr = (char *)strrchr(pbuffer, '/');
+ ptr = (char *)strrchr(pbuffer, OS_DIRSEPC);
if (ptr) {
strcpy(pbuffer, ptr + 1);
return pbuffer;
#ifdef AFS_NT40_ENV
/* Opendir can fail on "C:" but not on "C:\" if C is empty! */
- (void)sprintf(fileSysPath, "%s\\", fileSysPathName);
+ (void)sprintf(fileSysPath, "%s" OS_DIRSEP, fileSysPathName);
name = partP->devName;
#else
fileSysPath = fileSysPathName;
char npath[1024];
Log("Removing old salvager temp files %s\n", dp->d_name);
strcpy(npath, fileSysPath);
- strcat(npath, "/");
+ strcat(npath, OS_DIRSEP);
strcat(npath, dp->d_name);
unlink(npath);
}
(void)_putenv("TMP="); /* If "TMP" is set, then that overrides tdir. */
(void)strncpy(inodeListPath, _tempnam(tdir, "salvage.inodes."), 255);
#else
- snprintf(inodeListPath, 255, "%s/salvage.inodes.%s.%d", tdir, name,
+ snprintf(inodeListPath, 255, "%s" OS_DIRSEP "salvage.inodes.%s.%d", tdir, name,
getpid());
#endif
(void)strcpy(summaryFileName, _tempnam(tdir, "salvage.temp"));
#else
(void)afs_snprintf(summaryFileName, sizeof summaryFileName,
- "%s/salvage.temp.%d", tdir, getpid());
+ "%s" OS_DIRSEP "salvage.temp.%d", tdir, getpid());
#endif
summaryFile = afs_fopen(summaryFileName, "a+");
if (summaryFile == NULL) {
/* check if the header file is incorrectly named */
int badname = 0;
- const char *base = strrchr(name, '/');
+ const char *base = strrchr(name, OS_DIRSEPC);
if (base) {
base++;
} else {
}
if (vp->parent && vp->name && (parentvp = CheckVnodeNumber(vp->parent))
&& GetDirName(vp->parent, parentvp, path)) {
- strcat(path, "/");
+ strcat(path, OS_DIRSEP);
strcat(path, vp->name);
return path;
}
VOL_UNLOCK;
- strcat(path, "/");
+ strcat(path, OS_DIRSEP);
strcat(path, name);
if (!vp) {
VOL_UNLOCK;
- strcat(path, "/");
+ strcat(path, OS_DIRSEP);
strcat(path, name);
/* do volume attach
struct DiskPartition64 *dp;
*ec = 0;
- name[0] = '/';
+ name[0] = OS_DIRSEPC;
(void)afs_snprintf(&name[1], (sizeof name) - 1, VFORMAT, afs_printable_uint32_lu(volumeId));
for (dp = DiskPartitionList; dp; dp = dp->next) {
struct afs_stat status;
* @return volume number
*
* @note the string must be of the form VFORMAT. the only permissible
- * deviation is a leading '/' character.
+ * deviation is a leading OS_DIRSEPC character.
*
* @see VFORMAT
*/
int
VolumeNumber(char *name)
{
- if (*name == '/')
+ if (*name == OS_DIRSEPC)
name++;
return atoi(name + 1);
}