/*
- * $Id: file.c,v 1.68 2002-10-25 11:10:48 didg Exp $
+ * $Id: file.c,v 1.71 2003-01-11 17:26:06 jmarcus Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
return data;
}
-/*
- * FIXME: PDINFO is UTF8 and doesn't need adp
+/* ---------------------
*/
-#define PARAM_NEED_ADP(b) ((b) & ((1 << FILPBIT_ATTR) |\
- (1 << FILPBIT_CDATE) |\
- (1 << FILPBIT_MDATE) |\
- (1 << FILPBIT_BDATE) |\
- (1 << FILPBIT_FINFO) |\
- (1 << FILPBIT_RFLEN) |\
- (1 << FILPBIT_EXTRFLEN) |\
- (1 << FILPBIT_PDINFO)))
-
-
char *set_name(char *data, const char *name, u_int32_t utf8)
{
u_int32_t aint;
aint = strlen( name );
if (!utf8) {
+ if (afp_version >= 30) {
+ /* the name is in utf8 */
+ }
if (aint > MACFILELEN)
aint = MACFILELEN;
*data++ = aint;
return data;
}
+/*
+ * FIXME: PDINFO is UTF8 and doesn't need adp
+*/
+#define PARAM_NEED_ADP(b) ((b) & ((1 << FILPBIT_ATTR) |\
+ (1 << FILPBIT_CDATE) |\
+ (1 << FILPBIT_MDATE) |\
+ (1 << FILPBIT_BDATE) |\
+ (1 << FILPBIT_FINFO) |\
+ (1 << FILPBIT_RFLEN) |\
+ (1 << FILPBIT_EXTRFLEN) |\
+ (1 << FILPBIT_PDINFO)))
+
+
/* -------------------------- */
int getmetadata(struct vol *vol,
u_int16_t bitmap,
us what the PD file code should be. Everything gets a
subtype of 0x0000 unless the original value was hashed
to "pXYZ" when we created it. See IA, Ver 2.
- <shirsch@ibm.net> */
+ <shirsch@adelphia.net> */
case FILPBIT_PDINFO :
if (afp_version >= 30) { /* UTF8 name */
utf8 = kTextEncodingUTF8;
ibuf += sizeof( did );
if (( dir = dirlookup( vol, did )) == NULL ) {
- return( AFPERR_NOOBJ );
+ return afp_errno;
}
if (( s_path = cname( vol, dir, &ibuf )) == NULL ) {
- return( AFPERR_NOOBJ );
+ return afp_errno;
}
if ( *s_path->m_name == '\0' ) {
ibuf += sizeof( bitmap );
if (( s_path = cname( vol, dir, &ibuf )) == NULL ) {
- return( AFPERR_NOOBJ );
+ return afp_errno;
}
if ( *s_path->m_name == '\0' ) {
break;
/* Client needs to set the ProDOS file info for this file.
- Use defined strings for the simple cases, and convert
- all else into pXYY per Inside Appletalk. Always set
- the creator as "pdos". <shirsch@ibm.net> */
+ Use a defined string for TEXT to support crlf
+ translations and convert all else into pXYY per Inside
+ Appletalk. Always set the creator as "pdos". Changes
+ from original by Marsha Jackson. */
case FILPBIT_PDINFO :
achar = *buf;
buf += 2;
- memcpy(&ashort, buf, sizeof( ashort ));
- ashort = ntohs( ashort );
- buf += 2;
-
- switch ( (unsigned int) achar )
- {
- case 0x04 :
- fdType = ( u_char *) "TEXT";
- break;
-
- case 0xff :
- fdType = ( u_char *) "PSYS";
- break;
-
- case 0xb3 :
- fdType = ( u_char *) "PS16";
- break;
-
- case 0x00 :
- fdType = ( u_char *) "BINA";
- break;
-
- default :
- xyy[0] = ( u_char ) 'p';
- xyy[1] = achar;
- xyy[2] = ( u_char ) ( ashort >> 8 ) & 0xff;
- xyy[3] = ( u_char ) ashort & 0xff;
- fdType = xyy;
- break;
- }
-
+ /* Keep special case to support crlf translations */
+ if ((unsigned int) achar == 0x04) {
+ fdType = (u_char *)"TEXT";
+ buf += 2;
+ } else {
+ xyy[0] = ( u_char ) 'p';
+ xyy[1] = achar;
+ xyy[3] = *buf++;
+ xyy[2] = *buf++;
+ fdType = xyy;
+ }
memcpy(ad_entry( adp, ADEID_FINDERI ), fdType, 4 );
memcpy(ad_entry( adp, ADEID_FINDERI ) + 4, "pdos", 4 );
break;
LOG(log_info, logtype_afpd, "begin renamefile:");
#endif /* DEBUG */
- if ( rename( src, dst ) < 0 ) {
+ if ( unix_rename( src, dst ) < 0 ) {
switch ( errno ) {
case ENOENT :
return( AFPERR_NOOBJ );
strcpy( adsrc, ad_path( src, 0 ));
rc = 0;
rename_retry:
- if (rename( adsrc, ad_path( dst, 0 )) < 0 ) {
+ if (unix_rename( adsrc, ad_path( dst, 0 )) < 0 ) {
struct stat st;
switch ( errno ) {
memcpy(&sdid, ibuf, sizeof( sdid ));
ibuf += sizeof( sdid );
if (( dir = dirlookup( vol, sdid )) == NULL ) {
- return( AFPERR_PARAM );
+ return afp_errno;
}
memcpy(&dvid, ibuf, sizeof( dvid ));
ibuf += sizeof( ddid );
if (( s_path = cname( vol, dir, &ibuf )) == NULL ) {
- return( AFPERR_NOOBJ );
+ return afp_errno;
}
if ( *s_path->m_name == '\0' ) {
return( AFPERR_BADTYPE );
return AFPERR_VLOCK;
if (( dir = dirlookup( vol, ddid )) == NULL ) {
- return( AFPERR_PARAM );
+ return afp_errno;
}
if (( s_path = cname( vol, dir, &ibuf )) == NULL ) {
- return( AFPERR_NOOBJ );
+ return afp_errno;
}
if ( *s_path->m_name != '\0' ) {
return( AFPERR_BADTYPE ); /* not a directory. AFPERR_PARAM? */