ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/extfs.cpp
(Generate patch)

Comparing BasiliskII/src/extfs.cpp (file contents):
Revision 1.4 by cebix, 1999-10-20T17:23:53Z vs.
Revision 1.6 by cebix, 1999-10-22T15:08:10Z

# Line 204 | Line 204 | static FSItem *find_fsitem(const char *n
204   const int MAX_PATH_LENGTH = 1024;
205   static char full_path[MAX_PATH_LENGTH];
206  
207 < static void add_path_component(const char *s)
207 > static void add_path_comp(const char *s)
208   {
209 <        int l = strlen(full_path);
210 <        if (l < MAX_PATH_LENGTH-1 && full_path[l-1] != '/') {
211 <                full_path[l] = '/';
212 <                full_path[l+1] = 0;
213 <        }
214 <        strncat(full_path, s, MAX_PATH_LENGTH-1);
209 >        add_path_component(full_path, s, MAX_PATH_LENGTH);
210   }
211  
212   static void get_path_for_fsitem(FSItem *p)
213   {
214 <        if (p->id == ROOT_ID) {
214 >        if (p->id == ROOT_PARENT_ID) {
215 >                full_path[0] = 0;
216 >        } else if (p->id == ROOT_ID) {
217                  strncpy(full_path, RootPath, MAX_PATH_LENGTH-1);
218                  full_path[MAX_PATH_LENGTH-1] = 0;
219          } else {
220                  get_path_for_fsitem(p->parent);
221 <                add_path_component(p->name);
221 >                add_path_comp(p->name);
222          }
223   }
224  
# Line 440 | Line 437 | void InstallExtFS(void)
437          WriteMacInt16(p, 0x7006); p+= 2;        // UTAllocateVCB
438          WriteMacInt16(p, 0xa824); p+= 2;        // FSMgr
439          WriteMacInt16(p, 0x301f); p+= 2;        // move.w (sp)+,d0
440 <        WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2;
440 >        WriteMacInt16(p, M68K_RTS); p+= 2;
441          if (p - fs_data != fsAddNewVCB)
442                  goto fsdat_error;
443          WriteMacInt16(p, 0x4267); p+= 2;        // clr.w -(sp)
# Line 450 | Line 447 | void InstallExtFS(void)
447          WriteMacInt16(p, 0x7007); p+= 2;        // UTAddNewVCB
448          WriteMacInt16(p, 0xa824); p+= 2;        // FSMgr
449          WriteMacInt16(p, 0x301f); p+= 2;        // move.w (sp)+,d0
450 <        WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2;
450 >        WriteMacInt16(p, M68K_RTS); p+= 2;
451          if (p - fs_data != fsDetermineVol)
452                  goto fsdat_error;
453          WriteMacInt16(p, 0x4267); p+= 2;        // clr.w -(sp)
# Line 462 | Line 459 | void InstallExtFS(void)
459          WriteMacInt16(p, 0x701d); p+= 2;        // UTDetermineVol
460          WriteMacInt16(p, 0xa824); p+= 2;        // FSMgr
461          WriteMacInt16(p, 0x301f); p+= 2;        // move.w (sp)+,d0
462 <        WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2;
462 >        WriteMacInt16(p, M68K_RTS); p+= 2;
463          if (p - fs_data != fsResolveWDCB)
464                  goto fsdat_error;
465          WriteMacInt16(p, 0x4267); p+= 2;        // clr.w -(sp)
# Line 473 | Line 470 | void InstallExtFS(void)
470          WriteMacInt16(p, 0x700e); p+= 2;        // UTResolveWDCB
471          WriteMacInt16(p, 0xa824); p+= 2;        // FSMgr
472          WriteMacInt16(p, 0x301f); p+= 2;        // move.w (sp)+,d0
473 <        WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2;
473 >        WriteMacInt16(p, M68K_RTS); p+= 2;
474          if (p - fs_data != fsGetDefaultVol)
475                  goto fsdat_error;
476          WriteMacInt16(p, 0x4267); p+= 2;        // clr.w -(sp)
# Line 481 | Line 478 | void InstallExtFS(void)
478          WriteMacInt16(p, 0x7012); p+= 2;        // UTGetDefaultVol
479          WriteMacInt16(p, 0xa824); p+= 2;        // FSMgr
480          WriteMacInt16(p, 0x301f); p+= 2;        // move.w (sp)+,d0
481 <        WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2;
481 >        WriteMacInt16(p, M68K_RTS); p+= 2;
482          if (p - fs_data != fsGetPathComponentName)
483                  goto fsdat_error;
484          WriteMacInt16(p, 0x4267); p+= 2;        // clr.w -(sp)
# Line 489 | Line 486 | void InstallExtFS(void)
486          WriteMacInt16(p, 0x701c); p+= 2;        // UTGetPathComponentName
487          WriteMacInt16(p, 0xa824); p+= 2;        // FSMgr
488          WriteMacInt16(p, 0x301f); p+= 2;        // move.w (sp)+,d0
489 <        WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2;
489 >        WriteMacInt16(p, M68K_RTS); p+= 2;
490          if (p - fs_data != fsParsePathname)
491                  goto fsdat_error;
492          WriteMacInt16(p, 0x4267); p+= 2;        // clr.w -(sp)
# Line 498 | Line 495 | void InstallExtFS(void)
495          WriteMacInt16(p, 0x701b); p+= 2;        // UTParsePathname
496          WriteMacInt16(p, 0xa824); p+= 2;        // FSMgr
497          WriteMacInt16(p, 0x301f); p+= 2;        // move.w (sp)+,d0
498 <        WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2;
498 >        WriteMacInt16(p, M68K_RTS); p+= 2;
499          if (p - fs_data != fsDisposeVCB)
500                  goto fsdat_error;
501          WriteMacInt16(p, 0x4267); p+= 2;        // clr.w -(sp)
# Line 506 | Line 503 | void InstallExtFS(void)
503          WriteMacInt16(p, 0x7008); p+= 2;        // UTDisposeVCB
504          WriteMacInt16(p, 0xa824); p+= 2;        // FSMgr
505          WriteMacInt16(p, 0x301f); p+= 2;        // move.w (sp)+,d0
506 <        WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2;
506 >        WriteMacInt16(p, M68K_RTS); p+= 2;
507          if (p - fs_data != fsCheckWDRefNum)
508                  goto fsdat_error;
509          WriteMacInt16(p, 0x4267); p+= 2;        // clr.w -(sp)
# Line 514 | Line 511 | void InstallExtFS(void)
511          WriteMacInt16(p, 0x7013); p+= 2;        // UTCheckWDRefNum
512          WriteMacInt16(p, 0xa824); p+= 2;        // FSMgr
513          WriteMacInt16(p, 0x301f); p+= 2;        // move.w (sp)+,d0
514 <        WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2;
514 >        WriteMacInt16(p, M68K_RTS); p+= 2;
515          if (p - fs_data != fsSetDefaultVol)
516                  goto fsdat_error;
517          WriteMacInt16(p, 0x4267); p+= 2;        // clr.w -(sp)
# Line 524 | Line 521 | void InstallExtFS(void)
521          WriteMacInt16(p, 0x7011); p+= 2;        // UTSetDefaultVol
522          WriteMacInt16(p, 0xa824); p+= 2;        // FSMgr
523          WriteMacInt16(p, 0x301f); p+= 2;        // move.w (sp)+,d0
524 <        WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2;
524 >        WriteMacInt16(p, M68K_RTS); p+= 2;
525          if (p - fs_data != fsAllocateFCB)
526                  goto fsdat_error;
527          WriteMacInt16(p, 0x4267); p+= 2;        // clr.w -(sp)
# Line 533 | Line 530 | void InstallExtFS(void)
530          WriteMacInt16(p, 0x7000); p+= 2;        // UTAllocateFCB
531          WriteMacInt16(p, 0xa824); p+= 2;        // FSMgr
532          WriteMacInt16(p, 0x301f); p+= 2;        // move.w (sp)+,d0
533 <        WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2;
533 >        WriteMacInt16(p, M68K_RTS); p+= 2;
534          if (p - fs_data != fsReleaseFCB)
535                  goto fsdat_error;
536          WriteMacInt16(p, 0x4267); p+= 2;        // clr.w -(sp)
# Line 541 | Line 538 | void InstallExtFS(void)
538          WriteMacInt16(p, 0x7001); p+= 2;        // UTReleaseFCB
539          WriteMacInt16(p, 0xa824); p+= 2;        // FSMgr
540          WriteMacInt16(p, 0x301f); p+= 2;        // move.w (sp)+,d0
541 <        WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2;
541 >        WriteMacInt16(p, M68K_RTS); p+= 2;
542          if (p - fs_data != fsIndexFCB)
543                  goto fsdat_error;
544          WriteMacInt16(p, 0x4267); p+= 2;        // clr.w -(sp)
# Line 551 | Line 548 | void InstallExtFS(void)
548          WriteMacInt16(p, 0x7004); p+= 2;        // UTIndexFCB
549          WriteMacInt16(p, 0xa824); p+= 2;        // FSMgr
550          WriteMacInt16(p, 0x301f); p+= 2;        // move.w (sp)+,d0
551 <        WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2;
551 >        WriteMacInt16(p, M68K_RTS); p+= 2;
552          if (p - fs_data != fsResolveFCB)
553                  goto fsdat_error;
554          WriteMacInt16(p, 0x4267); p+= 2;        // clr.w -(sp)
# Line 560 | Line 557 | void InstallExtFS(void)
557          WriteMacInt16(p, 0x7005); p+= 2;        // UTResolveFCB
558          WriteMacInt16(p, 0xa824); p+= 2;        // FSMgr
559          WriteMacInt16(p, 0x301f); p+= 2;        // move.w (sp)+,d0
560 <        WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2;
560 >        WriteMacInt16(p, M68K_RTS); p+= 2;
561          if (p - fs_data != fsAdjustEOF)
562                  goto fsdat_error;
563          WriteMacInt16(p, 0x4267); p+= 2;        // clr.w -(sp)
# Line 568 | Line 565 | void InstallExtFS(void)
565          WriteMacInt16(p, 0x7010); p+= 2;        // UTAdjustEOF
566          WriteMacInt16(p, 0xa824); p+= 2;        // FSMgr
567          WriteMacInt16(p, 0x301f); p+= 2;        // move.w (sp)+,d0
568 <        WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2;
568 >        WriteMacInt16(p, M68K_RTS); p+= 2;
569          if (p - fs_data != fsAllocateWDCB)
570                  goto fsdat_error;
571          WriteMacInt16(p, 0x4267); p+= 2;        // clr.w -(sp)
# Line 576 | Line 573 | void InstallExtFS(void)
573          WriteMacInt16(p, 0x700c); p+= 2;        // UTAllocateWDCB
574          WriteMacInt16(p, 0xa824); p+= 2;        // FSMgr
575          WriteMacInt16(p, 0x301f); p+= 2;        // move.w (sp)+,d0
576 <        WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2;
576 >        WriteMacInt16(p, M68K_RTS); p+= 2;
577          if (p - fs_data != fsReleaseWDCB)
578                  goto fsdat_error;
579          WriteMacInt16(p, 0x4267); p+= 2;        // clr.w -(sp)
# Line 584 | Line 581 | void InstallExtFS(void)
581          WriteMacInt16(p, 0x700d); p+= 2;        // UTReleaseWDCB
582          WriteMacInt16(p, 0xa824); p+= 2;        // FSMgr
583          WriteMacInt16(p, 0x301f); p+= 2;        // move.w (sp)+,d0
584 <        WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2;
584 >        WriteMacInt16(p, M68K_RTS); p+= 2;
585          if (p - fs_data != SIZEOF_fsdat)
586                  goto fsdat_error;
587  
# Line 1192 | Line 1189 | read_next_de:
1189                                  goto read_next_de;      // Suppress name beginning with '.' (MacOS could interpret these as driver names)
1190                          //!! suppress directories
1191                  }
1192 <                add_path_component(de->d_name);
1192 >                add_path_comp(de->d_name);
1193  
1194                  // Get FSItem for queried item
1195                  fs_item = find_fsitem(de->d_name, p);
# Line 1320 | Line 1317 | read_next_de:
1317                          if (de->d_name[0] == '.')
1318                                  goto read_next_de;      // Suppress name beginning with '.' (MacOS could interpret these as driver names)
1319                  }
1320 <                add_path_component(de->d_name);
1320 >                add_path_comp(de->d_name);
1321  
1322                  // Get FSItem for queried item
1323                  fs_item = find_fsitem(de->d_name, p);
# Line 1978 | Line 1975 | static int16 fs_cat_move(uint32 pb)
1975                  return result;
1976  
1977          // Append old file/dir name
1978 <        add_path_component(fs_item->name);
1978 >        add_path_comp(fs_item->name);
1979  
1980          // Does the new name already exist?
1981          if (access(full_path, F_OK) == 0)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines