/*
- * $Id: desktop.c,v 1.26.2.4.2.10 2004-03-11 02:01:59 didg Exp $
+ * $Id: desktop.c,v 1.26.2.4.2.11 2004-03-11 16:16:40 didg Exp $
*
* See COPYRIGHT.
*
} else {
name = path->m_name;
}
- ad_setentrylen( adp, ADEID_NAME, strlen( name ));
- memcpy( ad_entry( adp, ADEID_NAME ), name,
- ad_getentrylen( adp, ADEID_NAME ));
+ ad_setname(adp, name);
}
ad_setentrylen( adp, ADEID_COMMENT, clen );
/*
- * $Id: directory.c,v 1.71.2.4.2.11 2004-03-11 02:01:59 didg Exp $
+ * $Id: directory.c,v 1.71.2.4.2.12 2004-03-11 16:16:40 didg Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
* Check to see if a create was necessary. If it was, we'll want
* to set our name, etc.
*/
- if ( (ad_get_HF_flags( &ad ) & O_CREAT) && ad_getentryoff(&ad, ADEID_NAME)) {
- ad_setentrylen( &ad, ADEID_NAME, strlen( curdir->d_m_name ));
- memcpy( ad_entry( &ad, ADEID_NAME ), curdir->d_m_name,
- ad_getentrylen( &ad, ADEID_NAME ));
+ if ( (ad_get_HF_flags( &ad ) & O_CREAT)) {
+ ad_setname(&ad, curdir->d_m_name);
}
}
goto createdir_done;
return( AFPERR_ACCESS );
}
-
- if (ad_getentryoff(&ad, ADEID_NAME)) {
- ad_setentrylen( &ad, ADEID_NAME, strlen( s_path->m_name ));
- memcpy( ad_entry( &ad, ADEID_NAME ), s_path->m_name,
- ad_getentrylen( &ad, ADEID_NAME ));
- }
+ ad_setname(&ad, s_path->m_name);
ad_setid( &ad, (vol->v_flags & AFPVOL_NODEV)?0:s_path->st.st_dev,
s_path->st.st_ino, dir->d_did, did, vol->v_stamp);
ad_init(&ad, vol->v_adouble);
if (!ad_open( dst, ADFLAGS_HF|ADFLAGS_DIR, O_RDWR, 0, &ad)) {
- if (ad_getentryoff(&ad, ADEID_NAME)) {
- ad_setentrylen( &ad, ADEID_NAME, len );
- memcpy( ad_entry( &ad, ADEID_NAME ), newname, len );
- }
+ ad_setname(&ad, newname);
ad_flush( &ad, ADFLAGS_HF );
ad_close( &ad, ADFLAGS_HF );
}
/*
- * $Id: file.c,v 1.92.2.2.2.19 2004-03-11 12:47:59 didg Exp $
+ * $Id: file.c,v 1.92.2.2.2.20 2004-03-11 16:16:40 didg Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
}
path = s_path->m_name;
- if (ad_getentryoff(adp, ADEID_NAME)) {
- ad_setentrylen( adp, ADEID_NAME, strlen( path ));
- memcpy(ad_entry( adp, ADEID_NAME ), path, ad_getentrylen( adp, ADEID_NAME ));
- }
+ ad_setname(adp, path);
ad_flush( adp, ADFLAGS_DF|ADFLAGS_HF );
ad_close( adp, ADFLAGS_DF|ADFLAGS_HF );
return vol_noadouble(vol) ? AFP_OK : AFPERR_ACCESS;
}
isad = 0;
- } else if (ad_getentryoff(adp, ADEID_NAME) && (ad_get_HF_flags( adp ) & O_CREAT) ) {
- ad_setentrylen( adp, ADEID_NAME, strlen( path->m_name ));
- memcpy(ad_entry( adp, ADEID_NAME ), path->m_name,
- ad_getentrylen( adp, ADEID_NAME ));
+ } else if ((ad_get_HF_flags( adp ) & O_CREAT) ) {
+ ad_setname(adp, path->m_name);
}
while ( bitmap != 0 ) {
struct adouble *adp;
{
char adsrc[ MAXPATHLEN + 1];
- int len;
int rc;
#ifdef DEBUG
/* don't care if we can't open the newly renamed ressource fork
*/
if (!ad_open( dst, ADFLAGS_HF, O_RDWR, 0666, adp)) {
- if (ad_getentryoff(adp, ADEID_NAME) ) {
- len = strlen( newname );
- ad_setentrylen( adp, ADEID_NAME, len );
- memcpy(ad_entry( adp, ADEID_NAME ), newname, len );
- }
+ ad_setname(adp, newname);
ad_flush( adp, ADFLAGS_HF );
ad_close( adp, ADFLAGS_HF );
}
char *src, *dst, *newname;
{
struct adouble ads, add;
- int len, err = 0;
+ int err = 0;
int ret_err = 0;
int adflags;
int noadouble = vol_noadouble(d_vol);
}
}
- if (!ret_err && newname && ad_getentryoff(&add, ADEID_NAME)) {
- len = strlen( newname );
- ad_setentrylen( &add, ADEID_NAME, len );
- memcpy(ad_entry( &add, ADEID_NAME ), newname, len );
+ if (!ret_err && newname) {
+ ad_setname(&add, newname);
}
ad_flush( &add, adflags );
/*
- * $Id: fork.c,v 1.51.2.2.2.7 2004-03-11 02:02:01 didg Exp $
+ * $Id: fork.c,v 1.51.2.2.2.8 2004-03-11 16:16:41 didg Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
}
if ((adflags & ADFLAGS_HF) && (ad_get_HF_flags( ofork->of_ad) & O_CREAT)) {
- if (ad_getentryoff(ofork->of_ad, ADEID_NAME)) {
- ad_setentrylen( ofork->of_ad, ADEID_NAME, strlen( path ));
- memcpy(ad_entry( ofork->of_ad, ADEID_NAME ), path,
- ad_getentrylen( ofork->of_ad, ADEID_NAME ));
+ if (ad_setname(ofork->of_ad, path)) {
ad_flush( ofork->of_ad, adflags );
}
}
/*
- * $Id: adouble.h,v 1.21.6.13 2004-03-11 02:02:04 didg Exp $
+ * $Id: adouble.h,v 1.21.6.14 2004-03-11 16:16:41 didg Exp $
* Copyright (c) 1990,1991 Regents of The University of Michigan.
* All Rights Reserved.
*
extern int ad_setattr __P((const struct adouble *, const u_int16_t));
extern int ad_getattr __P((const struct adouble *, u_int16_t *));
+extern int ad_setname __P((const struct adouble *, const char *));
#if AD_VERSION == AD_VERSION2
extern int ad_setid __P((struct adouble *, const dev_t dev,const ino_t ino, const u_int32_t, const u_int32_t, const void *));
#else
/*
- * $Id: ad_attr.c,v 1.4.8.4 2004-03-11 02:02:05 didg Exp $
+ * $Id: ad_attr.c,v 1.4.8.5 2004-03-11 16:16:41 didg Exp $
*/
#ifdef HAVE_CONFIG_H
}
#endif
+
+/* -----------------
+ * set resource fork filename attribute.
+*/
+int ad_setname(const struct adouble *ad, const char *path)
+{
+ if (ad_getentryoff(ad, ADEID_NAME)) {
+ ad_setentrylen( ad, ADEID_NAME, strlen( path ));
+ memcpy(ad_entry( ad, ADEID_NAME ), path, ad_getentrylen( ad, ADEID_NAME ));
+ return 1;
+ }
+ return 0;
+}