*** ./mkisofs.h.orig	Wed Dec 20 17:56:02 1995
--- ./mkisofs.h	Fri Oct 25 18:09:41 1996
***************
*** 180,185 ****
--- 180,187 ----
  extern int verbose;
  extern int all_files;
  extern int generate_tables;
+ extern int generate_mime_header;
+ extern char *mime_type;
  extern int omit_period;
  extern int omit_version_number;
  extern int transparent_compression;
***************
*** 262,264 ****
--- 264,278 ----
  #define SPATH_SEPARATOR "/"
  #endif
  
+ struct mac_partition_table {
+ 	char *type;
+ 	char *name;
+ 	char *container;
+ 	char *whole_path;
+ 	int   start;
+ 	int   size;
+ };
+ 
+ extern struct mac_partition_table mac_partitions_map [];
+ extern int    mac_partitions_cnt;
+ extern int    mac_partitions_2048;
*** ./iso9660.h.orig	Mon Jan 24 18:19:54 1994
--- ./iso9660.h	Mon Mar 11 17:19:11 1996
***************
*** 85,91 ****
  	unsigned char  name_len[2];	/* 721 */
  	char extent[4];		/* 731 */
  	char  parent[2];	/* 721 */
! 	char name[1];
  };
  
  struct iso_directory_record {
--- 85,91 ----
  	unsigned char  name_len[2];	/* 721 */
  	char extent[4];		/* 731 */
  	char  parent[2];	/* 721 */
! 	char name[2];
  };
  
  struct iso_directory_record {
***************
*** 99,105 ****
  	char interleave			[ISODCL (28, 28)]; /* 711 */
  	char volume_sequence_number	[ISODCL (29, 32)]; /* 723 */
  	unsigned char name_len		[ISODCL (33, 33)]; /* 711 */
! 	char name			[34]; /* Not really, but we need something here */
  };
  #endif
  
--- 99,105 ----
  	char interleave			[ISODCL (28, 28)]; /* 711 */
  	char volume_sequence_number	[ISODCL (29, 32)]; /* 723 */
  	unsigned char name_len		[ISODCL (33, 33)]; /* 711 */
! 	char name			[33]; /* Not really, but we need something here */
  };
  #endif
  
*** ./mkisofs.c.orig	Wed Dec 20 18:03:22 1995
--- ./mkisofs.c	Fri Nov  1 19:26:24 1996
***************
*** 76,81 ****
--- 76,83 ----
  int follow_links = 0;
  int rationalize = 0;
  int generate_tables = 0;
+ int generate_mime_header = 0;
+ char * mime_type = "application/x-cdrecordable";
  char * preparer = PREPARER_DEFAULT;
  char * publisher = PUBLISHER_DEFAULT;
  char * appid = APPID_DEFAULT;
***************
*** 94,99 ****
--- 96,136 ----
  				  DOS */
  int allow_leading_dots = 0;	 /* DOS cannot read names with leading dots */
  
+ struct mac_partition_table mac_partitions_map [6];
+ int    mac_partitions_cnt;
+ int    mac_partitions_2048;
+ 
+ void FDECL1(set_mac_partition, char *, parm)
+ { char *str;
+ 
+   if (mac_partitions_cnt >= 6) return;
+ 
+   if (str=strchr (parm,':')) *str='\0';
+   mac_partitions_map [mac_partitions_cnt].container = parm;
+   if (str)
+      parm=str+1;
+   else {
+      mac_partitions_map [mac_partitions_cnt].type = "Apple_HFS";
+      mac_partitions_map [mac_partitions_cnt].name = "Untitled";
+      return;
+   }
+ 
+   if (str=strchr (parm,':')) *str='\0';
+   mac_partitions_map [mac_partitions_cnt].type = parm;
+   if (!strncmp (parm,"Apple_Driver",12))
+      fprintf (stderr,"\07Double check, you might have to run with -2 option\n");
+   if (str)
+      parm=str+1;
+   else {
+      mac_partitions_map [mac_partitions_cnt].name = "Untitled";
+      return;
+   }
+ 
+   mac_partitions_map [mac_partitions_cnt].name = parm;
+ 
+   mac_partitions_cnt++;
+ }
+ 
  struct rcopts{
    char * tag;
    char ** variable;
***************
*** 109,118 ****
    {"VOLS", &volset_id},
    {"VOLI", &volume_id},
    {"SYSI", &system_id},
    {NULL, NULL}
  };
  
! #ifdef ultrix
  char *strdup(s)
  char *s;{char *c;if(c=(char *)malloc(strlen(s)+1))strcpy(c,s);return c;}
  #endif
--- 146,156 ----
    {"VOLS", &volset_id},
    {"VOLI", &volume_id},
    {"SYSI", &system_id},
+   {"MACP", (char **)set_mac_partition },
    {NULL, NULL}
  };
  
! #if defined(ultrix) || defined(_AUX_SOURCE)
  char *strdup(s)
  char *s;{char *c;if(c=(char *)malloc(strlen(s)+1))strcpy(c,s);return c;}
  #endif
***************
*** 126,131 ****
--- 164,170 ----
    static char rcfn[] = ".mkisofsrc";
    char filename[1000];
    int linum;
+   extern etext;
  
    strcpy(filename, rcfn);
    rcfile = fopen(filename, "r");
***************
*** 134,139 ****
--- 173,189 ----
  
    if (!rcfile)
      {
+       pnt = getenv("MKISOFSRC");
+       if (pnt && strlen(pnt) <= sizeof(filename))
+         {
+           strcpy(filename, pnt);
+           rcfile = fopen(filename, "r");
+           if (!rcfile && errno != ENOENT)
+             perror(filename);
+         }
+     }
+   if (!rcfile)
+     {
        pnt = getenv("HOME");
        if (pnt && strlen(pnt) + strlen(rcfn) + 2 <= sizeof(filename))
  	{
***************
*** 202,208 ****
        pnt++; /* Skip past '=' sign */
        while (*pnt == ' ' || *pnt == '\t')
  	pnt++;
!       +       /* now it is safe to NUL terminate the name */
  	*name_end = 0;
        /* Now get rid of trailing newline */
        pnt1 = pnt;
--- 252,258 ----
        pnt++; /* Skip past '=' sign */
        while (*pnt == ' ' || *pnt == '\t')
  	pnt++;
!       /* now it is safe to NUL terminate the name */
  	*name_end = 0;
        /* Now get rid of trailing newline */
        pnt1 = pnt;
***************
*** 219,225 ****
        for(rco = rcopt; rco->tag; rco++) {
  	if(strcmp(rco->tag, name) == 0)
  	  {
! 	    *rco->variable = strdup(pnt);
  	    break;
  	  };
        }
--- 269,278 ----
        for(rco = rcopt; rco->tag; rco++) {
  	if(strcmp(rco->tag, name) == 0)
  	  {
! 	    if ((int)rco->variable >= (int)&etext)
! 	       *rco->variable = strdup(pnt);
! 	    else
! 	       (*((void(*)(char*))rco->variable))(strdup(pnt));
  	    break;
  	  };
        }
***************
*** 243,249 ****
  	fprintf(stderr,
  "mkisofs [-o outfile] [-R] [-V volid] [-v] [-a] \
  [-T]\n [-l] [-d] [-V] [-D] [-L] [-p preparer] \
! [-P publisher] [ -A app_id ] [-z] \
  [-x path -x path ...] path\n");
  	exit(1);
  }
--- 296,302 ----
  	fprintf(stderr,
  "mkisofs [-o outfile] [-R] [-V volid] [-v] [-a] \
  [-T]\n [-l] [-d] [-V] [-D] [-L] [-p preparer] \
! [-P publisher] [ -A app_id ] [-z] [-m|-M mime/type] [-2] \
  [-x path -x path ...] path\n");
  	exit(1);
  }
***************
*** 290,295 ****
--- 343,349 ----
    int seen_dot = 0;
    int seen_semic = 0;
    char * result;
+   char * last_dot;
    int priority = 32767;
    int tildes = 0;
    int ignore = 0;
***************
*** 314,319 ****
--- 368,374 ----
    };
  
    pnt = name;
+   last_dot = strrchr (pnt,'.');
    while(*pnt){
  #ifdef VMS
      if(strcmp(pnt,".DIR;1") == 0) break;
***************
*** 341,346 ****
--- 396,406 ----
  	  /* DOS can't read files with dot first */
            chars_before_dot++;
            if (result) *result++ = '_'; /* Substitute underscore */
+         } else if (pnt != last_dot) {
+           if(chars_before_dot < 8) {
+             chars_before_dot++;
+             if(result) *result++ = '_';
+           }
          } else {
            if (seen_dot) {ignore++; continue;}
  	  if(result) *result++ = '.';
***************
*** 559,565 ****
    read_rcfile(argv[0]);
  
    outfile = NULL;
!   while ((c = getopt(argc, argv, "i:o:V:RrfvaTp:P:x:dDlLNzA:")) != EOF)
      switch (c)
        {
        case 'p':
--- 619,625 ----
    read_rcfile(argv[0]);
  
    outfile = NULL;
!   while ((c = getopt(argc, argv, "i:o:V:RrfvaTp:P:x:dDlLNzA:mM:2")) != EOF)
      switch (c)
        {
        case 'p':
***************
*** 639,644 ****
--- 699,712 ----
  	add_file_file = optarg;
  	break;
  #endif
+       case 'M':
+ 	mime_type = optarg;
+       case 'm':
+ 	generate_mime_header++;
+ 	break;
+       case '2':
+ 	mac_partitions_2048++;
+ 	break;
        default:
  	usage();
  	exit(1);
***************
*** 699,704 ****
--- 767,788 ----
  #endif
    };
  
+ #ifndef VMS
+   if (geteuid() == 0) {
+      stat(argv[optind], &statbuf);
+      if (setuid (statbuf.st_uid) < 0)
+ #if defined(sun) || defined(_AUX_SOURCE)
+ 	fprintf (stderr,"setuid (%d): #%d - ignoring.\n",statbuf.st_uid,errno);
+ #else
+ 	fprintf (stderr,"setuid (%d): %s - ignoring.\n",statbuf.st_uid,strerror(errno));
+ #endif
+      else
+ 	fprintf (stderr,"setuid (%d): OK\n",statbuf.st_uid);
+   }
+   else
+      fprintf (stderr,"Running as #%d\n",getuid());
+ #endif
+ 
    stat_filter(argv[optind], &statbuf);
    add_directory_hash(statbuf.st_dev, STAT_INODE(statbuf));
  
***************
*** 771,781 ****
  #endif
  }
  
! void *e_malloc(size_t size)
  {
  void* pt;
  	if((pt=malloc(size))==NULL) {
! 		printf("Not enougth memory\n");
  		exit (1);
  		}
  return pt;
--- 855,866 ----
  #endif
  }
  
! void *
! FDECL1(e_malloc, size_t, size)
  {
  void* pt;
  	if((pt=malloc(size))==NULL) {
! 		fprintf(stderr,"Not enough memory\n");
  		exit (1);
  		}
  return pt;
*** ./tree.c.orig	Wed Dec 20 18:03:48 1995
--- ./tree.c	Wed Mar 13 17:09:47 1996
***************
*** 84,95 ****
       system.  */
    st->st_uid = 0;
    st->st_gid = 0;
!   +   /* Make sure the file modes make sense.  Turn on all read bits.  Turn
! 	 on all exec/search bits if any exec/search bit is set.  Turn off
! 	 all write bits, and all special mode bits (on a r/o fs lock bits
! 	 are useless, and with uid+gid 0 don't want set-id bits, either).
! 	 */
!     st->st_mode |= 0444;
    if (st->st_mode & 0111)
      st->st_mode |= 0111;
    st->st_mode &= ~07222;
--- 84,95 ----
       system.  */
    st->st_uid = 0;
    st->st_gid = 0;
!   /* Make sure the file modes make sense.  Turn on all read bits.  Turn
!      on all exec/search bits if any exec/search bit is set.  Turn off
!      all write bits, and all special mode bits (on a r/o fs lock bits
!      are useless, and with uid+gid 0 don't want set-id bits, either).
!   */
!   st->st_mode |= 0444;
    if (st->st_mode & 0111)
      st->st_mode |= 0111;
    st->st_mode &= ~07222;
***************
*** 227,233 ****
  	  for (s_entry = this_dir->contents; s_entry; s_entry = s_entry->next){
  		  if(strcmp(s_entry->name, ".") == 0  ||
  		     strcmp(s_entry->name, "..") == 0) continue; 
! 		  if(s_entry->table) tablesize += 35 + strlen(s_entry->table);
  	  };
  		  table = (struct directory_entry *) 
  		e_malloc(sizeof (struct directory_entry));
--- 227,233 ----
  	  for (s_entry = this_dir->contents; s_entry; s_entry = s_entry->next){
  		  if(strcmp(s_entry->name, ".") == 0  ||
  		     strcmp(s_entry->name, "..") == 0) continue; 
! 		  if(s_entry->table) tablesize += 34 + strlen(s_entry->table);
  	  };
  		  table = (struct directory_entry *) 
  		e_malloc(sizeof (struct directory_entry));
***************
*** 265,271 ****
  	  
  	  if(s_entry->isorec.flags[0] ==  2){
  		  if (strcmp(s_entry->name,".") && strcmp(s_entry->name,"..")) {
! 			  path_table_size += new_reclen + sizeof(struct iso_path_table) - 1;
  			  if (new_reclen & 1) path_table_size++;
  		  } else {
  			  new_reclen = 1;
--- 265,271 ----
  	  
  	  if(s_entry->isorec.flags[0] ==  2){
  		  if (strcmp(s_entry->name,".") && strcmp(s_entry->name,"..")) {
! 			  path_table_size += new_reclen + sizeof(struct iso_path_table) - 2;
  			  if (new_reclen & 1) path_table_size++;
  		  } else {
  			  new_reclen = 1;
***************
*** 308,314 ****
  		     strcmp(s_entry->name, "..") == 0) continue;
  
  		  sprintf(buffer,"%c %-34s%s",s_entry->table[0],  
! 			  s_entry->isorec.name, s_entry->table+1);
  		  memcpy(table->table + count, buffer, strlen(buffer));
  		  count +=  strlen(buffer);
  		  free(s_entry->table);
--- 308,314 ----
  		     strcmp(s_entry->name, "..") == 0) continue;
  
  		  sprintf(buffer,"%c %-34s%s",s_entry->table[0],  
! 			  s_entry->isorec.name, s_entry->table+2);
  		  memcpy(table->table + count, buffer, strlen(buffer));
  		  count +=  strlen(buffer);
  		  free(s_entry->table);
***************
*** 952,957 ****
--- 952,958 ----
   
      if(generate_tables && strcmp(s_entry->name, ".") && strcmp(s_entry->name, "..")) {
  	    char  buffer[2048];
+ 	    int   len;
  	    switch(lstatbuf.st_mode & S_IFMT){
  	    case S_IFDIR:
  		    sprintf(buffer,"D\t%s\n",
***************
*** 975,981 ****
  			    (unsigned long) minor(statbuf.st_rdev));
  		    break;
  	    case S_IFLNK:
! 		    readlink(whole_path, symlink_buff, sizeof(symlink_buff));
  		    sprintf(buffer,"L\t%s\t%s\n",
  			    s_entry->name, symlink_buff);
  		    break;
--- 976,983 ----
  			    (unsigned long) minor(statbuf.st_rdev));
  		    break;
  	    case S_IFLNK:
! 		    len = readlink(whole_path, symlink_buff, sizeof(symlink_buff));
! 		    symlink_buff [len<0 ? 0 : len] = '\0';
  		    sprintf(buffer,"L\t%s\t%s\n",
  			    s_entry->name, symlink_buff);
  		    break;
*** ./write.c.orig	Wed Dec 20 19:46:34 1995
--- ./write.c	Tue Oct 29 13:32:08 1996
***************
*** 25,30 ****
--- 25,31 ----
  #include "iso9660.h"
  #include <time.h>
  #include <errno.h>
+ #include "mac_label.h"
  
  #ifdef __svr4__
  extern char * strdup(const char *);
***************
*** 157,163 ****
    int use;
    int remain;
    if ((infile = fopen(filename, "rb")) == NULL) {
! #ifdef sun
        fprintf(stderr, "cannot open %s: (%d)\n", filename, errno);
  #else
        fprintf(stderr, "cannot open %s: %s\n", filename, strerror(errno));
--- 158,164 ----
    int use;
    int remain;
    if ((infile = fopen(filename, "rb")) == NULL) {
! #if defined(sun) || defined(_AUX_SOURCE)
        fprintf(stderr, "cannot open %s: (%d)\n", filename, errno);
  #else
        fprintf(stderr, "cannot open %s: %s\n", filename, strerror(errno));
***************
*** 184,190 ****
  	     time_t now;
  	     time_t the_end;
  	     double frac;
! 	     ! 	     time(&now);
  	     frac = last_extent_written / (double)last_extent;
  	     the_end = begun + (now - begun) / frac;
  	     fprintf(stderr, "%6.2f%% done, estimate finish %s",
--- 185,191 ----
  	     time_t now;
  	     time_t the_end;
  	     double frac;
! 	     time(&now);
  	     frac = last_extent_written / (double)last_extent;
  	     the_end = begun + (now - begun) / frac;
  	     fprintf(stderr, "%6.2f%% done, estimate finish %s",
***************
*** 313,327 ****
    root_record.name_len[0] = 1;
  }
  
! static void FDECL1(assign_file_addresses, struct directory *, dpnt){
    struct directory * finddir;
    struct directory_entry * s_entry;
    struct file_hash *s_hash;
    struct deferred_write * dwpnt;
    char whole_path[1024];
  
    while (dpnt){
      s_entry = dpnt->contents;
      for(s_entry = dpnt->contents; s_entry; s_entry = s_entry->next){
        
        /* This saves some space if there are symlinks present */
--- 314,342 ----
    root_record.name_len[0] = 1;
  }
  
! static void FDECL2(assign_file_addresses, struct directory *, dpnt, char *, rpath){
    struct directory * finddir;
    struct directory_entry * s_entry;
    struct file_hash *s_hash;
    struct deferred_write * dwpnt;
    char whole_path[1024];
+   char rela_path[1024];
+   int  rela_path_len=0;
  
    while (dpnt){
      s_entry = dpnt->contents;
+ 
+     if (rpath) {
+        if (strlen(rpath)+strlen(dpnt->de_name)+2 < sizeof(rela_path)) {
+           strcpy (rela_path,rpath);
+           strcat (rela_path,dpnt->de_name);
+           strcat (rela_path,"/");
+        }
+     }
+     else *rela_path='\0';
+ 
+     rela_path_len = strlen (rela_path);
+ 
      for(s_entry = dpnt->contents; s_entry; s_entry = s_entry->next){
        
        /* This saves some space if there are symlinks present */
***************
*** 406,411 ****
--- 421,442 ----
  	    if(verbose)
  	      fprintf(stderr,"%d %d %s\n", s_entry->starting_block,
  		      last_extent-1, whole_path);
+ 
+ 	    if (mac_partitions_cnt) {
+ 	       int i=strlen(s_entry->name)+1;
+ 
+ 	       if (rela_path_len+i < sizeof (rela_path)) {
+ 	          memcpy (rela_path+rela_path_len,s_entry->name,i);
+ 	          for (i=0;i<mac_partitions_cnt;i++)
+ 	            if (!strcmp (rela_path,mac_partitions_map[i].container)) {
+ 	              mac_partitions_map[i].start=s_entry->starting_block;
+ 	              mac_partitions_map[i].size =ROUND_UP(s_entry->size)/SECTOR_SIZE;
+                       mac_partitions_map[i].whole_path=s_entry->whole_name;
+ 	            }
+ 	          rela_path [rela_path_len] = '\0';
+ 	       }
+ 	    }
+ 
  #ifdef DBG_ISO
  	    if((ROUND_UP(s_entry->size) >> 11) > 500){
  	      fprintf(stderr,"Warning: large file %s\n", whole_path);
***************
*** 432,438 ****
  	};
        };
      };
!     if(dpnt->subdir) assign_file_addresses(dpnt->subdir);
      dpnt = dpnt->next;
    };
  }
--- 463,469 ----
  	};
        };
      };
!     if(dpnt->subdir) assign_file_addresses(dpnt->subdir,rela_path);
      dpnt = dpnt->next;
    };
  }
***************
*** 662,669 ****
    int i;
  
    time(&begun);
!   assign_file_addresses(root);
  
    memset(buffer, 0, sizeof(buffer));
  
    /* This will break  in the year  2000, I supose, but there is no good way
--- 693,708 ----
    int i;
  
    time(&begun);
!   assign_file_addresses(root,NULL);
  
+   if (generate_mime_header)
+   {  fprintf (stderr,"Generating MIME header:\n");
+      printf ("Content-type: %s\r\n",mime_type);
+      fprintf (stderr, "\tContent-type: %s\n",mime_type);
+      printf ("Content-length: %u\r\n",last_extent*SECTOR_SIZE);
+      fprintf (stderr, "\tContent-length: %u\n",last_extent*SECTOR_SIZE);
+      printf ("\r\n");
+   }
    memset(buffer, 0, sizeof(buffer));
  
    /* This will break  in the year  2000, I supose, but there is no good way
***************
*** 672,677 ****
--- 711,828 ----
  	  local->tm_mon+1, local->tm_mday,
  	  local->tm_hour, local->tm_min, local->tm_sec);
  
+   /* get rid of non-existing partitions */
+   for (i=0;i<mac_partitions_cnt;)
+       if (!mac_partitions_map[i].whole_path)
+          mac_partitions_map[i]=mac_partitions_map[i+1],
+          mac_partitions_cnt--;
+       else
+          i++;
+ 
+   if (mac_partitions_cnt) {
+      MacLabel *mac_label;
+      MacPart  *mac_part;
+      char     *buffer;
+      int       block_size = mac_partitions_2048 ? SECTOR_SIZE : 512;
+ 
+      if (verbose) fprintf (stderr,"Generating Mac partition table.\n");
+ 
+      buffer = e_malloc (16*SECTOR_SIZE);
+      memset (buffer, 0, 16*SECTOR_SIZE);
+ 
+      mac_label = buffer;
+      mac_label->sbSig [0] = 'E';
+      mac_label->sbSig [1] = 'R';
+      set_722 (mac_label->sbBlkSize,block_size);
+      set_732 (mac_label->sbBlkCount,last_extent*(SECTOR_SIZE/block_size));
+      set_722 (mac_label->sbDevType,1);
+      set_722 (mac_label->sbDevId,1);
+ 
+      mac_part = (MacPart*)(buffer+block_size);
+      mac_part->pmSig [0] = 'P';
+      mac_part->pmSig [1] = 'M';
+      set_732 (mac_part->pmMapBlkCnt,mac_partitions_cnt+1);
+      set_732 (mac_part->pmPyPartStart,1);
+      set_732 (mac_part->pmPartBlkCnt,mac_partitions_cnt+1);
+      strncpy (mac_part->pmPartName,"Apple",sizeof(mac_part->pmPartName));
+      strncpy (mac_part->pmPartType,"Apple_partition_map",sizeof(mac_part->pmPartType));
+      set_732 (mac_part->pmLgDataStart,0);
+      set_732 (mac_part->pmDataCnt,mac_partitions_cnt+1);
+      set_732 (mac_part->pmPartStatus,PM_STAT_DEFAULT);
+ 
+      for (i=0;i<mac_partitions_cnt;i++) {
+          mac_part = (MacPart*)(buffer + (i+2)*block_size);
+          if (!strncmp(mac_partitions_map[i].type,"Apple_Driver",12)) {
+             FILE *fp=fopen (mac_partitions_map[i].whole_path,"r");
+             fread (mac_label,512,1,fp); /* get driver label and patch it */
+             set_732 (mac_label->sbBlkCount,last_extent*(SECTOR_SIZE/block_size));
+             set_732 (mac_label->ddBlock,(mac_partitions_map[i].start+1)*(SECTOR_SIZE/block_size));
+             fread (mac_part,512,1,fp);
+             fclose(fp);
+             set_732 (mac_part->pmMapBlkCnt,mac_partitions_cnt+1);
+             set_732 (mac_part->pmPyPartStart,(mac_partitions_map[i].start+1)*(SECTOR_SIZE/block_size));
+          }
+          else {
+             mac_part->pmSig [0] = 'P';
+             mac_part->pmSig [1] = 'M';
+             set_732 (mac_part->pmMapBlkCnt,mac_partitions_cnt+1);
+             set_732 (mac_part->pmPyPartStart,mac_partitions_map[i].start*(SECTOR_SIZE/512));
+             set_732 (mac_part->pmPartBlkCnt,mac_partitions_map[i].size*(SECTOR_SIZE/512));
+             strncpy (mac_part->pmPartName,mac_partitions_map[i].name,sizeof(mac_part->pmPartName));
+             strncpy (mac_part->pmPartType,mac_partitions_map[i].type,sizeof(mac_part->pmPartType));
+             set_732 (mac_part->pmLgDataStart,0);
+             set_732 (mac_part->pmDataCnt,mac_partitions_map[i].size*(SECTOR_SIZE/512));
+             set_732 (mac_part->pmPartStatus,PM_STAT_DEFAULT);
+          }
+      }
+ 
+      if (mac_partitions_2048) { /* generate 512 partition table as well */
+      mac_part = (MacPart*)(buffer+512);
+      if (mac_partitions_cnt<3) { /* don't have to interleave with 2048 table */
+          mac_part->pmSig [0] = 'P';
+          mac_part->pmSig [1] = 'M';
+          set_732 (mac_part->pmMapBlkCnt,mac_partitions_cnt+1);
+          set_732 (mac_part->pmPyPartStart,1);
+          set_732 (mac_part->pmPartBlkCnt,mac_partitions_cnt+1);
+          strncpy (mac_part->pmPartName,"Apple",sizeof(mac_part->pmPartName));
+          strncpy (mac_part->pmPartType,"Apple_partition_map",sizeof(mac_part->pmPartType));
+          set_732 (mac_part->pmLgDataStart,0);
+          set_732 (mac_part->pmDataCnt,mac_partitions_cnt+1);
+          set_732 (mac_part->pmPartStatus,PM_STAT_DEFAULT);
+          mac_part++; /* +512 */
+      }
+      for (i=0;i<mac_partitions_cnt;i++,mac_part++) {
+          if (mac_part == (MacPart*)(buffer+SECTOR_SIZE)) mac_part++; /* jump over 2048 partition entry */
+          if (!strncmp(mac_partitions_map[i].type,"Apple_Driver",12)) {
+             FILE *fp=fopen (mac_partitions_map[i].whole_path,"r");
+             fseek (fp,512*2,SEEK_SET);
+             fread (mac_part,512,1,fp);
+             fclose(fp);
+             if (!IS_MAC_PART(mac_part)) { mac_part--; continue; }
+             set_732 (mac_part->pmMapBlkCnt,mac_partitions_cnt+1);
+             set_732 (mac_part->pmPyPartStart,(mac_partitions_map[i].start+1)*(SECTOR_SIZE/512));
+          }
+          else {
+             mac_part->pmSig [0] = 'P';
+             mac_part->pmSig [1] = 'M';
+             set_732 (mac_part->pmMapBlkCnt,mac_partitions_cnt+1);
+             set_732 (mac_part->pmPyPartStart,mac_partitions_map[i].start*(SECTOR_SIZE/512));
+             set_732 (mac_part->pmPartBlkCnt,mac_partitions_map[i].size*(SECTOR_SIZE/512));
+             strncpy (mac_part->pmPartName,mac_partitions_map[i].name,sizeof(mac_part->pmPartName));
+             strncpy (mac_part->pmPartType,mac_partitions_map[i].type,sizeof(mac_part->pmPartType));
+             set_732 (mac_part->pmLgDataStart,0);
+             set_732 (mac_part->pmDataCnt,mac_partitions_map[i].size*(SECTOR_SIZE/512));
+             set_732 (mac_part->pmPartStatus,PM_STAT_DEFAULT);
+          }
+      }
+ 
+      }
+      xfwrite(buffer, 1, 16*SECTOR_SIZE, outfile);
+ 
+      free(buffer);
+   }
+   else
+ 
    /* First, we output 16 sectors of all zero */
  
    for(i=0; i<16; i++)
*** ./defaults.h.orig	Sun Feb  5 00:55:04 1995
--- ./defaults.h	Sat Oct 26 16:15:18 1996
***************
*** 3,16 ****
   * the volume descriptor.
   */
  
! #define  PREPARER_DEFAULT 	NULL
! #define  PUBLISHER_DEFAULT	NULL
  #define  APPID_DEFAULT 		NULL
! #define  COPYRIGHT_DEFAULT 	NULL
! #define  BIBLIO_DEFAULT 	NULL
! #define  ABSTRACT_DEFAULT 	NULL
! #define  VOLSET_ID_DEFAULT 	NULL
! #define  VOLUME_ID_DEFAULT 	"CDROM"
  
  #ifdef __QNX__
  #define  SYSTEM_ID_DEFAULT 	"QNX"
--- 3,16 ----
   * the volume descriptor.
   */
  
! #define  PREPARER_DEFAULT 	"MKISOFS 1.05 BY ERIC YOUNGDALE. COPYRIGHT (C) 1993 YGGDRASIL COMPUTING, INCORPORATED. PLUS EXTENSIONS BY APPRO@FY.CHALMERS.SE."
! #define  PUBLISHER_DEFAULT	"FYSIKDATORN, CHALMERS UNIVERSITY OF TECHNOLOGY, GOTHENBURG, S-412 96 SWEDEN, TEL. +46(31)7721000"
  #define  APPID_DEFAULT 		NULL
! #define  COPYRIGHT_DEFAULT 	"COPYRGHT.FIL;1"
! #define  BIBLIO_DEFAULT 	"BIBLIOG.FIL;1"
! #define  ABSTRACT_DEFAULT 	"ABSTRACT.FIL;1"
! #define  VOLSET_ID_DEFAULT 	"CDROM"
! #define  VOLUME_ID_DEFAULT 	"NONAME"
  
  #ifdef __QNX__
  #define  SYSTEM_ID_DEFAULT 	"QNX"
***************
*** 20,25 ****
--- 20,27 ----
  #define  SYSTEM_ID_DEFAULT 	"OSF"
  #endif
  
+ #define  SYSTEM_ID_DEFAULT	"SPARC SOLARIS 2.X"
+ 
  #ifndef SYSTEM_ID_DEFAULT
  #define  SYSTEM_ID_DEFAULT 	"LINUX"
  #endif
*** ./mac_label.h.orig	Mon Oct 21 19:14:36 1996
--- ./mac_label.h	Tue Oct 22 23:26:23 1996
***************
*** 0 ****
--- 1,87 ----
+ #ifndef __MAC_LABEL__
+ #define __MAC_LABEL__
+ 
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
+ 
+ /* Driver Descriptor Map */
+ #define sbSigMagic	"ER"
+ struct MacLabel {
+ 	unsigned char	sbSig[2];	/* unique value for SCSI block 0 */
+ 	unsigned char	sbBlkSize[2];	/* block size of device */
+ 	unsigned char	sbBlkCount[4];	/* number of blocks on device */
+ 	unsigned char	sbDevType[2];	/* device type */
+ 	unsigned char	sbDevId[2];	/* device id */
+ 	unsigned char	sbData[4];	/* not used */
+ 	unsigned char	sbDrvrCount[2];	/* driver descriptor count */
+ 	unsigned char	ddBlock[4];	/* 1st driver's starting block */
+ 	unsigned char	ddSize[2];	/* size of 1st driver (512-byte blks) */
+ 	unsigned char	ddType[2];	/* system type (1 for Mac+) */
+ 	unsigned char	ddPad[486];	/* ARRAY[0..242] OF INTEGER; not used */
+ };
+ typedef struct MacLabel MacLabel;
+ 
+ #define IS_MAC_LABEL(d)		(((MacLabel*)(d))->sbSig[0]=='E'&&((MacLabel*)(d))->sbSig[1]=='R')
+ 
+ /* Partition Map Entry */
+ #define pmSigMagic	"PM"
+ 
+ #define pmPartType_1	"Apple_partition_map"
+ #	define pmPartName_11	"Apple"
+ 
+ #define pmPartType_2	"Apple_Driver"
+ #define pmPartType_21	"Apple_Driver43"
+ 
+ #define pmPartType_3	"Apple_UNIX_SVR2"
+ #	define pmPartName_31	"A/UX Root"
+ #	define pmPartName_32	"A/UX Usr"
+ #	define pmPartName_33	"Random A/UX fs"
+ #	define pmPartName_34	"Swap"
+ 
+ #define pmPartType_4	"Apple_HFS"
+ #	define pmPartName_41	"MacOS"
+ 
+ #define pmPartType_5	"Apple_Free"
+ #	define pmPartName_51	"Extra"
+ 
+ struct MacPart {
+ 	unsigned char	pmSig[2];	/* unique value for map entry blk */
+ 	unsigned char	pmSigPad[2];	/* currently unused */
+ 	unsigned char	pmMapBlkCnt[4];	/* # of blks in partition map */
+ 	unsigned char	pmPyPartStart[4];/* physical start blk of partition */
+ 	unsigned char	pmPartBlkCnt[4];/* # of blks in this partition */
+ 	unsigned char	pmPartName[32];	/* ASCII partition name */
+ 	unsigned char	pmPartType[32];	/* ASCII partition type */
+ 	unsigned char	pmLgDataStart[4];/* log. # of partition's 1st data blk */
+ 	unsigned char	pmDataCnt[4];	/* # of blks in partition's data area */
+ 	unsigned char	pmPartStatus[4];/* bit field for partition status */
+ 	unsigned char	pmLgBootStart[4];/* log. blk of partition's boot code */
+ 	unsigned char	pmBootSize[4];	/* number of bytes in boot code */
+ 	unsigned char	pmBootAddr[4];	/* memory load address of boot code */
+ 	unsigned char	pmBootAddr2[4];	/* currently unused */
+ 	unsigned char	pmBootEntry[4];	/* entry point of boot code */
+ 	unsigned char	pmBootEntry2[4];/* currently unused */
+ 	unsigned char	pmBootCksum[4];	/* checksum of boot code */
+ 	unsigned char	pmProcessor[16];/* ASCII for the processor type */
+ 	unsigned char	pmPad[376];	/* ARRAY[0..187] OF INTEGER; not used */
+ };
+ typedef struct MacPart MacPart;
+ 
+ #define IS_MAC_PART(d)		(((MacPart*)(d))->pmSig[0]=='P'&&((MacPart*)(d))->pmSig[1]=='M')
+ 
+ #define PM_STAT_VALID		0x01	/* Set if a valid partition map entry */
+ #define PM_STAT_ALLOC		0x02	/* Set if partition is already allocated; clear if available */
+ #define PM_STAT_INUSE		0x04	/* Set if partition is in use; may be cleared after a system reset */
+ #define PM_STAT_BOOTABLE	0x08	/* Set if partition contains valid boot information */
+ #define PM_STAT_READABLE	0x10	/* Set if partition allows reading */
+ #define PM_STAT_WRITABLE	0x20	/* Set if partition allows writing */
+ #define PM_STAT_BOOT_PIC	0x40	/* Set if boot code is position-independent */
+ #define PM_STAT_UNUSED		0x80	/* Unused */
+ #define PM_STAT_DEFAULT		PM_STAT_VALID|PM_STAT_ALLOC|PM_STAT_READABLE|PM_STAT_WRITABLE
+ 
+ #ifdef __cplusplus
+ }
+ #endif
+ 
+ #endif /* __MAC_LABEL__ */
*** ./Makefile.in.orig	Tue Oct 22 10:36:59 1996
--- ./Makefile.in	Fri Oct 25 18:30:10 1996
***************
*** 1,11 ****
  #CFLAGS=-g -Wall -c
! #CC=gcc
  
  #
  # XCFLAGS is automatically set by Configure.
  #
  XCFLAGS=
! CFLAGS=-g -c $(XCFLAGS)
  LDFLAGS=
  OBJS=mkisofs.o tree.o write.o hash.o rock.o exclude.o
  
--- 1,11 ----
  #CFLAGS=-g -Wall -c
! CC=gcc
  
  #
  # XCFLAGS is automatically set by Configure.
  #
  XCFLAGS=
! CFLAGS=-O -funsigned-char -c $(XCFLAGS)
  LDFLAGS=
  OBJS=mkisofs.o tree.o write.o hash.o rock.o exclude.o
  
***************
*** 26,32 ****
  tree.o: tree.c mkisofs.h iso9660.h exclude.h
  	$(CC) $(CFLAGS) tree.c
  
! write.o: write.c mkisofs.h iso9660.h
  	$(CC) $(CFLAGS) write.c
  
  hash.o: hash.c mkisofs.h 
--- 26,32 ----
  tree.o: tree.c mkisofs.h iso9660.h exclude.h
  	$(CC) $(CFLAGS) tree.c
  
! write.o: write.c mkisofs.h iso9660.h mac_label.h
  	$(CC) $(CFLAGS) write.c
  
  hash.o: hash.c mkisofs.h 
