--- BasiliskII/src/extfs.cpp 1999/10/19 21:33:56 1.2 +++ BasiliskII/src/extfs.cpp 1999/10/21 22:39:51 1.5 @@ -19,16 +19,19 @@ */ /* -TODO: -LockRng -UnlockRng -(CatSearch) -(MakeFSSpec) -(GetVolMountInfoSize) -(GetVolMountInfo) -(GetForeignPrivs) -(SetForeignPrivs) -*/ + * SEE ALSO + * Guide to the File System Manager (from FSM 1.2 SDK) + * + * TODO + * LockRng + * UnlockRng + * (CatSearch) + * (MakeFSSpec) + * (GetVolMountInfoSize) + * (GetVolMountInfo) + * (GetForeignPrivs) + * (SetForeignPrivs) + */ #include "sysdeps.h" @@ -201,14 +204,9 @@ static FSItem *find_fsitem(const char *n const int MAX_PATH_LENGTH = 1024; static char full_path[MAX_PATH_LENGTH]; -static void add_path_component(const char *s) +static void add_path_comp(const char *s) { - int l = strlen(full_path); - if (l < MAX_PATH_LENGTH-1 && full_path[l-1] != '/') { - full_path[l] = '/'; - full_path[l+1] = 0; - } - strncat(full_path, s, MAX_PATH_LENGTH-1); + add_path_component(full_path, s, MAX_PATH_LENGTH); } static void get_path_for_fsitem(FSItem *p) @@ -218,7 +216,7 @@ static void get_path_for_fsitem(FSItem * full_path[MAX_PATH_LENGTH-1] = 0; } else { get_path_for_fsitem(p->parent); - add_path_component(p->name); + add_path_comp(p->name); } } @@ -322,13 +320,23 @@ void ExtFSInit(void) cstr2pstr(FS_NAME, GetString(STR_EXTFS_NAME)); cstr2pstr(VOLUME_NAME, GetString(STR_EXTFS_VOLUME_NAME)); - // Create root FSItem + // Create root's parent FSItem FSItem *p = new FSItem; first_fs_item = last_fs_item = p; p->next = NULL; + p->id = ROOT_PARENT_ID; + p->parent_id = 0; + p->parent = NULL; + p->name[0] = 0; + + // Create root FSItem + p = new FSItem; + last_fs_item->next = p; + p->next = NULL; + last_fs_item = p; p->id = ROOT_ID; p->parent_id = ROOT_PARENT_ID; - p->parent = NULL; + p->parent = first_fs_item; strncpy(p->name, GetString(STR_EXTFS_VOLUME_NAME), 32); // Find path for root @@ -379,15 +387,19 @@ void InstallExtFS(void) r.d[0] = gestaltFSAttr; Execute68kTrap(0xa1ad, &r); // Gestalt() D(bug("FSAttr %ld, %08lx\n", r.d[0], r.a[0])); - if ((r.d[0] & 0xffff) || !(r.a[0] & (1 << gestaltHasFileSystemManager))) + if ((r.d[0] & 0xffff) || !(r.a[0] & (1 << gestaltHasFileSystemManager))) { + printf("WARNING: No FSM present, disabling ExtFS\n"); return; + } // Yes, version >=1.2? r.d[0] = gestaltFSMVersion; Execute68kTrap(0xa1ad, &r); // Gestalt() D(bug("FSMVersion %ld, %08lx\n", r.d[0], r.a[0])); - if ((r.d[0] & 0xffff) || (r.a[0] < 0x0120)) + if ((r.d[0] & 0xffff) || (r.a[0] < 0x0120)) { + printf("WARNING: FSM <1.2 found, disabling ExtFS\n"); return; + } D(bug("FSM present\n")); @@ -423,7 +435,7 @@ void InstallExtFS(void) WriteMacInt16(p, 0x7006); p+= 2; // UTAllocateVCB WriteMacInt16(p, 0xa824); p+= 2; // FSMgr WriteMacInt16(p, 0x301f); p+= 2; // move.w (sp)+,d0 - WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2; + WriteMacInt16(p, M68K_RTS); p+= 2; if (p - fs_data != fsAddNewVCB) goto fsdat_error; WriteMacInt16(p, 0x4267); p+= 2; // clr.w -(sp) @@ -433,7 +445,7 @@ void InstallExtFS(void) WriteMacInt16(p, 0x7007); p+= 2; // UTAddNewVCB WriteMacInt16(p, 0xa824); p+= 2; // FSMgr WriteMacInt16(p, 0x301f); p+= 2; // move.w (sp)+,d0 - WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2; + WriteMacInt16(p, M68K_RTS); p+= 2; if (p - fs_data != fsDetermineVol) goto fsdat_error; WriteMacInt16(p, 0x4267); p+= 2; // clr.w -(sp) @@ -445,7 +457,7 @@ void InstallExtFS(void) WriteMacInt16(p, 0x701d); p+= 2; // UTDetermineVol WriteMacInt16(p, 0xa824); p+= 2; // FSMgr WriteMacInt16(p, 0x301f); p+= 2; // move.w (sp)+,d0 - WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2; + WriteMacInt16(p, M68K_RTS); p+= 2; if (p - fs_data != fsResolveWDCB) goto fsdat_error; WriteMacInt16(p, 0x4267); p+= 2; // clr.w -(sp) @@ -456,7 +468,7 @@ void InstallExtFS(void) WriteMacInt16(p, 0x700e); p+= 2; // UTResolveWDCB WriteMacInt16(p, 0xa824); p+= 2; // FSMgr WriteMacInt16(p, 0x301f); p+= 2; // move.w (sp)+,d0 - WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2; + WriteMacInt16(p, M68K_RTS); p+= 2; if (p - fs_data != fsGetDefaultVol) goto fsdat_error; WriteMacInt16(p, 0x4267); p+= 2; // clr.w -(sp) @@ -464,7 +476,7 @@ void InstallExtFS(void) WriteMacInt16(p, 0x7012); p+= 2; // UTGetDefaultVol WriteMacInt16(p, 0xa824); p+= 2; // FSMgr WriteMacInt16(p, 0x301f); p+= 2; // move.w (sp)+,d0 - WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2; + WriteMacInt16(p, M68K_RTS); p+= 2; if (p - fs_data != fsGetPathComponentName) goto fsdat_error; WriteMacInt16(p, 0x4267); p+= 2; // clr.w -(sp) @@ -472,7 +484,7 @@ void InstallExtFS(void) WriteMacInt16(p, 0x701c); p+= 2; // UTGetPathComponentName WriteMacInt16(p, 0xa824); p+= 2; // FSMgr WriteMacInt16(p, 0x301f); p+= 2; // move.w (sp)+,d0 - WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2; + WriteMacInt16(p, M68K_RTS); p+= 2; if (p - fs_data != fsParsePathname) goto fsdat_error; WriteMacInt16(p, 0x4267); p+= 2; // clr.w -(sp) @@ -481,7 +493,7 @@ void InstallExtFS(void) WriteMacInt16(p, 0x701b); p+= 2; // UTParsePathname WriteMacInt16(p, 0xa824); p+= 2; // FSMgr WriteMacInt16(p, 0x301f); p+= 2; // move.w (sp)+,d0 - WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2; + WriteMacInt16(p, M68K_RTS); p+= 2; if (p - fs_data != fsDisposeVCB) goto fsdat_error; WriteMacInt16(p, 0x4267); p+= 2; // clr.w -(sp) @@ -489,7 +501,7 @@ void InstallExtFS(void) WriteMacInt16(p, 0x7008); p+= 2; // UTDisposeVCB WriteMacInt16(p, 0xa824); p+= 2; // FSMgr WriteMacInt16(p, 0x301f); p+= 2; // move.w (sp)+,d0 - WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2; + WriteMacInt16(p, M68K_RTS); p+= 2; if (p - fs_data != fsCheckWDRefNum) goto fsdat_error; WriteMacInt16(p, 0x4267); p+= 2; // clr.w -(sp) @@ -497,7 +509,7 @@ void InstallExtFS(void) WriteMacInt16(p, 0x7013); p+= 2; // UTCheckWDRefNum WriteMacInt16(p, 0xa824); p+= 2; // FSMgr WriteMacInt16(p, 0x301f); p+= 2; // move.w (sp)+,d0 - WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2; + WriteMacInt16(p, M68K_RTS); p+= 2; if (p - fs_data != fsSetDefaultVol) goto fsdat_error; WriteMacInt16(p, 0x4267); p+= 2; // clr.w -(sp) @@ -507,7 +519,7 @@ void InstallExtFS(void) WriteMacInt16(p, 0x7011); p+= 2; // UTSetDefaultVol WriteMacInt16(p, 0xa824); p+= 2; // FSMgr WriteMacInt16(p, 0x301f); p+= 2; // move.w (sp)+,d0 - WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2; + WriteMacInt16(p, M68K_RTS); p+= 2; if (p - fs_data != fsAllocateFCB) goto fsdat_error; WriteMacInt16(p, 0x4267); p+= 2; // clr.w -(sp) @@ -516,7 +528,7 @@ void InstallExtFS(void) WriteMacInt16(p, 0x7000); p+= 2; // UTAllocateFCB WriteMacInt16(p, 0xa824); p+= 2; // FSMgr WriteMacInt16(p, 0x301f); p+= 2; // move.w (sp)+,d0 - WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2; + WriteMacInt16(p, M68K_RTS); p+= 2; if (p - fs_data != fsReleaseFCB) goto fsdat_error; WriteMacInt16(p, 0x4267); p+= 2; // clr.w -(sp) @@ -524,7 +536,7 @@ void InstallExtFS(void) WriteMacInt16(p, 0x7001); p+= 2; // UTReleaseFCB WriteMacInt16(p, 0xa824); p+= 2; // FSMgr WriteMacInt16(p, 0x301f); p+= 2; // move.w (sp)+,d0 - WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2; + WriteMacInt16(p, M68K_RTS); p+= 2; if (p - fs_data != fsIndexFCB) goto fsdat_error; WriteMacInt16(p, 0x4267); p+= 2; // clr.w -(sp) @@ -534,7 +546,7 @@ void InstallExtFS(void) WriteMacInt16(p, 0x7004); p+= 2; // UTIndexFCB WriteMacInt16(p, 0xa824); p+= 2; // FSMgr WriteMacInt16(p, 0x301f); p+= 2; // move.w (sp)+,d0 - WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2; + WriteMacInt16(p, M68K_RTS); p+= 2; if (p - fs_data != fsResolveFCB) goto fsdat_error; WriteMacInt16(p, 0x4267); p+= 2; // clr.w -(sp) @@ -543,7 +555,7 @@ void InstallExtFS(void) WriteMacInt16(p, 0x7005); p+= 2; // UTResolveFCB WriteMacInt16(p, 0xa824); p+= 2; // FSMgr WriteMacInt16(p, 0x301f); p+= 2; // move.w (sp)+,d0 - WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2; + WriteMacInt16(p, M68K_RTS); p+= 2; if (p - fs_data != fsAdjustEOF) goto fsdat_error; WriteMacInt16(p, 0x4267); p+= 2; // clr.w -(sp) @@ -551,7 +563,7 @@ void InstallExtFS(void) WriteMacInt16(p, 0x7010); p+= 2; // UTAdjustEOF WriteMacInt16(p, 0xa824); p+= 2; // FSMgr WriteMacInt16(p, 0x301f); p+= 2; // move.w (sp)+,d0 - WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2; + WriteMacInt16(p, M68K_RTS); p+= 2; if (p - fs_data != fsAllocateWDCB) goto fsdat_error; WriteMacInt16(p, 0x4267); p+= 2; // clr.w -(sp) @@ -559,7 +571,7 @@ void InstallExtFS(void) WriteMacInt16(p, 0x700c); p+= 2; // UTAllocateWDCB WriteMacInt16(p, 0xa824); p+= 2; // FSMgr WriteMacInt16(p, 0x301f); p+= 2; // move.w (sp)+,d0 - WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2; + WriteMacInt16(p, M68K_RTS); p+= 2; if (p - fs_data != fsReleaseWDCB) goto fsdat_error; WriteMacInt16(p, 0x4267); p+= 2; // clr.w -(sp) @@ -567,7 +579,7 @@ void InstallExtFS(void) WriteMacInt16(p, 0x700d); p+= 2; // UTReleaseWDCB WriteMacInt16(p, 0xa824); p+= 2; // FSMgr WriteMacInt16(p, 0x301f); p+= 2; // move.w (sp)+,d0 - WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2; + WriteMacInt16(p, M68K_RTS); p+= 2; if (p - fs_data != SIZEOF_fsdat) goto fsdat_error; @@ -682,7 +694,7 @@ static int16 get_current_dir(uint32 pb, int16 result; // Determine volume -// D(bug(" determining volume\n")); + D(bug(" determining volume, dirID %d\n", dirID)); r.a[0] = pb; r.a[1] = fs_data + fsReturn; r.a[2] = fs_data + fsReturn + 2; @@ -700,7 +712,7 @@ static int16 get_current_dir(uint32 pb, int16 more_matches = ReadMacInt16(fs_data + fsReturn + 2); int16 vRefNum = ReadMacInt16(fs_data + fsReturn + 4); uint32 vcb = ReadMacInt32(fs_data + fsReturn + 6); -// D(bug(" UTDetermineVol() returned %d, status %d\n", r.d[0], status)); + D(bug(" UTDetermineVol() returned %d, status %d\n", r.d[0], status)); result = r.d[0] & 0xffff; if (result == noErr) { @@ -783,6 +795,7 @@ static int16 get_item_and_path(uint32 pb uint32 current_dir; if ((result = get_current_dir(pb, dirID, current_dir, no_vol_name)) != noErr) return result; + D(bug(" current dir %08x\n", current_dir)); FSItem *p = find_fsitem_by_id(current_dir); if (p == NULL) return dirNFErr; @@ -796,11 +809,11 @@ static int16 get_item_and_path(uint32 pb WriteMacInt8(parseRec + ppFoundDelimiter, false); // Get length of volume name -// D(bug(" parsing pathname\n")); + D(bug(" parsing pathname\n")); r.a[0] = parseRec + ppStartOffset; r.a[1] = ReadMacInt32(parseRec + ppNamePtr); Execute68k(fs_data + fsParsePathname, &r); -// D(bug(" UTParsePathname() returned %d, startOffset %d\n", r.d[0], ReadMacInt16(parseRec + ppStartOffset))); + D(bug(" UTParsePathname() returned %d, startOffset %d\n", r.d[0], ReadMacInt16(parseRec + ppStartOffset))); result = r.d[0] & 0xffff; if (result == noErr) { @@ -1079,7 +1092,7 @@ static int16 fs_get_vol(uint32 pb) // Set default volume (WDParam) static int16 fs_set_vol(uint32 pb, bool hfs, uint32 vcb) { - D(bug(" fs_set_vol(%08lx), vRefNum %d, name %#s, dirID %d\n", pb, ReadMacInt16(pb + ioVRefNum), Mac2HostAddr(ReadMacInt32(pb + ioNamePtr)), ReadMacInt32(pb + ioWDDirID))); + D(bug(" fs_set_vol(%08lx), vRefNum %d, name %.31s, dirID %d\n", pb, ReadMacInt16(pb + ioVRefNum), Mac2HostAddr(ReadMacInt32(pb + ioNamePtr) + 1), ReadMacInt32(pb + ioWDDirID))); M68kRegisters r; // Determine parameters @@ -1135,11 +1148,11 @@ static int16 fs_set_vol(uint32 pb, bool // Query file attributes (HFileParam) static int16 fs_get_file_info(uint32 pb, bool hfs, uint32 dirID) { - D(bug(" fs_get_file_info(%08lx), vRefNum %d, name %#s, idx %d, dirID %d\n", pb, ReadMacInt16(pb + ioVRefNum), Mac2HostAddr(ReadMacInt32(pb + ioNamePtr)), ReadMacInt16(pb + ioFDirIndex), dirID)); + D(bug(" fs_get_file_info(%08lx), vRefNum %d, name %.31s, idx %d, dirID %d\n", pb, ReadMacInt16(pb + ioVRefNum), Mac2HostAddr(ReadMacInt32(pb + ioNamePtr) + 1), ReadMacInt16(pb + ioFDirIndex), dirID)); FSItem *fs_item; - int16 dir_index = ReadMacInt16(pb + ioFDirIndex); - if (dir_index == 0) { // Query item specified by ioDirID and ioNamePtr + int16 dir_index = (int16)ReadMacInt16(pb + ioFDirIndex); + if (dir_index <= 0) { // Query item specified by ioDirID and ioNamePtr // Find FSItem for given file int16 result = get_item_and_path(pb, dirID, fs_item); @@ -1174,7 +1187,7 @@ read_next_de: goto read_next_de; // Suppress name beginning with '.' (MacOS could interpret these as driver names) //!! suppress directories } - add_path_component(de->d_name); + add_path_comp(de->d_name); // Get FSItem for queried item fs_item = find_fsitem(de->d_name, p); @@ -1231,7 +1244,7 @@ read_next_de: // Set file attributes (HFileParam) static int16 fs_set_file_info(uint32 pb, bool hfs, uint32 dirID) { - D(bug(" fs_set_file_info(%08lx), vRefNum %d, name %#s, idx %d, dirID %d\n", pb, ReadMacInt16(pb + ioVRefNum), Mac2HostAddr(ReadMacInt32(pb + ioNamePtr)), ReadMacInt16(pb + ioFDirIndex), dirID)); + D(bug(" fs_set_file_info(%08lx), vRefNum %d, name %.31s, idx %d, dirID %d\n", pb, ReadMacInt16(pb + ioVRefNum), Mac2HostAddr(ReadMacInt32(pb + ioNamePtr) + 1), ReadMacInt16(pb + ioFDirIndex), dirID)); // Find FSItem for given file/dir FSItem *fs_item; @@ -1256,11 +1269,11 @@ static int16 fs_set_file_info(uint32 pb, // Query file/directory attributes static int16 fs_get_cat_info(uint32 pb) { - D(bug(" fs_get_cat_info(%08lx), vRefNum %d, name %#s, idx %d, dirID %d\n", pb, ReadMacInt16(pb + ioVRefNum), Mac2HostAddr(ReadMacInt32(pb + ioNamePtr)), ReadMacInt16(pb + ioFDirIndex), ReadMacInt32(pb + ioDirID))); + D(bug(" fs_get_cat_info(%08lx), vRefNum %d, name %.31s, idx %d, dirID %d\n", pb, ReadMacInt16(pb + ioVRefNum), Mac2HostAddr(ReadMacInt32(pb + ioNamePtr) + 1), ReadMacInt16(pb + ioFDirIndex), ReadMacInt32(pb + ioDirID))); FSItem *fs_item; - int16 dir_index = ReadMacInt16(pb + ioFDirIndex); - if (dir_index == -1) { // Query directory specified by ioDirID + int16 dir_index = (int16)ReadMacInt16(pb + ioFDirIndex); + if (dir_index < 0) { // Query directory specified by ioDirID // Find FSItem for directory fs_item = find_fsitem_by_id(ReadMacInt32(pb + ioDrDirID)); @@ -1302,7 +1315,7 @@ read_next_de: if (de->d_name[0] == '.') goto read_next_de; // Suppress name beginning with '.' (MacOS could interpret these as driver names) } - add_path_component(de->d_name); + add_path_comp(de->d_name); // Get FSItem for queried item fs_item = find_fsitem(de->d_name, p); @@ -1390,7 +1403,7 @@ read_next_de: // Set file/directory attributes static int16 fs_set_cat_info(uint32 pb) { - D(bug(" fs_set_cat_info(%08lx), vRefNum %d, name %#s, idx %d, dirID %d\n", pb, ReadMacInt16(pb + ioVRefNum), Mac2HostAddr(ReadMacInt32(pb + ioNamePtr)), ReadMacInt16(pb + ioFDirIndex), ReadMacInt32(pb + ioDirID))); + D(bug(" fs_set_cat_info(%08lx), vRefNum %d, name %.31s, idx %d, dirID %d\n", pb, ReadMacInt16(pb + ioVRefNum), Mac2HostAddr(ReadMacInt32(pb + ioNamePtr) + 1), ReadMacInt16(pb + ioFDirIndex), ReadMacInt32(pb + ioDirID))); // Find FSItem for given file/dir FSItem *fs_item; @@ -1417,7 +1430,7 @@ static int16 fs_set_cat_info(uint32 pb) // Open file static int16 fs_open(uint32 pb, uint32 dirID, uint32 vcb, bool resource_fork) { - D(bug(" fs_open(%08lx), %s, vRefNum %d, name %#s, dirID %d, perm %d\n", pb, resource_fork ? "rsrc" : "data", ReadMacInt16(pb + ioVRefNum), Mac2HostAddr(ReadMacInt32(pb + ioNamePtr)), dirID, ReadMacInt8(pb + ioPermssn))); + D(bug(" fs_open(%08lx), %s, vRefNum %d, name %.31s, dirID %d, perm %d\n", pb, resource_fork ? "rsrc" : "data", ReadMacInt16(pb + ioVRefNum), Mac2HostAddr(ReadMacInt32(pb + ioNamePtr) + 1), dirID, ReadMacInt8(pb + ioPermssn))); M68kRegisters r; // Find FSItem for given file @@ -1704,9 +1717,14 @@ static int16 fs_set_fpos(uint32 pb) if (lseek(fd, ReadMacInt32(pb + ioPosOffset), SEEK_SET) < 0) return posErr; break; + case fsFromLEOF: + if (lseek(fd, (int32)ReadMacInt32(pb + ioPosOffset), SEEK_END) < 0) + return posErr; + break; case fsFromMark: - if (lseek(fd, ReadMacInt32(pb + ioPosOffset), SEEK_CUR) < 0) + if (lseek(fd, (int32)ReadMacInt32(pb + ioPosOffset), SEEK_CUR) < 0) return posErr; + break; default: break; } @@ -1818,7 +1836,7 @@ static int16 fs_write(uint32 pb) // Create file static int16 fs_create(uint32 pb, uint32 dirID) { - D(bug(" fs_create(%08lx), vRefNum %d, name %#s, dirID %d\n", pb, ReadMacInt16(pb + ioVRefNum), Mac2HostAddr(ReadMacInt32(pb + ioNamePtr)), dirID)); + D(bug(" fs_create(%08lx), vRefNum %d, name %.31s, dirID %d\n", pb, ReadMacInt16(pb + ioVRefNum), Mac2HostAddr(ReadMacInt32(pb + ioNamePtr) + 1), dirID)); // Find FSItem for given file FSItem *fs_item; @@ -1843,7 +1861,7 @@ static int16 fs_create(uint32 pb, uint32 // Create directory static int16 fs_dir_create(uint32 pb) { - D(bug(" fs_dir_create(%08lx), vRefNum %d, name %#s, dirID %d\n", pb, ReadMacInt16(pb + ioVRefNum), Mac2HostAddr(ReadMacInt32(pb + ioNamePtr)), ReadMacInt32(pb + ioDirID))); + D(bug(" fs_dir_create(%08lx), vRefNum %d, name %.31s, dirID %d\n", pb, ReadMacInt16(pb + ioVRefNum), Mac2HostAddr(ReadMacInt32(pb + ioNamePtr) + 1), ReadMacInt32(pb + ioDirID))); // Find FSItem for given directory FSItem *fs_item; @@ -1867,7 +1885,7 @@ static int16 fs_dir_create(uint32 pb) // Delete file/directory static int16 fs_delete(uint32 pb, uint32 dirID) { - D(bug(" fs_delete(%08lx), vRefNum %d, name %#s, dirID %d\n", pb, ReadMacInt16(pb + ioVRefNum), Mac2HostAddr(ReadMacInt32(pb + ioNamePtr)), dirID)); + D(bug(" fs_delete(%08lx), vRefNum %d, name %.31s, dirID %d\n", pb, ReadMacInt16(pb + ioVRefNum), Mac2HostAddr(ReadMacInt32(pb + ioNamePtr) + 1), dirID)); // Find FSItem for given file/dir FSItem *fs_item; @@ -1892,7 +1910,7 @@ static int16 fs_delete(uint32 pb, uint32 // Rename file/directory static int16 fs_rename(uint32 pb, uint32 dirID) { - D(bug(" fs_rename(%08lx), vRefNum %d, name %#s, dirID %d, new name %#s\n", pb, ReadMacInt16(pb + ioVRefNum), Mac2HostAddr(ReadMacInt32(pb + ioNamePtr)), dirID, Mac2HostAddr(ReadMacInt32(pb + ioMisc)))); + D(bug(" fs_rename(%08lx), vRefNum %d, name %.31s, dirID %d, new name %.31s\n", pb, ReadMacInt16(pb + ioVRefNum), Mac2HostAddr(ReadMacInt32(pb + ioNamePtr) + 1), dirID, Mac2HostAddr(ReadMacInt32(pb + ioMisc) + 1))); // Find path of given file/dir FSItem *fs_item; @@ -1933,7 +1951,7 @@ static int16 fs_rename(uint32 pb, uint32 // Move file/directory (CMovePBRec) static int16 fs_cat_move(uint32 pb) { - D(bug(" fs_cat_move(%08lx), vRefNum %d, name %#s, dirID %d, new name %#s, new dirID %d\n", pb, ReadMacInt16(pb + ioVRefNum), Mac2HostAddr(ReadMacInt32(pb + ioNamePtr)), ReadMacInt32(pb + ioDirID), Mac2HostAddr(ReadMacInt32(pb + ioNewName)), ReadMacInt32(pb + ioNewDirID))); + D(bug(" fs_cat_move(%08lx), vRefNum %d, name %.31s, dirID %d, new name %.31s, new dirID %d\n", pb, ReadMacInt16(pb + ioVRefNum), Mac2HostAddr(ReadMacInt32(pb + ioNamePtr) + 1), ReadMacInt32(pb + ioDirID), Mac2HostAddr(ReadMacInt32(pb + ioNewName) + 1), ReadMacInt32(pb + ioNewDirID))); // Find path of given file/dir FSItem *fs_item; @@ -1955,7 +1973,7 @@ static int16 fs_cat_move(uint32 pb) return result; // Append old file/dir name - add_path_component(fs_item->name); + add_path_comp(fs_item->name); // Does the new name already exist? if (access(full_path, F_OK) == 0) @@ -1980,7 +1998,7 @@ static int16 fs_cat_move(uint32 pb) // Open working directory (WDParam) static int16 fs_open_wd(uint32 pb) { - D(bug(" fs_open_wd(%08lx), vRefNum %d, name %#s, dirID %d\n", pb, ReadMacInt16(pb + ioVRefNum), Mac2HostAddr(ReadMacInt32(pb + ioNamePtr)), ReadMacInt32(pb + ioWDDirID))); + D(bug(" fs_open_wd(%08lx), vRefNum %d, name %.31s, dirID %d\n", pb, ReadMacInt16(pb + ioVRefNum), Mac2HostAddr(ReadMacInt32(pb + ioNamePtr) + 1), ReadMacInt32(pb + ioWDDirID))); M68kRegisters r; // Allocate WDCB