diff --git a/logo/dsks/vmw_logo.dsk b/logo/vmw/vmw_logo.dsk similarity index 100% rename from logo/dsks/vmw_logo.dsk rename to logo/vmw/vmw_logo.dsk diff --git a/utils/dos33fs-utils/dos33.c b/utils/dos33fs-utils/dos33.c index a935ec37..4f28f12f 100644 --- a/utils/dos33fs-utils/dos33.c +++ b/utils/dos33fs-utils/dos33.c @@ -904,25 +904,29 @@ int main(int argc, char **argv) { unsigned char vtoc[BYTES_PER_SECTOR]; /* Check command line arguments */ - while ((c = getopt (argc, argv,"a:l:t:s:hvxy"))!=-1) { + while ((c = getopt (argc, argv,"a:l:t:s:dhvxy"))!=-1) { switch (c) { + case 'd': + fprintf(stderr,"DEBUG enabled\n"); + debug=1; + break; case 'a': address=strtol(optarg,&endptr,0); - if (debug) printf("Address=%d\n",address); + if (debug) fprintf(stderr,"Address=%d\n",address); break; case 'l': length=strtol(optarg,&endptr,0); - if (debug) printf("Length=%d\n",address); + if (debug) fprintf(stderr,"Length=%d\n",address); break; #if 0 case 't': track=strtol(optarg,&endptr,0); - if (debug) printf("Track=%d\n",address); + if (debug) fprintf(stderr,"Track=%d\n",address); break; case 's': sector=strtol(optarg,&endptr,0); - if (debug) printf("Sector=%d\n",address); + if (debug) fprintf(stderr,"Sector=%d\n",address); break; #endif case 'v': diff --git a/utils/dos33fs-utils/dos33_catalog.c b/utils/dos33fs-utils/dos33_catalog.c index 06102921..87f106ae 100644 --- a/utils/dos33fs-utils/dos33_catalog.c +++ b/utils/dos33fs-utils/dos33_catalog.c @@ -1,9 +1,12 @@ #include #include #include +#include #include "dos33.h" +static int debug=0; + unsigned char dos33_file_type(int value) { unsigned char result; @@ -81,11 +84,21 @@ static int dos33_find_next_file(int fd,int catalog_tsf,unsigned char *vtoc) { catalog_track=(catalog_tsf>>8)&0xff; catalog_sector=(catalog_tsf&0xff); + if (debug) { + fprintf(stderr,"CATALOG FIND NEXT, " + "CURRENT FILE=%X TRACK=%X SECTOR=%X\n", + catalog_file,catalog_track,catalog_sector); + } + catalog_loop: /* Read in Catalog Sector */ lseek(fd,DISK_OFFSET(catalog_track,catalog_sector),SEEK_SET); result=read(fd,sector_buffer,BYTES_PER_SECTOR); + if (result<0) { + fprintf(stderr,"Error on I/O %s\n",strerror(errno)); + return -1; + } i=catalog_file; while(i<7) { @@ -94,19 +107,36 @@ catalog_loop: (i*CATALOG_ENTRY_SIZE)]; /* 0xff means file deleted */ /* 0x0 means empty */ + if (debug) { + if (file_track==0xff) fprintf(stderr,"\tFILE %d DELETED\n",i); + if (file_track==0x00) fprintf(stderr,"\tFILE %d UNALLOCATED\n",i); + } + if ((file_track!=0xff) && (file_track!=0x0)) { + if (debug) fprintf(stderr,"\tFOUND FILE %X TRACK $%X SECTOR $%X\n",i,catalog_track,catalog_sector); return ((i<<16)+(catalog_track<<8)+catalog_sector); } i++; } + catalog_track=sector_buffer[CATALOG_NEXT_T]; catalog_sector=sector_buffer[CATALOG_NEXT_S]; + + if (debug) fprintf(stderr,"\tTRYING NEXT SECTOR T=$%X S=$%X\n", + catalog_track,catalog_sector); + + /* FIXME: this wouldn't happen on 140k disks */ + /* but who knows if you're doing something fancy? */ + if ((catalog_track<0) || (catalog_track>40)) { + return -1; + } + if (catalog_sector!=0) { catalog_file=0; goto catalog_loop; } - if (result<0) fprintf(stderr,"Error on I/O\n"); + return -1; } @@ -122,6 +152,9 @@ static int dos33_print_file_info(int fd,int catalog_tsf) { catalog_track=(catalog_tsf>>8)&0xff; catalog_sector=(catalog_tsf&0xff); + if (debug) fprintf(stderr,"CATALOG FILE=%X TRACK=%X SECTOR=%X\n", + catalog_file,catalog_track,catalog_sector); + /* Read in Catalog Sector */ lseek(fd,DISK_OFFSET(catalog_track,catalog_sector),SEEK_SET); result=read(fd,sector_buffer,BYTES_PER_SECTOR); @@ -167,6 +200,7 @@ void dos33_catalog(int dos_fd, unsigned char *vtoc) { printf("\nDISK VOLUME %i\n\n",vtoc[VTOC_DISK_VOLUME]); while(catalog_entry>0) { catalog_entry=dos33_find_next_file(dos_fd,catalog_entry,vtoc); + if (debug) fprintf(stderr,"CATALOG entry=$%X\n",catalog_entry); if (catalog_entry>0) { dos33_print_file_info(dos_fd,catalog_entry); /* why 1<<16 ? */