*** isovfy.c.bak	Tue Mar  2 04:41:36 1999
--- isovfy.c	Thu Apr  8 17:32:06 1999
***************
*** 22,27 ****
--- 22,33 ----
  
  static char rcsid[] ="$Id: isovfy.c,v 1.5 1999/03/02 03:41:36 eric Exp $";
  
+ #include "../config.h"
+ 
+ #include <stdxlib.h>
+ #include <unixstd.h>
+ #include <strdefs.h>
+ 
  #include <stdio.h>
  #include <signal.h>
  
***************
*** 83,88 ****
--- 89,100 ----
  };
  
  int
+ isonum_721 (char * p)
+ {
+ 	return ((p[0] & 0xff) | ((p[1] & 0xff) << 8));
+ }
+ 
+ int
  isonum_723 (char * p)
  {
  #if 0
***************
*** 95,106 ****
  }
  
  int
- isonum_721 (char * p)
- {
- 	return ((p[0] & 0xff) | ((p[1] & 0xff) << 8));
- }
- 
- int
  isonum_711 (char * p)
  {
  	return (*p & 0xff);
--- 107,112 ----
***************
*** 142,169 ****
  int rr_goof;
  
  
- int 
- dump_rr(struct iso_directory_record * idr){
- 	int len;
- 	char * pnt;
- 
- 	len = idr->length[0] & 0xff;
- 	len -= (sizeof(struct iso_directory_record) - sizeof(idr->name));
- 	len -= idr->name_len[0];
- 	pnt = (char *) idr;
- 	pnt += (sizeof(struct iso_directory_record) - sizeof(idr->name));
- 	pnt += idr->name_len[0];
- 
- 	if((idr->name_len[0] & 1) == 0){
- 		pnt++;
- 		len--;
- 	};
- 
- 	rr_goof = 0;
- 	parse_rr(pnt, len, 0);
- 	return rr_goof;
- }
- 
  int parse_rr(unsigned char * pnt, int len, int cont_flag)
  {
  	int slen;
--- 148,153 ----
***************
*** 191,218 ****
  		if(pnt[0] < 'A' || pnt[0] > 'Z' || pnt[1] < 'A' || 
  		   pnt[1] > 'Z') {
  			sprintf(lbuffer+iline,"**BAD SUSP %d %d]", 
! 					 pnt[0], pnt[1], rr_goof++);
  			iline += strlen(lbuffer + iline);
  			return flag2;
  		};
  
  		if(pnt[3] != 1) {
! 			sprintf(lbuffer+iline,"**BAD RRVERSION", rr_goof++);
  			iline += strlen(lbuffer + iline);
  			return flag2;
  		};
  		ncount++;
  		if(pnt[0] == 'R' && pnt[1] == 'R') flag1 = pnt[4] & 0xff;
! 		if(strncmp(pnt, "PX", 2) == 0) flag2 |= 1;
! 		if(strncmp(pnt, "PN", 2) == 0) flag2 |= 2;
! 		if(strncmp(pnt, "SL", 2) == 0) flag2 |= 4;
! 		if(strncmp(pnt, "NM", 2) == 0) flag2 |= 8;
! 		if(strncmp(pnt, "CL", 2) == 0) flag2 |= 16;
! 		if(strncmp(pnt, "PL", 2) == 0) flag2 |= 32;
! 		if(strncmp(pnt, "RE", 2) == 0) flag2 |= 64;
! 		if(strncmp(pnt, "TF", 2) == 0) flag2 |= 128;
  
! 		if(strncmp(pnt, "CE", 2) == 0) {
  			cont_extent = isonum_733(pnt+4);
  			cont_offset = isonum_733(pnt+12);
  			cont_size = isonum_733(pnt+20);
--- 175,204 ----
  		if(pnt[0] < 'A' || pnt[0] > 'Z' || pnt[1] < 'A' || 
  		   pnt[1] > 'Z') {
  			sprintf(lbuffer+iline,"**BAD SUSP %d %d]", 
! 					 pnt[0], pnt[1]);
! 			rr_goof++;
  			iline += strlen(lbuffer + iline);
  			return flag2;
  		};
  
  		if(pnt[3] != 1) {
! 			sprintf(lbuffer+iline,"**BAD RRVERSION");
! 			rr_goof++;
  			iline += strlen(lbuffer + iline);
  			return flag2;
  		};
  		ncount++;
  		if(pnt[0] == 'R' && pnt[1] == 'R') flag1 = pnt[4] & 0xff;
! 		if(strncmp((char *)pnt, "PX", 2) == 0) flag2 |= 1;
! 		if(strncmp((char *)pnt, "PN", 2) == 0) flag2 |= 2;
! 		if(strncmp((char *)pnt, "SL", 2) == 0) flag2 |= 4;
! 		if(strncmp((char *)pnt, "NM", 2) == 0) flag2 |= 8;
! 		if(strncmp((char *)pnt, "CL", 2) == 0) flag2 |= 16;
! 		if(strncmp((char *)pnt, "PL", 2) == 0) flag2 |= 32;
! 		if(strncmp((char *)pnt, "RE", 2) == 0) flag2 |= 64;
! 		if(strncmp((char *)pnt, "TF", 2) == 0) flag2 |= 128;
  
! 		if(strncmp((char *)pnt, "CE", 2) == 0) {
  			cont_extent = isonum_733(pnt+4);
  			cont_offset = isonum_733(pnt+12);
  			cont_size = isonum_733(pnt+20);
***************
*** 221,239 ****
  			iline += strlen(lbuffer + iline);
  		      };
  
! 		if(strncmp(pnt, "PL", 2) == 0 || strncmp(pnt, "CL", 2) == 0) {
  			extent = isonum_733(pnt+4);
  		        sprintf(lbuffer+iline,"=%x", extent);
  			iline += strlen(lbuffer + iline);
  			if(extent == 0) rr_goof++;
  		};
! 		if(strncmp(pnt, "SL", 2) == 0) {
  			pnts = pnt+5;
  			slen = pnt[2] - 5;
  			while(slen >= 1){
  				switch(pnts[0] & 0xfe){
  				case 0:
! 					strncat(symlink, pnts+2, pnts[1]);
  					break;
  				case 2:
  					strcat (symlink, ".");
--- 207,225 ----
  			iline += strlen(lbuffer + iline);
  		      };
  
! 		if(strncmp((char *)pnt, "PL", 2) == 0 || strncmp((char *)pnt, "CL", 2) == 0) {
  			extent = isonum_733(pnt+4);
  		        sprintf(lbuffer+iline,"=%x", extent);
  			iline += strlen(lbuffer + iline);
  			if(extent == 0) rr_goof++;
  		};
! 		if(strncmp((char *)pnt, "SL", 2) == 0) {
  			pnts = pnt+5;
  			slen = pnt[2] - 5;
  			while(slen >= 1){
  				switch(pnts[0] & 0xfe){
  				case 0:
! 					strncat(symlink, (char *)(pnts+2), pnts[1]);
  					break;
  				case 2:
  					strcat (symlink, ".");
***************
*** 255,261 ****
  					iline += strlen(lbuffer + iline);
  					break;
  				default:
! 					sprintf(lbuffer+iline,"Reserved bit setting in symlink", rr_goof++);
  					iline += strlen(lbuffer + iline);
  					break;
  				};
--- 241,248 ----
  					iline += strlen(lbuffer + iline);
  					break;
  				default:
! 					sprintf(lbuffer+iline,"Reserved bit setting in symlink");
! 					rr_goof++;
  					iline += strlen(lbuffer + iline);
  					break;
  				};
***************
*** 292,309 ****
  	  }
  	if (!cont_flag && flag1 && flag1 != flag2) 
  	  {
! 	    sprintf(lbuffer+iline,"Flag %x != %x", flag1, flag2, rr_goof++);
  	    iline += strlen(lbuffer + iline);
  	  }
  	return flag2;
  }
  
  
  int dir_count = 0;
  int dir_size_count = 0;
  int ngoof = 0;
  
! 
  check_tree(int file_addr, int file_size, int parent_addr){
    unsigned char buffer[2048];
    unsigned int k;
--- 279,319 ----
  	  }
  	if (!cont_flag && flag1 && flag1 != flag2) 
  	  {
! 	    sprintf(lbuffer+iline,"Flag %x != %x", flag1, flag2);
! 	    rr_goof++;
  	    iline += strlen(lbuffer + iline);
  	  }
  	return flag2;
  }
  
+ int 
+ dump_rr(struct iso_directory_record * idr){
+ 	int len;
+ 	char * pnt;
  
+ 	len = idr->length[0] & 0xff;
+ 	len -= (sizeof(struct iso_directory_record) - sizeof(idr->name));
+ 	len -= idr->name_len[0];
+ 	pnt = (char *) idr;
+ 	pnt += (sizeof(struct iso_directory_record) - sizeof(idr->name));
+ 	pnt += idr->name_len[0];
+ 
+ 	if((idr->name_len[0] & 1) == 0){
+ 		pnt++;
+ 		len--;
+ 	};
+ 
+ 	rr_goof = 0;
+ 	parse_rr((unsigned char *)pnt, len, 0);
+ 	return rr_goof;
+ }
+ 
+ 
  int dir_count = 0;
  int dir_size_count = 0;
  int ngoof = 0;
  
! void
  check_tree(int file_addr, int file_size, int parent_addr){
    unsigned char buffer[2048];
    unsigned int k;
***************
*** 351,357 ****
  		  if(idr->name_len[0] > 33)
  		    {
  		      sprintf(&lbuffer[iline],"File name length=(%d)",
! 			      idr->name_len[0], goof++);
  		      iline += strlen(lbuffer + iline);
  		    }
  		  else if(idr->name_len[0] == 1 && idr->name[0] == 0) {
--- 361,368 ----
  		  if(idr->name_len[0] > 33)
  		    {
  		      sprintf(&lbuffer[iline],"File name length=(%d)",
! 			      idr->name_len[0]);
! 		      goof++;
  		      iline += strlen(lbuffer + iline);
  		    }
  		  else if(idr->name_len[0] == 1 && idr->name[0] == 0) {
***************
*** 360,371 ****
  			  rflag = 0;
  			  if(orig_file_addr !=isonum_733(idr->extent) + isonum_711((char *) idr->ext_attr_length))
  			    {
! 			      sprintf(&lbuffer[iline],"***** Directory has null extent.", goof++);
  			      iline += strlen(lbuffer + iline);
  			    }
  			  if(i1)
  			    {
! 			      sprintf(&lbuffer[iline],"***** . not  first entry.", rr_goof++);
  			      iline += strlen(lbuffer + iline);
  			    }
  		  } else if(idr->name_len[0] == 1 && idr->name[0] == 1) {
--- 371,384 ----
  			  rflag = 0;
  			  if(orig_file_addr !=isonum_733(idr->extent) + isonum_711((char *) idr->ext_attr_length))
  			    {
! 			      sprintf(&lbuffer[iline],"***** Directory has null extent.");
! 			      goof++;
  			      iline += strlen(lbuffer + iline);
  			    }
  			  if(i1)
  			    {
! 			      sprintf(&lbuffer[iline],"***** . not  first entry.");
! 			      rr_goof++;
  			      iline += strlen(lbuffer + iline);
  			    }
  		  } else if(idr->name_len[0] == 1 && idr->name[0] == 1) {
***************
*** 374,385 ****
  			  rflag = 0;
  			  if(parent_file_addr !=isonum_733(idr->extent) + isonum_711((char *) idr->ext_attr_length))
  			    {
! 			      sprintf(&lbuffer[iline],"***** Directory has null extent.", goof++);
  			      iline += strlen(lbuffer + iline);
  			    }
  			  if(i1 != 1)
  			    {
! 			      sprintf(&lbuffer[iline],"***** .. not second entry.", rr_goof++);
  			      iline += strlen(lbuffer + iline);
  			    }
  			  
--- 387,400 ----
  			  rflag = 0;
  			  if(parent_file_addr !=isonum_733(idr->extent) + isonum_711((char *) idr->ext_attr_length))
  			    {
! 			      sprintf(&lbuffer[iline],"***** Directory has null extent.");
! 			      goof++;
  			      iline += strlen(lbuffer + iline);
  			    }
  			  if(i1 != 1)
  			    {
! 			      sprintf(&lbuffer[iline],"***** .. not second entry.");
! 			      rr_goof++;
  			      iline += strlen(lbuffer + iline);
  			    }
  			  
***************
*** 386,392 ****
  		  } else {
  		          if(i1 < 2) 
  			    {
! 			      sprintf(&lbuffer[iline]," Improper sorting.", rr_goof++);
  			    }
  			  for(j=0; j<idr->name_len[0]; j++) 
  			    {
--- 401,408 ----
  		  } else {
  		          if(i1 < 2) 
  			    {
! 			      sprintf(&lbuffer[iline]," Improper sorting.");
! 			      rr_goof++;
  			    }
  			  for(j=0; j<idr->name_len[0]; j++) 
  			    {
***************
*** 402,408 ****
  
  		  if(size && extent == 0) 
  		    {
! 		      sprintf(&lbuffer[iline],"****Extent==0, size != 0", goof++);
  		      iline += strlen(lbuffer + iline);
  		    }
  #if 0
--- 418,425 ----
  
  		  if(size && extent == 0) 
  		    {
! 		      sprintf(&lbuffer[iline],"****Extent==0, size != 0");
! 		      goof++;
  		      iline += strlen(lbuffer + iline);
  		    }
  #if 0
***************
*** 409,415 ****
  		  /* This is apparently legal. */
  		  if(size == 0 && extent) 
  		    {
! 		      sprintf(&lbuffer[iline],"****Extent!=0, size == 0", goof++);
  		      iline += strlen(lbuffer + iline);
  		    }
  #endif
--- 426,433 ----
  		  /* This is apparently legal. */
  		  if(size == 0 && extent) 
  		    {
! 		      sprintf(&lbuffer[iline],"****Extent!=0, size == 0");
! 		      goof++;
  		      iline += strlen(lbuffer + iline);
  		    }
  #endif
***************
*** 416,433 ****
  
  		  if(idr->flags[0] & 0xf5)
  		    {
! 			  sprintf(&lbuffer[iline],"Flags=(%x) ", idr->flags[0], goof++);
  			  iline += strlen(lbuffer + iline);
  		    }
  		  if(idr->interleave[0])
  		    {
! 			  sprintf(&lbuffer[iline],"Interleave=(%d) ", idr->interleave[0], goof++);
  			  iline += strlen(lbuffer + iline);
  		    }
  
  		  if(idr->file_unit_size[0])
  		    {
! 			sprintf(&lbuffer[iline],"File unit size=(%d) ", idr->file_unit_size[0], goof++);
  			iline += strlen(lbuffer + iline);
  		    }
  
--- 434,454 ----
  
  		  if(idr->flags[0] & 0xf5)
  		    {
! 			  sprintf(&lbuffer[iline],"Flags=(%x) ", idr->flags[0]);
! 			  goof++;
  			  iline += strlen(lbuffer + iline);
  		    }
  		  if(idr->interleave[0])
  		    {
! 			  sprintf(&lbuffer[iline],"Interleave=(%d) ", idr->interleave[0]);
! 			  goof++;
  			  iline += strlen(lbuffer + iline);
  		    }
  
  		  if(idr->file_unit_size[0])
  		    {
! 			sprintf(&lbuffer[iline],"File unit size=(%d) ", idr->file_unit_size[0]);
! 			goof++;
  			iline += strlen(lbuffer + iline);
  		    }
  
***************
*** 434,440 ****
  
  		  if(idr->volume_sequence_number[0] != 1)
  		    {
! 		      sprintf(&lbuffer[iline],"Volume sequence number=(%d) ", idr->volume_sequence_number[0], goof++);
  		      iline += strlen(lbuffer + iline);
  		    }
  
--- 455,462 ----
  
  		  if(idr->volume_sequence_number[0] != 1)
  		    {
! 		      sprintf(&lbuffer[iline],"Volume sequence number=(%d) ", idr->volume_sequence_number[0]);
! 		      goof++;
  		      iline += strlen(lbuffer + iline);
  		    }
  
***************
*** 475,481 ****
    unsigned short parent;
  };
  
! 
  check_path_tables(int typel_extent, int typem_extent, int path_table_size){
    int file_addr;
    int count;
--- 497,503 ----
    unsigned short parent;
  };
  
! void
  check_path_tables(int typel_extent, int typem_extent, int path_table_size){
    int file_addr;
    int count;
