/*
- * $Id: directory.c,v 1.65 2003-03-18 00:20:27 didg Exp $
+ * $Id: directory.c,v 1.66 2003-04-14 18:03:48 didg Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
#ifdef ATACC
int path_isadir(struct path *o_path)
{
+ return o_path->dir != NULL;
+#if 0
return o_path->m_name == '\0' || /* we are in a it */
!o_path->st_valid || /* in cache but we can't chdir in it */
(!o_path->st_errno && S_ISDIR(o_path->st.st_mode)); /* not in cache an can't chdir */
+#endif
}
#endif
struct path *path;
{
path->u_name = mtoupath(vol, path->m_name, utf8_encoding() );
+ path->dir = NULL;
if ( path->u_name == NULL) {
afp_errno = AFPERR_PARAM;
return( NULL );
}
+ path->dir = dir;
if ( movecwd( vol, dir ) < 0 ) {
return( NULL );
}
ret.m_name = path;
ret.st_errno = 0;
ret.st_valid = 0;
+ ret.dir = NULL;
for ( ;; ) {
if ( len == 0 ) {
if (movecwd( vol, dir ) < 0 ) {
}
ret.m_name = dir->d_m_name;
ret.u_name = dir->d_u_name;
+ ret.dir = dir;
return &ret;
} else if (afp_errno == AFPERR_NOOBJ) {
if ( movecwd( vol, dir->d_parent ) < 0 ) {
}
if (*path == '\0') {
ret.u_name = ".";
+ ret.dir = dir;
}
return &ret;
}
/*
- * $Id: directory.h,v 1.11 2003-03-09 19:55:34 didg Exp $
+ * $Id: directory.h,v 1.12 2003-04-14 18:03:49 didg Exp $
*
* Copyright (c) 1990,1991 Regents of The University of Michigan.
* All Rights Reserved.
};
struct path {
- int m_type;
- char *m_name; /* mac name */
+ int m_type; /* mac name type (long name, unicode */
+ char *m_name; /* mac name */
char *u_name; /* unix name */
-
- int st_valid;
+ struct dir *dir; /* */
+ int st_valid; /* does st_errno and st set */
int st_errno;
struct stat st;
};
#ifndef ATACC
static __inline__ int path_isadir(struct path *o_path)
{
+ return o_path->dir != NULL;
+#if 0
return o_path->m_name == '\0' || /* we are in a it */
!o_path->st_valid || /* in cache but we can't chdir in it */
(!o_path->st_errno && S_ISDIR(o_path->st.st_mode)); /* not in cache an can't chdir */
+#endif
}
#else
extern int path_isadir(struct path *o_path);
/*
- * $Id: filedir.c,v 1.43 2003-03-15 01:34:35 didg Exp $
+ * $Id: filedir.c,v 1.44 2003-04-14 18:03:49 didg Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
buflen = 0;
if (S_ISDIR(st->st_mode)) {
if (dbitmap) {
- dir = dirsearch_byname(curdir, s_path->u_name);
+ dir = s_path->dir;
if (!dir)
return AFPERR_NOOBJ;
if ( *path->m_name != '\0' ) {
strcpy(oldname, path->m_name); /* an extra copy for of_rename */
if (isdir) {
- /* curdir parent dir, need to move sdir back
- * FIXME search by unix name or mac name?
- */
- sdir = dirsearch_byname(curdir, path->u_name);
- if (!sdir)
- return AFPERR_NOOBJ;
+ /* curdir parent dir, need to move sdir back */
+ sdir = path->dir;
}
}
else {
isdir = path_isadir(path);
if ( *path->m_name != '\0' ) {
if (isdir) {
- sdir = dirsearch_byname(curdir, path->u_name);
- if (!sdir)
- return AFPERR_NOOBJ;
+ sdir = path->dir;
}
strcpy(oldname, path->m_name); /* an extra copy for of_rename */
} else {