[Debburn-changes] r453 - in cdrkit/trunk: . debian genisoimage

Eduard Bloch blade at alioth.debian.org
Thu Nov 23 23:11:42 CET 2006


Author: blade
Date: 2006-11-23 23:11:41 +0100 (Thu, 23 Nov 2006)
New Revision: 453

Added:
   cdrkit/trunk/debian/genisoimage.dirs
   cdrkit/trunk/debian/genisoimage.install
   cdrkit/trunk/debian/genisoimage.links
   cdrkit/trunk/genisoimage/
   cdrkit/trunk/genisoimage/CMakeLists.txt
   cdrkit/trunk/genisoimage/apple.c
   cdrkit/trunk/genisoimage/apple_driver.8
   cdrkit/trunk/genisoimage/apple_driver.c
   cdrkit/trunk/genisoimage/boot-alpha.c
   cdrkit/trunk/genisoimage/boot-hppa.c
   cdrkit/trunk/genisoimage/boot-mips.c
   cdrkit/trunk/genisoimage/boot-mipsel.c
   cdrkit/trunk/genisoimage/boot.c
   cdrkit/trunk/genisoimage/bootinfo.h
   cdrkit/trunk/genisoimage/bswap.h
   cdrkit/trunk/genisoimage/build_genisoimage.com
   cdrkit/trunk/genisoimage/desktop.c
   cdrkit/trunk/genisoimage/diag/
   cdrkit/trunk/genisoimage/dvd_file.c
   cdrkit/trunk/genisoimage/dvd_reader.c
   cdrkit/trunk/genisoimage/dvd_reader.h
   cdrkit/trunk/genisoimage/eltorito.c
   cdrkit/trunk/genisoimage/files.c
   cdrkit/trunk/genisoimage/genisoimage.8
   cdrkit/trunk/genisoimage/genisoimage.c
   cdrkit/trunk/genisoimage/genisoimage.h
   cdrkit/trunk/genisoimage/hash.c
   cdrkit/trunk/genisoimage/ifo_read.c
   cdrkit/trunk/genisoimage/ifo_read.h
   cdrkit/trunk/genisoimage/ifo_types.h
   cdrkit/trunk/genisoimage/iso9660.h
   cdrkit/trunk/genisoimage/joliet.c
   cdrkit/trunk/genisoimage/jte.c
   cdrkit/trunk/genisoimage/mac_label.c
   cdrkit/trunk/genisoimage/mac_label.h
   cdrkit/trunk/genisoimage/mkhybrid.8
   cdrkit/trunk/genisoimage/multi.c
   cdrkit/trunk/genisoimage/name.c
   cdrkit/trunk/genisoimage/rock.c
   cdrkit/trunk/genisoimage/rsync.c
   cdrkit/trunk/genisoimage/scsi.c
   cdrkit/trunk/genisoimage/stream.c
   cdrkit/trunk/genisoimage/sunlabel.h
   cdrkit/trunk/genisoimage/tree.c
   cdrkit/trunk/genisoimage/udf.c
   cdrkit/trunk/genisoimage/udf.h
   cdrkit/trunk/genisoimage/udf_fs.h
   cdrkit/trunk/genisoimage/vms.c
   cdrkit/trunk/genisoimage/vms.h
   cdrkit/trunk/genisoimage/volume.c
   cdrkit/trunk/genisoimage/write.c
Removed:
   cdrkit/trunk/debian/mkisofs.dirs
   cdrkit/trunk/debian/mkisofs.install
   cdrkit/trunk/debian/mkisofs.links
   cdrkit/trunk/genisoimage/CMakeLists.txt
   cdrkit/trunk/genisoimage/apple.c
   cdrkit/trunk/genisoimage/apple_driver.8
   cdrkit/trunk/genisoimage/apple_driver.c
   cdrkit/trunk/genisoimage/boot-alpha.c
   cdrkit/trunk/genisoimage/boot-hppa.c
   cdrkit/trunk/genisoimage/boot-mips.c
   cdrkit/trunk/genisoimage/boot-mipsel.c
   cdrkit/trunk/genisoimage/boot.c
   cdrkit/trunk/genisoimage/bootinfo.h
   cdrkit/trunk/genisoimage/bswap.h
   cdrkit/trunk/genisoimage/build_mkisoimage.com
   cdrkit/trunk/genisoimage/desktop.c
   cdrkit/trunk/genisoimage/diag/
   cdrkit/trunk/genisoimage/dvd_file.c
   cdrkit/trunk/genisoimage/dvd_reader.c
   cdrkit/trunk/genisoimage/dvd_reader.h
   cdrkit/trunk/genisoimage/eltorito.c
   cdrkit/trunk/genisoimage/files.c
   cdrkit/trunk/genisoimage/hash.c
   cdrkit/trunk/genisoimage/ifo_read.c
   cdrkit/trunk/genisoimage/ifo_read.h
   cdrkit/trunk/genisoimage/ifo_types.h
   cdrkit/trunk/genisoimage/iso9660.h
   cdrkit/trunk/genisoimage/joliet.c
   cdrkit/trunk/genisoimage/jte.c
   cdrkit/trunk/genisoimage/mac_label.c
   cdrkit/trunk/genisoimage/mac_label.h
   cdrkit/trunk/genisoimage/mkhybrid.8
   cdrkit/trunk/genisoimage/mkisoimage.8
   cdrkit/trunk/genisoimage/mkisoimage.c
   cdrkit/trunk/genisoimage/mkisoimage.h
   cdrkit/trunk/genisoimage/multi.c
   cdrkit/trunk/genisoimage/name.c
   cdrkit/trunk/genisoimage/rock.c
   cdrkit/trunk/genisoimage/rsync.c
   cdrkit/trunk/genisoimage/scsi.c
   cdrkit/trunk/genisoimage/stream.c
   cdrkit/trunk/genisoimage/sunlabel.h
   cdrkit/trunk/genisoimage/tree.c
   cdrkit/trunk/genisoimage/udf.c
   cdrkit/trunk/genisoimage/udf.h
   cdrkit/trunk/genisoimage/udf_fs.h
   cdrkit/trunk/genisoimage/vms.c
   cdrkit/trunk/genisoimage/vms.h
   cdrkit/trunk/genisoimage/volume.c
   cdrkit/trunk/genisoimage/write.c
   cdrkit/trunk/mkisoimage/
Modified:
   cdrkit/trunk/CMakeLists.txt
   cdrkit/trunk/debian/control
   cdrkit/trunk/debian/copyright
   cdrkit/trunk/debian/rules
Log:
Name is finally genisoimage, debian/* fixes, debian/copyright cleanup

Modified: cdrkit/trunk/CMakeLists.txt
===================================================================
--- cdrkit/trunk/CMakeLists.txt	2006-11-23 21:59:20 UTC (rev 452)
+++ cdrkit/trunk/CMakeLists.txt	2006-11-23 22:11:41 UTC (rev 453)
@@ -1,3 +1,3 @@
 PROJECT (cdrkit)
-SUBDIRS(wodim libdeflt libedc libhfs_iso libparanoia icedax libusal libschily libunls mkisoimage readom netscsid 3rd-party/dirsplit include)
+SUBDIRS(wodim libdeflt libedc libhfs_iso libparanoia icedax libusal libschily libunls genisoimage readom netscsid 3rd-party/dirsplit include)
 

Modified: cdrkit/trunk/debian/control
===================================================================
--- cdrkit/trunk/debian/control	2006-11-23 21:59:20 UTC (rev 452)
+++ cdrkit/trunk/debian/control	2006-11-23 22:11:41 UTC (rev 453)
@@ -31,10 +31,20 @@
  It provides a cdrecord symlink to wodim for compatibility purposes.
 
 Package: mkisofs
+Architecture: all
+Depends: ${shlibs:Depends}
+Depends: genisoimage (>= 9:1.0)
+Description: Dummy package for transition to genisoimage
+ This is a dummy package to ease the transition to genisoimage, the fork
+ of mkisofs. Please use genisoimage instead of mkisofs.
+ It provides a mkisofs symlink to genisoimage for compatibility purposes.
+
+Package: genisoimage
 Architecture: any
 Depends: ${shlibs:Depends}
 Suggests: wodim, cdrkit-doc
-Conflicts: mkhybrid
+Replaces: mkisofs (<< 9:1.0)
+Conflicts: mkhybrid, mkisofs (<< 9:1.0)
 Description: Creates ISO-9660 CD-ROM filesystem images
  mkisofs is a pre-mastering program for creating ISO-9660 CD-ROM 
  filesystem images, which can then be written to a CD-ROM (or DVD-ROM) using
@@ -53,7 +63,7 @@
 Suggests: vorbis-tools, cdrkit-doc
 Depends: ${shlibs:Depends}
 Section: sound
-Replaces: cdda2wav
+Replaces: cdda2wav (<< 9:1.0)
 Conflicts: cdda2wav (<< 9:1.0)
 Description: Creates WAV files from audio CDs
  cdda2wav lets you digitally copy audio tracks from a CD-ROM, avoiding

Modified: cdrkit/trunk/debian/copyright
===================================================================
--- cdrkit/trunk/debian/copyright	2006-11-23 21:59:20 UTC (rev 452)
+++ cdrkit/trunk/debian/copyright	2006-11-23 22:11:41 UTC (rev 453)
@@ -22,120 +22,6 @@
 
 Copyright:
 
-* wodim (originally known as cdrecord)
-  Copyright (c) 1995-2004 J. Schilling
-  License: GPLv2 with the following additional requirement:
--       You may not modify certain copyright messages in cdrecord.c
-        See cdrecord.c for further information.
-
--       You may (with a few exceptions) not modify the location of the
-        configuration file /etc/default/cdrecord.
-        See defaults.c for further information.
-
-cdrecord.c says (but see below):
-------------------------------------------
-|   Warning: you are not allowed to modify or to remove the
-|   Copyright and version printing code below!
-|   See also GPL § 2 subclause c)
-|  
-|   If you modify cdrecord you need to include additional version
-|   printing code that:
-|  
-|  	-	Clearly states that the current version is an
-|  		inofficial (modified) version and thus may have bugs
-|  		that are not present in the original.
-|  
-|  	-	Print your support e-mail address and tell people that
-|  		you will do complete support for this version of
-|  		cdrecord.
-|  
-|  		Or clearly state that there is absolutely no support
-|  		for the modified version you did create.
-|  
-|  	-	Tell the users not to ask the original author for
-|  		help.
-|  
-|   This limitation definitely also applies when you use any other
-|   cdrecord release together with libscg-0.6 or later, or when you
-|   use any amount of code from cdrecord-1.11a17 or later.
-|   In fact, it applies to any version of cdrecord, see also
-|   GPL Preamble, subsection 6.
-|  
-|   I am sorry for the inconvenience but I am forced to do this because
-|   some people create inofficial branches. These branches create
-|   problems but the initiators do not give support and thus cause the
-|   development of the official cdrecord versions to slow down because
-|   I am loaded with unneeded work.
-|  
-|   Please note that this is a memorandum on how I interpret the GPL.
-|   If you use/modify/redistribute cdrecord, you need to accept it
-|   this way.
-|   
-|  
-|   The above statement is void if there has been neither a new version
-|   of cdrecord nor a new version of star from the original author
-|   within more then a year.
-------------------------------------------
-
-For that Andreas Metzler had a mail conversation with Joerg, the last
-and important mail is included below, except an unrelated part I
-removed. It's in German, translation follows after the original mail.
-------------------------------------------------------------
-From: Joerg Schilling <schilling at fokus.fraunhofer.de>
-Subject: Re: Geaendertes Copyright in a36
-To: ametzler at logic.univie.ac.at
-Date: Thu, 19 Aug 2004 18:10:31 +0200
-
->From ametzler at logic.univie.ac.at  Thu Aug 19 18:04:42 2004
-
-[...]
->und im Rahmen des Zulaessigen[1].
-
->Darf ich nochmal nachbohren: linuxcheck() faellt auch nicht unter
->"you are not allowed to modify or to remove the Copyright and version
->printing code below!"?
-
-Darf geaendert werden. und ich habe auch absichtlich ein "Loch" gelassen, so
-dasz jemand den uname() Test mit einem automatischen Patch versehen kann.
-
-Jörg
-
--- 
- EMail:joerg at schily.isdn.cs.tu-berlin.de (home) Jörg Schilling D-13353 Berlin
-       js at cs.tu-berlin.de		(uni)  If you don't have iso-8859-1
-       schilling at fokus.fraunhofer.de	(work) chars I am J"org Schilling
- URL:  http://www.fokus.fraunhofer.de/usr/schilling ftp://ftp.berlios.de/pub/schily
-------------------------------------------------------------
-
-And now the English translation of the mail above. Only content:
-------------------------------------------------------------
-Andreas asks:
-Let me ask again: linuxcheck() is not restricted with
-"you are not allowed to modify or to remove the Copyright and version
-printing code below!"?
-
-Jörg answers:
-It is allowed to change this and I have a "gap" there intentionally, so
-one can change the uname() check with an automated patch.
-------------------------------------------------------------
-
-Thats not a Debian-specific license and it only leaves the version
-printing stuff in cdrecord.c. Which is allowed from GPL.
-
-defaults.c says:
-------------------------------------------
- | WARNING you are only allowed to change this filename if you also
- | change the documentation and add a statement that makes clear
- | where the official location of the file is why you did choose a
- | nonstandard location and that the nonstandard location only refers
- | to unofficial cdrecord versions.
- |
- | I was forced to add this because some people change cdrecord without
- | rational reason and then publish the result. As those people
- | don't contribute work and don't give support, they are causing extra
- | work for me and this way slow down the cdrecord development.
-------------------------------------------
-
 * cdda2wav 
   Copyright 1998-2003 Heiko Eissfeldt
   parts    (C) Peter Widow

Copied: cdrkit/trunk/debian/genisoimage.dirs (from rev 449, cdrkit/trunk/debian/mkisofs.dirs)

Copied: cdrkit/trunk/debian/genisoimage.install (from rev 449, cdrkit/trunk/debian/mkisofs.install)
===================================================================
--- cdrkit/trunk/debian/mkisofs.install	2006-11-23 21:26:50 UTC (rev 449)
+++ cdrkit/trunk/debian/genisoimage.install	2006-11-23 22:11:41 UTC (rev 453)
@@ -0,0 +1,10 @@
+debian/tmp/usr/bin/genisoimage
+debian/tmp/usr/bin/devdump
+debian/tmp/usr/bin/isoinfo
+debian/tmp/usr/bin/isodump
+debian/tmp/usr/bin/isovfy
+debian/tmp/usr/bin/dirsplit
+debian/tmp/usr/share/man/man8/genisoimage.8
+debian/tmp/usr/share/man/man8/isoinfo.8
+debian/tmp/usr/share/man/man1/dirsplit.1
+

Copied: cdrkit/trunk/debian/genisoimage.links (from rev 449, cdrkit/trunk/debian/mkisofs.links)

Deleted: cdrkit/trunk/debian/mkisofs.dirs
===================================================================
--- cdrkit/trunk/debian/mkisofs.dirs	2006-11-23 21:59:20 UTC (rev 452)
+++ cdrkit/trunk/debian/mkisofs.dirs	2006-11-23 22:11:41 UTC (rev 453)
@@ -1 +0,0 @@
-usr/share/bug/mkisofs

Deleted: cdrkit/trunk/debian/mkisofs.install
===================================================================
--- cdrkit/trunk/debian/mkisofs.install	2006-11-23 21:59:20 UTC (rev 452)
+++ cdrkit/trunk/debian/mkisofs.install	2006-11-23 22:11:41 UTC (rev 453)
@@ -1,10 +0,0 @@
-debian/tmp/usr/bin/mkisofs
-debian/tmp/usr/bin/devdump
-debian/tmp/usr/bin/isoinfo
-debian/tmp/usr/bin/isodump
-debian/tmp/usr/bin/isovfy
-debian/tmp/usr/bin/dirsplit
-debian/tmp/usr/share/man/man8/mkisofs.8
-debian/tmp/usr/share/man/man8/isoinfo.8
-debian/tmp/usr/share/man/man1/dirsplit.1
-

Deleted: cdrkit/trunk/debian/mkisofs.links
===================================================================
--- cdrkit/trunk/debian/mkisofs.links	2006-11-23 21:59:20 UTC (rev 452)
+++ cdrkit/trunk/debian/mkisofs.links	2006-11-23 22:11:41 UTC (rev 453)
@@ -1,5 +0,0 @@
-usr/bin/mkisofs usr/bin/mkhybrid
-usr/share/man/man8/isoinfo.8 usr/share/man/man8/isodump.8
-usr/share/man/man8/isoinfo.8 usr/share/man/man8/isovfy.8
-usr/share/man/man8/isoinfo.8 usr/share/man/man8/devdump.8
-usr/share/man/man8/mkisofs.8 usr/share/man/man8/mkhybrid.8

Modified: cdrkit/trunk/debian/rules
===================================================================
--- cdrkit/trunk/debian/rules	2006-11-23 21:59:20 UTC (rev 452)
+++ cdrkit/trunk/debian/rules	2006-11-23 22:11:41 UTC (rev 453)
@@ -15,7 +15,7 @@
 
 i=$(shell pwd)/debian/tmp/usr
 b=$(shell pwd)/debian/build
-iso=mkisofs
+iso=genisoimage
 cdd=icedax
 cdr=wodim
 ziso_VERSION = $(shell cat 3rd-party/zisofs_tools/version)
@@ -130,13 +130,31 @@
 	dh_md5sums           -p$@ -P$(b)/$@
 	dh_builddeb          -p$@ -P$(b)/$@
 
+
 #
-# mkisofs
+# mkisofs dummy one
 #
 
 mkisofs: install
 	@echo "--- Building: $@"
 	dh_installdirs 		 -p$@ -P$(b)/$@ 
+	dh_link              -p$@ -P$(b)/$@ 
+	dh_install			 -p$@ -P$(b)/$@
+	dh_compress          -p$@ -P$(b)/$@
+	dh_fixperms          -p$@ -P$(b)/$@
+	dh_installdeb        -p$@ -P$(b)/$@
+	dh_gencontrol        -p$@ -P$(b)/$@
+	dh_makeshlibs        -p$@ -P$(b)/$@ -V
+	dh_md5sums           -p$@ -P$(b)/$@
+	dh_builddeb          -p$@ -P$(b)/$@
+
+#
+# genisoimage
+#
+
+genisoimage: install
+	@echo "--- Building: $@"
+	dh_installdirs 		 -p$@ -P$(b)/$@ 
 	dh_installdocs       -p$@ -P$(b)/$@
 	dh_installchangelogs -p$@ -P$(b)/$@ $(iso)/ChangeLog zisofs_tools/CHANGES
 	dh_install           -p$@ -P$(b)/$@

Copied: cdrkit/trunk/genisoimage (from rev 450, cdrkit/trunk/mkisoimage)

Deleted: cdrkit/trunk/genisoimage/CMakeLists.txt
===================================================================
--- cdrkit/trunk/mkisoimage/CMakeLists.txt	2006-11-23 21:37:32 UTC (rev 450)
+++ cdrkit/trunk/genisoimage/CMakeLists.txt	2006-11-23 22:11:41 UTC (rev 453)
@@ -1,56 +0,0 @@
-PROJECT (MKISOFS)
-
-INCLUDE(../include/AddScgBits.cmake)
-INCLUDE(../include/AddSchilyBits.cmake)
-
-INCLUDE_DIRECTORIES(../include ../libhfs_iso ../wodim ${CMAKE_BINARY_DIR})
-
-FIND_FILE (USE_MAGIC magic.h)
-IF(USE_MAGIC)
-	ADD_DEFINITIONS(-DUSE_MAGIC)
-	SET(MAGICLIBS magic)
-ENDIF(USE_MAGIC)
-
-FIND_FILE (USE_ICONV iconv.h)
-IF(USE_ICONV)
-	ADD_DEFINITIONS(-DUSE_ICONV)
-ENDIF(USE_ICONV)
-# iconv may be provided by the 3rd party library
-FIND_LIBRARY (USE_LIBICONV iconv)
-IF(USE_LIBICONV)
-	SET(EXTRA_LIBICONV iconv)
-endif(USE_LIBICONV)
-	
-
-ADD_DEFINITIONS(-DUSE_LARGEFILES -DABORT_DEEP_ISO_ONLY -DAPPLE_HYB -DUDF -DDVD_VIDEO -DSORTING -DHAVE_CONFIG_H -DUSE_LIBSCHILY -DUSE_SCG -DJIGDO_TEMPLATE)
-
-SET(MKISOFS_MOST_SRCS apple.c boot.c cd_misc.c defaults.c desktop.c dvd_file.c dvd_reader.c eltorito.c exclude.c files.c fnmatch.c getnum.c getopt.c getopt1.c hash.c ifo_read.c joliet.c mac_label.c match.c modes.c multi.c name.c rock.c scsi.c scsi_cdr.c stream.c tree.c udf.c vms.c volume.c write.c boot-alpha.c boot-hppa.c boot-mips.c md5.c jte.c rsync.c
-	boot-mipsel.c endian.c  )
-
-#SET_SOURCE_FILES_PROPERTIES(${MKISOFS_MOST_SRCS} PROPERTIES )
-LINK_DIRECTORIES(../libhfs_iso ../libschily ../libusal ../libunls ../libdeflt)
-
-ADD_EXECUTABLE (mkisoimage mkisoimage.c ${MKISOFS_MOST_SRCS})
-TARGET_LINK_LIBRARIES(mkisoimage hfs_iso deflt ${MAGICLIBS} c unls z ${EXTRA_LIBICONV} ${EXTRA_LIBS})
-
-# common lib set and mkisoimage source parts for the rest
-LINK_LIBRARIES(${EXTRA_LIBS} deflt unls ${EXTRA_LIBICONV} )
-SET(MI_COMMON scsi.c scsi_cdr.c cd_misc.c modes.c defaults.c getnum.c)
-ADD_EXECUTABLE(devdump diag/dump.c  ${MI_COMMON})
-ADD_EXECUTABLE(isodebug	diag/isodebug.c   ${MI_COMMON})
-ADD_EXECUTABLE(isodump	diag/isodump.c    ${MI_COMMON})
-ADD_EXECUTABLE(isoinfo diag/isoinfo.c	 ${MI_COMMON})
-ADD_EXECUTABLE(isovfy	diag/isovfy.c	 ${MI_COMMON})
-
-
-SET_TARGET_PROPERTIES(mkisoimage devdump isodebug isodump isoinfo isovfy PROPERTIES  SKIP_BUILD_RPATH TRUE)
-
-INSTALL(TARGETS mkisoimage devdump isodebug isodump isoinfo isovfy DESTINATION bin)
-INSTALL(FILES 
-mkisoimage.8
-diag/devdump.8
-diag/isodebug.8
-diag/isodump.8
-diag/isoinfo.8
-diag/isovfy.8
-DESTINATION share/man/man8)

Copied: cdrkit/trunk/genisoimage/CMakeLists.txt (from rev 452, cdrkit/trunk/mkisoimage/CMakeLists.txt)

Deleted: cdrkit/trunk/genisoimage/apple.c
===================================================================
--- cdrkit/trunk/mkisoimage/apple.c	2006-11-23 21:37:32 UTC (rev 450)
+++ cdrkit/trunk/genisoimage/apple.c	2006-11-23 22:11:41 UTC (rev 453)
@@ -1,2688 +0,0 @@
-/*
- * This file has been modified for the cdrkit suite.
- *
- * The behaviour and appearence of the program code below can differ to a major
- * extent from the version distributed by the original author(s).
- *
- * For details, see Changelog file distributed with the cdrkit package. If you
- * received this file from another source then ask the distributing person for
- * a log of modifications.
- *
- */
-
-/* @(#)apple.c	1.19 04/03/02 joerg, Copyright 1997, 1998, 1999, 2000 James Pearson */
-#ifndef lint
-static	char sccsid[] =
-	"@(#)apple.c	1.19 04/03/02 joerg, Copyright 1997, 1998, 1999, 2000 James Pearson";
-#endif
-/*
- *      Copyright (c) 1997, 1998, 1999, 2000 James Pearson
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING.  If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-/*
- *	Unix-HFS file interface including maping file extensions to TYPE/CREATOR
- *
- *	Adapted from mkhfs routines for mkhybrid
- *
- *	James Pearson 1/5/97
- *	Bug fix JCP 4/12/97
- *	Updated for 1.12 and added more Unix HFS filetypes. JCP 21/1/98
- *	Tidy up to use Finfo and Dinfo for all formats where
- *		possible JCP 25/4/2000
- *
- *	Things still to de done:
- *
- *		Check file size = finder + rsrc [+ data] is needed
- */
-
-#ifdef APPLE_HYB
-
-#include <mconfig.h>
-#include "mkisoimage.h"
-#include <errno.h>
-#include <fctldefs.h>
-#include <utypes.h>
-#include <ctype.h>
-#include <netinet/in.h>
-#include "apple.h"
-#include <schily.h>
-
-#ifdef USE_MAGIC
-#include <magic.h>
-magic_t magic_state = NULL;
-#endif /* USE_MAGIC */
-
-/* tidy up mkisoimage definition ... */
-typedef struct directory_entry dir_ent;
-
-/* routines for getting HFS names and info */
-#ifndef	HAVE_STRCASECMP
-static int	strcasecmp(const char *s1, const char *s2);
-#endif
-static int	get_none_dir(char *, char *, dir_ent *, int);
-static int	get_none_info(char *, char *, dir_ent *, int);
-static int	get_cap_dir(char *, char *, dir_ent *, int);
-static int	get_cap_info(char *, char *, dir_ent *, int);
-static int	get_es_dir(char *, char *, dir_ent *, int);
-static int	get_es_info(char *, char *, dir_ent *, int);
-static int	get_dbl_dir(char *, char *, dir_ent *, int);
-static int	get_dbl_info(char *, char *, dir_ent *, int);
-static int	get_mb_info(char *, char *, dir_ent *, int);
-static int	get_sgl_info(char *, char *, dir_ent *, int);
-static int	get_fe_dir(char *, char *, dir_ent *, int);
-static int	get_fe_info(char *, char *, dir_ent *, int);
-static int	get_sgi_dir(char *, char *, dir_ent *, int);
-static int	get_sgi_info(char *, char *, dir_ent *, int);
-static int	get_sfm_info(char *, char *, dir_ent *, int);
-
-#ifdef IS_MACOS_X
-static int	get_xhfs_dir(char *, char *, dir_ent *, int);
-static int	get_xhfs_info(char *, char *, dir_ent *, int);
-#else
-#define	get_xhfs_dir	get_none_dir
-#define	get_xhfs_info	get_none_info
-#endif /* IS_MACOS_X */
-
-static void	set_ct(hfsdirent *, char *, char *);
-static void	set_Dinfo(byte *, hfsdirent *);
-static void	set_Finfo(byte *, hfsdirent *);
-static void	cstrncpy(char *, char *, int);
-static unsigned char dehex(char);
-static unsigned char hex2char(char *);
-static void	hstrncpy(unsigned char *, char *, int);
-static int	read_info_file(char *, void *, int);
-
-/*static unsigned short	calc_mb_crc	__PR((unsigned char *, long, unsigned short));*/
-static struct hfs_info *get_hfs_fe_info(struct hfs_info *, char *);
-static struct hfs_info *get_hfs_sgi_info(struct hfs_info *, char *);
-static struct hfs_info *match_key(struct hfs_info *, char *);
-
-static int	get_hfs_itype(char *, char *, char *);
-static void	map_ext(char *, char **, char **, short *, char *);
-
-static afpmap	**map;		/* list of mappings */
-static afpmap	*defmap;	/* the default mapping */
-static int	last_ent;	/* previous mapped entry */
-static int	map_num;	/* number of mappings */
-static int	mlen;		/* min extension length */
-static char	tmp[PATH_MAX];	/* tmp working buffer */
-static int	hfs_num;	/* number of file types */
-static char	p_buf[PATH_MAX]; /* info working buffer */
-static FILE	*p_fp = NULL;	/* probe File pointer */
-static int	p_num = 0;	/* probe bytes read */
-static unsigned	int hselect;	/* type of HFS file selected */
-
-struct hfs_type {	/* Types of various HFS Unix files */
-	int	type;	/* type of file */
-	int	flags;	/* special flags */
-	char	*info;	/* finderinfo name */
-	char	*rsrc;	/* resource fork name */
-	int	(*get_info)(char *, char *, dir_ent *, int); /* finderinfo */
-								    /*	function */
-	int	(*get_dir)(char *, char *, dir_ent *, int);  /* directory */
-								    /* name */
-								    /* function */
-	char	*desc;	/* description */
-};
-
-/* Above filled in */
-static struct hfs_type hfs_types[] = {
-	{TYPE_NONE, INSERT, "", "", get_none_info, get_none_dir, "None"},
-	{TYPE_CAP, INSERT, ".finderinfo/", ".resource/",
-				get_cap_info, get_cap_dir, "CAP"},
-	{TYPE_NETA, INSERT, ".AppleDouble/", ".AppleDouble/",
-				get_dbl_info, get_dbl_dir, "Netatalk"},
-	{TYPE_DBL, INSERT, "%", "%", get_dbl_info, get_dbl_dir, "AppleDouble"},
-	{TYPE_ESH, INSERT, ".rsrc/", ".rsrc/",
-				get_es_info, get_es_dir, "EtherShare/UShare"},
-	{TYPE_FEU, NOPEND, "FINDER.DAT", "RESOURCE.FRK/",
-				get_fe_info, get_fe_dir, "Exchange"},
-	{TYPE_FEL, NOPEND, "finder.dat", "resource.frk/",
-				get_fe_info, get_fe_dir, "Exchange"},
-	{TYPE_SGI, NOPEND, ".HSancillary", ".HSResource/",
-				get_sgi_info, get_sgi_dir, "XINET/SGI"},
-	{TYPE_MBIN, PROBE, "", "", get_mb_info, get_none_dir, "MacBinary"},
-	{TYPE_SGL, PROBE, "", "", get_sgl_info, get_none_dir, "AppleSingle"},
-	{TYPE_DAVE, INSERT, "resource.frk/", "resource.frk/",
-				get_dbl_info, get_dbl_dir, "DAVE"},
-	{TYPE_SFM, APPEND | NORSRC, ":Afp_AfpInfo", ":Afp_Resource",
-				get_sfm_info, get_none_dir, "SFM"},
-	{TYPE_XDBL, INSERT, "._", "._", get_dbl_info, get_dbl_dir,
-				"MacOS X AppleDouble"},
-	{TYPE_XHFS, APPEND | NOINFO, "/rsrc", "/rsrc", get_xhfs_info, get_xhfs_dir,
-				"MacOS X HFS"}
-};
-
-/* used by get_magic_match() return */
-static char	tmp_type[CT_SIZE + 1],
-		tmp_creator[CT_SIZE + 1];
-
-#ifdef	__used__
-/*
- *	An array useful for CRC calculations that use 0x1021 as the "seed"
- *	taken from mcvert.c modified by Jim Van Verth.
- */
-
-static unsigned short mb_magic[] = {
-	0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7,
-	0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef,
-	0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6,
-	0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de,
-	0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485,
-	0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d,
-	0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4,
-	0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc,
-	0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823,
-	0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b,
-	0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12,
-	0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a,
-	0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41,
-	0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49,
-	0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70,
-	0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78,
-	0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f,
-	0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067,
-	0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e,
-	0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256,
-	0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d,
-	0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405,
-	0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c,
-	0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634,
-	0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab,
-	0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3,
-	0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a,
-	0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92,
-	0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9,
-	0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1,
-	0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8,
-	0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0
-};
-
-#endif	/* __used__ */
-
-#ifndef	HAVE_STRCASECMP
-static int
-strcasecmp(const char *s1, const char *s2)
-{
-	while (tolower(*s1) == tolower(*s2)) {
-		if (*s1 == 0)
-			return (0);
-		s1++;
-		s2++;
-	}
-	return (tolower(*s1) - tolower(*s2));
-}
-#endif
-
-/*
- *	set_ct: set CREATOR and TYPE in hfs_ent
- *
- *	CREATOR and TYPE are padded with spaces if not CT_SIZE long
- */
-
-static void
-set_ct(hfsdirent *hfs_ent, char *c, char *t)
-{
-	memset(hfs_ent->u.file.type, ' ', CT_SIZE);
-	memset(hfs_ent->u.file.creator, ' ', CT_SIZE);
-
-	strncpy(hfs_ent->u.file.type, t, MIN(CT_SIZE, strlen(t)));
-	strncpy(hfs_ent->u.file.creator, c, MIN(CT_SIZE, strlen(c)));
-
-	hfs_ent->u.file.type[CT_SIZE] = '\0';
-	hfs_ent->u.file.creator[CT_SIZE] = '\0';
-}
-
-/*
- *	cstrncopy: Cap Unix name to HFS name
- *
- *	':' is replaced by '%' and string is terminated with '\0'
- */
-static void
-cstrncpy(char *t, char *f, int c)
-{
-	while (c-- && *f) {
-		switch (*f) {
-		case ':':
-			*t = '%';
-			break;
-		default:
-			*t = *f;
-			break;
-		}
-		t++;
-		f++;
-	}
-
-	*t = '\0';
-}
-
-/*
- * dehex()
- *
- * Given a hexadecimal digit in ASCII, return the integer representation.
- *
- *	Taken from linux/fs/hfs/trans.c by Paul H. Hargrove
- */
-static unsigned char
-dehex(char c)
-{
-	if ((c >= '0') && (c <= '9')) {
-		return (c - '0');
-	}
-	if ((c >= 'a') && (c <= 'f')) {
-		return (c - 'a' + 10);
-	}
-	if ((c >= 'A') && (c <= 'F')) {
-		return (c - 'A' + 10);
-	}
-/*	return (0xff); */
-	return (0);
-}
-
-static unsigned char
-hex2char(char *s)
-{
-	unsigned char	i1;
-	unsigned char	i2;
-	unsigned char	o;
-
-	if (strlen(++s) < 2)
-		return (0);
-
-	i1 = (unsigned char) s[0];
-	i2 = (unsigned char) s[1];
-
-	if (!isxdigit(i1) || !isxdigit(i2))
-		return (0);
-
-	o = (dehex(i1) << 4) & 0xf0;
-	o |= (dehex(i2) & 0xf);
-
-	return (o);
-}
-
-
-/*
- *	hstrncpy: Unix name to HFS name with special character
- *	translation.
- *
- *	"%xx" or ":xx" is assumed to be a "special" character and
- *	replaced by character code given by the hex characters "xx"
- *
- *	if "xx" is not a hex number, then it is left alone - except
- *	that ":" is replaced by "%"
- *
- */
-static void
-hstrncpy(unsigned char *t, char *f, int c)
-{
-	unsigned char	o;
-
-	while (c-- && *f) {
-		switch (*f) {
-		case ':':
-		case '%':
-			if ((o = hex2char(f)) == 0) {
-				*t = conv_charset('%', in_nls, hfs_onls);
-			} else {
-				*t = o;
-				f += 2;
-			}
-			break;
-		default:
-			*t = conv_charset(*f, in_nls, hfs_onls);
-			break;
-		}
-		t++;
-		f++;
-	}
-
-	*t = '\0';
-}
-
-/*
- *	basename: find just the filename with any directory component
- */
-/*
-	not used at the moment ...
-static char
-basename(a)
-	char	*a;
-{
-	char	*b;
-
-	if ((b = strchr(a, '/')))
-		return (++b);
-	else
-		return (a);
-}
-*/
-
-/*
- *	set_Dinfo: set directory info
- */
-static void
-set_Dinfo(byte *ptr, hfsdirent *ent)
-{
-	Dinfo	*dinfo = (Dinfo *)ptr;
-
-	/* finder flags */
-	ent->fdflags = d_getw((unsigned char *) dinfo->frFlags);
-
-	if (icon_pos) {
-		ent->u.dir.rect.top =
-		d_getw((unsigned char *) dinfo->frRect[0]);
-		ent->u.dir.rect.left =
-		d_getw((unsigned char *) dinfo->frRect[1]);
-		ent->u.dir.rect.bottom =
-		d_getw((unsigned char *) dinfo->frRect[2]);
-		ent->u.dir.rect.right =
-		d_getw((unsigned char *) dinfo->frRect[3]);
-
-		ent->fdlocation.v =
-		d_getw((unsigned char *) dinfo->frLocation[0]);
-		ent->fdlocation.h =
-		d_getw((unsigned char *) dinfo->frLocation[1]);
-
-		ent->u.dir.view =
-		d_getw((unsigned char *) dinfo->frView);
-
-		ent->u.dir.frscroll.v =
-		d_getw((unsigned char *) dinfo->frScroll[0]);
-		ent->u.dir.frscroll.h =
-		d_getw((unsigned char *) dinfo->frScroll[1]);
-
-	} else {
-		/*
-		 * clear HFS_FNDR_HASBEENINITED to have tidy desktop ??
-		 */
-		ent->fdflags &= 0xfeff;
-	}
-}
-
-/*
- *	set_Finfo: set file info
- */
-static void
-set_Finfo(byte *ptr, hfsdirent *ent)
-{
-	Finfo	*finfo = (Finfo *)ptr;
-
-	/* type and creator from finder info */
-	set_ct(ent, finfo->fdCreator, finfo->fdType);
-
-	/* finder flags */
-	ent->fdflags = d_getw((unsigned char *) finfo->fdFlags);
-
-	if (icon_pos) {
-		ent->fdlocation.v =
-		d_getw((unsigned char *) finfo->fdLocation[0]);
-		ent->fdlocation.h =
-		d_getw((unsigned char *) finfo->fdLocation[1]);
-	} else {
-		/*
-		 * clear HFS_FNDR_HASBEENINITED to have tidy desktop ??
-		 */
-		ent->fdflags &= 0xfeff;
-	}
-}
-
-/*
- *	get_none_dir: ordinary Unix directory
- */
-static int
-get_none_dir(char *hname, char *dname, dir_ent *s_entry, int ret)
-{
-	/* just copy the given name */
-	hstrncpy((unsigned char *) (s_entry->hfs_ent->name),
-							dname, HFS_MAX_FLEN);
-
-	return (ret);
-}
-
-/*
- *	get_none_info: ordinary Unix file - try to map extension
- */
-static int
-get_none_info(char *hname, char *dname, dir_ent *s_entry, int ret)
-{
-	char		*t,
-			*c;
-	hfsdirent	*hfs_ent = s_entry->hfs_ent;
-
-	map_ext(dname, &t, &c, &s_entry->hfs_ent->fdflags, s_entry->whole_name);
-
-	/* just copy the given name */
-	hstrncpy((unsigned char *) (hfs_ent->name), dname, HFS_MAX_FLEN);
-
-	set_ct(hfs_ent, c, t);
-
-	return (ret);
-}
-
-/*
- *	read_info_file:	open and read a finderinfo file for an HFS file
- *			or directory
- */
-static int
-read_info_file(char *name, /* finderinfo filename */
-					void *info, /* info buffer */
-					int len		/* length of above */)
-{
-	FILE		*fp;
-	int		num;
-
-	/* clear out any old finderinfo stuf */
-	memset(info, 0, len);
-
-	if ((fp = fopen(name, "rb")) == NULL)
-		return (-1);
-
-	/* read and ignore if the file is short - checked later */
-	num = fread(info, 1, len, fp);
-
-	fclose(fp);
-
-	return (num);
-}
-
-/*
- *	get_cap_dir: get the CAP name for a directory
- */
-static int
-get_cap_dir(char *hname, /* whole path */ 
-				char *dname, /* this dir name */
-				dir_ent *s_entry, /* directory entry */ 
-				int ret)
-{
-	FileInfo	info;		/* finderinfo struct */
-	int		num = -1;	/* bytes read */
-	hfsdirent	*hfs_ent = s_entry->hfs_ent;
-
-	num = read_info_file(hname, &info, sizeof (FileInfo));
-
-	/* check finder info is OK */
-	if (num > 0 &&
-		info.fi_magic1 == FI_MAGIC1 &&
-		info.fi_magic == FI_MAGIC &&
-		info.fi_bitmap & FI_BM_MACINTOSHFILENAME) {
-		/* use the finderinfo name if it exists */
-		cstrncpy((char *) (hfs_ent->name),
-				(char *) (info.fi_macfilename), HFS_MAX_FLEN);
-
-		set_Dinfo(info.finderinfo, hfs_ent);
-
-		return (ret);
-	} else {
-		/* otherwise give it it's Unix name */
-		hstrncpy((unsigned char *) (s_entry->hfs_ent->name),
-							dname, HFS_MAX_FLEN);
-		return (TYPE_NONE);
-	}
-}
-
-/*
-**	get_cap_info:	get CAP finderinfo for a file
-*/
-static int
-get_cap_info(char *hname, /* whole path */
-				 char *dname, /* this dir name */
-				 dir_ent *s_entry, /* directory entry */
-				 int ret)
-{
-	FileInfo	info;		/* finderinfo struct */
-	int		num = -1;	/* bytes read */
-	hfsdirent	*hfs_ent = s_entry->hfs_ent;
-
-	num = read_info_file(hname, &info, sizeof (info));
-
-	/* check finder info is OK */
-	if (num > 0 &&
-		info.fi_magic1 == FI_MAGIC1 &&
-		info.fi_magic == FI_MAGIC) {
-
-		if (info.fi_bitmap & FI_BM_MACINTOSHFILENAME) {
-			/* use the finderinfo name if it exists */
-			cstrncpy((char *) (hfs_ent->name),
-				(char *) (info.fi_macfilename), HFS_MAX_FLEN);
-		} else {
-			/* use Unix name */
-			hstrncpy((unsigned char *) (hfs_ent->name), dname,
-								HFS_MAX_FLEN);
-		}
-
-		set_Finfo(info.finderinfo, hfs_ent);
-#ifdef USE_MAC_DATES
-		/*
-		 * set created/modified dates - these date should have already
-		 * been set from the Unix data fork dates. The finderinfo dates
-		 * are in Mac format - but we have to convert them back to Unix
-		 * for the time being
-		 */
-		if ((info.fi_datemagic & FI_CDATE)) {
-			/* use libhfs routines to get correct byte order */
-			hfs_ent->crdate = d_toutime(d_getl(info.fi_ctime));
-		}
-		if (info.fi_datemagic & FI_MDATE) {
-			hfs_ent->mddate = d_toutime(d_getl(info.fi_mtime));
-		}
-#endif	/* USE_MAC_DATES */
-	} else {
-		/* failed to open/read finderinfo - so try afpfile mapping */
-		if (verbose > 2) {
-			fprintf(stderr,
-				"warning: %s doesn't appear to be a %s file\n",
-				s_entry->whole_name, hfs_types[ret].desc);
-		}
-		ret = get_none_info(hname, dname, s_entry, TYPE_NONE);
-	}
-
-	return (ret);
-}
-
-/*
- *	get_es_dir:	get EtherShare/UShare finderinfo for a directory
- *
- *	based on code from Jens-Uwe Mager (jum at helios.de) and Phil Sylvester
- *	<psylvstr at interaccess.com>
- */
-static int
-get_es_dir(char *hname, /* whole path */ 
-			  char *dname, /* this dir name */
-			  dir_ent *s_entry, /* directory entry */
-			  int ret)
-{
-	es_FileInfo	*einfo;		/* EtherShare info struct */
-	us_FileInfo	*uinfo;		/* UShare info struct */
-	char		info[ES_INFO_SIZE];	/* finderinfo buffer */
-	int		num = -1;	/* bytes read */
-	hfsdirent	*hfs_ent = s_entry->hfs_ent;
-
-	/*
-	 * the EtherShare and UShare file layout is the same, but they store
-	 * finderinfo differently
-	 */
-	einfo = (es_FileInfo *) info;
-	uinfo = (us_FileInfo *) info;
-
-	num = read_info_file(hname, info, sizeof (info));
-
-	/* check finder info for EtherShare finderinfo */
-	if (num >= (int)sizeof (es_FileInfo) &&
-		d_getl(einfo->magic) == ES_MAGIC &&
-		d_getw(einfo->version) == ES_VERSION) {
-
-		set_Dinfo(einfo->finderinfo, hfs_ent);
-
-	} else if (num >= (int)sizeof (us_FileInfo)) {
-		/*
-		 * UShare has no magic number, so we assume that this is a valid
-		 * info/resource file ...
-		 */
-
-		set_Dinfo(uinfo->finderinfo, hfs_ent);
-
-	} else {
-		/* failed to open/read finderinfo - so try afpfile mapping */
-		if (verbose > 2) {
-			fprintf(stderr,
-				"warning: %s doesn't appear to be a %s file\n",
-				s_entry->whole_name, hfs_types[ret].desc);
-		}
-		ret = get_none_dir(hname, dname, s_entry, TYPE_NONE);
-		return (ret);
-	}
-
-	/* set name */
-	hstrncpy((unsigned char *) (hfs_ent->name), dname, HFS_MAX_FLEN);
-
-	return (ret);
-}
-
-/*
- *	get_es_info:	get EtherShare/UShare finderinfo for a file
- *
- *	based on code from Jens-Uwe Mager (jum at helios.de) and Phil Sylvester
- *	<psylvstr at interaccess.com>
- */
-static int
-get_es_info(char *hname, /* whole path */
-				char *dname, /* this dir name */
-				dir_ent *s_entry, /* directory entry */
-				int ret)
-{
-	es_FileInfo	*einfo;		/* EtherShare info struct */
-	us_FileInfo	*uinfo;		/* UShare info struct */
-	char		info[ES_INFO_SIZE];	/* finderinfo buffer */
-	int		num = -1;	/* bytes read */
-	hfsdirent	*hfs_ent = s_entry->hfs_ent;
-	dir_ent		*s_entry1;
-
-	/*
-	 * the EtherShare and UShare file layout is the same, but they store
-	 * finderinfo differently
-	 */
-	einfo = (es_FileInfo *) info;
-	uinfo = (us_FileInfo *) info;
-
-	num = read_info_file(hname, info, sizeof (info));
-
-	/* check finder info for EtherShare finderinfo */
-	if (num >= (int)sizeof (es_FileInfo) &&
-		d_getl(einfo->magic) == ES_MAGIC &&
-		d_getw(einfo->version) == ES_VERSION) {
-
-		set_Finfo(einfo->finderinfo, hfs_ent);
-
-		/*
-		 * set create date - modified date set from the Unix
-		 * data fork date
-		 */
-
-		hfs_ent->crdate = d_getl(einfo->createTime);
-
-	} else if (num >= (int)sizeof (us_FileInfo)) {
-		/*
-		 * UShare has no magic number, so we assume that this is a valid
-		 * info/resource file ...
-		 */
-
-		set_Finfo(uinfo->finderinfo, hfs_ent);
-
-		/* set create and modified date - if they exist */
-		if (uinfo->ctime)
-			hfs_ent->crdate =
-				d_getl(uinfo->ctime);
-
-		if (uinfo->mtime)
-			hfs_ent->mddate =
-				d_getl(uinfo->mtime);
-	} else {
-		/* failed to open/read finderinfo - so try afpfile mapping */
-		if (verbose > 2) {
-			fprintf(stderr,
-				"warning: %s doesn't appear to be a %s file\n",
-				s_entry->whole_name, hfs_types[ret].desc);
-		}
-		ret = get_none_info(hname, dname, s_entry, TYPE_NONE);
-		return (ret);
-	}
-
-	/* this should exist ... */
-	if ((s_entry1 = s_entry->assoc) == NULL)
-		perr("TYPE_ESH error - shouldn't happen!");
-
-	/* set name */
-	hstrncpy((unsigned char *) (hfs_ent->name), dname, HFS_MAX_FLEN);
-
-	/* real rsrc file starts ES_INFO_SIZE bytes into the file */
-	if (s_entry1->size <= ES_INFO_SIZE) {
-		s_entry1->size = 0;
-		hfs_ent->u.file.rsize = 0;
-	} else {
-		s_entry1->size -= ES_INFO_SIZE;
-		hfs_ent->u.file.rsize = s_entry1->size;
-		s_entry1->hfs_off = ES_INFO_SIZE;
-	}
-
-	set_733((char *) s_entry1->isorec.size, s_entry1->size);
-
-	return (ret);
-}
-
-/*
- * calc_crc() --
- *   Compute the MacBinary II-style CRC for the data pointed to by p, with the
- *   crc seeded to seed.
- *
- *   Modified by Jim Van Verth to use the magic array for efficiency.
- */
-#ifdef	__used__
-static unsigned short
-calc_mb_crc(unsigned char *p, long len, unsigned short seed)
-{
-	unsigned short	hold;	/* crc computed so far */
-	long		i;	/* index into data */
-
-	hold = seed;	/* start with seed */
-	for (i = 0; i < len; i++, p++) {
-		hold ^= (*p << 8);
-		hold = (hold << 8) ^ mb_magic[(unsigned char) (hold >> 8)];
-	}
-
-	return (hold);
-}/* calc_mb_crc() */
-
-#endif	/* __used__ */
-
-static int
-get_mb_info(char *hname, /* whole path */
-				char *dname, /* this dir name */
-				dir_ent *s_entry, /* directory entry */
-				int ret)
-{
-	mb_info		*info;		/* finderinfo struct */
-	char		*c;
-	char		*t;
-	hfsdirent	*hfs_ent;
-	dir_ent		*s_entry1;
-	int		i;
-
-#ifdef TEST_CODE
-	unsigned short	crc_file,
-			crc_calc;
-
-#endif
-
-	info = (mb_info *) p_buf;
-
-	/*
-	 * routine called twice for each file - first to check that it is a
-	 * valid MacBinary file, second to fill in the HFS info. p_buf holds
-	 * the required raw data and it *should* remain the same between the
-	 * two calls
-	 */
-	if (s_entry == 0) {
-		/*
-		 * test that the CRC is OK - not set for MacBinary I files (and
-		 * incorrect in some MacBinary II files!). If this fails, then
-		 * perform some other checks
-		 */
-
-#ifdef TEST_CODE
-		/* leave this out for the time being ... */
-		if (p_num >= MB_SIZE && info->version == 0 && info->zero1 == 0) {
-			crc_calc = calc_mb_crc((unsigned char *) info, 124, 0);
-			crc_file = d_getw(info->crc);
-#ifdef DEBUG
-			fprintf(stderr, "%s: file %d, calc %d\n", hname,
-							crc_file, crc_calc);
-#endif	/* DEBUG */
-			if (crc_file == crc_calc)
-				return (ret);
-		}
-#endif	/* TEST_CODE */
-
-		/*
-		 * check some of the fields for a valid MacBinary file not
-		 * zero1 and zero2 SHOULD be zero - but some files incorrect
-		 */
-
-/*	    if (p_num < MB_SIZE || info->nlen > 63 || info->zero2 || */
-		if (p_num < MB_SIZE || info->zero1 ||
-			info->zero2 || info->nlen > 63 ||
-			info->version || info->nlen == 0 || *info->name == 0)
-			return (TYPE_NONE);
-
-		/* check that the filename is OKish */
-		for (i = 0; i < (int)info->nlen; i++)
-			if (info->name[i] == 0)
-				return (TYPE_NONE);
-
-		/* check CREATOR and TYPE are valid */
-		for (i = 0; i < 4; i++)
-			if (info->type[i] == 0 || info->auth[i] == 0)
-				return (TYPE_NONE);
-	} else {
-		/* we have a vaild MacBinary file, so fill in the bits */
-
-		/* this should exist ... */
-		if ((s_entry1 = s_entry->assoc) == NULL)
-			perr("TYPE_MBIN error - shouldn't happen!");
-
-		hfs_ent = s_entry->hfs_ent;
-
-		/* type and creator from finder info */
-		t = (char *) (info->type);
-		c = (char *) (info->auth);
-
-		set_ct(hfs_ent, c, t);
-
-		/* finder flags */
-		hfs_ent->fdflags = ((info->flags << 8) & 0xff00) | info->flags2;
-
-		if (icon_pos) {
-			hfs_ent->fdlocation.v =
-				d_getw((unsigned char *) info->icon_vert);
-			hfs_ent->fdlocation.h =
-				d_getw((unsigned char *) info->icon_horiz);
-		} else {
-			/*
-			 * clear HFS_FNDR_HASBEENINITED to have tidy desktop ??
-			 */
-			hfs_ent->fdflags &= 0xfeff;
-		}
-
-		/*
-		 * set created/modified dates - these date should have already
-		 * been set from the Unix data fork dates. The finderinfo dates
-		 * are in Mac format - but we have to convert them back to Unix
-		 * for the time being
-		 */
-		hfs_ent->crdate = d_toutime(d_getl(info->cdate));
-		hfs_ent->mddate = d_toutime(d_getl(info->mdate));
-
-		/* set name */
-		hstrncpy((unsigned char *) (hfs_ent->name),
-			(char *) (info->name), MIN(HFS_MAX_FLEN, info->nlen));
-
-		/* set correct fork sizes */
-		hfs_ent->u.file.dsize = d_getl(info->dflen);
-		hfs_ent->u.file.rsize = d_getl(info->rflen);
-
-		/* update directory entries for data fork */
-		s_entry->size = hfs_ent->u.file.dsize;
-		s_entry->hfs_off = MB_SIZE;
-		set_733((char *) s_entry->isorec.size, s_entry->size);
-
-		/*
-		 * real rsrc file starts after data fork (must be a multiple of
-		 * MB_SIZE)
-		 */
-		s_entry1->size = hfs_ent->u.file.rsize;
-		s_entry1->hfs_off = MB_SIZE + ROUND_UP(hfs_ent->u.file.dsize, MB_SIZE);
-		set_733((char *) s_entry1->isorec.size, s_entry1->size);
-	}
-
-	return (ret);
-}
-
-/*
- *	get_dbl_dir:	get Apple double finderinfo for a directory
- *
- *	Based on code from cvt2cap.c (c) May 1988, Paul Campbell
- */
-static int
-get_dbl_dir(char *hname, /* whole path */
-				char *dname, /* this dir name */
-				dir_ent *s_entry, /* directory entry */
-				int ret)
-{
-	FileInfo	info;		/* finderinfo struct */
-	a_hdr		*hp;
-	a_entry		*ep;
-	int		num = -1;	/* bytes read */
-	int		nentries;
-	FILE		*fp;
-	hfsdirent	*hfs_ent = s_entry->hfs_ent;
-	char		name[64];
-	int		i;
-	int		fail = 0;
-	int		len = 0;
-
-	hp = (a_hdr *) p_buf;
-	memset(hp, 0, A_HDR_SIZE);
-
-	memset(name, 0, sizeof (name));
-
-	/* open and read the info/rsrc file (it's the same file) */
-	if ((fp = fopen(hname, "rb")) != NULL)
-		num = fread(hp, 1, A_HDR_SIZE, fp);
-
-	/*
-	 * check finder info is OK - some Netatalk files don't have magic
-	 * or version set - ignore if it's a netatalk file
-	 */
-	if (num == A_HDR_SIZE && ((ret == TYPE_NETA) ||
-			(d_getl(hp->magic) == APPLE_DOUBLE &&
-				(d_getl(hp->version) == A_VERSION1 ||
-					d_getl(hp->version) == A_VERSION2)))) {
-
-		/* read TOC of the AppleDouble file */
-		nentries = (int) d_getw(hp->nentries);
-		if (fread(hp->entries, A_ENTRY_SIZE, nentries, fp) < 1) {
-			fail = 1;
-			nentries = 0;
-		}
-		/* extract what is needed */
-		for (i = 0, ep = hp->entries; i < nentries; i++, ep++) {
-			switch ((int)d_getl(ep->id)) {
-			case ID_FINDER:
-				/* get the finder info */
-				fseek(fp, (off_t)d_getl(ep->offset), SEEK_SET);
-				if (fread(&info, d_getl(ep->length), 1, fp) < 1) {
-					fail = 1;
-				}
-				break;
-			case ID_NAME:
-				/* get Mac file name */
-				fseek(fp, (off_t)d_getl(ep->offset), SEEK_SET);
-				if (fread(name, d_getl(ep->length), 1, fp) < 1)
-					*name = '\0';
-				len = d_getl(ep->length);
-				break;
-			default:
-				break;
-			}
-		}
-
-		fclose(fp);
-
-		/* skip this if we had a problem */
-		if (!fail) {
-
-			set_Dinfo(info.finderinfo, hfs_ent);
-
-			/* use stored name if it exists */
-			if (*name) {
-				/*
-				 * In some cases the name is stored in the
-				 * Pascal string format - first char is the
-				 * length, the rest is the actual string.
-				 * The following *should* be OK
-				 */
-				if (len == 32 && (int) name[0] < 32) {
-					cstrncpy(hfs_ent->name, &name[1],
-						MIN(name[0], HFS_MAX_FLEN));
-				} else {
-					cstrncpy(hfs_ent->name, name,
-							HFS_MAX_FLEN);
-				}
-			} else {
-				hstrncpy((unsigned char *) (hfs_ent->name),
-							dname, HFS_MAX_FLEN);
-			}
-		}
-	} else {
-		/* failed to open/read finderinfo */
-		fail = 1;
-		if (fp)
-			fclose(fp);
-	}
-
-	if (fail) {
-		/* problem with the file - try mapping/magic */
-		if (verbose > 2) {
-			fprintf(stderr,
-				"warning: %s doesn't appear to be a %s file\n",
-				s_entry->whole_name, hfs_types[ret].desc);
-		}
-		ret = get_none_dir(hname, dname, s_entry, TYPE_NONE);
-	}
-	return (ret);
-}
-
-/*
- *	Depending on the version, AppleDouble/Single stores dates
- *	relative to 1st Jan 1904 (v1) or 1st Jan 2000 (v2)
- *
- *	The d_toutime() function uses 1st Jan 1904 to convert to
- *	Unix time (1st Jan 1970).
- *
- *	The d_dtoutime() function uses 1st Jan 2000 to convert to
- *	Unix time (1st Jan 1970).
- *
- *	However, NetaTalk files seem to do their own thing - older
- *	Netatalk files don't have a magic number of version and
- *	store dates in ID=7 (don't know how). Newer Netatalk files
- *	claim to be version 1, but store dates in ID=7 as if they
- *	were version 2 files.
- */
-
-/*
- *	get_dbl_info:	get Apple double finderinfo for a file
- *
- *	Based on code from cvt2cap.c (c) May 1988, Paul Campbell
- */
-static int
-get_dbl_info(char *hname, /* whole path */
-				 char *dname, /* this dir name */
-				 dir_ent *s_entry, /* directory entry */
-				 int ret)
-{
-	FileInfo	info;		/* finderinfo struct */
-	a_hdr		*hp;
-	a_entry		*ep;
-	int		num = -1;	/* bytes read */
-	int		nentries;
-	FILE		*fp;
-	hfsdirent	*hfs_ent = s_entry->hfs_ent;
-	dir_ent		*s_entry1;
-	char		name[64];
-	int		i;
-	int		fail = 0;
-	int		len = 0;
-	unsigned char	dates[A_DATE];
-	int		ver = 0, dlen;
-
-	hp = (a_hdr *) p_buf;
-	memset(hp, 0, A_HDR_SIZE);
-
-	memset(name, 0, sizeof (name));
-	memset(dates, 0, sizeof (dates));
-
-	/* get the rsrc file info - should exist ... */
-	if ((s_entry1 = s_entry->assoc) == NULL)
-		perr("TYPE_DBL error - shouldn't happen!");
-
-	/* open and read the info/rsrc file (it's the same file) */
-	if ((fp = fopen(hname, "rb")) != NULL)
-		num = fread(hp, 1, A_HDR_SIZE, fp);
-
-	/*
-	 * check finder info is OK - some Netatalk files don't have magic
-	 * or version set - ignore if it's a netatalk file
-	 */
-
-	ver = d_getl(hp->version);
-	if (num == A_HDR_SIZE && ((ret == TYPE_NETA) ||
-			(d_getl(hp->magic) == APPLE_DOUBLE &&
-				(ver == A_VERSION1 || ver == A_VERSION2)))) {
-
-		/* read TOC of the AppleDouble file */
-		nentries = (int) d_getw(hp->nentries);
-		if (fread(hp->entries, A_ENTRY_SIZE, nentries, fp) < 1) {
-			fail = 1;
-			nentries = 0;
-		}
-		/* extract what is needed */
-		for (i = 0, ep = hp->entries; i < nentries; i++, ep++) {
-			switch ((int)d_getl(ep->id)) {
-			case ID_FINDER:
-				/* get the finder info */
-				fseek(fp, (off_t)d_getl(ep->offset), SEEK_SET);
-				if (fread(&info, d_getl(ep->length), 1, fp) < 1) {
-					fail = 1;
-				}
-				break;
-			case ID_RESOURCE:
-				/* set the offset and correct rsrc fork size */
-				s_entry1->size = d_getl(ep->length);
-				hfs_ent->u.file.rsize = s_entry1->size;
-				/* offset to start of real rsrc fork */
-				s_entry1->hfs_off = d_getl(ep->offset);
-				set_733((char *) s_entry1->isorec.size,
-								s_entry1->size);
-				break;
-			case ID_NAME:
-				/* get Mac file name */
-				fseek(fp, (off_t)d_getl(ep->offset), SEEK_SET);
-				if (fread(name, d_getl(ep->length), 1, fp) < 1)
-					*name = '\0';
-				len = d_getl(ep->length);
-				break;
-			case ID_FILEI:
-				/* Workround for NetaTalk files ... */
-				if (ret == TYPE_NETA && ver == A_VERSION1)
-					ver = A_VERSION2;
-				/* fall through */
-			case ID_FILEDATESI:
-				/* get file info */
-				fseek(fp, d_getl(ep->offset), 0);
-				dlen = MIN(d_getl(ep->length), A_DATE);
-				if (fread(dates, dlen, 1, fp) < 1) {
-					fail = 1;
-				} else {
-					/* get the correct Unix time */
-					switch (ver) {
-
-					case (A_VERSION1):
-						hfs_ent->crdate =
-						d_toutime(d_getl(dates));
-						hfs_ent->mddate =
-						d_toutime(d_getl(dates+4));
-						break;
-					case (A_VERSION2):
-						hfs_ent->crdate =
-						d_dtoutime(d_getl(dates));
-						hfs_ent->mddate =
-						d_dtoutime(d_getl(dates+4));
-						break;
-					default:
-						/* Use Unix dates */
-						break;
-					}
-				}
-				break;
-			default:
-				break;
-			}
-		}
-
-		fclose(fp);
-
-		/* skip this if we had a problem */
-		if (!fail) {
-			set_Finfo(info.finderinfo, hfs_ent);
-
-			/* use stored name if it exists */
-			if (*name) {
-				/*
-				 * In some cases the name is stored in the
-				 * Pascal string format - first char is the
-				 * length, the rest is the actual string.
-				 * The following *should* be OK
-				 */
-				if (len == 32 && (int) name[0] < 32) {
-					cstrncpy(hfs_ent->name, &name[1],
-						MIN(name[0], HFS_MAX_FLEN));
-				} else {
-					cstrncpy(hfs_ent->name, name,
-							HFS_MAX_FLEN);
-				}
-			} else {
-				hstrncpy((unsigned char *) (hfs_ent->name),
-							dname, HFS_MAX_FLEN);
-			}
-		}
-	} else {
-		/* failed to open/read finderinfo */
-		fail = 1;
-		if (fp)
-			fclose(fp);
-	}
-
-	if (fail) {
-		/* problem with the file - try mapping/magic */
-		if (verbose > 2) {
-			fprintf(stderr,
-				"warning: %s doesn't appear to be a %s file\n",
-				s_entry->whole_name, hfs_types[ret].desc);
-		}
-		ret = get_none_info(hname, dname, s_entry, TYPE_NONE);
-	}
-	return (ret);
-}
-
-/*
- *	get_sgl_info:	get Apple single finderinfo for a file
- *
- *	Based on code from cvt2cap.c (c) May 1988, Paul Campbell
- */
-static int
-get_sgl_info(char *hname, /* whole path */
-				 char *dname, /* this dir name */
-				 dir_ent *s_entry, /* directory entry */
-				 int ret)
-{
-	FileInfo	*info = 0;	/* finderinfo struct */
-	a_hdr		*hp;
-	static a_entry	*entries;
-	a_entry		*ep;
-	int		nentries;
-	hfsdirent	*hfs_ent;
-	dir_ent		*s_entry1;
-	char		name[64];
-	int		i;
-	int		len = 0;
-	unsigned char	*dates;
-	int		ver = 0;
-
-	/*
-	 * routine called twice for each file
-	 * - first to check that it is a valid
-	 * AppleSingle file, second to fill in the HFS info.
-	 * p_buf holds the required
-	 * raw data and it *should* remain the same between the two calls
-	 */
-	hp = (a_hdr *) p_buf;
-
-	if (s_entry == 0) {
-		if (p_num < A_HDR_SIZE ||
-			d_getl(hp->magic) != APPLE_SINGLE ||
-			(d_getl(hp->version) != A_VERSION1 &&
-				d_getl(hp->version) != A_VERSION2))
-			return (TYPE_NONE);
-
-		/* check we have TOC for the AppleSingle file */
-		nentries = (int) d_getw(hp->nentries);
-		if (p_num < (int)(A_HDR_SIZE + nentries * A_ENTRY_SIZE))
-			return (TYPE_NONE);
-
-		/* save the TOC */
-		entries = (a_entry *) e_malloc(nentries * A_ENTRY_SIZE);
-
-		memcpy(entries, (p_buf + A_HDR_SIZE), nentries * A_ENTRY_SIZE);
-	} else {
-		/* have a vaild AppleSingle File */
-		memset(name, 0, sizeof (name));
-
-		/* get the rsrc file info - should exist ... */
-		if ((s_entry1 = s_entry->assoc) == NULL)
-			perr("TYPE_SGL error - shouldn't happen!");
-
-		hfs_ent = s_entry->hfs_ent;
-
-		nentries = (int) d_getw(hp->nentries);
-		ver = d_getl(hp->version);
-
-		/* extract what is needed */
-		for (i = 0, ep = entries; i < nentries; i++, ep++) {
-			switch ((int)d_getl(ep->id)) {
-			case ID_FINDER:
-				/* get the finder info */
-				info = (FileInfo *) (p_buf + d_getl(ep->offset));
-				break;
-			case ID_DATA:
-				/* set the offset and correct data fork size */
-				hfs_ent->u.file.dsize = s_entry->size =
-							d_getl(ep->length);
-				/* offset to start of real data fork */
-				s_entry->hfs_off = d_getl(ep->offset);
-				set_733((char *) s_entry->isorec.size,
-								s_entry->size);
-				break;
-			case ID_RESOURCE:
-				/* set the offset and correct rsrc fork size */
-				hfs_ent->u.file.rsize = s_entry1->size =
-							d_getl(ep->length);
-				/* offset to start of real rsrc fork */
-				s_entry1->hfs_off = d_getl(ep->offset);
-				set_733((char *) s_entry1->isorec.size,
-								s_entry1->size);
-				break;
-			case ID_NAME:
-				/* get Mac file name */
-				strncpy(name, (p_buf + d_getl(ep->offset)),
-					d_getl(ep->length));
-				len = d_getl(ep->length);
-				break;
-			case ID_FILEI:
-				/* get file info - ignore at the moment*/
-				break;
-			case ID_FILEDATESI:
-				/* get file info */
-				dates = (unsigned char *)p_buf + d_getl(ep->offset);
-				/* get the correct Unix time */
-				if (ver == A_VERSION1) {
-					hfs_ent->crdate =
-						d_toutime(d_getl(dates));
-					hfs_ent->mddate =
-						d_toutime(d_getl(dates+4));
-				} else {
-					hfs_ent->crdate =
-						d_dtoutime(d_getl(dates));
-					hfs_ent->mddate =
-						d_dtoutime(d_getl(dates+4));
-				}
-				break;
-			default:
-				break;
-			}
-		}
-
-		free(entries);
-
-		if (info == NULL) {
-			/*
-			 * failed to open/read finderinfo
-			 * - so try afpfile mapping
-			 */
-			if (verbose > 2) {
-				fprintf(stderr,
-				"warning: %s doesn't appear to be a %s file\n",
-					s_entry->whole_name,
-					hfs_types[ret].desc);
-			}
-			ret = get_none_info(hname, dname, s_entry, TYPE_NONE);
-			return (ret);
-		}
-
-		set_Finfo(info->finderinfo, hfs_ent);
-
-		/* use stored name if it exists */
-		if (*name) {
-			/*
-			 * In some cases the name is stored in the Pascal string
-			 * format - first char is the length, the rest is the
-			 * actual string. The following *should* be OK
-			 */
-			if (len == 32 && (int) name[0] < 32) {
-				cstrncpy(hfs_ent->name, &name[1], MIN(name[0],
-								HFS_MAX_FLEN));
-			} else {
-				cstrncpy(hfs_ent->name, name, HFS_MAX_FLEN);
-			}
-		} else {
-			hstrncpy((unsigned char *) (hfs_ent->name), dname,
-								HFS_MAX_FLEN);
-		}
-	}
-
-	return (ret);
-}
-
-/*
- *	get_hfs_fe_info: read in the whole finderinfo for a PC Exchange
- *		directory - saves on reading this many times for each file.
- *
- *	Based of information provided by Mark Weinstein <mrwesq at earthlink.net>
- *
- *	Note: the FINDER.DAT file layout depends on the FAT cluster size
- *	therefore, files should only be read directly from the FAT media
- *
- *	Only tested with PC Exchange v2.1 - don't know if it will work
- *	with v2.2 and above.
- */
-static struct hfs_info *
-get_hfs_fe_info(struct hfs_info *hfs_info, char *name)
-{
-	FILE		*fp;
-	int		fe_num,
-			fe_pad;
-	fe_info		info;
-	int		c = 0;
-	struct hfs_info	*hfs_info1 = NULL;
-	char		keyname[12];
-	char		*s,
-			*e,
-			*k;
-	int		i;
-
-	if ((fp = fopen(name, "rb")) == NULL)
-		return (NULL);
-
-	/*
-	 * no longer attempt to find out FAT cluster
-	 * - rely on command line parameter
-	 */
-	if (afe_size <= 0)
-		return (NULL);
-
-	fe_num = afe_size / FE_SIZE;
-	fe_pad = afe_size % FE_SIZE;
-
-	while (fread(&info, 1, FE_SIZE, fp) != 0) {
-
-		/* the Mac name may be NULL - so ignore this entry */
-		if (info.nlen != 0) {
-
-			hfs_info1 =
-			(struct hfs_info *)e_malloc(sizeof (struct hfs_info));
-			/* add this entry to the list */
-			hfs_info1->next = hfs_info;
-			hfs_info = hfs_info1;
-
-			/*
-			 * get the bits we need
-			 * - ignore [cm]time for the moment
-			 */
-			cstrncpy(hfs_info->name, (char *) (info.name),
-					info.nlen);
-
-			memcpy(hfs_info->finderinfo, info.finderinfo, INFOLEN);
-
-			s = (char *) (info.sname);
-			e = (char *) (info.ext);
-			k = keyname;
-
-			/*
-			 * short (Unix) name is stored in PC format,
-			 * so needs to be mangled a bit
-			 */
-
-			/* name part */
-			for (i = 0; i < 8; i++, s++, k++) {
-				if (*s == ' ')
-					break;
-				else
-					*k = *s;
-			}
-
-			/* extension - if it exists */
-			if (strncmp((const char *) (info.ext), "   ", 3)) {
-				*k = '.';
-				k++;
-				for (i = 0; i < 3; i++, e++, k++) {
-					if (*e == ' ')
-						break;
-					else
-						*k = *e;
-				}
-			}
-			*k = '\0';
-
-			hfs_info1->keyname = strdup(keyname);
-		}
-		/*
-		 * each record is FE_SIZE long, and there are FE_NUM
-		 * per each "cluster size", so we may need to skip the padding
-		 */
-		if (++c == fe_num) {
-			c = 0;
-			fseek(fp, (off_t)fe_pad, SEEK_CUR);
-		}
-	}
-	fclose(fp);
-
-	return (hfs_info);
-}
-
-/*
- *	get_hfs_sgi_info: read in the whole finderinfo for a SGI (XINET)
- *		directory - saves on reading this many times for each
- *		file.
- */
-static struct hfs_info *
-get_hfs_sgi_info(struct hfs_info *hfs_info, char *name)
-{
-	FILE		*fp;
-	sgi_info	info;
-	struct hfs_info	*hfs_info1 = NULL;
-
-	if ((fp = fopen(name, "rb")) == NULL)
-		return (NULL);
-
-	while (fread(&info, 1, SGI_SIZE, fp) != 0) {
-
-		hfs_info1 = (struct hfs_info *)e_malloc(sizeof (struct hfs_info));
-		/* add this entry to the list */
-		hfs_info1->next = hfs_info;
-		hfs_info = hfs_info1;
-
-		/* get the bits we need - ignore [cm]time for the moment */
-		cstrncpy(hfs_info->name, (char *)info.name, HFS_MAX_FLEN);
-
-		memcpy(hfs_info->finderinfo, info.finderinfo, INFOLEN);
-
-		/* use the HFS name as the key */
-		hfs_info1->keyname = hfs_info->name;
-
-	}
-	fclose(fp);
-
-	return (hfs_info);
-}
-
-/*
- *	del_hfs_info: delete the info list and recover memory
- */
-void
-del_hfs_info(struct hfs_info *hfs_info)
-{
-	struct hfs_info	*hfs_info1;
-
-	while (hfs_info) {
-		hfs_info1 = hfs_info;
-		hfs_info = hfs_info->next;
-
-		/* key may be the same as the HFS name - so don't free it */
-		*hfs_info1->name = '\0';
-		if (*hfs_info1->keyname)
-			free(hfs_info1->keyname);
-		free(hfs_info1);
-	}
-}
-
-/*
- *	match_key: find the correct hfs_ent using the Unix filename
- *		as the key
- */
-static struct hfs_info *
-match_key(struct hfs_info *hfs_info, char *key)
-{
-	while (hfs_info) {
-		if (strcasecmp(key, hfs_info->keyname) == 0)
-			return (hfs_info);
-		hfs_info = hfs_info->next;
-	}
-
-	return (NULL);
-}
-
-/*
- *	get_fe_dir: get PC Exchange directory name
- *
- *	base on probing with od ...
- */
-static int
-get_fe_dir(char *hname, /* whole path */
-			  char *dname, /* this dir name */
-			  dir_ent *s_entry, /* directory entry */
-			  int ret)
-{
-	struct hfs_info	*hfs_info;
-	hfsdirent	*hfs_ent = s_entry->hfs_ent;
-
-	/* cached finderinfo stored with parent directory */
-	hfs_info = s_entry->filedir->hfs_info;
-
-	/* if we have no cache, then make one and store it */
-	if (hfs_info == NULL) {
-		if ((hfs_info = get_hfs_fe_info(hfs_info, hname)) == NULL)
-			ret = TYPE_NONE;
-		else
-			s_entry->filedir->hfs_info = hfs_info;
-	}
-	if (ret != TYPE_NONE) {
-		/* see if we can find the details of this file */
-		if ((hfs_info = match_key(hfs_info, dname)) != NULL) {
-			strcpy(hfs_ent->name, hfs_info->name);
-
-			set_Dinfo(hfs_info->finderinfo, hfs_ent);
-
-			return (ret);
-		}
-	}
-	/* can't find the entry, so use the Unix name */
-	hstrncpy((unsigned char *)(hfs_ent->name), dname, HFS_MAX_FLEN);
-
-	return (TYPE_NONE);
-}
-
-/*
- *	get_fe_info: get PC Exchange file details.
- *
- *	base on probing with od and details from Mark Weinstein
- *	<mrwesq at earthlink.net>
- */
-static int
-get_fe_info(char *hname, /* whole path */
-			   char *dname, /* this dir name */
-			   dir_ent *s_entry, /* directory entry */
-			   int ret)
-{
-	struct hfs_info	*hfs_info;
-	hfsdirent	*hfs_ent = s_entry->hfs_ent;
-
-	/* cached finderinfo stored with parent directory */
-	hfs_info = s_entry->filedir->hfs_info;
-
-	/* if we have no cache, then make one and store it */
-	if (hfs_info == NULL) {
-		if ((hfs_info = get_hfs_fe_info(hfs_info, hname)) == NULL)
-			ret = TYPE_NONE;
-		else
-			s_entry->filedir->hfs_info = hfs_info;
-	}
-	if (ret != TYPE_NONE) {
-		char	*dn = dname;
-
-#ifdef _WIN32_TEST
-		/*
-		 * may have a problem here - v2.2 has long filenames,
-		 * but we need to key on the short filename,
-		 * so we need do go a bit of win32 stuff
-		 * ...
-		 */
-		char	sname[1024];
-		char	lname[1024];
-
-		cygwin32_conv_to_full_win32_path(s_entry->whole_name, lname);
-
-		if (GetShortPathName(lname, sname, sizeof (sname))) {
-			if (dn = strrchr(sname, '\\'))
-				dn++;
-			else
-				dn = sname;
-		}
-#endif	/* _WIN32 */
-
-		/* see if we can find the details of this file */
-		if ((hfs_info = match_key(hfs_info, dn)) != NULL) {
-
-			strcpy(hfs_ent->name, hfs_info->name);
-
-			set_Finfo(hfs_info->finderinfo, hfs_ent);
-
-			return (ret);
-		}
-	}
-	/* no entry found - use extension mapping */
-	if (verbose > 2) {
-		fprintf(stderr, "warning: %s doesn't appear to be a %s file\n",
-			s_entry->whole_name, hfs_types[ret].desc);
-	}
-	ret = get_none_info(hname, dname, s_entry, TYPE_NONE);
-
-	return (TYPE_NONE);
-}
-
-/*
- *	get_sgi_dir: get SGI (XINET) HFS directory name
- *
- *	base on probing with od ...
- */
-static int
-get_sgi_dir(char *hname, /* whole path */
-			   char *dname, /* this dir name */
-			   dir_ent *s_entry, /* directory entry */
-			   int ret)
-{
-	struct hfs_info	*hfs_info;
-	hfsdirent	*hfs_ent = s_entry->hfs_ent;
-
-	/* cached finderinfo stored with parent directory */
-	hfs_info = s_entry->filedir->hfs_info;
-
-	/* if we haven't got a cache, then make one */
-	if (hfs_info == NULL) {
-		if ((hfs_info = get_hfs_sgi_info(hfs_info, hname)) == NULL)
-			ret = TYPE_NONE;
-		else
-			s_entry->filedir->hfs_info = hfs_info;
-	}
-	/* find the matching entry in the cache */
-	if (ret != TYPE_NONE) {
-		/* key is (hopefully) the real Mac name */
-		cstrncpy(tmp, dname, strlen(dname));
-		if ((hfs_info = match_key(hfs_info, tmp)) != NULL) {
-			strcpy(hfs_ent->name, hfs_info->name);
-
-			set_Dinfo(hfs_info->finderinfo, hfs_ent);
-
-			return (ret);
-		}
-	}
-	/* no entry found - use Unix name */
-	hstrncpy((unsigned char *)(hfs_ent->name), dname, HFS_MAX_FLEN);
-
-	return (TYPE_NONE);
-}
-
-/*
- *	get_sgi_info: get SGI (XINET) HFS finder info
- *
- *	base on probing with od ...
- */
-static int
-get_sgi_info(char *hname, /* whole path */
-			    char *dname, /* this dir name */
-			    dir_ent *s_entry, /* directory entry */
-			    int ret)
-{
-	struct hfs_info	*hfs_info;
-	hfsdirent	*hfs_ent = s_entry->hfs_ent;
-
-	/* cached finderinfo stored with parent directory */
-	hfs_info = s_entry->filedir->hfs_info;
-
-	/* if we haven't got a cache, then make one */
-	if (hfs_info == NULL) {
-		if ((hfs_info = get_hfs_sgi_info(hfs_info, hname)) == NULL)
-			ret = TYPE_NONE;
-		else
-			s_entry->filedir->hfs_info = hfs_info;
-	}
-	if (ret != TYPE_NONE) {
-		/*
-		 * tmp is the same as hname here, but we don't need hname
-		 * anymore in this function  ...  see if we can find the
-		 * details of this file using the Unix name as the key
-		 */
-		cstrncpy(tmp, dname, strlen(dname));
-		if ((hfs_info = match_key(hfs_info, tmp)) != NULL) {
-
-			strcpy(hfs_ent->name, hfs_info->name);
-
-			set_Finfo(hfs_info->finderinfo, hfs_ent);
-
-			return (ret);
-		}
-	}
-	/* no entry found, so try file extension */
-	if (verbose > 2) {
-		fprintf(stderr, "warning: %s doesn't appear to be a %s file\n",
-			s_entry->whole_name, hfs_types[ret].desc);
-	}
-	ret = get_none_info(hname, dname, s_entry, TYPE_NONE);
-
-	return (TYPE_NONE);
-}
-
-/*
- *	get_sfm_info:	get SFM finderinfo for a file
- */
-
-static byte	sfm_magic[4] = {0x41, 0x46, 0x50, 0x00};
-static byte	sfm_version[4] = {0x00, 0x00, 0x01, 0x00};
-
-static int
-get_sfm_info(char *hname, /* whole path */
-			    char *dname, /* this dir name */
-			    dir_ent *s_entry, /* directory entry */
-			    int ret)
-{
-	sfm_info	info;	/* finderinfo struct */
-	int		num = -1; /* bytes read */
-	hfsdirent	*hfs_ent = s_entry->hfs_ent;
-
-	num = read_info_file(hname, &info, sizeof (info));
-
-	/* check finder info is OK */
-	if (num == sizeof (info) &&
-		!memcmp((char *)info.afpi_Signature, (char *)sfm_magic, 4) &&
-		!memcmp((char *)info.afpi_Version, (char *)sfm_version, 4)) {
-		/* use Unix name */
-		hstrncpy((unsigned char *)(hfs_ent->name), dname, HFS_MAX_FLEN);
-
-		set_Finfo(info.finderinfo, hfs_ent);
-
-	} else {
-		/* failed to open/read finderinfo - so try afpfile mapping */
-		if (verbose > 2) {
-			fprintf(stderr,
-				"warning: %s doesn't appear to be a %s file\n",
-				s_entry->whole_name, hfs_types[ret].desc);
-		}
-		ret = get_none_info(hname, dname, s_entry, TYPE_NONE);
-	}
-
-	return (ret);
-}
-
-#ifdef IS_MACOS_X
-/*
- *	get_xhfs_dir:	get MacOS X HFS finderinfo for a directory
- *
- *	Code ideas from 'hfstar' by Marcel Weiher marcel at metaobject.com
- *	and another GNU hfstar by Torres Vedras paulotex at yahoo.com
- *
- *	Here we are dealing with actual HFS files - not some encoding
- *	we have to use a system call to get the finderinfo
- *
- *	The file name here is the pseudo name for the resource fork
- */
-static int
-get_xhfs_dir(char *hname, /* whole path */
-			    char *dname, /* this dir name */
-			    dir_ent *s_entry, /* directory entry */
-			    int ret)
-{
-	int		err;
-	hfsdirent	*hfs_ent = s_entry->hfs_ent;
-	attrinfo	ainfo;
-	struct attrlist attrs;
-	int		i;
-
-	memset(&attrs, 0, sizeof (attrs));
-
-	/* set flags we need to get info from getattrlist() */
-	attrs.bitmapcount = ATTR_BIT_MAP_COUNT;
-	attrs.commonattr  = ATTR_CMN_CRTIME | ATTR_CMN_MODTIME |
-				ATTR_CMN_FNDRINFO;
-
-	/* get the info */
-	err = getattrlist(hname, &attrs, &ainfo, sizeof (ainfo), 0);
-
-	if (err == 0) {
-		/*
-		 * If the Finfo is blank then we assume it's not a
-		 * 'true' HFS directory ...
-		 */
-		err = 1;
-		for (i = 0; i < sizeof (ainfo.info); i++) {
-			if (ainfo.info[i] != 0) {
-				err = 0;
-				break;
-			}
-		}
-	}
-
-	/* check finder info is OK */
-	if (err == 0) {
-
-		hstrncpy((unsigned char *) (s_entry->hfs_ent->name),
-							dname, HFS_MAX_FLEN);
-
-		set_Dinfo(ainfo.info, hfs_ent);
-
-		return (ret);
-	} else {
-		/* otherwise give it it's Unix name */
-		hstrncpy((unsigned char *) (s_entry->hfs_ent->name),
-							dname, HFS_MAX_FLEN);
-		return (TYPE_NONE);
-	}
-}
-
-/*
- *	get_xhfs_info:	get MacOS X HFS finderinfo for a file
- *
- *	Code ideas from 'hfstar' by Marcel Weiher marcel at metaobject.com,
- *	another GNU hfstar by Torres Vedras paulotex at yahoo.com and
- *	hfspax by Howard Oakley howard at quercus.demon.co.uk
- *
- *	Here we are dealing with actual HFS files - not some encoding
- *	we have to use a system call to get the finderinfo
- *
- *	The file name here is the pseudo name for the resource fork
- */
-static int
-get_xhfs_info(char *hname, /* whole path */
-			     char *dname, /* this dir name */
-			     dir_ent *s_entry, /* directory entry */
-			     int ret)
-{
-	int		err;
-	hfsdirent	*hfs_ent = s_entry->hfs_ent;
-	attrinfo	ainfo;
-	struct attrlist attrs;
-	int		i;
-	int		size;
-
-	memset(&attrs, 0, sizeof (attrs));
-
-	/* set flags we need to get info from getattrlist() */
-	attrs.bitmapcount = ATTR_BIT_MAP_COUNT;
-	attrs.commonattr  = ATTR_CMN_CRTIME | ATTR_CMN_MODTIME |
-				ATTR_CMN_FNDRINFO;
-
-	/* get the info */
-	err = getattrlist(hname, &attrs, &ainfo, sizeof (ainfo), 0);
-
-	/* check finder info is OK */
-	if (err == 0) {
-
-		/*
-		 * If the Finfo is blank and the resource file is empty,
-		 * then we assume it's not a 'true' HFS file ...
-		 * There will be not associated file if the resource fork
-		 * is empty
-		 */
-
-		if (s_entry->assoc == NULL) {
-			err = 1;
-			for (i = 0; i < sizeof (ainfo.info); i++) {
-				if (ainfo.info[i] != 0) {
-					err = 0;
-					break;
-				}
-			}
-		}
-
-		if (err == 0) {
-
-			/* use Unix name */
-			hstrncpy((unsigned char *) (hfs_ent->name), dname,
-						HFS_MAX_FLEN);
-
-			set_Finfo(ainfo.info, hfs_ent);
-
-			/*
-			 * dates have already been set - but we will
-			 * set them here as well from the HFS info
-			 * shouldn't need to check for byte order, as
-			 * the source is HFS ... but we will just in case
-			 */
-			hfs_ent->crdate = d_getl((byte *)&ainfo.ctime.tv_sec);
-
-			hfs_ent->mddate = d_getl((byte *)&ainfo.mtime.tv_sec);
-		}
-
-	}
-
-	if (err) {
-		/* not a 'true' HFS file - so try afpfile mapping */
-#if 0
-		/*
-		 * don't print a warning as we will get lots on HFS
-		 * file systems ...
-		 */
-		if (verbose > 2) {
-			fprintf(stderr,
-				"warning: %s doesn't appear to be a %s file\n",
-				s_entry->whole_name, hfs_types[ret].desc);
-		}
-#endif
-		ret = get_none_info(hname, dname, s_entry, TYPE_NONE);
-	}
-
-	return (ret);
-}
-#endif /* IS_MACOS_X */
-
-/*
- *	get_hfs_itype: get the type of HFS info for a file
- */
-static int
-get_hfs_itype(char *wname, char *dname, char *htmp)
-{
-	int	wlen,
-		i;
-	int	no_type = TYPE_NONE;
-
-	wlen = strlen(wname) - strlen(dname);
-
-	/* search through the known types looking for matches */
-	for (i = 1; i < hfs_num; i++) {
-		/* skip the ones that we don't care about */
-		if ((hfs_types[i].flags & PROBE) ||
-				*(hfs_types[i].info) == TYPE_NONE) {
-			continue;
-		}
-
-		strcpy(htmp, wname);
-
-		/*
-		 * special case - if the info file doesn't exist
-		 * for a requested type, then remember the type -
-		 * we don't return here, as we _may_ find another type
-		 * so we save the type here in case - we will have
-		 * problems if more than one of this type ever exists ...
-		 */
-		if (hfs_types[i].flags & NOINFO) {
-			no_type = i;
-		} else {
-
-			/* append or insert finderinfo filename part */
-			if (hfs_types[i].flags & APPEND)
-				strcat(htmp, hfs_types[i].info);
-			else
-				sprintf(htmp + wlen, "%s%s", hfs_types[i].info,
-					(hfs_types[i].flags & NOPEND) ? "" : dname);
-
-			/* hack time ... Netatalk is a special case ... */
-			if (i == TYPE_NETA) {
-				strcpy(htmp, wname);
-				strcat(htmp, "/.AppleDouble/.Parent");
-			}
-
-			if (!access(htmp, R_OK))
-				return (hfs_types[i].type);
-		}
-	}
-
-	return (no_type);
-}
-
-/*
- *	set_root_info: set the root folder hfs_ent from given file
- */
-void
-set_root_info(char *name)
-{
-	dir_ent		*s_entry;
-	hfsdirent	*hfs_ent;
-	int		i;
-
-	s_entry = root->self;
-
-	hfs_ent = (hfsdirent *) e_malloc(sizeof (hfsdirent));
-	memset(hfs_ent, 0, sizeof (hfsdirent));
-
-	/* make sure root has a valid hfs_ent */
-	s_entry->hfs_ent = root->hfs_ent = hfs_ent;
-
-	/* search for correct type of root info data */
-	for (i = 1; i < hfs_num; i++) {
-		if ((hfs_types[i].flags & PROBE) ||
-				(hfs_types[i].get_info == get_none_info))
-			continue;
-
-		if ((*(hfs_types[i].get_dir))(name, "", s_entry, i) == i)
-			return;
-	}
-}
-
-
-/*
- *	get_hfs_dir: set the HFS directory name
- */
-int
-get_hfs_dir(char *wname, char *dname, dir_ent *s_entry)
-{
-	int	type;
-
-	/* get the HFS file type from the info file (if it exists) */
-	type = get_hfs_itype(wname, dname, tmp);
-
-	/* try to get the required info */
-	type = (*(hfs_types[type].get_dir)) (tmp, dname, s_entry, type);
-
-	return (type);
-}
-
-/*
- *	get_hfs_info: set the HFS info for a file
- */
-int
-get_hfs_info(char *wname, char *dname, dir_ent *s_entry)
-{
-	int	type,
-		wlen,
-		i;
-
-	wlen = strlen(wname) - strlen(dname);
-
-	/* we may already know the type of Unix/HFS file - so process */
-	if (s_entry->hfs_type != TYPE_NONE) {
-
-		type = s_entry->hfs_type;
-
-		strcpy(tmp, wname);
-
-		/* append or insert finderinfo filename part */
-		if (hfs_types[type].flags & APPEND)
-			strcat(tmp, hfs_types[type].info);
-		else
-			sprintf(tmp + wlen, "%s%s", hfs_types[type].info,
-				(hfs_types[type].flags & NOPEND) ? "" : dname);
-
-		type = (*(hfs_types[type].get_info))(tmp, dname, s_entry, type);
-
-		/* if everything is as expected, then return */
-		if (s_entry->hfs_type == type)
-			return (type);
-	}
-	/* we don't know what type we have so, find out */
-	for (i = 1; i < hfs_num; i++) {
-		if ((hfs_types[i].flags & PROBE) ||
-				*(hfs_types[i].info) == TYPE_NONE) {
-			continue;
-		}
-
-		strcpy(tmp, wname);
-
-		/* append or insert finderinfo filename part */
-		if (hfs_types[i].flags & APPEND) {
-			strcat(tmp, hfs_types[i].info);
-		} else {
-			sprintf(tmp + wlen, "%s%s", hfs_types[i].info,
-				(hfs_types[i].flags & NOPEND) ? "" : dname);
-		}
-
-		/* if the file exists - and not a type we've already tried */
-		if (!access(tmp, R_OK) && i != s_entry->hfs_type) {
-			type = (*(hfs_types[i].get_info))(tmp, dname,
-							s_entry, i);
-			s_entry->hfs_type = type;
-			return (type);
-		}
-	}
-
-	/* nothing found, so just a Unix file */
-	type = (*(hfs_types[TYPE_NONE].get_info))(wname, dname,
-							s_entry, TYPE_NONE);
-
-	return (type);
-}
-
-/*
- *	get_hfs_rname: set the name of the Unix rsrc file for a file
- *
- *	For the time being we ignore the 'NOINFO' flag - the only case
- *	at the moment is for MacOS X HFS files - for files the resource
- *	fork exists - so testing the "filename/rsrc" pseudo file as
- *	the 'info' filename is OK ...
- */
-int
-get_hfs_rname(char *wname, char *dname, char *rname)
-{
-	int	wlen,
-		type,
-		i;
-	int	p_fd = -1;
-
-	wlen = strlen(wname) - strlen(dname);
-
-	/* try to find what sort of Unix HFS file type we have */
-	for (i = 1; i < hfs_num; i++) {
-		/* skip if don't want to probe the files - (default) */
-		if (hfs_types[i].flags & PROBE)
-			continue;
-
-		strcpy(rname, wname);
-
-		/* if we have a different info file, the find out it's type */
-		if (*(hfs_types[i].rsrc) && *(hfs_types[i].info)) {
-			/* first test the Info file */
-
-			/* append or insert finderinfo filename part */
-			if (hfs_types[i].flags & APPEND) {
-				strcat(rname, hfs_types[i].info);
-			} else {
-				sprintf(rname + wlen, "%s%s", hfs_types[i].info,
-					(hfs_types[i].flags & NOPEND) ?
-								"" : dname);
-			}
-
-			/* if it exists, then check the Rsrc file */
-			if (!access(rname, R_OK)) {
-				if (hfs_types[i].flags & APPEND) {
-					sprintf(rname + wlen, "%s%s", dname,
-						hfs_types[i].rsrc);
-				} else {
-					sprintf(rname + wlen, "%s%s",
-						hfs_types[i].rsrc, dname);
-				}
-
-				/*
-				 * for some types, a rsrc fork may not exist,
-				 * so just return the current type
-				 * in these cases
-				 */
-				if (hfs_types[i].flags & NORSRC ||
-							!access(rname, R_OK))
-					return (hfs_types[i].type);
-			}
-		} else {
-			/*
-			 * if we are probing,
-			 * then have a look at the contents to find type
-			 */
-			if (p_fd < 0) {
-				/* open file, if not already open */
-				if ((p_fd = open(wname,
-						O_RDONLY | O_BINARY)) < 0) {
-					/* can't open it, then give up */
-					return (TYPE_NONE);
-				} else {
-					if ((p_num = read(p_fd, p_buf,
-							sizeof (p_buf))) <= 0) {
-						/*
-						 * can't read, or zero length
-						 * - give up
-						 */
-						close(p_fd);
-						return (TYPE_NONE);
-					}
-					/* get file pointer and close file */
-					p_fp = fdopen(p_fd, "rb");
-					close(p_fd);
-					if (p_fp == NULL)
-						return (TYPE_NONE);
-				}
-			}
-			/*
-			 * call routine to do the work
-			 * - use the given dname as this
-			 * is the name we may use on the CD
-			 */
-			type = (*(hfs_types[i].get_info)) (rname, dname, 0, i);
-			if (type != 0) {
-				fclose(p_fp);
-				return (type);
-			}
-			if (p_fp) {
-				/*
-				 * close file
-				 * - just use contents of buffer next time
-				 */
-				fclose(p_fp);
-				p_fp = NULL;
-			}
-		}
-	}
-
-	return (0);
-}
-
-/*
- *	hfs_exclude: file/directory names that hold finder/resource
- *		     information that we want to exclude from the tree.
- *		     These files/directories are processed later ...
- */
-int
-hfs_exclude(char *d_name)
-{
-	/* we don't exclude "." and ".." */
-	if (strcmp(d_name, ".") == 0)
-		return (0);
-	if (strcmp(d_name, "..") == 0)
-		return (0);
-
-	/* do not add the following to our list of dir entries */
-	if (DO_CAP & hselect) {
-		/* CAP */
-		if (strcmp(d_name, ".finderinfo") == 0)
-			return (1);
-		if (strcmp(d_name, ".resource") == 0)
-			return (1);
-		if (strcmp(d_name, ".ADeskTop") == 0)
-			return (1);
-		if (strcmp(d_name, ".IDeskTop") == 0)
-			return (1);
-		if (strcmp(d_name, "Network Trash Folder") == 0)
-			return (1);
-		/*
-		 * special case when HFS volume is mounted using Linux's hfs_fs
-		 * Brad Midgley <brad at pht.com>
-		 */
-		if (strcmp(d_name, ".rootinfo") == 0)
-			return (1);
-	}
-	if (DO_ESH & hselect) {
-		/* Helios EtherShare files */
-		if (strcmp(d_name, ".rsrc") == 0)
-			return (1);
-		if (strcmp(d_name, ".Desktop") == 0)
-			return (1);
-		if (strcmp(d_name, ".DeskServer") == 0)
-			return (1);
-		if (strcmp(d_name, ".Label") == 0)
-			return (1);
-	}
-	if (DO_DBL & hselect) {
-	/* Apple Double */
-		/*
-		 * special case when HFS volume is mounted using Linux's hfs_fs
-		 */
-		if (strcmp(d_name, "%RootInfo") == 0)
-			return (1);
-		/*
-		 * have to be careful here - a filename starting with '%'
-		 * may be vaild if the next two letters are a hex character -
-		 * unfortunately '%' 'digit' 'digit' may be a valid resource
-		 * file name ...
-		 */
-		if (*d_name == '%')
-			if (hex2char(d_name) == 0)
-				return (1);
-	}
-	if (DO_NETA & hselect) {
-		if (strcmp(d_name, ".AppleDouble") == 0)
-			return (1);
-		if (strcmp(d_name, ".AppleDesktop") == 0)
-			return (1);
-	}
-	if ((DO_FEU & hselect) || (DO_FEL & hselect)) {
-		/* PC Exchange */
-		if (strcmp(d_name, "RESOURCE.FRK") == 0)
-			return (1);
-		if (strcmp(d_name, "FINDER.DAT") == 0)
-			return (1);
-		if (strcmp(d_name, "DESKTOP") == 0)
-			return (1);
-		if (strcmp(d_name, "FILEID.DAT") == 0)
-			return (1);
-		if (strcmp(d_name, "resource.frk") == 0)
-			return (1);
-		if (strcmp(d_name, "finder.dat") == 0)
-			return (1);
-		if (strcmp(d_name, "desktop") == 0)
-			return (1);
-		if (strcmp(d_name, "fileid.dat") == 0)
-			return (1);
-	}
-	if (DO_SGI & hselect) {
-		/* SGI */
-		if (strcmp(d_name, ".HSResource") == 0)
-			return (1);
-		if (strcmp(d_name, ".HSancillary") == 0)
-			return (1);
-	}
-	if (DO_DAVE & hselect) {
-		/* DAVE */
-		if (strcmp(d_name, "resource.frk") == 0)
-			return (1);
-		if (strcmp(d_name, "DesktopFolderDB") == 0)
-			return (1);
-	}
-#ifndef _WIN32
-	/*
-	 * NTFS streams are not "seen" as files,
-	 * so WinNT will not see these files -
-	 * so ignore - used for testing under Unix
-	 */
-	if (DO_SFM & hselect) {
-		/* SFM */
-		char	*dn = strrchr(d_name, ':');
-
-		if (dn) {
-			if (strcmp(dn, ":Afp_Resource") == 0)
-				return (1);
-			if (strcmp(dn, ":Comments") == 0)
-				return (1);
-			if (strcmp(dn, ":Afp_AfpInfo") == 0)
-				return (1);
-		}
-	}
-#endif	/* _WIN32 */
-
-	if (DO_XDBL & hselect) {
-		/* XDB */
-		if (strncmp(d_name, "._", 2) == 0)
-			return (1);
-	}
-
-	return (0);
-}
-
-/*
- *	print_hfs_info: print info about the HFS files.
- *
- */
-void
-print_hfs_info(dir_ent *s_entry)
-{
-	fprintf(stderr, "Name: %s\n", s_entry->whole_name);
-	fprintf(stderr, "\tFile type: %s\n", hfs_types[s_entry->hfs_type].desc);
-	fprintf(stderr, "\tHFS Name: %s\n", s_entry->hfs_ent->name);
-	fprintf(stderr, "\tISO Name: %s\n", s_entry->isorec.name);
-	fprintf(stderr, "\tCREATOR: %s\n", s_entry->hfs_ent->u.file.creator);
-	fprintf(stderr, "\tTYPE:	%s\n", s_entry->hfs_ent->u.file.type);
-}
-
-
-/*
- *	hfs_init: sets up the mapping list from the afpfile as well
- *		 the default mapping (with or without) an afpfile
- */
-void
-hfs_init(char *name, Ushort fdflags, Uint hfs_select)
-{
-	FILE	*fp;		/* File pointer */
-	int	count = NUMMAP;	/* max number of entries */
-	char	buf[PATH_MAX];	/* working buffer */
-	afpmap	*amap;		/* mapping entry */
-	char	*c,
-		*t,
-		*e;
-	int	i;
-
-	/* setup number of Unix/HFS filetype - we may wish to not bother */
-	if (hfs_select) {
-		hfs_num = sizeof (hfs_types) / sizeof (struct hfs_type);
-
-		/*
-		 * code below needs to be tidied up
-		 * - most can be made redundant
-		 */
-		for (i = 0; i < hfs_num; i++)
-			hfs_types[i].flags &= ~1;	/* 0xfffffffe */
-
-		for (i = 1; i < hfs_num; i++)
-			if (!((1 << i) & hfs_select))
-				hfs_types[i].flags |= PROBE;
-
-		hselect = hfs_select;
-	} else
-		hfs_num = hselect = 0;
-
-#ifdef DEBUG
-	for (i = 0; i < hfs_num; i++)
-		fprintf(stderr, "type = %d flags = %d\n",
-					i, hfs_types[i].flags);
-#endif	/* DEBUG */
-
-	/* min length set to max to start with */
-	mlen = PATH_MAX;
-
-#ifdef USE_MAGIC
-	/* initialise magic state */
-	if (magic_filename) {
-		magic_state = magic_open(MAGIC_ERROR);
-		if (magic_state == NULL)
-			perr("failed to initialise libmagic");
-		if (magic_load(magic_state, magic_filename) == -1) {
-			fprintf(stderr, "failed to open magic file: %s\n",
-				magic_error(magic_state));
-			exit(1);
-		}
-	}
-#endif /* USE_MAGIC */
-
-	/* set defaults */
-	map_num = last_ent = 0;
-
-	/* allocate memory for the default entry */
-	defmap = (afpmap *) e_malloc(sizeof (afpmap));
-
-	/* set default values */
-	defmap->extn = DEFMATCH;
-
-	/* make sure creator and type are 4 chars long */
-	strcpy(defmap->type, BLANK);
-	strcpy(defmap->creator, BLANK);
-
-	e = deftype;
-	t = defmap->type;
-
-	while (*e && (e - deftype) < CT_SIZE)
-		*t++ = *e++;
-
-	e = defcreator;
-	c = defmap->creator;
-
-	while (*e && (e - defcreator) < CT_SIZE)
-		*c++ = *e++;
-
-	/* length is not important here */
-	defmap->elen = 0;
-
-	/* no flags */
-	defmap->fdflags = fdflags;
-
-	/* no afpfile - no mappings */
-	if (*name == '\0') {
-		map = NULL;
-		return;
-	}
-	if ((fp = fopen(name, "r")) == NULL)
-		perr("unable to open mapping file");
-
-	map = (afpmap **) e_malloc(NUMMAP * sizeof (afpmap *));
-
-	/* read afpfile line by line */
-	while (fgets(buf, PATH_MAX, fp) != NULL) {
-		/* ignore any comment lines */
-		c = tmp;
-		*c = '\0';
-		if (sscanf(buf, "%1s", c) == EOF || *c == '#')
-			continue;
-
-		/* increase list size if needed */
-		if (map_num == count) {
-			count += NUMMAP;
-			map = (afpmap **)realloc(map, count * sizeof (afpmap *));
-			if (map == NULL)
-				perr("not enough memory");
-		}
-		/* allocate memory for this entry */
-		amap = (afpmap *) e_malloc(sizeof (afpmap));
-
-		t = amap->type;
-		c = amap->creator;
-
-		/* extract the info */
-		if (sscanf(buf, "%s%*s%*1s%c%c%c%c%*1s%*1s%c%c%c%c%*1s",
-				tmp, c, c + 1, c + 2, c + 3,
-				t, t + 1, t + 2, t + 3) != 9) {
-			fprintf(stderr,
-				"error scanning afpfile %s - continuing", name);
-			free(amap);
-			continue;
-		}
-		/* copy the extension found */
-		if ((amap->extn = (char *) strdup(tmp)) == NULL)
-			perr("not enough memory");
-
-		/* set end-of-string */
-		*(t + 4) = *(c + 4) = '\0';
-
-		/* find the length of the extension */
-		amap->elen = strlen(amap->extn);
-
-		/* set flags */
-		amap->fdflags = fdflags;
-
-		/* see if we have the default creator/type */
-		if (strcmp(amap->extn, DEFMATCH) == 0) {
-			/* get rid of the old default */
-			free(defmap);
-			/* make this the default */
-			defmap = amap;
-			continue;
-		}
-		/* update the smallest extension length */
-		mlen = MIN(mlen, amap->elen);
-
-		/* add entry to the list */
-		map[map_num++] = amap;
-
-	}
-
-	/* free up some memory */
-	if (map_num != count) {
-		map = (afpmap **) realloc(map, map_num * sizeof (afpmap *));
-		if (map == NULL)
-			perr("not enough memory");
-	}
-}
-
-#ifdef USE_MAGIC
-static int
-try_map_magic(char *whole_name, char **type, /* set type */
-				  char **creator /* set creator */)
-{
-	const char * ret = magic_file(magic_state, whole_name);
-
-#ifdef DEBUG
-	fprintf(stderr, "magic_file(magic_state, \"%s\"): %s\n",
-		whole_name, ret ? ret : "NULL");
-#endif
-	/*
-	 * check that we found a match; ignore results in the
-	 * wrong format (probably due to libmagic's built-in rules)
-	 */
-	if (ret && strcspn(ret, " ") == CT_SIZE
-	    && ret[CT_SIZE] == ' '
-	    && strcspn(ret + CT_SIZE + 1, " ") == CT_SIZE) {
-		memcpy(tmp_type, ret, CT_SIZE);
-		tmp_type[CT_SIZE] = 0;
-		memcpy(tmp_creator, ret + CT_SIZE + 1, CT_SIZE);
-		tmp_creator[CT_SIZE] = 0;
-#ifdef DEBUG
-		fprintf(stderr, "tmp_type = \"%s\"; tmp_creator = \"%s\"\n",
-			tmp_type, tmp_creator);
-#endif
-		*type = tmp_type;
-		*creator = tmp_creator;
-		return (1);
-	}
-
-	return (0);
-}
-#endif /* USE_MAGIC */
-
-/*
- *	map_ext: map a files extension with the list to get type/creator
- */
-static void
-map_ext(char *name, /* filename */
-		  char **type, /* set type */
-		  char **creator, /* set creator */
-		  short *fdflags, /* set finder flags */
-		  char *whole_name)
-{
-	int	i;		/* loop counter */
-	int	len;		/* filename length */
-	afpmap	*amap;		/* mapping entry */
-	const char	*ret;
-
-	/* we don't take fdflags from the map or magic file */
-	*fdflags = defmap->fdflags;
-
-#ifdef USE_MAGIC
-	/*
-	 * if we have a magic file and we want to search it first,
-	 * then try to get a match
-	 */
-	if (magic_state && hfs_last == MAP_LAST
-	    && try_map_magic(whole_name, type, creator))
-				return;
-#endif /* USE_MAGIC */
-
-	len = strlen(name);
-
-	/* have an afpfile and filename if long enough */
-	if (map && len >= mlen) {
-		/*
-		 * search through the list - we start where we left off
-		 * last time in case this file is of the same type as the
-		 * last one
-		 */
-		for (i = 0; i < map_num; i++) {
-			amap = map[last_ent];
-
-			/* compare the end of the filename */
-/*			if (strcmp((name+len - amap->elen), amap->extn) == 0) { */
-			if (strcasecmp((name+len - amap->elen), amap->extn) == 0) {
-				/* set the required info */
-				*type = amap->type;
-				*creator = amap->creator;
-				*fdflags = amap->fdflags;
-				return;
-			}
-			/*
-			 * move on to the next entry - wrapping round
-			 * if neccessary
-			 */
-			last_ent++;
-			last_ent %= map_num;
-		}
-	}
-	/*
-	 * if no matches are found, file name too short, or no afpfile,
-	 * then take defaults
-	 */
-	*type = defmap->type;
-	*creator = defmap->creator;
-
-#ifdef USE_MAGIC
-	/*
-	 * if we have a magic file and we haven't searched yet,
-	 * then try to get a match
-	 */
-	if (magic_state && hfs_last == MAG_LAST)
-		try_map_magic(whole_name, type, creator);
-#endif /* USE_MAGIC */
-}
-
-void
-delete_rsrc_ent(dir_ent *s_entry)
-{
-	dir_ent	*s_entry1 = s_entry->next;
-
-	if (s_entry1 == NULL)
-		return;
-
-	s_entry->next = s_entry1->next;
-	s_entry->assoc = NULL;
-
-	free(s_entry1->name);
-	free(s_entry1->whole_name);
-
-	free(s_entry1);
-}
-
-void
-clean_hfs()
-{
-	if (map)
-		free(map);
-
-	if (defmap)
-		free(defmap);
-
-#ifdef USE_MAGIC
-	if (magic_state) {
-		magic_close(magic_state);
-		magic_state = NULL;
-	}
-#endif /* USE_MAGIC */
-}
-
-#endif	/* APPLE_HYB */
-
-void
-perr(char *a)
-{
-#ifdef	USE_LIBSCHILY
-	if (a)
-		comerr("%s\n", a);
-	else
-		comerr("<no error message given>\n");
-#else
-	if (a)
-		fprintf(stderr, "mkhybrid: %s\n", a);
-	perror("mkhybrid");
-	exit(1);
-#endif
-}

Copied: cdrkit/trunk/genisoimage/apple.c (from rev 452, cdrkit/trunk/mkisoimage/apple.c)

Deleted: cdrkit/trunk/genisoimage/apple_driver.8
===================================================================
--- cdrkit/trunk/mkisoimage/apple_driver.8	2006-11-23 21:37:32 UTC (rev 450)
+++ cdrkit/trunk/genisoimage/apple_driver.8	2006-11-23 22:11:41 UTC (rev 453)
@@ -1,72 +0,0 @@
-'\" te
-.\" To print, first run through tbl
-.TH APPLE_DRIVER 8 "18 May 1998" "Version 1.0"
-.SH NAME
-apple_driver \- extract Macintosh partition label, maps and boot driver
-.SH SYNOPSIS
-.B apple_driver
-CDROM_device > HFS_driver_file
-.SH DESCRIPTION
-.I Apple_driver
-extracts the information from an Apple (or compatible) CD-ROM required
-for the
-.I \-hfs-boot-file
-option to
-.IR mkhybrid (1). 
-.PP
-The 
-.I CDROM_device
-is the device name used by the CD-ROM (e.g. /dev/cdrom).
-.PP
-The format of the HFS driver file is:
-.PP
-.TS
-l l .
-HFS CD Label Block	512 bytes
-Driver Partition Map (for 2048 byte blocks)	512 bytes
-Driver Partition Map (for 512 byte blocks)	512 bytes
-Empty	512 bytes
-Driver Partition	N x 2048 bytes
-HFS Partition Boot Block	1024 bytes
-.TE
-.PP
-The Perl script
-.I hdisk.pl
-can be used to give a listing of what's on a Mac CD. hdisk.pl is part of
-hfsutils.
-.SH NOTE
-By using a driver from an Apple CD and copying Apple software to your CD,
-you become liable to obey Apple Computer, Inc. Software License Agreements.
-
-.SH SEE\ ALSO
-.IR mkhybrid (1)
-.SH PROGRAMMER
-James Pearson (j.pearson at ge.ucl.ac.uk) 18/5/98
-.PP
-The driver code (both extracting the driver and creating partitions etc.
-is based on code from 
-.I mkisoimage 1.05 PLUS
-by Andy Polyakov <appro at fy.chalmers.se>
-(see http://fy.chalmers.se/~appro/mkisoimage_plus.html)
-.PP
-This manpage describes the program implementation of
-.B
-apple_driver
-as shipped by the cdrkit distribution. See
-.B
-http://alioth.debian.org/projects/debburn/
-for details. It is a spinof from the original program distributed by the cdrtools project. However, the cdrtools developers are not involved in the development of this spinoff and therefore shall not be made responsible for any problem caused by it. Do not try to get support for this program by contacting the original authors.
-.PP
-If you have support questions, send them to
-.PP
-.B
-debburn-devel at lists.alioth.debian.org
-.br
-.PP
-If you have definitely found a bug, send a mail to this list or to
-.PP
-.B
-submit at bugs.debian.org
-.br
-.PP
-writing at least a short description into the Subject and "Package: cdrkit" into the first line of the mail body.

Copied: cdrkit/trunk/genisoimage/apple_driver.8 (from rev 452, cdrkit/trunk/mkisoimage/apple_driver.8)

Deleted: cdrkit/trunk/genisoimage/apple_driver.c
===================================================================
--- cdrkit/trunk/mkisoimage/apple_driver.c	2006-11-23 21:37:32 UTC (rev 450)
+++ cdrkit/trunk/genisoimage/apple_driver.c	2006-11-23 22:11:41 UTC (rev 453)
@@ -1,194 +0,0 @@
-/*
- * This file has been modified for the cdrkit suite.
- *
- * The behaviour and appearence of the program code below can differ to a major
- * extent from the version distributed by the original author(s).
- *
- * For details, see Changelog file distributed with the cdrkit package. If you
- * received this file from another source then ask the distributing person for
- * a log of modifications.
- *
- */
-
-/* @(#)apple_driver.c	1.6 04/03/04 joerg */
-#ifndef lint
-static	char sccsid[] =
-	"@(#)apple_driver.c	1.6 04/03/04 joerg";
-#endif
-/*
- *	apple_driver.c: extract Mac partition label, maps and boot driver
- *
- *	Based on Apple_Driver.pl, part of "mkisoimage 1.05 PLUS" by Andy Polyakov
- *	<appro at fy.chalmers.se> (I don't know Perl, so I rewrote it C ...)
- *	(see http://fy.chalmers.se/~appro/mkisoimage_plus.html for details)
- *
- *	usage: apple_driver CDROM_device > HFS_driver_file
- *
- *	The format of the HFS driver file:
- *
- *	HFS CD Label Block				512 bytes
- *	Driver Partition Map (for 2048 byte blocks)	512 bytes
- *	Driver Partition Map (for 512 byte blocks)	512 bytes
- *	Empty						512 bytes
- *	Driver Partition				N x 2048 bytes
- *	HFS Partition Boot Block			1024 bytes
- *
- *	By extracting a driver from an Apple CD, you become liable to obey
- *	Apple Computer, Inc. Software License Agreements.
- *
- *	James Pearson 17/5/98
- */
-
-#include <mconfig.h>
-#include "mkisoimage.h"
-#include <mac_label.h>
-#include <schily.h>
-
-int	get_732(char *p);
-int	get_722(char *p);
-
-int
-get_732(char *p)
-{
-	return ((p[3] & 0xff)
-		| ((p[2] & 0xff) << 8)
-		| ((p[1] & 0xff) << 16)
-		| ((p[0] & 0xff) << 24));
-}
-
-int
-get_722(char *p)
-{
-	return ((p[1] & 0xff)
-		| ((p[0] & 0xff) << 8));
-}
-
-#if 0
-EXPORT int
-main(argc, argv)
-	int	argc;
-	char	**argv;
-{
-	FILE		*fp;
-	MacLabel	*mac_label;
-	MacPart		*mac_part;
-	unsigned char	Block0[HFS_BLOCKSZ];
-	unsigned char	block[SECTOR_SIZE];
-	unsigned char	bootb[2*HFS_BLOCKSZ];
-	unsigned char	pmBlock512[HFS_BLOCKSZ];
-	unsigned int	sbBlkSize;
-	unsigned int	pmPyPartStart;
-	unsigned int	pmPartStatus;
-	unsigned int	pmMapBlkCnt;
-	int		have_boot = 0, have_hfs = 0;
-	int		hfs_start;
-	int		i, j;
-
-
-	save_args(argc, argv);
-
-	if (argc != 2)
-	    comerrno(EX_BAD, "Usage: %s device-path", argv[0]);
-
-	if ((fp = fopen(argv[1], "rb")) == NULL)
-	    comerr("Can't open '%s'.", argv[1]);
-
-	if (fread(Block0, 1, HFS_BLOCKSZ, fp) != HFS_BLOCKSZ)
-	    comerr("Can't read '%s'.", argv[1]);
-
-	mac_label = (MacLabel *)Block0;
-	mac_part = (MacPart *)block;
-
-	sbBlkSize = get_722((char *)mac_label->sbBlkSize);
-
-	if (! IS_MAC_LABEL(mac_label) || sbBlkSize != SECTOR_SIZE)
-	    comerrno(EX_BAD, "%s is not a bootable Mac disk", argv[1]);
-
-	i = 1;
-	do {
-		if (fseek(fp, i * HFS_BLOCKSZ, SEEK_SET) != 0)
-			comerr("Ccan't seek %s", argv[1]);
-
-		if (fread(block, 1, HFS_BLOCKSZ, fp) != HFS_BLOCKSZ)
-			comerr("Can't read '%s'.", argv[1]);
-
-		pmMapBlkCnt = get_732((char *)mac_part->pmMapBlkCnt);
-
-		if (!have_boot && strncmp((char *)mac_part->pmPartType, pmPartType_2, 12) == 0) {
-			hfs_start = get_732((char *)mac_part->pmPyPartStart);
-
-			fprintf(stderr, "%s: found 512 driver partition (at block %d)\n", argv[0], hfs_start);
-			memcpy(pmBlock512, block, HFS_BLOCKSZ);
-			have_boot = 1;
-		}
-
-		if (!have_hfs && strncmp((char *)mac_part->pmPartType, pmPartType_4, 9) == 0) {
-
-			hfs_start = get_732((char *)mac_part->pmPyPartStart);
-
-			if (fseek(fp, hfs_start*HFS_BLOCKSZ, SEEK_SET) != 0)
-				comerr("Can't seek '%s'.", argv[1]);
-
-			if (fread(bootb, 2, HFS_BLOCKSZ, fp) != HFS_BLOCKSZ)
-				comerr("Can't read '%s'.", argv[1]);
-
-			if (get_722((char *)bootb) == 0x4c4b) {
-
-				fprintf(stderr, "%s: found HFS partition (at blk %d)\n", argv[0], hfs_start);
-				have_hfs = 1;
-			}
-		}
-	} while (i++ < pmMapBlkCnt);
-
-	if (!have_hfs || !have_boot)
-		comerrno(EX_BAD, "%s is not a bootable Mac disk", argv[1]);
-
-	i = 1;
-
-	do {
-		if (fseek(fp, i*sbBlkSize, SEEK_SET) != 0)
-			comerr("Can't seek '%s'.", argv[1]);
-
-		if (fread(block, 1, HFS_BLOCKSZ, fp) != HFS_BLOCKSZ)
-			comerr("Can't read '%s'.", argv[1]);
-
-		pmMapBlkCnt = get_732((char *)mac_part->pmMapBlkCnt);
-
-		if (strncmp((char *)mac_part->pmPartType, pmPartType_2, 12) == 0) {
-
-			int	start, num;
-
-			fprintf(stderr, "%s: extracting %s ", argv[0], mac_part->pmPartType);
-			start = get_732((char *)mac_part->pmPyPartStart);
-			num = get_732((char *)mac_part->pmPartBlkCnt);
-			fwrite(Block0, 1, HFS_BLOCKSZ, stdout);
-			fwrite(block, 1, HFS_BLOCKSZ, stdout);
-			fwrite(pmBlock512, 1, HFS_BLOCKSZ, stdout);
-			memset(block, 0, HFS_BLOCKSZ);
-			fwrite(block, 1, HFS_BLOCKSZ, stdout);
-
-			if (fseek(fp, start*sbBlkSize, SEEK_SET) != 0)
-				comerr("Can't seek '%s'.", argv[1]);
-
-			for (j = 0; j < num; j++) {
-				if (fread(block, 1, sbBlkSize, fp) != sbBlkSize)
-					comerr("Can't read '%s'.", argv[1]);
-
-				fwrite(block, 1, sbBlkSize, stdout);
-				fprintf(stderr, ".");
-			}
-			fprintf(stderr, "\n");
-
-			fwrite(bootb, 2, HFS_BLOCKSZ, stdout);
-			fclose(fp);
-			exit(0);
-		}
-
-		if (!IS_MAC_PART(mac_part))
-			comerrno(EX_BAD, "Unable to find boot partition");
-
-	} while (i++ < pmMapBlkCnt);
-
-	return (0);
-}
-#endif

Copied: cdrkit/trunk/genisoimage/apple_driver.c (from rev 452, cdrkit/trunk/mkisoimage/apple_driver.c)

Deleted: cdrkit/trunk/genisoimage/boot-alpha.c
===================================================================
--- cdrkit/trunk/mkisoimage/boot-alpha.c	2006-11-23 21:37:32 UTC (rev 450)
+++ cdrkit/trunk/genisoimage/boot-alpha.c	2006-11-23 22:11:41 UTC (rev 453)
@@ -1,124 +0,0 @@
-/*
- * This file has been modified for the cdrkit suite.
- *
- * The behaviour and appearence of the program code below can differ to a major
- * extent from the version distributed by the original author(s).
- *
- * For details, see Changelog file distributed with the cdrkit package. If you
- * received this file from another source then ask the distributing person for
- * a log of modifications.
- *
- */
-
-/*
- * Program boot-alpha.c - Handle Linux alpha boot extensions to iso9660.
- *
- * Written by Steve McIntyre <steve at einval.com> June 2004
- *
- * Heavily inspired by isomarkboot by David Mosberger in 1996.
- *
- * Copyright 2004 Steve McIntyre
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <mconfig.h>
-#include "mkisoimage.h"
-#include <fctldefs.h>
-#include <utypes.h>
-#include <intcvt.h>
-#include "match.h"
-#include "diskmbr.h"
-#include "bootinfo.h"
-#include <schily.h>
-#include "endianconv.h"
-
-        int     add_boot_alpha_filename(char *filename);
-static  int     boot_alpha_write(FILE *outfile);
-static  char   *boot_file_name = NULL;
-
-#define BOOT_STRING "Linux/Alpha aboot for ISO filesystem."
-
-/* Simple function: store the filename to be used later when we need
-   to find the boot file */
-extern int add_boot_alpha_filename(char *filename)
-{
-    boot_file_name = filename;
-    return 0;
-}
-
-static int boot_alpha_write(FILE *outfile)
-{
-    unsigned long long boot_sector[256]; /* One (ISO) sector */
-    unsigned long long sum = 0;
-	struct directory_entry	*boot_file;	/* Boot file we need to search for */
-    unsigned long length = 0;
-    unsigned long extent = 0;
-    int i = 0;
-
-    memset(boot_sector, 0, sizeof(boot_sector));    
-
-    /* Write the text header into the boot sector */
-    strcpy((char *)boot_sector, BOOT_STRING);
-
-    /* Find the dir entry for the boot file by walking our file list */
-    boot_file = search_tree_file(root, boot_file_name);
-    if (!boot_file) {
-#ifdef	USE_LIBSCHILY
-		comerrno(EX_BAD, "Uh oh, I cant find the Alpha boot file '%s'!\n",
-							boot_file_name);
-#else
-		fprintf(stderr, "Uh oh, I cant find the Alpha boot file '%s'!\n",
-							boot_file_name);
-		exit(1);
-#endif
-    }
-
-    /* Grab the ISO start sector and length from the dir entry. ISO
-       uses 2048-byte sectors, but we convert to 512-byte sectors here
-       for the sake of the firmware */
-    extent = get_733(boot_file->isorec.extent);
-    extent *= 4;
-    
-    length = get_733(boot_file->isorec.size);
-    length /= 512; /* I'm sure we should take account of any overlap
-                      here, but I'm copying what isomarkboot
-                      does. Maybe the boot files are specified to be
-                      exact multiples of 512 bytes? */
-
-    fprintf(stderr, "Found alpha boot image %s: using extent %lu, #blocks %lu\n",
-            boot_file_name, extent, length);
-
-    /* Now write those values into the appropriate area of the boot
-       sector in LITTLE ENDIAN format. */
-    write_le64(length, (unsigned char *)(unsigned long long *)&boot_sector[60]);
-    write_le64(extent, (unsigned char *)&boot_sector[61]);
-
-    /* Now generate a checksum of the first 504 bytes of the boot
-       sector and place it in boot_sector[63]. Isomarkboot currently
-       gets this wrong and will not work on big-endian systems! */
-    for (i = 0; i < 63; i++)
-        sum += read_le64((unsigned char *)&boot_sector[i]);
-
-    write_le64(sum, (unsigned char *)&boot_sector[63]);
-
-    jtwrite(boot_sector, sizeof(boot_sector), 1, 0, FALSE);
-    xfwrite(boot_sector, sizeof(boot_sector), 1, outfile, 0, FALSE);
-    last_extent_written++;
-
-    return 0;
-}
-
-struct output_fragment alphaboot_desc = {NULL, oneblock_size, NULL, boot_alpha_write, "alpha boot block"};

Copied: cdrkit/trunk/genisoimage/boot-alpha.c (from rev 452, cdrkit/trunk/mkisoimage/boot-alpha.c)

Deleted: cdrkit/trunk/genisoimage/boot-hppa.c
===================================================================
--- cdrkit/trunk/mkisoimage/boot-hppa.c	2006-11-23 21:37:32 UTC (rev 450)
+++ cdrkit/trunk/genisoimage/boot-hppa.c	2006-11-23 22:11:41 UTC (rev 453)
@@ -1,203 +0,0 @@
-/*
- * This file has been modified for the cdrkit suite.
- *
- * The behaviour and appearence of the program code below can differ to a major
- * extent from the version distributed by the original author(s).
- *
- * For details, see Changelog file distributed with the cdrkit package. If you
- * received this file from another source then ask the distributing person for
- * a log of modifications.
- *
- */
-
-/*
- * Program boot-hppa.c - Handle HPPA boot extensions to iso9660.
- *
- * Written by Steve McIntyre <steve at einval.com> June 2004.
- *
- * Heavily inspired by palo:
- *
- ****************************************************************************
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) Hewlett-Packard (Paul Bame) paul_bame at hp.com
- *
- ****************************************************************************
- * Copyright 2004 Steve McIntyre
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <mconfig.h>
-#include "mkisoimage.h"
-#include <fctldefs.h>
-#include <utypes.h>
-#include <intcvt.h>
-#include "match.h"
-#include "diskmbr.h"
-#include "bootinfo.h"
-#include <schily.h>
-#include "endianconv.h"
-
-int     add_boot_hppa_cmdline(char *cmdline);
-int     add_boot_hppa_kernel_32(char *filename);
-int     add_boot_hppa_kernel_64(char *filename);
-int     add_boot_hppa_bootloader(char *filename);
-int     add_boot_hppa_ramdisk(char *filename);
-
-static  int     boot_hppa_write(FILE *outfile);
-
-static  char   *hppa_cmdline = NULL;
-static  char   *hppa_kernel_32 = NULL;
-static  char   *hppa_kernel_64 = NULL;
-static  char   *hppa_bootloader = NULL;
-static  char   *hppa_ramdisk = NULL;
-
-/* Simple function: store the filename to be used later when we need
-   to find the boot file */
-extern int add_boot_hppa_cmdline(char *cmdline)
-{
-    char *ptr = NULL;
-    hppa_cmdline = strdup(cmdline);
-    ptr = hppa_cmdline;
-    while (*ptr)
-    {
-        if (',' == *ptr)
-            *ptr = ' ';
-        ptr++;
-    }    
-    return 0;
-}
-
-/* Simple function: store the filename to be used later when we need
-   to find the boot file */
-extern int add_boot_hppa_kernel_32(char *filename)
-{
-    hppa_kernel_32 = filename;
-    return 0;
-}
-
-/* Simple function: store the filename to be used later when we need
-   to find the boot file */
-extern int add_boot_hppa_kernel_64(char *filename)
-{
-    hppa_kernel_64 = filename;
-    return 0;
-}
-
-/* Simple function: store the filename to be used later when we need
-   to find the boot file */
-extern int add_boot_hppa_bootloader(char *filename)
-{
-    hppa_bootloader = filename;
-    return 0;
-}
-
-/* Simple function: store the filename to be used later when we need
-   to find the boot file */
-extern int add_boot_hppa_ramdisk(char *filename)
-{
-    hppa_ramdisk = filename;
-    return 0;
-}
-
-static void exit_fatal(char *type, char *filename)
-{
-#ifdef	USE_LIBSCHILY
-    comerrno(EX_BAD, "Uh oh, I can't find the %s '%s'!\n",
-             type, filename);
-#else
-    fprintf(stderr, "Uh oh, I can't find the %s '%s'!\n",
-             type, filename);
-    exit(1);
-#endif
-}
-
-static int boot_hppa_write(FILE *outfile)
-{
-    unsigned char boot_sector[2048]; /* One (ISO) sector */
-	struct directory_entry	*boot_file;	/* Boot file we need to search for */
-    unsigned long length = 0;
-    unsigned long extent = 0;
-    int i = 0;
-
-    memset(boot_sector, 0, sizeof(boot_sector));    
-
-    boot_sector[0] = 0x80;  /* magic */
-    boot_sector[1] = 0x00;  /* magic */
-    boot_sector[2] = 'P';
-    boot_sector[3] = 'A';
-    boot_sector[4] = 'L';
-    boot_sector[5] = 'O';
-    boot_sector[6] = 0x00;
-    boot_sector[7] = 0x04;  /* version */
-
-    /* Find the dir entry for the 32-bit kernel by walking our file list */
-    boot_file = search_tree_file(root, hppa_kernel_32);
-    if (!boot_file)
-        exit_fatal("HPPA 32-bit kernel", hppa_kernel_32);
-    extent = 2048 * get_733(boot_file->isorec.extent);
-    length = get_733(boot_file->isorec.size);
-    fprintf(stderr, "Found hppa 32-bit kernel %s: using extent %lu (0x%lX), size %lu (0x%lX)\n",
-            hppa_kernel_32, extent, extent, length, length);
-    write_be32(extent, &boot_sector[8]);
-    write_be32(length, &boot_sector[12]);
-
-    /* Find the dir entry for the ramdisk by walking our file list */
-    boot_file = search_tree_file(root, hppa_ramdisk);
-    if (!boot_file)
-        exit_fatal("HPPA ramdisk", hppa_ramdisk);
-    extent = 2048 * get_733(boot_file->isorec.extent);
-    length = get_733(boot_file->isorec.size);
-    fprintf(stderr, "Found hppa ramdisk %s: using extent %lu (0x%lX), size %lu (0x%lX)\n",
-            hppa_ramdisk, extent, extent, length, length);
-    write_be32(extent, &boot_sector[16]);
-    write_be32(length, &boot_sector[20]);
-
-    /* Now the commandline */
-    snprintf(&boot_sector[24], 127, "%s", hppa_cmdline);
-
-    /* Find the dir entry for the 64-bit kernel by walking our file list */
-    boot_file = search_tree_file(root, hppa_kernel_64);
-    if (!boot_file)
-        exit_fatal("HPPA 64-bit kernel", hppa_kernel_64);
-    extent = 2048 * get_733(boot_file->isorec.extent);
-    length = get_733(boot_file->isorec.size);
-    fprintf(stderr, "Found hppa 64-bit kernel %s: using extent %lu (0x%lX), size %lu (0x%lX)\n",
-            hppa_kernel_64, extent, extent, length, length);
-    write_be32(extent, &boot_sector[232]);
-    write_be32(length, &boot_sector[236]);
-
-    /* Find the dir entry for the IPL by walking our file list */
-    boot_file = search_tree_file(root, hppa_bootloader);
-    if (!boot_file)
-        exit_fatal("HPPA bootloader", hppa_bootloader);
-    extent = 2048 * get_733(boot_file->isorec.extent);
-    length = get_733(boot_file->isorec.size);
-    fprintf(stderr, "Found hppa bootloader %s: using extent %lu (0x%lX), size %lu (0x%lX)\n",
-            hppa_bootloader, extent, extent, length, length);
-    write_be32(extent, &boot_sector[240]);
-    write_be32(length, &boot_sector[244]);
-
-    jtwrite(boot_sector, sizeof(boot_sector), 1, 0, FALSE);
-    xfwrite(boot_sector, sizeof(boot_sector), 1, outfile, 0, FALSE);
-    last_extent_written++;
-
-    return 0;
-}
-
-struct output_fragment hppaboot_desc = {NULL, oneblock_size, NULL, boot_hppa_write, "hppa boot block"};

Copied: cdrkit/trunk/genisoimage/boot-hppa.c (from rev 452, cdrkit/trunk/mkisoimage/boot-hppa.c)

Deleted: cdrkit/trunk/genisoimage/boot-mips.c
===================================================================
--- cdrkit/trunk/mkisoimage/boot-mips.c	2006-11-23 21:37:32 UTC (rev 450)
+++ cdrkit/trunk/genisoimage/boot-mips.c	2006-11-23 22:11:41 UTC (rev 453)
@@ -1,341 +0,0 @@
-/*
- * This file has been modified for the cdrkit suite.
- *
- * The behaviour and appearence of the program code below can differ to a major
- * extent from the version distributed by the original author(s).
- *
- * For details, see Changelog file distributed with the cdrkit package. If you
- * received this file from another source then ask the distributing person for
- * a log of modifications.
- *
- */
-
-/*
- * Program boot-mips.c - Handle big-endian boot extensions to iso9660.
- *
- * Written by Steve McIntyre <steve at einval.com> June 2004
- *
- * Heavily inspired by / borrowed from genisovh:
- *
- * Copyright: (C) 2002 by Florian Lohoff <flo at rfc822.org>
- *            (C) 2004 by Thiemo Seufer <seufer at csv.ica.uni-stuttgart.de>
- *
- * This program is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, Version 2, as published by the
- * Free Software Foundation.
- *
- * Format for volume header information
- *
- * The volume header is a block located at the beginning of all disk
- * media (sector 0).  It contains information pertaining to physical
- * device parameters and logical partition information.
- *
- * The volume header is manipulated by disk formatters/verifiers,
- * partition builders (e.g. fx, dvhtool, and mkfs), and disk drivers.
- *
- * Previous versions of IRIX wrote a copy of the volume header is
- * located at sector 0 of each track of cylinder 0.  These copies were
- * never used, and reduced the capacity of the volume header to hold large
- * files, so this practice was discontinued.
- * The volume header is constrained to be less than or equal to 512
- * bytes long.  A particular copy is assumed valid if no drive errors
- * are detected, the magic number is correct, and the 32 bit 2's complement
- * of the volume header is correct.  The checksum is calculated by initially
- * zeroing vh_csum, summing the entire structure and then storing the
- * 2's complement of the sum.  Thus a checksum to verify the volume header
- * should be 0.
- *
- * The error summary table, bad sector replacement table, and boot blocks are
- * located by searching the volume directory within the volume header.
- *
- * Tables are sized simply by the integral number of table records that
- * will fit in the space indicated by the directory entry.
- *
- * The amount of space allocated to the volume header, replacement blocks,
- * and other tables is user defined when the device is formatted.
- */
-
-#include <inttypes.h>
-#ifndef MIN
-#define MIN(a,b) ( (a<b) ? a : b )
-#endif
-
-/*
- * device parameters are in the volume header to determine mapping
- * from logical block numbers to physical device addresses
- *
- * Linux doesn't care ...
- */
-struct device_parameters {
-	uint8_t dp_skew;	/* spiral addressing skew */
-	uint8_t dp_gap1;	/* words of 0 before header */
-	uint8_t dp_gap2;	/* words of 0 between hdr and data */
-	uint8_t dp_spares_cyl;	/* This is for drives (such as SCSI
-		that support zone oriented sparing, where the zone is larger
-		than one track.  It gets subracteded from the cylinder size
-		( dp_trks0 * dp_sec) when doing partition size calculations */
-	uint16_t dp_cyls;	/* number of usable cylinders (i.e.,
-		doesn't include cylinders reserved by the drive for badblocks,
-		etc.). For drives with variable geometry, this number may be
-		decreased so that:
-		dp_cyls * ((dp_heads * dp_trks0) - dp_spares_cyl) <= actualcapacity
-		This happens on SCSI drives such as the Wren IV and Toshiba 156
-		Also see dp_cylshi below */
-	uint16_t dp_shd0;	/* starting head vol 0 */
-	uint16_t dp_trks0;	/* number of tracks / cylinder vol 0*/
-	uint8_t dp_ctq_depth;	/* Depth of CTQ queue */
-	uint8_t dp_cylshi;	/* high byte of 24 bits of cylinder count */
-	uint16_t dp_unused;	/* not used */
-	uint16_t dp_secs;	/* number of sectors/track */
-	uint16_t dp_secbytes;	/* length of sector in bytes */
-	uint16_t dp_interleave;	/* sector interleave */
-	int32_t dp_flags;		/* controller characteristics */
-	int32_t dp_datarate;		/* bytes/sec for kernel stats */
-	int32_t dp_nretries;		/* max num retries on data error */
-	int32_t dp_mspw;		/* ms per word to xfer, for iostat */
-	uint16_t dp_xgap1;	/* Gap 1 for xylogics controllers */
-	uint16_t dp_xsync;    /* sync delay for xylogics controllers */
-	uint16_t dp_xrdly;    /* read delay for xylogics controllers */
-	uint16_t dp_xgap2;    /* gap 2 for xylogics controllers */
-	uint16_t dp_xrgate;   /* read gate for xylogics controllers */
-	uint16_t dp_xwcont;   /* write continuation for xylogics */
-};
-
-/*
- * Device characterization flags
- * (dp_flags)
- */
-#define	DP_SECTSLIP	0x00000001	/* sector slip to spare sector */
-#define	DP_SECTFWD	0x00000002	/* forward to replacement sector */
-#define	DP_TRKFWD	0x00000004	/* forward to replacement track */
-#define	DP_MULTIVOL	0x00000008	/* multiple volumes per spindle */
-#define	DP_IGNOREERRORS	0x00000010	/* transfer data regardless of errors */
-#define DP_RESEEK	0x00000020	/* recalibrate as last resort */
-#define	DP_CTQ_EN	0x00000040	/* enable command tag queueing */
-
-/*
- * Boot blocks, bad sector tables, and the error summary table, are located
- * via the volume_directory.
- */
-#define VDNAMESIZE	8
-
-struct volume_directory {
-	int8_t  vd_name[VDNAMESIZE];	/* name */
-	int32_t vd_lbn;			/* logical block number */
-	int32_t vd_nbytes;		/* file length in bytes */
-};
-
-/*
- * partition table describes logical device partitions
- * (device drivers examine this to determine mapping from logical units
- * to cylinder groups, device formatters/verifiers examine this to determine
- * location of replacement tracks/sectors, etc)
- *
- * NOTE: pt_firstlbn SHOULD BE CYLINDER ALIGNED
- */
-struct partition_table {		/* one per logical partition */
-	int32_t pt_nblks;		/* # of logical blks in partition */
-	int32_t pt_firstlbn;		/* first lbn of partition */
-	int32_t pt_type;		/* use of partition */
-};
-
-#define	PTYPE_VOLHDR	0		/* partition is volume header */
-#define	PTYPE_TRKREPL	1		/* partition is used for repl trks */
-#define	PTYPE_SECREPL	2		/* partition is used for repl secs */
-#define	PTYPE_RAW	3		/* partition is used for data */
-#define	PTYPE_BSD42	4		/* partition is 4.2BSD file system */
-#define	PTYPE_BSD	4		/* partition is 4.2BSD file system */
-#define	PTYPE_SYSV	5		/* partition is SysV file system */
-#define	PTYPE_VOLUME	6		/* partition is entire volume */
-#define	PTYPE_EFS	7		/* partition is sgi EFS */
-#define	PTYPE_LVOL	8		/* partition is part of a logical vol */
-#define	PTYPE_RLVOL	9		/* part of a "raw" logical vol */
-#define	PTYPE_XFS	10		/* partition is sgi XFS */
-#define	PTYPE_XFSLOG	11		/* partition is sgi XFS log */
-#define	PTYPE_XLV	12		/* partition is part of an XLV vol */
-#define	PTYPE_XVM	13		/* partition is sgi XVM */
-#define	PTYPE_LSWAP	0x82		/* partition is Linux swap */
-#define	PTYPE_LINUX	0x83		/* partition is Linux native */
-#define NPTYPES		16
-
-#define	VHMAGIC		0xbe5a941	/* randomly chosen value */
-#define	NPARTAB		16		/* 16 unix partitions */
-#define	NVDIR		15		/* max of 15 directory entries */
-#define BFNAMESIZE	16		/* max 16 chars in boot file name */
-
-/* Partition types for ARCS */
-#define NOT_USED        0       /* Not used 				*/
-#define FAT_SHORT       1       /* FAT filesystem, 12-bit FAT entries 	*/
-#define FAT_LONG        4       /* FAT filesystem, 16-bit FAT entries 	*/
-#define EXTENDED        5       /* extended partition 			*/
-#define HUGE            6       /* huge partition- MS/DOS 4.0 and later */
-
-/* Active flags for ARCS */
-#define BOOTABLE        0x00;
-#define NOT_BOOTABLE    0x80;
-
-struct volume_header {
-	int32_t vh_magic; /* identifies volume header */
-	int16_t vh_rootpt; /* root partition number */
-	int16_t vh_swappt; /* swap partition number */
-	int8_t vh_bootfile[BFNAMESIZE]; /* name of file to boot */
-	struct device_parameters vh_dp; /* device parameters */
-	struct volume_directory vh_vd[NVDIR]; /* other vol hdr contents */
-	struct partition_table vh_pt[NPARTAB]; /* device partition layout */
-	int32_t vh_csum; /* volume header checksum */
-	int32_t vh_fill; /* fill out to 512 bytes */
-    char pad[1536];  /* pad out to 2048 */
-};
-
-#include <mconfig.h>
-#include "mkisoimage.h"
-#include <fctldefs.h>
-#include <utypes.h>
-#include <intcvt.h>
-#include "match.h"
-#include "diskmbr.h"
-#include "bootinfo.h"
-#include <schily.h>
-#include "endianconv.h"
-
-int     add_boot_mips_filename(char *filename);
-
-static  int     boot_mips_write(FILE *outfile);
-
-#define MAX_NAMES 15
-static char *boot_mips_filename[MAX_NAMES] =
-{
-    NULL, NULL, NULL,
-    NULL, NULL, NULL,
-    NULL, NULL, NULL,
-    NULL, NULL, NULL,
-    NULL, NULL, NULL
-};
-
-static int boot_mips_num_files = 0;
-
-#define SECTORS_PER_TRACK	32
-#define BYTES_PER_SECTOR	512
-
-int add_boot_mips_filename(char *filename)
-{
-    if (boot_mips_num_files < MAX_NAMES)
-    {
-        boot_mips_filename[boot_mips_num_files] = filename;
-        boot_mips_num_files++;
-    }
-
-    else
-    {
-#ifdef	USE_LIBSCHILY
-        comerrno(EX_BAD, "Too many MIPS boot files!\n");
-#else
-        fprintf(stderr, "Too many MIPS boot files!\n");
-        exit(1);
-#endif
-    }
-    return 0;
-}
-
-static void vh_calc_checksum(struct volume_header *vh)
-{
-	uint32_t newsum = 0;
-	unsigned char *buffer = (unsigned char *)vh;
-	unsigned int i;
-
-	vh->vh_csum = 0;
-
-	for(i = 0; i < sizeof(struct volume_header); i += 4)
-        newsum -= read_be32(&buffer[i]);
-
-    write_be32(newsum, (unsigned char *)&vh->vh_csum);
-}
-
-static char *file_base_name(char *path)
-{
-    char *endptr = path;
-    char *ptr = path;
-    
-    while (*ptr != '\0')
-    {
-        if ('/' == *ptr)
-            endptr = ++ptr;
-        else
-            ++ptr;
-    }
-    return endptr;
-}
-
-static int boot_mips_write(FILE *outfile)
-{
-	struct directory_entry	*boot_file;	/* Boot file we need to search for */
-    unsigned long length = 0;
-    unsigned long extent = 0;
-	int i;
-	struct volume_header vh;
-    unsigned long long iso_size = 0;
-    char *filename = NULL;
-
-	memset(&vh, 0, sizeof(vh));
-
-    iso_size = last_extent * 2048;
-
-    write_be32(VHMAGIC, (unsigned char *)&vh.vh_magic);
-
-	/* Values from an IRIX cd */
-    write_be16(BYTES_PER_SECTOR, (unsigned char *)&vh.vh_dp.dp_secbytes);
-    write_be16(SECTORS_PER_TRACK, (unsigned char *)&vh.vh_dp.dp_secs);
-    write_be32(DP_RESEEK|DP_IGNOREERRORS|DP_TRKFWD, (unsigned char *)&vh.vh_dp.dp_flags);
-    write_be16(1, (unsigned char *)&vh.vh_dp.dp_trks0);
-
-    write_be16((iso_size + BYTES_PER_SECTOR - 1) / (SECTORS_PER_TRACK * BYTES_PER_SECTOR),
-               (unsigned char *)&vh.vh_dp.dp_cyls);
-
-	for(i = 0; i < boot_mips_num_files; i++)
-    {
-        boot_file = search_tree_file(root, boot_mips_filename[i]);
-        
-        if (!boot_file) {
-#ifdef	USE_LIBSCHILY
-            comerrno(EX_BAD, "Uh oh, I cant find the MIPS boot file '%s'!\n",
-                     boot_mips_filename[i]);
-#else
-            fprintf(stderr, "Uh oh, I cant find the MIPS boot file '%s'!\n",
-                    boot_mips_filename[i]);
-            exit(1);
-#endif
-        }
-
-        extent = get_733(boot_file->isorec.extent) * 4;
-        length = ((get_733(boot_file->isorec.size) + 2047) / 2048) * 2048;
-        filename = file_base_name(boot_mips_filename[i]);
-
-        strncpy(vh.vh_vd[i].vd_name, filename, MIN(VDNAMESIZE, strlen(filename)));
-        write_be32(extent, (unsigned char *)&vh.vh_vd[i].vd_lbn);
-        write_be32(length, (unsigned char *)&vh.vh_vd[i].vd_nbytes);
-        
-        fprintf(stderr, "Found mips boot image %s, using extent %lu (0x%lX), #blocks %lu (0x%lX)\n",
-                filename, extent, extent, length, length);
-	}
-
-	/* Create volume partition on whole cd iso */
-    write_be32((iso_size + (BYTES_PER_SECTOR - 1))/ BYTES_PER_SECTOR, (unsigned char *)&vh.vh_pt[10].pt_nblks);
-    write_be32(0, (unsigned char *)&vh.vh_pt[10].pt_firstlbn);
-    write_be32(PTYPE_VOLUME, (unsigned char *)&vh.vh_pt[10].pt_type);
-
-	/* Create volume header partition, also on WHOLE cd iso */
-    write_be32((iso_size + (BYTES_PER_SECTOR - 1))/ BYTES_PER_SECTOR, (unsigned char *)&vh.vh_pt[8].pt_nblks);
-    write_be32(0, (unsigned char *)&vh.vh_pt[8].pt_firstlbn);
-    write_be32(PTYPE_VOLHDR, (unsigned char *)&vh.vh_pt[8].pt_type);
-
-	/* Create checksum */
-	vh_calc_checksum(&vh);
-
-    jtwrite(&vh, sizeof(vh), 1, 0, FALSE);
-    xfwrite(&vh, sizeof(vh), 1, outfile, 0, FALSE);
-    last_extent_written++;
-
-	return 0;
-}
-
-struct output_fragment mipsboot_desc = {NULL, oneblock_size, NULL, boot_mips_write, "MIPS boot block"};

Copied: cdrkit/trunk/genisoimage/boot-mips.c (from rev 452, cdrkit/trunk/mkisoimage/boot-mips.c)

Deleted: cdrkit/trunk/genisoimage/boot-mipsel.c
===================================================================
--- cdrkit/trunk/mkisoimage/boot-mipsel.c	2006-11-23 21:37:32 UTC (rev 450)
+++ cdrkit/trunk/genisoimage/boot-mipsel.c	2006-11-23 22:11:41 UTC (rev 453)
@@ -1,251 +0,0 @@
-/*
- * This file has been modified for the cdrkit suite.
- *
- * The behaviour and appearence of the program code below can differ to a major
- * extent from the version distributed by the original author(s).
- *
- * For details, see Changelog file distributed with the cdrkit package. If you
- * received this file from another source then ask the distributing person for
- * a log of modifications.
- *
- */
-
-/*
- * Program boot-mipsel.c - Handle Mipsel boot extensions to iso9660.
- *
- *  Written by Steve McIntyre <steve at einval.com> (2004).
- *
- * Heavily inspired by / borrowed from delo:
- *
- * Copyright: (C) 2002 by Florian Lohoff <flo at rfc822.org>
- *            (C) 2004 by Thiemo Seufer <seufer at csv.ica.uni-stuttgart.de>
- *
- * This program is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, Version 2, as published by the
- * Free Software Foundation.
- *
- * Format for volume header information
- *
- * The volume header is a block located at the beginning of all disk
- * media (sector 0).  It contains information pertaining to physical
- * device parameters and logical partition information.
- *
- * The volume header is manipulated by disk formatters/verifiers,
- * partition builders (e.g. fx, dvhtool, and mkfs), and disk drivers.
- *
- * Previous versions of IRIX wrote a copy of the volume header is
- * located at sector 0 of each track of cylinder 0.  These copies were
- * never used, and reduced the capacity of the volume header to hold large
- * files, so this practice was discontinued.
- * The volume header is constrained to be less than or equal to 512
- * bytes long.  A particular copy is assumed valid if no drive errors
- * are detected, the magic number is correct, and the 32 bit 2's complement
- * of the volume header is correct.  The checksum is calculated by initially
- * zeroing vh_csum, summing the entire structure and then storing the
- * 2's complement of the sum.  Thus a checksum to verify the volume header
- * should be 0.
- *
- * The error summary table, bad sector replacement table, and boot blocks are
- * located by searching the volume directory within the volume header.
- *
- * Tables are sized simply by the integral number of table records that
- * will fit in the space indicated by the directory entry.
- *
- * The amount of space allocated to the volume header, replacement blocks,
- * and other tables is user defined when the device is formatted.
- */
-
-#include <mconfig.h>
-#include "mkisoimage.h"
-#include <fctldefs.h>
-#include <utypes.h>
-#include <intcvt.h>
-#include "match.h"
-#include "diskmbr.h"
-#include "bootinfo.h"
-#include <schily.h>
-#include "endianconv.h"
-#include <errno.h>
-#include <glibc_elf.h>
-
-int             add_boot_mipsel_filename(char *filename);
-static  int     boot_mipsel_write(FILE *outfile);
-
-static  char   *boot_file_name = NULL;
-
-#define MAX_MAPS        51
-#define DEC_BOOT_MAGIC  0x02757a
-#define HD_SECTOR_SIZE  512
-
-/* Those were stolen from linux kernel headers. */
-
-struct extent {
-    uint32_t count;
-    uint32_t start;
-} __attribute__((packed));
-
-struct dec_bootblock {
-    int8_t pad[8];
-    int32_t magic;          /* We are a DEC BootBlock */
-    int32_t mode;           /* 0: Single extent, 1: Multi extent boot */
-    int32_t loadAddr;       /* Load below kernel */
-    int32_t execAddr;       /* And exec there */
-    struct extent bootmap[MAX_MAPS];
-} __attribute__((packed));
-
-static void swap_in_elf32_ehdr(Elf32_Ehdr *ehdr)
-{
-    ehdr->e_type = read_le16((unsigned char *)&ehdr->e_type);
-    ehdr->e_machine = read_le16((unsigned char *)&ehdr->e_machine);
-    ehdr->e_version = read_le32((unsigned char *)&ehdr->e_version);
-    ehdr->e_entry = read_le32((unsigned char *)&ehdr->e_entry);
-    ehdr->e_phoff = read_le32((unsigned char *)&ehdr->e_phoff);
-    ehdr->e_shoff = read_le32((unsigned char *)&ehdr->e_shoff);
-    ehdr->e_flags = read_le32((unsigned char *)&ehdr->e_flags);
-    ehdr->e_ehsize = read_le16((unsigned char *)&ehdr->e_ehsize);
-    ehdr->e_phentsize = read_le16((unsigned char *)&ehdr->e_phentsize);
-    ehdr->e_phnum = read_le16((unsigned char *)&ehdr->e_phnum);
-    ehdr->e_shentsize = read_le16((unsigned char *)&ehdr->e_shentsize);
-    ehdr->e_shnum = read_le16((unsigned char *)&ehdr->e_shnum);
-    ehdr->e_shstrndx = read_le16((unsigned char *)&ehdr->e_shstrndx);
-}
-
-static void swap_in_elf32_phdr(Elf32_Phdr *phdr)
-{
-    phdr->p_type = read_le32((unsigned char *)&phdr->p_type);
-    phdr->p_offset = read_le32((unsigned char *)&phdr->p_offset);
-    phdr->p_vaddr = read_le32((unsigned char *)&phdr->p_vaddr);
-    phdr->p_paddr = read_le32((unsigned char *)&phdr->p_paddr);
-    phdr->p_filesz = read_le32((unsigned char *)&phdr->p_filesz);
-    phdr->p_memsz = read_le32((unsigned char *)&phdr->p_memsz);
-    phdr->p_flags = read_le32((unsigned char *)&phdr->p_flags);
-    phdr->p_align = read_le32((unsigned char *)&phdr->p_align);
-}
-
-/* Simple function: store the filename to be used later when we need
-   to find the boot file */
-extern int add_boot_mipsel_filename(char *filename)
-{
-    boot_file_name = filename;
-    return 0;
-}
-
-/* Parse the ELF header of the boot loaded to work out the load
-   address and exec address */
-static int parse_boot_file(char *filename, int32_t *loadaddr, int32_t *execaddr, int32_t *offset, int32_t *count)
-{
-    int error = 0;
-    FILE *loader = NULL;
-    Elf32_Ehdr ehdr;
-    Elf32_Phdr phdr;
-    
-    loader = fopen(filename, "rb");
-    if (!loader)
-        return errno;
-    
-    error = fread(&ehdr, sizeof(ehdr), 1, loader);
-    if (1 != error)
-        return EIO;
-
-    swap_in_elf32_ehdr(&ehdr);
-    if (!(ehdr.e_ident[EI_MAG0] == ELFMAG0
-          && ehdr.e_ident[EI_MAG1] == ELFMAG1
-          && ehdr.e_ident[EI_MAG2] == ELFMAG2
-          && ehdr.e_ident[EI_MAG3] == ELFMAG3
-          && ehdr.e_ident[EI_CLASS] == ELFCLASS32
-          && ehdr.e_ident[EI_DATA] == ELFDATA2LSB
-          && ehdr.e_ident[EI_VERSION] == EV_CURRENT
-          && ehdr.e_type == ET_EXEC
-          && ehdr.e_machine == EM_MIPS
-          && ehdr.e_version == EV_CURRENT))
-    {
-        fprintf(stderr, "Sorry, %s is not a MIPS ELF32 little endian file", filename);        
-        return EINVAL;
-    }
-    if (ehdr.e_phnum != 1)
-    {
-        fprintf(stderr, "Sorry, %s has more than one ELF segment", filename);
-        return EINVAL;
-    }
-    fseek(loader, ehdr.e_phoff, SEEK_SET);
-    error = fread(&phdr, sizeof(phdr), 1, loader);
-    if (1 != error)
-        return EIO;
-
-    *loadaddr = phdr.p_vaddr;
-    *execaddr = ehdr.e_entry;
-	*offset = (phdr.p_offset + HD_SECTOR_SIZE - 1) / HD_SECTOR_SIZE;
-	*count = (phdr.p_filesz + HD_SECTOR_SIZE - 1) / HD_SECTOR_SIZE;
-
-    fprintf(stderr, "Parsed mipsel boot image %s: using loadaddr 0x%X, execaddr 0x%X, offset 0x%X, count 0x%X\n",
-            filename, *loadaddr, *execaddr, *offset, *count);
-
-    fclose(loader);
-    return 0;
-}
-
-static int boot_mipsel_write(FILE *outfile)
-{
-    char sector[2048];
-    struct dec_bootblock *bb = (struct dec_bootblock *)sector;
-    int error = 0;
-    int offset = 0;
-    int count = 0;
-    struct directory_entry	*boot_file;	/* Boot file we need to search for in the image */
-    unsigned long length = 0;
-    unsigned long extent = 0;
-    int loadaddr = 0;
-    int execaddr = 0;
-
-    memset(sector, 0, sizeof(sector));
-
-    /* Fill in our values we care on */
-    write_le32(DEC_BOOT_MAGIC, (unsigned char *)&bb->magic);
-    write_le32(1, (unsigned char *)&bb->mode);
-
-    /* Find the file entry in the CD image */
-    boot_file = search_tree_file(root, boot_file_name);
-    if (!boot_file)
-    {
-#ifdef	USE_LIBSCHILY
-		comerrno(EX_BAD, "Uh oh, unable to find the mipsel boot file '%s'!\n",
-                 boot_file_name);
-#else
-		fprintf(stderr, "Uh oh, unable to find the mipsel boot file '%s'!\n",
-                boot_file_name);
-		exit(1);
-#endif
-    }
-
-    extent = get_733(boot_file->isorec.extent);
-    length = get_733(boot_file->isorec.size);
-    fprintf(stderr, "Found mipsel boot loader %s: using extent %lu, #blocks %lu\n",
-            boot_file_name, extent, length);
-
-    /* Parse the ELF headers on the boot file */
-    error = parse_boot_file(boot_file->whole_name, &loadaddr, &execaddr, &offset, &count);
-    if (error)
-    {
-#ifdef	USE_LIBSCHILY
-		comerrno(EX_BAD, "Uh oh, unable to parse the mipsel boot file '%s'!\n",
-                 boot_file->whole_name);
-#else
-		fprintf(stderr, "Uh oh, unable to parse the mipsel boot file '%s'!\n",
-                boot_file->whole_name);
-		exit(1);
-#endif
-    }
-
-    write_le32(loadaddr, (unsigned char *)&bb->loadAddr);
-    write_le32(execaddr, (unsigned char *)&bb->execAddr);
-    write_le32((extent * 4) + offset, (unsigned char *)&bb->bootmap[0].start);
-    write_le32(count, (unsigned char *)&bb->bootmap[0].count);
-    
-    jtwrite(sector, sizeof(sector), 1, 0, FALSE);
-    xfwrite(sector, sizeof(sector), 1, outfile, 0, FALSE);
-    last_extent_written++;
-
-    return 0;
-}
-
-struct output_fragment mipselboot_desc = {NULL, oneblock_size, NULL, boot_mipsel_write, "mipsel boot block"};

Copied: cdrkit/trunk/genisoimage/boot-mipsel.c (from rev 452, cdrkit/trunk/mkisoimage/boot-mipsel.c)

Deleted: cdrkit/trunk/genisoimage/boot.c
===================================================================
--- cdrkit/trunk/mkisoimage/boot.c	2006-11-23 21:37:32 UTC (rev 450)
+++ cdrkit/trunk/genisoimage/boot.c	2006-11-23 22:11:41 UTC (rev 453)
@@ -1,541 +0,0 @@
-/*
- * This file has been modified for the cdrkit suite.
- *
- * The behaviour and appearence of the program code below can differ to a major
- * extent from the version distributed by the original author(s).
- *
- * For details, see Changelog file distributed with the cdrkit package. If you
- * received this file from another source then ask the distributing person for
- * a log of modifications.
- *
- */
-
-/* @(#)boot.c	1.13 04/02/22 Copyright 1999-2003 J. Schilling */
-#ifndef lint
-static	char sccsid[] =
-	"@(#)boot.c	1.13 04/02/22 Copyright 1999-2003 J. Schilling";
-#endif
-/*
- *	Support for generic boot (sector 0..16)
- *	and to boot Sun sparc and Sun x86 systems.
- *
- *	Copyright (c) 1999-2003 J. Schilling
- */
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; see the file COPYING.  If not, write to the Free Software
- * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#include <mconfig.h>
-#include "mkisoimage.h"
-#include <fctldefs.h>
-#include <utypes.h>
-#include <intcvt.h>
-#include <schily.h>
-#include "sunlabel.h"
-
-extern	int	use_sunx86boot;
-
-static struct sun_label cd_label;
-static struct x86_label sx86_label;
-static struct pc_part	fdisk_part;
-static char	*boot_files[NDKMAP];	/* Change this for > 8 x86 parts */
-
-static	void	init_sparc_label(void);
-static	void	init_sunx86_label(void);
-void	sparc_boot_label(char *label);
-void	sunx86_boot_label(char *label);
-void	scan_sparc_boot(char *files);
-void	scan_sunx86_boot(char *files);
-int	make_sun_label(void);
-int	make_sunx86_label(void);
-static	void	dup_sun_label(int part);
-static	int	sunboot_write(FILE *outfile);
-static	int	sunlabel_size(int starting_extent);
-static	int	sunlabel_write(FILE * outfile);
-static	int	genboot_size(int starting_extent);
-static	int	genboot_write(FILE * outfile);
-
-/*
- * Set the virtual geometry in the disk label.
- * If we like to make the geometry variable, we may change
- * dkl_ncyl and dkl_pcyl later.
- */
-static void
-init_sparc_label()
-{
-	i_to_4_byte(cd_label.dkl_vtoc.v_version, V_VERSION);
-	i_to_2_byte(cd_label.dkl_vtoc.v_nparts, NDKMAP);
-	i_to_4_byte(cd_label.dkl_vtoc.v_sanity, VTOC_SANE);
-
-	i_to_2_byte(cd_label.dkl_rpm, CD_RPM);
-	i_to_2_byte(cd_label.dkl_pcyl, CD_PCYL);
-	i_to_2_byte(cd_label.dkl_apc, CD_APC);
-	i_to_2_byte(cd_label.dkl_intrlv, CD_INTRLV);
-	i_to_2_byte(cd_label.dkl_ncyl, CD_NCYL);
-	i_to_2_byte(cd_label.dkl_acyl, CD_ACYL);
-	i_to_2_byte(cd_label.dkl_nhead, CD_NHEAD);
-	i_to_2_byte(cd_label.dkl_nsect, CD_NSECT);
-
-	cd_label.dkl_magic[0] =	DKL_MAGIC_0;
-	cd_label.dkl_magic[1] =	DKL_MAGIC_1;
-}
-
-static void
-init_sunx86_label()
-{
-	li_to_4_byte(sx86_label.dkl_vtoc.v_sanity, VTOC_SANE);
-	li_to_4_byte(sx86_label.dkl_vtoc.v_version, V_VERSION);
-	li_to_2_byte(sx86_label.dkl_vtoc.v_sectorsz, 512);
-	li_to_2_byte(sx86_label.dkl_vtoc.v_nparts, NX86MAP);
-
-	li_to_4_byte(sx86_label.dkl_pcyl, CD_PCYL);
-	li_to_4_byte(sx86_label.dkl_ncyl, CD_NCYL);
-	li_to_2_byte(sx86_label.dkl_acyl, CD_ACYL);
-	li_to_2_byte(sx86_label.dkl_bcyl, 0);
-
-	li_to_4_byte(sx86_label.dkl_nhead, CD_NHEAD);
-	li_to_4_byte(sx86_label.dkl_nsect, CD_NSECT);
-	li_to_2_byte(sx86_label.dkl_intrlv, CD_INTRLV);
-	li_to_2_byte(sx86_label.dkl_skew, 0);
-	li_to_2_byte(sx86_label.dkl_apc, CD_APC);
-	li_to_2_byte(sx86_label.dkl_rpm, CD_RPM);
-
-	li_to_2_byte(sx86_label.dkl_write_reinstruct, 0);
-	li_to_2_byte(sx86_label.dkl_read_reinstruct, 0);
-
-	li_to_2_byte(sx86_label.dkl_magic, DKL_MAGIC);
-}
-
-/*
- * For command line parser: set ASCII label.
- */
-void
-sparc_boot_label(char *label)
-{
-	strncpy(cd_label.dkl_ascilabel, label, 127);
-	cd_label.dkl_ascilabel[127] = '\0';
-}
-
-void
-sunx86_boot_label(char *label)
-{
-	strncpy(sx86_label.dkl_vtoc.v_asciilabel, label, 127);
-	sx86_label.dkl_vtoc.v_asciilabel[127] = '\0';
-}
-
-/*
- * Parse the command line argument for boot images.
- */
-void
-scan_sparc_boot(char *files)
-{
-	char		*p;
-	int		i = 1;
-	struct stat	statbuf;
-	int		status;
-
-	init_sparc_label();
-
-	do {
-		if (i >= NDKMAP)
-			comerrno(EX_BAD, "Too many boot partitions.\n");
-		boot_files[i++] = files;
-		if ((p = strchr(files, ',')) != NULL)
-			*p++ = '\0';
-		files = p;
-	} while (p);
-
-	i_to_2_byte(cd_label.dkl_vtoc.v_part[0].p_tag,  V_USR);
-	i_to_2_byte(cd_label.dkl_vtoc.v_part[0].p_flag, V_RONLY);
-	for (i = 0; i < NDKMAP; i++) {
-		p = boot_files[i];
-		if (p == NULL || *p == '\0')
-			continue;
-		if (strcmp(p, "...") == '\0')
-			break;
-
-		status = stat_filter(p, &statbuf);
-		if (status < 0 || access(p, R_OK) < 0)
-			comerr("Cannot access '%s'.\n", p);
-
-		i_to_4_byte(cd_label.dkl_map[i].dkl_nblk,
-			roundup(statbuf.st_size, CD_CYLSIZE)/512);
-
-		i_to_2_byte(cd_label.dkl_vtoc.v_part[i].p_tag,  V_ROOT);
-		i_to_2_byte(cd_label.dkl_vtoc.v_part[i].p_flag, V_RONLY);
-	}
-}
-
-void
-scan_sunx86_boot(char *files)
-{
-	char		*p;
-	int		i = 0;
-	struct stat	statbuf;
-	int		status;
-
-	init_sunx86_label();
-
-	do {
-		if (i >= NDKMAP)
-			comerrno(EX_BAD, "Too many boot partitions.\n");
-		boot_files[i++] = files;
-		if ((p = strchr(files, ',')) != NULL)
-			*p++ = '\0';
-		files = p;
-	} while (p);
-
-	li_to_2_byte(sx86_label.dkl_vtoc.v_part[0].p_tag,  V_ROOT);  /* UFS */
-	li_to_2_byte(sx86_label.dkl_vtoc.v_part[0].p_flag, V_RONLY);
-	li_to_2_byte(sx86_label.dkl_vtoc.v_part[1].p_tag,  V_USR);   /* ISO */
-	li_to_2_byte(sx86_label.dkl_vtoc.v_part[1].p_flag, V_RONLY);
-	li_to_2_byte(sx86_label.dkl_vtoc.v_part[2].p_tag,  0);	    /* ALL */
-	li_to_2_byte(sx86_label.dkl_vtoc.v_part[2].p_flag, 0);
-	for (i = 0; i < NDKMAP; i++) {
-		p = boot_files[i];
-		if (p == NULL || *p == '\0')
-			continue;
-		if (i == 1 || i == 2) {
-			comerrno(EX_BAD,
-			"Partition %d may not have a filename.\n", i);
-		}
-
-		status = stat_filter(p, &statbuf);
-		if (status < 0 || access(p, R_OK) < 0)
-			comerr("Cannot access '%s'.\n", p);
-
-		li_to_4_byte(sx86_label.dkl_vtoc.v_part[i].p_size,
-			roundup(statbuf.st_size, CD_CYLSIZE)/512);
-
-		if (i > 2) {
-			li_to_2_byte(sx86_label.dkl_vtoc.v_part[i].p_tag,  V_USR);
-			li_to_2_byte(sx86_label.dkl_vtoc.v_part[i].p_flag, V_RONLY);
-		}
-	}
-}
-
-/*
- * Finish the Sun disk label and compute the size of the additional data.
- */
-int
-make_sun_label()
-{
-	int	last;
-	int	cyl = 0;
-	int	nblk;
-	int	bsize;
-	int	i;
-	char	*p;
-
-	/*
-	 * Compute the size of the padding for the iso9660 image
-	 * to allow the next partition to start on a cylinder boundary.
-	 */
-	last = roundup(last_extent, (CD_CYLSIZE/SECTOR_SIZE));
-
-	i_to_4_byte(cd_label.dkl_map[0].dkl_nblk, last*4);
-	bsize = 0;
-	for (i = 0; i < NDKMAP; i++) {
-		p = boot_files[i];
-		if (p != NULL && strcmp(p, "...") == '\0') {
-			dup_sun_label(i);
-			break;
-		}
-		if ((nblk = a_to_4_byte(cd_label.dkl_map[i].dkl_nblk)) == 0)
-			continue;
-
-		i_to_4_byte(cd_label.dkl_map[i].dkl_cylno, cyl);
-		cyl += nblk / (CD_CYLSIZE/512);
-		if (i > 0)
-			bsize += nblk;
-	}
-	bsize /= 4;
-	return (last-last_extent+bsize);
-}
-
-/*
- * A typical Solaris boot/install CD from a Sun CD set looks
- * this way:
- *
- * UFS	Part 0 tag 2 flag 10 start 3839 size 1314560
- * ISO	Part 1 tag 4 flag 10 start    0 size    3839
- * ALL	Part 2 tag 0 flag  0 start    0 size 1318400
- */
-int
-make_sunx86_label()
-{
-	int	last;
-	int	cyl = 0;
-	int	nblk;
-	int	bsize;
-	int	i;
-	int	partoff = 1;	/* The offset of the Solaris 0x82 partition */
-	char	*p;
-
-	/*
-	 * Compute the size of the padding for the iso9660 image
-	 * to allow the next partition to start on a cylinder boundary.
-	 */
-	last = roundup(last_extent, (CD_CYLSIZE/SECTOR_SIZE));
-
-	li_to_4_byte(sx86_label.dkl_vtoc.v_part[1].p_size, last*4);
-
-	/*
-	 * Note that the Solaris fdisk partition with fdisk signature 0x82
-	 * is created at fixed offset 1 sector == 512 Bytes by this
-	 * implementation.
-	 * We need subtract this partition offset from all absolute
-	 * partition offsets in order to get offsets relative to the
-	 * Solaris primary partition.
-	 */
-	bsize = 0;
-	for (i = 0; i < NDKMAP; i++) {
-		if (i == 2)		/* Never include the whole disk in */
-			continue;	/* size/offset computations	   */
-		p = boot_files[i];
-
-		if ((nblk = la_to_4_byte(sx86_label.dkl_vtoc.v_part[i].p_size)) == 0)
-			continue;
-
-		li_to_4_byte(sx86_label.dkl_vtoc.v_part[i].p_start,
-						cyl*(CD_CYLSIZE/512)-partoff);
-		cyl += nblk / (CD_CYLSIZE/512);
-		if (i == 0 || i > 2)
-			bsize += nblk;
-	}
-	li_to_4_byte(sx86_label.dkl_vtoc.v_part[0].p_start, last*4-partoff);
-	li_to_4_byte(sx86_label.dkl_vtoc.v_part[1].p_start, 0);
-	li_to_4_byte(sx86_label.dkl_vtoc.v_part[1].p_size, last*4-partoff);
-	li_to_4_byte(sx86_label.dkl_vtoc.v_part[2].p_start, 0);
-	li_to_4_byte(sx86_label.dkl_vtoc.v_part[2].p_size, last*4+bsize);
-
-	fdisk_part.part[0].pr_status = STATUS_ACTIVE;
-	fdisk_part.part[0].pr_type   = TYPE_SOLARIS;
-	li_to_4_byte(fdisk_part.part[0].pr_partoff, partoff);
-	li_to_4_byte(fdisk_part.part[0].pr_nsect, last*4+bsize-partoff);
-	fdisk_part.magic[0] = 0x55;
-	fdisk_part.magic[1] = 0xAA;
-
-	bsize /= 4;
-	return (last-last_extent+bsize);
-}
-
-/*
- * Duplicate a partition of the Sun disk label until all partitions are filled up.
- */
-static void
-dup_sun_label(int part)
-{
-	int	cyl;
-	int	nblk;
-	int	i;
-
-
-	if (part < 1 || part >= NDKMAP)
-		part = 1;
-	cyl = a_to_4_byte(cd_label.dkl_map[part-1].dkl_cylno);
-	nblk = a_to_4_byte(cd_label.dkl_map[part-1].dkl_nblk);
-
-	for (i = part; i < NDKMAP; i++) {
-		i_to_4_byte(cd_label.dkl_map[i].dkl_cylno, cyl);
-		i_to_4_byte(cd_label.dkl_map[i].dkl_nblk, nblk);
-
-		i_to_2_byte(cd_label.dkl_vtoc.v_part[i].p_tag,  V_ROOT);
-		i_to_2_byte(cd_label.dkl_vtoc.v_part[i].p_flag, V_RONLY);
-	}
-}
-
-/*
- * Write out Sun boot partitions.
- */
-static int
-sunboot_write(FILE *outfile)
-{
-	char	buffer[SECTOR_SIZE];
-	int	i;
-	int	n;
-	int	nblk;
-	int	amt;
-	int	f;
-	char	*p;
-
-	memset(buffer, 0, sizeof (buffer));
-
-	/*
-	 * Write padding to the iso9660 image to allow the
-	 * boot partitions to start on a cylinder boundary.
-	 */
-	amt = roundup(last_extent_written, (CD_CYLSIZE/SECTOR_SIZE)) - last_extent_written;
-	for (n = 0; n < amt; n++) {
-		jtwrite(buffer, SECTOR_SIZE, 1, 0, FALSE);
-		xfwrite(buffer, SECTOR_SIZE, 1, outfile, 0, FALSE);
-		last_extent_written++;
-	}
-	if (use_sunx86boot)
-		i = 0;
-	else
-		i = 1;
-	for (; i < NDKMAP; i++) {
-		if (use_sunx86boot && (i == 1 || i == 2))
-			continue;
-		p = boot_files[i];
-		if (p == NULL || *p == '\0')
-			continue;
-		if (p != NULL && strcmp(p, "...") == '\0')
-			break;
-		if (use_sunx86boot) {
-			if ((nblk = la_to_4_byte(sx86_label.dkl_vtoc.v_part[i].p_size)) == 0)
-				continue;
-		} else {
-			if ((nblk = a_to_4_byte(cd_label.dkl_map[i].dkl_nblk)) == 0)
-				continue;
-		}
-		if ((f = open(boot_files[i], O_RDONLY| O_BINARY)) < 0)
-			comerr("Cannot open '%s'.\n", boot_files[i]);
-
-		amt = nblk / 4;
-		for (n = 0; n < amt; n++) {
-			memset(buffer, 0, sizeof (buffer));
-			if (read(f, buffer, SECTOR_SIZE) < 0)
-				comerr("Read error on '%s'.\n", boot_files[i]);
-			jtwrite(buffer, SECTOR_SIZE, 1, 0, FALSE);
-			xfwrite(buffer, SECTOR_SIZE, 1, outfile, 0, FALSE);
-			last_extent_written++;
-		}
-		close(f);
-	}
-	fprintf(stderr, "Total extents including %s boot = %d\n",
-				use_sunx86boot ? "Solaris x86":"sparc",
-				last_extent_written - session_start);
-	return (0);
-}
-
-/*
- * Do size management for the Sun disk label that is located in the first
- * sector of a disk.
- */
-static int
-sunlabel_size(int starting_extent)
-{
-	if (last_extent != session_start)
-		comerrno(EX_BAD, "Cannot create sparc boot on offset != 0.\n");
-	last_extent++;
-	return (0);
-}
-
-/*
- * Cumpute the checksum and write a Sun disk label to the first sector
- * of the disk.
- * If the -generic-boot option has been specified too, overlay the
- * Sun disk label on the firs 512 bytes of the generic boot code.
- */
-static int
-sunlabel_write(FILE *outfile)
-{
-		char	buffer[SECTOR_SIZE];
-	register char	*p;
-	register short	count = (512/2) - 1;
-		int	f;
-
-	memset(buffer, 0, sizeof (buffer));
-	if (genboot_image) {
-		if ((f = open(genboot_image, O_RDONLY| O_BINARY)) < 0)
-			comerr("Cannot open '%s'.\n", genboot_image);
-
-		if (read(f, buffer, SECTOR_SIZE) < 0)
-			comerr("Read error on '%s'.\n", genboot_image);
-		close(f);
-	}
-
-	if (use_sunx86boot) {
-		if (sx86_label.dkl_vtoc.v_asciilabel[0] == '\0')
-			strcpy(sx86_label.dkl_vtoc.v_asciilabel, CD_X86LABEL);
-
-		p = (char *)&sx86_label;
-		sx86_label.dkl_cksum[0] = 0;
-		sx86_label.dkl_cksum[1] = 0;
-		while (count-- > 0) {
-			sx86_label.dkl_cksum[0] ^= *p++;
-			sx86_label.dkl_cksum[1] ^= *p++;
-		}
-		memcpy(&buffer[0x1BE], &fdisk_part.part, 512-0x1BE);
-		memcpy(&buffer[1024], &sx86_label, 512);
-	} else {
-		/*
-		 * If we don't already have a Sun disk label text
-		 * set up the default.
-		 */
-		if (cd_label.dkl_ascilabel[0] == '\0')
-			strcpy(cd_label.dkl_ascilabel, CD_DEFLABEL);
-
-		p = (char *)&cd_label;
-		cd_label.dkl_cksum[0] = 0;
-		cd_label.dkl_cksum[1] = 0;
-		while (count--) {
-			cd_label.dkl_cksum[0] ^= *p++;
-			cd_label.dkl_cksum[1] ^= *p++;
-		}
-		memcpy(buffer, &cd_label, 512);
-	}
-
-	jtwrite(buffer, SECTOR_SIZE, 1, 0, FALSE);
-	xfwrite(buffer, SECTOR_SIZE, 1, outfile, 0, FALSE);
-	last_extent_written++;
-	return (0);
-}
-
-/*
- * Do size management for the generic boot code on sectors 0..16.
- */
-static int
-genboot_size(int starting_extent)
-{
-	if (last_extent > (session_start + 1))
-		comerrno(EX_BAD, "Cannot create generic boot on offset != 0.\n");
-	last_extent = session_start + 16;
-	return (0);
-}
-
-/*
- * Write the generic boot code to sectors 0..16.
- * If there is a Sun disk label, start writing at sector 1.
- */
-static int
-genboot_write(FILE *outfile)
-{
-	char	buffer[SECTOR_SIZE];
-	int	i;
-	int	f;
-
-	if ((f = open(genboot_image, O_RDONLY| O_BINARY)) < 0)
-		comerr("Cannot open '%s'.\n", genboot_image);
-
-	for (i = 0; i < 16; i++) {
-		memset(buffer, 0, sizeof (buffer));
-		if (read(f, buffer, SECTOR_SIZE) < 0)
-			comerr("Read error on '%s'.\n", genboot_image);
-
-		if (i != 0 || last_extent_written == session_start) {
-			jtwrite(buffer, SECTOR_SIZE, 1, 0, FALSE);
-			xfwrite(buffer, SECTOR_SIZE, 1, outfile, 0, FALSE);
-			last_extent_written++;
-		}
-	}
-	close(f);
-	return (0);
-}
-
-struct output_fragment sunboot_desc	= {NULL, NULL,		NULL,	sunboot_write,  "Sun Boot" };
-struct output_fragment sunlabel_desc	= {NULL, sunlabel_size,	NULL,	sunlabel_write, "Sun Disk Label" };
-struct output_fragment genboot_desc	= {NULL, genboot_size,	NULL,	genboot_write,  "Generic Boot" };

Copied: cdrkit/trunk/genisoimage/boot.c (from rev 452, cdrkit/trunk/mkisoimage/boot.c)

Deleted: cdrkit/trunk/genisoimage/bootinfo.h
===================================================================
--- cdrkit/trunk/mkisoimage/bootinfo.h	2006-11-23 21:37:32 UTC (rev 450)
+++ cdrkit/trunk/genisoimage/bootinfo.h	2006-11-23 22:11:41 UTC (rev 453)
@@ -1,46 +0,0 @@
-/*
- * This file has been modified for the cdrkit suite.
- *
- * The behaviour and appearence of the program code below can differ to a major
- * extent from the version distributed by the original author(s).
- *
- * For details, see Changelog file distributed with the cdrkit package. If you
- * received this file from another source then ask the distributing person for
- * a log of modifications.
- *
- */
-
-/* @(#)bootinfo.h	1.3 04/03/02 Copyright 1999, 2004 J. Schilling */
-/*
- *	Header file bootinfo.h - mkisoimage-defined boot information table
- *	useful for an El Torito-loaded disk image.
- *
- *	Copyright (c) 1999, 2004 J. Schilling
- */
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; see the file COPYING.  If not, write to the Free Software
- * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef	_BOOTINFO_H
-#define	_BOOTINFO_H
-
-struct mkisoimage_boot_info {
-	char bi_pvd	 [ISODCL(1,   4)]; /* LBA of PVD */
-	char bi_file	 [ISODCL(5,   8)]; /* LBA of boot image */
-	char bi_length	 [ISODCL(9,  12)]; /* Length of boot image */
-	char bi_csum	 [ISODCL(13, 16)]; /* Checksum of boot image */
-	char bi_reserved [ISODCL(17, 56)]; /* Reserved */
-};
-
-#endif	/* _BOOTINFO_H */

Copied: cdrkit/trunk/genisoimage/bootinfo.h (from rev 452, cdrkit/trunk/mkisoimage/bootinfo.h)

Deleted: cdrkit/trunk/genisoimage/bswap.h
===================================================================
--- cdrkit/trunk/mkisoimage/bswap.h	2006-11-23 21:37:32 UTC (rev 450)
+++ cdrkit/trunk/genisoimage/bswap.h	2006-11-23 22:11:41 UTC (rev 453)
@@ -1,67 +0,0 @@
-/*
- * This file has been modified for the cdrkit suite.
- *
- * The behaviour and appearence of the program code below can differ to a major
- * extent from the version distributed by the original author(s).
- *
- * For details, see Changelog file distributed with the cdrkit package. If you
- * received this file from another source then ask the distributing person for
- * a log of modifications.
- *
- */
-
-/* @(#)bswap.h	1.2 03/03/25 Copyright 2002 J. Schilling */
-#ifndef _BSWAP_H
-#define	_BSWAP_H
-
-/*
- *	Allow to use B2N_* macros found in libdvdread in a portable way.
- *	These macros should better be avoided as in place conversion in
- *	general only works on processors like Motorola 68000 and Intel x86.
- *	Modern processors usually have alignement restrictions that may
- *	cause problems. The stripped down libdvdread for mkisoimage is known
- *	not to have these alignement problems, so we may use the macros
- *	as they have been introduced by the authors of libdvdread.
- *
- *	Copyright (c) 2002 J. Schilling
- */
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; see the file COPYING.  If not, write to the Free Software
- * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#include <mconfig.h>
-#include <btorder.h>
-#include <intcvt.h>
-
-#if defined(WORDS_BIGENDIAN)
-
-/* All bigendian systems are fine, just ignore the swaps. */
-#define	B2N_16(x) (void)(x)
-#define	B2N_32(x) (void)(x)
-#define	B2N_64(x) (void)(x)
-
-#else
-
-/*
- * It is a bad idea to convert numbers in place.
- * In protocols, there is usually the additional problem that the
- * data is not properly aligned.
- */
-#define	B2N_16(x) (x) = a_to_u_2_byte(&(x))
-#define	B2N_32(x) (x) = a_to_u_4_byte(&(x))
-#define	B2N_64(x) (x) = a_to_u_8_byte(&(x))
-
-#endif
-
-#endif /* _BSWAP_H */

Copied: cdrkit/trunk/genisoimage/bswap.h (from rev 452, cdrkit/trunk/mkisoimage/bswap.h)

Copied: cdrkit/trunk/genisoimage/build_genisoimage.com (from rev 452, cdrkit/trunk/mkisoimage/build_genisoimage.com)

Deleted: cdrkit/trunk/genisoimage/build_mkisoimage.com
===================================================================
--- cdrkit/trunk/mkisoimage/build_mkisoimage.com	2006-11-23 21:37:32 UTC (rev 450)
+++ cdrkit/trunk/genisoimage/build_mkisoimage.com	2006-11-23 22:11:41 UTC (rev 453)
@@ -1,49 +0,0 @@
-$ defs = "/define=("USE_LARGEFILES","ABORT_DEEP_ISO_ONLY","APPLE_HYB","UDF","DVD_VIDEO","SORTING","USE_LIBSCHILY","USE_SCG","HAVE_DIRENT_H","HAVE_STRCASECMP")
-$ incs = "/include=([-.include],[-.libhfs_iso],[-.cdrecord],[])"
-$ opts = "/float=ieee/prefix=all"
-$ define/nolog scg [-.LIBSCG.scg]
-$ copy [-.cdrecord]scsi_cdr.c *.*
-$ copy [-.cdrecord]cd_misc.c *.*
-$ copy [-.cdrecord]modes.c *.*
-$ cc 'defs' 'incs'  'opts' mkisoimage.c
-$ cc 'defs' 'incs'  'opts' tree.c
-$ cc 'defs' 'incs'  'opts' write.c
-$ cc 'defs' 'incs'  'opts' hash.c
-$ cc 'defs' 'incs'  'opts' rock.c
-$ cc 'defs' 'incs'  'opts' udf.c
-$ cc 'defs' 'incs'  'opts' multi.c
-$ cc 'defs' 'incs'  'opts' joliet.c
-$ cc 'defs' 'incs'  'opts' match.c
-$ cc 'defs' 'incs'  'opts' name.c
-$ cc 'defs' 'incs'  'opts' fnmatch.c
-$ cc 'defs' 'incs'  'opts' eltorito.c
-$ cc 'defs' 'incs'  'opts' boot.c
-$ cc 'defs' 'incs'  'opts' getopt.c
-$ cc 'defs' 'incs'  'opts' getopt1.c
-$ cc 'defs' 'incs'  'opts' scsi.c
-$ cc 'defs' 'incs'  'opts' scsi_cdr.c
-$ cc 'defs' 'incs'  'opts' cd_misc.c
-$ cc 'defs' 'incs'  'opts' modes.c
-$ cc 'defs' 'incs'  'opts' apple.c
-$ cc 'defs' 'incs'  'opts' volume.c
-$ cc 'defs' 'incs'  'opts' desktop.c
-$ cc 'defs' 'incs'  'opts' mac_label.c
-$ cc 'defs' 'incs'  'opts' stream.c
-$ cc 'defs' 'incs'  'opts' ifo_read.c
-$ cc 'defs' 'incs'  'opts' dvd_file.c
-$ cc 'defs' 'incs'  'opts' dvd_reader.c
-$ cc 'defs' 'incs'  'opts' vms.c
-$ libr/crea mkisoimage.olb
-$ libr/ins mkisoimage.olb *.obj
-$ link/nosysshr/exe=[-.bins]mkisoimage.exe sys$input/option
-cluster=myclu,,,mkisoimage.obj,mkisoimage.olb/libr, -
-[-.libs]LIBHFS_Iso.olb/lib, -
-LIBUNLS.olb/lib, -
-libfile.olb/lib, -
-libscg.olb/lib, -
-libschily.olb/lib, -
-STDIO.OLB/lib
-sys$library:decc$shr/share/selective
-sys$library:cma$tis_shr/share/selective
-$ delete *.obj;*
-$ purge/nolog *.olb

Deleted: cdrkit/trunk/genisoimage/desktop.c
===================================================================
--- cdrkit/trunk/mkisoimage/desktop.c	2006-11-23 21:37:32 UTC (rev 450)
+++ cdrkit/trunk/genisoimage/desktop.c	2006-11-23 22:11:41 UTC (rev 453)
@@ -1,184 +0,0 @@
-/*
- * This file has been modified for the cdrkit suite.
- *
- * The behaviour and appearence of the program code below can differ to a major
- * extent from the version distributed by the original author(s).
- *
- * For details, see Changelog file distributed with the cdrkit package. If you
- * received this file from another source then ask the distributing person for
- * a log of modifications.
- *
- */
-
-/* @(#)desktop.c	1.6 04/03/04 joerg, Copyright 1997, 1998, 1999, 2000 James Pearson */
-#ifndef lint
-static	char sccsid[] =
-	"@(#)desktop.c	1.6 04/03/04 joerg, Copyright 1997, 1998, 1999, 2000 James Pearson";
-#endif
-/*
- *      Copyright (c) 1997, 1998, 1999, 2000 James Pearson
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING.  If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-/*
- *	make_desktop: create "Desktop DB" and "Desktop DF" files.
- *
- *	These are set up to prevent the Mac "rebuilding the desktop"
- *	when the CD is inserted ???
- *
- *	I don't know if these files should be populated, but I've just
- *	created these files in their initial states:
- *
- *	Desktop DB:	Initial size == volume's clump size
- *			first block contents found by using od ...
- *			rest of file seems to be padding
- *			No resource fork
- *
- *	Desktop DF:	Empty
- *
- *	If the files already exist, then set correct type/creator/flags
- *
- *	James Pearson 11/8/97
- *	Adapted from mkhfs routines for mkhybrid
- */
-
-#ifdef APPLE_HYB
-
-#include <mconfig.h>
-#include "mkisoimage.h"
-
-#define	DB	"Desktop DB"
-#define	DBFC	"DMGR"
-#define	DBT	"BTFL"
-
-#define	DF	"Desktop DF"
-#define	DFT	"DTFL"
-
-/*
- * from "data.h" - libhfs routines
- */
-extern	void d_putw(unsigned char *, short);
-extern	void d_putl(unsigned char *, long);
-
-int	make_desktop(hfsvol *vol, int end);
-
-
-extern	hce_mem *hce;	/* libhfs/mkisoimage extras */
-
-int
-make_desktop(hfsvol *vol, int end)
-{
-	hfsfile		*hfp;			/* Mac file */
-	hfsdirent	ent;			/* Mac finderinfo */
-	unsigned long	clps;			/* clump size */
-	unsigned short	blks;			/* blocks in a clump */
-	unsigned char	*blk;			/* user data */
-
-	/*
-	 * set up default directory entries - not all these fields are needed,
-	 * but we'll set them up anyway ...
-	 * First do a memset because there was a report about randomly
-	 * changing Desktop DB/DF entries...
-	 */
-	memset(&ent, 0, sizeof (hfsdirent));	/* First clear all ... */
-	ent.u.file.rsize = 0;			/* resource size == 0 */
-	strcpy(ent.u.file.creator, DBFC);	/* creator */
-	strcpy(ent.u.file.type, DBT);		/* type */
-	ent.crdate = ent.mddate = time(0);	/* date is now */
-	ent.fdflags = HFS_FNDR_ISINVISIBLE;	/* invisible files */
-
-	/*
-	 * clear the DB file
-	 */
-	blk = hce->hfs_ce + hce->hfs_ce_size * HFS_BLOCKSZ;
-	blks = hce->hfs_dt_size;
-	clps = blks * HFS_BLOCKSZ;
-
-	memset(blk, 0, clps);
-
-	/*
-	 * create "Desktop DB" (if it doesn't exist)
-	 */
-	if (hfs_create(vol, DB, ent.u.file.type, ent.u.file.creator) == 0) {
-		/*
-		 * DB file size from hce_mem info
-		 * set up "Desktop DB" data - following found by od'ing the
-		 * "Desktop DB" file
-		 */
-		d_putw(blk + 8, 0x100);
-		d_putw(blk + 10, 0x3);
-
-		d_putw(blk + 32, 0x200);
-		d_putw(blk + 34, 0x25);
-
-		d_putl(blk + 36, blks);
-		d_putl(blk + 40, blks - 1);
-
-		d_putl(blk + 46, clps);
-		d_putw(blk + 50, 0xff);
-
-		d_putw(blk + 120, 0x20a);
-		d_putw(blk + 122, 0x100);
-
-		d_putw(blk + 248, 0x8000);
-
-		d_putl(blk + 504, 0x1f800f8);
-		d_putl(blk + 508, 0x78000e);
-
-		/* entries for "Desktop DB" */
-		ent.u.file.dsize = clps;	/* size = clump size */
-
-		/* open file */
-		if ((hfp = hfs_open(vol, DB)) == 0)
-			perr(hfs_error);
-
-		/* "write" file */
-		write_fork(hfp, clps);
-
-		/* set DB file attributes */
-		if (hfs_fsetattr(hfp, &ent) < 0)
-			perr(hfs_error);
-
-		/* find the real start of the file */
-		end += hce->hfs_ce_size;
-
-		/* close DB file */
-		if (hfs_close(hfp, end, 0) < 0)
-			perr(hfs_error);
-	} else {
-		/*
-		 * if it already exists, then make sure it has the correct
-		 * type/creator and flags
-		 */
-		if (hfs_setattr(vol, DB, &ent) < 0)
-			perr(hfs_error);
-	}
-
-	/* setup "Desktop DF" file as an empty file */
-	strcpy(ent.u.file.type, DFT);		/* type */
-	ent.u.file.dsize = 0;			/* empty */
-
-	/* create DF file (if it doesn't exist) - no need to open it */
-	hfs_create(vol, DF, ent.u.file.type, ent.u.file.creator);
-
-	/* set DB file attributes */
-	if (hfs_setattr(vol, DF, &ent) < 0)
-		perr(hfs_error);
-
-	return (0);
-}
-
-#endif	/* APPLE_HYB */

Copied: cdrkit/trunk/genisoimage/desktop.c (from rev 452, cdrkit/trunk/mkisoimage/desktop.c)

Copied: cdrkit/trunk/genisoimage/diag (from rev 452, cdrkit/trunk/mkisoimage/diag)

Deleted: cdrkit/trunk/genisoimage/dvd_file.c
===================================================================
--- cdrkit/trunk/mkisoimage/dvd_file.c	2006-11-23 21:37:32 UTC (rev 450)
+++ cdrkit/trunk/genisoimage/dvd_file.c	2006-11-23 22:11:41 UTC (rev 453)
@@ -1,775 +0,0 @@
-/*
- * This file has been modified for the cdrkit suite.
- *
- * The behaviour and appearence of the program code below can differ to a major
- * extent from the version distributed by the original author(s).
- *
- * For details, see Changelog file distributed with the cdrkit package. If you
- * received this file from another source then ask the distributing person for
- * a log of modifications.
- *
- */
-
-/* @(#)dvd_file.c	1.3 04/03/04 joerg */
-#ifndef lint
-static	char sccsid[] =
-	"@(#)dvd_file.c	1.3 04/03/04 joerg";
-#endif
-/*
- * DVD_VIDEO code
- *  Copyright (c) 2002 Olaf Beck - olaf_sc at yahoo.com
- *			Jörg Schilling <schilling at fokus.gmd.de>
- *			(making the code portable)
- */
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; see the file COPYING.  If not, write to the Free Software
- * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifdef DVD_VIDEO
-
-#include <mconfig.h>
-#include "mkisoimage.h"
-#include <schily.h>
-#include "dvd_reader.h"
-#include "dvd_file.h"
-#include "ifo_read.h"
-
-static	void	bsort(int sector[], int title[], int size);
-static	void	uniq(int sector[], int title[], int title_sets_array[],
-						  int sector_sets_array[], int titles);
-static	void	DVDFreeFileSetArrays(int *sector, int *title, 
-												int *title_sets_array, 
-												int *sector_sets_array);
-void	DVDFreeFileSet(title_set_info_t *title_set_info);
-title_set_info_t *DVDGetFileSet(char *dvd);
-int	DVDGetFilePad(title_set_info_t *title_set_info, char *name);
-
-
-static void
-bsort(int sector[], int title[], int size)
-{
-	int	temp_title;
-	int	temp_sector;
-	int	i;
-	int	j;
-
-  /* this is not bubble sort, this is primitive selection sort. Replace with
-   * bubble sort later, maybe bidirectional, aka Coctail Sort */
-	for (i = 0; i < size; i++) {
-		for (j = 0; j < size; j++) {
-			if (sector[i] < sector[j]) {
-				temp_sector = sector[i];
-				temp_title = title[i];
-				sector[i] = sector[j];
-				title[i] = title[j];
-				sector[j] = temp_sector;
-				title[j] = temp_title;
-			}
-		}
-	}
-}
-
-
-static void
-uniq(int sector[], int title[], int title_sets_array[], 
-	  int sector_sets_array[], int titles)
-{
-	int	i;
-	int	j;
-
-
-	for (i = 0, j = 0; j < titles; ) {
-		if (sector[j] != sector[j+1]) {
-			title_sets_array[i]  = title[j];
-			sector_sets_array[i] = sector[j];
-#ifdef DEBUG
-			fprintf(stderr, "Sector offset is %d\n", sector_sets_array[i]);
-#endif
-			i++;
-			j++;
-		} else {
-			do {
-				if (j < titles)
-					j++;
-
-			} while (sector[j] == sector[j+1]);
-
-		}
-	}
-
-}
-
-static void
-DVDFreeFileSetArrays(int *sector, int *title, int *title_sets_array, 
-							int *sector_sets_array)
-{
-	free(sector);
-	free(title);
-	free(title_sets_array);
-	free(sector_sets_array);
-}
-
-void
-DVDFreeFileSet(title_set_info_t *title_set_info)
-{
-	free(title_set_info->title_set);
-	free(title_set_info);
-}
-
-title_set_info_t *
-DVDGetFileSet(char *dvd)
-{
-	/*
-	 * TODO  Fix close of files if
-	 *	we error out
-	 *	We also assume that all
-	 *	DVD files are of valid
-	 *	size i.e. file%2048 == 0
-	 */
-
-	/* title interation */
-	int		title_sets;
-	int		titles;
-	int		counter;
-	int		i;
-
-	/* DVD file structures */
-	dvd_reader_t *	_dvd = NULL;
-
-	ifo_handle_t *	vmg_ifo = NULL;
-	ifo_handle_t *	vts_ifo = NULL;
-
-	dvd_file_t   *	vmg_vob_file = NULL;
-	dvd_file_t   *	vmg_ifo_file = NULL;
-
-	dvd_file_t   *	vts_ifo_file = NULL;
-	dvd_file_t   *	vts_menu_file = NULL;
-	dvd_file_t   * 	vts_title_file = NULL;
-
-	/* The sizes it self of each file */
-	int		ifo;
-	int		bup;
-	int		menu_vob;
-	int		title_vob;
-
-	/* Arrays keeping the title - filset relationship */
-	int		* sector;
-	int		* title;
-	int		* title_sets_array;
-	int		* sector_sets_array;
-
-	/* DVD Video files */
-	struct stat	fileinfo;
-	char		temppoint[PATH_MAX + 1];
-
-	/* The Title Set Info struct*/
-	title_set_info_t * title_set_info;
-
-	/* Temporary mount point - to be used later */
-	char		mountpoint[PATH_MAX + 1];
-
-	strncpy(mountpoint, dvd, sizeof (mountpoint));
-	mountpoint[sizeof (mountpoint)-1] = '\0';
-
-
-	_dvd = DVDOpen(dvd);
-	if (!_dvd) {
-#ifdef	USE_LIBSCHILY
-		errmsgno(EX_BAD, "Can't open device '%s'\n", dvd);
-#else
-		fprintf(stderr, "Can't open device\n");
-#endif
-		return (0);
-	}
-	vmg_ifo = ifoOpen(_dvd, 0);
-	if (!vmg_ifo) {
-#ifdef	USE_LIBSCHILY
-		errmsgno(EX_BAD, "Can't open VMG info for '%s'.\n", dvd);
-#else
-		fprintf(stderr, "Can't open VMG info.\n");
-#endif
-		return (0);
-	}
-
-	/* Check mount point */
-
-	snprintf(temppoint, sizeof (temppoint),
-				"%s/VIDEO_TS/VIDEO_TS.IFO", mountpoint);
-
-
-	if (stat(temppoint, &fileinfo) < 0) {
-		/* If we can't stat the file, give up */
-#ifdef	USE_LIBSCHILY
-		errmsg("Can't stat %s\n", temppoint);
-#else
-		fprintf(stderr, "Can't stat %s\n", temppoint);
-		perror("");
-#endif
-		return (0);
-	}
-
-
-
-	title_sets = vmg_ifo->vmgi_mat->vmg_nr_of_title_sets;
-	titles = vmg_ifo->tt_srpt->nr_of_srpts;
-
-	sector = e_malloc(titles * sizeof (int));
-	memset(sector, 0, titles * sizeof (int));
-	title = e_malloc(titles * sizeof (int));
-	title_sets_array = e_malloc(title_sets * sizeof (int));
-	sector_sets_array = e_malloc(title_sets * sizeof (int));
-	title_set_info = (title_set_info_t *)e_malloc(sizeof (title_set_info_t));
-	title_set_info->title_set = (title_set_t *)e_malloc((title_sets + 1) *
-							sizeof (title_set_t));
-
-	title_set_info->num_titles = title_sets;
-
-
-	/* Fill and sort the arrays for titles*/
-
-	if (titles >= 1) {
-		for (counter = 0; counter < titles; counter++) {
-			sector[counter] = vmg_ifo->tt_srpt->title[counter].title_set_sector;
-			title[counter]  = counter + 1;
-		}
-	}
-
-	/* Yes, we should probably do a better sort than B - but what the heck*/
-	bsort(sector, title, titles);
-
-
-	/*
-	 * Since title sets and titles are not the same we will need to sort
-	 * out "bogus" titles
-	 */
-
-	uniq(sector, title, title_sets_array, sector_sets_array, titles);
-
-
-	/* Open VIDEO_TS.VOB is present */
-
-	vmg_vob_file = DVDOpenFile(_dvd, 0, DVD_READ_MENU_VOBS);
-
-	/* Check VIDEO_TS title set */
-
-	vmg_ifo_file = DVDOpenFile(_dvd, 0, DVD_READ_INFO_FILE);
-
-	if ((vmg_vob_file == 0) && vmg_ifo->vmgi_mat->vmg_last_sector + 1
-			< 2 * DVDFileSize(vmg_ifo_file)) {
-#ifdef	USE_LIBSCHILY
-		errmsgno(EX_BAD, "IFO is not of correct size aborting\n");
-#else
-		fprintf(stderr, "IFO is not of correct size aborting\n");
-#endif
-		DVDFreeFileSetArrays(sector, title, title_sets_array,
-					sector_sets_array);
-		DVDFreeFileSet(title_set_info);
-		return (0);
-	} else if ((vmg_vob_file != 0) && (vmg_ifo->vmgi_mat->vmg_last_sector
-		    + 1  < 2 * DVDFileSize(vmg_ifo_file) +
-		    DVDFileSize(vmg_vob_file))) {
-#ifdef	USE_LIBSCHILY
-		errmsgno(EX_BAD, "Either VIDEO_TS.IFO or VIDEO_TS.VOB is not of correct size");
-#else
-		fprintf(stderr, "Either VIDEO_TS.IFO or VIDEO_TS.VOB is not of correct size");
-#endif
-		DVDFreeFileSetArrays(sector, title, title_sets_array,
-					sector_sets_array);
-		DVDFreeFileSet(title_set_info);
-		return (0);
-	}
-
-	/* Find the actuall right size of VIDEO_TS.IFO */
-	if (vmg_vob_file == 0) {
-		if (vmg_ifo->vmgi_mat->vmg_last_sector + 1 > 2
-				*  DVDFileSize(vmg_ifo_file)) {
-			ifo = vmg_ifo->vmgi_mat->vmg_last_sector
-				- DVDFileSize(vmg_ifo_file) + 1;
-		} else {
-			ifo = vmg_ifo->vmgi_mat->vmgi_last_sector + 1;
-		}
-	} else {
-		if (vmg_ifo->vmgi_mat->vmgi_last_sector + 1
-				< vmg_ifo->vmgi_mat->vmgm_vobs) {
-			ifo = vmg_ifo->vmgi_mat->vmgm_vobs;
-		} else {
-			ifo = vmg_ifo->vmgi_mat->vmgi_last_sector + 1;
-		}
-	}
-
-	title_set_info->title_set[0].size_ifo = ifo * 2048;
-	title_set_info->title_set[0].realsize_ifo = fileinfo.st_size;
-	title_set_info->title_set[0].pad_ifo = ifo - DVDFileSize(vmg_ifo_file);
-
-	/* Find the actuall right size of VIDEO_TS.VOB */
-	if (vmg_vob_file != 0) {
-		if (ifo + DVDFileSize(vmg_ifo_file) +
-		    DVDFileSize(vmg_vob_file) - 1 <
-		    vmg_ifo->vmgi_mat->vmg_last_sector) {
-				menu_vob = vmg_ifo->vmgi_mat->vmg_last_sector -
-						ifo - DVDFileSize(vmg_ifo_file) + 1;
-		} else {
-			menu_vob = vmg_ifo->vmgi_mat->vmg_last_sector
-			- ifo - DVDFileSize(vmg_ifo_file) + 1;
-		}
-
-		snprintf(temppoint, sizeof (temppoint),
-				"%s/VIDEO_TS/VIDEO_TS.VOB", mountpoint);
-		if (stat(temppoint, &fileinfo) < 0) {
-#ifdef	USE_LIBSCHILY
-			errmsg("calc: Can't stat %s\n", temppoint);
-#else
-			fprintf(stderr, "calc: Can't stat %s\n", temppoint);
-			perror("");
-#endif
-			DVDFreeFileSetArrays(sector, title, title_sets_array,
-						sector_sets_array);
-			DVDFreeFileSet(title_set_info);
-			return (0);
-		}
-
-		title_set_info->title_set[0].realsize_menu = fileinfo.st_size;
-		title_set_info->title_set[0].pad_menu = menu_vob -
-						DVDFileSize(vmg_vob_file);
-		title_set_info->title_set[0].size_menu = menu_vob * 2048;
-		DVDCloseFile(vmg_vob_file);
-	} else {
-		title_set_info->title_set[0].size_menu = 0;
-		title_set_info->title_set[0].realsize_menu = 0;
-		title_set_info->title_set[0].pad_menu = 0;
-		menu_vob = 0;
-	}
-
-
-	/* Finding the actuall right size of VIDEO_TS.BUP */
-	if (title_sets >= 1) {
-		bup = sector_sets_array[0] - menu_vob - ifo;
-	} else {
-		/* Just in case we burn a DVD-Video without any title_sets */
-		bup = vmg_ifo->vmgi_mat->vmg_last_sector + 1 - menu_vob - ifo;
-	}
-
-	/* Never trust the BUP file - use a copy of the IFO */
-	snprintf(temppoint, sizeof (temppoint),
-				"%s/VIDEO_TS/VIDEO_TS.IFO", mountpoint);
-
-	if (stat(temppoint, &fileinfo) < 0) {
-#ifdef	USE_LIBSCHILY
-		errmsg("calc: Can't stat %s\n", temppoint);
-#else
-		fprintf(stderr, "calc: Can't stat %s\n", temppoint);
-		perror("");
-#endif
-		DVDFreeFileSetArrays(sector, title, title_sets_array,
-					sector_sets_array);
-		DVDFreeFileSet(title_set_info);
-		return (0);
-	}
-
-	title_set_info->title_set[0].realsize_bup = fileinfo.st_size;
-	title_set_info->title_set[0].size_bup = bup * 2048;
-	title_set_info->title_set[0].pad_bup = bup - DVDFileSize(vmg_ifo_file);
-
-	/* Take care of the titles which we don't have in VMG */
-
-	title_set_info->title_set[0].number_of_vob_files = 0;
-	title_set_info->title_set[0].realsize_vob[0] = 0;
-	title_set_info->title_set[0].pad_title = 0;
-
-	DVDCloseFile(vmg_ifo_file);
-
-	if (title_sets >= 1) {
-		for (counter = 0; counter < title_sets; counter++) {
-
-			vts_ifo = ifoOpen(_dvd, counter + 1);
-
-			if (!vts_ifo) {
-#ifdef	USE_LIBSCHILY
-				errmsgno(EX_BAD, "Can't open VTS info.\n");
-#else
-				fprintf(stderr, "Can't open VTS info.\n");
-#endif
-				DVDFreeFileSetArrays(sector, title,
-					title_sets_array, sector_sets_array);
-				DVDFreeFileSet(title_set_info);
-				return (0);
-			}
-
-			snprintf(temppoint, sizeof (temppoint),
-				"%s/VIDEO_TS/VTS_%02i_0.IFO",
-				mountpoint, counter + 1);
-
-			if (stat(temppoint, &fileinfo) < 0) {
-#ifdef	USE_LIBSCHILY
-				errmsg("calc: Can't stat %s\n", temppoint);
-#else
-				fprintf(stderr, "calc: Can't stat %s\n",
-					temppoint);
-				perror("");
-#endif
-				DVDFreeFileSetArrays(sector, title,
-					title_sets_array, sector_sets_array);
-				DVDFreeFileSet(title_set_info);
-				return (0);
-			}
-
-
-			/* Test if VTS_XX_0.VOB is present */
-
-			vts_menu_file = DVDOpenFile(_dvd, counter + 1,
-					DVD_READ_MENU_VOBS);
-
-			/* Test if VTS_XX_X.VOB are present */
-
-			vts_title_file = DVDOpenFile(_dvd, counter + 1,
-						DVD_READ_TITLE_VOBS);
-
-			/* Check VIDEO_TS.IFO */
-
-			vts_ifo_file = DVDOpenFile(_dvd, counter + 1,
-							DVD_READ_INFO_FILE);
-
-			/*
-			 * Checking that title will fit in the
-			 * space given by the ifo file
-			 */
-
-
-			if (vts_ifo->vtsi_mat->vts_last_sector + 1
-				< 2 * DVDFileSize(vts_ifo_file)) {
-#ifdef	USE_LIBSCHILY
-				errmsgno(EX_BAD, "IFO is not of correct size aborting.\n");
-#else
-				fprintf(stderr, "IFO is not of correct size aborting\n");
-#endif
-				DVDFreeFileSetArrays(sector, title,
-					title_sets_array, sector_sets_array);
-				DVDFreeFileSet(title_set_info);
-				return (0);
-			} else if ((vts_title_file != 0) &&
-				    (vts_menu_file != 0) &&
-				    (vts_ifo->vtsi_mat->vts_last_sector + 1
-				    < 2 * DVDFileSize(vts_ifo_file) +
-				    DVDFileSize(vts_title_file) +
-				    DVDFileSize(vts_menu_file))) {
-#ifdef	USE_LIBSCHILY
-				errmsgno(EX_BAD, "Either VIDEO_TS.IFO or VIDEO_TS.VOB is not of correct size.\n");
-#else
-				fprintf(stderr, "Either VIDEO_TS.IFO or VIDEO_TS.VOB is not of correct size");
-#endif
-				DVDFreeFileSetArrays(sector, title,
-					title_sets_array, sector_sets_array);
-				DVDFreeFileSet(title_set_info);
-				return (0);
-			} else if ((vts_title_file != 0) &&
-				    (vts_menu_file == 0) &&
-				    (vts_ifo->vtsi_mat->vts_last_sector + 1
-				    < 2 * DVDFileSize(vts_ifo_file) +
-				    DVDFileSize(vts_title_file))) {
-#ifdef	USE_LIBSCHILY
-				errmsgno(EX_BAD, "Either VIDEO_TS.IFO or VIDEO_TS.VOB is not of correct size.\n");
-#else
-				fprintf(stderr, "Either VIDEO_TS.IFO or VIDEO_TS.VOB is not of correct size");
-#endif
-				DVDFreeFileSetArrays(sector, title,
-					title_sets_array, sector_sets_array);
-				DVDFreeFileSet(title_set_info);
-				return (0);
-			} else if ((vts_menu_file != 0) &&
-				    (vts_title_file == 0) &&
-				    (vts_ifo->vtsi_mat->vts_last_sector + 1
-				    < 2 * DVDFileSize(vts_ifo_file) +
-				    DVDFileSize(vts_menu_file))) {
-#ifdef	USE_LIBSCHILY
-				errmsgno(EX_BAD, "Either VIDEO_TS.IFO or VIDEO_TS.VOB is not of correct size.\n");
-#else
-				fprintf(stderr, "Either VIDEO_TS.IFO or VIDEO_TS.VOB is not of correct size");
-#endif
-				DVDFreeFileSetArrays(sector, title,
-					title_sets_array, sector_sets_array);
-				DVDFreeFileSet(title_set_info);
-				return (0);
-			}
-
-
-			/* Find the actuall right size of VTS_XX_0.IFO */
-			if ((vts_title_file == 0) && (vts_menu_file == 0)) {
-				if (vts_ifo->vtsi_mat->vts_last_sector + 1 >
-				    2 * DVDFileSize(vts_ifo_file)) {
-					ifo = vts_ifo->vtsi_mat->vts_last_sector
-						- DVDFileSize(vts_ifo_file) + 1;
-				} else {
-					ifo = vts_ifo->vtsi_mat->vts_last_sector
-						- DVDFileSize(vts_ifo_file) + 1;
-				}
-			} else if (vts_title_file == 0) {
-				if (vts_ifo->vtsi_mat->vtsi_last_sector + 1 <
-				    vts_ifo->vtsi_mat->vtstt_vobs) {
-					ifo = vmg_ifo->vtsi_mat->vtstt_vobs;
-				} else {
-					ifo = vmg_ifo->vtsi_mat->vtstt_vobs;
-				}
-			} else {
-				if (vts_ifo->vtsi_mat->vtsi_last_sector + 1 <
-				    vts_ifo->vtsi_mat->vtsm_vobs) {
-					ifo = vts_ifo->vtsi_mat->vtsm_vobs;
-				} else {
-					ifo = vts_ifo->vtsi_mat->vtsi_last_sector + 1;
-				}
-			}
-			title_set_info->title_set[counter + 1].size_ifo =
-						ifo * 2048;
-			title_set_info->title_set[counter + 1].realsize_ifo =
-						fileinfo.st_size;
-			title_set_info->title_set[counter + 1].pad_ifo =
-						ifo - DVDFileSize(vts_ifo_file);
-
-
-			/* Find the actuall right size of VTS_XX_0.VOB */
-			if (vts_menu_file != 0) {
-				if (vts_ifo->vtsi_mat->vtsm_vobs == 0)  {
-					/*
-					 * Apparently start sector 0 means that
-					 * VTS_XX_0.VOB is empty after all...
-					 */
-					menu_vob = 0;
-					if (DVDFileSize(vts_menu_file) != 0) {
-						/*
-						 * Paranoia: we most likely never
-						 * come here...
-						 */
-#ifdef	USE_LIBSCHILY
-						errmsgno(EX_BAD,
-							"%s/VIDEO_TS/VTS_%02i_0.IFO appears to be corrupted.\n",
-							mountpoint, counter+1);
-#else
-						fprintf(stderr,
-							"%s/VIDEO_TS/VTS_%02i_0.IFO appears to be corrupted.\n",
-							mountpoint, counter+1);
-#endif
-						return (0);
-					}
-				} else if ((vts_title_file != 0) &&
-					(vts_ifo->vtsi_mat->vtstt_vobs -
-					vts_ifo->vtsi_mat->vtsm_vobs >
-						DVDFileSize(vts_menu_file))) {
-					menu_vob = vts_ifo->vtsi_mat->vtstt_vobs -
-							vts_ifo->vtsi_mat->vtsm_vobs;
-				} else if ((vts_title_file == 0) &&
-					    (vts_ifo->vtsi_mat->vtsm_vobs +
-					    DVDFileSize(vts_menu_file) +
-					    DVDFileSize(vts_ifo_file) - 1 <
-					    vts_ifo->vtsi_mat->vts_last_sector)) {
-					menu_vob = vts_ifo->vtsi_mat->vts_last_sector
-						- DVDFileSize(vts_ifo_file)
-						- vts_ifo->vtsi_mat->vtsm_vobs + 1;
-				} else {
-					menu_vob = vts_ifo->vtsi_mat->vtstt_vobs -
-							vts_ifo->vtsi_mat->vtsm_vobs;
-				}
-
-				snprintf(temppoint, sizeof (temppoint),
-					"%s/VIDEO_TS/VTS_%02i_0.VOB", mountpoint, counter + 1);
-
-				if (stat(temppoint, &fileinfo)  < 0) {
-#ifdef	USE_LIBSCHILY
-					errmsg("calc: Can't stat %s\n", temppoint);
-#else
-					fprintf(stderr, "calc: Can't stat %s\n",
-						temppoint);
-					perror("");
-#endif
-					DVDFreeFileSetArrays(sector, title,
-						title_sets_array, sector_sets_array);
-					DVDFreeFileSet(title_set_info);
-					return (0);
-				}
-
-				title_set_info->title_set[counter + 1].realsize_menu = fileinfo.st_size;
-				title_set_info->title_set[counter + 1].size_menu = menu_vob * 2048;
-				title_set_info->title_set[counter + 1].pad_menu = menu_vob - DVDFileSize(vts_menu_file);
-
-			} else {
-				title_set_info->title_set[counter + 1].size_menu = 0;
-				title_set_info->title_set[counter + 1].realsize_menu = 0;
-				title_set_info->title_set[counter + 1].pad_menu = 0;
-				menu_vob = 0;
-			}
-
-
-			/* Find the actuall total size of VTS_XX_[1 to 9].VOB */
-
-			if (vts_title_file != 0) {
-				if (ifo + menu_vob + DVDFileSize(vts_ifo_file) -
-				    1 < vts_ifo->vtsi_mat->vts_last_sector) {
-				    title_vob = vts_ifo->vtsi_mat->vts_last_sector
-						+ 1 - ifo - menu_vob -
-						DVDFileSize(vts_ifo_file);
-				} else {
-					title_vob = vts_ifo->vtsi_mat->vts_last_sector +
-						1 - ifo - menu_vob -
-						DVDFileSize(vts_ifo_file);
-				}
-				/*
-				 * Find out how many vob files
-				 * and the size of them
-				 */
-				for (i = 0; i < 9; ++i) {
-					snprintf(temppoint, sizeof (temppoint),
-						"%s/VIDEO_TS/VTS_%02i_%i.VOB",
-						mountpoint, counter + 1, i + 1);
-					if (stat(temppoint, &fileinfo) < 0) {
-						break;
-					}
-					title_set_info->title_set[counter + 1].realsize_vob[i] = fileinfo.st_size;
-				}
-				title_set_info->title_set[counter + 1].number_of_vob_files = i;
-				title_set_info->title_set[counter + 1].size_title = title_vob * 2048;
-				title_set_info->title_set[counter + 1].pad_title = title_vob - DVDFileSize(vts_title_file);
-			} else {
-				title_set_info->title_set[counter + 1].number_of_vob_files = 0;
-				title_set_info->title_set[counter + 1].realsize_vob[0] = 0;
-				title_set_info->title_set[counter + 1].size_title = 0;
-				title_set_info->title_set[counter + 1].pad_title = 0;
-				title_vob = 0;
-
-			}
-
-
-			/* Find the actuall total size of VTS_XX_0.BUP */
-			if (title_sets - 1 > counter) {
-				bup = sector_sets_array[counter+1]
-					- sector_sets_array[counter]
-					- title_vob - menu_vob - ifo;
-			} else {
-				bup = vts_ifo->vtsi_mat->vts_last_sector + 1
-					- title_vob - menu_vob - ifo;
-			}
-
-			/* Never trust the BUP use a copy of the IFO */
-			snprintf(temppoint, sizeof (temppoint),
-				"%s/VIDEO_TS/VTS_%02i_0.IFO",
-				mountpoint, counter + 1);
-
-			if (stat(temppoint, &fileinfo) < 0) {
-#ifdef	USE_LIBSCHILY
-				errmsg("calc: Can't stat %s\n", temppoint);
-#else
-				fprintf(stderr, "calc: Can't stat %s\n",
-					temppoint);
-				perror("");
-#endif
-				DVDFreeFileSetArrays(sector, title,
-					title_sets_array, sector_sets_array);
-				DVDFreeFileSet(title_set_info);
-				return (0);
-			}
-
-			title_set_info->title_set[counter + 1].size_bup =
-						bup * 2048;
-			title_set_info->title_set[counter + 1].realsize_bup =
-						fileinfo.st_size;
-			title_set_info->title_set[counter + 1].pad_bup =
-						bup - DVDFileSize(vts_ifo_file);
-
-
-			/* Closing files */
-
-			if (vts_menu_file != 0) {
-				DVDCloseFile(vts_menu_file);
-			}
-
-			if (vts_title_file != 0) {
-				DVDCloseFile(vts_title_file);
-			}
-
-
-			if (vts_ifo_file != 0) {
-				DVDCloseFile(vts_ifo_file);
-			}
-
-			ifoClose(vts_ifo);
-
-		}
-
-	}
-
-	DVDFreeFileSetArrays(sector, title, title_sets_array, sector_sets_array);
-
-	/* Close the VMG ifo file we got all the info we need */
-	ifoClose(vmg_ifo);
-
-
-	/* Close the DVD */
-	DVDClose(_dvd);
-
-	/* Return the actuall info*/
-	return (title_set_info);
-
-
-}
-
-int
-DVDGetFilePad(title_set_info_t *title_set_info, char *name)
-{
-	char	title_a[3];
-	char	vob_a[2];
-	int	title;
-	int	vob;
-
-	title_a[0] = title_a[1] = title_a[2] = '\0';
-	vob_a[0] = vob_a[1] = '\0';
-
-	if (name[0] != 'V') {
-		return (0);
-	}
-	if (memcmp(name, "VIDEO_TS", 8) == 0) {
-		if (strstr(name, ".IFO") != 0) {
-			return (title_set_info->title_set[0].pad_ifo);
-		} else if (strstr(name, ".VOB") != 0) {
-			return (title_set_info->title_set[0].pad_menu);
-		} else if (strstr(name, ".BUP") != 0) {
-			return (title_set_info->title_set[0].pad_bup);
-		} else {
-			return (0);
-		}
-	} else if (memcmp(name, "VTS_", 4) == 0) {
-		title_a[0] = name[4];
-		title_a[1] = name[5];
-		title_a[2] = '\0';
-		vob_a[0] = name[7];
-		vob_a[1] = '\0';
-		title = atoi(title_a);
-		vob = atoi(vob_a);
-		if (title > title_set_info->num_titles) {
-			return (0);
-		} else {
-			if (strstr(name, ".IFO") != 0) {
-				return (title_set_info->title_set[title].pad_ifo);
-			} else if (strstr(name, ".BUP") != 0) {
-				return (title_set_info->title_set[title].pad_bup);
-			} else if (vob == 0) {
-				return (title_set_info->title_set[title].pad_menu);
-			} else if (vob == title_set_info->title_set[title].number_of_vob_files) {
-				return (title_set_info->title_set[title].pad_title);
-			} else {
-				return (0);
-			}
-		}
-	} else {
-		return (0);
-	}
-}
-
-#endif /*DVD_VIDEO*/

Copied: cdrkit/trunk/genisoimage/dvd_file.c (from rev 452, cdrkit/trunk/mkisoimage/dvd_file.c)

Deleted: cdrkit/trunk/genisoimage/dvd_reader.c
===================================================================
--- cdrkit/trunk/mkisoimage/dvd_reader.c	2006-11-23 21:37:32 UTC (rev 450)
+++ cdrkit/trunk/genisoimage/dvd_reader.c	2006-11-23 22:11:41 UTC (rev 453)
@@ -1,299 +0,0 @@
-/*
- * This file has been modified for the cdrkit suite.
- *
- * The behaviour and appearence of the program code below can differ to a major
- * extent from the version distributed by the original author(s).
- *
- * For details, see Changelog file distributed with the cdrkit package. If you
- * received this file from another source then ask the distributing person for
- * a log of modifications.
- *
- */
-
-/* @(#)dvd_reader.c	1.3 04/03/04 joerg */
-#ifndef lint
-static	char sccsid[] =
-	"@(#)dvd_reader.c	1.3 04/03/04 joerg";
-#endif
-/*
- * Copyright (C) 2001, 2002 Billy Biggs <vektor at dumbterm.net>,
- *                          Håkan Hjort <d95hjort at dtek.chalmers.se>,
- *                          Olaf Beck <olaf_sc at yahoo.com>
- *			    (I only did the cut down no other contribs)
- *			    Jörg Schilling <schilling at fokus.gmd.de>
- *			    (making the code portable)
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-/*
- * NOTE: This is a cut down version of libdvdread for mkisoimage, due
- * to portability issues with the current libdvdread according to
- * the maintainer of mkisoimage.
- * This cut down version only reads from a harddisk file structure
- * and it only implements the functions necessary inorder to make
- * mkisoimage produce valid DVD-Video images.
- * DON'T USE THIS LIBRARY IN ANY OTHER PROGRAM GET THE REAL
- * LIBDVDREAD INSTEAD
- */
-#ifdef DVD_VIDEO
-
-#include "mkisoimage.h"
-#include <fctldefs.h>
-#include <schily.h>
-
-#include "dvd_reader.h"
-
-struct dvd_file_s {
-	/* Basic information. */
-	dvd_reader_t	*dvd;
-
-	/* Calculated at open-time, size in blocks. */
-	ssize_t		filesize;
-};
-
-
-void		DVDCloseFile(dvd_file_t *dvd_file);
-static	dvd_file_t *DVDOpenFilePath(dvd_reader_t *dvd, char *filename);
-static	dvd_file_t *DVDOpenVOBPath(dvd_reader_t *dvd, int title, int menu);
-dvd_file_t *DVDOpenFile(dvd_reader_t *dvd, int titlenum, 
-								dvd_read_domain_t domain);
-static	dvd_reader_t *DVDOpenPath(const char *path_root);
-dvd_reader_t *DVDOpen(const char *path);
-void		DVDClose(dvd_reader_t *dvd);
-ssize_t		DVDFileSize(dvd_file_t *dvd_file);
-
-
-/*
- * Free a DVD file
- */
-void
-DVDCloseFile(dvd_file_t *dvd_file)
-{
-	free(dvd_file);
-	dvd_file = 0;
-}
-
-
-/*
- * Stat a IFO or BUP file from a DVD directory tree.
- */
-static dvd_file_t *
-DVDOpenFilePath(dvd_reader_t *dvd, char *filename)
-{
-
-	char		full_path[PATH_MAX + 1];
-	dvd_file_t	*dvd_file;
-	struct stat	fileinfo;
-
-	/* Get the full path of the file. */
-
-	snprintf(full_path, sizeof (full_path),
-				"%s/%s", dvd->path_root, filename);
-
-
-	dvd_file = (dvd_file_t *) e_malloc(sizeof (dvd_file_t));
-	if (!dvd_file)
-		return (0);
-	dvd_file->dvd = dvd;
-	dvd_file->filesize = 0;
-
-	if (stat(full_path, &fileinfo) < 0) {
-		free(dvd_file);
-		return (0);
-	}
-	dvd_file->filesize = fileinfo.st_size / DVD_VIDEO_LB_LEN;
-
-	return (dvd_file);
-}
-
-
-/*
- * Stat a VOB file from a DVD directory tree.
- */
-static dvd_file_t *
-DVDOpenVOBPath(dvd_reader_t *dvd, int title, int menu)
-{
-
-	char		filename[PATH_MAX + 1];
-	struct stat	fileinfo;
-	dvd_file_t	*dvd_file;
-	int		i;
-
-	dvd_file = (dvd_file_t *) e_malloc(sizeof (dvd_file_t));
-	if (!dvd_file)
-		return (0);
-	dvd_file->dvd = dvd;
-	dvd_file->filesize = 0;
-
-	if (menu) {
-		if (title == 0) {
-			snprintf(filename, sizeof (filename),
-				"%s/VIDEO_TS/VIDEO_TS.VOB", dvd->path_root);
-		} else {
-			snprintf(filename, sizeof (filename),
-				"%s/VIDEO_TS/VTS_%02i_0.VOB", dvd->path_root, title);
-		}
-		if (stat(filename, &fileinfo) < 0) {
-			free(dvd_file);
-			return (0);
-		}
-		dvd_file->filesize = fileinfo.st_size / DVD_VIDEO_LB_LEN;
-	} else {
-		for (i = 0; i < 9; ++i) {
-
-			snprintf(filename, sizeof (filename),
-				"%s/VIDEO_TS/VTS_%02i_%i.VOB", dvd->path_root, title, i + 1);
-			if (stat(filename, &fileinfo) < 0) {
-					break;
-			}
-
-			dvd_file->filesize += fileinfo.st_size / DVD_VIDEO_LB_LEN;
-		}
-	}
-
-	return (dvd_file);
-}
-
-/*
- * Stat a DVD file from a DVD directory tree
- */
-EXPORT dvd_file_t *
-DVDOpenFile(dvd_reader_t *dvd, int titlenum, dvd_read_domain_t domain)
-{
-	char		filename[MAX_UDF_FILE_NAME_LEN];
-
-	switch (domain) {
-
-	case DVD_READ_INFO_FILE:
-		if (titlenum == 0) {
-			snprintf(filename, sizeof (filename),
-					"/VIDEO_TS/VIDEO_TS.IFO");
-		} else {
-			snprintf(filename, sizeof (filename),
-					"/VIDEO_TS/VTS_%02i_0.IFO", titlenum);
-		}
-		break;
-
-	case DVD_READ_INFO_BACKUP_FILE:
-		if (titlenum == 0) {
-			snprintf(filename, sizeof (filename),
-					"/VIDEO_TS/VIDEO_TS.BUP");
-		} else {
-			snprintf(filename, sizeof (filename),
-					"/VIDEO_TS/VTS_%02i_0.BUP", titlenum);
-		}
-		break;
-
-	case DVD_READ_MENU_VOBS:
-		return (DVDOpenVOBPath(dvd, titlenum, 1));
-
-	case DVD_READ_TITLE_VOBS:
-		if (titlenum == 0)
-			return (0);
-		return (DVDOpenVOBPath(dvd, titlenum, 0));
-
-	default:
-#ifdef	USE_LIBSCHILY
-		errmsgno(EX_BAD, "Invalid domain for file open.\n");
-#else
-		fprintf(stderr, "Invalid domain for file open.\n");
-#endif
-		return (0);
-	}
-	return (DVDOpenFilePath(dvd, filename));
-}
-
-
-
-/*
- * Stat a DVD directory structure
- */
-static dvd_reader_t *
-DVDOpenPath(const char *path_root)
-{
-	dvd_reader_t	*dvd;
-
-	dvd = (dvd_reader_t *) e_malloc(sizeof (dvd_reader_t));
-	if (!dvd)
-		return (0);
-	dvd->path_root = strdup(path_root);
-
-	return (dvd);
-}
-
-
-/*
- * Stat a DVD structure - this one only works with directory structures
- */
-dvd_reader_t *
-DVDOpen(const char *path)
-{
-	struct stat	fileinfo;
-	int		ret;
-
-	if (!path)
-		return (0);
-
-	ret = stat(path, &fileinfo);
-	if (ret < 0) {
-	/* If we can't stat the file, give up */
-#ifdef	USE_LIBSCHILY
-		errmsg("Can't stat %s\n", path);
-#else
-		fprintf(stderr, "Can't stat %s\n", path);
-		perror("");
-#endif
-		return (0);
-	}
-
-
-	if (S_ISDIR(fileinfo.st_mode)) {
-		return (DVDOpenPath(path));
-	}
-
-	/* If it's none of the above, screw it. */
-#ifdef	USE_LIBSCHILY
-	errmsgno(EX_BAD, "Could not open %s\n", path);
-#else
-	fprintf(stderr, "Could not open %s\n", path);
-#endif
-	return (0);
-}
-
-/*
- * Free a DVD structure - this one will only close a directory tree
- */
-void
-DVDClose(dvd_reader_t *dvd)
-{
-	if (dvd) {
-		if (dvd->path_root) free(dvd->path_root);
-		free(dvd);
-		dvd = 0;
-	}
-}
-
-
-
-/*
- * Return the size of a DVD file
- */
-ssize_t
-DVDFileSize(dvd_file_t *dvd_file)
-{
-	return (dvd_file->filesize);
-}
-
-#endif /* DVD_VIDEO */

Copied: cdrkit/trunk/genisoimage/dvd_reader.c (from rev 452, cdrkit/trunk/mkisoimage/dvd_reader.c)

Deleted: cdrkit/trunk/genisoimage/dvd_reader.h
===================================================================
--- cdrkit/trunk/mkisoimage/dvd_reader.h	2006-11-23 21:37:32 UTC (rev 450)
+++ cdrkit/trunk/genisoimage/dvd_reader.h	2006-11-23 22:11:41 UTC (rev 453)
@@ -1,151 +0,0 @@
-/*
- * This file has been modified for the cdrkit suite.
- *
- * The behaviour and appearence of the program code below can differ to a major
- * extent from the version distributed by the original author(s).
- *
- * For details, see Changelog file distributed with the cdrkit package. If you
- * received this file from another source then ask the distributing person for
- * a log of modifications.
- *
- */
-
-/* @(#)dvd_reader.h	1.2 04/03/02 joerg */
-
-#ifndef	_DVD_READER_H
-#define	_DVD_READER_H
-
-/*
- * Copyright (C) 2001, 2002 Billy Biggs <vektor at dumbterm.net>,
- *			    Håkan Hjort <d95hjort at dtek.chalmers.se
- *			    Olaf Beck <olaf_sc at yahoo.com>
- *			    (I only did the cut down no other contribs)
- *			    Jörg Schilling <schilling at fokus.gmd.de>
- *			    (making the code portable)
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-/*
- * NOTE: This is a cut down version of libdvdread for mkisoimage, due
- * to portability issues with the current libdvdread according to
- * the maintainer of mkisoimage.
- * This cut down version only reads from a harddisk file structure
- * and it only implements the functions necessary inorder to make
- * mkisoimage produce valid DVD-Video images.
- * DON'T USE THIS LIBRARY IN ANY OTHER PROGRAM GET THE REAL
- * LIBDVDREAD INSTEAD
- */
-
-
-#include <unixstd.h>	/* Make sure <sys/types.h> is included */
-
-/*
- * Maximum length of filenames for UDF.
- */
-#define	MAX_UDF_FILE_NAME_LEN 2048
-
-/*
- * The length of one Logical Block of a DVD Video.
- */
-#define	DVD_VIDEO_LB_LEN 2048
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-struct dvd_reader_s {
-	/* Information required for a directory path drive. */
-	char	*path_root;
-};
-
-
-typedef struct dvd_reader_s	dvd_reader_t;
-typedef struct dvd_file_s	dvd_file_t;
-
-
-/*
- * dvd = DVDOpen(path);
- * Opens a directory name of a DVD-Video structure on HD.
- * Returns zero if it fails.
- * The path should be like this
- * "path/VIDEO_TS/VTS_01_1.VOB"
- */
-
-
-extern	dvd_reader_t *DVDOpen(const char *);
-
-
-/*
- * DVDClose(dvd);
- *
- * Closes and cleans up the DVD reader object.  You must close all open files
- * before calling this function.
- */
-
-
-extern	void DVDClose(dvd_reader_t *);
-
-/*
- * INFO_FILE       : VIDEO_TS.IFO     (manager)
- *                   VTS_XX_0.IFO     (title)
- *
- * INFO_BACKUP_FILE: VIDEO_TS.BUP     (manager)
- *                   VTS_XX_0.BUP     (title)
- *
- * MENU_VOBS       : VIDEO_TS.VOB     (manager)
- *                   VTS_XX_0.VOB     (title)
- *
- * TITLE_VOBS      : VTS_XX_[1-9].VOB (title)
- *                   All files in the title set are opened and
- *                   read as a single file.
- */
-typedef enum {
-	DVD_READ_INFO_FILE,
-	DVD_READ_INFO_BACKUP_FILE,
-	DVD_READ_MENU_VOBS,
-	DVD_READ_TITLE_VOBS
-} dvd_read_domain_t;
-
-/*
- * dvd_file = DVDOpenFile(dvd, titlenum, domain);
- *
- * Opens a file on the DVD given the title number and domain.  If the title
- * number is 0, the video manager information is opened
- * (VIDEO_TS.[IFO,BUP,VOB]).  Returns a file structure which may be used for
- * reads, or 0 if the file was not found.
- */
-extern	dvd_file_t * DVDOpenFile(dvd_reader_t *, int, dvd_read_domain_t);
-
-/*
- * DVDCloseFile(dvd_file);
- *
- * Closes a file and frees the associated structure.
- */
-extern	void DVDCloseFile(dvd_file_t *);
-
-
-/*
- * blocks = DVDFileSize(dvd_file);
- *
- * Returns the file size in blocks.
- */
-extern	ssize_t DVDFileSize(dvd_file_t *);
-
-
-#ifdef __cplusplus
-};
-#endif
-#endif /* _DVD_READER_H */

Copied: cdrkit/trunk/genisoimage/dvd_reader.h (from rev 452, cdrkit/trunk/mkisoimage/dvd_reader.h)

Deleted: cdrkit/trunk/genisoimage/eltorito.c
===================================================================
--- cdrkit/trunk/mkisoimage/eltorito.c	2006-11-23 21:37:32 UTC (rev 450)
+++ cdrkit/trunk/genisoimage/eltorito.c	2006-11-23 22:11:41 UTC (rev 453)
@@ -1,713 +0,0 @@
-/*
- * This file has been modified for the cdrkit suite.
- *
- * The behaviour and appearence of the program code below can differ to a major
- * extent from the version distributed by the original author(s).
- *
- * For details, see Changelog file distributed with the cdrkit package. If you
- * received this file from another source then ask the distributing person for
- * a log of modifications.
- *
- */
-
-/* @(#)eltorito.c	1.33 05/02/27 joerg */
-#ifndef lint
-static	char sccsid[] =
-	"@(#)eltorito.c	1.33 05/02/27 joerg";
-
-#endif
-/*
- * Program eltorito.c - Handle El Torito specific extensions to iso9660.
- *
- *
- *  Written by Michael Fulbright <msf at redhat.com> (1996).
- *
- * Copyright 1996 RedHat Software, Incorporated
- * Copyright (c) 1999-2004 J. Schilling
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <mconfig.h>
-#include "mkisoimage.h"
-#include <fctldefs.h>
-#include <utypes.h>
-#include <intcvt.h>
-#include "match.h"
-#include "diskmbr.h"
-#include "bootinfo.h"
-#include <schily.h>
-
-#undef MIN
-#define	MIN(a, b) (((a) < (b))? (a): (b))
-
-static struct eltorito_validation_entry valid_desc;
-static struct eltorito_boot_descriptor gboot_desc;
-static struct disk_master_boot_record disk_mbr;
-static unsigned int bcat_de_flags;
-
-void	init_boot_catalog(const char *path);
-void	insert_boot_cat(void);
-static	void	get_torito_desc(struct eltorito_boot_descriptor *boot_desc);
-static	void	fill_boot_desc(struct eltorito_defaultboot_entry *boot_desc_entry,
-										struct eltorito_boot_entry_info *boot_entry);
-void	get_boot_entry(void);
-void	new_boot_entry(void);
-static	int	tvd_write(FILE *outfile);
-
-
-static	char	*bootcat_path;		/* filename of boot catalog */
-/*
- * Make sure any existing boot catalog is excluded
- */
-void
-init_boot_catalog(const char *path)
-{
-#ifdef	SORTING
-	struct eltorito_boot_entry_info * cbe;
-
-	for (cbe = first_boot_entry;
-	    cbe != NULL;
-	    cbe = cbe->next) {
-		char	*p;
-
-		if (cbe->boot_image == NULL)
-			comerrno(EX_BAD, "Missing boot image name, use -eltorito-boot option.\n");
-		p = (char *) e_malloc(strlen(cbe->boot_image) + strlen(path) + 2);
-		strcpy(p, path);
-		if (p[strlen(p) - 1] != '/') {
-			strcat(p, "/");
-		}
-		strcat(p, cbe->boot_image);
-		add_sort_match(p, sort_matches(p, 1));
-		free(p);
-	}
-#endif
-	bootcat_path = (char *) e_malloc(strlen(boot_catalog) + strlen(path) + 2);
-	strcpy(bootcat_path, path);
-	if (bootcat_path[strlen(bootcat_path) - 1] != '/') {
-		strcat(bootcat_path, "/");
-	}
-	strcat(bootcat_path, boot_catalog);
-
-	/*
-	 * we are going to create a virtual catalog file
-	 * - so make sure any existing is excluded
-	 */
-	add_match(bootcat_path);
-
-	/* flag the file as a memory file */
-	bcat_de_flags = MEMORY_FILE;
-
-	/* find out if we want to "hide" this file */
-	if (i_matches(boot_catalog) || i_matches(bootcat_path))
-		bcat_de_flags |= INHIBIT_ISO9660_ENTRY;
-
-	if (j_matches(boot_catalog) || j_matches(bootcat_path))
-		bcat_de_flags |= INHIBIT_JOLIET_ENTRY;
-
-}/* init_boot_catalog(... */
-
-/*
- * Create a boot catalog file in memory - mkisoimage already uses this type of
- * file for the TRANS.TBL files. Therefore the boot catalog is set up in
- * similar way
- */
-void
-insert_boot_cat()
-{
-	struct directory_entry	*de;
-	struct directory_entry	*s_entry;
-	char			*p1;
-	char			*p2;
-	char			*p3;
-	struct directory	*this_dir;
-	struct directory	*dir;
-	char			*buffer;
-
-	init_fstatbuf();
-
-	buffer = (char *) e_malloc(SECTOR_SIZE);
-	memset(buffer, 0, SECTOR_SIZE);
-
-	/*
-	 * try to find the directory that will contain the boot.cat file
-	 * - not very neat, but I can't think of a better way
-	 */
-	p1 = strdup(boot_catalog);
-
-	/* get dirname (p1) and basename (p2) of boot.cat */
-	if ((p2 = strrchr(p1, '/')) != NULL) {
-		*p2 = '\0';
-		p2++;
-
-		/* find the dirname directory entry */
-		de = search_tree_file(root, p1);
-		if (!de) {
-#ifdef	USE_LIBSCHILY
-			comerrno(EX_BAD,
-			"Uh oh, I cant find the boot catalog directory '%s'!\n",
-								p1);
-#else
-			fprintf(stderr,
-			"Uh oh, I cant find the boot catalog directory '%s'!\n",
-								p1);
-			exit(1);
-#endif
-		}
-		this_dir = 0;
-
-		/* get the basename (p3) of the directory */
-		if ((p3 = strrchr(p1, '/')) != NULL)
-			p3++;
-		else
-			p3 = p1;
-
-		/* find the correct sub-directory entry */
-		for (dir = de->filedir->subdir; dir; dir = dir->next)
-			if (!(strcmp(dir->de_name, p3)))
-				this_dir = dir;
-
-		if (this_dir == 0) {
-#ifdef	USE_LIBSCHILY
-			comerrno(EX_BAD,
-			"Uh oh, I cant find the boot catalog directory '%s'!\n",
-								p3);
-#else
-			fprintf(stderr,
-			"Uh oh, I cant find the boot catalog directory '%s'!\n",
-								p3);
-			exit(1);
-#endif
-		}
-	} else {
-		/* boot.cat is in the root directory */
-		this_dir = root;
-		p2 = p1;
-	}
-
-	/*
-	 * make a directory entry in memory (using the same set up as for table
-	 * entries
-	 */
-	s_entry = (struct directory_entry *)
-		e_malloc(sizeof (struct directory_entry));
-	memset(s_entry, 0, sizeof (struct directory_entry));
-	s_entry->next = this_dir->contents;
-	this_dir->contents = s_entry;
-
-#ifdef SORTING
-	/* inherit any sort weight from parent directory */
-	s_entry->sort = this_dir->sort;
-	s_entry->sort += 2;
-
-	/* see if this entry should have a new weighting */
-	if (do_sort) {
-		s_entry->sort = sort_matches(bootcat_path, s_entry->sort);
-	}
-#endif /* SORTING */
-
-	s_entry->isorec.flags[0] = ISO_FILE;
-	s_entry->priority = 32768;
-	iso9660_date(s_entry->isorec.date, fstatbuf.st_mtime);
-	s_entry->inode = TABLE_INODE;
-	s_entry->dev = (dev_t) UNCACHED_DEVICE;
-	set_723(s_entry->isorec.volume_sequence_number,
-						volume_sequence_number);
-	set_733((char *) s_entry->isorec.size, SECTOR_SIZE);
-	s_entry->size = SECTOR_SIZE;
-	s_entry->filedir = this_dir;
-	s_entry->name = strdup(p2);
-	iso9660_file_length(p2, s_entry, 0);
-
-	/* flag file as necessary */
-	s_entry->de_flags = bcat_de_flags;
-
-	if ((use_XA || use_RockRidge) &&
-	    !(bcat_de_flags & INHIBIT_ISO9660_ENTRY)) {
-		fstatbuf.st_mode = 0444 | S_IFREG;
-		fstatbuf.st_nlink = 1;
-		generate_xa_rr_attributes("",
-			p2, s_entry,
-			&fstatbuf, &fstatbuf, 0);
-	}
-	/*
-	 *  memory files are stored at s_entry->table
-	 * - but this is also used for each s_entry to generate
-	 * TRANS.TBL entries. So if we are generating tables,
-	 * store the TRANS.TBL data here for the moment
-	 */
-	if (generate_tables && !(bcat_de_flags & INHIBIT_ISO9660_ENTRY)) {
-		sprintf(buffer, "F\t%s\n", s_entry->name);
-
-		/* copy the TRANS.TBL entry info and clear the buffer */
-		s_entry->table = strdup(buffer);
-		memset(buffer, 0, SECTOR_SIZE);
-
-		/*
-		 * store the (empty) file data in the
-		 * unused s_entry->whole_name element for the time being
-		 * - this will be transferred to s_entry->table after any
-		 * TRANS.TBL processing later
-		 */
-		s_entry->whole_name = buffer;
-	} else {
-		/* store the (empty) file data in the s_entry->table element */
-		s_entry->table = buffer;
-		s_entry->whole_name = NULL;
-	}
-}
-
-static void
-get_torito_desc(struct eltorito_boot_descriptor *boot_desc)
-{
-	int			checksum;
-	unsigned char		*checksum_ptr;
-	struct directory_entry	*de2;	/* Boot catalog */
-	int			i;
-	int			offset;
-	struct eltorito_defaultboot_entry boot_desc_record;
-
-	memset(boot_desc, 0, sizeof (*boot_desc));
-	boot_desc->type[0] = 0;
-	memcpy(boot_desc->id, ISO_STANDARD_ID, sizeof (ISO_STANDARD_ID));
-	boot_desc->version[0] = 1;
-
-	memcpy(boot_desc->system_id, EL_TORITO_ID, sizeof (EL_TORITO_ID));
-
-	/*
-	 * search from root of iso fs to find boot catalog
-	 * - we already know where the boot catalog is
-	 * - we created it above - but lets search for it anyway
-	 * - good sanity check!
-	 */
-	de2 = search_tree_file(root, boot_catalog);
-	if (!de2 || !(de2->de_flags & MEMORY_FILE)) {
-#ifdef	USE_LIBSCHILY
-		comerrno(EX_BAD, "Uh oh, I cant find the boot catalog '%s'!\n",
-							boot_catalog);
-#else
-		fprintf(stderr, "Uh oh, I cant find the boot catalog '%s'!\n",
-							boot_catalog);
-		exit(1);
-#endif
-	}
-	set_731(boot_desc->bootcat_ptr,
-		(unsigned int) get_733(de2->isorec.extent));
-
-	/*
-	 * we have the boot image, so write boot catalog information
-	 * Next we write out the primary descriptor for the disc
-	 */
-	memset(&valid_desc, 0, sizeof (valid_desc));
-	valid_desc.headerid[0] = 1;
-	valid_desc.arch[0] = EL_TORITO_ARCH_x86;
-
-	/*
-	 * we'll shove start of publisher id into id field,
-	 * may get truncated but who really reads this stuff!
-	 */
-	if (publisher)
-		memcpy_max(valid_desc.id, publisher,
-						MIN(23, strlen(publisher)));
-
-	valid_desc.key1[0] = (char) 0x55;
-	valid_desc.key2[0] = (char) 0xAA;
-
-	/* compute the checksum */
-	checksum = 0;
-	checksum_ptr = (unsigned char *) &valid_desc;
-	/* Set checksum to 0 before computing checksum */
-	set_721(valid_desc.cksum, 0);
-	for (i = 0; i < (int)sizeof (valid_desc); i += 2) {
-		checksum += (unsigned int) checksum_ptr[i];
-		checksum += ((unsigned int) checksum_ptr[i + 1]) * 256;
-	}
-
-	/* now find out the real checksum */
-	checksum = -checksum;
-	set_721(valid_desc.cksum, (unsigned int) checksum);
-
-	/* now write it to the virtual boot catalog */
-	memcpy(de2->table, &valid_desc, 32);
-
-	for (current_boot_entry = first_boot_entry, offset = sizeof (valid_desc);
-		current_boot_entry != NULL;
-		current_boot_entry = current_boot_entry->next,
-		offset += sizeof (boot_desc_record)) {
-
-		if (offset >= SECTOR_SIZE) {
-#ifdef	USE_LIBSCHILY
-			comerrno(EX_BAD,
-			"Too many El Torito boot entries\n");
-#else
-			fprintf(stderr,
-			"Too many El Torito boot entries\n");
-			exit(1);
-#endif
-		}
-		fill_boot_desc(&boot_desc_record, current_boot_entry);
-		memcpy(de2->table + offset, &boot_desc_record,
-					sizeof (boot_desc_record));
-	}
-}/* get_torito_desc(... */
-
-static void
-fill_boot_desc(struct eltorito_defaultboot_entry *boot_desc_entry, 
-					struct eltorito_boot_entry_info *boot_entry)
-{
-	struct directory_entry	*de;	/* Boot file */
-	int			bootmbr;
-	int			i;
-	int			nsectors;
-	int			geosec;
-
-	if (!boot_desc_entry || !boot_entry)
-		return;
-
-	/* now adjust boot catalog lets find boot image first */
-	de = search_tree_file(root, boot_entry->boot_image);
-	if (!de) {
-#ifdef	USE_LIBSCHILY
-		comerrno(EX_BAD, "Uh oh, I cant find the boot image '%s' !\n",
-							boot_entry->boot_image);
-#else
-		fprintf(stderr, "Uh oh, I cant find the boot image '%s' !\n",
-							boot_entry->boot_image);
-		exit(1);
-#endif
-	}
-	/* now make the initial/default entry for boot catalog */
-	memset(boot_desc_entry, 0, sizeof (*boot_desc_entry));
-	boot_desc_entry->boot_id[0] = (char) boot_entry->not_bootable ?
-				EL_TORITO_NOT_BOOTABLE : EL_TORITO_BOOTABLE;
-
-	/* use default BIOS loadpnt */
-	set_721(boot_desc_entry->loadseg, boot_entry->load_addr);
-
-	/*
-	 * figure out size of boot image in 512-byte sectors.
-	 * However, round up to the nearest integral CD (2048-byte) sector.
-	 * This is only used for no-emulation booting.
-	 */
-	nsectors = boot_entry->load_size ? boot_entry->load_size :
-				ISO_BLOCKS(de->size) * (SECTOR_SIZE/512);
-
-	if (verbose > 0) {
-		fprintf(stderr,
-			"Size of boot image is %d sectors -> ", nsectors);
-	}
-
-	if (boot_entry->hard_disk_boot) {
-		/* sanity test hard disk boot image */
-		boot_desc_entry->boot_media[0] = EL_TORITO_MEDIA_HD;
-		if (verbose > 0)
-			fprintf(stderr, "Emulating a hard disk\n");
-
-		/* read MBR */
-		bootmbr = open(de->whole_name, O_RDONLY | O_BINARY);
-		if (bootmbr == -1) {
-#ifdef	USE_LIBSCHILY
-			comerr("Error opening boot image '%s' for read.\n",
-							de->whole_name);
-#else
-			fprintf(stderr,
-				"Error opening boot image '%s' for read.\n",
-							de->whole_name);
-			perror("");
-			exit(1);
-#endif
-		}
-		if (read(bootmbr, &disk_mbr, sizeof (disk_mbr)) !=
-							sizeof (disk_mbr)) {
-#ifdef	USE_LIBSCHILY
-			comerr("Error reading MBR from boot image '%s'.\n",
-							de->whole_name);
-#else
-			fprintf(stderr,
-				"Error reading MBR from boot image '%s'.\n",
-							de->whole_name);
-			exit(1);
-#endif
-		}
-		close(bootmbr);
-		if (la_to_u_2_byte(disk_mbr.magic) != MBR_MAGIC) {
-#ifdef	USE_LIBSCHILY
-			errmsgno(EX_BAD,
-			"Warning: boot image '%s' MBR is not a boot sector.\n",
-							de->whole_name);
-#else
-			fprintf(stderr,
-				"Warning: boot image '%s' MBR is not a boot sector.\n",
-							de->whole_name);
-#endif
-		}
-		/* find partition type */
-		boot_desc_entry->sys_type[0] = PARTITION_UNUSED;
-		for (i = 0; i < PARTITION_COUNT; ++i) {
-			int		s_cyl_sec;
-			int		e_cyl_sec;
-
-			s_cyl_sec =
-			la_to_u_2_byte(disk_mbr.partition[i].s_cyl_sec);
-			e_cyl_sec =
-			la_to_u_2_byte(disk_mbr.partition[i].e_cyl_sec);
-
-			if (disk_mbr.partition[i].type != PARTITION_UNUSED) {
-				if (boot_desc_entry->sys_type[0] !=
-							PARTITION_UNUSED) {
-#ifdef	USE_LIBSCHILY
-					comerrno(EX_BAD,
-					"Boot image '%s' has multiple partitions.\n",
-							de->whole_name);
-#else
-					fprintf(stderr,
-					"Boot image '%s' has multiple partitions.\n",
-							de->whole_name);
-					exit(1);
-#endif
-				}
-				boot_desc_entry->sys_type[0] =
-						disk_mbr.partition[i].type;
-
-				/* a few simple sanity warnings */
-				if (!boot_entry->not_bootable &&
-				    disk_mbr.partition[i].status !=
-							PARTITION_ACTIVE) {
-					fprintf(stderr,
-					"Warning: partition not marked active.\n");
-				}
-				if (MBR_CYLINDER(s_cyl_sec) != 0 ||
-					disk_mbr.partition[i].s_head != 1 ||
-					MBR_SECTOR(s_cyl_sec != 1)) {
-					fprintf(stderr,
-					"Warning: partition does not start at 0/1/1.\n");
-				}
-				geosec = (MBR_CYLINDER(e_cyl_sec) + 1) *
-					(disk_mbr.partition[i].e_head + 1) *
-					MBR_SECTOR(e_cyl_sec);
-				if (geosec != nsectors) {
-					fprintf(stderr,
-					"Warning: image size does not match geometry (%d)\n",
-						geosec);
-				}
-#ifdef DEBUG_TORITO
-				fprintf(stderr, "Partition start %u/%u/%u\n",
-					MBR_CYLINDER(s_cyl_sec),
-					disk_mbr.partition[i].s_head,
-					MBR_SECTOR(s_cyl_sec));
-				fprintf(stderr, "Partition end %u/%u/%u\n",
-					MBR_CYLINDER(e_cyl_sec),
-					disk_mbr.partition[i].e_head,
-					MBR_SECTOR(e_cyl_sec));
-#endif
-			}
-		}
-		if (boot_desc_entry->sys_type[0] == PARTITION_UNUSED) {
-#ifdef	USE_LIBSCHILY
-			comerrno(EX_BAD,
-					"Boot image '%s' has no partitions.\n",
-							de->whole_name);
-#else
-			fprintf(stderr,
-					"Boot image '%s' has no partitions.\n",
-							de->whole_name);
-			exit(1);
-#endif
-		}
-#ifdef DEBUG_TORITO
-		fprintf(stderr, "Partition type %u\n",
-						boot_desc_entry->sys_type[0]);
-#endif
-	/* load single boot sector, in this case the MBR */
-		nsectors = 1;
-
-	} else if (boot_entry->no_emul_boot) {
-		/*
-		 * no emulation is a simple image boot of all the sectors
-		 * in the boot image
-		 */
-		boot_desc_entry->boot_media[0] = EL_TORITO_MEDIA_NOEMUL;
-		if (verbose > 0)
-			fprintf(stderr, "No emulation\n");
-
-	} else {
-		/* choose size of emulated floppy based on boot image size */
-		if (nsectors == 2880) {
-			boot_desc_entry->boot_media[0] = EL_TORITO_MEDIA_144FLOP;
-			if (verbose > 0)
-				fprintf(stderr, "Emulating a 1440 kB floppy\n");
-
-		} else if (nsectors == 5760) {
-			boot_desc_entry->boot_media[0] = EL_TORITO_MEDIA_288FLOP;
-			if (verbose > 0)
-				fprintf(stderr, "Emulating a 2880 kB floppy\n");
-
-		} else if (nsectors == 2400) {
-			boot_desc_entry->boot_media[0] = EL_TORITO_MEDIA_12FLOP;
-			if (verbose > 0)
-				fprintf(stderr, "Emulating a 1200 kB floppy\n");
-
-		} else {
-#ifdef	USE_LIBSCHILY
-			comerrno(EX_BAD,
-			"Error - boot image '%s' has not an allowable size.\n",
-							de->whole_name);
-#else
-			fprintf(stderr,
-			"Error - boot image '%s' has not an allowable size.\n",
-							de->whole_name);
-			exit(1);
-#endif
-		}
-
-		/* load single boot sector for floppies */
-		nsectors = 1;
-	}
-
-	/* fill in boot image details */
-#ifdef DEBUG_TORITO
-	fprintf(stderr, "Boot %u sectors\n", nsectors);
-	fprintf(stderr, "Extent of boot images is %d\n",
-				get_733(de->isorec.extent));
-#endif
-	set_721(boot_desc_entry->nsect, (unsigned int) nsectors);
-	set_731(boot_desc_entry->bootoff,
-		(unsigned int) get_733(de->isorec.extent));
-
-
-	/* If the user has asked for it, patch the boot image */
-	if (boot_entry->boot_info_table) {
-		int		bootimage;
-		unsigned int	bi_checksum;
-		unsigned int	total_len;
-		static char	csum_buffer[SECTOR_SIZE];
-		int		len;
-		struct mkisoimage_boot_info bi_table;
-
-		bootimage = open(de->whole_name, O_RDWR | O_BINARY);
-		if (bootimage == -1) {
-#ifdef	USE_LIBSCHILY
-			comerr(
-			"Error opening boot image file '%s' for update.\n",
-							de->whole_name);
-#else
-			fprintf(stderr,
-			"Error opening boot image file '%s' for update.\n",
-							de->whole_name);
-			perror("");
-			exit(1);
-#endif
-		}
-	/* Compute checksum of boot image, sans 64 bytes */
-		total_len = 0;
-		bi_checksum = 0;
-		while ((len = read(bootimage, csum_buffer, SECTOR_SIZE)) > 0) {
-			if (total_len & 3) {
-#ifdef	USE_LIBSCHILY
-				comerrno(EX_BAD,
-				"Odd alignment at non-end-of-file in boot image '%s'.\n",
-							de->whole_name);
-#else
-				fprintf(stderr,
-				"Odd alignment at non-end-of-file in boot image '%s'.\n",
-							de->whole_name);
-				exit(1);
-#endif
-			}
-			if (total_len < 64)
-				memset(csum_buffer, 0, 64 - total_len);
-			if (len < SECTOR_SIZE)
-				memset(csum_buffer + len, 0, SECTOR_SIZE-len);
-			for (i = 0; i < SECTOR_SIZE; i += 4)
-				bi_checksum += get_731(&csum_buffer[i]);
-			total_len += len;
-		}
-
-		if (total_len != de->size) {
-#ifdef	USE_LIBSCHILY
-			comerrno(EX_BAD,
-			"Boot image file '%s' changed underneath us!\n",
-						de->whole_name);
-#else
-			fprintf(stderr,
-			"Boot image file '%s' changed underneath us!\n",
-						de->whole_name);
-			exit(1);
-#endif
-		}
-		/* End of file, set position to byte 8 */
-		lseek(bootimage, (off_t)8, SEEK_SET);
-		memset(&bi_table, 0, sizeof (bi_table));
-		/* Is it always safe to assume PVD is at session_start+16? */
-		set_731(bi_table.bi_pvd, session_start + 16);
-		set_731(bi_table.bi_file, de->starting_block);
-		set_731(bi_table.bi_length, de->size);
-		set_731(bi_table.bi_csum, bi_checksum);
-
-		write(bootimage, &bi_table, sizeof (bi_table));
-		close(bootimage);
-	}
-}/* fill_boot_desc(... */
-
-void
-get_boot_entry()
-{
-	if (current_boot_entry)
-		return;
-
-	current_boot_entry = (struct eltorito_boot_entry_info *)
-			e_malloc(sizeof (struct eltorito_boot_entry_info));
-	memset(current_boot_entry, 0, sizeof (*current_boot_entry));
-
-	if (!first_boot_entry) {
-		first_boot_entry = current_boot_entry;
-		last_boot_entry = current_boot_entry;
-	} else {
-		last_boot_entry->next = current_boot_entry;
-		last_boot_entry = current_boot_entry;
-	}
-}
-
-void
-new_boot_entry()
-{
-	current_boot_entry = NULL;
-}
-
-/*
- * Function to write the EVD for the disc.
- */
-static int
-tvd_write(FILE *outfile)
-{
-	/* check the boot image is not NULL */
-	if (!boot_image) {
-#ifdef	USE_LIBSCHILY
-		comerrno(EX_BAD, "No boot image specified.\n");
-#else
-		fprintf(stderr, "No boot image specified.\n");
-		exit(1);
-#endif
-	}
-	/* Next we write out the boot volume descriptor for the disc */
-	get_torito_desc(&gboot_desc);
-	jtwrite(&gboot_desc, SECTOR_SIZE, 1, 0, FALSE);
-	xfwrite(&gboot_desc, SECTOR_SIZE, 1, outfile, 0, FALSE);
-	last_extent_written++;
-	return (0);
-}
-
-struct output_fragment torito_desc = {NULL, oneblock_size, NULL, tvd_write, "Eltorito Volume Descriptor"};

Copied: cdrkit/trunk/genisoimage/eltorito.c (from rev 452, cdrkit/trunk/mkisoimage/eltorito.c)

Deleted: cdrkit/trunk/genisoimage/files.c
===================================================================
--- cdrkit/trunk/mkisoimage/files.c	2006-11-23 21:37:32 UTC (rev 450)
+++ cdrkit/trunk/genisoimage/files.c	2006-11-23 22:11:41 UTC (rev 453)
@@ -1,403 +0,0 @@
-/*
- * This file has been modified for the cdrkit suite.
- *
- * The behaviour and appearence of the program code below can differ to a major
- * extent from the version distributed by the original author(s).
- *
- * For details, see Changelog file distributed with the cdrkit package. If you
- * received this file from another source then ask the distributing person for
- * a log of modifications.
- *
- */
-
-/* @(#)files.c	1.12 04/03/04 joerg */
-#ifndef lint
-static	char sccsid[] =
-	"@(#)files.c	1.12 04/03/04 joerg";
-
-#endif
-/*
- * File files.c - Handle ADD_FILES related stuff.
- *
- * Written by Eric Youngdale (1993).
- *
- * Copyright 1993 Yggdrasil Computing, Incorporated
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-/* ADD_FILES changes made by Ross Biro biro at yggdrasil.com 2/23/95 */
-
-#include <mconfig.h>
-#include "mkisoimage.h"
-#include <errno.h>
-#include <schily.h>
-#include <ctype.h>
-
-#ifdef ADD_FILES
-
-void	add_one_file(char *addpath, char *path);
-void	add_file_list(int argc, char **argv, int ind);
-void	add_file(char *filename);
-char *look_up_addition(char **newpath, char *path, struct dirent **de);
-void	nuke_duplicates(char *path, struct dirent **de);
-struct dirent  *readdir_add_files(char **pathp, char *path, DIR *dir);
-
-struct file_adds {
-	char			*name;
-	struct file_adds	*child;
-	struct file_adds	*next;
-	int			add_count;
-	int			used;
-	union diru {
-	/*
-	 * XXX Struct dirent is not guaranteed to be any size on a POSIX
-	 * XXX compliant system.
-	 * XXX We need to allocate enough space here, to allow the hacky
-	 * XXX code in tree.c made by Ross Biro biro at yggdrasil.com
-	 * XXX to work on operating systems other than Linux :-(
-	 * XXX Changes made by Joerg Schilling
-	 * XXX joerg at schily.isdn.cs.tu-berlin.de
-	 * XXX to prevent core dumps on Solaris.
-	 * XXX Space allocated:
-	 * XXX		1024 bytes == NAME_MAX
-	 * XXX	+	2   bytes for directory record length
-	 * XXX	+	2*8 bytes for inode number & offset (64 for future exp)
-	 */
-		struct dirent	de;
-		char		dspace[NAME_MAX + 2 + 2 * 8];
-	} du;
-	struct {
-		char		*path;
-		char		*name;
-	} *adds;
-};
-extern struct file_adds *root_file_adds;
-
-/*
- * FIXME(eric) - the file adding code really doesn't work very well
- * at all.  We should differentiate between adding directories, and adding
- * single files, as adding a full directory affects how we should be
- * searching for things.  Ideally what we should do is make two passes
- * through the local filesystem - one to figure out what trees we need
- * to scan (and merge in any additions at that point), and the second to
- * actually fill out each structure with the appropriate contents.
- */
-
-struct file_adds *root_file_adds = NULL;
-
-void
-add_one_file(char *addpath, char *path)
-{
-	char			*cp;
-	char			*name;
-	struct file_adds	*f;
-	struct file_adds	*tmp;
-
-	f = root_file_adds;
-	tmp = NULL;
-
-	name = strrchr(addpath, PATH_SEPARATOR);
-	if (name == NULL) {
-		name = addpath;
-	} else {
-		name++;
-	}
-
-	cp = strtok(addpath, SPATH_SEPARATOR);
-
-	while (cp != NULL && strcmp(name, cp)) {
-		if (f == NULL) {
-			root_file_adds = e_malloc(sizeof (*root_file_adds));
-			f = root_file_adds;
-			f->name = NULL;
-			f->child = NULL;
-			f->next = NULL;
-			f->add_count = 0;
-			f->adds = NULL;
-			f->used = 0;
-		}
-		if (f->child) {
-			for (tmp = f->child; tmp->next != NULL;
-							tmp = tmp->next) {
-				if (strcmp(tmp->name, cp) == 0) {
-					f = tmp;
-					goto next;
-				}
-			}
-			if (strcmp(tmp->name, cp) == 0) {
-				f = tmp;
-				goto next;
-			}
-			/* add a new node. */
-			tmp->next = e_malloc(sizeof (*tmp->next));
-			f = tmp->next;
-			f->name = strdup(cp);
-			f->child = NULL;
-			f->next = NULL;
-			f->add_count = 0;
-			f->adds = NULL;
-			f->used = 0;
-		} else {
-			/* no children. */
-			f->child = e_malloc(sizeof (*f->child));
-			f = f->child;
-			f->name = strdup(cp);
-			f->child = NULL;
-			f->next = NULL;
-			f->add_count = 0;
-			f->adds = NULL;
-			f->used = 0;
-
-		}
-next:
-		cp = strtok(NULL, SPATH_SEPARATOR);
-	}
-	/* Now f if non-null points to where we should add things */
-	if (f == NULL) {
-		root_file_adds = e_malloc(sizeof (*root_file_adds));
-		f = root_file_adds;
-		f->name = NULL;
-		f->child = NULL;
-		f->next = NULL;
-		f->add_count = 0;
-		f->adds = NULL;
-	}
-	/* Now f really points to where we should add this name. */
-	f->add_count++;
-	f->adds = realloc(f->adds, sizeof (*f->adds) * f->add_count);
-	f->adds[f->add_count - 1].path = strdup(path);
-	f->adds[f->add_count - 1].name = strdup(name);
-}
-
-/*
- * Function:	add_file_list
- *
- * Purpose:	Register an add-in file.
- *
- * Arguments:
- */
-void
-add_file_list(int argc, char **argv, int ind)
-{
-	char	*ptr;
-	char	*dup_arg;
-
-	while (ind < argc) {
-		dup_arg = strdup(argv[ind]);
-		ptr = strchr(dup_arg, '=');
-		if (ptr == NULL) {
-			free(dup_arg);
-			return;
-		}
-		*ptr = 0;
-		ptr++;
-		add_one_file(dup_arg, ptr);
-		free(dup_arg);
-		ind++;
-	}
-}
-
-void
-add_file(char *filename)
-{
-	char	buff[PATH_MAX];
-	FILE	*f;
-	char	*ptr;
-	char	*p2;
-	int	count = 0;
-
-	if (strcmp(filename, "-") == 0) {
-		f = stdin;
-	} else {
-		f = fopen(filename, "r");
-		if (f == NULL) {
-#ifdef	USE_LIBSCHILY
-			comerr("Cannot open '%s'.\n", filename);
-#else
-			perror("fopen");
-			exit(1);
-#endif
-		}
-	}
-	while (fgets(buff, sizeof (buff), f)) {
-		count++;
-		ptr = buff;
-		while (isspace(*ptr))
-			ptr++;
-		if (*ptr == 0)
-			continue;
-		if (*ptr == '#')
-			continue;
-
-		if (ptr[strlen(ptr) - 1] == '\n')
-			ptr[strlen(ptr) - 1] = 0;
-		p2 = strchr(ptr, '=');
-		if (p2 == NULL) {
-#ifdef	USE_LIBSCHILY
-			comerrno(EX_BAD, "Error in file '%s' line %d: %s\n",
-						filename, count, buff);
-#else
-			fprintf(stderr, "Error in file '%s' line %d: %s\n",
-						filename, count, buff);
-			exit(1);
-#endif
-		}
-		*p2 = 0;
-		p2++;
-		add_one_file(ptr, p2);
-	}
-	if (f != stdin)
-		fclose(f);
-}
-
-/* This function looks up additions. */
-char *
-look_up_addition(char **newpath, char *path, struct dirent **de)
-{
-	char			*dup_path;
-	char			*cp;
-	struct file_adds	*f;
-	struct file_adds	*tmp = NULL;
-
-	f = root_file_adds;
-	if (!f)
-		return (NULL);
-
-	/* I don't trust strtok */
-	dup_path = strdup(path);
-
-	cp = strtok(dup_path, SPATH_SEPARATOR);
-	while (cp != NULL) {
-		for (tmp = f->child; tmp != NULL; tmp = tmp->next) {
-			if (strcmp(tmp->name, cp) == 0)
-				break;
-		}
-		if (tmp == NULL) {
-			/* no match */
-			free(dup_path);
-			return (NULL);
-		}
-		f = tmp;
-		cp = strtok(NULL, SPATH_SEPARATOR);
-	}
-	free(dup_path);
-
-	/* If nothing, then return. */
-	if (tmp == NULL) {
-	/* no match */
-		return (NULL);
-	}
-	/* looks like we found something. */
-	if (tmp->used >= tmp->add_count)
-		return (NULL);
-
-	*newpath = tmp->adds[tmp->used].path;
-	tmp->used++;
-	*de = &(tmp->du.de);
-	return (tmp->adds[tmp->used - 1].name);
-
-}
-
-/* This function looks up additions. */
-void
-nuke_duplicates(char *path, struct dirent **de)
-{
-	char			*dup_path;
-	char			*cp;
-	struct file_adds	*f;
-	struct file_adds	*tmp;
-
-	f = root_file_adds;
-	if (!f)
-		return;
-
-	/* I don't trust strtok */
-	dup_path = strdup(path);
-
-	cp = strtok(dup_path, SPATH_SEPARATOR);
-	while (cp != NULL) {
-		for (tmp = f->child; tmp != NULL; tmp = tmp->next) {
-			if (strcmp(tmp->name, cp) == 0)
-				break;
-		}
-		if (tmp == NULL) {
-			/* no match */
-			free(dup_path);
-			return;
-		}
-		f = tmp;
-		cp = strtok(NULL, SPATH_SEPARATOR);
-	}
-	free(dup_path);
-
-#if 0
-	/* looks like we found something. */
-	if (tmp->used >= tmp->add_count)
-		return;
-
-	*newpath = tmp->adds[tmp->used].path;
-	tmp->used++;
-	*de = &(tmp->du.de);
-	return (tmp->adds[tmp->used - 1].name);
-#endif
-}
-
-/*
- * This function lets us add files from outside the standard file tree.
- * It is useful if we want to duplicate a cd, but add/replace things.
- * We should note that the real path will be used for exclusions.
- */
-
-struct dirent  *
-readdir_add_files(char **pathp, char **path, DIR *dir)
-{
-	struct dirent  *de;
-
-	char	*addpath;
-	char	*name;
-
-	de = readdir(dir);
-	if (de) {
-		nuke_duplicates(path, &de);
-		return (de);
-	}
-	name = look_up_addition(&addpath, path, &de);
-
-	if (!name) {
-		return (NULL);
-	}
-	*pathp = addpath;
-
-	/*
-	 * Now we must create the directory entry.
-	 * fortuneately only the name seems to matter.
-	 */
-/*	de->d_ino = -1; de->d_off = 0; de->d_reclen = strlen (name); */
-	strncpy(de->d_name, name, NAME_MAX);
-	de->d_name[NAME_MAX] = 0;
-	nuke_duplicates(path, &de);
-	return (de);
-
-}
-
-#else
-struct dirent  *
-readdir_add_files(char **pathp, char *path, DIR *dir)
-{
-	return (readdir(dir));
-}
-
-#endif

Copied: cdrkit/trunk/genisoimage/files.c (from rev 452, cdrkit/trunk/mkisoimage/files.c)

Copied: cdrkit/trunk/genisoimage/genisoimage.8 (from rev 452, cdrkit/trunk/mkisoimage/genisoimage.8)
===================================================================
--- cdrkit/trunk/mkisoimage/genisoimage.8	2006-11-23 21:59:20 UTC (rev 452)
+++ cdrkit/trunk/genisoimage/genisoimage.8	2006-11-23 22:11:41 UTC (rev 453)
@@ -0,0 +1,3036 @@
+'\" t
+.\" To print, first run through tbl
+.\" -*- nroff -*-
+.\" @(#)genisoimage.8	1.109 05/05/01 joerg
+.\"
+.if t .ds a \v'-0.55m'\h'0.00n'\z.\h'0.40n'\z.\v'0.55m'\h'-0.40n'a
+.if t .ds o \v'-0.55m'\h'0.00n'\z.\h'0.45n'\z.\v'0.55m'\h'-0.45n'o
+.if t .ds u \v'-0.55m'\h'0.00n'\z.\h'0.40n'\z.\v'0.55m'\h'-0.40n'u
+.if t .ds A \v'-0.77m'\h'0.25n'\z.\h'0.45n'\z.\v'0.77m'\h'-0.70n'A
+.if t .ds O \v'-0.77m'\h'0.25n'\z.\h'0.45n'\z.\v'0.77m'\h'-0.70n'O
+.if t .ds U \v'-0.77m'\h'0.30n'\z.\h'0.45n'\z.\v'0.77m'\h'-0.75n'U
+.if t .ds s \\(*b
+.if t .ds S SS
+.if n .ds a ae
+.if n .ds o oe
+.if n .ds u ue
+.if n .ds s sz
+.TH GENISOIMAGE 8 "24 Aug 2006" "Version 2.01"
+.SH NAME
+genisoimage \- create an hybrid ISO9660/JOLIET/HFS filesystem with optional Rock Ridge attributes.
+.SH SYNOPSIS
+.B genisoimage
+[
+.I options
+]
+[
+.B \-o
+.I filename
+]
+.I pathspec [pathspec ...]
+.SH DESCRIPTION
+.B genisoimage
+is a pre-mastering program to generate ISO9660/JOLIET/HFS hybrid
+filesystems.
+.PP
+.B genisoimage
+is capable of generating the 
+.B "System Use Sharing Protocol records (SUSP)
+specified
+by the 
+.B "Rock Ridge Interchange Protocol.
+This is used to further describe the
+files in the ISO9660 filesystem to a Unix host, and provides information such
+as long filenames, UID/GID, POSIX permissions, symbolic links,
+block and character devices.
+.PP
+If Joliet or HFS hybrid command line options are specified, 
+.B genisoimage
+will create the additional filesystem metadata needed for Joliet or HFS.
+If no Joliet or HFS hybrid command line options are given,
+.B genisoimage
+will generate a pure ISO9660 filesystem.
+.PP
+.B genisoimage
+can generate a 
+.I true
+(or
+.IR shared )
+HFS hybrid filesystem. The same files are seen as HFS files when
+accessed from a Macintosh and as ISO9660 files when accessed from other 
+machines. HFS stands for
+.I Hierarchical File System
+and is the native file system used on Macintosh computers.
+.PP
+As an alternative,
+.B genisoimage
+can generate the
+.I Apple Extensions to ISO9660
+for each file. These extensions provide each file with CREATOR, TYPE and
+certain Finder Flags when accessed from a Macintosh. See the
+.B HFS MACINTOSH FILE FORMATS
+section below.
+.PP
+.B genisoimage
+takes a snapshot of a given directory tree, and generates a
+binary image which will correspond to an ISO9660 or HFS filesystem when
+written to a block device.
+.PP
+Each file written to the ISO9660 filesystem must have a filename in the 8.3
+format (8 characters, period, 3 characters, all upper case), even if Rock Ridge
+is in use.  This filename is used on systems that are not able to make use of
+the Rock Ridge extensions (such as MS-DOS), and each filename in each directory
+must be different from the other filenames in the same directory.
+.B genisoimage
+generally tries to form correct names by forcing the Unix filename to upper
+case and truncating as required, but often times this yields unsatisfactory
+results when there are cases where the
+truncated names are not all unique.
+.B genisoimage
+assigns weightings to each filename, and if two names that are otherwise the
+same are found the name with the lower priority is renamed to have a 3 digit
+number as an extension (where the number is guaranteed to be unique).  An
+example of this would be the files foo.bar and
+foo.bar.~1~ - the file foo.bar.~1~ would be written as FOO000.BAR;1 and the file
+foo.bar would be written as FOO.BAR;1
+.PP
+When used with various HFS options,
+.B genisoimage
+will attempt to recognise files stored in a number of Apple/Unix file formats
+and will copy the data and resource forks as well as any
+relevant finder information. See the
+.B HFS MACINTOSH FILE FORMATS
+section below for more about formats
+.B genisoimage
+supports.
+.PP
+Note that
+.B genisoimage
+is not designed to communicate with the writer directly.  Most writers
+have proprietary command sets which vary from one manufacturer to
+another, and you need a specialized tool to actually burn the disk.
+.PP
+The
+.B wodim
+utility is a utility capable of burning an actual disc.  The latest version
+of
+.B wodim
+is available from
+http://alioth.debian.org/projects/debburn/
+.PP
+Also you should know that most cd writers are very particular about timing.
+Once you start to burn a disc, you cannot let their buffer empty before you
+are done, or you will end up with a corrupt disc.  Thus it is critical
+that you be able to maintain an uninterrupted data stream to the writer
+for the entire time that the disc is being written.
+.PP
+.B pathspec
+is the path of the directory tree to be copied into the ISO9660 filesystem.
+Multiple paths can be specified, and
+.B
+genisoimage
+will merge the files found in all of the specified path components to form the cdrom
+image.
+.PP
+If the option
+.I \-graft\-points
+has been specified, 
+it is possible to graft the paths at points other than the root
+directory, and it is possible to graft files or directories onto the
+cdrom image with names different than what they have in the source filesystem.  This is
+easiest to illustrate with a couple of examples.   Let's start by assuming that a local
+file ../old.lis exists, and you wish to include it in the cdrom image.
+
+
+	foo/bar/=../old.lis
+
+will include the file old.lis in the cdrom image at /foo/bar/old.lis, while
+
+	foo/bar/xxx=../old.lis
+
+will include the file old.lis in the cdrom image at /foo/bar/xxx.  The
+same sort of syntax can be used with directories as well.
+.B genisoimage
+will create any directories required such that the graft
+points exist on the cdrom image - the directories do not need to
+appear in one of the paths.  By default, any directories that are created on 
+the fly like this will have permissions 0555 and appear to be owned by the
+person running genisoimage.  If you wish other permissions or owners of
+the intermediate directories, see \-uid, \-gid, \-dir\-mode, \-file\-mode and
+\-new\-dir\-mode.
+.PP
+.B genisoimage
+will also run on Win9X/NT4 machines when compiled with Cygnus' cygwin
+(available from http://sourceware.cygnus.com/cygwin/). Therefore most
+references in this man page to
+.I Unix
+can be replaced with
+.IR Win32 .
+
+.SH OPTIONS
+.TP
+.BI \-abstract " FILE
+Specifies the abstract file name.
+There is space on the disc for 37 characters of information.
+This parameter can also be set in the file
+.B \&.m\&kisofsrc
+with ABST=filename.
+If specified in both places, the command line version is used.
+.TP
+.BI \-A " application_id
+Specifies a text string that will be written into the volume header.
+This should describe the application that will be on the disc.  There
+is space on the disc for 128 characters of information.  This parameter can
+also be set in the file
+.B \&.m\&kisofsrc
+with APPI=id.
+If specified in both places, the command line version is used.
+.TP
+.B \-allow\-leading\-dots
+.TP
+.B \-ldots
+Allow ISO9660 filenames to begin with a period.  Usually, a leading dot is
+replaced with an underscore in order to maintain MS-DOS compatibility.
+.br
+This violates the ISO9660 standard, but it happens to work on many systems.
+Use with caution.
+.TP
+.B \-allow\-lowercase
+This options allows lower case characters to appear in ISO9660 file names.
+.br
+This violates the ISO9660 standard, but it happens to work on some systems.
+Use with caution.
+.TP
+.B \-allow\-multidot
+This options allows more than one dot to appear in ISO9660 filenames.
+A leading dot is not affected by this option, it
+may be allowed separately using the
+.B \-allow\-leading\-dots
+option.
+.br
+This violates the ISO9660 standard, but it happens to work on many systems.
+Use with caution.
+.TP
+.BI \-biblio " FILE
+Specifies the bibliographic file name.
+There is space on the disc for 37 characters of information.
+This parameter can also be set in the file
+.B \&.m\&kisofsrc
+with BIBLO=filename.
+If specified in both places, the command line version is used.
+.TP
+.B \-cache\-inodes
+Cache inode and device numbers to find hard links to files.
+If
+.B genisoimage
+finds a hard link (a file with multiple names), then the file will only
+appear once on the CD. This helps to save space on the CD.
+The option
+.B \-cache\-inodes
+is default on Unix like operating systems.
+Be careful when using this option on a filesystem without unique
+inode numbers as it may result in files containing the wrong content on CD.
+.TP
+.B \-no\-cache\-inodes
+Do not cache inode and device numbers.
+This option is needed whenever a filesystem does not have unique
+inode numbers. It is the default on
+.BR Cygwin .
+As the Microsoft operating system that runs below
+.B Cygwin
+is not POSIX compliant, it does not have unique inode numbers.
+Cygwin creates fake inode numbers from a hash algorithm that
+is not 100% correct.
+If
+.B genisoimage
+would cache inodes on Cygwin, it would believe that some files are
+identical although they are not. The result in this case are files
+that contain the wrong content if a significant amount of different
+files (> ~5000) is in inside the tree that is to be archived.
+This does not happen when the
+.B \-no\-cache\-inodes is used, but the disadvantage is that
+.B genisoimage
+cannot detect hardlinks anymore and the resulting CD image may be larger
+than expected.
+.TP
+.BI \-alpha\-boot " alpha_boot_image
+Specifies the path and filename of the boot image to be used when
+making an Alpha/SRM bootable CD. The pathname must be relative to the
+source path specified to
+.B genisoimage.
+.TP
+.BI \-hppa\-bootloader " hppa_bootloader_image
+Specifies the path and filename of the boot image to be used when
+making an HPPA bootable CD. The pathname must be relative to the
+source path specified to
+.B genisoimage.
+Other options are required, at the very least a kernel file name and
+the boot command line. See the
+.B HPPA NOTES
+section below for more information.
+.TP
+.BI \-hppa\-cmdline " hppa_boot_command_line
+Specifies the command line to be passed to the hppa boot loader when
+making a bootable CD. Separate the parameters with spaces or
+commas. More options must be passed to
+.B genisoimage,
+at the very least a kernel file name and the boot loader file
+name. See the
+.B HPPA NOTES
+section below for more information.
+.TP
+.BI \-hppa\-kernel\-32 " hppa_kernel_32
+Specifies the path and filename of the 32-bit kernel image to be used
+when making an HPPA bootable CD. The pathname must be relative to the
+source path specified to
+.B genisoimage.
+Other options are required, at the very least the boot loader file
+name and the boot command line. See the
+.B HPPA NOTES
+section below for more information.
+.TP
+.BI \-hppa\-kernel\-64 " hppa_kernel_64
+Specifies the path and filename of the 64-bit kernel image to be used
+when making an HPPA bootable CD. The pathname must be relative to the
+source path specified to
+.B genisoimage.
+Other options are required, at the very least the boot loader file
+name and the boot command line. See the
+.B HPPA NOTES
+section below for more information.
+.TP
+.BI \-hppa\-ramdisk " hppa_ramdisk_image
+Specifies the path and filename of the ramdisk image to be used when
+making an HPPA bootable CD. The pathname must be relative to the
+source path specified to
+.B genisoimage.
+This parameter is
+.B optional.
+Other options are required, at the very
+least a kernel file name and the boot command line. See the
+.B HPPA NOTES
+section below for more information.
+.TP
+.BI \-mips\-boot " mips_boot_image
+Specifies the path and filename of the boot image to be used when
+making an SGI/big-endian MIPS bootable CD. The pathname must be
+relative to the source path specified to
+.B genisoimage.
+This option may be specified several times to allow the addition of
+multiple boot images, up to a maximum of 15.
+.TP
+.BI \-mipsel\-boot " mipsel_boot_image
+Specifies the path and filename of the boot image to be used when
+making an DEC/little-endian MIPS bootable CD. The pathname must be
+relative to the source path specified to
+.B genisoimage.
+.TP
+.BI \-sparc\-boot " img_sun4,img_sun4c,img_sun4m,img_sun4d,img_sun4e
+Specifies a comma separated list of boot images that are needed to make
+a bootable CD for sparc systems.
+Partition 0 is used for the ISO9660 image, the first image file is mapped
+to partition 1.
+There may be empty fields in the comma separated list.
+The maximum number of possible partitions is 8 so it is impossible to specify
+more than 7 partition images.
+This option is required to make a bootable CD for Sun sparc systems.
+If the
+.B \-B
+or
+.B \-sparc\-boot
+option has been specified, the first sector of the resulting image will
+contain a Sun disk label. This disk label specifies slice 0 for the
+ISO9660 image and slice 1 .\|.\|. slice 7 for the boot images that
+have been specified with this option. Byte offset 512 .\|.\|. 8191
+within each of the additional boot images must contain a primary boot
+that works for the appropriate sparc architecture. The rest of each
+of the images usually contains an ufs filesystem that is used primary
+kernel boot stage.
+.sp
+The implemented boot method is the boot method found with SunOS 4.x and SunOS 5.x.
+However, it does not depend on SunOS internals but only on properties of
+the Open Boot prom. For this reason, it should be usable for any OS
+that boots off a sparc system.
+.sp
+For more information also see the 
+.B NOTES
+section below.
+.sp
+If the special filename
+.B "..."
+is used, the actual and all following boot partitions are mapped to the
+previous partition. If
+.B genisoimage
+is called with
+.BI "\-G " image " \-B " ...
+all boot partitions are mapped to the partition that contains the ISO9660
+filesystem image and the generic boot image that is located in the first
+16 sectors of the disk is used for all architectures.
+.TP
+.BI \-b " eltorito_boot_image
+Specifies the path and filename of the boot image to be used when making
+an "El Torito" bootable CD. The pathname must be relative to the source
+path specified to
+.B genisoimage.
+This option is required to make an "El Torito" bootable CD.
+The boot image must be exactly the size of either a 1200, 1440, or a 2880
+kB floppy, and
+.B genisoimage
+will use this size when creating the output ISO9660
+filesystem. It is assumed that the first 512 byte sector should be read
+from the boot image (it is essentially emulating a normal floppy drive).
+This will work, for example, if the boot image is a LILO based boot floppy.
+.sp
+If the boot image is not an image of a floppy, you need to add one of the
+options:
+.BR \-hard\-disk\-boot " or " \-no\-emul\-boot .
+If the system should not boot off the emulated disk, use
+.BR \-no\-boot .
+.sp
+If the
+.B \-sort
+option has not been specified, the boot images are sorted
+with low priority (+2) to the beginning of the medium.
+If you don't like this, you need to specify a sort weight of 0 for the boot images.
+.TP
+.B \-eltorito\-alt\-boot
+Start with a new set of "El Torito" boot parameters.
+This allows to have more than one El Torito boot on a CD.
+A maximum of 63 El Torito boot entries may be put on a single CD.
+.TP
+.BI \-B " img_sun4,img_sun4c,img_sun4m,img_sun4d,img_sun4e
+.TP
+.BI \-sparc\-boot " img_sun4,img_sun4c,img_sun4m,img_sun4d,img_sun4e
+Specifies a comma separated list of boot images that are needed to make
+a bootable CD for sparc systems.
+Partition 0 is used for the ISO9660 image, the first image file is mapped
+to partition 1.
+There may be empty fields in the comma separated list.
+The maximum number of possible partitions is 8 so it is impossible to specify
+more than 7 partition images.
+This option is required to make a bootable CD for Sun sparc systems.
+If the
+.B \-B
+or
+.B \-sparc\-boot
+option has been specified, the first sector of the resulting image will
+contain a Sun disk label. This disk label specifies slice 0 for the
+ISO9660 image and slice 1 .\|.\|. slice 7 for the boot images that
+have been specified with this option. Byte offset 512 .\|.\|. 8191
+within each of the additional boot images must contain a primary boot
+that works for the appropriate sparc architecture. The rest of each
+of the images usually contains an ufs filesystem that is used primary
+kernel boot stage.
+.sp
+The implemented boot method is the boot method found with SunOS 4.x and SunOS 5.x.
+However, it does not depend on SunOS internals but only on properties of
+the Open Boot prom. For this reason, it should be usable for any OS
+that boots off a sparc system.
+.sp
+For more information also see the 
+.B NOTES
+section below.
+.sp
+If the special filename
+.B "..."
+is used, the actual and all following boot partitions are mapped to the
+previous partition. If
+.B genisoimage
+is called with
+.BI "\-G " image " \-B " ...
+all boot partitions are mapped to the partition that contains the ISO9660
+filesystem image and the generic boot image that is located in the first
+16 sectors of the disk is used for all architectures.
+.TP
+.BI \-G " generic_boot_image
+Specifies the path and filename of the generic boot image to be used when making
+a generic bootable CD.
+The
+.B generic_boot_image
+will be placed on the first 16 sectors of the CD. The first 16 sectors
+are the sectors that are located before the ISO9660 primary volume descriptor.
+If this option is used together with the
+.B \-sparc\-boot
+option, the Sun disk label will overlay the first 512 bytes of the generic
+boot image.
+.TP
+.BI \-hard\-disk\-boot
+Specifies that the boot image used to create "El Torito" bootable CDs is
+a hard disk image. The hard disk image must begin with a master boot
+record that contains a single partition.
+.TP
+.BI \-no\-emul\-boot
+Specifies that the boot image used to create "El Torito" bootable CDs is
+a 'no emulation' image. The system will load and execute this image without
+performing any disk emulation.
+.TP
+.BI \-no\-boot
+Specifies that the created "El Torito" CD should be marked as not bootable. The
+system will provide an emulated drive for the image, but will boot off
+a standard boot device.
+.TP
+.BI \-boot\-load\-seg " segment_address
+Specifies the load segment address of the boot image for no-emulation
+"El Torito" CDs.
+.TP
+.BI \-boot\-load\-size " load_sectors
+Specifies the number of "virtual" (512-byte) sectors to load in
+no-emulation mode.  The default is to load the entire boot file.  Some
+BIOSes may have problems if this is not a multiple of 4.
+.TP
+.BI \-boot\-info\-table
+Specifies that a 56-byte table with information of the CD-ROM layout
+will be patched in at offset 8 in the boot file.  If this option is
+given, the boot file is modified in the source filesystem, so make
+sure to make a copy if this file cannot be easily regenerated!  See
+the
+.B "EL TORITO BOOT INFO TABLE
+section for a description of this table.
+.TP
+.BI \-C " last_sess_start,next_sess_start
+This option is needed when
+.B genisoimage
+is used to create a CD Extra or the image of a second session or a 
+higher level session for a multi session disk.
+The option
+.B \-C
+takes a pair of two numbers separated by a comma. The first number is the
+sector number of the first sector in the last session of the disk
+that should be appended to.
+The second number is the starting sector number of the new session.
+The expected pair of numbers may be retrieved by calling
+.B "wodim \-msinfo ...
+If the
+.B \-C
+option is used in conjunction with the
+.B \-M
+option,
+.B genisoimage
+will create a filesystem image that is intended to be a continuation
+of the previous session.
+If the
+.B \-C
+option is used without the
+.B \-M
+option,
+.B genisoimage
+will create a filesystem image that is intended to be used for a second
+session on a CD Extra. This is a multi session CD that holds audio data
+in the first session and a ISO9660 filesystem in the second session.
+.TP
+.BI \-c " boot_catalog
+Specifies the path and filename of the boot catalog to be used when making
+an "El Torito" bootable CD. The pathname must be relative to the source
+path specified to
+.B genisoimage.
+This option is required to make a bootable CD.
+This file will be inserted into the output tree and not created
+in the source filesystem, so be
+sure the specified filename does not conflict with an existing file, as
+it will be excluded. Usually a name like "boot.catalog" is
+chosen.
+.sp
+If the
+.B \-sort
+option has not been specified, the boot catalog sorted
+with low priority (+1) to the beginning of the medium.
+If you don't like this, you need to specify a sort weight of 0 for the boot catalog.
+.TP
+.B \-check\-oldnames
+Check all filenames imported from old session for compliance with
+actual 
+.B genisoimage 
+ISO9660 file naming rules.
+It his option is not present, only names with a length > 31 are checked
+as these files are a hard violation of the ISO9660 standard.
+.TP
+.BI \-check\-session " FILE
+Check all old sessions for compliance with
+actual 
+.B genisoimage 
+ISO9660 file naming rules.
+This is a high level option that is a combination of the options:
+.BI \-M " FILE " "\-C 0,0 \-check\-oldnames
+For the parameter 
+.I FILE
+see description of
+.B \-M
+option.
+.TP
+.BI \-copyright " FILE
+Specifies the copyright file name.
+There is space on the disc for 37 characters of information.
+This parameter can also be set in the file
+.B \&.m\&kisofsrc
+with COPY=filename.
+If specified in both places, the command line version is used.
+.TP
+.B \-d
+Omit trailing period from files that do not have a period.
+.br
+This violates the ISO9660 standard, but it happens to work on many systems.
+Use with caution.
+.TP
+.B \-D
+Do not use deep directory relocation, and instead just pack them in the
+way we see them.
+.br
+If ISO9660:1999 has not been selected,
+this violates the ISO9660 standard, but it happens to work on many systems.
+Use with caution.
+.TP
+.BI \-dir\-mode " mode
+Overrides the mode of directories used to create the image to
+.IR mode .
+Specifying this option automatically enables Rock Ridge extensions.
+.TP
+.B \-dvd\-video
+Generate a DVD-Video compliant UDF file system. This is done by sorting the
+order of the content of the appropriate files and by adding padding 
+between the files if needed.
+Note that the sorting only works if the DVD-Video filenames include upper case
+characters only.
+.br
+.br
+Note that in order to get a DVD-Video compliant filesystem image, you need
+to prepare a DVD-Video compliant directory tree. This means you need to
+have a directory VIDEO_TS (all caps) in the root directory of the resulting DVD
+and you should have a directory AUDIO_TS. The directory VIDEO_TS needs to
+include all needed files (file names must be all caps) for a compliant DVD-Video
+filesystem.
+.TP
+.B \-f
+Follow symbolic links when generating the filesystem.  When this option is not
+in use, symbolic links will be entered using Rock Ridge if enabled, otherwise
+the file will be ignored.
+.TP
+.BI \-file\-mode " mode
+Overrides the mode of regular files used to create the image to
+.IR mode .
+Specifying this option automatically enables Rock Ridge extensions.
+.TP
+.BI \-gid " gid
+Overrides the gid read from the source files to the value of
+.IR gid . 
+Specifying this option automatically enables Rock Ridge extensions.
+.TP
+.B \-gui
+Switch the behaviour for a GUI. This currently makes the output more verbose
+but may have other effects in future.
+.TP
+.B \-graft\-points
+Allow to use graft points for filenames. If this option is used, all filenames
+are checked for graft points. The filename is divided at the first unescaped
+equal sign. All occurrences of '\\\\' and '=' characters must be escaped with '\\\\'
+if 
+.I \-graft\-points
+has been specified.
+.TP
+.BI \-hide " glob
+Hide
+.I glob
+from being seen on the ISO9660 or Rock Ridge directory.
+.I glob
+is a shell wild-card-style pattern that must match any part of the filename 
+or path.
+Multiple globs may be hidden.
+If
+.I glob
+matches a directory, then the contents of that directory will be hidden.
+In order to match a directory name, make sure the pathname does not include
+a trailing '/' character.
+All the hidden files will still be written to the output CD image file.
+Should be used with the
+.B \-hide\-joliet
+option. See README.hide for more details.
+.TP
+.BI \-hide\-list " file
+A file containing a list of
+.I globs
+to be hidden as above.
+.TP
+.BI \-hidden " glob
+Add the hidden (existence) ISO9660 directory attribute for
+.IR glob .
+This attribute will prevent 
+.I glob
+from being listed on DOS based systems if the /A flag is not used for the listing.
+.I glob
+is a shell wild-card-style pattern that must match any part of the filename 
+or path.
+In order to match a directory name, make sure the pathname does not include
+a trailing '/' character.
+Multiple globs may be hidden.
+.TP
+.BI \-hidden\-list " file
+A file containing a list of
+.I globs
+to get the hidden attribute as above.
+.TP
+.BI \-hide\-joliet " glob
+Hide
+.I glob
+from being seen on the Joliet directory.
+.I glob
+is a shell wild-card-style pattern that must match any part of the filename 
+or path.
+Multiple globs may be hidden.
+If
+.I glob
+matches a directory, then the contents of that directory will be hidden.
+In order to match a directory name, make sure the pathname does not include
+a trailing '/' character.
+All the hidden files will still be written to the output CD image file.
+Should be used with the
+.B \-hide
+option. See README.hide for more details.
+.TP
+.BI \-hide\-joliet\-list " file
+A file containing a list of
+.I globs
+to be hidden as above.
+.TP
+.B \-hide\-joliet\-trans\-tbl
+Hide the
+.B TRANS.TBL
+files from the Joliet tree.
+These files usually don't make sense in the Joliet World as they list
+the real name and the ISO9660 name which may both be different from the
+Joliet name.
+.TP
+.B \-hide\-rr\-moved
+Rename the directory
+.B RR_MOVED
+to
+.B .rr_moved
+in the Rock Ridge tree.
+It seems to be impossible to completely hide the
+.B RR_MOVED
+directory from the Rock Ridge tree.
+This option only makes the visible tree better to understand for
+people who don't know what this directory is for.
+If you need to have no
+.B RR_MOVED
+directory at all, you should use the
+.B \-D
+option. Note that in case that the
+.B \-D
+option has been specified, the resulting filesystem is not ISO9660
+level-1 compliant and will not be readable on MS-DOS.
+See also 
+.B NOTES
+section for more information on the 
+.B RR_MOVED
+directory.
+.TP
+.BI \-input\-charset " charset
+Input charset that defines the characters used in local file names.
+To get a list of valid charset names, call
+.B "genisoimage \-input\-charset help.
+To get a 1:1 mapping, you may use
+.B default
+as charset name. The default initial values are
+.I cp437
+on DOS based systems and
+.I iso8859-1
+on all other systems.
+See 
+.B "CHARACTER SETS
+section below for more details.
+.TP
+.BI \-output\-charset " charset
+Output charset that defines the characters that will be used in Rock Ridge
+file names. Defaults to the input charset. See
+.B "CHARACTER SETS
+section below for more details.
+.TP
+.BI \-iso\-level " level
+Set the ISO9660 conformance level. Valid numbers are 1..3 and 4.
+.sp
+With level 1, files may only consist of one section and filenames are
+restricted to 8.3 characters.
+.sp
+With level 2, files may only consist of one section.
+.sp
+With level 3, no restrictions (other than ISO-9660:1988) do apply.
+.sp
+With all ISO9660 levels from 1..3, all filenames are restricted to upper
+case letters, numbers and the underscore (_). The maximum filename
+length is restricted to 31 characters, the directory nesting level
+is restricted to 8 and the maximum path length is limited to 255 characters.
+.sp
+Level 4 officially does not exists but 
+.B genisoimage
+maps it to ISO-9660:1999 which is ISO9660 version 2.
+.sp
+With level 4, an enhanced volume descriptor with version number
+and file structure version number set to 2 is emitted.
+There may be more than 8 levels of directory nesting,
+there is no need for a file to contain a dot and the dot has no
+more special meaning,
+file names do not have version numbers,
+.\" (f XXX ??? The character used for filling byte positions which are
+.\"     specified to be characters is subject to agreement between the
+.\"     originator and the recipient of the volume),
+the maximum length for files and directory is raised to 207.
+If Rock Ridge is used, the maximum ISO9660 name length is reduced to 197.
+.sp
+When creating Version 2 images,
+.B genisoimage
+emits an enhanced volume descriptor which looks similar to a primary volume
+descriptor but is slightly different. Be careful not to use broken software
+to make ISO9660 images bootable by assuming a second PVD copy and patching 
+this putative PVD copy into an El Torito VD.
+.TP
+.B \-J
+Generate Joliet directory records in addition to regular ISO9660 file
+names.  This is primarily useful when the discs are to be used on Windows
+machines.  The Joliet filenames are specified in Unicode and
+each path component can be up to 64 Unicode characters long.
+Note that Joliet is not a standard - CDs that use only Joliet extensions but no
+standard Rock Ridge extensions may usually only be used on Microsoft Win32
+systems. Furthermore, the fact that the filenames are limited to 64 characters
+and the fact that Joliet uses the UTF-16 coding for Unicode characters causes
+interoperability problems.
+.TP
+.B \-joliet\-long
+Allow Joliet filenames to be up to 103 Unicode characters. This breaks the
+Joliet specification - but appears to work. Use with caution. The number
+103 is derived from: the maximum Directory Record Length (254), minus the
+length of Directory Record (33), minus CD-ROM XA System Use Extension
+Information (14), divided by the UTF-16 character size (2).
+.TP
+.BI \-jcharset " charset
+Same as using
+.B \-input\-charset
+.I charset
+and
+.B \-J
+options. See
+.B "CHARACTER SETS
+section below for more details.
+.TP
+.B \-l
+Allow full 31 character filenames.  Normally the ISO9660 filename will be in an
+8.3 format which is compatible with MS-DOS, even though the ISO9660 standard
+allows filenames of up to 31 characters.  If you use this option, the disc may
+be difficult to use on a MS-DOS system, but this comes in handy on some other
+systems (such as the Amiga).
+Use with caution.
+.TP
+.B \-L
+Outdated option reserved by POSIX.1-2001, use
+.B \-allow\-leading\-dots
+instead.
+This option will get POSIX.1-2001 semantics with genisoimage-2.02.
+.TP
+.BI \-jigdo\-jigdo " jigdo_file
+Produce a jigdo .jigdo file as well as the .iso. See the
+.B JIGDO NOTES
+section below for more information.
+.TP
+.BI \-jigdo\-template " template_file
+Produce a jigdo .template file as well as the .iso. See the
+.B JIGDO NOTES
+section below for more information.
+.TP
+.BI \-jigdo\-min\-file\-size " size
+Specify the minimum size for a file to be listed in the .jigdo
+file. Default (and minimum allowed) is 1KB. See the
+.B JIGDO NOTES
+section below for more information.
+.TP
+.BI \-jigdo\-force\-md5 " path
+Specify a file pattern where files MUST be contained in the
+externally-suplied MD5 list as supplied by \-md5\-list. See the
+.B JIGDO NOTES
+section below for more information.
+.TP
+.BI \-jigdo\-exclude " path
+Specify a file pattern where files will not be listed in the .jigdo
+file. See the
+.B JIGDO NOTES
+section below for more information.
+.TP
+.BI \-jigdo\-map " path
+Specify a pattern mapping for the jigdo file
+(e.g. Debian=/mirror/debian). See the
+.B JIGDO NOTES
+section below for more information.
+.TP
+.BI \-md5\-list " md5_file
+Specify a file containing the MD5sums, sizes and pathnames of the
+files to be included in the .jigdo file. See the
+.B JIGDO NOTES
+section below for more information.
+.TP
+.BI \-log\-file " log_file
+Redirect all error, warning and informational messages to
+.I log_file
+instead of the standard error.
+.TP
+.BI \-m " glob
+Exclude
+.I glob
+from being written to CD-ROM.
+.I glob
+is a shell wild-card-style pattern that must match part of the filename (not 
+the path as with option
+.BR \-x ).
+Technically
+.I glob
+is matched against the
+.I d->d_name
+part of the directory entry.
+Multiple globs may be excluded.
+Example:
+
+genisoimage \-o rom \-m '*.o' \-m core \-m foobar
+
+would exclude all files ending in ".o", called "core" or "foobar" to be
+copied to CD-ROM. Note that if you had a directory called "foobar" it too (and
+of course all its descendants) would be excluded.
+.sp
+NOTE: The
+.B \-m
+and
+.B \-x
+option description should both be updated, they are wrong.
+Both now work identical and use filename globbing. A file is excluded if either
+the last component matches or the whole path matches.
+.TP
+.BI \-exclude\-list " file
+A file containing a list of
+.I globs
+to be exclude as above.
+.TP
+.B \-max\-iso9660\-filenames
+Allow 37 chars in ISO9660 filenames.
+This option forces the
+.B \-N
+option as the extra name space is taken from the space reserved for
+ISO9660 version numbers.
+.br
+This violates the ISO9660 standard, but it happens to work on many systems.
+Although a conforming application needs to provide a buffer space of at
+least 37 characters, disks created with this option may cause a buffer
+overflow in the reading operating system. Use with extreme care.
+.TP
+.BI \-M " path
+or
+.TP
+.BI \-M " device
+or
+.TP
+.BI \-dev " device
+Specifies path to existing ISO9660 image to be merged. The alternate form
+takes a SCSI device specifier that uses the same syntax as the
+.B "dev=
+parameter of
+.B wodim.
+The output of 
+.B genisoimage
+will be a new session which should get written to the end of the
+image specified in \-M.  Typically this requires multi-session capability
+for the recorder and cdrom drive that you are attempting to write this
+image to.
+This option may only be used in conjunction with the
+.B \-C
+option.
+.TP
+.B \-N
+Omit version numbers from ISO9660 file names.
+.br
+This violates the ISO9660 standard, but no one really uses the
+version numbers anyway.
+Use with caution.
+.TP
+.BI \-new\-dir\-mode " mode
+Mode to use when creating new directories in the filesystem image.  The default
+mode is 0555.
+.TP
+.B \-nobak
+.TP
+.B \-no\-bak
+Do not include backup files files on the ISO9660 filesystem.
+If the
+.B \-no\-bak
+option is specified, files that contain the characters '~' or '#'
+or end in '.bak' will not be included (these are typically backup files
+for editors under Unix).
+.TP
+.B \-force\-rr
+Do not use the automatic Rock Ridge attributes recognition for previous sessions.
+This helps to show rotten ISO9660 extension records as e.g. created by NERO burning ROM.
+.TP
+.B \-no\-rr
+Do not use the Rock Ridge attributes from previous sessions.
+This may help to avoid getting into trouble when
+.B genisoimage
+finds illegal Rock Ridge signatures on an old session.
+.TP
+.B \-no\-split\-symlink\-components
+Don't split the SL components, but begin a new Continuation Area (CE)
+instead. This may waste some space, but the SunOS 4.1.4 cdrom driver
+has a bug in reading split SL components (link_size = component_size 
+instead of link_size += component_size).
+.sp
+Note that this option has been introduced by Eric Youngdale in 1997.
+It is questionable whether it makes sense at all.
+When it has been introduced,
+.B genisoimage 
+did have a serious bug that did create defective CE signatures if
+a symlink contained `/../'.
+This CE signature bug in
+.B genisoimage
+has been fixed in May 2003.
+.TP
+.B \-no\-split\-symlink\-fields
+Don't split the SL fields, but begin a new Continuation Area (CE)
+instead. This may waste some space, but the SunOS 4.1.4 and
+Solaris 2.5.1 cdrom driver have a bug in reading split SL fields
+(a `/' can be dropped).
+.sp
+Note that this option has been introduced by Eric Youngdale in 1997.
+It is questionable whether it makes sense at all.
+When it has been introduced,
+.B genisoimage 
+did have a serious bug that did create defective CE signatures if
+a symlink contained `/../'.
+This CE signature bug in
+.B genisoimage
+has been fixed in May 2003.
+.TP
+.BI \-o " filename
+is the name of the file to which the ISO9660 filesystem image should be
+written.  This can be a disk file, a tape drive, or it can correspond directly
+to the device name of the optical disc writer.  If not specified, stdout is
+used.  Note that the output can also be a block special device for a regular
+disk drive, in which case the disk partition can be mounted and examined to
+ensure that the premastering was done correctly.
+.TP
+.B \-pad
+Pad the end of the whole image by 150 sectors (300 kB).
+If the option
+.B \-B
+is used, then there is a padding at the end of the ISO9660 partition 
+and before the beginning of the boot partitions.
+The size of this padding is chosen to make the first boot partition start
+on a sector number that is a multiple of 16.
+.sp
+The padding is needed as many operating systems (e.g. Linux)
+implement read ahead bugs in their filesystem I/O. These bugs result in read
+errors on one or more files that are located at the end of a track. They are
+usually present when the CD is written in Track at Once mode or when
+the disk is written as mixed mode CD where an audio track follows the
+data track.
+.sp
+To avoid problems with I/O error on the last file on the filesystem,
+the 
+.B \-pad
+option has been made the default.
+.TP
+.B \-no\-pad
+Do not Pad the end by 150 sectors (300 kB) and do not make the the boot partitions
+start on a multiple of 16 sectors.
+.TP
+.BI \-path\-list " file
+A file containing a list of
+.I pathspec
+directories and filenames to be added to the ISO9660 filesystem. This list
+of pathspecs are processed after any that appear on the command line. If the
+argument is
+.IR \- ,
+then the list is read from the standard input.
+.TP
+.B \-P
+Outdated option reserved by POSIX.1-2001, use
+.B \-publisher
+instead.
+This option will get POSIX.1-2001 semantics with genisoimage-2.02.
+.TP
+.BI \-publisher " publisher_id
+Specifies a text string that will be written into the volume header.
+This should describe the publisher of the CD-ROM, usually with a
+mailing address and phone number.  There is space on the disc for 128
+characters of information.  This parameter can also be set in the file
+.B \&.m\&kisofsrc
+with PUBL=.
+If specified in both places, the command line version is used.
+.TP
+.BI \-p " preparer_id
+Specifies a text string that will be written into the volume header.
+This should describe the preparer of the CD-ROM, usually with a mailing
+address and phone number.  There is space on the disc for 128
+characters of information.  This parameter can also be set in the file
+.B \&.m\&kisofsrc
+with PREP=.
+If specified in both places, the command line version is used.
+.TP
+.B \-print\-size
+Print estimated filesystem size in multiples of the sector size (2048 bytes)
+and exit. This option is needed for
+Disk At Once mode and with some CD-R drives when piping directly into
+.B wodim.
+In this case it is needed to know the size of the filesystem before the
+actual CD creation is done.
+The option \-print\-size allows to get this size from a "dry-run" before
+the CD is actually written.
+Old versions of
+.B genisoimage
+did write this information (among other information) to 
+.IR stderr .
+As this turns out to be hard to parse, the number without any other information
+is now printed on 
+.B stdout
+too.
+If you like to write a simple shell script, redirect
+.B stderr
+and catch the number from
+.BR stdout .
+This may be done with:
+.sp
+.B "cdblocks=` genisoimage \-print\-size \-quiet .\|.\|. `
+.sp
+.B "genisoimage .\|.\|. | wodim .\|.\|. tsize=${cdblocks}s -"
+.TP
+.B \-quiet
+This makes
+.B genisoimage
+even less verbose.  No progress output will be provided.
+.TP
+.B \-R
+Generate SUSP and RR records using the Rock Ridge protocol to further describe
+the files on the ISO9660 filesystem.
+.TP
+.B \-r
+This is like the \-R option, but file ownership and modes are set to
+more useful values.  The uid and gid are set to zero, because they are
+usually only useful on the author's system, and not useful to the
+client.  All the file read bits are set true, so that files and
+directories are globally readable on the client.  If any execute bit is
+set for a file, set all of the execute bits, so that executables are
+globally executable on the client.  If any search bit is set for a
+directory, set all of the search bits, so that directories are globally
+searchable on the client.  All write bits are cleared, because the
+filesystem will be mounted read-only in any case.  If any of the special
+mode bits are set, clear them, because file locks are not useful on a
+read-only file system, and set-id bits are not desirable for uid 0 or
+gid 0.
+When used on Win32, the execute bit is set on
+.I all
+files. This is a result of the lack of file permissions on Win32 and the
+Cygwin POSIX emulation layer.  See also \-uid \-gid, \-dir\-mode, \-file\-mode
+and \-new\-dir\-mode.
+.TP
+.B \-relaxed\-filenames
+The option
+.B \-relaxed\-filenames
+allows ISO9660 filenames to include digits, upper case characters
+and all other 7 bit ASCII characters (resp. anything except lowercase
+characters).
+.br
+This violates the ISO9660 standard, but it happens to work on many systems.
+Use with caution.
+.TP
+.BI \-root " dir
+Moves all files and directories into
+.I dir
+in the image. This is essentially the
+same as using 
+.B -graft-points
+and adding
+.I dir
+in front of every pathspec, but is easier to use.
+
+.I dir
+may actually be several levels deep. It is
+created with the same permissions as other graft points.
+.TP
+.BI \-old-root " dir
+This option is necessary when writing a multisession
+image and the previous (or even older) session was written with
+.BI -root " dir.
+Using a directory name not found in the previous session
+causes
+.B genisoimage
+to abort with an error.
+
+Without this option,
+.B genisoimage
+would not be able to find unmodified files and would
+be forced to write their data into the image once more.
+
+.B \-root
+and
+.B \-old-root
+are meant to be used together to do incremental backups.
+The initial session would e.g. use:
+.BI "genisoimage \-root backup_1 " dirs\f0.
+The next incremental backup with
+.BI "genisoimage \-root backup_2 \-old-root backup_1 " dirs\f0.
+would take another snapshot of these directories. The first
+snapshot would be found in
+.BR backup_1 ,
+the second one in
+.BR backup_2 ,
+but only modified or new files need to be written
+into the second session.
+
+Without these options, new files would be added and old ones would be
+preserved. But old ones would be overwritten if the file was
+modified. Recovering the files by copying the whole directory back
+from CD would also restore files that were deleted
+intentionally. Accessing several older versions of a file requires
+support by the operating system to choose which sessions are to be
+mounted.
+.TP
+.BI \-sort " sort file
+Sort file locations on the media. Sorting is controlled by a file that
+contains pairs of filenames and sorting offset weighting.
+If the weighting is higher, the file will be located closer to the
+beginning of the media, if the weighting is lower, the file will be located
+closer to the end of the media. There must be only one space or tabs
+character between the filename and the
+weight and the weight must be the last characters on a line. The filename
+is taken to include all the characters up to, but not including the last
+space or tab character on a line. This is to allow for space characters to
+be in, or at the end of a filename.
+This option does
+.B not
+sort the order of the file names that appear
+in the ISO9660 directory. It sorts the order in which the file data is
+written to the CD image - which may be useful in order to optimize the
+data layout on a CD. See README.sort for more details.
+.TP
+.BI \-sparc\-boot " img_sun4,img_sun4c,img_sun4m,img_sun4d,img_sun4e
+See
+.B \-B
+option above.
+.TP
+.BI \-sparc\-label " label
+Set the Sun disk label name for the Sun disk label that is created with the
+.B \-sparc-boot
+option.
+.TP
+.B \-split\-output
+Split the output image into several files of approximately 1 GB.
+This helps to create DVD sized ISO9660 images on operating systems without
+large file support.
+Wodim will concatenate more than one file into a single track if writing
+to a DVD.
+To make
+.B \-split\-output
+work, the 
+.BI \-o " filename"
+option must be specified. The resulting outout images will be named:
+.IR filename_00 , filename_01, filename_02 ...
+.TP
+.BI \-stream\-media\-size " #
+Select streaming operation and set the media size to # sectors.
+This allows you to pipe the output of the tar program into genisoimage
+and to create a ISO9660 filesystem without the need of an intermediate
+tar archive file. 
+If this option has been specified,
+.B genisoimage
+reads from 
+.B stdin 
+and creates a file with the name
+.BR STREAM.IMG .
+The maximum size of the file (with padding) is 200 sectors less than the 
+specified media size. If 
+.B \-no\-pad
+has been specified, the file size is 50 sectors less than the specified media size.
+If the file is smaller, then genisoimage will write padding. This may take a while.
+.sp
+The option 
+.B \-stream\-media\-size
+creates simple ISO9660 filesystems only and may not used together with multi-session
+or hybrid filesystem options.
+.TP
+.BI \-stream\-file\-name " name
+Reserved for future use.
+.TP
+.BI \-sunx86\-boot " UFS-img,,,AUX1-img
+Specifies a comma separated list of filesystem images that are needed to make
+a bootable CD for Solaris x86 systems.
+.sp
+Note that partition 1 is used for the ISO9660 image and that partition 2 is
+the whole disk, so partition 1 and 2 may not be used by external partition data.
+The first image file is mapped to partition 0.
+There may be empty fields in the comma separated list,
+and list entries for partition 1 and 2 must be empty.
+The maximum number of supported partitions is 8 (although the Solaris x86
+partition table could support up to 16 partitions), so it is impossible
+to specify more than 6 partition images.
+This option is required to make a bootable CD for Solaris x86 systems.
+.sp
+If the
+.B \-sunx86\-boot
+option has been specified, the first sector of the resulting image will
+contain a PC fdisk label with a Solaris type 0x82 fdisk partition that
+starts at offset 512 and spans the whole CD.
+In addition, for the Solaris type 0x82 fdisk partition, there is a
+SVr4 disk label at offset 1024 in the first sector of the CD.
+This disk label specifies slice 0 for the first (usually UFS type)
+filesystem image that is used to boot the PC and slice 1 for
+the ISO9660 image.
+Slice 2 spans the whole CD slice 3 .\|.\|. slice 7 may be used for additional
+filesystem images that have been specified with this option.
+.sp
+A Solaris x86 boot CD uses a 1024 byte sized primary boot that uses the
+.B "El-Torito no-emulation 
+boot mode and a secondary generic boot that is in CD sectors 1\|.\|.15.
+For this reason, both
+.BI "-b " bootimage " -no\-emul\-boot
+and
+.BI \-G " genboot
+must be specified.
+.TP
+.BI \-sunx86\-label " label
+Set the SVr4 disk label name for the SVr4 disk label that is created with the
+.B \-sunx86-boot
+option.
+.TP
+.BI \-sysid " ID
+Specifies the system ID.
+There is space on the disc for 32 characters of information.
+This parameter can also be set in the file
+.B \&.m\&kisofsrc
+with SYSI=system_id.
+If specified in both places, the command line version is used.
+.TP
+.B \-T
+Generate a file TRANS.TBL in each directory on the CD-ROM, which can be used
+on non-Rock Ridge capable systems to help establish the correct file names.
+There is also information present in the file that indicates the major and
+minor numbers for block and character devices, and each symlink has the name of
+the link file given.
+.TP
+.BI \-table\-name " TABLE_NAME
+Alternative translation table file name (see above). Implies the
+.B \-T
+option.
+If you are creating a multi-session image you must use the same name
+as in the previous session.
+.TP
+.BI \-ucs\-level " level
+Set Unicode conformance level in the Joliet SVD. The default level is 3.
+It may be set to 1..3 using this option.
+.TP
+.B \-udf
+Include 
+.B UDF
+support in the generated filesystem image.
+.B UDF
+support is currently in alpha status and for this reason, it is not possible
+to create UDF only images. 
+.B UDF
+data structures are currently coupled to the Joliet structures, so there are many
+pitfalls with the current implementation. There is no UID/GID support,
+there is no POSIX permission support, there is no support for symlinks.
+Note that 
+.B UDF
+wastes the space from sector ~20 to sector 256 at the beginning of the disk
+in addition to the space needed for real 
+.B UDF 
+data structures.
+.TP
+.BI \-uid " uid
+Overrides the uid read from the source files to the value of
+.IR uid . 
+Specifying this option automatically enables Rock Ridge extensions.
+.TP
+.B \-use\-fileversion
+The option 
+.B \-use\-fileversion
+allows genisoimage to use file version numbers from the filesystem.
+If the option is not specified, 
+.B genisoimage
+creates a version number of 1 for all files.
+File versions are strings in the range 
+.I ";1"
+to
+.I ";32767"
+This option is the default on VMS. 
+.TP
+.B \-U
+Allows "Untranslated" filenames, completely violating the ISO9660 standards
+described above. Forces on the \-d, \-l, \-N, \-allow\-leading\-dots,
+\-relaxed\-filenames,
+\-allow\-lowercase, \-allow\-multidot and \-no\-iso\-translate
+flags. It allows more
+than one '.' character in the filename, as well as mixed case filenames.
+This is useful on HP-UX system, where the built-in CDFS filesystem does
+not recognize ANY extensions. Use with extreme caution.
+.TP
+.B \-no\-iso\-translate
+Do not translate the characters '#' and '~' which are invalid for ISO9660 filenames.
+These characters are though invalid often used by Microsoft systems.
+.br
+This violates the ISO9660 standard, but it happens to work on many systems.
+Use with caution.
+.TP
+.BI \-V " volid
+Specifies the volume ID (volume name or label) to be written into the
+master block. 
+There is space on the disc for 32 characters of information.
+This parameter can also be set in the file
+.B \&.m\&kisofsrc
+with VOLI=id.
+If specified in both places, the command line version is used.  Note that
+if you assign a volume ID, this is the name that will be used as the mount
+point used by the Solaris volume management system and the name that is
+assigned to the disc on a Microsoft Win32 or Apple Mac platform.
+.TP
+.BI \-volset " ID
+Specifies the volset ID.
+There is space on the disc for 128 characters of information.
+This parameter can also be set in the file
+.B \&.m\&kisofsrc
+with VOLS=volset_id.
+If specified in both places, the command line version is used.
+.TP
+.BI \-volset\-size " #
+Sets the volume set size to #.
+The volume set size is the number of CDs that are in a CD volume set.
+A volume set is a collection of one or more volumes, on which a set of
+files is recorded.
+.sp
+Volume Sets are not intended to be used to create a set numbered CDs
+that are part of e.g. a Operation System installation set of CDs.
+Volume Sets are rather used to record a big directory tree that would not
+fit on a single volume.
+Each volume of a Volume Set contains a description of all the directories
+and files that are recorded on the volumes where the sequence numbers
+are less than, or equal to, the assigned Volume Set Size of the current
+volume.
+.sp
+.B genisoimage
+currently does not support a
+.B \-volset\-size
+that is larger than 1.
+.sp
+The option
+.B \-volset\-size
+must be specified before
+.B \-volset\-seqno
+on each command line.
+.TP
+.BI \-volset\-seqno " #
+Sets the volume set sequence number to #.
+The volume set sequence number is the index number of the current
+CD in a CD set.
+The option
+.B \-volset\-size
+must be specified before
+.B \-volset\-seqno
+on each command line.
+.TP
+.B \-v
+Verbose execution. If given twice on the command line, extra debug information
+will be printed.
+.TP
+.BI \-x " path
+Exclude
+.I path
+from being written to CD-ROM.
+.I path
+must be the complete pathname that results from concatenating the pathname
+given as command line argument and the path relative to this directory.
+Multiple paths may be excluded.
+Example: 
+
+genisoimage \-o cd \-x /local/dir1 \-x /local/dir2 /local
+.sp
+NOTE: The
+.B \-m
+and
+.B \-x
+option description should both be updated, they are wrong.
+Both now work identical and use filename globbing. A file is excluded if either
+the last component matches or the whole path matches.
+.TP
+.B \-z
+Generate special RRIP records for transparently compressed files.
+This is only of use and interest for hosts that support transparent
+decompression, such as Linux 2.4.14 or later.  You must specify the
+.B \-R
+or
+.B \-r
+options to enable Rock Ridge, and generate compressed files using the
+.B mkzftree
+utility before running
+.BR genisoimage .
+Note that transparent compression is a nonstandard Rock Ridge extension.
+The resulting disks are only transparently readable if used on Linux.
+On other operating systems you will need to call
+.B mkzftree
+by hand to decompress the files.
+
+.SH "HFS OPTIONS
+.TP
+.B \-hfs
+Create an ISO9660/HFS hybrid CD. This option should be used in conjunction
+with the
+.BR \-map ,
+.B \-magic
+and/or the various
+.I double dash
+options given below.
+.TP
+.B \-apple
+Create an ISO9660 CD with Apple's extensions. Similar to the
+.B \-hfs
+option, except that the Apple Extensions to ISO9660 are added instead of
+creating an HFS hybrid volume.
+Former 
+.B genisoimage
+versions did include Rock Ridge attributes by default if 
+.B \-apple
+was specified. This versions of
+.B genisoimage
+does not do this anymore. If you like to have Rock Ridge attributes,
+you need to specify this separately.
+.TP
+.BI \-map " mapping_file
+Use the
+.I mapping_file
+to set the CREATOR and TYPE information for a file based on the
+filename's extension. A filename is 
+mapped only if it is not one of the know Apple/Unix file formats. See the
+.B "HFS CREATOR/TYPE
+section below.
+.TP
+.BI \-magic " magic_file
+The CREATOR and TYPE information is set by using a file's
+.I magic number
+(usually the first few bytes of a file). The
+.I magic_file
+is only used if a file is not one of the known Apple/Unix file formats, or
+the filename extension has not been mapped using the
+.B \-map
+option. See the 
+.B "HFS CREATOR/TYPE
+section below for more details.
+.TP
+.BI \-hfs\-creator " CREATOR
+Set the default CREATOR for all files. Must be exactly 4 characters. See the
+.B "HFS CREATOR/TYPE
+section below for more details.
+.TP
+.BI \-hfs\-type " TYPE
+Set the default TYPE for all files. Must be exactly 4 characters. See the
+.B "HFS CREATOR/TYPE
+section below for more details.
+.TP
+.B \-probe
+Search the contents of files for all the known Apple/Unix file formats.
+See the
+.B HFS MACINTOSH FILE FORMATS
+section below for more about these formats.
+However, the only way to check for
+.I MacBinary
+and
+.I AppleSingle
+files is to open and read them. Therefore this option
+.I may
+increase processing time. It is better to use one or more
+.I double dash
+options given below if the Apple/Unix formats in use are known.
+.TP
+.B \-no\-desktop
+Do not create (empty) Desktop files. New HFS Desktop files will be created
+when the CD is used on a Macintosh (and stored in the System Folder).
+By default, empty Desktop files are added to the HFS volume.
+.TP
+.B \-mac\-name
+Use the HFS filename as the starting point for the ISO9660, Joliet and
+Rock Ridge file names. See the
+.B HFS MACINTOSH FILE NAMES
+section below for more information.
+.TP
+.BI \-boot\-hfs\-file " driver_file
+Installs the
+.I driver_file
+that
+.I may
+make the CD bootable on a Macintosh. See the
+.B HFS BOOT DRIVER
+section below. (Alpha).
+.TP
+.B \-part
+Generate an HFS partition table. By default, no partition table is generated,
+but some older Macintosh CD-ROM drivers need an HFS partition table on the
+CD-ROM to be able to recognize a hybrid CD-ROM.
+.TP
+.BI \-auto " AutoStart_file
+Make the HFS CD use the QuickTime 2.0 Autostart feature to launch an
+application or document. The given filename must be the name of a document or
+application located at the top level of the CD. The filename must be less
+than 12 characters. (Alpha).
+.TP
+.BI \-cluster\-size " size
+Set the size in bytes of the cluster or allocation units of PC Exchange
+files. Implies the
+.B \-\-exchange
+option. See the
+.B HFS MACINTOSH FILE FORMATS
+section below.
+.TP
+.BI \-hide\-hfs " glob
+Hide
+.I glob
+from the HFS volume. The file or directory will still exist in the
+ISO9660 and/or Joliet directory.
+.I glob
+is a shell wild-card-style pattern that must match any part of the filename
+Multiple globs may be excluded.
+Example:
+
+genisoimage \-o rom \-hfs \-hide\-hfs '*.o' \-hide\-hfs foobar
+
+would exclude all files ending in ".o" or called "foobar" 
+from the HFS volume. Note that if you had a directory called
+"foobar" it too (and of course all its descendants) would be excluded.
+The
+.I glob
+can also be a path name relative to the source directories given on the
+command line. Example:
+
+genisoimage \-o rom \-hfs \-hide\-hfs src/html src
+
+would exclude just the file or directory called "html" from the "src"
+directory. Any other file or directory called "html" in the tree will
+not be excluded.
+Should be used with the
+.B \-hide
+and/or
+.B \-hide\-joliet
+options.
+In order to match a directory name, make sure the pathname does not include
+a trailing '/' character. See README.hide for more details.
+.TP
+.BI \-hide\-hfs\-list " file
+A file containing a list of
+.I globs
+to be hidden as above.
+.TP
+.BI \-hfs\-volid " hfs_volid
+Volume name for the HFS partition. This is the name that is
+assigned to the disc on a Macintosh and replaces the
+.I volid
+used with the 
+.B \-V
+option
+.TP
+.B \-icon\-position
+Use the icon position information, if it exists, from the Apple/Unix file.
+The icons will appear in the same position as they would on a Macintosh
+desktop. Folder location and size on screen, its scroll positions, folder
+View (view as Icons, Small Icons, etc.) are also preserved.
+This option may become set by default in the future.
+(Alpha).
+.TP
+.BI \-root\-info " file
+Set the location, size on screen, scroll positions, folder View etc. for the
+root folder of an HFS volume. See README.rootinfo for more information.
+(Alpha)
+.TP
+.BI \-prep\-boot " FILE
+PReP boot image file. Up to 4 are allowed. See README.prep_boot (Alpha)
+.TP
+.BI \-input\-hfs\-charset " charset
+Input charset that defines the characters used in HFS file names when
+used with the
+.I \-mac\-name
+option.
+The default charset is cp10000 (Mac Roman)
+.I cp10000
+(Mac Roman)
+See
+.B "CHARACTER SETS
+and
+.B "HFS MACINTOSH FILE NAMES
+sections below for more details.
+.TP
+.BI \-output\-hfs\-charset " charset
+Output charset that defines the characters that will be used in the HFS
+file names. Defaults to the input charset. See
+.B "CHARACTER SETS
+section below for more details.
+.TP
+.B \-hfs\-unlock
+By default,
+.B genisoimage
+will create an HFS volume that is
+.IR locked .
+This option leaves the volume unlocked so that other applications (e.g.
+hfsutils) can modify the volume. See the
+.B "HFS PROBLEMS/LIMITATIONS
+section below for warnings about using this option.
+.TP
+.BI \-hfs\-bless " folder_name
+"Bless" the given directory (folder). This is usually the 
+.B System Folder
+and is used in creating HFS bootable CDs. The name of the directory must
+be the whole path name as
+.B genisoimage
+sees it. e.g. if the given pathspec is ./cddata and the required folder is
+called System Folder, then the whole path name is "./cddata/System Folder"
+(remember to use quotes if the name contains spaces).
+.TP
+.BI \-hfs\-parms " PARAMETERS
+Override certain parameters used to create the HFS file system. Unlikely to
+be used in normal circumstances. See the libhfs_iso/hybrid.h source file for
+details.
+.TP
+.B \-\-cap
+Look for AUFS CAP Macintosh files. Search for CAP Apple/Unix file formats
+only. Searching for the other possible Apple/Unix file formats is disabled,
+unless other
+.I double dash
+options are given.
+.TP
+.B \-\-netatalk
+Look for NETATALK Macintosh files
+.TP
+.B \-\-double
+Look for AppleDouble Macintosh files
+.TP
+.B \-\-ethershare
+Look for Helios EtherShare Macintosh files
+.TP
+.B \-\-ushare
+Look for IPT UShare Macintosh files
+.TP
+.B \-\-exchange
+Look for PC Exchange Macintosh files
+.TP
+.B \-\-sgi
+Look for SGI Macintosh files
+.TP
+.B \-\-xinet
+Look for XINET Macintosh files
+.TP
+.B \-\-macbin
+Look for MacBinary Macintosh files
+.TP
+.B \-\-single
+Look for AppleSingle Macintosh files
+.TP
+.B \-\-dave
+Look for Thursby Software Systems DAVE Macintosh files
+.TP
+.B \-\-sfm
+Look for Microsoft's Services for Macintosh files (NT only) (Alpha)
+.TP
+.B \-\-osx\-double
+Look for MacOS X AppleDouble Macintosh files
+.TP
+.B \-\-osx\-hfs
+Look for MacOS X HFS Macintosh files
+
+.SH "CHARACTER SETS
+.B genisoimage
+processes file names in a POSIX compliant way as strings of 8-bit characters.
+To represent all codings for all languages, 8-bit characters are not
+sufficient. Unicode or
+.B ISO-10646
+define character codings that need at least 21 bits to represent all
+known languages. They may be represented with
+.BR UTF-32 ", " UTF-16 " or " UTF-8
+coding.
+.B UTF-32
+uses a plain 32-bit coding but seems to be uncommon. 
+.B UTF-16
+is used by Microsoft with Win32 with the disadvantage that it only supports
+a subset of all codes and that 16-bit characters are not compliant with
+the POSIX filesystem interface.
+.PP
+Modern Unix operating systems may use
+.B UTF-8
+coding for filenames. This coding allows to use the complete Unicode code set.
+Each 32-bit character is represented by one or more 8-bit characters.
+If a character is coded in
+.B ISO-8859-1
+(used in Central Europe and North America) is maps 1:1 to a 
+.BR UTF-32 " or " UTF-16 "
+coded Unicode character.
+If a character is coded in
+.B "7-Bit ASCII
+(used in USA and other countries with limited character set)
+is maps 1:1 to a 
+.BR UTF-32 ", " UTF-16 " or " UTF-8
+coded Unicode character.
+Character codes that cannot be represented as a single byte in UTF-8
+(typically if the value is > 0x7F) use escape sequences that map to more than
+one 8-bit character.
+.PP
+If all operating systems would use 
+.B UTF-8
+coding,
+.B genisoimage
+would not need to recode characters in file names.
+Unfortunately, Apple uses completely nonstandard codings and Microsoft
+uses a Unicode coding that is not compatible with the POSIX filename
+interface.
+.PP
+For all non
+.B UTF-8
+coded operating systems, the actual character
+that each byte represents depends on the
+.I character set
+or
+.I codepage
+(which is the name used by Microsoft)
+used by the local operating system in use - the characters in a character
+set will reflect the region or natural language used by the user.
+.PP
+Usually character codes 0x00-0x1f are control characters, codes 0x20-0x7f
+are the 7 bit ASCII characters and (on PC's and Mac's) 0x80-0xff are used
+for other characters.
+Unfortunately even this does not follow ISO standards that reserve the
+range 0x80-0x9f for control characters and only allow 0xa0-0xff for other
+characters.
+.PP
+As there is a lot more than 256 characters/symbols in use, only a small
+subset are represented in a character set. Therefore the same character code
+may represent a different character in different character sets. So a file name
+generated, say in central Europe, may not display the same character
+when viewed on a machine in, say eastern Europe.
+.PP
+To make matters more complicated, different operating systems use
+different character sets for the region or language. For example the character
+code for "small e with acute accent" may be character code 0x82 on a PC, 
+code 0x8e on a Macintosh and code 0xe9 on a Unix system.
+Note while the codings used on a PC or Mac are nonstandard,
+Unicode codes this character as 0x00000000e9 which is basically the
+same value as the value used by most Unix systems.
+.PP
+As long as not all operating systems and applications will use the Unicode
+character set as the basis for file names in a unique way, it may be
+necessary to specify which character set your file names use in and which
+character set the file names should appear on the CD.
+.PP
+There are four options to specify the character sets you want to use:
+.IP \-input\-charset
+Defines the local character set you are using on your host machine.
+Any character set conversions that take place will use this character
+set as the staring point. The default input character sets are
+.I cp437
+on DOS based systems and
+.I iso8859-1
+on all other systems.
+
+If the
+.I \-J
+option is given, then the Unicode equivalents of the input character set
+will be used in the Joliet directory. Using the 
+.I \-jcharset
+option is the same as using the
+.I \-input\-charset
+and
+.I \-J
+options.
+.IP \-output\-charset
+Defines the character set that will be used with for the Rock Ridge names
+on the CD. Defaults to the input character set. Only likely to be useful
+if used on a non-Unix platform. e.g. using
+.B genisoimage
+on a Microsoft Win32 machine to create Rock Ridge CDs. If you are using
+.B genisoimage
+on a Unix machine, it is likely that the output character set
+will be the same as the input character set.
+.IP \-input\-hfs\-charset
+Defines the HFS character set used for HFS file names decoded from
+any of the various Apple/Unix file formats. Only useful when used with
+.I \-mac\-name
+option. See the
+.B HFS MACINTOSH FILE NAMES
+for more information. Defaults to
+.I cp10000
+(Mac Roman).
+.IP \-output\-hfs\-charset
+Defines the HFS character set used to create HFS file names from the input
+character set in use. In most cases this will be from the character set
+given with the
+.I \-input\-charset
+option. Defaults to the input HFS character set.
+.PP
+There are a number of character sets built in to
+.IR genisoimage .
+To get a listing, use
+.B "genisoimage \-input\-charset help.
+This list doesn't include the charset derived from the current locale,
+if genisoimage is built with iconv support.
+.PP
+Additional character sets can be read from file for any of the character
+set options by giving a filename as the argument to the options. The given
+file will only be read if its name does not match one of the built in
+character sets.
+.PP
+The format of the character set files is the same as the mapping files
+available from http://www.unicode.org/Public/MAPPINGS The format of these
+files is:
+
+	Column #1 is the input byte code (in hex as 0xXX)
+.br
+	Column #2 is the Unicode (in hex as 0xXXXX)
+.br
+	Rest of the line is ignored.
+
+Any blank line, line without two (or more) columns in the above format
+or comments lines (starting with the # character) are ignored without any
+warnings. Any missing input code is mapped to Unicode character 0x0000.
+.PP
+Note that there is no support for 16 bit UNICODE (UTF-16) or 32 bit UNICODE
+(UTF-32) coding because this coding is not POSIX compliant. There should 
+be support for UTF-8 UNICODE coding which is compatible to POSIX filenames
+and supported by moder Unix implementations such as Solaris.
+.PP
+A 1:1 character set mapping can be defined by using the keyword
+.I default
+as the argument to any of the character set options. This is the behaviour
+of older (v1.12) versions of
+.BR genisoimage .
+.PP
+The ISO9660 file names generated from the input filenames are not converted
+from the input character set. The ISO9660 character set is a very limited
+subset of the ASCII characters, so any conversion would be pointless.
+.PP
+Any character that
+.B genisoimage
+can not convert will be replaced with a '_' character.
+.PP
+.SH "HFS CREATOR/TYPE
+A Macintosh file has two properties associated with it which define
+which application created the file, the
+.I CREATOR
+and what data the file contains, the
+.IR TYPE .
+Both are (exactly) 4 letter strings. Usually this
+allows a Macintosh user to double-click on a file and launch the correct
+application etc. The CREATOR and TYPE of a particular file can be found by
+using something like ResEdit (or similar) on a Macintosh.
+.LP
+The CREATOR and TYPE information is stored in all the various Apple/Unix
+encoded files.
+For other files it is possible to base the CREATOR and TYPE on the
+filename's extension using a
+.I mapping
+file (the
+.B \-map
+option) and/or using the
+.I magic number
+(usually a
+.I signature
+in the first few bytes)
+of a file (the
+.B \-magic
+option). If both these options are given, then their order on the command
+line is important. If the
+.B \-map
+option is given first, then a filename extension match is attempted
+before a magic number match. However, if the
+.B \-magic
+option is given first, then a magic number match is attempted before a
+filename extension match.
+.PP
+If a mapping or magic file is not used, or no match is found then the default
+CREATOR and TYPE for all regular files can be set by using entries in the 
+.B \&.m\&kisofsrc
+file or using the 
+.B \-hfs\-creator
+and/or
+.B \-hfs\-type
+options, otherwise the default CREATOR and TYPE are 'Unix' and 'TEXT'.
+.PP
+The format of the
+.I mapping
+file is the same
+.I afpfile
+format as used by
+.IR aufs .
+This file has five columns for the
+.IR extension ,
+.I file
+.IR translation ,
+.IR CREATOR ,
+.I TYPE
+and
+.IR Comment .
+Lines starting with the '#' character are
+comment lines and are ignored. An example file would be like:
+.LP
+.TS
+tab (/);
+l s s s s
+l s s s s
+l l l l l .
+# Example filename mapping file
+#
+# EXTN/XLate/CREATOR/TYPE/Comment
+\&.tif/Raw/'8BIM'/'TIFF'/"Photoshop TIFF image"
+\&.hqx/Ascii/'BnHq'/'TEXT'/"BinHex file"
+\&.doc/Raw/'MSWD'/'WDBN'/"Word file"
+\&.mov/Raw/'TVOD'/'MooV'/"QuickTime Movie"
+*/Ascii/'ttxt'/'TEXT'/"Text file"
+.TE
+.LP
+Where:
+.IP
+The first column
+.I EXTN
+defines the Unix filename extension to be
+mapped. The default mapping for any filename extension that doesn't
+match is defined with the "*" character.
+.IP
+The
+.I Xlate
+column defines the type of text translation between the Unix and
+Macintosh file it is ignored by
+.BR genisoimage ,
+but is kept to be compatible with
+.BR aufs (1).
+Although 
+.B genisoimage
+does not alter the contents of a file, if a binary file has it's TYPE
+set as 'TEXT', it
+.I may
+be read incorrectly on a Macintosh. Therefore a better choice for the
+default TYPE may be '????'
+.IP
+The
+.I CREATOR
+and
+.I TYPE
+keywords must be 4 characters long and enclosed in single quotes.
+.IP
+The comment field is enclosed in double quotes - it is ignored by
+.BR genisoimage ,
+but is kept to be compatible with 
+.BR aufs .
+.PP
+The format of the
+.I magic
+file is almost identical to the
+.BR magic (5)
+file used by the Linux
+.BR file (1)
+command - the routines for reading and decoding the
+.I magic
+file are based on the Linux
+.BR file (1)
+command.
+.PP
+This file has four tab separated columns for the 
+.I byte
+.IR offset ,
+.IR type ,
+.I test
+and
+.IR message .
+Lines starting with the '#' character are
+comment lines and are ignored. An example file would be like:
+.LP
+.TS
+tab (/);
+l s s s
+l s s s
+l l l l .
+# Example magic file
+#
+# off/type/test/message
+0/string/GIF8/8BIM GIFf  GIF image
+0/beshort/0xffd8/8BIM JPEG  image data
+0/string/SIT!/SIT! SIT!  StuffIt Archive
+0/string/\\037\\235/LZIV ZIVU  standard Unix compress
+0/string/\\037\\213/GNUz ZIVU  gzip compressed data
+0/string/%!/ASPS TEXT  Postscript
+0/string/\\004%!/ASPS TEXT  PC Postscript with a ^D to start
+4/string/moov/txtt MooV  QuickTime movie file (moov)
+4/string/mdat/txtt MooV  QuickTime movie file (mdat)
+.TE
+.PP
+The format of the file is described in the
+.BR magic (4)
+man page. The only difference here is that for each entry in the magic file, the
+.I message
+for the initial offset
+.B must
+be 4 characters for the CREATOR followed by 4 characters for the TYPE -
+white space is
+optional between them. Any other characters on this line are ignored.
+Continuation lines (starting with a '>') are also ignored i.e. only the initial
+offset lines are used.
+.PP
+Using the
+.B \-magic
+option may significantly increase processing time as each file has to opened
+and read to find it's magic number.
+.PP
+In summary, for all files, the default CREATOR is 'Unix' and the default
+TYPE is 'TEXT'.  These can be changed by using entries in the 
+.I \&.m\&kisofsrc 
+file or by using the
+.B \-hfs\-creator
+and/or
+.B \-hfs\-type
+options. 
+.PP
+If the a file is in one of the known Apple/Unix formats (and the format
+has been selected), then the CREATOR and TYPE are taken from the values
+stored in the Apple/Unix file.
+.PP
+Other files can have their CREATOR and TYPE set from their file name
+extension (the
+.B \-map
+option), or their magic number (the
+.B \-magic
+option). If the default match is used in the
+.I mapping
+file, then these values override the default CREATOR and TYPE.
+.PP
+A full CREATOR/TYPE database can be found at 
+http://www.angelfire.com/il/szekely/index.html
+
+.SH "HFS MACINTOSH FILE FORMATS
+Macintosh files have two parts called the
+.I Data
+and
+.I Resource
+fork. Either may be empty. Unix (and many other OSs) can only
+cope with files having one part (or fork). To add to this, Macintosh files
+have a number of attributes associated with them - probably the most
+important are the TYPE and CREATOR. Again Unix has no concept of these
+types of attributes.
+.PP
+e.g. a Macintosh file may be a JPEG image where the image is stored in the
+Data fork and a desktop thumbnail stored in the Resource fork. It is usually
+the information in the data fork that is useful across platforms.
+.PP
+Therefore to store a Macintosh file on a Unix filesystem, a way has to be
+found to cope with the two forks and the extra attributes (which are
+referred to as the
+.I finder
+.IR info ).
+Unfortunately, it seems that every software package that stores Macintosh
+files on Unix has chosen a completely different storage method.
+.PP
+The Apple/Unix formats that
+.I genisoimage
+(partially) supports are:
+.IP "CAP AUFS format"
+Data fork stored in a file. Resource fork in subdirectory .resource
+with same filename as data fork. Finder info
+in .finderinfo subdirectory with same filename.
+.IP "AppleDouble/Netatalk"
+Data fork stored in a file. Resource fork stored in a file with
+same name prefixed with "%". Finder info also stored in same
+"%" file. Netatalk uses the same format, but the resource
+fork/finderinfo stored in subdirectory .AppleDouble with same
+name as data fork.
+.IP AppleSingle
+Data structures similar to above, except both forks and finder
+info are stored in one file.
+.IP "Helios EtherShare"
+Data fork stored in a file. Resource fork and finder info together in
+subdirectory .rsrc with same filename as data fork.
+.IP "IPT UShare"
+Very similar to the EtherShare format, but the finder info
+is stored slightly differently.
+.IP MacBinary
+Both forks and finder info stored in one file.
+.IP "Apple PC Exchange"
+Used by Macintoshes to store Apple files on DOS (FAT) disks.
+Data fork stored in a file. Resource fork in subdirectory
+resource.frk (or RESOURCE.FRK). Finder info as one record
+in file finder.dat (or FINDER.DAT). Separate finder.dat for
+each data fork directory.
+.IP
+Note: 
+.I genisoimage
+needs to know the native FAT cluster size of the disk that the PC Exchange
+files are on (or have been copied from). This size is given by the
+.B \-cluster\-size
+option.
+The cluster or allocation size can be found by using the DOS utility
+.BR CHKDSK .
+.IP
+May not work with PC Exchange v2.2 or higher files (available with MacOS 8.1).
+DOS media containing PC Exchange files should be mounted as type
+.B msdos
+(not
+.BR vfat )
+when using Linux.
+.IP "SGI/XINET"
+Used by SGI machines when they mount HFS disks. Data fork stored
+in a file. Resource fork in subdirectory .HSResource with same
+name. Finder info as one record in file .HSancillary. Separate .HSancillary
+for each data fork directory.
+.IP "Thursby Software Systems DAVE"
+Allows Macintoshes to store Apple files on SMB servers.
+Data fork stored in a file. Resource fork in subdirectory
+resource.frk. Uses the AppleDouble format to store resource fork.
+.IP "Services for Macintosh"
+Format of files stored by NT Servers on NTFS filesystems. Data fork is
+stored as "filename". Resource fork stored as a NTFS
+.I stream
+called "filename:AFP_Resource". The finder info is stored as a NTFS
+.I stream
+called "filename:Afp_AfpInfo". These streams are normally invisible to the
+user.
+.IP
+Warning: genisoimage only partially supports the SFM format. If an HFS file
+or folder stored on the NT server contains an
+.I illegal
+NT character in its name, then NT converts these characters to
+.I Private Use Unicode
+characters. The characters are: " * / < > ? \ | also a space or
+period if it is the last character of the file name, character codes 0x01
+to 0x1f (control characters) and Apple' apple logo.
+.IP
+Unfortunately, these private Unicode characters are not
+readable by the genisoimage NT executable. Therefore any file or directory
+name containing these characters will be ignored - including the contents of
+any such directory.
+.IP "MacOS X AppleDouble"
+When HFS/HFS+ files are copied or saved by MacOS X on to a non-HFS file
+system (e.g. UFS, NFS etc.), the files are stored in AppleDouble format.
+Data fork stored in a file. Resource fork stored in a file with
+same name prefixed with "._". Finder info also stored in same "._" file.
+.IP "MacOS X HFS (Alpha)"
+Not really an Apple/Unix encoding, but actual HFS/HFS+ files on a MacOS X
+system. Data fork stored in a file. Resource fork stored in a pseudo file
+with the same name with the suffix '/rsrc'. The finderinfo is only
+available via a MacOS X library call.
+.IP
+Notes: (also see README.macosx)
+.IP
+Only works when used on MacOS X.
+.IP
+If a file is found with a zero
+length resource fork and empty finderinfo, it is assumed not to have
+any Apple/Unix encoding - therefore a TYPE and CREATOR can be set using
+other methods.
+.LP
+.I genisoimage
+will attempt to set the CREATOR, TYPE, date and possibly other flags from
+the finder info. Additionally, if it exists, the Macintosh filename is set
+from the finder info, otherwise the Macintosh name is based on the Unix
+filename - see the
+.B "HFS MACINTOSH FILE NAMES
+section below.
+.PP
+When using the
+.B \-apple
+option, the TYPE and CREATOR are stored in the optional System Use or SUSP field
+in the ISO9660 Directory Record - in much the same way as the Rock Ridge
+attributes are. In fact to make life easy, the Apple extensions are added
+at the beginning of the existing Rock Ridge attributes (i.e. to get the Apple
+extensions you get the Rock Ridge extensions as well).
+.PP
+The Apple extensions require the resource fork to be stored as an ISO9660
+.I associated
+file. This is just like any normal file stored in the ISO9660 filesystem
+except that the associated file flag is set in the Directory Record (bit
+2). This file has the same name as the data fork (the file seen by
+non-Apple machines). Associated files are normally ignored by other OSs
+.PP
+When using the
+.B \-hfs
+option, the TYPE and CREATOR plus other finder info, are stored in a separate
+HFS directory, not visible on the ISO9660 volume. The HFS directory references
+the same data and resource fork files described above.
+.PP
+In most cases, it is better to use the
+.B \-hfs
+option instead of the
+.B \-apple
+option, as the latter imposes the limited ISO9660 characters allowed in
+filenames. However, the Apple extensions do give the advantage that the
+files are packed on the disk more efficiently and it may be possible to fit 
+more files on a CD - important when the total size of the source files is
+approaching 650MB.
+
+.SH "HFS MACINTOSH FILE NAMES
+Where possible, the HFS filename that is stored with an Apple/Unix file
+is used for the HFS part of the CD. However, not all the Apple/Unix
+encodings store the HFS filename with the finderinfo. In these cases,
+the Unix filename is used - with escaped special characters. Special
+characters include '/' and characters with codes over 127.
+.PP
+AUFS escapes these characters by using ":" followed by the character code
+as two hex digits. Netatalk and EtherShare have a similar scheme, but uses
+"%" instead of a ":".
+.PP
+If genisoimage can not find an HFS filename, it uses the Unix name, with
+any %xx or :xx characters (xx == two hex digits) converted to a single
+character code. If "xx" are not hex digits ([0-9a-fA-F]), then they are
+left alone - although any remaining ":" is converted to "%" as colon
+is the HFS directory separator. Care must be taken, as an ordinary Unix
+file with %xx or :xx will also be converted. e.g.
+.PP
+.TS
+l l 
+l s
+l l
+l s
+l l .
+This:2fFile	converted to This/File
+	
+This:File	converted to This%File
+	
+This:t7File	converted to This%t7File
+.TE
+.PP
+Although HFS filenames appear to support upper and lower case letters,
+the filesystem is case insensitive. i.e. the filenames "aBc" and "AbC"
+are the same. If a file is found in a directory with the same HFS name,
+then
+.I genisoimage
+will attempt, where possible, to make a unique name by adding '_' characters
+to one of the filenames. 
+.PP
+If an HFS filename exists for a file, then genisoimage can use this name as
+the starting point for the ISO9660, Joliet and Rock Ridge filenames using
+the
+.B \-mac\-name
+option. Normal Unix files without an HFS name will still use their Unix name.
+e.g.
+.PP
+If a
+.I MacBinary
+(or
+.I PC
+.IR Exchange )
+file is stored as 
+.I someimage.gif.bin
+on the Unix filesystem, but contains a HFS file called
+.IR someimage.gif ,
+then this is the name that would appear on the HFS part of the CD. However, as
+genisoimage uses the Unix name as the starting point for the other names, then
+the ISO9660 name generated will probably be 
+.I SOMEIMAG.BIN
+and the Joliet/Rock Ridge would be
+.IR someimage.gif.bin .
+Although the actual data (in this case) is a GIF image. This option will use
+the HFS filename as the starting point and the ISO9660 name will probably be
+.I SOMEIMAG.GIF
+and the Joliet/Rock Ridge would be
+.IR someimage.gif .
+.PP
+Using the
+.B \-mac\-name
+option will not currently work with the
+.B \-T
+option - the Unix
+name will be used in the TRANS.TBL file, not the Macintosh name.
+.PP
+The character set used to convert any HFS file name to a Joliet/Rock Ridge
+file name defaults to
+.I cp10000
+(Mac Roman).
+The character set used can be specified using the
+.I \-input\-hfs\-charset
+option. Other built in HFS character sets are: cp10006 (MacGreek),
+cp10007 (MacCyrillic), cp10029 (MacLatin2), cp10079 (MacIcelandandic) and
+cp10081 (MacTurkish).
+.PP
+Note: the character codes used by HFS file names taken from the various
+Apple/Unix formats will not be converted as they are assumed to be in the
+correct Apple character set. Only the Joliet/Rock Ridge names derived from
+the HFS file names will be converted.
+.PP
+The existing genisoimage code will filter out any illegal characters for the
+ISO9660 and Joliet filenames, but as genisoimage expects to be dealing
+directly with Unix names, it leaves the Rock Ridge names as is.
+But as '/' is a legal HFS filename character, the
+.B \-mac\-name
+option converts '/' to a '_' in Rock Ridge filenames.
+.PP
+If the Apple extensions are used, then only the ISO9660 filenames will
+appear on the Macintosh. However, as the Macintosh ISO9660 drivers can use
+.I Level 2
+filenames, then you can use options like
+.B \-allow\-multidot
+without problems on
+a Macintosh - still take care over the names, for example
+.I this.file.name
+will be converted to
+.I THIS.FILE
+i.e. only have one '.', also filename
+.I abcdefgh
+will be seen as
+.I ABCDEFGH
+but
+.I abcdefghi
+will be seen as
+.I ABCDEFGHI.
+i.e. with a '.' at the end - don't know if this is a Macintosh
+problem or m\&kisofs/mkhybrid problem. All filenames will be in upper case
+when viewed on a Macintosh. Of course, DOS/Win3.X machines will not be able
+to see Level 2 filenames...
+
+.SH "HFS CUSTOM VOLUME/FOLDER ICONS
+To give a HFS CD a custom icon, make sure the root (top level) folder includes
+a standard Macintosh volume icon file. To give a volume a custom icon on
+a Macintosh, an icon has to be pasted over the volume's icon in the "Get Info"
+box of the volume. This creates an invisible file called 'Icon\\r' ('\\r' is
+the 'carriage return' character) in the root folder.
+.P
+A custom folder icon is very similar - an invisible file called 'Icon\\r'
+exits in the folder itself.
+.P
+Probably the easiest way to create a custom icon that genisoimage can use, is to
+format a blank HFS floppy disk on a Mac, paste an icon to its "Get Info"
+box. If using Linux with the HFS module installed, mount the floppy using
+something like:
+
+	mount \-t hfs /dev/fd0 /mnt/floppy
+
+The floppy will be mounted as a CAP file system by default. Then run genisoimage
+using something like:
+
+	genisoimage \-\-cap \-o output source_dir /mnt/floppy
+
+If you are not using Linux, then you can use the hfsutils to copy the icon
+file from the floppy. However, care has to be taken, as the icon file
+contains a control character. e.g.
+
+	hmount /dev/fd0
+.br
+	hdir \-a
+.br
+	hcopy \-m Icon^V^M icon_dir/icon
+
+Where '^V^M' is control\-V followed by control\-M. Then run 
+.B genisoimage
+by using something like:
+
+	genisoimage \-\-macbin \-o output source_dir icon_dir
+.PP
+The procedure for creating/using custom folder icons is very similar - paste
+an icon to folder's "Get Info" box and transfer the resulting 'Icon\\r'
+file to the relevant directory in the genisoimage source tree.
+.PP
+You may want to hide the icon files from the ISO9660 and Joliet trees.
+.PP
+To give a custom icon to a Joliet CD, follow the instructions found at:
+http://www.fadden.com/cdrfaq/faq03.html#[3-21]
+
+.SH "HFS BOOT DRIVER
+It 
+.I may
+be possible to make the hybrid CD bootable on a Macintosh.
+.PP
+A bootable HFS CD requires an Apple CD-ROM (or compatible) driver, a bootable
+HFS partition and the necessary System, Finder, etc. files.
+.PP
+A driver can be obtained from any other Macintosh bootable CD-ROM using the
+.I apple_driver
+utility. This file can then be used with the
+.B \-boot\-hfs\-file
+option.
+.PP
+The HFS partition (i.e. the hybrid disk in our case) must contain a
+suitable System Folder, again from another CD-ROM or disk.
+.PP
+For a partition to be bootable, it must have it's 
+.I boot block
+set. The boot
+block is in the first two blocks of a partition. For a non-bootable partition
+the boot block is full of zeros. Normally, when a System file is copied to
+partition on a Macintosh disk, the boot block is filled with a number of
+required settings - unfortunately I don't know the full spec for the boot
+block, so I'm guessing that the following will work OK.
+.PP
+Therefore, the utility
+.I apple_driver
+also extracts the boot block from the
+first HFS partition it finds on the given CD-ROM and this is used for the
+HFS partition created by
+.BR genisoimage .
+.IP "PLEASE NOTE"
+By using a driver from an Apple CD and copying Apple software to your CD,
+you become liable to obey Apple Computer, Inc. Software License Agreements.
+.SH "EL TORITO BOOT INFORMATION TABLE
+When the
+.B \-boot\-info\-table
+option is given,
+.B genisoimage
+will modify the boot file specified by the
+.B \-b
+option by inserting a 56-byte "boot information table" at offset 8 in
+the file.  This modification is done in the source filesystem, so make
+sure you use a copy if this file is not easily recreated!  This file
+contains pointers which may not be easily or reliably obtained at boot
+time.
+.PP
+The format of this table is as follows; all integers are in
+section 7.3.1 ("little endian") format.
+.sp
+.RS +.2i
+.ta 1.0i 2.5i 3.5i
+.nf
+Offset	Name	Size	Meaning
+ 8	bi_pvd	4 bytes	LBA of primary volume descriptor
+12	bi_file	4 bytes	LBA of boot file
+16	bi_length	4 bytes	Boot file length in bytes
+20	bi_csum	4 bytes	32-bit checksum
+24	bi_reserved	40 bytes	Reserved
+.fi
+.RE
+.sp
+The 32-bit checksum is the sum of all the 32-bit words in the boot
+file starting at byte offset 64.  All linear block addresses (LBAs)
+are given in CD sectors (normally 2048 bytes).
+.SH "HPPA NOTES"
+To make a bootable CD for HPPA, at the very least a boot loader file (
+.B \-hppa\-bootloader
+), a kernel image file (32- or 64-bit or both, depending on hardware)
+and a boot command line (
+.B \-hppa\-cmdline
+) must be specified. Some systems can boot either a 32- or a 64-bit
+kernel, and the choice of which one to use will be made by the
+firmware. Optionally, a ramdisk can be used for the root filesystem
+using
+.B \-hppa\-cmdline.
+.SH "JIGDO NOTES"
+Jigdo is a useful tool to help in the distribution of large files like CD and
+DVD images. See Richard Atterer's site for more details. Debian CDs and DVD ISO
+images are published on the web in jigdo format to allow end users to download
+them more efficiently.
+.PP
+To create jigdo and template files alongside the ISO image from
+genisoimage, you must first generate a list of the files that will be
+used, in the following format:
+.sp
+.RS +.2i
+.ta 2.0i 2.0i 5.0i
+.nf
+MD5sum   File size  Path
+32 chars 12 chars   to end of line
+.fi
+.RE
+.sp
+The MD5sum should be written in jigdo's pseudo-base64 format. The file
+size should be in decimal, and the path to the file must be absolute.
+.PP
+Once you have this file, call genisoimage with all of your normal command
+line parameters. Specify the output filenames for the jigdo and
+template files using \-jigdo\-jigdo and \-jigdo\-template, and pass in
+the location of your MD5 list with the \-md5\-list option.
+.PP
+If there are files that you do NOT want to be added into the jigdo
+file (e.g. if they are likely to change often), specify them using
+\-jigdo\-ignore. If you want to verify some of the files as they are
+written into the image, specify them using \-jigdo\-force\-md5. If any
+files don't match, genisoimage will then abort. Both of these options take
+regular expressions as input. It is possible to restrict the set of
+files that will be used further based on size - use the
+\-jigdo\-min\-file\-size option.
+.PP
+Finally, the jigdo code needs to know how to map the files it is given
+onto a mirror-style configuration. Specify how to map paths using the
+\-jigdo\-map option. Using "Debian=/mirror/debian" will cause all
+paths starting with "/mirror/debian" to be mapped to "Debian:<file>"
+in the output jigdo file.
+.SH CONFIGURATION
+.B genisoimage
+looks for the
+.B \&.m\&kisofsrc
+file,
+first in the current working directory,
+then in the user's home directory,
+and then in the directory in which the
+.B genisoimage
+binary is stored.  This file is assumed to contain a series of lines
+of the form
+.BI TAG= value
+, and in this way you can specify certain options.
+The case of the tag is not significant.
+Some fields in the volume header
+are not settable on the command line, but can be altered through this
+facility.
+Comments may be placed in this file,
+using lines which start with a hash (#) character.
+.TP
+.B APPI
+The application identifier
+should describe the application that will be on the disc.
+There is space on the disc for 128 characters of information.
+May be overridden using the
+.B \-A
+command line option.
+.TP
+.B COPY
+The copyright information,
+often the name of a file on the disc containing the copyright notice.
+There is space in the disc for 37 characters of information.
+May be overridden using the
+.B \-copyright
+command line option.
+.TP
+.B ABST
+The abstract information,
+often the name of a file on the disc containing an abstract.
+There is space in the disc for 37 characters of information.
+May be overridden using the
+.B \-abstract
+command line option.
+.TP
+.B BIBL
+The bibliographic information,
+often the name of a file on the disc containing a bibliography.
+There is space in the disc for 37 characters of information.
+May be overridden using the
+.B \-bilio
+command line option.
+.TP
+.B PREP
+This should describe the preparer of the CD-ROM,
+usually with a mailing address and phone number.
+There is space on the disc for 128 characters of information.
+May be overridden using the
+.B \-p
+command line option.
+.TP
+.B PUBL
+This should describe the publisher of the CD-ROM,
+usually with a mailing address and phone number.
+There is space on the disc for 128 characters of information.
+May be overridden using the
+.B \-publisher
+command line option.
+.TP
+.B SYSI
+The System Identifier.
+There is space on the disc for 32 characters of information.
+May be overridden using the
+.B \-sysid
+command line option.
+.TP
+.B VOLI
+The Volume Identifier.
+There is space on the disc for 32 characters of information.
+May be overridden using the
+.B \-V
+command line option.
+.TP
+.B VOLS
+The Volume Set Name.
+There is space on the disc for 128 characters of information.
+May be overridden using the
+.B \-volset
+command line option.
+.TP
+.B HFS_TYPE
+The default TYPE for Macintosh files. Must be exactly 4 characters.
+May be overridden using the
+.B \-hfs\-type
+command line option.
+.TP
+.B HFS_CREATOR
+The default CREATOR for Macintosh files. Must be exactly 4 characters.
+May be overridden using the
+.B \-hfs\-creator
+command line option.
+.PP
+.B genisoimage
+can also be configured at compile time with defaults for many of these fields.
+See the file defaults.h.
+
+.SH EXAMPLES
+.PP
+To create a vanilla ISO9660 filesystem image in the file 
+.IR cd.iso ,
+where the directory
+.I cd_dir
+will become the root directory if the CD, call:
+.PP
+% genisoimage \-o cd.iso cd_dir
+.PP
+To create a CD with Rock Ridge extensions of
+the source directory
+.IR cd_dir :
+.PP
+% genisoimage \-o cd.iso \-R cd_dir
+.PP
+To create a CD with Rock Ridge extensions of
+the source directory
+.I cd_dir
+where all files have at least read permission and all files
+are owned by
+.IR root ,
+call:
+.PP
+% genisoimage \-o cd.iso \-r cd_dir
+.PP
+To write a tar archive directly to a CD that will later contain a simple
+ISO9660 filesystem with the tar archive call:
+.PP
+% star \-c . | genisoimage \-stream\-media\-size 333000 | \\
+.br
+wodim dev=b,t,l \-dao tsize=333000s \-
+.PP
+To create a HFS hybrid CD with the Joliet and Rock Ridge extensions of
+the source directory
+.IR cd_dir :
+.PP
+% genisoimage \-o cd.iso \-R \-J \-hfs cd_dir
+.PP
+To create a HFS hybrid CD from the source directory 
+.I cd_dir
+that contains
+Netatalk Apple/Unix files:
+.PP
+% genisoimage \-o cd.iso \-\-netatalk cd_dir
+.PP
+To create a HFS hybrid CD from the source directory
+.IR cd_dir ,
+giving all files
+CREATOR and TYPES based on just their filename extensions listed in the file 
+"mapping".:
+.PP
+% genisoimage \-o cd.iso \-map mapping cd_dir
+.PP
+To create a CD with the 'Apple Extensions to ISO9660', from the source
+directories
+.I cd_dir
+and
+.IR another_dir.
+Files in all the known Apple/Unix format
+are decoded and any other files are given CREATOR and TYPE based on their
+magic number given in the file "magic":
+.PP
+% genisoimage \-o cd.iso \-apple \-magic magic \-probe \\
+.br
+        cd_dir another_dir
+.PP
+The following example puts different files on the CD that all have
+the name README, but have different contents when seen as a
+ISO9660/Rock Ridge, Joliet or HFS CD.
+.PP
+Current directory contains:
+.PP
+% ls \-F
+.br
+README.hfs     README.joliet  README.Unix    cd_dir/
+.PP
+The following command puts the contents of the directory
+.I cd_dir
+on the
+CD along with the three README files - but only one will be seen from
+each of the three filesystems:
+.PP
+% genisoimage \-o cd.iso \-hfs \-J \-r \-graft\-points \\
+.br
+        \-hide README.hfs \-hide README.joliet \\
+.br
+        \-hide\-joliet README.hfs \-hide\-joliet README.Unix \\
+.br
+        \-hide\-hfs README.joliet \-hide\-hfs README.Unix \\
+.br
+        README=README.hfs README=README.joliet \\
+.br
+        README=README.Unix cd_dir
+.PP
+i.e. the file README.hfs will be seen as README on the HFS CD and the
+other two README files will be hidden. Similarly for the Joliet and
+ISO9660/Rock Ridge CD.
+.PP
+There are probably all sorts of strange results possible with
+combinations of the hide options ...
+
+.SH AUTHOR
+.PP
+.br
+Eric Youngdale <ericy at gnu.ai.mit.edu> or <eric at andante.org> wrote the
+first versions (1993 .\|.\|. 1998) of the m\&kisofs utility.
+The copyright for old versions of the m\&kisofs utility is held by
+Yggdrasil Computing, Incorporated.
+.PP
+Major additional parts were written or contributed by the following authors. Also
+see the MAINTAINER section below for recent information.
+.PP
+J\*org Schilling 
+wrote the SCSI transport library and its adaptation layer to
+.B genisoimage
+and newer parts (starting from 1999) of the utility, this makes
+.B genisoimage
+.br
+Copyright (C) 1999, 2000, 2001 J\*org Schilling.
+.PP
+HFS hybrid code, Copyright (C) James Pearson 1997, 1998, 1999, 2000, 2001
+.PP
+libhfs code, Copyright (C) 1996, 1997 Robert Leslie
+.PP
+libunls code, Copyright (C) James Pearson 2000, (C) Joerg Schilling 2001-2006, (C) Jungshik Shin 2002
+.PP
+iconv code, Copyright (C) 2003 Jungshik Shin, (C) 2003 Jaakko Heinonen
+.PP
+See MAINTAINER section for contact information.
+.SH NOTES
+.PP
+.B genisoimage
+is not based on the standard mk*fs tools for Unix, because we must generate
+a complete copy of an existing filesystem on a disk in the ISO9660
+filesystem.  The name genisoimage is probably a bit of a misnomer, since it
+not only creates the filesystem, but it also populates it.
+However, the appropriate tool name for a Unix tool that creates populated
+filesystems - mkproto - is not well known.
+.PP
+.B genisoimage
+may safely be installed suid root. This may be needed to allow
+.B genisoimage
+to read the previous session when creating a multi session image.
+.PP
+If 
+.B genisoimage 
+is creating a filesystem image with Rock Ridge attributes and the
+directory nesting level of the source directory tree is too much
+for ISO9660, 
+.B genisoimage 
+will do deep directory relocation.
+This results in a directory called
+.B RR_MOVED
+in the root directory of the CD. You cannot avoid this directory.
+.PP
+The sparc boot support that is implemented with the
+.B \-sparc\-boot
+options completely follows the official Sparc CD boot requirements from
+the Boot prom in Sun Sparc systems. Some Linux distributions for Sparc
+systems use a boot loader called
+.B SILO
+that unfortunately is not Sparc CD boot compliant.
+It is annoyingly to see that the Authors of SILO don't fix SILO but instead
+provide a completely unneeded "patch" to genisoimage that incorporates far
+more source than the fix for SILO would need.
+.SH BUGS
+.TP
+\(bu
+Any files that have hard links to files not in the tree being copied to the
+ISO9660 filesystem will have an incorrect file reference count.
+.TP
+\(bu
+Does not check for SUSP record(s) in "." entry of the
+root directory to verify the existence of Rock Ridge
+enhancements.
+.sp
+This problem is present when reading old sessions while
+adding data in multi-session mode.
+.TP
+\(bu
+Does not properly read relocated directories in multi-session
+mode when adding data.
+.sp
+Any relocated deep directory is lost if the new session does not
+include the deep directory.
+.sp
+Repeat by: create first session with deep directory relocation
+then add new session with a single dir that differs from the
+old deep path.
+.TP
+\(bu
+Does not re-use RR_MOVED when doing multi-session from TRANS.TBL
+.TP
+\(bu
+Does not create whole_name entry for RR_MOVED in multi-session
+mode.
+.PP
+There may be some other ones.  Please, report them to the author.
+
+.SH "HFS PROBLEMS/LIMITATIONS
+I have had to make several assumptions on how I expect the modified
+libhfs routines to work, however there may be situations that either
+I haven't thought of, or come across when these assumptions fail.
+Therefore I can't guarantee that genisoimage will work as expected
+(although I haven't had a major problem yet). Most of the HFS features work
+fine, however, some are not fully tested. These are marked as
+.I Alpha
+above.
+.PP
+Although HFS filenames appear to support upper and lower case letters,
+the filesystem is case insensitive. i.e. the filenames "aBc" and "AbC"
+are the same. If a file is found in a directory with the same HFS name, then
+.I genisoimage
+will attempt, where possible, to make a unique name by adding '_' characters
+to one of the filenames.
+.PP
+HFS file/directory names that share the first 31 characters have
+_N' (N == decimal number) substituted for the last few characters
+to generate unique names.
+.PP
+Care must be taken when "grafting" Apple/Unix files or directories (see
+above for the method and syntax involved). It is not possible to use a
+new name for an Apple/Unix encoded file/directory. e.g. If a Apple/Unix
+encoded file called "oldname" is to added to the CD, then you can not use
+the command line:
+.IP
+genisoimage \-o output.raw \-hfs \-graft\-points newname=oldname cd_dir
+.LP
+genisoimage will be unable to decode "oldname". However, you can graft
+Apple/Unix encoded files or directories as long as you do not attempt to
+give them new names as above.
+.PP
+When creating an HFS volume with the multisession options,
+.B \-M
+and
+.BR \-C ,
+only files in the last session will be in the HFS volume. i.e. genisoimage can
+not
+.I add
+existing files from previous sessions to the HFS volume.
+.PP
+However, if each session is created with the
+.B \-part
+option, then each session will appear as 
+separate volumes when mounted on a Mac. In this case, it is worth using the 
+.B \-V
+or
+.B \-hfs\-volid
+option to give each session a unique volume name,
+otherwise each "volume" will appear on the Desktop with the same name.
+.PP
+Symbolic links (as with all other non-regular files) are not added to
+the HFS directory.
+.PP
+Hybrid volumes may be larger than pure ISO9660 volumes
+containing the same data. In some cases (e.g. DVD sized volumes) the hybrid
+volume may be significantly larger. As an HFS volume gets bigger, so does the
+allocation block size (the smallest amount of space a file can occupy).
+For a 650Mb CD, the allocation block is 10Kb, for a 4.7Gb DVD it will be
+about 70Kb.
+.PP
+The maximum number of files in an HFS volume is about 65500 - although
+the real limit will be somewhat less than this.
+.PP
+The resulting hybrid volume can be accessed on a Unix machine by using
+the hfsutils routines. However, no changes can be made to the volume as it
+is set as
+.B locked.
+The option
+.B \-hfs\-unlock
+will create an output image that is unlocked - however no changes should be
+made to the contents of the volume (unless you really know what you are
+doing) as it's not a "real" HFS volume.
+.PP
+Using the
+.B \-mac\-name
+option will not currently work with the
+.B \-T
+option - the Unix
+name will be used in the TRANS.TBL file, not the Macintosh name.
+.PP
+Although 
+.B genisoimage
+does not alter the contents of a file, if a binary file has it's TYPE
+set as 'TEXT', it
+.I may
+be read incorrectly on a Macintosh. Therefore a better choice for the
+default TYPE may be '????'
+.PP
+The
+.B \-mac\-boot\-file
+option may not work at all...
+.PP
+May not work with PC Exchange v2.2 or higher files (available with MacOS 8.1).
+DOS media containing PC Exchange files should be mounted as type
+.B msdos
+(not
+.BR vfat )
+when using Linux.
+.PP
+The SFM format is only partially supported - see
+.B HFS MACINTOSH FILE FORMATS
+section above.
+.PP
+It is not possible to use the the
+.B \-sparc\-boot
+or
+.B \-generic\-boot
+options with the 
+.B \-boot\-hfs\-file
+or
+.B \-prep\-boot
+options.
+.PP
+.B genisoimage
+should be able to create HFS hybrid images over 4Gb, although this has not
+been fully tested.
+
+.SH "SEE ALSO
+.BR wodim (1),
+.BR mkzftree (8),
+.BR magic (5),
+.BR apple_driver (8).
+
+.SH "FUTURE IMPROVEMENTS
+Some sort of gui interface.
+.SH AVAILABILITY
+.B m\&kisofs
+is available as part of the cdrkit package from
+http://alioth.debian.org/projects/debburn/. For other implementations/spinoffs
+of genisoimage, look at the homepage of the particular developers.
+.B hfsutils
+from ftp://ftp.mars.org/pub/hfs
+.SH "MAILING LISTS
+If you want to actively take part on the development of m\&kisofs,
+you may join the Cdrkit developers mailing list by following the instructions on:
+.nf
+.sp
+https://alioth.debian.org/mail/?group_id=31006	
+.sp
+.fi
+and include the word
+.I subscribe
+in the body.
+The mail address of the list is:
+.nf
+.B
+debburn-devel at lists.alioth.debian.org
+.fi
+
+.SH MAINTAINER
+.PP
+This is the Cdrkit spinoff of the original mkisofs application. Maintained by:
+.nf
+Joerg Jaspert
+Eduard Bloch
+Steve McIntyre
+Ben Hutchings
+and other contributors
+.PP
+Cdrkit implementation of genisoimage is derived from mkisofs in the Cdrtools
+package [1] (however now developed independently), having previous maintainers:
+.PP
+.nf
+J\*org Schilling
+Seestr. 110
+D-13353 Berlin
+Germany
+.fi
+.PP
+.nf
+James Pearson (HFS MKHYBRID MAINTAINER)
+j.pearson at ge.ucl.ac.uk
+
+.PP
+If you have support questions, send them to:
+.PP
+.B
+debburn-devel at lists.alioth.debian.org
+
+.PP
+Note that Cdrkit is not affiliated to Cdrtools and vice versa.
+
+.SH ACKNOWLEDGEMENTS
+UNIX is a registered trademark of The Open Group in the US and other countries.
+
+.SH SOURCES
+.PP
+.br
+[1] Cdrtools 2.01.01a08 from May 2006, http://cdrecord.berlios.de
+

Copied: cdrkit/trunk/genisoimage/genisoimage.c (from rev 452, cdrkit/trunk/mkisoimage/genisoimage.c)

Copied: cdrkit/trunk/genisoimage/genisoimage.h (from rev 452, cdrkit/trunk/mkisoimage/genisoimage.h)

Deleted: cdrkit/trunk/genisoimage/hash.c
===================================================================
--- cdrkit/trunk/mkisoimage/hash.c	2006-11-23 21:37:32 UTC (rev 450)
+++ cdrkit/trunk/genisoimage/hash.c	2006-11-23 22:11:41 UTC (rev 453)
@@ -1,392 +0,0 @@
-/*
- * This file has been modified for the cdrkit suite.
- *
- * The behaviour and appearence of the program code below can differ to a major
- * extent from the version distributed by the original author(s).
- *
- * For details, see Changelog file distributed with the cdrkit package. If you
- * received this file from another source then ask the distributing person for
- * a log of modifications.
- *
- */
-
-/* @(#)hash.c	1.18 04/06/18 joerg */
-#ifndef lint
-static	char sccsid[] =
-	"@(#)hash.c	1.18 04/06/18 joerg";
-
-#endif
-/*
- * File hash.c - generate hash tables for iso9660 filesystem.
- *
- * Written by Eric Youngdale (1993).
- *
- * Copyright 1993 Yggdrasil Computing, Incorporated
- * Copyright (c) 1999,2000 J. Schilling
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-/* APPLE_HYB James Pearson j.pearson at ge.ucl.ac.uk 23/2/2000 */
-
-/*
- * From jb at danware.dk:
- *
- * Cygwin fakes inodes by hashing file info, actual collisions observed!
- * This is documented in the cygwin source, look at winsup/cygwin/path.cc
- * and search for the word 'Hash'.  On NT, cygwin ORs together the
- * high and low 32 bits of the 64 bit genuine inode, look at fhandler.cc.
- *
- * Note:	Other operating systems which support the FAT filesystem may
- *		have the same problem because FAT does not use the inode
- *		concept.  For NTFS, genuine inode numbers exist, but they are
- *		64 bits and available only through an open file handle.
- *
- * The solution is the new options -no-cache-inodes/-cache-inodes that
- * allow to disable the mkisoimage inode cache.
- */
-
-#include <mconfig.h>
-#include "mkisoimage.h"
-#include <schily.h>
-
-#define	NR_HASH	1024
-
-#define	HASH_FN(DEV, INO)	((DEV + INO + (INO >> 2) + (INO << 8)) % NR_HASH)
-
-static struct file_hash *hash_table[NR_HASH] = {0, };
-
-void		add_hash(struct directory_entry *spnt);
-struct file_hash *find_hash(dev_t dev, ino_t inode);
-void		flush_hash(void);
-void		add_directory_hash(dev_t dev, ino_t inode);
-struct file_hash *find_directory_hash(dev_t dev, ino_t inode);
-static	unsigned int	name_hash(const char *name);
-void		add_file_hash(struct directory_entry *de);
-struct directory_entry *find_file_hash(char *name);
-static	BOOL		isoname_endsok(char *name);
-int		delete_file_hash(struct directory_entry *de);
-void		flush_file_hash(void);
-
-void
-add_hash(struct directory_entry *spnt)
-{
-	struct file_hash *s_hash;
-	unsigned int    hash_number;
-
-	if (spnt->size == 0 || spnt->starting_block == 0)
-		if (spnt->size != 0 || spnt->starting_block != 0) {
-#ifdef	USE_LIBSCHILY
-			comerrno(EX_BAD,
-			"Non zero-length file '%s' assigned zero extent.\n",
-							spnt->name);
-#else
-			fprintf(stderr,
-			"Non zero-length file '%s' assigned zero extent.\n",
-							spnt->name);
-			exit(1);
-#endif
-		};
-
-	if (!cache_inodes)
-		return;
-	if (spnt->dev == (dev_t) UNCACHED_DEVICE ||
-				spnt->inode == UNCACHED_INODE) {
-		return;
-	}
-	hash_number = HASH_FN((unsigned int) spnt->dev,
-						(unsigned int) spnt->inode);
-
-#if 0
-	if (verbose > 1)
-		fprintf(stderr, "%s ", spnt->name);
-#endif
-	s_hash = (struct file_hash *) e_malloc(sizeof (struct file_hash));
-	s_hash->next = hash_table[hash_number];
-	s_hash->inode = spnt->inode;
-	s_hash->dev = spnt->dev;
-	s_hash->starting_block = spnt->starting_block;
-	s_hash->size = spnt->size;
-#ifdef SORTING
-	s_hash->de = spnt;
-#endif /* SORTING */
-	hash_table[hash_number] = s_hash;
-}
-
-struct file_hash *
-find_hash(dev_t dev, ino_t inode)
-{
-	unsigned int    hash_number;
-	struct file_hash *spnt;
-
-	if (!cache_inodes)
-		return (NULL);
-	if (dev == (dev_t) UNCACHED_DEVICE || inode == UNCACHED_INODE)
-		return (NULL);
-
-	hash_number = HASH_FN((unsigned int) dev, (unsigned int) inode);
-	spnt = hash_table[hash_number];
-	while (spnt) {
-		if (spnt->inode == inode && spnt->dev == dev)
-			return (spnt);
-		spnt = spnt->next;
-	};
-	return (NULL);
-}
-
-/*
- * based on flush_file_hash() below - needed as we want to re-use the
- * file hash table.
- */
-void
-flush_hash()
-{
-	struct file_hash	*fh;
-	struct file_hash	*fh1;
-	int			i;
-
-	for (i = 0; i < NR_HASH; i++) {
-		fh = hash_table[i];
-		while (fh) {
-			fh1 = fh->next;
-			free(fh);
-			fh = fh1;
-		}
-		hash_table[i] = NULL;
-	}
-}
-
-static struct file_hash *directory_hash_table[NR_HASH] = {0, };
-
-void
-add_directory_hash(dev_t dev, ino_t inode)
-{
-	struct file_hash *s_hash;
-	unsigned int    hash_number;
-
-	if (!cache_inodes)
-		return;
-	if (dev == (dev_t) UNCACHED_DEVICE || inode == UNCACHED_INODE)
-		return;
-
-	hash_number = HASH_FN((unsigned int) dev, (unsigned int) inode);
-
-	s_hash = (struct file_hash *) e_malloc(sizeof (struct file_hash));
-	s_hash->next = directory_hash_table[hash_number];
-	s_hash->inode = inode;
-	s_hash->dev = dev;
-	directory_hash_table[hash_number] = s_hash;
-}
-
-struct file_hash *
-find_directory_hash(dev_t dev, ino_t inode)
-{
-	unsigned int    hash_number;
-	struct file_hash *spnt;
-
-	if (!cache_inodes)
-		return (NULL);
-	if (dev == (dev_t) UNCACHED_DEVICE || inode == UNCACHED_INODE)
-		return (NULL);
-
-	hash_number = HASH_FN((unsigned int) dev, (unsigned int) inode);
-	spnt = directory_hash_table[hash_number];
-	while (spnt) {
-		if (spnt->inode == inode && spnt->dev == dev)
-			return (spnt);
-		spnt = spnt->next;
-	};
-	return (NULL);
-}
-
-struct name_hash {
-	struct name_hash *next;
-	struct directory_entry *de;
-};
-
-#define	NR_NAME_HASH	(256*1024)
-
-static struct name_hash *name_hash_table[NR_NAME_HASH] = {0, };
-
-/*
- * Find the hash bucket for this name.
- */
-static unsigned int
-name_hash(const char *name)
-{
-	unsigned int	hash = 0;
-	const char	*p;
-
-	p = name;
-
-	while (*p) {
-		/*
-		 * Don't hash the  iso9660 version number.
-		 * This way we can detect duplicates in cases where we have
-		 * directories (i.e. foo) and non-directories (i.e. foo;1).
-		 */
-		if (*p == ';') {
-			break;
-		}
-		hash = (hash << 15) + (hash << 3) + (hash >> 3) + *p++;
-	}
-	return (hash % NR_NAME_HASH);
-}
-
-void
-add_file_hash(struct directory_entry *de)
-{
-	struct name_hash	*new;
-	int			hash;
-
-	new = (struct name_hash *) e_malloc(sizeof (struct name_hash));
-	new->de = de;
-	new->next = NULL;
-	hash = name_hash(de->isorec.name);
-
-	/* Now insert into the hash table */
-	new->next = name_hash_table[hash];
-	name_hash_table[hash] = new;
-}
-
-struct directory_entry *
-find_file_hash(register char *name)
-{
-	register char			*p1;
-	register char			*p2;
-	register struct name_hash	*nh;
-
-	if (debug > 1)
-		fprintf(stderr, "find_hash('%s')\n", name);
-
-	for (nh = name_hash_table[name_hash(name)]; nh; nh = nh->next) {
-		p1 = name;
-		p2 = nh->de->isorec.name;
-		if (debug > 1)
-			fprintf(stderr, "Checking name '%s' isorec.name '%s'\n", p1, p2);
-
-		/* Look for end of string, or a mismatch. */
-		while (1 == 1) {
-			if ((*p1 == '\0' || *p1 == ';') ||
-			    (*p2 == '\0' || *p2 == ';') ||
-			    (*p1 != *p2)) {
-				break;
-			}
-			p1++;
-			p2++;
-		}
-		if (!isoname_endsok(p1) || !isoname_endsok(p2)) {
-			if (debug > 1) {
-				if (!isoname_endsok(p1))
-					fprintf(stderr, "'%s' does NOT END OK\n", p1);
-				if (!isoname_endsok(p2))
-					fprintf(stderr, "'%s' does NOT END OK\n", p2);
-			}
-			/*
-			 * If one file does not end with a valid version number
-			 * and the other name ends here, we found a miss match.
-			 */
-			if (*p1 == '\0' || *p2 == '\0')
-				continue;
-
-			if (*p1 == ';' && *p2 == ';') {
-				p1++;
-				p2++;
-				continue;
-			}
-			
-		}
-
-		/*
-		 * If we are at the end of both strings, then we have a match.
-		 */
-		if ((*p1 == '\0' || *p1 == ';') &&
-		    (*p2 == '\0' || *p2 == ';')) {
-			return (nh->de);
-		}
-	}
-	return (NULL);
-}
-
-/*
- * The macro 'eo' is just an idea on how one might speed up isoname_endsok()
- */
-#define	eo(p)	(((p)[0] == '\0') || \
-		((p)[0] == ';' && (p)[1] == '1' && (p)[2] == '\0') || \
-		isoname_endsok(p))
-
-static BOOL
-isoname_endsok(char *name)
-{
-	int	i;
-	char	*p;
-
-	if (*name == '\0')
-		return (TRUE);
-	if (*name != ';')
-		return (FALSE);
-
-	for (p = ++name, i = 0; *p && i < 5; p++, i++) {
-		if (*p < '0' || *p > '9')
-			return (FALSE);
-	}
-	i = atoi(name);
-	if (i < 1 || i > 32767)
-		return (FALSE);
-	return (TRUE);
-}
-
-int
-delete_file_hash(struct directory_entry *de)
-{
-	struct name_hash	*nh;
-	struct name_hash	*prev;
-	int			hash;
-
-	prev = NULL;
-	hash = name_hash(de->isorec.name);
-	for (nh = name_hash_table[hash]; nh; nh = nh->next) {
-		if (nh->de == de)
-			break;
-		prev = nh;
-	}
-	if (!nh)
-		return (1);
-	if (!prev)
-		name_hash_table[hash] = nh->next;
-	else
-		prev->next = nh->next;
-	free(nh);
-	return (0);
-}
-
-void
-flush_file_hash()
-{
-	struct name_hash	*nh;
-	struct name_hash	*nh1;
-	int			i;
-
-	for (i = 0; i < NR_NAME_HASH; i++) {
-		nh = name_hash_table[i];
-		while (nh) {
-			nh1 = nh->next;
-			free(nh);
-			nh = nh1;
-		}
-		name_hash_table[i] = NULL;
-
-	}
-}

Copied: cdrkit/trunk/genisoimage/hash.c (from rev 452, cdrkit/trunk/mkisoimage/hash.c)

Deleted: cdrkit/trunk/genisoimage/ifo_read.c
===================================================================
--- cdrkit/trunk/mkisoimage/ifo_read.c	2006-11-23 21:37:32 UTC (rev 450)
+++ cdrkit/trunk/genisoimage/ifo_read.c	2006-11-23 22:11:41 UTC (rev 453)
@@ -1,563 +0,0 @@
-/*
- * This file has been modified for the cdrkit suite.
- *
- * The behaviour and appearence of the program code below can differ to a major
- * extent from the version distributed by the original author(s).
- *
- * For details, see Changelog file distributed with the cdrkit package. If you
- * received this file from another source then ask the distributing person for
- * a log of modifications.
- *
- */
-
-/* @(#)ifo_read.c	1.5 04/03/04 joerg */
-#ifndef lint
-static	char sccsid[] =
-	"@(#)ifo_read.c	1.5 04/03/04 joerg";
-#endif
-/*
- * Copyright (C) 2002 Olaf Beck <olaf_sc at yahoo.com>
- *		     Jörg Schilling <schilling at fokus.gmd.de>
- *		     (making the code portable)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-/*
- * NOTE: This is a cut down version of libdvdread for mkisoimage, due
- * to portability issues with the current libdvdread according to
- * the maintainer of mkisoimage.
- * This cut down version only reads from a harddisk file structure
- * and it only implements the functions necessary inorder to make
- * mkisoimage produce valid DVD-Video images.
- * DON'T USE THIS LIBRARY IN ANY OTHER PROGRAM GET THE REAL
- * LIBDVDREAD INSTEAD
- */
-#ifdef DVD_VIDEO
-
-#include <mconfig.h>
-#include "mkisoimage.h"
-#include <fctldefs.h>
-#include <utypes.h>
-#include <schily.h>
-
-#include "ifo_read.h"
-#include "bswap.h"
-
-#define MSGEREAD "Failed to read VIDEO_TS.IFO\n"
-#define MSGESEEK "Failed to seek VIDEO_TS.IFO\n"
-#define MSGEOPEN "Failed to open VIDEO_TS.IFO\n"
-
-static	ifo_handle_t *ifoReadVTSI(int file, ifo_handle_t * ifofile);
-static	ifo_handle_t *ifoReadVGMI(int file, ifo_handle_t * ifofile);
-ifo_handle_t *ifoOpen(dvd_reader_t *dvd, int title);
-static	void		ifoFree_TT_SRPT(ifo_handle_t *ifofile);
-void		ifoClose(ifo_handle_t * ifofile);
-
-
-static ifo_handle_t *
-ifoReadVTSI(int file, ifo_handle_t *ifofile)
-{
-	off_t offset;
-	UInt32_t sector;
-
-	vtsi_mat_t * vtsi_mat;
-
-	/* Make the VMG part NULL */
-	ifofile->vmgi_mat = NULL;
-	ifofile->tt_srpt = NULL;
-
-	vtsi_mat = (vtsi_mat_t *)e_malloc(sizeof (vtsi_mat_t));
-	if (!vtsi_mat) {
-/*		fprintf(stderr, "Memmory allocation error\n");*/
-		free(ifofile);
-		return (0);
-	}
-
-	ifofile->vtsi_mat = vtsi_mat;
-
-	/* Last sector of VTS i.e. last sector of BUP */
-
-	offset = 12;
-
-	if (lseek(file, offset, SEEK_SET) != offset) {
-#ifdef	USE_LIBSCHILY
-		errmsg(MSGESEEK);
-#else
-		printf(stderr, MSGESEEK);
-#endif
-		ifoClose(ifofile);
-		return (0);
-	}
-
-	if (read(file, &sector, sizeof (sector)) != sizeof (sector)) {
-#ifdef	USE_LIBSCHILY
-		errmsg(MSGEREAD);
-#else
-		printf(stderr, MSGEREAD);
-#endif
-		ifoClose(ifofile);
-		return (0);
-	}
-
-	B2N_32(sector);
-
-	vtsi_mat->vts_last_sector = sector;
-
-	/* Last sector of IFO */
-
-	offset = 28;
-
-	if (lseek(file, offset, SEEK_SET) != offset) {
-#ifdef	USE_LIBSCHILY
-		errmsg(MSGESEEK);
-#else
-		printf(stderr, MSGESEEK);
-#endif
-		ifoClose(ifofile);
-		return (0);
-	}
-
-	if (read(file, &sector, sizeof (sector)) != sizeof (sector)) {
-#ifdef	USE_LIBSCHILY
-		errmsg(MSGEREAD);
-#else
-		printf(stderr, MSGEREAD);
-#endif
-		ifoClose(ifofile);
-		return (0);
-	}
-
-	B2N_32(sector);
-
-	vtsi_mat->vtsi_last_sector = sector;
-
-
-	/* Star sector of VTS Menu VOB */
-
-	offset = 192;
-
-	if (lseek(file, offset, SEEK_SET) != offset) {
-#ifdef	USE_LIBSCHILY
-		errmsg(MSGESEEK);
-#else
-		printf(stderr, MSGESEEK);
-#endif
-		ifoClose(ifofile);
-		return (0);
-	}
-
-
-	if (read(file, &sector, sizeof (sector)) != sizeof (sector)) {
-#ifdef	USE_LIBSCHILY
-		errmsg(MSGEREAD);
-#else
-		printf(stderr, MSGEREAD);
-#endif
-		ifoClose(ifofile);
-		return (0);
-	}
-
-	B2N_32(sector);
-
-	vtsi_mat->vtsm_vobs = sector;
-
-
-	/* Start sector of VTS Title VOB */
-
-	offset = 196;
-
-	if (lseek(file, offset, SEEK_SET) != offset) {
-#ifdef	USE_LIBSCHILY
-		errmsg(MSGESEEK);
-#else
-		printf(stderr, MSGESEEK);
-#endif
-		ifoClose(ifofile);
-		return (0);
-	}
-
-
-	if (read(file, &sector, sizeof (sector)) != sizeof (sector)) {
-#ifdef	USE_LIBSCHILY
-		errmsg(MSGEREAD);
-#else
-		printf(stderr, MSGEREAD);
-#endif
-		ifoClose(ifofile);
-		return (0);
-	}
-
-	B2N_32(sector);
-
-	vtsi_mat->vtstt_vobs = sector;
-
-	return (ifofile);
-}
-
-
-static ifo_handle_t *
-ifoReadVGMI(int file, ifo_handle_t *ifofile)
-{
-	off_t	offset;
-	Uint	counter;
-	UInt32_t sector;
-	UInt16_t titles;
-
-	vmgi_mat_t *vmgi_mat;
-	tt_srpt_t *tt_srpt;
-
-	/* Make the VTS part null */
-	ifofile->vtsi_mat = NULL;
-
-	vmgi_mat = (vmgi_mat_t *)e_malloc(sizeof (vmgi_mat_t));
-	if (!vmgi_mat) {
-/*		fprintf(stderr, "Memmory allocation error\n");*/
-		free(ifofile);
-		return (0);
-	}
-
-	ifofile->vmgi_mat = vmgi_mat;
-
-	/* Last sector of VMG i.e. last sector of BUP */
-
-	offset = 12;
-
-	if (lseek(file, offset, SEEK_SET) != offset) {
-#ifdef	USE_LIBSCHILY
-		errmsg(MSGESEEK);
-#else
-		printf(stderr, MSGESEEK);
-#endif
-		ifoClose(ifofile);
-		return (0);
-	}
-
-	if (read(file, &sector, sizeof (sector)) != sizeof (sector)) {
-#ifdef	USE_LIBSCHILY
-		errmsg(MSGEREAD);
-#else
-		printf(stderr, MSGEREAD);
-#endif
-		ifoClose(ifofile);
-		return (0);
-	}
-
-	B2N_32(sector);
-
-	vmgi_mat->vmg_last_sector = sector;
-
-	/* Last sector of IFO */
-
-	offset = 28;
-
-	if (lseek(file, offset, SEEK_SET) != offset) {
-#ifdef	USE_LIBSCHILY
-		errmsg(MSGESEEK);
-#else
-		printf(stderr, MSGESEEK);
-#endif
-		ifoClose(ifofile);
-		return (0);
-	}
-
-
-	if (read(file, &sector, sizeof (sector)) != sizeof (sector)) {
-#ifdef	USE_LIBSCHILY
-		errmsg(MSGEREAD);
-#else
-		printf(stderr, MSGEREAD);
-#endif
-		ifoClose(ifofile);
-		return (0);
-	}
-
-	B2N_32(sector);
-
-	vmgi_mat->vmgi_last_sector = sector;
-
-
-	/* Number of VTS i.e. title sets */
-
-	offset = 62;
-
-	if (lseek(file, offset, SEEK_SET) != offset) {
-#ifdef	USE_LIBSCHILY
-		errmsg(MSGESEEK);
-#else
-		printf(stderr, MSGESEEK);
-#endif
-		ifoClose(ifofile);
-		return (0);
-	}
-
-
-	if (read(file, &titles, sizeof (titles)) != sizeof (titles)) {
-#ifdef	USE_LIBSCHILY
-		errmsg(MSGEREAD);
-#else
-		printf(stderr, MSGEREAD);
-#endif
-		ifoClose(ifofile);
-		return (0);
-	}
-
-	B2N_16(titles);
-
-	vmgi_mat->vmg_nr_of_title_sets = titles;
-
-
-	/* Star sector of VMG Menu VOB */
-
-	offset = 192;
-
-	if (lseek(file, offset, SEEK_SET) != offset) {
-#ifdef	USE_LIBSCHILY
-		errmsg(MSGESEEK);
-#else
-		printf(stderr, MSGESEEK);
-#endif
-		ifoClose(ifofile);
-		return (0);
-	}
-
-
-	if (read(file, &sector, sizeof (sector)) != sizeof (sector)) {
-#ifdef	USE_LIBSCHILY
-		errmsg(MSGEREAD);
-#else
-		printf(stderr, MSGEREAD);
-#endif
-		ifoClose(ifofile);
-		return (0);
-	}
-
-	B2N_32(sector);
-
-	vmgi_mat->vmgm_vobs = sector;
-
-
-	/* Sector offset to TT_SRPT */
-
-	offset = 196;
-
-	if (lseek(file, offset, SEEK_SET) != offset) {
-#ifdef	USE_LIBSCHILY
-		errmsg(MSGESEEK);
-#else
-		printf(stderr, MSGESEEK);
-#endif
-		ifoClose(ifofile);
-		return (0);
-	}
-
-
-	if (read(file, &sector, sizeof (sector)) != sizeof (sector)) {
-#ifdef	USE_LIBSCHILY
-		errmsg(MSGEREAD);
-#else
-		printf(stderr, MSGEREAD);
-#endif
-		ifoClose(ifofile);
-		return (0);
-	}
-
-	B2N_32(sector);
-
-	vmgi_mat->tt_srpt = sector;
-
-	tt_srpt = (tt_srpt_t *)e_malloc(sizeof (tt_srpt_t));
-	if (!tt_srpt) {
-/*		fprintf(stderr, "Memmory allocation error\n");*/
-		ifoClose(ifofile);
-		return (0);
-	}
-
-	ifofile->tt_srpt = tt_srpt;
-
-
-	/* Number of titles in TT_SRPT */
-
-	offset = 2048 * vmgi_mat->tt_srpt;
-
-	if (lseek(file, offset, SEEK_SET) != offset) {
-#ifdef	USE_LIBSCHILY
-		errmsg(MSGESEEK);
-#else
-		printf(stderr, MSGESEEK);
-#endif
-		return (0);
-	}
-
-	if (read(file, &titles, sizeof (titles)) != sizeof (titles)) {
-#ifdef	USE_LIBSCHILY
-		errmsg(MSGEREAD);
-#else
-		printf(stderr, MSGEREAD);
-#endif
-		return (0);
-	}
-
-	B2N_16(titles);
-
-	tt_srpt->nr_of_srpts = titles;
-
-	tt_srpt->title = (title_info_t *)e_malloc(sizeof (title_info_t) * tt_srpt->nr_of_srpts);
-	if (!tt_srpt->title) {
-/*		fprintf(stderr, "Memmory allocation error\n");*/
-		ifoClose(ifofile);
-		return (0);
-	}
-
-	/* Start sector of each title in TT_SRPT */
-
-	for (counter = 0; counter < tt_srpt->nr_of_srpts; counter++) {
-		offset = (2048 * vmgi_mat->tt_srpt) + 8 + (counter * 12) + 8;
-		if (lseek(file, offset, SEEK_SET) != offset) {
-#ifdef	USE_LIBSCHILY
-			errmsg(MSGESEEK);
-#else
-			printf(stderr, MSGESEEK);
-#endif
-			ifoClose(ifofile);
-			return (0);
-		}
-
-		if (read(file, &sector, sizeof (sector)) != sizeof (sector)) {
-#ifdef	USE_LIBSCHILY
-			errmsg(MSGEREAD);
-#else
-			printf(stderr, MSGEREAD);
-#endif
-			ifoClose(ifofile);
-			return (0);
-		}
-
-		B2N_32(sector);
-
-		tt_srpt->title[counter].title_set_sector = sector;
-
-	}
-	return (ifofile);
-}
-
-ifo_handle_t *
-ifoOpen(dvd_reader_t *dvd, int title)
-{
-	/* The main ifofile structure */
-	ifo_handle_t *ifofile;
-
-	/* File handles and offset */
-	int file;
-	off_t offset;
-	char full_path[ PATH_MAX + 1 ];
-
-	/* Identifier of the IFO */
-	char identifier[13];
-
-	identifier[0] = '\0';
-
-	ifofile = (ifo_handle_t *)e_malloc(sizeof (ifo_handle_t));
-
-	memset(ifofile, 0, sizeof (ifo_handle_t));
-
-	if (title) {
-		snprintf(full_path, sizeof (full_path),
-				"%s/VIDEO_TS/VTS_%02d_0.IFO", dvd->path_root, title);
-	} else {
-		snprintf(full_path, sizeof (full_path),
-				"%s/VIDEO_TS/VIDEO_TS.IFO", dvd->path_root);
-	}
-
-	if ((file = open(full_path, O_RDONLY | O_BINARY)) == -1) {
-#ifdef	USE_LIBSCHILY
-		errmsg(MSGEOPEN);
-#else
-		printf(stderr, MSGEOPEN);
-#endif
-		free(ifofile);
-		return (0);
-	}
-
-	offset = 0;
-
-	/* Determine if we have a VMGI or VTSI */
-
-	if (read(file, identifier, sizeof (identifier)) != sizeof (identifier)) {
-#ifdef	USE_LIBSCHILY
-		errmsg(MSGEREAD);
-#else
-		printf(stderr, MSGEREAD);
-#endif
-		return (0);
-	}
-
-	if ((strstr("DVDVIDEO-VMG", identifier) != 0) && (title == 0)) {
-		ifofile = ifoReadVGMI(file, ifofile);
-		close(file);
-		return (ifofile);
-	} else if ((strstr("DVDVIDEO-VTS", identifier) != 0) && (title != 0)) {
-		ifofile = ifoReadVTSI(file, ifofile);
-		close(file);
-		return (ifofile);
-	} else {
-#ifdef	USE_LIBSCHILY
-		errmsgno(EX_BAD, "Giving up this is not a valid IFO file\n");
-#else
-		fprintf(stderr, "Giving up this is not a valid IFO file\n");
-#endif
-		close(file);
-		free(ifofile);
-		ifofile = 0;
-		return (0);
-	}
-}
-
-static void
-ifoFree_TT_SRPT(ifo_handle_t *ifofile)
-{
-	if (!ifofile)
-		return;
-
-	if (ifofile->tt_srpt) {
-		if (ifofile->tt_srpt->title) {
-			free(ifofile->tt_srpt->title);
-		}
-		free(ifofile->tt_srpt);
-		ifofile->tt_srpt = 0;
-	}
-}
-
-void
-ifoClose(ifo_handle_t *ifofile)
-{
-
-	if (!ifofile)
-		return;
-
-	ifoFree_TT_SRPT(ifofile);
-
-	if (ifofile->vmgi_mat) {
-		free(ifofile->vtsi_mat);
-	}
-
-	if (ifofile->vtsi_mat) {
-		free(ifofile->vtsi_mat);
-	}
-
-	free(ifofile);
-	ifofile = 0;
-}
-#endif /* DVD_VIDEO */

Copied: cdrkit/trunk/genisoimage/ifo_read.c (from rev 452, cdrkit/trunk/mkisoimage/ifo_read.c)

Deleted: cdrkit/trunk/genisoimage/ifo_read.h
===================================================================
--- cdrkit/trunk/mkisoimage/ifo_read.h	2006-11-23 21:37:32 UTC (rev 450)
+++ cdrkit/trunk/genisoimage/ifo_read.h	2006-11-23 22:11:41 UTC (rev 453)
@@ -1,81 +0,0 @@
-/*
- * This file has been modified for the cdrkit suite.
- *
- * The behaviour and appearence of the program code below can differ to a major
- * extent from the version distributed by the original author(s).
- *
- * For details, see Changelog file distributed with the cdrkit package. If you
- * received this file from another source then ask the distributing person for
- * a log of modifications.
- *
- */
-
-/* @(#)ifo_read.h	1.2 04/03/02 joerg */
-
-#ifndef	_IFO_READ_H
-#define	_IFO_READ_H
-
-/*
- * Copyright (C) 2000, 2001, 2002 Björn Englund <d4bjorn at dtek.chalmers.se>,
- *				  Håkan Hjort <d95hjort at dtek.chalmers.se
- *				  Olaf Beck <olaf_sc at yahoo.com>
- *				  (I only did the cut down no other contribs)
- *				  Jörg Schilling <schilling at fokus.gmd.de>
- *				  (making the code portable)
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-/*
- * NOTE: This is a cut down version of libdvdread for mkisoimage, due
- * to portability issues with the current libdvdread according to
- * the maintainer of mkisoimage.
- * This cut down version only reads from a harddisk file structure
- * and it only implements the functions necessary inorder to make
- * mkisoimage produce valid DVD-Video images.
- * DON'T USE THIS LIBRARY IN ANY OTHER PROGRAM GET THE REAL
- * LIBDVDREAD INSTEAD
- */
-
-
-
-#include "ifo_types.h"
-#include "dvd_reader.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*
- * handle = ifoOpen(dvd, title);
- *
- * Opens an IFO and reads a tiny fraction of the data for the IFO file
- * corresponding to the given title set. If title 0 is given, the video
- * manager IFO file is read.
- * Returns a handle to a tiny parsed fraction of a IFO strcuture
- */
-extern	ifo_handle_t *ifoOpen(dvd_reader_t *, int);
-
-
-/*
- * ifoClose(ifofile);
- * Cleans up the IFO information. This will free all data allocated.
- */
-extern	void ifoClose(ifo_handle_t *);
-
-#ifdef __cplusplus
-};
-#endif
-#endif /* _IFO_READ_H */

Copied: cdrkit/trunk/genisoimage/ifo_read.h (from rev 452, cdrkit/trunk/mkisoimage/ifo_read.h)

Deleted: cdrkit/trunk/genisoimage/ifo_types.h
===================================================================
--- cdrkit/trunk/mkisoimage/ifo_types.h	2006-11-23 21:37:32 UTC (rev 450)
+++ cdrkit/trunk/genisoimage/ifo_types.h	2006-11-23 22:11:41 UTC (rev 453)
@@ -1,91 +0,0 @@
-/*
- * This file has been modified for the cdrkit suite.
- *
- * The behaviour and appearence of the program code below can differ to a major
- * extent from the version distributed by the original author(s).
- *
- * For details, see Changelog file distributed with the cdrkit package. If you
- * received this file from another source then ask the distributing person for
- * a log of modifications.
- *
- */
-
-/* @(#)ifo_types.h	1.2 04/03/02 joerg */
-
-#ifndef	_IFO_TYPES_H
-#define	_IFO_TYPES_H
-/*
- * Copyright (C) 2001, 2002 Billy Biggs <vektor at dumbterm.net>,
- *			    Håkan Hjort <d95hjort at dtek.chalmers.se>,
- *			    Olaf Beck <olaf_sc at yahoo.com>
- *			    (I only did the cut down no other contribs)
- *			    Jörg Schilling <schilling at fokus.gmd.de>
- *			    (making the code portable)
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-/*
- * NOTE: This is a cut down version of libdvdread for mkisoimage, due
- * to portability issues with the current libdvdread according to
- * the maintainer of mkisoimage.
- * This cut down version only reads from a harddisk file structure
- * and it only implements the functions necessary inorder to make
- * mkisoimage produce valid DVD-Video images.
- * DON'T USE THIS LIBRARY IN ANY OTHER PROGRAM GET THE REAL
- * LIBDVDREAD INSTEAD
- */
-
-#include "dvd_reader.h"
-
-
-typedef struct {
-	UInt32_t	title_set_sector; 	/* sector */
-} title_info_t;
-
-
-typedef struct {
-	UInt16_t	nr_of_srpts;
-	title_info_t *	title;			/* array of title info */
-} tt_srpt_t;
-
-typedef struct {
-	UInt32_t	vmg_last_sector;	/*sector */
-	UInt32_t	vmgi_last_sector;	/* sector */
-	UInt16_t	vmg_nr_of_title_sets;
-	UInt32_t	vmgm_vobs;		/* sector */
-	UInt32_t	tt_srpt;		/* sector */
-} vmgi_mat_t;
-
-
-
-typedef struct {
-	UInt32_t	vts_last_sector;	/* sector */
-	UInt32_t	vtsi_last_sector;	/* sector */
-	UInt32_t	vtsm_vobs;		/* sector */
-	UInt32_t	vtstt_vobs;		/* sector */
-} vtsi_mat_t;
-
-
-typedef struct {
-	/* VMGI */
-	vmgi_mat_t *	vmgi_mat;
-	tt_srpt_t  *	tt_srpt;
-
-	/* VTSI */
-	vtsi_mat_t *	vtsi_mat;
-} ifo_handle_t;
-
-
-#endif	/* _IFO_TYPES_H */

Copied: cdrkit/trunk/genisoimage/ifo_types.h (from rev 452, cdrkit/trunk/mkisoimage/ifo_types.h)

Deleted: cdrkit/trunk/genisoimage/iso9660.h
===================================================================
--- cdrkit/trunk/mkisoimage/iso9660.h	2006-11-23 21:37:32 UTC (rev 450)
+++ cdrkit/trunk/genisoimage/iso9660.h	2006-11-23 22:11:41 UTC (rev 453)
@@ -1,359 +0,0 @@
-/*
- * This file has been modified for the cdrkit suite.
- *
- * The behaviour and appearence of the program code below can differ to a major
- * extent from the version distributed by the original author(s).
- *
- * For details, see Changelog file distributed with the cdrkit package. If you
- * received this file from another source then ask the distributing person for
- * a log of modifications.
- *
- */
-
-/* @(#)iso9660.h	1.19 04/03/02 joerg */
-/*
- * Header file iso9660.h - assorted structure definitions and typecasts.
- * specific to iso9660 filesystem.
- *
- * Written by Eric Youngdale (1993).
- *
- * Copyright 1993 Yggdrasil Computing, Incorporated
- * Copyright (c) 1999,2000-2004 J. Schilling
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef	_ISOFS_FS_H
-#define	_ISOFS_FS_H
-
-/*
- * The isofs filesystem constants/structures
- */
-
-/* This part borrowed from the bsd386 isofs */
-#define	ISODCL(from, to) (to - from + 1)
-
-struct iso_volume_descriptor {
-	char type	[ISODCL(1, 1)]; /* 711 */
-	char id		[ISODCL(2, 6)];
-	char version	[ISODCL(7, 7)];
-	char data	[ISODCL(8, 2048)];
-};
-
-/* volume descriptor types */
-#define	ISO_VD_PRIMARY		1
-#define	ISO_VD_SUPPLEMENTARY	2	/* Used by Joliet */
-#define	ISO_VD_END		255
-
-#define	ISO_STANDARD_ID		"CD001"
-
-#define	EL_TORITO_ID		"EL TORITO SPECIFICATION"
-#define	EL_TORITO_ARCH_x86	0
-#define	EL_TORITO_ARCH_PPC	1
-#define	EL_TORITO_ARCH_MAC	2
-
-#define	EL_TORITO_BOOTABLE	0x88
-#define	EL_TORITO_NOT_BOOTABLE	0
-
-#define	EL_TORITO_MEDIA_NOEMUL	0
-#define	EL_TORITO_MEDIA_12FLOP	1
-#define	EL_TORITO_MEDIA_144FLOP	2
-#define	EL_TORITO_MEDIA_288FLOP	3
-#define	EL_TORITO_MEDIA_HD	4
-
-struct iso_primary_descriptor {
-	char type			[ISODCL(1,    1)]; /* 711 */
-	char id				[ISODCL(2,    6)];
-	char version			[ISODCL(7,    7)]; /* 711 */
-	char unused1			[ISODCL(8,    8)];
-	char system_id			[ISODCL(9,   40)]; /* achars */
-	char volume_id			[ISODCL(41,  72)]; /* dchars */
-	char unused2			[ISODCL(73,  80)];
-	char volume_space_size		[ISODCL(81,  88)]; /* 733 */
-	char escape_sequences		[ISODCL(89, 120)];
-	char volume_set_size		[ISODCL(121, 124)]; /* 723 */
-	char volume_sequence_number	[ISODCL(125, 128)]; /* 723 */
-	char logical_block_size		[ISODCL(129, 132)]; /* 723 */
-	char path_table_size		[ISODCL(133, 140)]; /* 733 */
-	char type_l_path_table		[ISODCL(141, 144)]; /* 731 */
-	char opt_type_l_path_table	[ISODCL(145, 148)]; /* 731 */
-	char type_m_path_table		[ISODCL(149, 152)]; /* 732 */
-	char opt_type_m_path_table	[ISODCL(153, 156)]; /* 732 */
-	char root_directory_record	[ISODCL(157, 190)]; /* 9.1 */
-	char volume_set_id		[ISODCL(191, 318)]; /* dchars */
-	char publisher_id		[ISODCL(319, 446)]; /* achars */
-	char preparer_id		[ISODCL(447, 574)]; /* achars */
-	char application_id		[ISODCL(575, 702)]; /* achars */
-	char copyright_file_id		[ISODCL(703, 739)]; /* 7.5 dchars */
-	char abstract_file_id		[ISODCL(740, 776)]; /* 7.5 dchars */
-	char bibliographic_file_id	[ISODCL(777, 813)]; /* 7.5 dchars */
-	char creation_date		[ISODCL(814, 830)]; /* 8.4.26.1 */
-	char modification_date		[ISODCL(831, 847)]; /* 8.4.26.1 */
-	char expiration_date		[ISODCL(848, 864)]; /* 8.4.26.1 */
-	char effective_date		[ISODCL(865, 881)]; /* 8.4.26.1 */
-	char file_structure_version	[ISODCL(882, 882)]; /* 711 */
-	char unused4			[ISODCL(883, 883)];
-	char application_data		[ISODCL(884, 1395)];
-	char unused5			[ISODCL(1396, 2048)];
-};
-
-/*
- * Supplementary or enhanced volume descriptor
- */
-struct iso_enhanced_descriptor {
-	char type			[ISODCL(1,    1)]; /* 711 */
-	char id				[ISODCL(2,    6)];
-	char version			[ISODCL(7,    7)]; /* 711 */
-	char flags			[ISODCL(8,    8)];
-	char system_id			[ISODCL(9,   40)]; /* achars */
-	char volume_id			[ISODCL(41,  72)]; /* dchars */
-	char unused2			[ISODCL(73,  80)];
-	char volume_space_size		[ISODCL(81,  88)]; /* 733 */
-	char escape_sequences		[ISODCL(89, 120)];
-	char volume_set_size		[ISODCL(121, 124)]; /* 723 */
-	char volume_sequence_number	[ISODCL(125, 128)]; /* 723 */
-	char logical_block_size		[ISODCL(129, 132)]; /* 723 */
-	char path_table_size		[ISODCL(133, 140)]; /* 733 */
-	char type_l_path_table		[ISODCL(141, 144)]; /* 731 */
-	char opt_type_l_path_table	[ISODCL(145, 148)]; /* 731 */
-	char type_m_path_table		[ISODCL(149, 152)]; /* 732 */
-	char opt_type_m_path_table	[ISODCL(153, 156)]; /* 732 */
-	char root_directory_record	[ISODCL(157, 190)]; /* 9.1 */
-	char volume_set_id		[ISODCL(191, 318)]; /* dchars */
-	char publisher_id		[ISODCL(319, 446)]; /* achars */
-	char preparer_id		[ISODCL(447, 574)]; /* achars */
-	char application_id		[ISODCL(575, 702)]; /* achars */
-	char copyright_file_id		[ISODCL(703, 739)]; /* 7.5 dchars */
-	char abstract_file_id		[ISODCL(740, 776)]; /* 7.5 dchars */
-	char bibliographic_file_id	[ISODCL(777, 813)]; /* 7.5 dchars */
-	char creation_date		[ISODCL(814, 830)]; /* 8.4.26.1 */
-	char modification_date		[ISODCL(831, 847)]; /* 8.4.26.1 */
-	char expiration_date		[ISODCL(848, 864)]; /* 8.4.26.1 */
-	char effective_date		[ISODCL(865, 881)]; /* 8.4.26.1 */
-	char file_structure_version	[ISODCL(882, 882)]; /* 711 */
-	char unused4			[ISODCL(883, 883)];
-	char application_data		[ISODCL(884, 1395)];
-	char unused5			[ISODCL(1396, 2048)];
-};
-
-/* El Torito Boot Record Volume Descriptor */
-struct eltorito_boot_descriptor {
-	char type			[ISODCL(1,    1)]; /* 711 */
-	char id				[ISODCL(2,    6)];
-	char version			[ISODCL(7,    7)]; /* 711 */
-	char system_id			[ISODCL(8,   39)];
-	char unused2			[ISODCL(40,  71)];
-	char bootcat_ptr		[ISODCL(72,  75)];
-	char unused5			[ISODCL(76, 2048)];
-};
-
-/* Validation entry for El Torito */
-struct eltorito_validation_entry {
-	char headerid			[ISODCL(1,    1)]; /* 711 */
-	char arch			[ISODCL(2,    2)];
-	char pad1			[ISODCL(3,    4)]; /* 711 */
-	char id				[ISODCL(5,   28)]; /* CD devel/man*/
-	char cksum			[ISODCL(29,  30)];
-	char key1			[ISODCL(31,  31)];
-	char key2			[ISODCL(32,  32)];
-};
-
-/* El Torito initial/default entry in boot catalog */
-struct eltorito_defaultboot_entry {
-	char boot_id			[ISODCL(1,    1)]; /* 711 */
-	char boot_media			[ISODCL(2,    2)];
-	char loadseg			[ISODCL(3,    4)]; /* 711 */
-	char sys_type			[ISODCL(5,    5)];
-	char pad1			[ISODCL(6,    6)];
-	char nsect			[ISODCL(7,    8)];
-	char bootoff			[ISODCL(9,   12)];
-	char pad2			[ISODCL(13,  32)];
-};
-
-/*
- * XXX JS: The next two structures have odd lengths!
- * Some compilers (e.g. on Sun3/mc68020) padd the structures to even length.
- * For this reason, we cannot use sizeof (struct iso_path_table) or
- * sizeof (struct iso_directory_record) to compute on disk sizes.
- * Instead, we use offsetof(..., name) and add the name size.
- * See mkisoimage.h
- */
-
-/* We use this to help us look up the parent inode numbers. */
-
-struct iso_path_table {
-	unsigned char  name_len[2];	/* 721 */
-	char extent[4];			/* 731 */
-	char  parent[2];		/* 721 */
-	char name[1];
-};
-
-/*
- * A ISO filename is: "abcde.eee;1" -> <filename> '.' <ext> ';' <version #>
- *
- * The maximum needed string length is:
- *	30 chars (filename + ext)
- * +	 2 chars ('.' + ';')
- * +	   strlen("32767")
- * +	   null byte
- * ================================
- * =	38 chars
- *
- * We currently do not support CD-ROM-XA entension records, but we must honor
- * the needed space for ISO-9660:1999 (Version 2).
- *
- * XXX If we ever will start to support XA records, we will need to take care
- * XXX that the the maximum ISO-9660 name length will be reduced by another
- * XXX 14 bytes resulting in a new total of 179 Bytes.
- */
-#define	LEN_ISONAME		31
-#define	MAX_ISONAME_V1		37
-#define	MAX_ISONAME_V2		207		/* 254 - 33 - 14 (XA Record) */
-#define	MAX_ISONAME_V2_RR	193		/* 254 - 33 - 28 (CE Record) */
-#define	MAX_ISONAME_V2_RR_XA	179		/* 254 - 33 - 14 - 28	    */
-#define	MAX_ISONAME		MAX_ISONAME_V2	/* Used for array space defs */
-#define	MAX_ISODIR		254		/* Must be even and <= 255   */
-
-struct iso_directory_record {
-	unsigned char length		[ISODCL(1,  1)];  /* 711 */
-	char ext_attr_length		[ISODCL(2,  2)];  /* 711 */
-	char extent			[ISODCL(3,  10)]; /* 733 */
-	char size			[ISODCL(11, 18)]; /* 733 */
-	char date			[ISODCL(19, 25)]; /* 7 by 711 */
-	char flags			[ISODCL(26, 26)];
-	char file_unit_size		[ISODCL(27, 27)]; /* 711 */
-	char interleave			[ISODCL(28, 28)]; /* 711 */
-	char volume_sequence_number	[ISODCL(29, 32)]; /* 723 */
-	unsigned char name_len		[ISODCL(33, 33)]; /* 711 */
-	char name			[MAX_ISONAME+1]; /* Not really, but we need something here */
-};
-
-
-/*
- * Iso directory flags.
- */
-#define	ISO_FILE	0	/* Not really a flag...			*/
-#define	ISO_EXISTENCE	1	/* Do not make existence known (hidden)	*/
-#define	ISO_DIRECTORY	2	/* This file is a directory		*/
-#define	ISO_ASSOCIATED	4	/* This file is an assiciated file	*/
-#define	ISO_RECORD	8	/* Record format in extended attr. != 0	*/
-#define	ISO_PROTECTION	16	/* No read/execute perm. in ext. attr.	*/
-#define	ISO_DRESERVED1	32	/* Reserved bit 5			*/
-#define	ISO_DRESERVED2	64	/* Reserved bit 6			*/
-#define	ISO_MULTIEXTENT	128	/* Not final entry of a mult. ext. file	*/
-
-
-struct iso_ext_attr_record {
-	char owner			[ISODCL(1, 4)];	    /* 723 */
-	char group			[ISODCL(5, 8)];	    /* 723 */
-	char permissions		[ISODCL(9, 10)];    /* 16 bits */
-	char creation_date		[ISODCL(11, 27)];   /* 8.4.26.1 */
-	char modification_date		[ISODCL(28, 44)];   /* 8.4.26.1 */
-	char expiration_date		[ISODCL(45, 61)];   /* 8.4.26.1 */
-	char effective_date		[ISODCL(62, 78)];   /* 8.4.26.1 */
-	char record_format		[ISODCL(79, 79)];   /* 711 */
-	char record_attributes		[ISODCL(80, 80)];   /* 711 */
-	char record_length		[ISODCL(81, 84)];   /* 723 */
-	char system_id			[ISODCL(85, 116)];  /* achars */
-	char system_use			[ISODCL(117, 180)];
-	char ext_attr_version		[ISODCL(181, 181)]; /* 711 */
-	char esc_seq_len		[ISODCL(182, 182)]; /* 711 */
-	char reserved			[ISODCL(183, 246)]; /* for future use */
-	char appl_use_len		[ISODCL(247, 250)]; /* 723 */
-	char appl_use[1];		/* really more */
-/*	char esc_seq[];			escape sequences recorded after appl_use */
-};
-
-/*
- * Iso extended attribute permissions.
- */
-#define	ISO_GS_READ		0x0001	/* System Group Read */
-#define	ISO_BIT_1		0x0002
-#define	ISO_GS_EXEC		0x0004	/* System Group Execute */
-#define	ISO_BIT_3		0x0008
-
-#define	ISO_O_READ		0x0010	/* Owner Read */
-#define	ISO_BIT_5		0x0020
-#define	ISO_O_EXEC		0x0040	/* Owner Exexute */
-#define	ISO_BIT_7		0x0080
-
-#define	ISO_G_READ		0x0100	/* Group Read */
-#define	ISO_BIT_9		0x0200
-#define	ISO_G_EXEC		0x0400	/* Group Execute */
-#define	ISO_BIT_11		0x0800
-
-#define	ISO_W_READ		0x1000	/* World (other) Read */
-#define	ISO_BIT_13		0x2000
-#define	ISO_W_EXEC		0x4000	/* World (other) Execute */
-#define	ISO_BIT_15		0x8000
-
-#define	ISO_MB_ONE		(ISO_BIT_1|ISO_BIT_3|ISO_BIT_5|ISO_BIT_7| \
-				ISO_BIT_9|ISO_BIT_11|ISO_BIT_13|ISO_BIT_15)
-
-/*
- * Extended Attributes record according to Yellow Book.
- */
-struct iso_xa_dir_record {
-	char group_id			[ISODCL(1, 2)];
-	char user_id			[ISODCL(3, 4)];
-	char attributes			[ISODCL(5, 6)];
-	char signature			[ISODCL(7, 8)];
-	char file_number		[ISODCL(9, 9)];
-	char reserved			[ISODCL(10, 14)];
-};
-
-/*
- * Definitions for XA attributes
- */
-#define	XA_O_READ	0x0001	/* Owner Read				*/
-#define	XA_O_RES	0x0002	/* Owner Reserved (write ?)		*/
-#define	XA_O_EXEC	0x0004	/* Owner Execute			*/
-#define	XA_O_RES2	0x0008	/* Owner Reserved			*/
-#define	XA_G_READ	0x0010	/* Group Read				*/
-#define	XA_G_RES	0x0020	/* Group Reserved (write ?)		*/
-#define	XA_G_EXEC	0x0040	/* Group Execute			*/
-#define	XA_G_RES2	0x0080	/* Group Reserved			*/
-#define	XA_W_READ	0x0100	/* World Read				*/
-#define	XA_W_RES	0x0200	/* World Reserved (write ?)		*/
-#define	XA_W_EXEC	0x0400	/* World Execute			*/
-
-#define	XA_FORM1	0x0800	/* File contains Form 1 sector		*/
-#define	XA_FORM2	0x1000	/* File contains Form 2 sector		*/
-#define	XA_INTERLEAVED	0x2000	/* File contains interleaved sectors	*/
-#define	XA_CDDA		0x4000	/* File contains audio data		*/
-#define	XA_DIR		0x8000	/* This is a directory			*/
-
-/*
- * Definitions for CD-ROM XA-Mode-2-form-1/2 sector sub-headers
- */
-struct xa_subhdr {
-	Uchar	file_number;		/* Identifies file for block	*/
-	Uchar	channel_number;		/* Playback channel selection	*/
-	Uchar	sub_mode;		/* See bit definitions below	*/
-	Uchar	coding;			/* Coding information		*/
-};
-
-/*
- * Sub mode bit definitions
- */
-#define	XA_SUBH_EOR		0x01	/* End-Of-Record		*/
-#define	XA_SUBH_VIDEO		0x02	/* Video Block			*/
-#define	XA_SUBH_AUDIO		0x04	/* Audio Block (not CD-DA)	*/
-#define	XA_SUBH_DATA		0x08	/* Data Block			*/
-#define	XA_SUBH_TRIGGER		0x10	/* Trigger Block		*/
-#define	XA_SUBH_FORM2		0x20	/* 0 == Form1, 1 == Form2	*/
-#define	XA_SUBH_REALTIME	0x40	/* Real Time Block		*/
-#define	XA_SUBH_EOF		0x80	/* End-Of-File			*/
-
-#endif	/* _ISOFS_FS_H */

Copied: cdrkit/trunk/genisoimage/iso9660.h (from rev 452, cdrkit/trunk/mkisoimage/iso9660.h)

Deleted: cdrkit/trunk/genisoimage/joliet.c
===================================================================
--- cdrkit/trunk/mkisoimage/joliet.c	2006-11-23 21:37:32 UTC (rev 450)
+++ cdrkit/trunk/genisoimage/joliet.c	2006-11-23 22:11:41 UTC (rev 453)
@@ -1,1456 +0,0 @@
-/*
- * This file has been modified for the cdrkit suite.
- *
- * The behaviour and appearence of the program code below can differ to a major
- * extent from the version distributed by the original author(s).
- *
- * For details, see Changelog file distributed with the cdrkit package. If you
- * received this file from another source then ask the distributing person for
- * a log of modifications.
- *
- */
-
-/* @(#)joliet.c	1.38 05/05/01 joerg */
-#ifndef lint
-static	char sccsid[] =
-	"@(#)joliet.c	1.38 05/05/01 joerg";
-#endif
-/*
- * File joliet.c - handle Win95/WinNT long file/unicode extensions for iso9660.
- *
- * Copyright 1997 Eric Youngdale.
- * APPLE_HYB James Pearson j.pearson at ge.ucl.ac.uk 22/2/2000
- * Copyright (c) 1999,2000,2001 J. Schilling
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-/*
- * Joliet extensions for ISO9660.  These are spottily documented by
- * Microsoft.  In their infinite stupidity, they completely ignored
- * the possibility of using an SUSP record with the long filename
- * in it, and instead wrote out a duplicate directory tree with the
- * long filenames in it.
- *
- * I am not sure why they did this.  One reason is that they get the path
- * tables with the long filenames in them.
- *
- * There are two basic principles to Joliet, and the non-Unicode variant
- * known as Romeo.  Long filenames seem to be the main one, and the second
- * is that the character set and a few other things is substantially relaxed.
- *
- * The SVD is identical to the PVD, except:
- *
- *	Id is 2, not 1 (indicates SVD).
- *	escape_sequences contains UCS-2 indicator (levels 1, 2 or 3).
- *	The root directory record points to a different extent (with different
- *		size).
- *	There are different path tables for the two sets of directory trees.
- *
- * The Unicode level is coded in the SVD as follows:
- *
- *	Standard	Level	ASCII escape code
- *	UCS-2		Level-1	%/@
- *	UCS-2		Level-2	%/C
- *	UCS-2		Level-3	%/E
- *
- * The following fields are recorded in Unicode:
- *	system_id
- *	volume_id
- *	volume_set_id
- *	publisher_id
- *	preparer_id
- *	application_id
- *	copyright_file_id
- *	abstract_file_id
- *	bibliographic_file_id
- *
- * Unicode strings are always encoded in big-endian format.
- *
- * In a directory record, everything is the same as with iso9660, except
- * that the name is recorded in unicode.  The name length is specified in
- * total bytes, not in number of unicode characters.
- *
- * The character set used for the names is different with UCS - the
- * restrictions are that the following are not allowed:
- *
- *	Characters (00)(00) through (00)(1f) (control chars)
- *	(00)(2a) '*'
- *	(00)(2f) '/'
- *	(00)(3a) ':'
- *	(00)(3b) ';'
- *	(00)(3f) '?'
- *	(00)(5c) '\'
- */
-#include <mconfig.h>
-#include "mkisoimage.h"
-#include <timedefs.h>
-#include <utypes.h>
-#include <intcvt.h>
-#include <unls.h>	/* For UNICODE translation */
-#include <schily.h>
-
-#ifdef USE_ICONV
-#include <iconv.h>
-#include <errno.h>
-#endif
-
-static Uint	jpath_table_index;
-static struct directory **jpathlist;
-static int	next_jpath_index = 1;
-static int	jsort_goof;
-
-static	char	ucs_codes[] = {
-		'\0',		/* UCS-level 0 is illegal	*/
-		'@',		/* UCS-level 1			*/
-		'C',		/* UCS-level 2			*/
-		'E',		/* UCS-level 3			*/
-};
-
-#ifdef	UDF
-#ifdef USE_ICONV
-size_t
-#else
-void
-#endif
-convert_to_unicode(unsigned char *buffer, int size, char *source, 
-						 struct unls_table *inls);
-int	joliet_strlen(const char *string, struct unls_table *inls);
-#else
-#ifdef USE_ICONV
-static size_t
-#else
-static void
-#endif
-convert_to_unicode(unsigned char *buffer, int size, char *source, 
-						 struct unls_table *inls);
-static int	joliet_strlen(const char *string, struct nls_table *inls);
-#endif
-static void	get_joliet_vol_desc(struct iso_primary_descriptor *jvol_desc);
-static void	assign_joliet_directory_addresses(struct directory *node);
-static void	build_jpathlist(struct directory *node);
-static int	joliet_compare_paths(void const *r, void const *l);
-static int	generate_joliet_path_tables(void);
-static void	generate_one_joliet_directory(struct directory *dpnt, 
-														FILE *outfile);
-static int	joliet_sort_n_finish(struct directory *this_dir);
-static int	joliet_compare_dirs(const void *rr, const void *ll);
-static int	joliet_sort_directory(struct directory_entry **sort_dir);
-int	joliet_sort_tree(struct directory *node);
-static void	generate_joliet_directories(struct directory *node, FILE *outfile);
-static int	jpathtab_write(FILE *outfile);
-static int	jdirtree_size(int starting_extent);
-static int	jroot_gen(void);
-static int	jdirtree_write(FILE *outfile);
-static int	jvd_write(FILE *outfile);
-static int	jpathtab_size(int starting_extent);
-
-/*
- *	conv_charset: convert to/from charsets via Unicode.
- *
- *	Any unknown character is set to '_'
- *
- */
-unsigned char
-conv_charset(unsigned char c,
-	struct unls_table *inls,
-	struct unls_table *onls)
-{
-	unsigned char	uh;
-	unsigned char	ul;
-	unsigned char	uc;
-	unsigned char	*up;
-
-	/* if we have a null mapping, just return the input character */
-	if (inls == onls)
-		return (c);
-
-#ifdef USE_ICONV
-	if(inls->unls_cs2uni == NULL || onls->unls_uni2cs == NULL) {
-		/*
-		 * This shouldn't be reached
-		 */
-		static BOOL iconv_warned = FALSE;
-		if(!iconv_warned) {
-			fprintf(stderr, "Warning: Iconv conversion not supported in conv_charset.\n");
-			iconv_warned = TRUE;
-		}
-		return (c);
-	}
-#endif
-
-	/* get high and low UNICODE bytes */
-	uh = inls->unls_cs2uni[c].unls_high;
-	ul = inls->unls_cs2uni[c].unls_low;
-
-	/* get the backconverted page from the output charset */
-	up = onls->unls_uni2cs[uh];
-
-	/* if the page exists, get the backconverted character */
-	if (up == NULL)
-		uc = '\0';
-	else
-		uc = up[ul];
-
-	/* return the backconverted, if it's not NULL */
-	return (uc ? uc : '_');
-}
-
-/*
- * Function:		convert_to_unicode
- *
- * Purpose:		Perform a unicode conversion on a text string
- *			using the supplied input character set.
- *
- * Notes:
- */
-#ifdef USE_ICONV
-#	if	UDF
-size_t
-#	else
-static size_t
-#	endif
-#else
-#	if	UDF
-void
-#	else
-static void
-#	endif
-#endif
-convert_to_unicode(unsigned char *buffer, int size, char *source, 
-						 struct unls_table *inls)
-{
-	unsigned char	*tmpbuf;
-	int		i;
-	int		j;
-	unsigned char	uh,
-			ul,
-			uc,
-			*up;
-
-	/*
-	 * If we get a NULL pointer for the source, it means we have an
-	 * inplace copy, and we need to make a temporary working copy first.
-	 */
-	if (source == NULL) {
-		tmpbuf = (Uchar *) e_malloc(size);
-		memcpy(tmpbuf, buffer, size);
-	} else {
-		tmpbuf = (Uchar *) source;
-	}
-
-#ifdef USE_ICONV
-	if (inls->iconv_d && inls->unls_cs2uni==NULL &&
-			inls->unls_uni2cs==NULL) {
-		char *inptr = tmpbuf;
-		char *outptr = buffer;
-		size_t inleft = strlen(tmpbuf);
-		size_t inlen = inleft;
-		size_t outleft = size;
-
-		iconv(inls->iconv_d, NULL, NULL, NULL, NULL);
-		if(iconv(inls->iconv_d, &inptr, &inleft, &outptr, &outleft) ==
-				(size_t)-1 && errno == EILSEQ) {
-			fprintf(stderr, "Incorrectly encoded string (%s) "
-				"encountered.\nPossibly creating an invalid "
-				"Joliet extension. Aborting.\n", source);
-			exit(1);
-		}
-
-	  	for (i = 0; (i + 1) < size - outleft; i += 2) {	/* Size may be odd!!!*/
-			if (buffer[i]=='\0') {
-				switch (buffer[i+1]) {   /* Invalid characters for Joliet */
-					case '*':
-					case '/':
-					case ':':
-					case ';':
-					case '?':
-					case '\\':
-						buffer[i+1]='_';
-					default:
-						if (buffer[i+1] == 0x7f ||
-							    buffer[i+1] < 0x20)
-							buffer[i+1]='_';
-				}
-			}
-		}
-		if (size & 1) {	/* beautification */
-	  		buffer[size - 1] = 0;
-		}
-		if (source == NULL) {
-			free(tmpbuf);
-		}
-		return (inlen - inleft);
-	}
-#endif
-
-	/*
-	 * Now start copying characters.  If the size was specified to be 0,
-	 * then assume the input was 0 terminated.
-	 */
-	j = 0;
-	for (i = 0; (i + 1) < size; i += 2, j++) {	/* Size may be odd! */
-		/*
-		 * JS integrated from: Achim_Kaiser at t-online.de
-		 * SGE modified according to Linux kernel source
-		 * Let all valid unicode characters pass
-		 * through (according to charset). Others are set to '_' .
-		 */
-		uc = tmpbuf[j];			/* temporary copy */
-		if (uc != '\0') {		/* must be converted */
-			uh = inls->unls_cs2uni[uc].unls_high;	/* convert forward:  */
-								/*   hibyte...	*/
-			ul = inls->unls_cs2uni[uc].unls_low;	/* ...lobyte	*/
-			up = inls->unls_uni2cs[uh];		/* convert backward: */
-								/*   page...	*/
-			if (up == NULL)
-				uc = '\0';	/* wrong unicode page	   */
-			else
-				uc = up[ul];	/* backconverted character */
-			if (uc != tmpbuf[j])
-				uc = '\0';	/* should be identical */
-			if (uc <= 0x1f || uc == 0x7f)
-				uc = '\0';	/* control char */
-			switch (uc) {		/* test special characters */
-
-			case '*':
-			case '/':
-			case ':':
-			case ';':
-			case '?':
-			case '\\':
-			case '\0':		/* illegal char mark */
-				/*
-				 * Even Joliet has some standards as to what is
-				 * allowed in a pathname. Pretty tame in
-				 * comparison to what DOS restricts you to.
-				 */
-				uc = '_';
-			}
-		}
-		buffer[i] = inls->unls_cs2uni[uc].unls_high; /* final UNICODE */
-							    /* conversion */
-		buffer[i + 1] = inls->unls_cs2uni[uc].unls_low;
-	}
-
-	if (size & 1) {	/* beautification */
-		buffer[size - 1] = 0;
-	}
-	if (source == NULL) {
-		free(tmpbuf);
-	}
-#ifdef USE_ICONV
-	return j;
-#endif
-}
-
-/*
- * Function:	joliet_strlen
- *
- * Purpose:	Return length in bytes of string after conversion to unicode.
- *
- * Notes:	This is provided mainly as a convenience so that when more
- * 		intelligent Unicode conversion for either Multibyte or 8-bit
- *		codes is available that we can easily adapt.
- */
-#ifdef	UDF
-int
-#else
-static int
-#endif
-joliet_strlen(const char *string, struct unls_table *inls)
-{
-	int		rtn;
-
-#ifdef USE_ICONV
-	if (inls->iconv_d && inls->unls_cs2uni==NULL &&
-			inls->unls_uni2cs==NULL) {
-		/*
-		 * we const-cast since we're sure iconv won't change
-		 * the string itself
-		 */
-		char *string_ptr = (char *)string;
-		size_t string_len = strlen(string);
-
-		/*
-		 * iconv has no way of finding out the required size
-		 * in the target
-		 */
-
-		char *tmp, *tmp_ptr;
-		/* we assume that the maximum length is 2 * jlen */
-		size_t tmp_len = (size_t)jlen * 2 + 1;
-		tmp = e_malloc(tmp_len);
-		tmp_ptr = tmp;
-
-		iconv(inls->iconv_d, NULL, NULL, NULL, NULL);
-		iconv(inls->iconv_d, &string_ptr, &string_len, &tmp_ptr,
-			&tmp_len);
-
-		/*
-		 * iconv advanced the tmp pointer with as many chars
-		 * as it has written to it, so we add up the delta
-		 */
-		rtn = (tmp_ptr - tmp);
-
-		free(tmp);
-	} else {
-		rtn = strlen(string) << 1;
-	}
-#else
-	rtn = strlen(string) << 1;
-#endif
-
-	/*
-	 * We do clamp the maximum length of a Joliet string to be the
-	 * maximum path size.  This helps to ensure that we don't completely
-	 * bolix things up with very long paths.    The Joliet specs say that
-	 * the maximum length is 128 bytes, or 64 unicode characters.
-	 */
-	if (rtn > 2*jlen) {
-		rtn = 2*jlen;
-	}
-	return (rtn);
-}
-
-/*
- * Function:		get_joliet_vol_desc
- *
- * Purpose:		generate a Joliet compatible volume desc.
- *
- * Notes:		Assume that we have the non-joliet vol desc
- *			already present in the buffer.  Just modifiy the
- *			appropriate fields.
- */
-static void
-get_joliet_vol_desc(struct iso_primary_descriptor *jvol_desc)
-{
-	jvol_desc->type[0] = ISO_VD_SUPPLEMENTARY;
-
-	/*
-	 * For now, always do Unicode level 3.
-	 * I don't really know what 1 and 2 are - perhaps a more limited
-	 * Unicode set.
-	 * FIXME(eric) - how does Romeo fit in here?
-	 */
-	sprintf(jvol_desc->escape_sequences, "%%/%c", ucs_codes[ucs_level]);
-
-	/* Until we have Unicode path tables, leave these unset. */
-	set_733((char *) jvol_desc->path_table_size, jpath_table_size);
-	set_731(jvol_desc->type_l_path_table, jpath_table[0]);
-	set_731(jvol_desc->opt_type_l_path_table, jpath_table[1]);
-	set_732(jvol_desc->type_m_path_table, jpath_table[2]);
-	set_732(jvol_desc->opt_type_m_path_table, jpath_table[3]);
-
-	/* Set this one up. */
-	memcpy(jvol_desc->root_directory_record, &jroot_record,
-		offsetof(struct iso_directory_record, name[0]) + 1);
-
-	/*
-	 * Finally, we have a bunch of strings to convert to Unicode.
-	 * FIXME(eric) - I don't know how to do this in general,
-	 * so we will just be really lazy and do a char -> short conversion.
-	 *  We probably will want to filter any characters >= 0x80.
-	 */
-	convert_to_unicode((Uchar *) jvol_desc->system_id,
-			sizeof (jvol_desc->system_id), NULL, in_nls);
-	convert_to_unicode((Uchar *) jvol_desc->volume_id,
-			sizeof (jvol_desc->volume_id), NULL, in_nls);
-	convert_to_unicode((Uchar *) jvol_desc->volume_set_id,
-			sizeof (jvol_desc->volume_set_id), NULL, in_nls);
-	convert_to_unicode((Uchar *) jvol_desc->publisher_id,
-			sizeof (jvol_desc->publisher_id), NULL, in_nls);
-	convert_to_unicode((Uchar *) jvol_desc->preparer_id,
-			sizeof (jvol_desc->preparer_id), NULL, in_nls);
-	convert_to_unicode((Uchar *) jvol_desc->application_id,
-			sizeof (jvol_desc->application_id), NULL, in_nls);
-	convert_to_unicode((Uchar *) jvol_desc->copyright_file_id,
-			sizeof (jvol_desc->copyright_file_id), NULL, in_nls);
-	convert_to_unicode((Uchar *) jvol_desc->abstract_file_id,
-			sizeof (jvol_desc->abstract_file_id), NULL, in_nls);
-	convert_to_unicode((Uchar *) jvol_desc->bibliographic_file_id,
-			sizeof (jvol_desc->bibliographic_file_id), NULL, in_nls);
-}
-
-static void
-assign_joliet_directory_addresses(struct directory *node)
-{
-	int		dir_size;
-	struct directory *dpnt;
-
-	dpnt = node;
-
-	while (dpnt) {
-		if ((dpnt->dir_flags & INHIBIT_JOLIET_ENTRY) == 0) {
-			/*
-			 * If we already have an extent for this
-			 * (i.e. it came from a multisession disc), then
-			 * don't reassign a new extent.
-			 */
-			dpnt->jpath_index = next_jpath_index++;
-			if (dpnt->jextent == 0) {
-				dpnt->jextent = last_extent;
-				dir_size = ISO_BLOCKS(dpnt->jsize);
-				last_extent += dir_size;
-			}
-		}
-		/* skip if hidden - but not for the rr_moved dir */
-		if (dpnt->subdir && (!(dpnt->dir_flags & INHIBIT_JOLIET_ENTRY) || dpnt == reloc_dir)) {
-			assign_joliet_directory_addresses(dpnt->subdir);
-		}
-		dpnt = dpnt->next;
-	}
-}
-
-static void
-build_jpathlist(struct directory *node)
-{
-	struct directory	*dpnt;
-
-	dpnt = node;
-
-	while (dpnt) {
-		if ((dpnt->dir_flags & INHIBIT_JOLIET_ENTRY) == 0) {
-			jpathlist[dpnt->jpath_index] = dpnt;
-		}
-		if (dpnt->subdir)
-			build_jpathlist(dpnt->subdir);
-		dpnt = dpnt->next;
-	}
-}/* build_jpathlist(... */
-
-static int
-joliet_compare_paths(void const *r, void const *l)
-{
-	struct directory const *ll = *(struct directory * const *) l;
-	struct directory const *rr = *(struct directory * const *) r;
-	int		rparent,
-			lparent;
-	char		*rpnt,
-			*lpnt;
-	unsigned char	rtmp[2],
-			ltmp[2];
-	struct unls_table *rinls, *linls;
-
-	/* make sure root directory is first */
-	if (rr == root)
-		return (-1);
-
-	if (ll == root)
-		return (1);
-
-	rparent = rr->parent->jpath_index;
-	lparent = ll->parent->jpath_index;
-	if (rr->parent == reloc_dir) {
-		rparent = rr->self->parent_rec->filedir->jpath_index;
-	}
-	if (ll->parent == reloc_dir) {
-		lparent = ll->self->parent_rec->filedir->jpath_index;
-	}
-	if (rparent < lparent) {
-		return (-1);
-	}
-	if (rparent > lparent) {
-		return (1);
-	}
-#ifdef APPLE_HYB
-	/*
-	 * we may be using the HFS name - so select the correct input
-	 * charset
-	 */
-	if (USE_MAC_NAME(rr->self)) {
-		rpnt = rr->self->hfs_ent->name;
-		rinls = hfs_inls;
-	} else {
-		rpnt = rr->self->name;
-		rinls = in_nls;
-	}
-
-	if (USE_MAC_NAME(ll->self)) {
-		lpnt = ll->self->hfs_ent->name;
-		linls = hfs_inls;
-	} else {
-		lpnt = ll->self->name;
-		linls = in_nls;
-	}
-#else
-	rpnt = rr->self->name;
-	lpnt = ll->self->name;
-	linls = rinls = in_nls;
-#endif	/* APPLE_HYB */
-
-	/* compare the Unicode names */
-
-	while (*rpnt && *lpnt) {
-#ifdef USE_ICONV
-		size_t ri, li;
-
-		ri = convert_to_unicode(rtmp, 2, rpnt, rinls);
-		li = convert_to_unicode(ltmp, 2, lpnt, linls);
-		rpnt += ri;
-		lpnt += li;
-		if(!ri && !li)
-			return (0);
-		else if(ri && !li)
-			return (1);
-		else if(!ri && li)
-			return (-1);
-#else
-		convert_to_unicode(rtmp, 2, rpnt, rinls);
-		convert_to_unicode(ltmp, 2, lpnt, linls);
-#endif
-
-		if (a_to_u_2_byte(rtmp) < a_to_u_2_byte(ltmp))
-			return (-1);
-		if (a_to_u_2_byte(rtmp) > a_to_u_2_byte(ltmp))
-			return (1);
-
-#ifndef USE_ICONV
-		rpnt++;
-		lpnt++;
-#endif
-	}
-
-	if (*rpnt)
-		return (1);
-	if (*lpnt)
-		return (-1);
-
-	return (0);
-
-}/* compare_paths(... */
-
-static int
-generate_joliet_path_tables()
-{
-	struct directory_entry *de;
-	struct directory *dpnt;
-	int		fix;
-	int		j;
-	int		namelen;
-	char		*npnt;
-	char		*npnt1;
-	int		tablesize;
-
-	/* First allocate memory for the tables and initialize the memory */
-	tablesize = jpath_blocks << 11;
-	jpath_table_m = (char *) e_malloc(tablesize);
-	jpath_table_l = (char *) e_malloc(tablesize);
-	memset(jpath_table_l, 0, tablesize);
-	memset(jpath_table_m, 0, tablesize);
-
-	/* Now start filling in the path tables.  Start with root directory */
-	jpath_table_index = 0;
-	jpathlist = (struct directory **) e_malloc(sizeof (struct directory *)
-		* next_jpath_index);
-	memset(jpathlist, 0, sizeof (struct directory *) * next_jpath_index);
-	build_jpathlist(root);
-
-	do {
-		fix = 0;
-#ifdef	PROTOTYPES
-		qsort(&jpathlist[1], next_jpath_index - 1, sizeof (struct directory *),
-			(int (*) (const void *, const void *)) joliet_compare_paths);
-#else
-		qsort(&jpathlist[1], next_jpath_index - 1, sizeof (struct directory *),
-			joliet_compare_paths);
-#endif
-
-		for (j = 1; j < next_jpath_index; j++) {
-			if (jpathlist[j]->jpath_index != j) {
-				jpathlist[j]->jpath_index = j;
-				fix++;
-			}
-		}
-	} while (fix);
-
-	for (j = 1; j < next_jpath_index; j++) {
-		dpnt = jpathlist[j];
-		if (!dpnt) {
-#ifdef	USE_LIBSCHILY
-			comerrno(EX_BAD, "Entry %d not in path tables\n", j);
-#else
-			fprintf(stderr, "Entry %d not in path tables\n", j);
-			exit(1);
-#endif
-		}
-		npnt = dpnt->de_name;
-
-		npnt1 = strrchr(npnt, PATH_SEPARATOR);
-		if (npnt1) {
-			npnt = npnt1 + 1;
-		}
-		de = dpnt->self;
-		if (!de) {
-#ifdef	USE_LIBSCHILY
-			comerrno(EX_BAD,
-			"Fatal Joliet goof - directory has amnesia\n");
-#else
-			fprintf(stderr,
-			"Fatal Joliet goof - directory has amnesia\n");
-			exit(1);
-#endif
-		}
-#ifdef APPLE_HYB
-		if (USE_MAC_NAME(de))
-			namelen = joliet_strlen(de->hfs_ent->name, hfs_inls);
-		else
-#endif	/* APPLE_HYB */
-			namelen = joliet_strlen(de->name, in_nls);
-
-		if (dpnt == root) {
-			jpath_table_l[jpath_table_index] = 1;
-			jpath_table_m[jpath_table_index] = 1;
-		} else {
-			jpath_table_l[jpath_table_index] = namelen;
-			jpath_table_m[jpath_table_index] = namelen;
-		}
-		jpath_table_index += 2;
-
-		set_731(jpath_table_l + jpath_table_index, dpnt->jextent);
-		set_732(jpath_table_m + jpath_table_index, dpnt->jextent);
-		jpath_table_index += 4;
-
-		if (dpnt->parent->jpath_index > 0xffff) {
-#ifdef	USE_LIBSCHILY
-			comerrno(EX_BAD,
-			"Unable to generate sane path tables - too many directories (%d)\n",
-				dpnt->parent->jpath_index);
-#else
-			fprintf(stderr,
-			"Unable to generate sane path tables - too many directories (%d)\n",
-				dpnt->parent->jpath_index);
-			exit(1);
-#endif
-		}
-
-		if (dpnt->parent != reloc_dir) {
-			set_721(jpath_table_l + jpath_table_index,
-				dpnt->parent->jpath_index);
-			set_722(jpath_table_m + jpath_table_index,
-				dpnt->parent->jpath_index);
-		} else {
-			set_721(jpath_table_l + jpath_table_index,
-				dpnt->self->parent_rec->filedir->jpath_index);
-			set_722(jpath_table_m + jpath_table_index,
-				dpnt->self->parent_rec->filedir->jpath_index);
-		}
-
-		jpath_table_index += 2;
-
-		/*
-		 * The root directory is still represented in non-unicode
-		 * fashion.
-		 */
-		if (dpnt == root) {
-			jpath_table_l[jpath_table_index] = 0;
-			jpath_table_m[jpath_table_index] = 0;
-			jpath_table_index++;
-		} else {
-#ifdef APPLE_HYB
-			if (USE_MAC_NAME(de)) {
-				convert_to_unicode((Uchar *) jpath_table_l +
-					jpath_table_index,
-					namelen, de->hfs_ent->name, hfs_inls);
-				convert_to_unicode((Uchar *) jpath_table_m +
-					jpath_table_index,
-					namelen, de->hfs_ent->name, hfs_inls);
-			} else {
-#endif	/* APPLE_HYB */
-				convert_to_unicode((Uchar *) jpath_table_l +
-					jpath_table_index,
-					namelen, de->name, in_nls);
-				convert_to_unicode((Uchar *) jpath_table_m +
-					jpath_table_index,
-					namelen, de->name, in_nls);
-#ifdef APPLE_HYB
-			}
-#endif	/* APPLE_HYB */
-
-			jpath_table_index += namelen;
-		}
-
-		if (jpath_table_index & 1) {
-			jpath_table_index++;	/* For odd lengths we pad */
-		}
-	}
-
-	free(jpathlist);
-	if (jpath_table_index != jpath_table_size) {
-#ifdef	USE_LIBSCHILY
-		errmsgno(EX_BAD,
-		"Joliet path table lengths do not match %d expected: %d\n",
-			jpath_table_index,
-			jpath_table_size);
-#else
-		fprintf(stderr,
-		"Joliet path table lengths do not match %d expected: %d\n",
-			jpath_table_index,
-			jpath_table_size);
-#endif
-	}
-	return (0);
-}/* generate_path_tables(... */
-
-static void
-generate_one_joliet_directory(struct directory *dpnt, FILE *outfile)
-{
-	unsigned int		dir_index;
-	char			*directory_buffer;
-	int			new_reclen;
-	struct directory_entry *s_entry;
-	struct directory_entry *s_entry1;
-	struct iso_directory_record jrec;
-	unsigned int	total_size;
-	int			cvt_len;
-	struct directory	*finddir;
-
-	total_size = ISO_ROUND_UP(dpnt->jsize);
-	directory_buffer = (char *) e_malloc(total_size);
-	memset(directory_buffer, 0, total_size);
-	dir_index = 0;
-
-	s_entry = dpnt->jcontents;
-	while (s_entry) {
-		if (s_entry->de_flags & INHIBIT_JOLIET_ENTRY) {
-			s_entry = s_entry->jnext;
-			continue;
-		}
-		/*
-		 * If this entry was a directory that was relocated,
-		 * we have a bit of trouble here.  We need to dig out the real
-		 * thing and put it back here.  In the Joliet tree, there is
-		 * no relocated rock ridge, as there are no depth limits to a
-		 * directory tree.
-		 */
-		if ((s_entry->de_flags & RELOCATED_DIRECTORY) != 0) {
-			for (s_entry1 = reloc_dir->contents; s_entry1;
-						s_entry1 = s_entry1->next) {
-				if (s_entry1->parent_rec == s_entry) {
-					break;
-				}
-			}
-			if (s_entry1 == NULL) {
-				/* We got trouble. */
-#ifdef	USE_LIBSCHILY
-				comerrno(EX_BAD,
-				"Unable to locate relocated directory\n");
-#else
-				fprintf(stderr,
-				"Unable to locate relocated directory\n");
-				exit(1);
-#endif
-			}
-		} else {
-			s_entry1 = s_entry;
-		}
-
-		/*
-		 * We do not allow directory entries to cross sector
-		 * boundaries. Simply pad, and then start the next entry at
-		 * the next sector
-		 */
-		new_reclen = s_entry1->jreclen;
-		if ((dir_index & (SECTOR_SIZE - 1)) + new_reclen >= SECTOR_SIZE) {
-			dir_index = ISO_ROUND_UP(dir_index);
-		}
-		memcpy(&jrec, &s_entry1->isorec, offsetof(struct iso_directory_record, name[0]));
-
-#ifdef APPLE_HYB
-		/* Use the HFS name if it exists */
-		if (USE_MAC_NAME(s_entry1))
-			cvt_len = joliet_strlen(s_entry1->hfs_ent->name, hfs_inls);
-		else
-#endif	/* APPLE_HYB */
-			cvt_len = joliet_strlen(s_entry1->name, in_nls);
-
-		/*
-		 * Fix the record length
-		 * - this was the non-Joliet version we were seeing.
-		 */
-		jrec.name_len[0] = cvt_len;
-		jrec.length[0] = s_entry1->jreclen;
-
-		/*
-		 * If this is a directory,
-		 * fix the correct size and extent number.
-		 */
-		if ((jrec.flags[0] & ISO_DIRECTORY) != 0) {
-			if (strcmp(s_entry1->name, ".") == 0) {
-				jrec.name_len[0] = 1;
-				set_733((char *) jrec.extent, dpnt->jextent);
-				set_733((char *) jrec.size, ISO_ROUND_UP(dpnt->jsize));
-			} else if (strcmp(s_entry1->name, "..") == 0) {
-				jrec.name_len[0] = 1;
-				if (dpnt->parent == reloc_dir) {
-					set_733((char *)jrec.extent, dpnt->self->parent_rec->filedir->jextent);
-					set_733((char *)jrec.size, ISO_ROUND_UP(dpnt->self->parent_rec->filedir->jsize));
-				} else {
-					set_733((char *)jrec.extent, dpnt->parent->jextent);
-					set_733((char *)jrec.size, ISO_ROUND_UP(dpnt->parent->jsize));
-				}
-			} else {
-				if ((s_entry->de_flags & RELOCATED_DIRECTORY) != 0) {
-					finddir = reloc_dir->subdir;
-				} else {
-					finddir = dpnt->subdir;
-				}
-				while (1 == 1) {
-					if (finddir->self == s_entry1)
-						break;
-					finddir = finddir->next;
-					if (!finddir) {
-#ifdef	USE_LIBSCHILY
-						comerrno(EX_BAD, "Fatal goof - unable to find directory location\n");
-#else
-						fprintf(stderr, "Fatal goof - unable to find directory location\n");
-						exit(1);
-#endif
-					}
-				}
-				set_733((char *)jrec.extent, finddir->jextent);
-				set_733((char *)jrec.size,
-						ISO_ROUND_UP(finddir->jsize));
-			}
-		}
-		memcpy(directory_buffer + dir_index, &jrec,
-			offsetof(struct iso_directory_record, name[0]));
-
-		dir_index += offsetof(struct iso_directory_record, name[0]);
-
-		/*
-		 * Finally dump the Unicode version of the filename.
-		 * Note - . and .. are the same as with non-Joliet discs.
-		 */
-		if ((jrec.flags[0] & ISO_DIRECTORY) != 0 &&
-			strcmp(s_entry1->name, ".") == 0) {
-			directory_buffer[dir_index++] = 0;
-		} else if ((jrec.flags[0] & ISO_DIRECTORY) != 0 &&
-			strcmp(s_entry1->name, "..") == 0) {
-			directory_buffer[dir_index++] = 1;
-		} else {
-#ifdef APPLE_HYB
-			if (USE_MAC_NAME(s_entry1)) {
-				/* Use the HFS name if it exists */
-				convert_to_unicode(
-					(Uchar *) directory_buffer+dir_index,
-					cvt_len,
-					s_entry1->hfs_ent->name, hfs_inls);
-			} else
-#endif	/* APPLE_HYB */
-			{
-				convert_to_unicode(
-					(Uchar *) directory_buffer+dir_index,
-					cvt_len,
-					s_entry1->name, in_nls);
-			}
-			dir_index += cvt_len;
-		}
-
-		if (dir_index & 1) {
-			directory_buffer[dir_index++] = 0;
-		}
-		s_entry = s_entry->jnext;
-	}
-
-	if (dpnt->jsize != dir_index) {
-#ifdef	USE_LIBSCHILY
-		errmsgno(EX_BAD,
-		"Unexpected joliet directory length %d expected: %d '%s'\n",
-			dpnt->jsize,
-			dir_index, dpnt->de_name);
-#else
-		fprintf(stderr,
-		"Unexpected joliet directory length %d expected: %d '%s'\n",
-			dpnt->jsize,
-			dir_index, dpnt->de_name);
-#endif
-	}
-	jtwrite(directory_buffer, total_size, 1, 0, FALSE);
-	xfwrite(directory_buffer, total_size, 1, outfile, 0, FALSE);
-	last_extent_written += total_size >> 11;
-	free(directory_buffer);
-}/* generate_one_joliet_directory(... */
-
-static int
-joliet_sort_n_finish(struct directory *this_dir)
-{
-	struct directory_entry	*s_entry;
-	int			status = 0;
-
-	/*
-	 * don't want to skip this directory if it's the reloc_dir
-	 * at the moment
-	 */
-	if (this_dir != reloc_dir &&
-				this_dir->dir_flags & INHIBIT_JOLIET_ENTRY) {
-		return (0);
-	}
-	for (s_entry = this_dir->contents; s_entry; s_entry = s_entry->next) {
-		/* skip hidden entries */
-		if ((s_entry->de_flags & INHIBIT_JOLIET_ENTRY) != 0) {
-			continue;
-		}
-		/*
-		 * First update the path table sizes for directories.
-		 *
-		 * Finally, set the length of the directory entry if Joliet is
-		 * used. The name is longer, but no Rock Ridge is ever used
-		 * here, so depending upon the options the entry size might
-		 * turn out to be about the same.  The Unicode name is always
-		 * a multiple of 2 bytes, so we always add 1 to make it an
-		 * even number.
-		 */
-		if (s_entry->isorec.flags[0] & ISO_DIRECTORY) {
-			if (strcmp(s_entry->name, ".") != 0 &&
-					strcmp(s_entry->name, "..") != 0) {
-#ifdef APPLE_HYB
-				if (USE_MAC_NAME(s_entry))
-					/* Use the HFS name if it exists */
-					jpath_table_size +=
-						joliet_strlen(s_entry->hfs_ent->name, hfs_inls) +
-						offsetof(struct iso_path_table, name[0]);
-				else
-#endif	/* APPLE_HYB */
-					jpath_table_size +=
-						joliet_strlen(s_entry->name, in_nls) +
-						offsetof(struct iso_path_table, name[0]);
-				if (jpath_table_size & 1) {
-					jpath_table_size++;
-				}
-			} else {
-				if (this_dir == root &&
-						strlen(s_entry->name) == 1) {
-
-					jpath_table_size += 1 + offsetof(struct iso_path_table, name[0]);
-					if (jpath_table_size & 1)
-						jpath_table_size++;
-				}
-			}
-		}
-		if (strcmp(s_entry->name, ".") != 0 &&
-					strcmp(s_entry->name, "..") != 0) {
-#ifdef APPLE_HYB
-			if (USE_MAC_NAME(s_entry))
-				/* Use the HFS name if it exists */
-				s_entry->jreclen =
-				offsetof(struct iso_directory_record, name[0])
-					+ joliet_strlen(s_entry->hfs_ent->name, hfs_inls)
-					+ 1;
-			else
-#endif	/* APPLE_HYB */
-				s_entry->jreclen =
-				offsetof(struct iso_directory_record, name[0])
-					+ joliet_strlen(s_entry->name, in_nls)
-					+ 1;
-		} else {
-			/*
-			 * Special - for '.' and '..' we generate the same
-			 * records we did for non-Joliet discs.
-			 */
-			s_entry->jreclen =
-			offsetof(struct iso_directory_record, name[0])
-				+ 1;
-		}
-
-
-	}
-
-	if ((this_dir->dir_flags & INHIBIT_JOLIET_ENTRY) != 0) {
-		return (0);
-	}
-	this_dir->jcontents = this_dir->contents;
-	status = joliet_sort_directory(&this_dir->jcontents);
-
-	/*
-	 * Now go through the directory and figure out how large this one will
-	 * be. Do not split a directory entry across a sector boundary
-	 */
-	s_entry = this_dir->jcontents;
-	/*
-	 * XXX Is it ok to comment this out?
-	 */
-/*XXX JS  this_dir->ce_bytes = 0;*/
-	for (s_entry = this_dir->jcontents; s_entry;
-						s_entry = s_entry->jnext) {
-		int	jreclen;
-
-		if ((s_entry->de_flags & INHIBIT_JOLIET_ENTRY) != 0) {
-			continue;
-		}
-		jreclen = s_entry->jreclen;
-
-		if ((this_dir->jsize & (SECTOR_SIZE - 1)) + jreclen >=
-								SECTOR_SIZE) {
-			this_dir->jsize = ISO_ROUND_UP(this_dir->jsize);
-		}
-		this_dir->jsize += jreclen;
-	}
-	return (status);
-}
-
-/*
- * Similar to the iso9660 case,
- * except here we perform a full sort based upon the
- * regular name of the file, not the 8.3 version.
- */
-static int
-joliet_compare_dirs(const void *rr, const void *ll)
-{
-	char		*rpnt,
-			*lpnt;
-	struct directory_entry **r,
-			**l;
-	unsigned char	rtmp[2],
-			ltmp[2];
-	struct unls_table *linls, *rinls;
-
-	r = (struct directory_entry **) rr;
-	l = (struct directory_entry **) ll;
-
-#ifdef APPLE_HYB
-	/*
-	 * we may be using the HFS name - so select the correct input
-	 * charset
-	 */
-	if (USE_MAC_NAME(*r)) {
-		rpnt = (*r)->hfs_ent->name;
-		rinls = hfs_inls;
-	} else {
-		rpnt = (*r)->name;
-		rinls = in_nls;
-	}
-
-	if (USE_MAC_NAME(*l)) {
-		lpnt = (*l)->hfs_ent->name;
-		linls = hfs_inls;
-	} else {
-		lpnt = (*l)->name;
-		linls = in_nls;
-	}
-#else
-	rpnt = (*r)->name;
-	lpnt = (*l)->name;
-	rinls = linls = in_nls;
-#endif	/* APPLE_HYB */
-
-	/*
-	 * If the entries are the same, this is an error.
-	 * Joliet specs allow for a maximum of 64 characters.
-	 */
-	if (strncmp(rpnt, lpnt, jlen) == 0) {
-#ifdef	USE_LIBSCHILY
-		errmsgno(EX_BAD,
-			"Error: %s and %s have the same Joliet name\n",
-			(*r)->whole_name, (*l)->whole_name);
-#else
-		fprintf(stderr,
-			"Error: %s and %s have the same Joliet name\n",
-			(*r)->whole_name, (*l)->whole_name);
-#endif
-		jsort_goof++;
-	}
-	/*
-	 * Put the '.' and '..' entries on the head of the sorted list.
-	 * For normal ASCII, this always happens to be the case, but out of
-	 * band characters cause this not to be the case sometimes.
-	 */
-	if (strcmp(rpnt, ".") == 0)
-		return (-1);
-	if (strcmp(lpnt, ".") == 0)
-		return (1);
-
-	if (strcmp(rpnt, "..") == 0)
-		return (-1);
-	if (strcmp(lpnt, "..") == 0)
-		return (1);
-
-#ifdef DVD_VIDEO
-	/*
-	 * There're rumors claiming that some players assume VIDEO_TS.IFO
-	 * to be the first file in VIDEO_TS/ catalog. Well, it's basically
-	 * the only file a player has to actually look for, as the whole
-	 * video content can be "rolled down" from this file alone.
-	 *				<appro at fy.chalmers.se>
-	 */
-	/*
-	 * XXX This code has to be moved from the Joliet implementation
-	 * XXX to the UDF implementation if we implement decent UDF support
-	 * XXX with a separate name space for the UDF file tree.
-	 */
-	if (dvd_video) {
-		if (strcmp(rpnt, "VIDEO_TS.IFO") == 0)
-			return (-1);
-		if (strcmp(lpnt, "VIDEO_TS.IFO") == 0)
-			return (1);
-	}
-#endif
-
-	while (*rpnt && *lpnt) {
-#ifdef USE_ICONV
-		size_t ri, li;
-#endif
-		if (*rpnt == ';' && *lpnt != ';')
-			return (-1);
-		if (*rpnt != ';' && *lpnt == ';')
-			return (1);
-
-		if (*rpnt == ';' && *lpnt == ';')
-			return (0);
-
-		/*
-		 * Extensions are not special here.
-		 * Don't treat the dot as something that must be bumped to
-		 * the start of the list.
-		 */
-#if 0
-		if (*rpnt == '.' && *lpnt != '.')
-			return (-1);
-		if (*rpnt != '.' && *lpnt == '.')
-			return (1);
-#endif
-
-#ifdef USE_ICONV
-
-		ri = convert_to_unicode(rtmp, 2, rpnt, rinls);
-		li = convert_to_unicode(ltmp, 2, lpnt, linls);
-		rpnt += ri;
-		lpnt += li;
-		if(!ri && !li)
-			return (0);
-		else if(ri && !li)
-			return (1);
-		else if(!ri && li)
-			return (-1);
-#else
-		convert_to_unicode(rtmp, 2, rpnt, rinls);
-		convert_to_unicode(ltmp, 2, lpnt, linls);
-#endif
-
-		if (a_to_u_2_byte(rtmp) < a_to_u_2_byte(ltmp))
-			return (-1);
-		if (a_to_u_2_byte(rtmp) > a_to_u_2_byte(ltmp))
-			return (1);
-
-#ifndef USE_ICONV
-		rpnt++;
-		lpnt++;
-#endif
-	}
-	if (*rpnt)
-		return (1);
-	if (*lpnt)
-		return (-1);
-	return (0);
-}
-
-
-/*
- * Function:		sort_directory
- *
- * Purpose:		Sort the directory in the appropriate ISO9660
- *			order.
- *
- * Notes:		Returns 0 if OK, returns > 0 if an error occurred.
- */
-static int
-joliet_sort_directory(struct directory_entry **sort_dir)
-{
-	int			dcount = 0;
-	int			i;
-	struct directory_entry	*s_entry;
-	struct directory_entry	**sortlist;
-
-	s_entry = *sort_dir;
-	while (s_entry) {
-		/* skip hidden entries */
-		if (!(s_entry->de_flags & INHIBIT_JOLIET_ENTRY))
-			dcount++;
-		s_entry = s_entry->next;
-	}
-
-	/* OK, now we know how many there are.  Build a vector for sorting. */
-	sortlist = (struct directory_entry **)
-		e_malloc(sizeof (struct directory_entry *) * dcount);
-
-	dcount = 0;
-	s_entry = *sort_dir;
-	while (s_entry) {
-	/* skip hidden entries */
-		if (!(s_entry->de_flags & INHIBIT_JOLIET_ENTRY)) {
-			sortlist[dcount] = s_entry;
-			dcount++;
-		}
-		s_entry = s_entry->next;
-	}
-
-	jsort_goof = 0;
-#ifdef	PROTOTYPES
-	qsort(sortlist, dcount, sizeof (struct directory_entry *),
-		(int (*) (const void *, const void *)) joliet_compare_dirs);
-#else
-	qsort(sortlist, dcount, sizeof (struct directory_entry *),
-		joliet_compare_dirs);
-#endif
-
-	/* Now reassemble the linked list in the proper sorted order */
-	for (i = 0; i < dcount - 1; i++) {
-		sortlist[i]->jnext = sortlist[i + 1];
-	}
-
-	sortlist[dcount - 1]->jnext = NULL;
-	*sort_dir = sortlist[0];
-
-	free(sortlist);
-	return (jsort_goof);
-}
-
-int
-joliet_sort_tree(struct directory *node)
-{
-	struct directory	*dpnt;
-	int			ret = 0;
-
-	dpnt = node;
-
-	while (dpnt) {
-		ret = joliet_sort_n_finish(dpnt);
-		if (ret) {
-			break;
-		}
-		if (dpnt->subdir)
-			ret = joliet_sort_tree(dpnt->subdir);
-		if (ret) {
-			break;
-		}
-		dpnt = dpnt->next;
-	}
-	return (ret);
-}
-
-static void
-generate_joliet_directories(struct directory *node, FILE *outfile)
-{
-	struct directory *dpnt;
-
-	dpnt = node;
-
-	while (dpnt) {
-		if ((dpnt->dir_flags & INHIBIT_JOLIET_ENTRY) == 0) {
-			/*
-			 * In theory we should never reuse a directory, so this
-			 * doesn't make much sense.
-			 */
-			if (dpnt->jextent > session_start) {
-				generate_one_joliet_directory(dpnt, outfile);
-			}
-		}
-		/* skip if hidden - but not for the rr_moved dir */
-		if (dpnt->subdir &&
-		    (!(dpnt->dir_flags & INHIBIT_JOLIET_ENTRY) ||
-		    dpnt == reloc_dir)) {
-			generate_joliet_directories(dpnt->subdir, outfile);
-		}
-		dpnt = dpnt->next;
-	}
-}
-
-
-/*
- * Function to write the EVD for the disc.
- */
-static int
-jpathtab_write(FILE *outfile)
-{
-	/* Next we write the path tables */
-	jtwrite(jpath_table_l, jpath_blocks << 11, 1, 0, FALSE);
-	xfwrite(jpath_table_l, jpath_blocks << 11, 1, outfile, 0, FALSE);
-	last_extent_written += jpath_blocks;
-	jtwrite(jpath_table_m, jpath_blocks << 11, 1, 0, FALSE);
-	xfwrite(jpath_table_m, jpath_blocks << 11, 1, outfile, 0, FALSE);
-	last_extent_written += jpath_blocks;
-	free(jpath_table_l);
-	free(jpath_table_m);
-	jpath_table_l = NULL;
-	jpath_table_m = NULL;
-	return (0);
-}
-
-static int
-jdirtree_size(int starting_extent)
-{
-	assign_joliet_directory_addresses(root);
-	return (0);
-}
-
-static int
-jroot_gen()
-{
-	jroot_record.length[0] =
-			1 + offsetof(struct iso_directory_record, name[0]);
-	jroot_record.ext_attr_length[0] = 0;
-	set_733((char *) jroot_record.extent, root->jextent);
-	set_733((char *) jroot_record.size, ISO_ROUND_UP(root->jsize));
-	iso9660_date(jroot_record.date, root_statbuf.st_mtime);
-	jroot_record.flags[0] = ISO_DIRECTORY;
-	jroot_record.file_unit_size[0] = 0;
-	jroot_record.interleave[0] = 0;
-	set_723(jroot_record.volume_sequence_number, volume_sequence_number);
-	jroot_record.name_len[0] = 1;
-	return (0);
-}
-
-static int
-jdirtree_write(FILE *outfile)
-{
-	generate_joliet_directories(root, outfile);
-	return (0);
-}
-
-/*
- * Function to write the EVD for the disc.
- */
-static int
-jvd_write(FILE *outfile)
-{
-	struct iso_primary_descriptor jvol_desc;
-
-	/* Next we write out the boot volume descriptor for the disc */
-	jvol_desc = vol_desc;
-	get_joliet_vol_desc(&jvol_desc);
-	jtwrite(&jvol_desc, SECTOR_SIZE, 1, 0, FALSE);
-	xfwrite(&jvol_desc, SECTOR_SIZE, 1, outfile, 0, FALSE);
-	last_extent_written++;
-	return (0);
-}
-
-/*
- * Functions to describe padding block at the start of the disc.
- */
-static int
-jpathtab_size(int starting_extent)
-{
-	jpath_table[0] = starting_extent;
-	jpath_table[1] = 0;
-	jpath_table[2] = jpath_table[0] + jpath_blocks;
-	jpath_table[3] = 0;
-
-	last_extent += 2 * jpath_blocks;
-	return (0);
-}
-
-struct output_fragment joliet_desc = {NULL, oneblock_size, jroot_gen, jvd_write, "Joliet Volume Descriptor" };
-struct output_fragment jpathtable_desc = {NULL, jpathtab_size, generate_joliet_path_tables, jpathtab_write, "Joliet path table" };
-struct output_fragment jdirtree_desc = {NULL, jdirtree_size, NULL, jdirtree_write, "Joliet directory tree" };

Copied: cdrkit/trunk/genisoimage/joliet.c (from rev 452, cdrkit/trunk/mkisoimage/joliet.c)

Deleted: cdrkit/trunk/genisoimage/jte.c
===================================================================
--- cdrkit/trunk/mkisoimage/jte.c	2006-11-23 21:37:32 UTC (rev 450)
+++ cdrkit/trunk/genisoimage/jte.c	2006-11-23 22:11:41 UTC (rev 453)
@@ -1,1016 +0,0 @@
-/*
- * This file has been modified for the cdrkit suite.
- *
- * The behaviour and appearence of the program code below can differ to a major
- * extent from the version distributed by the original author(s).
- *
- * For details, see Changelog file distributed with the cdrkit package. If you
- * received this file from another source then ask the distributing person for
- * a log of modifications.
- *
- */
-
-#undef BZ2_SUPPORT
-
-#include <mconfig.h>
-#include "mkisoimage.h"
-#include <timedefs.h>
-#include <fctldefs.h>
-#include <zlib.h>
-#ifdef BZ2_SUPPORT
-#   include <bzlib.h>
-#endif
-#include <regex.h>
-#ifdef SORTING
-#include "match.h"
-#endif /* SORTING */
-#include <errno.h>
-#include <schily.h>
-#ifdef DVD_VIDEO
-#include "dvd_reader.h"
-#include "dvd_file.h"
-#include "ifo_read.h"
-#include "md5.h"
-#include "endianconv.h"
-#endif
-#ifdef APPLE_HYB
-#include <ctype.h>
-#endif
-
-#ifdef	VMS
-#include "vms.h"
-#endif
-
-/* Different types used in building our state list below */
-#define JTET_FILE_MATCH 1
-#define JTET_NOMATCH    2
-
-#define JTE_VER_MAJOR     0x0001
-#define JTE_VER_MINOR     0x000F
-#define JTE_NAME          "JTE"
-#define JTE_COMMENT       "JTE at http://www.einval.com/~steve/software/JTE/ ; jigdo at http://atterer.net/jigdo/"
-
-#define JIGDO_TEMPLATE_VERSION "1.1"
-
-#ifdef BZ2_SUPPORT
-int use_bz2 = 0;
-#endif
-
-/*	
-	Simple list to hold the results of -jigdo-exclude and
-	-jigdo-force-match command line options. Seems easiest to do this
-	using regexps.
-*/
-struct path_match
-{
-    regex_t  match_pattern;
-    char    *match_rule;
-    struct path_match *next;
-};
-
-/* List of mappings e.g. Debian=/mirror/debian */
-struct path_mapping
-{
-    char                *from;
-    char                *to;
-    struct path_mapping *next;
-};
-
-FILE	*jtjigdo = NULL;       /* File handle used throughout for the jigdo file */
-FILE	*jttemplate = NULL;    /* File handle used throughout for the template file */
-char    *jjigdo_out = NULL;    /* Output name for jigdo .jigdo file; NULL means don't do it */
-char    *jtemplate_out = NULL; /* Output name for jigdo template file; NULL means don't do it */
-char    *jmd5_list = NULL;     /* Name of file to use for MD5 checking */
-int      jte_min_size = MIN_JIGDO_FILE_SIZE;
-struct  path_match *exclude_list = NULL;
-struct  path_match *include_list = NULL;
-struct  path_mapping  *map_list = NULL;
-unsigned long long template_size = 0;
-unsigned long long image_size = 0;
-
-static struct mk_MD5Context iso_context;
-static struct mk_MD5Context template_context;
-
-/* List of files that we've seen, ready to write into the template and
-   jigdo files */
-typedef struct _file_entry
-{
-    unsigned char       md5[16];
-    off_t               file_length;
-    unsigned long long  rsyncsum;
-    char               *filename;
-} file_entry_t;
-
-typedef struct _unmatched_entry
-{
-    off_t uncompressed_length;
-} unmatched_entry_t;    
-
-typedef struct _entry
-{
-    int entry_type; /* JTET_TYPE as above */
-    struct _entry *next;
-    union
-    {
-        file_entry_t      file;
-        unmatched_entry_t chunk;
-    } data;
-} entry_t;
-
-typedef struct _jigdo_file_entry
-{
-    unsigned char type;
-    unsigned char fileLen[6];
-    unsigned char fileRsync[8];
-    unsigned char fileMD5[16];
-} jigdo_file_entry_t;
-
-typedef struct _jigdo_chunk_entry
-{
-    unsigned char type;
-    unsigned char skipLen[6];
-} jigdo_chunk_entry_t;
-
-typedef struct _jigdo_image_entry
-{
-    unsigned char type;
-    unsigned char imageLen[6];
-    unsigned char imageMD5[16];
-    unsigned char blockLen[4];
-} jigdo_image_entry_t;
-
-typedef struct _md5_list_entry
-{
-    struct _md5_list_entry *next;
-    unsigned char       MD5[16];
-    unsigned long long  size;
-    char               *filename;
-} md5_list_entry_t;
-    
-entry_t *entry_list = NULL;
-entry_t *entry_last = NULL;
-FILE    *t_file = NULL;
-FILE    *j_file = NULL;
-int      num_matches = 0;
-int      num_chunks = 0;
-md5_list_entry_t *md5_list = NULL;
-md5_list_entry_t *md5_last = NULL;
-
-/* Grab the file component from a full path */
-static char *file_base_name(char *path)
-{
-    char *endptr = path;
-    char *ptr = path;
-    
-    while (*ptr != '\0')
-    {
-        if ('/' == *ptr)
-            endptr = ++ptr;
-        else
-            ++ptr;
-    }
-    return endptr;
-}
-
-/* Dump a buffer in hex */
-static char *hex_dump(unsigned char *buf, size_t buf_size)
-{
-    unsigned int i;
-    static char output_buffer[2048];
-    char *p = output_buffer;
-
-    memset(output_buffer, 0, sizeof(output_buffer));
-    if (buf_size >= (sizeof(output_buffer) / 2))
-    {
-        fprintf(stderr, "hex_dump: Buffer too small!\n");
-        exit(1);
-    }
-
-    for (i = 0; i < buf_size ; i++)
-        p += sprintf(p, "%2.2x", buf[i]);
-
-    return output_buffer;
-}
-
-/* Build the list of exclusion regexps */
-extern int jte_add_exclude(char *pattern)
-{
-    struct path_match *new = NULL;
-    
-    new = malloc(sizeof *new);
-    if (!new)
-        return ENOMEM;    
-    
-    regcomp(&new->match_pattern, pattern, REG_NEWLINE);
-	new->match_rule = pattern;
-
-    /* Order on the exclude list doesn't matter! */
-    if (NULL != exclude_list)
-        new->next = exclude_list;
-
-    exclude_list = new;
-    return 0;
-}
-
-/* Check if the file should be excluded because of a filename match. 1
-   means exclude, 0 means not */
-static int check_exclude_by_name(char *filename, char **matched)
-{
-    struct path_match *ptr = exclude_list;
-    regmatch_t pmatch[1];
-    int i = 0;
-
-    while (ptr)
-    {
-        if (!regexec(&ptr->match_pattern, filename, 1, pmatch, 0))
-        {
-            *matched = ptr->match_rule;
-            return 1;
-        }
-        ptr = ptr->next;
-    }
-    
-    /* Not matched, so return 0 */
-    return 0;
-}
-
-/* Build the list of required inclusion regexps */
-extern int jte_add_include(char *pattern)
-{
-    struct path_match *new = NULL;
-    
-    new = malloc(sizeof *new);
-    if (!new)
-        return ENOMEM;    
-    
-    regcomp(&new->match_pattern, pattern, REG_NEWLINE);
-	new->match_rule = pattern;
-
-    /* Order on the include list doesn't matter! */
-    if (NULL != include_list)
-        new->next = include_list;
-
-    include_list = new;
-    return 0;
-}
-
-/* Check if a file has to be MD5-matched to be valid. If we get called
-   here, we've failed to match any of the MD5 entries we were
-   given. If the path to the filename matches one of the paths in our
-   list, clearly it must have been corrupted. Abort with an error. */
-static void check_md5_file_match(char *filename)
-{
-    struct path_match *ptr = include_list;
-    regmatch_t pmatch[1];
-    int i = 0;
-
-    while (ptr)
-    {
-        if (!regexec(&ptr->match_pattern, filename, 1, pmatch, 0))
-        {
-#ifdef	USE_LIBSCHILY
-			comerr("File %s should have matched an MD5 entry, but didn't! (Rule '%s')\n", filename, ptr->match_rule);
-#else
-			fprintf(stderr, "File %s should have matched an MD5 entry, but didn't! (Rule '%s')\n", filename, ptr->match_rule);
-			exit(1);
-#endif
-		}
-        ptr = ptr->next;
-    }
-}    
-
-/* Should we list a file separately in the jigdo output, or should we
-   just dump it into the template file as binary data? Three things
-   cases to look for here:
-
-   1. Small files are better simply folded in, as they take less space that way.
-
-   2. Files in /doc (for example) may change in the archive all the
-      time and it's better to not have to fetch snapshot copies if we
-      can avoid it.      
-
-   3. Files living in specified paths *must* match an entry in the
-      md5-list, or they must have been corrupted. If we find a corrupt
-      file, bail out with an error.
-
-*/
-extern int list_file_in_jigdo(char *filename, off_t size, char **realname, unsigned char md5[16])
-{
-    char *matched_rule;
-    md5_list_entry_t *entry = md5_list;
-    int md5sum_done = 0;
-    
-    if (!jtemplate_out)
-        return 0;
-
-    memset(md5, 0, sizeof(md5));
-
-    /* Cheaper to check file size first */
-    if (size < jte_min_size)
-    {
-        if (verbose > 0)
-            fprintf(stderr, "Jigdo-ignoring file %s; it's too small\n", filename);
-        return 0;
-    }
-    
-    /* Now check the excluded list by name */
-    if (check_exclude_by_name(filename, &matched_rule))
-    {
-        if (verbose > 0)
-            fprintf(stderr, "Jigdo-ignoring file %s; it's covered in the exclude list by \"%s\"\n", filename, matched_rule);
-        return 0;
-    }
-
-    /* Check to see if the file is in our md5 list. Check three things:
-       
-       1. the size
-       2. the filename
-       3. (only if the first 2 match) the md5sum
-
-       If we get a match for all three, include the file and return
-       the full path to the file that we have gleaned from the mirror.
-    */
-
-    while (entry)
-    {
-        if (size == entry->size)
-        {
-            if (!strcmp(file_base_name(filename), file_base_name(entry->filename)))
-            {
-                if (!md5sum_done)
-                {
-                    calculate_md5sum(filename, size, md5);
-                    md5sum_done = 1;
-                }
-                if (!memcmp(md5, entry->MD5, sizeof(entry->MD5)))
-                {
-                    *realname = entry->filename;
-                    return 1;
-                }
-            }
-        }
-        entry = entry->next;
-    }
-
-    /* We haven't found an entry in our MD5 list to match this
-     * file. If we should have done, complain and bail out. */
-    check_md5_file_match(filename);
-    return 0;
-}
-
-/* Add a mapping of pathnames (e.g. Debian=/mirror/debian). We should
-   be passed TO=FROM here */
-extern int jte_add_mapping(char *arg)
-{
-    int error = 0;
-    struct path_mapping *new = NULL;
-    struct path_mapping *entry = NULL;
-    char *p = arg;
-    char *from = NULL;
-    char *to = NULL;
-
-    /* Find the "=" in the string passed. Set it to NULL and we can
-       use the string in-place */
-    while (*p)
-    {
-        if ('=' == *p)
-        {
-            *p = 0;
-            p++;
-            to = arg;
-            from = p;
-        }
-        p++;
-    }
-    if (!from || !strlen(from) || !to || !strlen(to))
-        return EINVAL;
-    
-    new = malloc(sizeof(*new));
-    if (!new)
-        return ENOMEM;
-    
-    new->from = from;
-    new->to = to;
-    new->next = NULL;
-
-    if (verbose > 0)
-        fprintf(stderr, "Adding mapping from %s to %s for the jigdo file\n", from, to);
-    if (!map_list)
-        map_list = new;
-    else
-    {
-        /* Order is important; add to the end of the list */
-        entry = map_list;
-        while (NULL != entry->next)
-            entry = entry->next;
-        entry->next = new;
-    }
-    return 0;
-}
-
-/* Check if the filename should be remapped; if so map it, otherwise
-   return the original name. */
-static char *remap_filename(char *filename)
-{
-    char *new_name = filename;
-    struct path_mapping *entry = map_list;
-    
-    while (entry)
-    {
-        if (!strncmp(filename, entry->from, strlen(entry->from)))
-        {
-            new_name = calloc(1, 2 + strlen(filename) + strlen(entry->to) - strlen(entry->from));
-            if (!new_name)
-            {
-                fprintf(stderr, "Failed to malloc new filename; abort!\n");
-                exit(1);
-            }
-            sprintf(new_name, "%s:%s", entry->to, &filename[strlen(entry->from)]);
-            return new_name;
-        }
-        entry = entry->next;
-    }
-
-    /* No mapping in effect */
-    return strdup(filename);
-}    
-
-/* Write data to the template file and update the MD5 sum */
-static size_t template_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream)
-{
-    mk_MD5Update(&template_context, ptr, size * nmemb);
-    template_size += (unsigned long long)size * nmemb;
-    return fwrite(ptr, size, nmemb, stream);
-}
-
-/* Create a new template file and initialise it */
-static void write_template_header()
-{
-    char buf[2048];
-    int i = 0;
-    char *p = buf;
-
-    memset(buf, 0, sizeof(buf));
-
-    mk_MD5Init(&template_context);
-    i += sprintf(p, "JigsawDownload template %s %s/%d.%d \r\n",
-                 JIGDO_TEMPLATE_VERSION, JTE_NAME, JTE_VER_MAJOR, JTE_VER_MINOR);
-    p = &buf[i];
-
-    i += sprintf(p, "%s \r\n", JTE_COMMENT);
-    p = &buf[i];
-
-    i += sprintf(p, "\r\n");
-    template_fwrite(buf, i, 1, t_file);
-}
-
-/* Read the MD5 list and build a list in memory for us to use later */
-static void add_md5_entry(unsigned char *md5, unsigned long long size, char *filename)
-{
-    int error = 0;
-    md5_list_entry_t *new = NULL;
-    
-    new = calloc(1, sizeof(md5_list_entry_t));
-    memcpy(new->MD5, md5, sizeof(new->MD5));
-    new->size = size;
-    new->filename = strdup(filename);
-    
-    /* Add to the end of the list */
-    if (NULL == md5_last)
-    {
-        md5_last = new;
-        md5_list = new;
-    }
-    else
-    {
-        md5_last->next = new;
-        md5_last = new;
-    }
-}
-
-/* Parse a 12-digit decimal number */
-static unsigned long long parse_number(unsigned char in[12])
-{
-    unsigned long long size = 0;
-    int i = 0;
-    
-    for (i = 0; i < 12; i++)
-    {
-        size *= 10;
-        if (isdigit(in[i]))
-            size += (in[i] - '0');
-    }
-
-    return size;
-}
-    
-/* Read the MD5 list and build a list in memory for us to use later
-   MD5 list format:
-
-   <---MD5--->  <--Size-->  <--Filename-->
-       32          12          remaining
-*/
-static void parse_md5_list(void)
-{
-    FILE *md5_file = NULL;
-    unsigned char buf[1024];
-    unsigned char md5[16];
-    char *filename = NULL;
-    unsigned char *numbuf = NULL;
-    int num_files = 0;
-    unsigned long long size = 0;
-
-    md5_file = fopen(jmd5_list, "rb");
-    if (!md5_file)
-    {
-#ifdef	USE_LIBSCHILY
-        comerr("cannot read from MD5 list file '%s'\n", jmd5_list);
-#else
-        fprintf(stderr, "cannot read from MD5 list file '%s'\n", jmd5_list);
-        exit(1);
-#endif
-    }
-
-    memset(buf, 0, sizeof(buf));
-    while (fgets(buf, sizeof(buf), md5_file))
-    {
-        numbuf = &buf[34];
-        filename = &buf[48];
-        /* Lose the trailing \n from the fgets() call */
-        if (buf[strlen(buf)-1] == '\n')
-            buf[strlen(buf)-1] = 0;
-
-        if (mk_MD5Parse(buf, md5))
-        {
-#ifdef	USE_LIBSCHILY
-            comerr("cannot parse MD5 file '%s'\n", jmd5_list);
-#else
-            fprintf(stderr, "cannot parse MD5 file '%s'\n", jmd5_list);
-            exit(1);
-#endif
-        }
-        size = parse_number(numbuf);
-        add_md5_entry(md5, size, filename);
-        memset(buf, 0, sizeof(buf));
-        num_files++;
-    }
-    if (verbose > 0)
-        fprintf(stderr, "parse_md5_list: added MD5 checksums for %d files\n", num_files);
-    fclose(md5_file);
-}
-
-/* Initialise state and start the jigdo template file */
-void write_jt_header(FILE *template_file, FILE *jigdo_file)
-{
-    t_file = template_file;
-    j_file = jigdo_file;
-
-    /* Start MD5 work for the image */
-    mk_MD5Init(&iso_context);
-
-    /* Start the template file */
-    write_template_header();
-
-    /* Load up the MD5 list if we've been given one */
-    if (jmd5_list)
-        parse_md5_list();
-}
-
-/* Compress and flush out a buffer full of template data */
-static void flush_gzip_chunk(void *buffer, off_t size)
-{
-    z_stream c_stream; /* compression stream */
-    unsigned char comp_size_out[6];
-    unsigned char uncomp_size_out[6];
-    off_t compressed_size_out = 0;
-    int err = 0;
-    unsigned char *comp_buf = NULL;
-
-    c_stream.zalloc = NULL;
-    c_stream.zfree = NULL;
-    c_stream.opaque = NULL;
-
-    err = deflateInit(&c_stream, Z_BEST_COMPRESSION);
-    comp_buf = malloc(2 * size); /* Worst case */
-    c_stream.next_out = comp_buf;
-    c_stream.avail_out = 2 * size;
-    c_stream.next_in = buffer;
-    c_stream.avail_in = size;
-    
-    err = deflate(&c_stream, Z_NO_FLUSH);
-    err = deflate(&c_stream, Z_FINISH);
-    
-    compressed_size_out = c_stream.total_out + 16;
-    err = deflateEnd(&c_stream);
-
-    template_fwrite("DATA", 4, 1, t_file);
-
-    write_le48(compressed_size_out, &comp_size_out[0]);
-    template_fwrite(comp_size_out, sizeof(comp_size_out), 1, t_file);
-
-    write_le48(size, &uncomp_size_out[0]);
-    template_fwrite(uncomp_size_out, sizeof(uncomp_size_out), 1, t_file);
-    
-    template_fwrite(comp_buf, c_stream.total_out, 1, t_file);
-    free(comp_buf);
-}
-
-#ifdef BZ2_SUPPORT
-/* Compress and flush out a buffer full of template data */
-static void flush_bz2_chunk(void *buffer, off_t size)
-{
-    bz_stream c_stream; /* compression stream */
-    unsigned char comp_size_out[6];
-    unsigned char uncomp_size_out[6];
-    off_t compressed_size_out = 0;
-    int err = 0;
-    unsigned char *comp_buf = NULL;
-
-    c_stream.bzalloc = NULL;
-    c_stream.bzfree = NULL;
-    c_stream.opaque = NULL;
-
-    err = BZ2_bzCompressInit(&c_stream, 9, 0, 0);
-    comp_buf = malloc(2 * size); /* Worst case */
-    c_stream.next_out = comp_buf;
-    c_stream.avail_out = 2 * size;
-    c_stream.next_in = buffer;
-    c_stream.avail_in = size;
-    
-    err = BZ2_bzCompress(&c_stream, BZ_FINISH);
-    
-    compressed_size_out = c_stream.total_out_lo32 + 16;
-    err = BZ2_bzCompressEnd(&c_stream);
-
-    template_fwrite("DATA", 4, 1, t_file);
-
-    write_le48(compressed_size_out, &comp_size_out[0]);
-    template_fwrite(comp_size_out, sizeof(comp_size_out), 1, t_file);
-
-    write_le48(size, &uncomp_size_out[0]);
-    template_fwrite(uncomp_size_out, sizeof(uncomp_size_out), 1, t_file);
-    
-    template_fwrite(comp_buf, c_stream.total_out_lo32, 1, t_file);
-    free(comp_buf);
-}
-#endif
-
-static void flush_compressed_chunk(void *buffer, off_t size)
-{
-#ifdef BZ2_SUPPORT
-    if (use_bz2)
-        flush_bz2_chunk(buffer, size);
-    else
-#endif
-        flush_gzip_chunk(buffer, size);
-}
-
-/* Append to an existing data buffer, and compress/flush it if
-   necessary */
-static void write_compressed_chunk(unsigned char *buffer, size_t size)
-{
-    static unsigned char uncomp_buf[1024 * 1024];
-    static size_t uncomp_buf_used = 0;
-
-    if ((uncomp_buf_used + size) > sizeof(uncomp_buf))
-    {
-        flush_compressed_chunk(uncomp_buf, uncomp_buf_used);
-        uncomp_buf_used = 0;
-    }
-
-    if (!size) /* Signal a flush before we start writing the DESC entry */
-    {
-        flush_compressed_chunk(uncomp_buf, uncomp_buf_used);
-        return;
-    }
-    
-    if (!uncomp_buf_used)
-        memset(uncomp_buf, 0, sizeof(uncomp_buf));
-
-    while (size > sizeof(uncomp_buf))
-    {
-        flush_compressed_chunk(buffer, sizeof(uncomp_buf));
-        buffer += sizeof(uncomp_buf);
-        size -= sizeof(uncomp_buf);
-    }
-    memcpy(&uncomp_buf[uncomp_buf_used], buffer, size);
-    uncomp_buf_used += size;
-}
-
-/* Loop through the list of DESC entries that we've built up and
-   append them to the template file */
-static void write_template_desc_entries(off_t image_len, char *image_md5)
-{
-    entry_t *entry = entry_list;
-    off_t desc_len = 0;
-    unsigned char out_len[6];
-    jigdo_image_entry_t jimage;
-
-    desc_len = 16 /* DESC + length twice */
-        + (sizeof(jigdo_file_entry_t) * num_matches)
-        + (sizeof(jigdo_chunk_entry_t) * num_chunks)
-        + sizeof(jigdo_image_entry_t);
-
-    write_le48(desc_len, &out_len[0]);
-    write_compressed_chunk(NULL, 0);
-    template_fwrite("DESC", 4, 1, t_file);
-    template_fwrite(out_len, sizeof(out_len), 1, t_file);
-    
-    while (entry)
-    {
-        switch (entry->entry_type)
-        {
-            case JTET_FILE_MATCH:
-            {
-                jigdo_file_entry_t jfile;
-                jfile.type = 6; /* Matched file */
-                write_le48(entry->data.file.file_length, &jfile.fileLen[0]);
-                write_le64(entry->data.file.rsyncsum, &jfile.fileRsync[0]);
-                memcpy(jfile.fileMD5, entry->data.file.md5, sizeof(jfile.fileMD5));
-                template_fwrite(&jfile, sizeof(jfile), 1, t_file);
-                break;
-            }
-            case JTET_NOMATCH:
-            {
-                jigdo_chunk_entry_t jchunk;
-#ifdef BZ2_SUPPORT
-                if (use_bz2)
-                    jchunk.type = 8; /* Raw data, bzipped */
-                else
-#endif
-                    jchunk.type = 2; /* Raw data, gzipped */
-                write_le48(entry->data.chunk.uncompressed_length, &jchunk.skipLen[0]);
-                template_fwrite(&jchunk, sizeof(jchunk), 1, t_file);
-                break;
-            }
-        }
-        entry = entry->next;
-    }
-
-    jimage.type = 5;
-    write_le48(image_len, &jimage.imageLen[0]);
-    memcpy(jimage.imageMD5, image_md5, sizeof(jimage.imageMD5));
-    write_le32(MIN_JIGDO_FILE_SIZE, &jimage.blockLen[0]);
-    template_fwrite(&jimage, sizeof(jimage), 1, t_file);    
-    template_fwrite(out_len, sizeof(out_len), 1, t_file);
-}
-
-/* Dump a buffer in jigdo-style "base64" */
-static char *base64_dump(unsigned char *buf, size_t buf_size)
-{
-    const char *b64_enc = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
-    int value = 0;
-    unsigned int i;
-    int bits = 0;
-    static char output_buffer[2048];
-    char *p = output_buffer;
-
-    memset(output_buffer, 0, sizeof(output_buffer));
-    if (buf_size >= (sizeof(output_buffer) * 6/8))
-    {
-        fprintf(stderr, "base64_dump: Buffer too small!\n");
-        exit(1);
-    }
-
-    for (i = 0; i < buf_size ; i++)
-    {
-        value = (value << 8) | buf[i];
-        bits += 2;
-        p += sprintf(p, "%c", b64_enc[(value >> bits) & 63U]);
-        if (bits >= 6) {
-            bits -= 6;
-            p += sprintf(p, "%c", b64_enc[(value >> bits) & 63U]);
-        }
-    }
-    if (bits > 0)
-    {
-        value <<= 6 - bits;
-        p += sprintf(p, "%c", b64_enc[value & 63U]);
-    }
-    return output_buffer;
-}
-
-/* Write the .jigdo file to match the .template we've just finished. */
-static void write_jigdo_file(void)
-{
-    unsigned char template_md5sum[16];
-    entry_t *entry = entry_list;
-    struct path_mapping *map = map_list;
-
-    mk_MD5Final(&template_md5sum[0], &template_context);
-
-    fprintf(j_file, "# JigsawDownload\n");
-    fprintf(j_file, "# See <http://atterer.net/jigdo/> for details about jigdo\n");
-    fprintf(j_file, "# See <http://www.einval.com/~steve/software/CD/JTE/> for details about JTE\n\n");
-    
-    fprintf(j_file, "[Jigdo]\n");
-    fprintf(j_file, "Version=%s\n", JIGDO_TEMPLATE_VERSION);
-    fprintf(j_file, "Generator=%s/%d.%d\n\n", JTE_NAME, JTE_VER_MAJOR, JTE_VER_MINOR);
-
-    fprintf(j_file, "[Image]\n");
-    fprintf(j_file, "Filename=%s\n", file_base_name(outfile));
-    fprintf(j_file, "Template=http://localhost/%s\n", jtemplate_out);
-    fprintf(j_file, "Template-MD5Sum=%s \n",
-            base64_dump(&template_md5sum[0], sizeof(template_md5sum)));
-    fprintf(j_file, "# Template Hex MD5sum %s\n",
-            hex_dump(&template_md5sum[0], sizeof(template_md5sum)));
-    fprintf(j_file, "# Template size %lld bytes\n", template_size);
-    fprintf(j_file, "# Image size %lld bytes\n\n", image_size);
-
-    fprintf(j_file, "[Parts]\n");
-    while (entry)
-    {
-        if (JTET_FILE_MATCH == entry->entry_type)
-        {
-            char *new_name = remap_filename(entry->data.file.filename);
-            fprintf(j_file, "%s=%s\n",
-                    base64_dump(&entry->data.file.md5[0], sizeof(entry->data.file.md5)),
-                    new_name);
-            free(new_name);
-        }
-        entry = entry->next;
-    }
-
-    fprintf(j_file, "\n[Servers]\n");
-    fflush(j_file);
-}
-
-/* Finish and flush state; for now:
-   
-   1. Dump the DESC blocks and the footer information in the jigdo template file
-   2. Write the jigdo .jigdo file containing file pointers
-*/
-void write_jt_footer(void)
-{
-    unsigned char md5[16]; /* MD5SUM of the entire image */
-
-    /* Finish calculating the image's checksum */
-    mk_MD5Final(&md5[0], &iso_context);
-
-    /* And calculate the image size */
-    image_size = (unsigned long long)SECTOR_SIZE * last_extent_written;
-
-    write_template_desc_entries(image_size, md5);
-
-    write_jigdo_file();
-}
-
-/* Add a raw data entry to the list of extents; no file to match */
-static void add_unmatched_entry(int uncompressed_length)
-{
-    entry_t *new_entry = NULL;
-
-    /* Can we extend a previous non-match entry? */
-    if (entry_last && (JTET_NOMATCH == entry_last->entry_type))
-    {
-        entry_last->data.chunk.uncompressed_length += uncompressed_length;
-        return;
-    }
-
-    new_entry = calloc(1, sizeof(entry_t));
-    new_entry->entry_type = JTET_NOMATCH;
-    new_entry->next = NULL;
-    new_entry->data.chunk.uncompressed_length = uncompressed_length;
-
-    /* Add to the end of the list */
-    if (NULL == entry_last)
-    {
-        entry_last = new_entry;
-        entry_list = new_entry;
-    }
-    else
-    {
-        entry_last->next = new_entry;
-        entry_last = new_entry;
-    }
-    num_chunks++;
-}
-
-/* Add a file match entry to the list of extents */
-static void add_file_entry(char *filename, off_t size, unsigned char *md5,
-                           unsigned long long rsyncsum)
-{
-    entry_t *new_entry = NULL;
-
-    new_entry = calloc(1, sizeof(entry_t));
-    new_entry->entry_type = JTET_FILE_MATCH;
-    new_entry->next = NULL;
-    memcpy(new_entry->data.file.md5, md5, sizeof(new_entry->data.file.md5));
-    new_entry->data.file.file_length = size;
-    new_entry->data.file.rsyncsum = rsyncsum;
-    new_entry->data.file.filename = strdup(filename);
-
-    /* Add to the end of the list */
-    if (NULL == entry_last)
-    {
-        entry_last = new_entry;
-        entry_list = new_entry;
-    }
-    else
-    {
-        entry_last->next = new_entry;
-        entry_last = new_entry;
-    }
-    num_matches++;
-}    
-
-/* Cope with an unmatched block in the .iso file:
-
-   1. Write a compressed data chunk in the jigdo template file
-   2. Add an entry in our list of unmatched chunks for later */
-void jtwrite(buffer, size, count, submode, islast)
-	void	*buffer;
-	int	size;
-	int	count;
-	int	submode;
-	BOOL	islast;
-{
-#ifdef	JTWRITE_DEBUG
-	if (count != 1 || (size % 2048) != 0)
-		fprintf(stderr, "Count: %d, size: %d\n", count, size);
-#endif
-
-    if (!jtemplate_out)
-        return;
-
-    /* Update the global image checksum */
-    mk_MD5Update(&iso_context, buffer, size*count);
-
-    /* Write a compressed version of the data to the template file,
-       and add a reference on the state list so we can write that
-       later. */
-    write_compressed_chunk(buffer, size*count);
-    add_unmatched_entry(size*count);
-}
-
-/* Cope with a file entry in the .iso file:
-
-   1. Read the file for the image's md5 checksum
-   2. Add an entry in our list of files to be written into the .jigdo later
-*/
-void write_jt_match_record(char *filename, char *mirror_name, int sector_size, off_t size, unsigned char md5[16])
-{
-    unsigned long long  tmp_size = 0;
-    char                buf[32768];
-    off_t               remain = size;
-	FILE               *infile = NULL;
-	int	                use = 0;
-    unsigned long long  rsync64_sum = 0;
-    int first_block = 1;
-
-    memset(buf, 0, sizeof(buf));
-
-    if ((infile = fopen(filename, "rb")) == NULL) {
-#ifdef	USE_LIBSCHILY
-		comerr("cannot open '%s'\n", filename);
-#else
-#ifndef	HAVE_STRERROR
-		fprintf(stderr, "cannot open '%s': (%d)\n",
-				filename, errno);
-#else
-		fprintf(stderr, "cannot open '%s': %s\n",
-				filename, strerror(errno));
-#endif
-		exit(1);
-#endif
-	}
-
-    while (remain > 0)
-    {
-        use = remain;
-        if (remain > sizeof(buf))
-            use = sizeof(buf);
-		if (fread(buf, 1, use, infile) == 0)
-        {
-#ifdef	USE_LIBSCHILY
-			comerr("cannot read from '%s'\n", filename);
-#else
-			fprintf(stderr, "cannot read from '%s'\n", filename);
-			exit(1);
-#endif
-		}
-        if (first_block)
-            rsync64_sum = rsync64(buf, MIN_JIGDO_FILE_SIZE);
-        mk_MD5Update(&iso_context, buf, use);
-        remain -= use;
-        first_block = 0;
-    }
-
-    fclose(infile);
-    
-    /* Update the image checksum with any necessary padding data */
-    if (size % sector_size)
-    {
-        int pad_size = sector_size - (size % sector_size);
-        memset(buf, 0, pad_size);
-        mk_MD5Update(&iso_context, buf, pad_size);
-    }
-
-    add_file_entry(mirror_name, size, &md5[0], rsync64_sum);
-    if (size % sector_size)
-    {
-        int pad_size = sector_size - (size % sector_size);
-        write_compressed_chunk(buf, pad_size);
-        add_unmatched_entry(pad_size);
-    }        
-}

Copied: cdrkit/trunk/genisoimage/jte.c (from rev 452, cdrkit/trunk/mkisoimage/jte.c)

Deleted: cdrkit/trunk/genisoimage/mac_label.c
===================================================================
--- cdrkit/trunk/mkisoimage/mac_label.c	2006-11-23 21:37:32 UTC (rev 450)
+++ cdrkit/trunk/genisoimage/mac_label.c	2006-11-23 22:11:41 UTC (rev 453)
@@ -1,429 +0,0 @@
-/*
- * This file has been modified for the cdrkit suite.
- *
- * The behaviour and appearence of the program code below can differ to a major
- * extent from the version distributed by the original author(s).
- *
- * For details, see Changelog file distributed with the cdrkit package. If you
- * received this file from another source then ask the distributing person for
- * a log of modifications.
- *
- */
-
-/* @(#)mac_label.c	1.9 04/03/05 joerg, Copyright 1997, 1998, 1999, 2000 James Pearson */
-#ifndef lint
-static	char sccsid[] =
-	"@(#)mac_label.c	1.9 04/03/05 joerg, Copyright 1997, 1998, 1999, 2000 James Pearson";
-#endif
-/*
- *      Copyright (c) 1997, 1998, 1999, 2000 James Pearson
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING.  If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-/*
- *	mac_label.c: generate Mactintosh partition maps and label
- *
- *	Taken from "mkisoimage 1.05 PLUS" by Andy Polyakov <appro at fy.chalmers.se>
- *	(see http://fy.chalmers.se/~appro/mkisoimage_plus.html for details)
- *
- *	The format of the HFS driver file:
- *
- *	HFS CD Label Block				512 bytes
- *	Driver Partition Map (for 2048 byte blocks)	512 bytes
- *	Driver Partition Map (for 512 byte blocks)	512 bytes
- *	Empty						512 bytes
- *	Driver Partition				N x 2048 bytes
- *	HFS Partition Boot Block			1024 bytes
- *
- *	File of the above format can be extracted from a CD using
- *	apple_driver.c
- *
- *	James Pearson 16/5/98
- */
-
-/* PREP_BOOT Troy Benjegerdes 2/4/99 */
-
-#include <mconfig.h>
-#include "mkisoimage.h"
-#include "mac_label.h"
-#include "apple.h"
-
-#ifdef PREP_BOOT
-void	gen_prepboot_label(unsigned char *ml);
-
-#endif	/* PREP_BOOT */
-int	gen_mac_label(defer * mac_boot);
-int	autostart(void);
-
-#ifdef PREP_BOOT
-void
-gen_prepboot_label(unsigned char *ml)
-{
-	struct directory_entry *de;
-	int		i = 0;
-	int		block;
-	int		size;
-	MacLabel	*mac_label = (MacLabel *) ml;
-
-	if (verbose > 1) {
-		fprintf(stderr, "Creating %d PReP boot partition(s)\n",
-						use_prep_boot + use_chrp_boot);
-	}
-	mac_label->fdiskMagic[0] = fdiskMagic0;
-	mac_label->fdiskMagic[1] = fdiskMagic1;
-
-	if (use_chrp_boot) {
-		fprintf(stderr, "CHRP boot partition 1\n");
-
-		mac_label->image[i].boot = 0x80;
-
-		mac_label->image[i].CHSstart[0] = 0xff;
-		mac_label->image[i].CHSstart[1] = 0xff;
-		mac_label->image[i].CHSstart[2] = 0xff;
-
-		mac_label->image[i].type = chrpPartType;	/* 0x96 */
-
-		mac_label->image[i].CHSend[0] = 0xff;
-		mac_label->image[i].CHSend[1] = 0xff;
-		mac_label->image[i].CHSend[2] = 0xff;
-
-		mac_label->image[i].startSect[0] = 0;
-		mac_label->image[i].startSect[1] = 0;
-		mac_label->image[i].startSect[2] = 0;
-		mac_label->image[i].startSect[3] = 0;
-
-		size = (last_extent - session_start) * 2048 / 512;
-		mac_label->image[i].size[0] = size & 0xff;
-		mac_label->image[i].size[1] = (size >> 8) & 0xff;
-		mac_label->image[i].size[2] = (size >> 16) & 0xff;
-		mac_label->image[i].size[3] = (size >> 24) & 0xff;
-
-		i++;
-	}
-
-	for (; i < use_prep_boot + use_chrp_boot; i++) {
-		de = search_tree_file(root, prep_boot_image[i - use_chrp_boot]);
-		if (!de) {
-			fprintf(stderr,
-				"Uh oh, I cant find the boot image \"%s\"!\n",
-				prep_boot_image[i - use_chrp_boot]);
-			exit(1);
-		}
-		/* get size and block in 512-byte blocks */
-		block = get_733(de->isorec.extent) * 2048 / 512;
-		size = get_733(de->isorec.size) / 512 + 1;
-		fprintf(stderr, "PReP boot partition %d is \"%s\"\n",
-			i + 1, prep_boot_image[i - use_chrp_boot]);
-
-		mac_label->image[i].boot = 0x80;
-
-		mac_label->image[i].CHSstart[0] = 0xff;
-		mac_label->image[i].CHSstart[1] = 0xff;
-		mac_label->image[i].CHSstart[2] = 0xff;
-
-		mac_label->image[i].type = prepPartType;	/* 0x41 */
-
-		mac_label->image[i].CHSend[0] = 0xff;
-		mac_label->image[i].CHSend[1] = 0xff;
-		mac_label->image[i].CHSend[2] = 0xff;
-
-		/* deal with  endianess */
-		mac_label->image[i].startSect[0] = block & 0xff;
-		mac_label->image[i].startSect[1] = (block >> 8) & 0xff;
-		mac_label->image[i].startSect[2] = (block >> 16) & 0xff;
-		mac_label->image[i].startSect[3] = (block >> 24) & 0xff;
-
-		mac_label->image[i].size[0] = size & 0xff;
-		mac_label->image[i].size[1] = (size >> 8) & 0xff;
-		mac_label->image[i].size[2] = (size >> 16) & 0xff;
-		mac_label->image[i].size[3] = (size >> 24) & 0xff;
-	}
-	for (; i < 4; i++) {
-		mac_label->image[i].CHSstart[0] = 0xff;
-		mac_label->image[i].CHSstart[1] = 0xff;
-		mac_label->image[i].CHSstart[2] = 0xff;
-
-		mac_label->image[i].CHSend[0] = 0xff;
-		mac_label->image[i].CHSend[1] = 0xff;
-		mac_label->image[i].CHSend[2] = 0xff;
-	}
-}
-
-#endif	/* PREP_BOOT */
-
-int
-gen_mac_label(defer *mac_boot)
-{
-	FILE		*fp;
-	MacLabel	*mac_label;
-	MacPart		*mac_part;
-	char		*buffer = (char *) hce->hfs_map;
-	int		block_size;
-	int		have_hfs_boot = 0;
-	char		tmp[SECTOR_SIZE];
-	struct stat	stat_buf;
-	mac_partition_table mpm[2];
-	int		mpc = 0;
-	int		i;
-
-	/* If we have a boot file, then open and check it */
-	if (mac_boot->name) {
-		if (stat(mac_boot->name, &stat_buf) < 0) {
-			sprintf(hce->error, "unable to stat HFS boot file %s",
-								mac_boot->name);
-			return (-1);
-		}
-		if ((fp = fopen(mac_boot->name, "rb")) == NULL) {
-			sprintf(hce->error, "unable to open HFS boot file %s",
-								mac_boot->name);
-			return (-1);
-		}
-		if (fread(tmp, 1, SECTOR_SIZE, fp) != SECTOR_SIZE) {
-			sprintf(hce->error, "unable to read HFS boot file %s",
-								mac_boot->name);
-			return (-1);
-		}
-		/* check we have a bootable partition */
-		mac_part = (MacPart *) (tmp + HFS_BLOCKSZ);
-
-		if (!(IS_MAC_PART(mac_part) &&
-		    strncmp((char *) mac_part->pmPartType, pmPartType_2, 12) == 0)) {
-			sprintf(hce->error, "%s is not a HFS boot file",
-								mac_boot->name);
-			return (-1);
-		}
-		/* check we have a boot block as well - last 2 blocks of file */
-
-		if (fseek(fp, (off_t)-2 * HFS_BLOCKSZ, SEEK_END) != 0) {
-			sprintf(hce->error, "unable to seek HFS boot file %s",
-								mac_boot->name);
-			return (-1);
-		}
-		/* overwrite (empty) boot block for our HFS volume */
-		if (fread(hce->hfs_hdr, 2, HFS_BLOCKSZ, fp) != HFS_BLOCKSZ) {
-			sprintf(hce->error, "unable to read HFS boot block %s",
-								mac_boot->name);
-			return (-1);
-		}
-		fclose(fp);
-
-		/* check boot block is valid */
-		if (d_getw((unsigned char *) hce->hfs_hdr) != HFS_BB_SIGWORD) {
-			sprintf(hce->error,
-				"%s does not contain a valid boot block",
-								mac_boot->name);
-			return (-1);
-		}
-		/*
-		 * collect info about boot file for later user
-		 * - skip over the bootfile header
-		 */
-		mac_boot->size = stat_buf.st_size - SECTOR_SIZE - 2*HFS_BLOCKSZ;
-		mac_boot->off = SECTOR_SIZE;
-		mac_boot->pad = 0;
-
-		/*
-		 * get size in SECTOR_SIZE blocks
-		 * - shouldn't need to round up
-		 */
-		mpm[mpc].size = ISO_BLOCKS(mac_boot->size);
-
-		mpm[mpc].ntype = PM2;
-		mpm[mpc].type = (char *) mac_part->pmPartType;
-		mpm[mpc].start = mac_boot->extent = last_extent;
-		mpm[mpc].name = 0;
-
-		/* flag that we have a boot file */
-		have_hfs_boot++;
-
-		/* add boot file size to the total size */
-		last_extent += mpm[mpc].size;
-		hfs_extra += mpm[mpc].size;
-
-		mpc++;
-	}
-	/* set info about our hybrid volume */
-	mpm[mpc].ntype = PM4;
-	mpm[mpc].type = pmPartType_4;
-	mpm[mpc].start = hce->hfs_map_size / HFS_BLK_CONV;
-	mpm[mpc].size = last_extent - mpm[mpc].start -
-			ISO_BLOCKS(mac_boot->size);
-	mpm[mpc].name = volume_id;
-
-	mpc++;
-
-	if (verbose > 1)
-		fprintf(stderr, "Creating HFS Label %s %s\n", mac_boot->name ?
-			"with boot file" : "",
-			mac_boot->name ? mac_boot->name : "");
-
-	/* for a bootable CD, block size is SECTOR_SIZE */
-	block_size = have_hfs_boot ? SECTOR_SIZE : HFS_BLOCKSZ;
-
-	/* create the CD label */
-	mac_label = (MacLabel *) buffer;
-	mac_label->sbSig[0] = 'E';
-	mac_label->sbSig[1] = 'R';
-	set_722((char *) mac_label->sbBlkSize, block_size);
-	set_732((char *) mac_label->sbBlkCount,
-				last_extent * (SECTOR_SIZE / block_size));
-	set_722((char *) mac_label->sbDevType, 1);
-	set_722((char *) mac_label->sbDevId, 1);
-
-	/* create the partition map entry */
-	mac_part = (MacPart *) (buffer + block_size);
-	mac_part->pmSig[0] = 'P';
-	mac_part->pmSig[1] = 'M';
-	set_732((char *) mac_part->pmMapBlkCnt, mpc + 1);
-	set_732((char *) mac_part->pmPyPartStart, 1);
-	set_732((char *) mac_part->pmPartBlkCnt, mpc + 1);
-	strncpy((char *) mac_part->pmPartName, "Apple",
-						sizeof (mac_part->pmPartName));
-	strncpy((char *) mac_part->pmPartType, "Apple_partition_map",
-						sizeof (mac_part->pmPartType));
-	set_732((char *) mac_part->pmLgDataStart, 0);
-	set_732((char *) mac_part->pmDataCnt, mpc + 1);
-	set_732((char *) mac_part->pmPartStatus, PM_STAT_DEFAULT);
-
-	/* create partition map entries for our partitions */
-	for (i = 0; i < mpc; i++) {
-		mac_part = (MacPart *) (buffer + (i + 2) * block_size);
-		if (mpm[i].ntype == PM2) {
-			/* get driver label and patch it */
-			memcpy((char *) mac_label, tmp, HFS_BLOCKSZ);
-			set_732((char *) mac_label->sbBlkCount,
-				last_extent * (SECTOR_SIZE / block_size));
-			set_732((char *) mac_label->ddBlock,
-				(mpm[i].start) * (SECTOR_SIZE / block_size));
-			memcpy((char *) mac_part, tmp + HFS_BLOCKSZ,
-								HFS_BLOCKSZ);
-			set_732((char *) mac_part->pmMapBlkCnt, mpc + 1);
-			set_732((char *) mac_part->pmPyPartStart,
-				(mpm[i].start) * (SECTOR_SIZE / block_size));
-		} else {
-			mac_part->pmSig[0] = 'P';
-			mac_part->pmSig[1] = 'M';
-			set_732((char *) mac_part->pmMapBlkCnt, mpc + 1);
-			set_732((char *) mac_part->pmPyPartStart,
-				mpm[i].start * (SECTOR_SIZE / HFS_BLOCKSZ));
-			set_732((char *) mac_part->pmPartBlkCnt,
-				mpm[i].size * (SECTOR_SIZE / HFS_BLOCKSZ));
-			strncpy((char *) mac_part->pmPartName, mpm[i].name,
-				sizeof (mac_part->pmPartName));
-			strncpy((char *) mac_part->pmPartType, mpm[i].type,
-				sizeof (mac_part->pmPartType));
-			set_732((char *) mac_part->pmLgDataStart, 0);
-			set_732((char *) mac_part->pmDataCnt,
-				mpm[i].size * (SECTOR_SIZE / HFS_BLOCKSZ));
-			set_732((char *) mac_part->pmPartStatus,
-				PM_STAT_DEFAULT);
-		}
-	}
-
-	if (have_hfs_boot) {	/* generate 512 partition table as well */
-		mac_part = (MacPart *) (buffer + HFS_BLOCKSZ);
-		if (mpc < 3) {	/* don't have to interleave with 2048 table */
-			mac_part->pmSig[0] = 'P';
-			mac_part->pmSig[1] = 'M';
-			set_732((char *) mac_part->pmMapBlkCnt, mpc + 1);
-			set_732((char *) mac_part->pmPyPartStart, 1);
-			set_732((char *) mac_part->pmPartBlkCnt, mpc + 1);
-			strncpy((char *) mac_part->pmPartName, "Apple",
-					sizeof (mac_part->pmPartName));
-			strncpy((char *) mac_part->pmPartType,
-					"Apple_partition_map",
-					sizeof (mac_part->pmPartType));
-			set_732((char *) mac_part->pmLgDataStart, 0);
-			set_732((char *) mac_part->pmDataCnt, mpc + 1);
-			set_732((char *) mac_part->pmPartStatus,
-							PM_STAT_DEFAULT);
-			mac_part++;	/* +HFS_BLOCKSZ */
-		}
-		for (i = 0; i < mpc; i++, mac_part++) {
-			if (mac_part == (MacPart *) (buffer + SECTOR_SIZE))
-				mac_part++;	/* jump over 2048 partition */
-						/* entry */
-			if (mpm[i].ntype == PM2) {
-				memcpy((char *) mac_part, tmp + HFS_BLOCKSZ * 2,
-							HFS_BLOCKSZ);
-				if (!IS_MAC_PART(mac_part)) {
-					mac_part--;
-					continue;
-				}
-				set_732((char *) mac_part->pmMapBlkCnt, mpc+1);
-				set_732((char *) mac_part->pmPyPartStart,
-				    mpm[i].start * (SECTOR_SIZE / HFS_BLOCKSZ));
-			} else {
-				mac_part->pmSig[0] = 'P';
-				mac_part->pmSig[1] = 'M';
-				set_732((char *) mac_part->pmMapBlkCnt, mpc+1);
-				set_732((char *) mac_part->pmPyPartStart,
-				    mpm[i].start * (SECTOR_SIZE / HFS_BLOCKSZ));
-				set_732((char *) mac_part->pmPartBlkCnt,
-				    mpm[i].size * (SECTOR_SIZE / HFS_BLOCKSZ));
-				strncpy((char *) mac_part->pmPartName,
-				    mpm[i].name, sizeof (mac_part->pmPartName));
-				strncpy((char *) mac_part->pmPartType,
-				    mpm[i].type, sizeof (mac_part->pmPartType));
-				set_732((char *) mac_part->pmLgDataStart, 0);
-				set_732((char *) mac_part->pmDataCnt,
-				    mpm[i].size * (SECTOR_SIZE / HFS_BLOCKSZ));
-				set_732((char *) mac_part->pmPartStatus,
-							PM_STAT_DEFAULT);
-			}
-		}
-	}
-	return (0);
-}
-
-/*
- *	autostart: make the HFS CD use the QuickTime 2.0 Autostart feature.
- *
- *	based on information from Eric Eisenhart <eric at sonic.net> and
- *	http://developer.apple.com/qa/qtpc/qtpc12.html and
- *	http://developer.apple.com/dev/techsupport/develop/issue26/macqa.html
- *
- *	The name of the AutoStart file is stored in the area allocated for
- *	the Clipboard name. This area begins 106 bytes into the sector of
- *	block 0, with the first four bytes at that offset containing the
- *	hex value 0x006A7068. This value indicates that an AutoStart
- *	filename follows. After this 4-byte tag, 12 bytes remain, starting
- *	at offset 110. In these 12 bytes, the name of the AutoStart file is
- *	stored as a Pascal string, giving you up to 11 characters to identify
- *	the file. The file must reside in the root directory of the HFS
- *	volume or partition.
- */
-
-int
-autostart()
-{
-	int	len;
-	int	i;
-
-	if ((len = strlen(autoname)) > 11)
-		return (-1);
-
-	hce->hfs_hdr[106] = 0x00;
-	hce->hfs_hdr[107] = 0x6A;
-	hce->hfs_hdr[108] = 0x70;
-	hce->hfs_hdr[109] = 0x68;
-	hce->hfs_hdr[110] = len;
-
-	for (i = 0; i < len; i++)
-		hce->hfs_hdr[111 + i] = autoname[i];
-
-	return (0);
-}

Copied: cdrkit/trunk/genisoimage/mac_label.c (from rev 452, cdrkit/trunk/mkisoimage/mac_label.c)

Deleted: cdrkit/trunk/genisoimage/mac_label.h
===================================================================
--- cdrkit/trunk/mkisoimage/mac_label.h	2006-11-23 21:37:32 UTC (rev 450)
+++ cdrkit/trunk/genisoimage/mac_label.h	2006-11-23 22:11:41 UTC (rev 453)
@@ -1,169 +0,0 @@
-/*
- * This file has been modified for the cdrkit suite.
- *
- * The behaviour and appearence of the program code below can differ to a major
- * extent from the version distributed by the original author(s).
- *
- * For details, see Changelog file distributed with the cdrkit package. If you
- * received this file from another source then ask the distributing person for
- * a log of modifications.
- *
- */
-
-/* @(#)mac_label.h	1.3 04/03/01 joerg, Copyright 1997, 1998, 1999, 2000 James Pearson */
-/*
- *      Copyright (c) 1997, 1998, 1999, 2000 James Pearson
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING.  If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-/*
- *	mac_label.h: defines Macintosh partition maps and label
- *
- *	Taken from "mkisoimage 1.05 PLUS" by Andy Polyakov <appro at fy.chalmers.se>
- *	(see http://fy.chalmers.se/~appro/mkisoimage_plus.html for details)
- *
- *	Much of this is already defined in the libhfs code, but to keep
- *	things simple we stick with these.
- */
-
-#ifndef	_MAC_LABEL_H
-#define	_MAC_LABEL_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef PREP_BOOT
-struct fdiskPartition {
-#define	prepPartType 0x41
-#define	chrpPartType 0x96
-	unsigned char	boot;		/* bootable flag; not used */
-	unsigned char	CHSstart[3];	/* start CHS; not used */
-	unsigned char	type;		/* Partition type, = 0x41 (PReP bootable) */
-	unsigned char	CHSend[3];	/* end CHS; not used */
-	unsigned char	startSect[4];	/* start sector (really start of boot image on CD */
-	unsigned char	size[4];	/* size of partition (or boot image ;) ) */
-};
-typedef struct fdiskPartition fdiskPartition;
-#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+) */
-#ifndef PREP_BOOT
-	unsigned char	ddPad[486];	/* ARRAY[0..242] OF INTEGER; not used */
-#else
-#define	fdiskMagic0 0x55
-#define	fdiskMagic1 0xAA
-	unsigned char   pad1[420];	/* not used */
-	fdiskPartition	image[4];	/* heh heh heh, we can have up to 4 */
-					/* different boot images */
-	unsigned char	fdiskMagic[2];	/* PReP uses fdisk partition map */
-#endif /* PREP_BOOT */
-};
-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"
-
-#define	PM2	2
-#define	PM4	4
-
-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
-
-typedef struct {
-	char *name;			/* Partition name */
-	char *type;			/* Partition type */
-	int   ntype;			/* Partition type (numeric) */
-	int   start;			/* start extent (SECTOR_SIZE blocks) */
-	int   size;			/* extents (SECTOR_SIZE blocks) */
-} mac_partition_table;
-
-/* from libhfs */
-#define	HFS_BB_SIGWORD		0x4c4b
-
-typedef struct deferred_write defer;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _MAC_LABEL_H */

Copied: cdrkit/trunk/genisoimage/mac_label.h (from rev 452, cdrkit/trunk/mkisoimage/mac_label.h)

Deleted: cdrkit/trunk/genisoimage/mkhybrid.8
===================================================================
--- cdrkit/trunk/mkisoimage/mkhybrid.8	2006-11-23 21:37:32 UTC (rev 450)
+++ cdrkit/trunk/genisoimage/mkhybrid.8	2006-11-23 22:11:41 UTC (rev 453)
@@ -1,2 +0,0 @@
-.so man8/mkisoimage.8
-.\" %Z%%M%	%I% %E% joerg

Copied: cdrkit/trunk/genisoimage/mkhybrid.8 (from rev 452, cdrkit/trunk/mkisoimage/mkhybrid.8)

Deleted: cdrkit/trunk/genisoimage/mkisoimage.8
===================================================================
--- cdrkit/trunk/mkisoimage/mkisoimage.8	2006-11-23 21:37:32 UTC (rev 450)
+++ cdrkit/trunk/genisoimage/mkisoimage.8	2006-11-23 22:11:41 UTC (rev 453)
@@ -1,3036 +0,0 @@
-'\" t
-.\" To print, first run through tbl
-.\" -*- nroff -*-
-.\" @(#)mkisoimage.8	1.109 05/05/01 joerg
-.\"
-.if t .ds a \v'-0.55m'\h'0.00n'\z.\h'0.40n'\z.\v'0.55m'\h'-0.40n'a
-.if t .ds o \v'-0.55m'\h'0.00n'\z.\h'0.45n'\z.\v'0.55m'\h'-0.45n'o
-.if t .ds u \v'-0.55m'\h'0.00n'\z.\h'0.40n'\z.\v'0.55m'\h'-0.40n'u
-.if t .ds A \v'-0.77m'\h'0.25n'\z.\h'0.45n'\z.\v'0.77m'\h'-0.70n'A
-.if t .ds O \v'-0.77m'\h'0.25n'\z.\h'0.45n'\z.\v'0.77m'\h'-0.70n'O
-.if t .ds U \v'-0.77m'\h'0.30n'\z.\h'0.45n'\z.\v'0.77m'\h'-0.75n'U
-.if t .ds s \\(*b
-.if t .ds S SS
-.if n .ds a ae
-.if n .ds o oe
-.if n .ds u ue
-.if n .ds s sz
-.TH MKISOFS 8 "24 Aug 2006" "Version 2.01"
-.SH NAME
-mkisoimage \- create an hybrid ISO9660/JOLIET/HFS filesystem with optional Rock Ridge attributes.
-.SH SYNOPSIS
-.B mkisoimage
-[
-.I options
-]
-[
-.B \-o
-.I filename
-]
-.I pathspec [pathspec ...]
-.SH DESCRIPTION
-.B mkisoimage
-is a pre-mastering program to generate ISO9660/JOLIET/HFS hybrid
-filesystems.
-.PP
-.B mkisoimage
-is capable of generating the 
-.B "System Use Sharing Protocol records (SUSP)
-specified
-by the 
-.B "Rock Ridge Interchange Protocol.
-This is used to further describe the
-files in the ISO9660 filesystem to a Unix host, and provides information such
-as long filenames, UID/GID, POSIX permissions, symbolic links,
-block and character devices.
-.PP
-If Joliet or HFS hybrid command line options are specified, 
-.B mkisoimage
-will create the additional filesystem metadata needed for Joliet or HFS.
-If no Joliet or HFS hybrid command line options are given,
-.B mkisoimage
-will generate a pure ISO9660 filesystem.
-.PP
-.B mkisoimage
-can generate a 
-.I true
-(or
-.IR shared )
-HFS hybrid filesystem. The same files are seen as HFS files when
-accessed from a Macintosh and as ISO9660 files when accessed from other 
-machines. HFS stands for
-.I Hierarchical File System
-and is the native file system used on Macintosh computers.
-.PP
-As an alternative,
-.B mkisoimage
-can generate the
-.I Apple Extensions to ISO9660
-for each file. These extensions provide each file with CREATOR, TYPE and
-certain Finder Flags when accessed from a Macintosh. See the
-.B HFS MACINTOSH FILE FORMATS
-section below.
-.PP
-.B mkisoimage
-takes a snapshot of a given directory tree, and generates a
-binary image which will correspond to an ISO9660 or HFS filesystem when
-written to a block device.
-.PP
-Each file written to the ISO9660 filesystem must have a filename in the 8.3
-format (8 characters, period, 3 characters, all upper case), even if Rock Ridge
-is in use.  This filename is used on systems that are not able to make use of
-the Rock Ridge extensions (such as MS-DOS), and each filename in each directory
-must be different from the other filenames in the same directory.
-.B mkisoimage
-generally tries to form correct names by forcing the Unix filename to upper
-case and truncating as required, but often times this yields unsatisfactory
-results when there are cases where the
-truncated names are not all unique.
-.B mkisoimage
-assigns weightings to each filename, and if two names that are otherwise the
-same are found the name with the lower priority is renamed to have a 3 digit
-number as an extension (where the number is guaranteed to be unique).  An
-example of this would be the files foo.bar and
-foo.bar.~1~ - the file foo.bar.~1~ would be written as FOO000.BAR;1 and the file
-foo.bar would be written as FOO.BAR;1
-.PP
-When used with various HFS options,
-.B mkisoimage
-will attempt to recognise files stored in a number of Apple/Unix file formats
-and will copy the data and resource forks as well as any
-relevant finder information. See the
-.B HFS MACINTOSH FILE FORMATS
-section below for more about formats
-.B mkisoimage
-supports.
-.PP
-Note that
-.B mkisoimage
-is not designed to communicate with the writer directly.  Most writers
-have proprietary command sets which vary from one manufacturer to
-another, and you need a specialized tool to actually burn the disk.
-.PP
-The
-.B wodim
-utility is a utility capable of burning an actual disc.  The latest version
-of
-.B wodim
-is available from
-http://alioth.debian.org/projects/debburn/
-.PP
-Also you should know that most cd writers are very particular about timing.
-Once you start to burn a disc, you cannot let their buffer empty before you
-are done, or you will end up with a corrupt disc.  Thus it is critical
-that you be able to maintain an uninterrupted data stream to the writer
-for the entire time that the disc is being written.
-.PP
-.B pathspec
-is the path of the directory tree to be copied into the ISO9660 filesystem.
-Multiple paths can be specified, and
-.B
-mkisoimage
-will merge the files found in all of the specified path components to form the cdrom
-image.
-.PP
-If the option
-.I \-graft\-points
-has been specified, 
-it is possible to graft the paths at points other than the root
-directory, and it is possible to graft files or directories onto the
-cdrom image with names different than what they have in the source filesystem.  This is
-easiest to illustrate with a couple of examples.   Let's start by assuming that a local
-file ../old.lis exists, and you wish to include it in the cdrom image.
-
-
-	foo/bar/=../old.lis
-
-will include the file old.lis in the cdrom image at /foo/bar/old.lis, while
-
-	foo/bar/xxx=../old.lis
-
-will include the file old.lis in the cdrom image at /foo/bar/xxx.  The
-same sort of syntax can be used with directories as well.
-.B mkisoimage
-will create any directories required such that the graft
-points exist on the cdrom image - the directories do not need to
-appear in one of the paths.  By default, any directories that are created on 
-the fly like this will have permissions 0555 and appear to be owned by the
-person running mkisoimage.  If you wish other permissions or owners of
-the intermediate directories, see \-uid, \-gid, \-dir\-mode, \-file\-mode and
-\-new\-dir\-mode.
-.PP
-.B mkisoimage
-will also run on Win9X/NT4 machines when compiled with Cygnus' cygwin
-(available from http://sourceware.cygnus.com/cygwin/). Therefore most
-references in this man page to
-.I Unix
-can be replaced with
-.IR Win32 .
-
-.SH OPTIONS
-.TP
-.BI \-abstract " FILE
-Specifies the abstract file name.
-There is space on the disc for 37 characters of information.
-This parameter can also be set in the file
-.B \&.m\&kisofsrc
-with ABST=filename.
-If specified in both places, the command line version is used.
-.TP
-.BI \-A " application_id
-Specifies a text string that will be written into the volume header.
-This should describe the application that will be on the disc.  There
-is space on the disc for 128 characters of information.  This parameter can
-also be set in the file
-.B \&.m\&kisofsrc
-with APPI=id.
-If specified in both places, the command line version is used.
-.TP
-.B \-allow\-leading\-dots
-.TP
-.B \-ldots
-Allow ISO9660 filenames to begin with a period.  Usually, a leading dot is
-replaced with an underscore in order to maintain MS-DOS compatibility.
-.br
-This violates the ISO9660 standard, but it happens to work on many systems.
-Use with caution.
-.TP
-.B \-allow\-lowercase
-This options allows lower case characters to appear in ISO9660 file names.
-.br
-This violates the ISO9660 standard, but it happens to work on some systems.
-Use with caution.
-.TP
-.B \-allow\-multidot
-This options allows more than one dot to appear in ISO9660 filenames.
-A leading dot is not affected by this option, it
-may be allowed separately using the
-.B \-allow\-leading\-dots
-option.
-.br
-This violates the ISO9660 standard, but it happens to work on many systems.
-Use with caution.
-.TP
-.BI \-biblio " FILE
-Specifies the bibliographic file name.
-There is space on the disc for 37 characters of information.
-This parameter can also be set in the file
-.B \&.m\&kisofsrc
-with BIBLO=filename.
-If specified in both places, the command line version is used.
-.TP
-.B \-cache\-inodes
-Cache inode and device numbers to find hard links to files.
-If
-.B mkisoimage
-finds a hard link (a file with multiple names), then the file will only
-appear once on the CD. This helps to save space on the CD.
-The option
-.B \-cache\-inodes
-is default on Unix like operating systems.
-Be careful when using this option on a filesystem without unique
-inode numbers as it may result in files containing the wrong content on CD.
-.TP
-.B \-no\-cache\-inodes
-Do not cache inode and device numbers.
-This option is needed whenever a filesystem does not have unique
-inode numbers. It is the default on
-.BR Cygwin .
-As the Microsoft operating system that runs below
-.B Cygwin
-is not POSIX compliant, it does not have unique inode numbers.
-Cygwin creates fake inode numbers from a hash algorithm that
-is not 100% correct.
-If
-.B mkisoimage
-would cache inodes on Cygwin, it would believe that some files are
-identical although they are not. The result in this case are files
-that contain the wrong content if a significant amount of different
-files (> ~5000) is in inside the tree that is to be archived.
-This does not happen when the
-.B \-no\-cache\-inodes is used, but the disadvantage is that
-.B mkisoimage
-cannot detect hardlinks anymore and the resulting CD image may be larger
-than expected.
-.TP
-.BI \-alpha\-boot " alpha_boot_image
-Specifies the path and filename of the boot image to be used when
-making an Alpha/SRM bootable CD. The pathname must be relative to the
-source path specified to
-.B mkisoimage.
-.TP
-.BI \-hppa\-bootloader " hppa_bootloader_image
-Specifies the path and filename of the boot image to be used when
-making an HPPA bootable CD. The pathname must be relative to the
-source path specified to
-.B mkisoimage.
-Other options are required, at the very least a kernel file name and
-the boot command line. See the
-.B HPPA NOTES
-section below for more information.
-.TP
-.BI \-hppa\-cmdline " hppa_boot_command_line
-Specifies the command line to be passed to the hppa boot loader when
-making a bootable CD. Separate the parameters with spaces or
-commas. More options must be passed to
-.B mkisoimage,
-at the very least a kernel file name and the boot loader file
-name. See the
-.B HPPA NOTES
-section below for more information.
-.TP
-.BI \-hppa\-kernel\-32 " hppa_kernel_32
-Specifies the path and filename of the 32-bit kernel image to be used
-when making an HPPA bootable CD. The pathname must be relative to the
-source path specified to
-.B mkisoimage.
-Other options are required, at the very least the boot loader file
-name and the boot command line. See the
-.B HPPA NOTES
-section below for more information.
-.TP
-.BI \-hppa\-kernel\-64 " hppa_kernel_64
-Specifies the path and filename of the 64-bit kernel image to be used
-when making an HPPA bootable CD. The pathname must be relative to the
-source path specified to
-.B mkisoimage.
-Other options are required, at the very least the boot loader file
-name and the boot command line. See the
-.B HPPA NOTES
-section below for more information.
-.TP
-.BI \-hppa\-ramdisk " hppa_ramdisk_image
-Specifies the path and filename of the ramdisk image to be used when
-making an HPPA bootable CD. The pathname must be relative to the
-source path specified to
-.B mkisoimage.
-This parameter is
-.B optional.
-Other options are required, at the very
-least a kernel file name and the boot command line. See the
-.B HPPA NOTES
-section below for more information.
-.TP
-.BI \-mips\-boot " mips_boot_image
-Specifies the path and filename of the boot image to be used when
-making an SGI/big-endian MIPS bootable CD. The pathname must be
-relative to the source path specified to
-.B mkisoimage.
-This option may be specified several times to allow the addition of
-multiple boot images, up to a maximum of 15.
-.TP
-.BI \-mipsel\-boot " mipsel_boot_image
-Specifies the path and filename of the boot image to be used when
-making an DEC/little-endian MIPS bootable CD. The pathname must be
-relative to the source path specified to
-.B mkisoimage.
-.TP
-.BI \-sparc\-boot " img_sun4,img_sun4c,img_sun4m,img_sun4d,img_sun4e
-Specifies a comma separated list of boot images that are needed to make
-a bootable CD for sparc systems.
-Partition 0 is used for the ISO9660 image, the first image file is mapped
-to partition 1.
-There may be empty fields in the comma separated list.
-The maximum number of possible partitions is 8 so it is impossible to specify
-more than 7 partition images.
-This option is required to make a bootable CD for Sun sparc systems.
-If the
-.B \-B
-or
-.B \-sparc\-boot
-option has been specified, the first sector of the resulting image will
-contain a Sun disk label. This disk label specifies slice 0 for the
-ISO9660 image and slice 1 .\|.\|. slice 7 for the boot images that
-have been specified with this option. Byte offset 512 .\|.\|. 8191
-within each of the additional boot images must contain a primary boot
-that works for the appropriate sparc architecture. The rest of each
-of the images usually contains an ufs filesystem that is used primary
-kernel boot stage.
-.sp
-The implemented boot method is the boot method found with SunOS 4.x and SunOS 5.x.
-However, it does not depend on SunOS internals but only on properties of
-the Open Boot prom. For this reason, it should be usable for any OS
-that boots off a sparc system.
-.sp
-For more information also see the 
-.B NOTES
-section below.
-.sp
-If the special filename
-.B "..."
-is used, the actual and all following boot partitions are mapped to the
-previous partition. If
-.B mkisoimage
-is called with
-.BI "\-G " image " \-B " ...
-all boot partitions are mapped to the partition that contains the ISO9660
-filesystem image and the generic boot image that is located in the first
-16 sectors of the disk is used for all architectures.
-.TP
-.BI \-b " eltorito_boot_image
-Specifies the path and filename of the boot image to be used when making
-an "El Torito" bootable CD. The pathname must be relative to the source
-path specified to
-.B mkisoimage.
-This option is required to make an "El Torito" bootable CD.
-The boot image must be exactly the size of either a 1200, 1440, or a 2880
-kB floppy, and
-.B mkisoimage
-will use this size when creating the output ISO9660
-filesystem. It is assumed that the first 512 byte sector should be read
-from the boot image (it is essentially emulating a normal floppy drive).
-This will work, for example, if the boot image is a LILO based boot floppy.
-.sp
-If the boot image is not an image of a floppy, you need to add one of the
-options:
-.BR \-hard\-disk\-boot " or " \-no\-emul\-boot .
-If the system should not boot off the emulated disk, use
-.BR \-no\-boot .
-.sp
-If the
-.B \-sort
-option has not been specified, the boot images are sorted
-with low priority (+2) to the beginning of the medium.
-If you don't like this, you need to specify a sort weight of 0 for the boot images.
-.TP
-.B \-eltorito\-alt\-boot
-Start with a new set of "El Torito" boot parameters.
-This allows to have more than one El Torito boot on a CD.
-A maximum of 63 El Torito boot entries may be put on a single CD.
-.TP
-.BI \-B " img_sun4,img_sun4c,img_sun4m,img_sun4d,img_sun4e
-.TP
-.BI \-sparc\-boot " img_sun4,img_sun4c,img_sun4m,img_sun4d,img_sun4e
-Specifies a comma separated list of boot images that are needed to make
-a bootable CD for sparc systems.
-Partition 0 is used for the ISO9660 image, the first image file is mapped
-to partition 1.
-There may be empty fields in the comma separated list.
-The maximum number of possible partitions is 8 so it is impossible to specify
-more than 7 partition images.
-This option is required to make a bootable CD for Sun sparc systems.
-If the
-.B \-B
-or
-.B \-sparc\-boot
-option has been specified, the first sector of the resulting image will
-contain a Sun disk label. This disk label specifies slice 0 for the
-ISO9660 image and slice 1 .\|.\|. slice 7 for the boot images that
-have been specified with this option. Byte offset 512 .\|.\|. 8191
-within each of the additional boot images must contain a primary boot
-that works for the appropriate sparc architecture. The rest of each
-of the images usually contains an ufs filesystem that is used primary
-kernel boot stage.
-.sp
-The implemented boot method is the boot method found with SunOS 4.x and SunOS 5.x.
-However, it does not depend on SunOS internals but only on properties of
-the Open Boot prom. For this reason, it should be usable for any OS
-that boots off a sparc system.
-.sp
-For more information also see the 
-.B NOTES
-section below.
-.sp
-If the special filename
-.B "..."
-is used, the actual and all following boot partitions are mapped to the
-previous partition. If
-.B mkisoimage
-is called with
-.BI "\-G " image " \-B " ...
-all boot partitions are mapped to the partition that contains the ISO9660
-filesystem image and the generic boot image that is located in the first
-16 sectors of the disk is used for all architectures.
-.TP
-.BI \-G " generic_boot_image
-Specifies the path and filename of the generic boot image to be used when making
-a generic bootable CD.
-The
-.B generic_boot_image
-will be placed on the first 16 sectors of the CD. The first 16 sectors
-are the sectors that are located before the ISO9660 primary volume descriptor.
-If this option is used together with the
-.B \-sparc\-boot
-option, the Sun disk label will overlay the first 512 bytes of the generic
-boot image.
-.TP
-.BI \-hard\-disk\-boot
-Specifies that the boot image used to create "El Torito" bootable CDs is
-a hard disk image. The hard disk image must begin with a master boot
-record that contains a single partition.
-.TP
-.BI \-no\-emul\-boot
-Specifies that the boot image used to create "El Torito" bootable CDs is
-a 'no emulation' image. The system will load and execute this image without
-performing any disk emulation.
-.TP
-.BI \-no\-boot
-Specifies that the created "El Torito" CD should be marked as not bootable. The
-system will provide an emulated drive for the image, but will boot off
-a standard boot device.
-.TP
-.BI \-boot\-load\-seg " segment_address
-Specifies the load segment address of the boot image for no-emulation
-"El Torito" CDs.
-.TP
-.BI \-boot\-load\-size " load_sectors
-Specifies the number of "virtual" (512-byte) sectors to load in
-no-emulation mode.  The default is to load the entire boot file.  Some
-BIOSes may have problems if this is not a multiple of 4.
-.TP
-.BI \-boot\-info\-table
-Specifies that a 56-byte table with information of the CD-ROM layout
-will be patched in at offset 8 in the boot file.  If this option is
-given, the boot file is modified in the source filesystem, so make
-sure to make a copy if this file cannot be easily regenerated!  See
-the
-.B "EL TORITO BOOT INFO TABLE
-section for a description of this table.
-.TP
-.BI \-C " last_sess_start,next_sess_start
-This option is needed when
-.B mkisoimage
-is used to create a CD Extra or the image of a second session or a 
-higher level session for a multi session disk.
-The option
-.B \-C
-takes a pair of two numbers separated by a comma. The first number is the
-sector number of the first sector in the last session of the disk
-that should be appended to.
-The second number is the starting sector number of the new session.
-The expected pair of numbers may be retrieved by calling
-.B "wodim \-msinfo ...
-If the
-.B \-C
-option is used in conjunction with the
-.B \-M
-option,
-.B mkisoimage
-will create a filesystem image that is intended to be a continuation
-of the previous session.
-If the
-.B \-C
-option is used without the
-.B \-M
-option,
-.B mkisoimage
-will create a filesystem image that is intended to be used for a second
-session on a CD Extra. This is a multi session CD that holds audio data
-in the first session and a ISO9660 filesystem in the second session.
-.TP
-.BI \-c " boot_catalog
-Specifies the path and filename of the boot catalog to be used when making
-an "El Torito" bootable CD. The pathname must be relative to the source
-path specified to
-.B mkisoimage.
-This option is required to make a bootable CD.
-This file will be inserted into the output tree and not created
-in the source filesystem, so be
-sure the specified filename does not conflict with an existing file, as
-it will be excluded. Usually a name like "boot.catalog" is
-chosen.
-.sp
-If the
-.B \-sort
-option has not been specified, the boot catalog sorted
-with low priority (+1) to the beginning of the medium.
-If you don't like this, you need to specify a sort weight of 0 for the boot catalog.
-.TP
-.B \-check\-oldnames
-Check all filenames imported from old session for compliance with
-actual 
-.B mkisoimage 
-ISO9660 file naming rules.
-It his option is not present, only names with a length > 31 are checked
-as these files are a hard violation of the ISO9660 standard.
-.TP
-.BI \-check\-session " FILE
-Check all old sessions for compliance with
-actual 
-.B mkisoimage 
-ISO9660 file naming rules.
-This is a high level option that is a combination of the options:
-.BI \-M " FILE " "\-C 0,0 \-check\-oldnames
-For the parameter 
-.I FILE
-see description of
-.B \-M
-option.
-.TP
-.BI \-copyright " FILE
-Specifies the copyright file name.
-There is space on the disc for 37 characters of information.
-This parameter can also be set in the file
-.B \&.m\&kisofsrc
-with COPY=filename.
-If specified in both places, the command line version is used.
-.TP
-.B \-d
-Omit trailing period from files that do not have a period.
-.br
-This violates the ISO9660 standard, but it happens to work on many systems.
-Use with caution.
-.TP
-.B \-D
-Do not use deep directory relocation, and instead just pack them in the
-way we see them.
-.br
-If ISO9660:1999 has not been selected,
-this violates the ISO9660 standard, but it happens to work on many systems.
-Use with caution.
-.TP
-.BI \-dir\-mode " mode
-Overrides the mode of directories used to create the image to
-.IR mode .
-Specifying this option automatically enables Rock Ridge extensions.
-.TP
-.B \-dvd\-video
-Generate a DVD-Video compliant UDF file system. This is done by sorting the
-order of the content of the appropriate files and by adding padding 
-between the files if needed.
-Note that the sorting only works if the DVD-Video filenames include upper case
-characters only.
-.br
-.br
-Note that in order to get a DVD-Video compliant filesystem image, you need
-to prepare a DVD-Video compliant directory tree. This means you need to
-have a directory VIDEO_TS (all caps) in the root directory of the resulting DVD
-and you should have a directory AUDIO_TS. The directory VIDEO_TS needs to
-include all needed files (file names must be all caps) for a compliant DVD-Video
-filesystem.
-.TP
-.B \-f
-Follow symbolic links when generating the filesystem.  When this option is not
-in use, symbolic links will be entered using Rock Ridge if enabled, otherwise
-the file will be ignored.
-.TP
-.BI \-file\-mode " mode
-Overrides the mode of regular files used to create the image to
-.IR mode .
-Specifying this option automatically enables Rock Ridge extensions.
-.TP
-.BI \-gid " gid
-Overrides the gid read from the source files to the value of
-.IR gid . 
-Specifying this option automatically enables Rock Ridge extensions.
-.TP
-.B \-gui
-Switch the behaviour for a GUI. This currently makes the output more verbose
-but may have other effects in future.
-.TP
-.B \-graft\-points
-Allow to use graft points for filenames. If this option is used, all filenames
-are checked for graft points. The filename is divided at the first unescaped
-equal sign. All occurrences of '\\\\' and '=' characters must be escaped with '\\\\'
-if 
-.I \-graft\-points
-has been specified.
-.TP
-.BI \-hide " glob
-Hide
-.I glob
-from being seen on the ISO9660 or Rock Ridge directory.
-.I glob
-is a shell wild-card-style pattern that must match any part of the filename 
-or path.
-Multiple globs may be hidden.
-If
-.I glob
-matches a directory, then the contents of that directory will be hidden.
-In order to match a directory name, make sure the pathname does not include
-a trailing '/' character.
-All the hidden files will still be written to the output CD image file.
-Should be used with the
-.B \-hide\-joliet
-option. See README.hide for more details.
-.TP
-.BI \-hide\-list " file
-A file containing a list of
-.I globs
-to be hidden as above.
-.TP
-.BI \-hidden " glob
-Add the hidden (existence) ISO9660 directory attribute for
-.IR glob .
-This attribute will prevent 
-.I glob
-from being listed on DOS based systems if the /A flag is not used for the listing.
-.I glob
-is a shell wild-card-style pattern that must match any part of the filename 
-or path.
-In order to match a directory name, make sure the pathname does not include
-a trailing '/' character.
-Multiple globs may be hidden.
-.TP
-.BI \-hidden\-list " file
-A file containing a list of
-.I globs
-to get the hidden attribute as above.
-.TP
-.BI \-hide\-joliet " glob
-Hide
-.I glob
-from being seen on the Joliet directory.
-.I glob
-is a shell wild-card-style pattern that must match any part of the filename 
-or path.
-Multiple globs may be hidden.
-If
-.I glob
-matches a directory, then the contents of that directory will be hidden.
-In order to match a directory name, make sure the pathname does not include
-a trailing '/' character.
-All the hidden files will still be written to the output CD image file.
-Should be used with the
-.B \-hide
-option. See README.hide for more details.
-.TP
-.BI \-hide\-joliet\-list " file
-A file containing a list of
-.I globs
-to be hidden as above.
-.TP
-.B \-hide\-joliet\-trans\-tbl
-Hide the
-.B TRANS.TBL
-files from the Joliet tree.
-These files usually don't make sense in the Joliet World as they list
-the real name and the ISO9660 name which may both be different from the
-Joliet name.
-.TP
-.B \-hide\-rr\-moved
-Rename the directory
-.B RR_MOVED
-to
-.B .rr_moved
-in the Rock Ridge tree.
-It seems to be impossible to completely hide the
-.B RR_MOVED
-directory from the Rock Ridge tree.
-This option only makes the visible tree better to understand for
-people who don't know what this directory is for.
-If you need to have no
-.B RR_MOVED
-directory at all, you should use the
-.B \-D
-option. Note that in case that the
-.B \-D
-option has been specified, the resulting filesystem is not ISO9660
-level-1 compliant and will not be readable on MS-DOS.
-See also 
-.B NOTES
-section for more information on the 
-.B RR_MOVED
-directory.
-.TP
-.BI \-input\-charset " charset
-Input charset that defines the characters used in local file names.
-To get a list of valid charset names, call
-.B "mkisoimage \-input\-charset help.
-To get a 1:1 mapping, you may use
-.B default
-as charset name. The default initial values are
-.I cp437
-on DOS based systems and
-.I iso8859-1
-on all other systems.
-See 
-.B "CHARACTER SETS
-section below for more details.
-.TP
-.BI \-output\-charset " charset
-Output charset that defines the characters that will be used in Rock Ridge
-file names. Defaults to the input charset. See
-.B "CHARACTER SETS
-section below for more details.
-.TP
-.BI \-iso\-level " level
-Set the ISO9660 conformance level. Valid numbers are 1..3 and 4.
-.sp
-With level 1, files may only consist of one section and filenames are
-restricted to 8.3 characters.
-.sp
-With level 2, files may only consist of one section.
-.sp
-With level 3, no restrictions (other than ISO-9660:1988) do apply.
-.sp
-With all ISO9660 levels from 1..3, all filenames are restricted to upper
-case letters, numbers and the underscore (_). The maximum filename
-length is restricted to 31 characters, the directory nesting level
-is restricted to 8 and the maximum path length is limited to 255 characters.
-.sp
-Level 4 officially does not exists but 
-.B mkisoimage
-maps it to ISO-9660:1999 which is ISO9660 version 2.
-.sp
-With level 4, an enhanced volume descriptor with version number
-and file structure version number set to 2 is emitted.
-There may be more than 8 levels of directory nesting,
-there is no need for a file to contain a dot and the dot has no
-more special meaning,
-file names do not have version numbers,
-.\" (f XXX ??? The character used for filling byte positions which are
-.\"     specified to be characters is subject to agreement between the
-.\"     originator and the recipient of the volume),
-the maximum length for files and directory is raised to 207.
-If Rock Ridge is used, the maximum ISO9660 name length is reduced to 197.
-.sp
-When creating Version 2 images,
-.B mkisoimage
-emits an enhanced volume descriptor which looks similar to a primary volume
-descriptor but is slightly different. Be careful not to use broken software
-to make ISO9660 images bootable by assuming a second PVD copy and patching 
-this putative PVD copy into an El Torito VD.
-.TP
-.B \-J
-Generate Joliet directory records in addition to regular ISO9660 file
-names.  This is primarily useful when the discs are to be used on Windows
-machines.  The Joliet filenames are specified in Unicode and
-each path component can be up to 64 Unicode characters long.
-Note that Joliet is not a standard - CDs that use only Joliet extensions but no
-standard Rock Ridge extensions may usually only be used on Microsoft Win32
-systems. Furthermore, the fact that the filenames are limited to 64 characters
-and the fact that Joliet uses the UTF-16 coding for Unicode characters causes
-interoperability problems.
-.TP
-.B \-joliet\-long
-Allow Joliet filenames to be up to 103 Unicode characters. This breaks the
-Joliet specification - but appears to work. Use with caution. The number
-103 is derived from: the maximum Directory Record Length (254), minus the
-length of Directory Record (33), minus CD-ROM XA System Use Extension
-Information (14), divided by the UTF-16 character size (2).
-.TP
-.BI \-jcharset " charset
-Same as using
-.B \-input\-charset
-.I charset
-and
-.B \-J
-options. See
-.B "CHARACTER SETS
-section below for more details.
-.TP
-.B \-l
-Allow full 31 character filenames.  Normally the ISO9660 filename will be in an
-8.3 format which is compatible with MS-DOS, even though the ISO9660 standard
-allows filenames of up to 31 characters.  If you use this option, the disc may
-be difficult to use on a MS-DOS system, but this comes in handy on some other
-systems (such as the Amiga).
-Use with caution.
-.TP
-.B \-L
-Outdated option reserved by POSIX.1-2001, use
-.B \-allow\-leading\-dots
-instead.
-This option will get POSIX.1-2001 semantics with mkisoimage-2.02.
-.TP
-.BI \-jigdo\-jigdo " jigdo_file
-Produce a jigdo .jigdo file as well as the .iso. See the
-.B JIGDO NOTES
-section below for more information.
-.TP
-.BI \-jigdo\-template " template_file
-Produce a jigdo .template file as well as the .iso. See the
-.B JIGDO NOTES
-section below for more information.
-.TP
-.BI \-jigdo\-min\-file\-size " size
-Specify the minimum size for a file to be listed in the .jigdo
-file. Default (and minimum allowed) is 1KB. See the
-.B JIGDO NOTES
-section below for more information.
-.TP
-.BI \-jigdo\-force\-md5 " path
-Specify a file pattern where files MUST be contained in the
-externally-suplied MD5 list as supplied by \-md5\-list. See the
-.B JIGDO NOTES
-section below for more information.
-.TP
-.BI \-jigdo\-exclude " path
-Specify a file pattern where files will not be listed in the .jigdo
-file. See the
-.B JIGDO NOTES
-section below for more information.
-.TP
-.BI \-jigdo\-map " path
-Specify a pattern mapping for the jigdo file
-(e.g. Debian=/mirror/debian). See the
-.B JIGDO NOTES
-section below for more information.
-.TP
-.BI \-md5\-list " md5_file
-Specify a file containing the MD5sums, sizes and pathnames of the
-files to be included in the .jigdo file. See the
-.B JIGDO NOTES
-section below for more information.
-.TP
-.BI \-log\-file " log_file
-Redirect all error, warning and informational messages to
-.I log_file
-instead of the standard error.
-.TP
-.BI \-m " glob
-Exclude
-.I glob
-from being written to CD-ROM.
-.I glob
-is a shell wild-card-style pattern that must match part of the filename (not 
-the path as with option
-.BR \-x ).
-Technically
-.I glob
-is matched against the
-.I d->d_name
-part of the directory entry.
-Multiple globs may be excluded.
-Example:
-
-mkisoimage \-o rom \-m '*.o' \-m core \-m foobar
-
-would exclude all files ending in ".o", called "core" or "foobar" to be
-copied to CD-ROM. Note that if you had a directory called "foobar" it too (and
-of course all its descendants) would be excluded.
-.sp
-NOTE: The
-.B \-m
-and
-.B \-x
-option description should both be updated, they are wrong.
-Both now work identical and use filename globbing. A file is excluded if either
-the last component matches or the whole path matches.
-.TP
-.BI \-exclude\-list " file
-A file containing a list of
-.I globs
-to be exclude as above.
-.TP
-.B \-max\-iso9660\-filenames
-Allow 37 chars in ISO9660 filenames.
-This option forces the
-.B \-N
-option as the extra name space is taken from the space reserved for
-ISO9660 version numbers.
-.br
-This violates the ISO9660 standard, but it happens to work on many systems.
-Although a conforming application needs to provide a buffer space of at
-least 37 characters, disks created with this option may cause a buffer
-overflow in the reading operating system. Use with extreme care.
-.TP
-.BI \-M " path
-or
-.TP
-.BI \-M " device
-or
-.TP
-.BI \-dev " device
-Specifies path to existing ISO9660 image to be merged. The alternate form
-takes a SCSI device specifier that uses the same syntax as the
-.B "dev=
-parameter of
-.B wodim.
-The output of 
-.B mkisoimage
-will be a new session which should get written to the end of the
-image specified in \-M.  Typically this requires multi-session capability
-for the recorder and cdrom drive that you are attempting to write this
-image to.
-This option may only be used in conjunction with the
-.B \-C
-option.
-.TP
-.B \-N
-Omit version numbers from ISO9660 file names.
-.br
-This violates the ISO9660 standard, but no one really uses the
-version numbers anyway.
-Use with caution.
-.TP
-.BI \-new\-dir\-mode " mode
-Mode to use when creating new directories in the filesystem image.  The default
-mode is 0555.
-.TP
-.B \-nobak
-.TP
-.B \-no\-bak
-Do not include backup files files on the ISO9660 filesystem.
-If the
-.B \-no\-bak
-option is specified, files that contain the characters '~' or '#'
-or end in '.bak' will not be included (these are typically backup files
-for editors under Unix).
-.TP
-.B \-force\-rr
-Do not use the automatic Rock Ridge attributes recognition for previous sessions.
-This helps to show rotten ISO9660 extension records as e.g. created by NERO burning ROM.
-.TP
-.B \-no\-rr
-Do not use the Rock Ridge attributes from previous sessions.
-This may help to avoid getting into trouble when
-.B mkisoimage
-finds illegal Rock Ridge signatures on an old session.
-.TP
-.B \-no\-split\-symlink\-components
-Don't split the SL components, but begin a new Continuation Area (CE)
-instead. This may waste some space, but the SunOS 4.1.4 cdrom driver
-has a bug in reading split SL components (link_size = component_size 
-instead of link_size += component_size).
-.sp
-Note that this option has been introduced by Eric Youngdale in 1997.
-It is questionable whether it makes sense at all.
-When it has been introduced,
-.B mkisoimage 
-did have a serious bug that did create defective CE signatures if
-a symlink contained `/../'.
-This CE signature bug in
-.B mkisoimage
-has been fixed in May 2003.
-.TP
-.B \-no\-split\-symlink\-fields
-Don't split the SL fields, but begin a new Continuation Area (CE)
-instead. This may waste some space, but the SunOS 4.1.4 and
-Solaris 2.5.1 cdrom driver have a bug in reading split SL fields
-(a `/' can be dropped).
-.sp
-Note that this option has been introduced by Eric Youngdale in 1997.
-It is questionable whether it makes sense at all.
-When it has been introduced,
-.B mkisoimage 
-did have a serious bug that did create defective CE signatures if
-a symlink contained `/../'.
-This CE signature bug in
-.B mkisoimage
-has been fixed in May 2003.
-.TP
-.BI \-o " filename
-is the name of the file to which the ISO9660 filesystem image should be
-written.  This can be a disk file, a tape drive, or it can correspond directly
-to the device name of the optical disc writer.  If not specified, stdout is
-used.  Note that the output can also be a block special device for a regular
-disk drive, in which case the disk partition can be mounted and examined to
-ensure that the premastering was done correctly.
-.TP
-.B \-pad
-Pad the end of the whole image by 150 sectors (300 kB).
-If the option
-.B \-B
-is used, then there is a padding at the end of the ISO9660 partition 
-and before the beginning of the boot partitions.
-The size of this padding is chosen to make the first boot partition start
-on a sector number that is a multiple of 16.
-.sp
-The padding is needed as many operating systems (e.g. Linux)
-implement read ahead bugs in their filesystem I/O. These bugs result in read
-errors on one or more files that are located at the end of a track. They are
-usually present when the CD is written in Track at Once mode or when
-the disk is written as mixed mode CD where an audio track follows the
-data track.
-.sp
-To avoid problems with I/O error on the last file on the filesystem,
-the 
-.B \-pad
-option has been made the default.
-.TP
-.B \-no\-pad
-Do not Pad the end by 150 sectors (300 kB) and do not make the the boot partitions
-start on a multiple of 16 sectors.
-.TP
-.BI \-path\-list " file
-A file containing a list of
-.I pathspec
-directories and filenames to be added to the ISO9660 filesystem. This list
-of pathspecs are processed after any that appear on the command line. If the
-argument is
-.IR \- ,
-then the list is read from the standard input.
-.TP
-.B \-P
-Outdated option reserved by POSIX.1-2001, use
-.B \-publisher
-instead.
-This option will get POSIX.1-2001 semantics with mkisoimage-2.02.
-.TP
-.BI \-publisher " publisher_id
-Specifies a text string that will be written into the volume header.
-This should describe the publisher of the CD-ROM, usually with a
-mailing address and phone number.  There is space on the disc for 128
-characters of information.  This parameter can also be set in the file
-.B \&.m\&kisofsrc
-with PUBL=.
-If specified in both places, the command line version is used.
-.TP
-.BI \-p " preparer_id
-Specifies a text string that will be written into the volume header.
-This should describe the preparer of the CD-ROM, usually with a mailing
-address and phone number.  There is space on the disc for 128
-characters of information.  This parameter can also be set in the file
-.B \&.m\&kisofsrc
-with PREP=.
-If specified in both places, the command line version is used.
-.TP
-.B \-print\-size
-Print estimated filesystem size in multiples of the sector size (2048 bytes)
-and exit. This option is needed for
-Disk At Once mode and with some CD-R drives when piping directly into
-.B wodim.
-In this case it is needed to know the size of the filesystem before the
-actual CD creation is done.
-The option \-print\-size allows to get this size from a "dry-run" before
-the CD is actually written.
-Old versions of
-.B mkisoimage
-did write this information (among other information) to 
-.IR stderr .
-As this turns out to be hard to parse, the number without any other information
-is now printed on 
-.B stdout
-too.
-If you like to write a simple shell script, redirect
-.B stderr
-and catch the number from
-.BR stdout .
-This may be done with:
-.sp
-.B "cdblocks=` mkisoimage \-print\-size \-quiet .\|.\|. `
-.sp
-.B "mkisoimage .\|.\|. | wodim .\|.\|. tsize=${cdblocks}s -"
-.TP
-.B \-quiet
-This makes
-.B mkisoimage
-even less verbose.  No progress output will be provided.
-.TP
-.B \-R
-Generate SUSP and RR records using the Rock Ridge protocol to further describe
-the files on the ISO9660 filesystem.
-.TP
-.B \-r
-This is like the \-R option, but file ownership and modes are set to
-more useful values.  The uid and gid are set to zero, because they are
-usually only useful on the author's system, and not useful to the
-client.  All the file read bits are set true, so that files and
-directories are globally readable on the client.  If any execute bit is
-set for a file, set all of the execute bits, so that executables are
-globally executable on the client.  If any search bit is set for a
-directory, set all of the search bits, so that directories are globally
-searchable on the client.  All write bits are cleared, because the
-filesystem will be mounted read-only in any case.  If any of the special
-mode bits are set, clear them, because file locks are not useful on a
-read-only file system, and set-id bits are not desirable for uid 0 or
-gid 0.
-When used on Win32, the execute bit is set on
-.I all
-files. This is a result of the lack of file permissions on Win32 and the
-Cygwin POSIX emulation layer.  See also \-uid \-gid, \-dir\-mode, \-file\-mode
-and \-new\-dir\-mode.
-.TP
-.B \-relaxed\-filenames
-The option
-.B \-relaxed\-filenames
-allows ISO9660 filenames to include digits, upper case characters
-and all other 7 bit ASCII characters (resp. anything except lowercase
-characters).
-.br
-This violates the ISO9660 standard, but it happens to work on many systems.
-Use with caution.
-.TP
-.BI \-root " dir
-Moves all files and directories into
-.I dir
-in the image. This is essentially the
-same as using 
-.B -graft-points
-and adding
-.I dir
-in front of every pathspec, but is easier to use.
-
-.I dir
-may actually be several levels deep. It is
-created with the same permissions as other graft points.
-.TP
-.BI \-old-root " dir
-This option is necessary when writing a multisession
-image and the previous (or even older) session was written with
-.BI -root " dir.
-Using a directory name not found in the previous session
-causes
-.B mkisoimage
-to abort with an error.
-
-Without this option,
-.B mkisoimage
-would not be able to find unmodified files and would
-be forced to write their data into the image once more.
-
-.B \-root
-and
-.B \-old-root
-are meant to be used together to do incremental backups.
-The initial session would e.g. use:
-.BI "mkisoimage \-root backup_1 " dirs\f0.
-The next incremental backup with
-.BI "mkisoimage \-root backup_2 \-old-root backup_1 " dirs\f0.
-would take another snapshot of these directories. The first
-snapshot would be found in
-.BR backup_1 ,
-the second one in
-.BR backup_2 ,
-but only modified or new files need to be written
-into the second session.
-
-Without these options, new files would be added and old ones would be
-preserved. But old ones would be overwritten if the file was
-modified. Recovering the files by copying the whole directory back
-from CD would also restore files that were deleted
-intentionally. Accessing several older versions of a file requires
-support by the operating system to choose which sessions are to be
-mounted.
-.TP
-.BI \-sort " sort file
-Sort file locations on the media. Sorting is controlled by a file that
-contains pairs of filenames and sorting offset weighting.
-If the weighting is higher, the file will be located closer to the
-beginning of the media, if the weighting is lower, the file will be located
-closer to the end of the media. There must be only one space or tabs
-character between the filename and the
-weight and the weight must be the last characters on a line. The filename
-is taken to include all the characters up to, but not including the last
-space or tab character on a line. This is to allow for space characters to
-be in, or at the end of a filename.
-This option does
-.B not
-sort the order of the file names that appear
-in the ISO9660 directory. It sorts the order in which the file data is
-written to the CD image - which may be useful in order to optimize the
-data layout on a CD. See README.sort for more details.
-.TP
-.BI \-sparc\-boot " img_sun4,img_sun4c,img_sun4m,img_sun4d,img_sun4e
-See
-.B \-B
-option above.
-.TP
-.BI \-sparc\-label " label
-Set the Sun disk label name for the Sun disk label that is created with the
-.B \-sparc-boot
-option.
-.TP
-.B \-split\-output
-Split the output image into several files of approximately 1 GB.
-This helps to create DVD sized ISO9660 images on operating systems without
-large file support.
-Wodim will concatenate more than one file into a single track if writing
-to a DVD.
-To make
-.B \-split\-output
-work, the 
-.BI \-o " filename"
-option must be specified. The resulting outout images will be named:
-.IR filename_00 , filename_01, filename_02 ...
-.TP
-.BI \-stream\-media\-size " #
-Select streaming operation and set the media size to # sectors.
-This allows you to pipe the output of the tar program into mkisoimage
-and to create a ISO9660 filesystem without the need of an intermediate
-tar archive file. 
-If this option has been specified,
-.B mkisoimage
-reads from 
-.B stdin 
-and creates a file with the name
-.BR STREAM.IMG .
-The maximum size of the file (with padding) is 200 sectors less than the 
-specified media size. If 
-.B \-no\-pad
-has been specified, the file size is 50 sectors less than the specified media size.
-If the file is smaller, then mkisoimage will write padding. This may take a while.
-.sp
-The option 
-.B \-stream\-media\-size
-creates simple ISO9660 filesystems only and may not used together with multi-session
-or hybrid filesystem options.
-.TP
-.BI \-stream\-file\-name " name
-Reserved for future use.
-.TP
-.BI \-sunx86\-boot " UFS-img,,,AUX1-img
-Specifies a comma separated list of filesystem images that are needed to make
-a bootable CD for Solaris x86 systems.
-.sp
-Note that partition 1 is used for the ISO9660 image and that partition 2 is
-the whole disk, so partition 1 and 2 may not be used by external partition data.
-The first image file is mapped to partition 0.
-There may be empty fields in the comma separated list,
-and list entries for partition 1 and 2 must be empty.
-The maximum number of supported partitions is 8 (although the Solaris x86
-partition table could support up to 16 partitions), so it is impossible
-to specify more than 6 partition images.
-This option is required to make a bootable CD for Solaris x86 systems.
-.sp
-If the
-.B \-sunx86\-boot
-option has been specified, the first sector of the resulting image will
-contain a PC fdisk label with a Solaris type 0x82 fdisk partition that
-starts at offset 512 and spans the whole CD.
-In addition, for the Solaris type 0x82 fdisk partition, there is a
-SVr4 disk label at offset 1024 in the first sector of the CD.
-This disk label specifies slice 0 for the first (usually UFS type)
-filesystem image that is used to boot the PC and slice 1 for
-the ISO9660 image.
-Slice 2 spans the whole CD slice 3 .\|.\|. slice 7 may be used for additional
-filesystem images that have been specified with this option.
-.sp
-A Solaris x86 boot CD uses a 1024 byte sized primary boot that uses the
-.B "El-Torito no-emulation 
-boot mode and a secondary generic boot that is in CD sectors 1\|.\|.15.
-For this reason, both
-.BI "-b " bootimage " -no\-emul\-boot
-and
-.BI \-G " genboot
-must be specified.
-.TP
-.BI \-sunx86\-label " label
-Set the SVr4 disk label name for the SVr4 disk label that is created with the
-.B \-sunx86-boot
-option.
-.TP
-.BI \-sysid " ID
-Specifies the system ID.
-There is space on the disc for 32 characters of information.
-This parameter can also be set in the file
-.B \&.m\&kisofsrc
-with SYSI=system_id.
-If specified in both places, the command line version is used.
-.TP
-.B \-T
-Generate a file TRANS.TBL in each directory on the CD-ROM, which can be used
-on non-Rock Ridge capable systems to help establish the correct file names.
-There is also information present in the file that indicates the major and
-minor numbers for block and character devices, and each symlink has the name of
-the link file given.
-.TP
-.BI \-table\-name " TABLE_NAME
-Alternative translation table file name (see above). Implies the
-.B \-T
-option.
-If you are creating a multi-session image you must use the same name
-as in the previous session.
-.TP
-.BI \-ucs\-level " level
-Set Unicode conformance level in the Joliet SVD. The default level is 3.
-It may be set to 1..3 using this option.
-.TP
-.B \-udf
-Include 
-.B UDF
-support in the generated filesystem image.
-.B UDF
-support is currently in alpha status and for this reason, it is not possible
-to create UDF only images. 
-.B UDF
-data structures are currently coupled to the Joliet structures, so there are many
-pitfalls with the current implementation. There is no UID/GID support,
-there is no POSIX permission support, there is no support for symlinks.
-Note that 
-.B UDF
-wastes the space from sector ~20 to sector 256 at the beginning of the disk
-in addition to the space needed for real 
-.B UDF 
-data structures.
-.TP
-.BI \-uid " uid
-Overrides the uid read from the source files to the value of
-.IR uid . 
-Specifying this option automatically enables Rock Ridge extensions.
-.TP
-.B \-use\-fileversion
-The option 
-.B \-use\-fileversion
-allows mkisoimage to use file version numbers from the filesystem.
-If the option is not specified, 
-.B mkisoimage
-creates a version number of 1 for all files.
-File versions are strings in the range 
-.I ";1"
-to
-.I ";32767"
-This option is the default on VMS. 
-.TP
-.B \-U
-Allows "Untranslated" filenames, completely violating the ISO9660 standards
-described above. Forces on the \-d, \-l, \-N, \-allow\-leading\-dots,
-\-relaxed\-filenames,
-\-allow\-lowercase, \-allow\-multidot and \-no\-iso\-translate
-flags. It allows more
-than one '.' character in the filename, as well as mixed case filenames.
-This is useful on HP-UX system, where the built-in CDFS filesystem does
-not recognize ANY extensions. Use with extreme caution.
-.TP
-.B \-no\-iso\-translate
-Do not translate the characters '#' and '~' which are invalid for ISO9660 filenames.
-These characters are though invalid often used by Microsoft systems.
-.br
-This violates the ISO9660 standard, but it happens to work on many systems.
-Use with caution.
-.TP
-.BI \-V " volid
-Specifies the volume ID (volume name or label) to be written into the
-master block. 
-There is space on the disc for 32 characters of information.
-This parameter can also be set in the file
-.B \&.m\&kisofsrc
-with VOLI=id.
-If specified in both places, the command line version is used.  Note that
-if you assign a volume ID, this is the name that will be used as the mount
-point used by the Solaris volume management system and the name that is
-assigned to the disc on a Microsoft Win32 or Apple Mac platform.
-.TP
-.BI \-volset " ID
-Specifies the volset ID.
-There is space on the disc for 128 characters of information.
-This parameter can also be set in the file
-.B \&.m\&kisofsrc
-with VOLS=volset_id.
-If specified in both places, the command line version is used.
-.TP
-.BI \-volset\-size " #
-Sets the volume set size to #.
-The volume set size is the number of CDs that are in a CD volume set.
-A volume set is a collection of one or more volumes, on which a set of
-files is recorded.
-.sp
-Volume Sets are not intended to be used to create a set numbered CDs
-that are part of e.g. a Operation System installation set of CDs.
-Volume Sets are rather used to record a big directory tree that would not
-fit on a single volume.
-Each volume of a Volume Set contains a description of all the directories
-and files that are recorded on the volumes where the sequence numbers
-are less than, or equal to, the assigned Volume Set Size of the current
-volume.
-.sp
-.B mkisoimage
-currently does not support a
-.B \-volset\-size
-that is larger than 1.
-.sp
-The option
-.B \-volset\-size
-must be specified before
-.B \-volset\-seqno
-on each command line.
-.TP
-.BI \-volset\-seqno " #
-Sets the volume set sequence number to #.
-The volume set sequence number is the index number of the current
-CD in a CD set.
-The option
-.B \-volset\-size
-must be specified before
-.B \-volset\-seqno
-on each command line.
-.TP
-.B \-v
-Verbose execution. If given twice on the command line, extra debug information
-will be printed.
-.TP
-.BI \-x " path
-Exclude
-.I path
-from being written to CD-ROM.
-.I path
-must be the complete pathname that results from concatenating the pathname
-given as command line argument and the path relative to this directory.
-Multiple paths may be excluded.
-Example: 
-
-mkisoimage \-o cd \-x /local/dir1 \-x /local/dir2 /local
-.sp
-NOTE: The
-.B \-m
-and
-.B \-x
-option description should both be updated, they are wrong.
-Both now work identical and use filename globbing. A file is excluded if either
-the last component matches or the whole path matches.
-.TP
-.B \-z
-Generate special RRIP records for transparently compressed files.
-This is only of use and interest for hosts that support transparent
-decompression, such as Linux 2.4.14 or later.  You must specify the
-.B \-R
-or
-.B \-r
-options to enable Rock Ridge, and generate compressed files using the
-.B mkzftree
-utility before running
-.BR mkisoimage .
-Note that transparent compression is a nonstandard Rock Ridge extension.
-The resulting disks are only transparently readable if used on Linux.
-On other operating systems you will need to call
-.B mkzftree
-by hand to decompress the files.
-
-.SH "HFS OPTIONS
-.TP
-.B \-hfs
-Create an ISO9660/HFS hybrid CD. This option should be used in conjunction
-with the
-.BR \-map ,
-.B \-magic
-and/or the various
-.I double dash
-options given below.
-.TP
-.B \-apple
-Create an ISO9660 CD with Apple's extensions. Similar to the
-.B \-hfs
-option, except that the Apple Extensions to ISO9660 are added instead of
-creating an HFS hybrid volume.
-Former 
-.B mkisoimage
-versions did include Rock Ridge attributes by default if 
-.B \-apple
-was specified. This versions of
-.B mkisoimage
-does not do this anymore. If you like to have Rock Ridge attributes,
-you need to specify this separately.
-.TP
-.BI \-map " mapping_file
-Use the
-.I mapping_file
-to set the CREATOR and TYPE information for a file based on the
-filename's extension. A filename is 
-mapped only if it is not one of the know Apple/Unix file formats. See the
-.B "HFS CREATOR/TYPE
-section below.
-.TP
-.BI \-magic " magic_file
-The CREATOR and TYPE information is set by using a file's
-.I magic number
-(usually the first few bytes of a file). The
-.I magic_file
-is only used if a file is not one of the known Apple/Unix file formats, or
-the filename extension has not been mapped using the
-.B \-map
-option. See the 
-.B "HFS CREATOR/TYPE
-section below for more details.
-.TP
-.BI \-hfs\-creator " CREATOR
-Set the default CREATOR for all files. Must be exactly 4 characters. See the
-.B "HFS CREATOR/TYPE
-section below for more details.
-.TP
-.BI \-hfs\-type " TYPE
-Set the default TYPE for all files. Must be exactly 4 characters. See the
-.B "HFS CREATOR/TYPE
-section below for more details.
-.TP
-.B \-probe
-Search the contents of files for all the known Apple/Unix file formats.
-See the
-.B HFS MACINTOSH FILE FORMATS
-section below for more about these formats.
-However, the only way to check for
-.I MacBinary
-and
-.I AppleSingle
-files is to open and read them. Therefore this option
-.I may
-increase processing time. It is better to use one or more
-.I double dash
-options given below if the Apple/Unix formats in use are known.
-.TP
-.B \-no\-desktop
-Do not create (empty) Desktop files. New HFS Desktop files will be created
-when the CD is used on a Macintosh (and stored in the System Folder).
-By default, empty Desktop files are added to the HFS volume.
-.TP
-.B \-mac\-name
-Use the HFS filename as the starting point for the ISO9660, Joliet and
-Rock Ridge file names. See the
-.B HFS MACINTOSH FILE NAMES
-section below for more information.
-.TP
-.BI \-boot\-hfs\-file " driver_file
-Installs the
-.I driver_file
-that
-.I may
-make the CD bootable on a Macintosh. See the
-.B HFS BOOT DRIVER
-section below. (Alpha).
-.TP
-.B \-part
-Generate an HFS partition table. By default, no partition table is generated,
-but some older Macintosh CD-ROM drivers need an HFS partition table on the
-CD-ROM to be able to recognize a hybrid CD-ROM.
-.TP
-.BI \-auto " AutoStart_file
-Make the HFS CD use the QuickTime 2.0 Autostart feature to launch an
-application or document. The given filename must be the name of a document or
-application located at the top level of the CD. The filename must be less
-than 12 characters. (Alpha).
-.TP
-.BI \-cluster\-size " size
-Set the size in bytes of the cluster or allocation units of PC Exchange
-files. Implies the
-.B \-\-exchange
-option. See the
-.B HFS MACINTOSH FILE FORMATS
-section below.
-.TP
-.BI \-hide\-hfs " glob
-Hide
-.I glob
-from the HFS volume. The file or directory will still exist in the
-ISO9660 and/or Joliet directory.
-.I glob
-is a shell wild-card-style pattern that must match any part of the filename
-Multiple globs may be excluded.
-Example:
-
-mkisoimage \-o rom \-hfs \-hide\-hfs '*.o' \-hide\-hfs foobar
-
-would exclude all files ending in ".o" or called "foobar" 
-from the HFS volume. Note that if you had a directory called
-"foobar" it too (and of course all its descendants) would be excluded.
-The
-.I glob
-can also be a path name relative to the source directories given on the
-command line. Example:
-
-mkisoimage \-o rom \-hfs \-hide\-hfs src/html src
-
-would exclude just the file or directory called "html" from the "src"
-directory. Any other file or directory called "html" in the tree will
-not be excluded.
-Should be used with the
-.B \-hide
-and/or
-.B \-hide\-joliet
-options.
-In order to match a directory name, make sure the pathname does not include
-a trailing '/' character. See README.hide for more details.
-.TP
-.BI \-hide\-hfs\-list " file
-A file containing a list of
-.I globs
-to be hidden as above.
-.TP
-.BI \-hfs\-volid " hfs_volid
-Volume name for the HFS partition. This is the name that is
-assigned to the disc on a Macintosh and replaces the
-.I volid
-used with the 
-.B \-V
-option
-.TP
-.B \-icon\-position
-Use the icon position information, if it exists, from the Apple/Unix file.
-The icons will appear in the same position as they would on a Macintosh
-desktop. Folder location and size on screen, its scroll positions, folder
-View (view as Icons, Small Icons, etc.) are also preserved.
-This option may become set by default in the future.
-(Alpha).
-.TP
-.BI \-root\-info " file
-Set the location, size on screen, scroll positions, folder View etc. for the
-root folder of an HFS volume. See README.rootinfo for more information.
-(Alpha)
-.TP
-.BI \-prep\-boot " FILE
-PReP boot image file. Up to 4 are allowed. See README.prep_boot (Alpha)
-.TP
-.BI \-input\-hfs\-charset " charset
-Input charset that defines the characters used in HFS file names when
-used with the
-.I \-mac\-name
-option.
-The default charset is cp10000 (Mac Roman)
-.I cp10000
-(Mac Roman)
-See
-.B "CHARACTER SETS
-and
-.B "HFS MACINTOSH FILE NAMES
-sections below for more details.
-.TP
-.BI \-output\-hfs\-charset " charset
-Output charset that defines the characters that will be used in the HFS
-file names. Defaults to the input charset. See
-.B "CHARACTER SETS
-section below for more details.
-.TP
-.B \-hfs\-unlock
-By default,
-.B mkisoimage
-will create an HFS volume that is
-.IR locked .
-This option leaves the volume unlocked so that other applications (e.g.
-hfsutils) can modify the volume. See the
-.B "HFS PROBLEMS/LIMITATIONS
-section below for warnings about using this option.
-.TP
-.BI \-hfs\-bless " folder_name
-"Bless" the given directory (folder). This is usually the 
-.B System Folder
-and is used in creating HFS bootable CDs. The name of the directory must
-be the whole path name as
-.B mkisoimage
-sees it. e.g. if the given pathspec is ./cddata and the required folder is
-called System Folder, then the whole path name is "./cddata/System Folder"
-(remember to use quotes if the name contains spaces).
-.TP
-.BI \-hfs\-parms " PARAMETERS
-Override certain parameters used to create the HFS file system. Unlikely to
-be used in normal circumstances. See the libhfs_iso/hybrid.h source file for
-details.
-.TP
-.B \-\-cap
-Look for AUFS CAP Macintosh files. Search for CAP Apple/Unix file formats
-only. Searching for the other possible Apple/Unix file formats is disabled,
-unless other
-.I double dash
-options are given.
-.TP
-.B \-\-netatalk
-Look for NETATALK Macintosh files
-.TP
-.B \-\-double
-Look for AppleDouble Macintosh files
-.TP
-.B \-\-ethershare
-Look for Helios EtherShare Macintosh files
-.TP
-.B \-\-ushare
-Look for IPT UShare Macintosh files
-.TP
-.B \-\-exchange
-Look for PC Exchange Macintosh files
-.TP
-.B \-\-sgi
-Look for SGI Macintosh files
-.TP
-.B \-\-xinet
-Look for XINET Macintosh files
-.TP
-.B \-\-macbin
-Look for MacBinary Macintosh files
-.TP
-.B \-\-single
-Look for AppleSingle Macintosh files
-.TP
-.B \-\-dave
-Look for Thursby Software Systems DAVE Macintosh files
-.TP
-.B \-\-sfm
-Look for Microsoft's Services for Macintosh files (NT only) (Alpha)
-.TP
-.B \-\-osx\-double
-Look for MacOS X AppleDouble Macintosh files
-.TP
-.B \-\-osx\-hfs
-Look for MacOS X HFS Macintosh files
-
-.SH "CHARACTER SETS
-.B mkisoimage
-processes file names in a POSIX compliant way as strings of 8-bit characters.
-To represent all codings for all languages, 8-bit characters are not
-sufficient. Unicode or
-.B ISO-10646
-define character codings that need at least 21 bits to represent all
-known languages. They may be represented with
-.BR UTF-32 ", " UTF-16 " or " UTF-8
-coding.
-.B UTF-32
-uses a plain 32-bit coding but seems to be uncommon. 
-.B UTF-16
-is used by Microsoft with Win32 with the disadvantage that it only supports
-a subset of all codes and that 16-bit characters are not compliant with
-the POSIX filesystem interface.
-.PP
-Modern Unix operating systems may use
-.B UTF-8
-coding for filenames. This coding allows to use the complete Unicode code set.
-Each 32-bit character is represented by one or more 8-bit characters.
-If a character is coded in
-.B ISO-8859-1
-(used in Central Europe and North America) is maps 1:1 to a 
-.BR UTF-32 " or " UTF-16 "
-coded Unicode character.
-If a character is coded in
-.B "7-Bit ASCII
-(used in USA and other countries with limited character set)
-is maps 1:1 to a 
-.BR UTF-32 ", " UTF-16 " or " UTF-8
-coded Unicode character.
-Character codes that cannot be represented as a single byte in UTF-8
-(typically if the value is > 0x7F) use escape sequences that map to more than
-one 8-bit character.
-.PP
-If all operating systems would use 
-.B UTF-8
-coding,
-.B mkisoimage
-would not need to recode characters in file names.
-Unfortunately, Apple uses completely nonstandard codings and Microsoft
-uses a Unicode coding that is not compatible with the POSIX filename
-interface.
-.PP
-For all non
-.B UTF-8
-coded operating systems, the actual character
-that each byte represents depends on the
-.I character set
-or
-.I codepage
-(which is the name used by Microsoft)
-used by the local operating system in use - the characters in a character
-set will reflect the region or natural language used by the user.
-.PP
-Usually character codes 0x00-0x1f are control characters, codes 0x20-0x7f
-are the 7 bit ASCII characters and (on PC's and Mac's) 0x80-0xff are used
-for other characters.
-Unfortunately even this does not follow ISO standards that reserve the
-range 0x80-0x9f for control characters and only allow 0xa0-0xff for other
-characters.
-.PP
-As there is a lot more than 256 characters/symbols in use, only a small
-subset are represented in a character set. Therefore the same character code
-may represent a different character in different character sets. So a file name
-generated, say in central Europe, may not display the same character
-when viewed on a machine in, say eastern Europe.
-.PP
-To make matters more complicated, different operating systems use
-different character sets for the region or language. For example the character
-code for "small e with acute accent" may be character code 0x82 on a PC, 
-code 0x8e on a Macintosh and code 0xe9 on a Unix system.
-Note while the codings used on a PC or Mac are nonstandard,
-Unicode codes this character as 0x00000000e9 which is basically the
-same value as the value used by most Unix systems.
-.PP
-As long as not all operating systems and applications will use the Unicode
-character set as the basis for file names in a unique way, it may be
-necessary to specify which character set your file names use in and which
-character set the file names should appear on the CD.
-.PP
-There are four options to specify the character sets you want to use:
-.IP \-input\-charset
-Defines the local character set you are using on your host machine.
-Any character set conversions that take place will use this character
-set as the staring point. The default input character sets are
-.I cp437
-on DOS based systems and
-.I iso8859-1
-on all other systems.
-
-If the
-.I \-J
-option is given, then the Unicode equivalents of the input character set
-will be used in the Joliet directory. Using the 
-.I \-jcharset
-option is the same as using the
-.I \-input\-charset
-and
-.I \-J
-options.
-.IP \-output\-charset
-Defines the character set that will be used with for the Rock Ridge names
-on the CD. Defaults to the input character set. Only likely to be useful
-if used on a non-Unix platform. e.g. using
-.B mkisoimage
-on a Microsoft Win32 machine to create Rock Ridge CDs. If you are using
-.B mkisoimage
-on a Unix machine, it is likely that the output character set
-will be the same as the input character set.
-.IP \-input\-hfs\-charset
-Defines the HFS character set used for HFS file names decoded from
-any of the various Apple/Unix file formats. Only useful when used with
-.I \-mac\-name
-option. See the
-.B HFS MACINTOSH FILE NAMES
-for more information. Defaults to
-.I cp10000
-(Mac Roman).
-.IP \-output\-hfs\-charset
-Defines the HFS character set used to create HFS file names from the input
-character set in use. In most cases this will be from the character set
-given with the
-.I \-input\-charset
-option. Defaults to the input HFS character set.
-.PP
-There are a number of character sets built in to
-.IR mkisoimage .
-To get a listing, use
-.B "mkisoimage \-input\-charset help.
-This list doesn't include the charset derived from the current locale,
-if mkisoimage is built with iconv support.
-.PP
-Additional character sets can be read from file for any of the character
-set options by giving a filename as the argument to the options. The given
-file will only be read if its name does not match one of the built in
-character sets.
-.PP
-The format of the character set files is the same as the mapping files
-available from http://www.unicode.org/Public/MAPPINGS The format of these
-files is:
-
-	Column #1 is the input byte code (in hex as 0xXX)
-.br
-	Column #2 is the Unicode (in hex as 0xXXXX)
-.br
-	Rest of the line is ignored.
-
-Any blank line, line without two (or more) columns in the above format
-or comments lines (starting with the # character) are ignored without any
-warnings. Any missing input code is mapped to Unicode character 0x0000.
-.PP
-Note that there is no support for 16 bit UNICODE (UTF-16) or 32 bit UNICODE
-(UTF-32) coding because this coding is not POSIX compliant. There should 
-be support for UTF-8 UNICODE coding which is compatible to POSIX filenames
-and supported by moder Unix implementations such as Solaris.
-.PP
-A 1:1 character set mapping can be defined by using the keyword
-.I default
-as the argument to any of the character set options. This is the behaviour
-of older (v1.12) versions of
-.BR mkisoimage .
-.PP
-The ISO9660 file names generated from the input filenames are not converted
-from the input character set. The ISO9660 character set is a very limited
-subset of the ASCII characters, so any conversion would be pointless.
-.PP
-Any character that
-.B mkisoimage
-can not convert will be replaced with a '_' character.
-.PP
-.SH "HFS CREATOR/TYPE
-A Macintosh file has two properties associated with it which define
-which application created the file, the
-.I CREATOR
-and what data the file contains, the
-.IR TYPE .
-Both are (exactly) 4 letter strings. Usually this
-allows a Macintosh user to double-click on a file and launch the correct
-application etc. The CREATOR and TYPE of a particular file can be found by
-using something like ResEdit (or similar) on a Macintosh.
-.LP
-The CREATOR and TYPE information is stored in all the various Apple/Unix
-encoded files.
-For other files it is possible to base the CREATOR and TYPE on the
-filename's extension using a
-.I mapping
-file (the
-.B \-map
-option) and/or using the
-.I magic number
-(usually a
-.I signature
-in the first few bytes)
-of a file (the
-.B \-magic
-option). If both these options are given, then their order on the command
-line is important. If the
-.B \-map
-option is given first, then a filename extension match is attempted
-before a magic number match. However, if the
-.B \-magic
-option is given first, then a magic number match is attempted before a
-filename extension match.
-.PP
-If a mapping or magic file is not used, or no match is found then the default
-CREATOR and TYPE for all regular files can be set by using entries in the 
-.B \&.m\&kisofsrc
-file or using the 
-.B \-hfs\-creator
-and/or
-.B \-hfs\-type
-options, otherwise the default CREATOR and TYPE are 'Unix' and 'TEXT'.
-.PP
-The format of the
-.I mapping
-file is the same
-.I afpfile
-format as used by
-.IR aufs .
-This file has five columns for the
-.IR extension ,
-.I file
-.IR translation ,
-.IR CREATOR ,
-.I TYPE
-and
-.IR Comment .
-Lines starting with the '#' character are
-comment lines and are ignored. An example file would be like:
-.LP
-.TS
-tab (/);
-l s s s s
-l s s s s
-l l l l l .
-# Example filename mapping file
-#
-# EXTN/XLate/CREATOR/TYPE/Comment
-\&.tif/Raw/'8BIM'/'TIFF'/"Photoshop TIFF image"
-\&.hqx/Ascii/'BnHq'/'TEXT'/"BinHex file"
-\&.doc/Raw/'MSWD'/'WDBN'/"Word file"
-\&.mov/Raw/'TVOD'/'MooV'/"QuickTime Movie"
-*/Ascii/'ttxt'/'TEXT'/"Text file"
-.TE
-.LP
-Where:
-.IP
-The first column
-.I EXTN
-defines the Unix filename extension to be
-mapped. The default mapping for any filename extension that doesn't
-match is defined with the "*" character.
-.IP
-The
-.I Xlate
-column defines the type of text translation between the Unix and
-Macintosh file it is ignored by
-.BR mkisoimage ,
-but is kept to be compatible with
-.BR aufs (1).
-Although 
-.B mkisoimage
-does not alter the contents of a file, if a binary file has it's TYPE
-set as 'TEXT', it
-.I may
-be read incorrectly on a Macintosh. Therefore a better choice for the
-default TYPE may be '????'
-.IP
-The
-.I CREATOR
-and
-.I TYPE
-keywords must be 4 characters long and enclosed in single quotes.
-.IP
-The comment field is enclosed in double quotes - it is ignored by
-.BR mkisoimage ,
-but is kept to be compatible with 
-.BR aufs .
-.PP
-The format of the
-.I magic
-file is almost identical to the
-.BR magic (5)
-file used by the Linux
-.BR file (1)
-command - the routines for reading and decoding the
-.I magic
-file are based on the Linux
-.BR file (1)
-command.
-.PP
-This file has four tab separated columns for the 
-.I byte
-.IR offset ,
-.IR type ,
-.I test
-and
-.IR message .
-Lines starting with the '#' character are
-comment lines and are ignored. An example file would be like:
-.LP
-.TS
-tab (/);
-l s s s
-l s s s
-l l l l .
-# Example magic file
-#
-# off/type/test/message
-0/string/GIF8/8BIM GIFf  GIF image
-0/beshort/0xffd8/8BIM JPEG  image data
-0/string/SIT!/SIT! SIT!  StuffIt Archive
-0/string/\\037\\235/LZIV ZIVU  standard Unix compress
-0/string/\\037\\213/GNUz ZIVU  gzip compressed data
-0/string/%!/ASPS TEXT  Postscript
-0/string/\\004%!/ASPS TEXT  PC Postscript with a ^D to start
-4/string/moov/txtt MooV  QuickTime movie file (moov)
-4/string/mdat/txtt MooV  QuickTime movie file (mdat)
-.TE
-.PP
-The format of the file is described in the
-.BR magic (4)
-man page. The only difference here is that for each entry in the magic file, the
-.I message
-for the initial offset
-.B must
-be 4 characters for the CREATOR followed by 4 characters for the TYPE -
-white space is
-optional between them. Any other characters on this line are ignored.
-Continuation lines (starting with a '>') are also ignored i.e. only the initial
-offset lines are used.
-.PP
-Using the
-.B \-magic
-option may significantly increase processing time as each file has to opened
-and read to find it's magic number.
-.PP
-In summary, for all files, the default CREATOR is 'Unix' and the default
-TYPE is 'TEXT'.  These can be changed by using entries in the 
-.I \&.m\&kisofsrc 
-file or by using the
-.B \-hfs\-creator
-and/or
-.B \-hfs\-type
-options. 
-.PP
-If the a file is in one of the known Apple/Unix formats (and the format
-has been selected), then the CREATOR and TYPE are taken from the values
-stored in the Apple/Unix file.
-.PP
-Other files can have their CREATOR and TYPE set from their file name
-extension (the
-.B \-map
-option), or their magic number (the
-.B \-magic
-option). If the default match is used in the
-.I mapping
-file, then these values override the default CREATOR and TYPE.
-.PP
-A full CREATOR/TYPE database can be found at 
-http://www.angelfire.com/il/szekely/index.html
-
-.SH "HFS MACINTOSH FILE FORMATS
-Macintosh files have two parts called the
-.I Data
-and
-.I Resource
-fork. Either may be empty. Unix (and many other OSs) can only
-cope with files having one part (or fork). To add to this, Macintosh files
-have a number of attributes associated with them - probably the most
-important are the TYPE and CREATOR. Again Unix has no concept of these
-types of attributes.
-.PP
-e.g. a Macintosh file may be a JPEG image where the image is stored in the
-Data fork and a desktop thumbnail stored in the Resource fork. It is usually
-the information in the data fork that is useful across platforms.
-.PP
-Therefore to store a Macintosh file on a Unix filesystem, a way has to be
-found to cope with the two forks and the extra attributes (which are
-referred to as the
-.I finder
-.IR info ).
-Unfortunately, it seems that every software package that stores Macintosh
-files on Unix has chosen a completely different storage method.
-.PP
-The Apple/Unix formats that
-.I mkisoimage
-(partially) supports are:
-.IP "CAP AUFS format"
-Data fork stored in a file. Resource fork in subdirectory .resource
-with same filename as data fork. Finder info
-in .finderinfo subdirectory with same filename.
-.IP "AppleDouble/Netatalk"
-Data fork stored in a file. Resource fork stored in a file with
-same name prefixed with "%". Finder info also stored in same
-"%" file. Netatalk uses the same format, but the resource
-fork/finderinfo stored in subdirectory .AppleDouble with same
-name as data fork.
-.IP AppleSingle
-Data structures similar to above, except both forks and finder
-info are stored in one file.
-.IP "Helios EtherShare"
-Data fork stored in a file. Resource fork and finder info together in
-subdirectory .rsrc with same filename as data fork.
-.IP "IPT UShare"
-Very similar to the EtherShare format, but the finder info
-is stored slightly differently.
-.IP MacBinary
-Both forks and finder info stored in one file.
-.IP "Apple PC Exchange"
-Used by Macintoshes to store Apple files on DOS (FAT) disks.
-Data fork stored in a file. Resource fork in subdirectory
-resource.frk (or RESOURCE.FRK). Finder info as one record
-in file finder.dat (or FINDER.DAT). Separate finder.dat for
-each data fork directory.
-.IP
-Note: 
-.I mkisoimage
-needs to know the native FAT cluster size of the disk that the PC Exchange
-files are on (or have been copied from). This size is given by the
-.B \-cluster\-size
-option.
-The cluster or allocation size can be found by using the DOS utility
-.BR CHKDSK .
-.IP
-May not work with PC Exchange v2.2 or higher files (available with MacOS 8.1).
-DOS media containing PC Exchange files should be mounted as type
-.B msdos
-(not
-.BR vfat )
-when using Linux.
-.IP "SGI/XINET"
-Used by SGI machines when they mount HFS disks. Data fork stored
-in a file. Resource fork in subdirectory .HSResource with same
-name. Finder info as one record in file .HSancillary. Separate .HSancillary
-for each data fork directory.
-.IP "Thursby Software Systems DAVE"
-Allows Macintoshes to store Apple files on SMB servers.
-Data fork stored in a file. Resource fork in subdirectory
-resource.frk. Uses the AppleDouble format to store resource fork.
-.IP "Services for Macintosh"
-Format of files stored by NT Servers on NTFS filesystems. Data fork is
-stored as "filename". Resource fork stored as a NTFS
-.I stream
-called "filename:AFP_Resource". The finder info is stored as a NTFS
-.I stream
-called "filename:Afp_AfpInfo". These streams are normally invisible to the
-user.
-.IP
-Warning: mkisoimage only partially supports the SFM format. If an HFS file
-or folder stored on the NT server contains an
-.I illegal
-NT character in its name, then NT converts these characters to
-.I Private Use Unicode
-characters. The characters are: " * / < > ? \ | also a space or
-period if it is the last character of the file name, character codes 0x01
-to 0x1f (control characters) and Apple' apple logo.
-.IP
-Unfortunately, these private Unicode characters are not
-readable by the mkisoimage NT executable. Therefore any file or directory
-name containing these characters will be ignored - including the contents of
-any such directory.
-.IP "MacOS X AppleDouble"
-When HFS/HFS+ files are copied or saved by MacOS X on to a non-HFS file
-system (e.g. UFS, NFS etc.), the files are stored in AppleDouble format.
-Data fork stored in a file. Resource fork stored in a file with
-same name prefixed with "._". Finder info also stored in same "._" file.
-.IP "MacOS X HFS (Alpha)"
-Not really an Apple/Unix encoding, but actual HFS/HFS+ files on a MacOS X
-system. Data fork stored in a file. Resource fork stored in a pseudo file
-with the same name with the suffix '/rsrc'. The finderinfo is only
-available via a MacOS X library call.
-.IP
-Notes: (also see README.macosx)
-.IP
-Only works when used on MacOS X.
-.IP
-If a file is found with a zero
-length resource fork and empty finderinfo, it is assumed not to have
-any Apple/Unix encoding - therefore a TYPE and CREATOR can be set using
-other methods.
-.LP
-.I mkisoimage
-will attempt to set the CREATOR, TYPE, date and possibly other flags from
-the finder info. Additionally, if it exists, the Macintosh filename is set
-from the finder info, otherwise the Macintosh name is based on the Unix
-filename - see the
-.B "HFS MACINTOSH FILE NAMES
-section below.
-.PP
-When using the
-.B \-apple
-option, the TYPE and CREATOR are stored in the optional System Use or SUSP field
-in the ISO9660 Directory Record - in much the same way as the Rock Ridge
-attributes are. In fact to make life easy, the Apple extensions are added
-at the beginning of the existing Rock Ridge attributes (i.e. to get the Apple
-extensions you get the Rock Ridge extensions as well).
-.PP
-The Apple extensions require the resource fork to be stored as an ISO9660
-.I associated
-file. This is just like any normal file stored in the ISO9660 filesystem
-except that the associated file flag is set in the Directory Record (bit
-2). This file has the same name as the data fork (the file seen by
-non-Apple machines). Associated files are normally ignored by other OSs
-.PP
-When using the
-.B \-hfs
-option, the TYPE and CREATOR plus other finder info, are stored in a separate
-HFS directory, not visible on the ISO9660 volume. The HFS directory references
-the same data and resource fork files described above.
-.PP
-In most cases, it is better to use the
-.B \-hfs
-option instead of the
-.B \-apple
-option, as the latter imposes the limited ISO9660 characters allowed in
-filenames. However, the Apple extensions do give the advantage that the
-files are packed on the disk more efficiently and it may be possible to fit 
-more files on a CD - important when the total size of the source files is
-approaching 650MB.
-
-.SH "HFS MACINTOSH FILE NAMES
-Where possible, the HFS filename that is stored with an Apple/Unix file
-is used for the HFS part of the CD. However, not all the Apple/Unix
-encodings store the HFS filename with the finderinfo. In these cases,
-the Unix filename is used - with escaped special characters. Special
-characters include '/' and characters with codes over 127.
-.PP
-AUFS escapes these characters by using ":" followed by the character code
-as two hex digits. Netatalk and EtherShare have a similar scheme, but uses
-"%" instead of a ":".
-.PP
-If mkisoimage can not find an HFS filename, it uses the Unix name, with
-any %xx or :xx characters (xx == two hex digits) converted to a single
-character code. If "xx" are not hex digits ([0-9a-fA-F]), then they are
-left alone - although any remaining ":" is converted to "%" as colon
-is the HFS directory separator. Care must be taken, as an ordinary Unix
-file with %xx or :xx will also be converted. e.g.
-.PP
-.TS
-l l 
-l s
-l l
-l s
-l l .
-This:2fFile	converted to This/File
-	
-This:File	converted to This%File
-	
-This:t7File	converted to This%t7File
-.TE
-.PP
-Although HFS filenames appear to support upper and lower case letters,
-the filesystem is case insensitive. i.e. the filenames "aBc" and "AbC"
-are the same. If a file is found in a directory with the same HFS name,
-then
-.I mkisoimage
-will attempt, where possible, to make a unique name by adding '_' characters
-to one of the filenames. 
-.PP
-If an HFS filename exists for a file, then mkisoimage can use this name as
-the starting point for the ISO9660, Joliet and Rock Ridge filenames using
-the
-.B \-mac\-name
-option. Normal Unix files without an HFS name will still use their Unix name.
-e.g.
-.PP
-If a
-.I MacBinary
-(or
-.I PC
-.IR Exchange )
-file is stored as 
-.I someimage.gif.bin
-on the Unix filesystem, but contains a HFS file called
-.IR someimage.gif ,
-then this is the name that would appear on the HFS part of the CD. However, as
-mkisoimage uses the Unix name as the starting point for the other names, then
-the ISO9660 name generated will probably be 
-.I SOMEIMAG.BIN
-and the Joliet/Rock Ridge would be
-.IR someimage.gif.bin .
-Although the actual data (in this case) is a GIF image. This option will use
-the HFS filename as the starting point and the ISO9660 name will probably be
-.I SOMEIMAG.GIF
-and the Joliet/Rock Ridge would be
-.IR someimage.gif .
-.PP
-Using the
-.B \-mac\-name
-option will not currently work with the
-.B \-T
-option - the Unix
-name will be used in the TRANS.TBL file, not the Macintosh name.
-.PP
-The character set used to convert any HFS file name to a Joliet/Rock Ridge
-file name defaults to
-.I cp10000
-(Mac Roman).
-The character set used can be specified using the
-.I \-input\-hfs\-charset
-option. Other built in HFS character sets are: cp10006 (MacGreek),
-cp10007 (MacCyrillic), cp10029 (MacLatin2), cp10079 (MacIcelandandic) and
-cp10081 (MacTurkish).
-.PP
-Note: the character codes used by HFS file names taken from the various
-Apple/Unix formats will not be converted as they are assumed to be in the
-correct Apple character set. Only the Joliet/Rock Ridge names derived from
-the HFS file names will be converted.
-.PP
-The existing mkisoimage code will filter out any illegal characters for the
-ISO9660 and Joliet filenames, but as mkisoimage expects to be dealing
-directly with Unix names, it leaves the Rock Ridge names as is.
-But as '/' is a legal HFS filename character, the
-.B \-mac\-name
-option converts '/' to a '_' in Rock Ridge filenames.
-.PP
-If the Apple extensions are used, then only the ISO9660 filenames will
-appear on the Macintosh. However, as the Macintosh ISO9660 drivers can use
-.I Level 2
-filenames, then you can use options like
-.B \-allow\-multidot
-without problems on
-a Macintosh - still take care over the names, for example
-.I this.file.name
-will be converted to
-.I THIS.FILE
-i.e. only have one '.', also filename
-.I abcdefgh
-will be seen as
-.I ABCDEFGH
-but
-.I abcdefghi
-will be seen as
-.I ABCDEFGHI.
-i.e. with a '.' at the end - don't know if this is a Macintosh
-problem or m\&kisofs/mkhybrid problem. All filenames will be in upper case
-when viewed on a Macintosh. Of course, DOS/Win3.X machines will not be able
-to see Level 2 filenames...
-
-.SH "HFS CUSTOM VOLUME/FOLDER ICONS
-To give a HFS CD a custom icon, make sure the root (top level) folder includes
-a standard Macintosh volume icon file. To give a volume a custom icon on
-a Macintosh, an icon has to be pasted over the volume's icon in the "Get Info"
-box of the volume. This creates an invisible file called 'Icon\\r' ('\\r' is
-the 'carriage return' character) in the root folder.
-.P
-A custom folder icon is very similar - an invisible file called 'Icon\\r'
-exits in the folder itself.
-.P
-Probably the easiest way to create a custom icon that mkisoimage can use, is to
-format a blank HFS floppy disk on a Mac, paste an icon to its "Get Info"
-box. If using Linux with the HFS module installed, mount the floppy using
-something like:
-
-	mount \-t hfs /dev/fd0 /mnt/floppy
-
-The floppy will be mounted as a CAP file system by default. Then run mkisoimage
-using something like:
-
-	mkisoimage \-\-cap \-o output source_dir /mnt/floppy
-
-If you are not using Linux, then you can use the hfsutils to copy the icon
-file from the floppy. However, care has to be taken, as the icon file
-contains a control character. e.g.
-
-	hmount /dev/fd0
-.br
-	hdir \-a
-.br
-	hcopy \-m Icon^V^M icon_dir/icon
-
-Where '^V^M' is control\-V followed by control\-M. Then run 
-.B mkisoimage
-by using something like:
-
-	mkisoimage \-\-macbin \-o output source_dir icon_dir
-.PP
-The procedure for creating/using custom folder icons is very similar - paste
-an icon to folder's "Get Info" box and transfer the resulting 'Icon\\r'
-file to the relevant directory in the mkisoimage source tree.
-.PP
-You may want to hide the icon files from the ISO9660 and Joliet trees.
-.PP
-To give a custom icon to a Joliet CD, follow the instructions found at:
-http://www.fadden.com/cdrfaq/faq03.html#[3-21]
-
-.SH "HFS BOOT DRIVER
-It 
-.I may
-be possible to make the hybrid CD bootable on a Macintosh.
-.PP
-A bootable HFS CD requires an Apple CD-ROM (or compatible) driver, a bootable
-HFS partition and the necessary System, Finder, etc. files.
-.PP
-A driver can be obtained from any other Macintosh bootable CD-ROM using the
-.I apple_driver
-utility. This file can then be used with the
-.B \-boot\-hfs\-file
-option.
-.PP
-The HFS partition (i.e. the hybrid disk in our case) must contain a
-suitable System Folder, again from another CD-ROM or disk.
-.PP
-For a partition to be bootable, it must have it's 
-.I boot block
-set. The boot
-block is in the first two blocks of a partition. For a non-bootable partition
-the boot block is full of zeros. Normally, when a System file is copied to
-partition on a Macintosh disk, the boot block is filled with a number of
-required settings - unfortunately I don't know the full spec for the boot
-block, so I'm guessing that the following will work OK.
-.PP
-Therefore, the utility
-.I apple_driver
-also extracts the boot block from the
-first HFS partition it finds on the given CD-ROM and this is used for the
-HFS partition created by
-.BR mkisoimage .
-.IP "PLEASE NOTE"
-By using a driver from an Apple CD and copying Apple software to your CD,
-you become liable to obey Apple Computer, Inc. Software License Agreements.
-.SH "EL TORITO BOOT INFORMATION TABLE
-When the
-.B \-boot\-info\-table
-option is given,
-.B mkisoimage
-will modify the boot file specified by the
-.B \-b
-option by inserting a 56-byte "boot information table" at offset 8 in
-the file.  This modification is done in the source filesystem, so make
-sure you use a copy if this file is not easily recreated!  This file
-contains pointers which may not be easily or reliably obtained at boot
-time.
-.PP
-The format of this table is as follows; all integers are in
-section 7.3.1 ("little endian") format.
-.sp
-.RS +.2i
-.ta 1.0i 2.5i 3.5i
-.nf
-Offset	Name	Size	Meaning
- 8	bi_pvd	4 bytes	LBA of primary volume descriptor
-12	bi_file	4 bytes	LBA of boot file
-16	bi_length	4 bytes	Boot file length in bytes
-20	bi_csum	4 bytes	32-bit checksum
-24	bi_reserved	40 bytes	Reserved
-.fi
-.RE
-.sp
-The 32-bit checksum is the sum of all the 32-bit words in the boot
-file starting at byte offset 64.  All linear block addresses (LBAs)
-are given in CD sectors (normally 2048 bytes).
-.SH "HPPA NOTES"
-To make a bootable CD for HPPA, at the very least a boot loader file (
-.B \-hppa\-bootloader
-), a kernel image file (32- or 64-bit or both, depending on hardware)
-and a boot command line (
-.B \-hppa\-cmdline
-) must be specified. Some systems can boot either a 32- or a 64-bit
-kernel, and the choice of which one to use will be made by the
-firmware. Optionally, a ramdisk can be used for the root filesystem
-using
-.B \-hppa\-cmdline.
-.SH "JIGDO NOTES"
-Jigdo is a useful tool to help in the distribution of large files like CD and
-DVD images. See Richard Atterer's site for more details. Debian CDs and DVD ISO
-images are published on the web in jigdo format to allow end users to download
-them more efficiently.
-.PP
-To create jigdo and template files alongside the ISO image from
-mkisoimage, you must first generate a list of the files that will be
-used, in the following format:
-.sp
-.RS +.2i
-.ta 2.0i 2.0i 5.0i
-.nf
-MD5sum   File size  Path
-32 chars 12 chars   to end of line
-.fi
-.RE
-.sp
-The MD5sum should be written in jigdo's pseudo-base64 format. The file
-size should be in decimal, and the path to the file must be absolute.
-.PP
-Once you have this file, call mkisoimage with all of your normal command
-line parameters. Specify the output filenames for the jigdo and
-template files using \-jigdo\-jigdo and \-jigdo\-template, and pass in
-the location of your MD5 list with the \-md5\-list option.
-.PP
-If there are files that you do NOT want to be added into the jigdo
-file (e.g. if they are likely to change often), specify them using
-\-jigdo\-ignore. If you want to verify some of the files as they are
-written into the image, specify them using \-jigdo\-force\-md5. If any
-files don't match, mkisoimage will then abort. Both of these options take
-regular expressions as input. It is possible to restrict the set of
-files that will be used further based on size - use the
-\-jigdo\-min\-file\-size option.
-.PP
-Finally, the jigdo code needs to know how to map the files it is given
-onto a mirror-style configuration. Specify how to map paths using the
-\-jigdo\-map option. Using "Debian=/mirror/debian" will cause all
-paths starting with "/mirror/debian" to be mapped to "Debian:<file>"
-in the output jigdo file.
-.SH CONFIGURATION
-.B mkisoimage
-looks for the
-.B \&.m\&kisofsrc
-file,
-first in the current working directory,
-then in the user's home directory,
-and then in the directory in which the
-.B mkisoimage
-binary is stored.  This file is assumed to contain a series of lines
-of the form
-.BI TAG= value
-, and in this way you can specify certain options.
-The case of the tag is not significant.
-Some fields in the volume header
-are not settable on the command line, but can be altered through this
-facility.
-Comments may be placed in this file,
-using lines which start with a hash (#) character.
-.TP
-.B APPI
-The application identifier
-should describe the application that will be on the disc.
-There is space on the disc for 128 characters of information.
-May be overridden using the
-.B \-A
-command line option.
-.TP
-.B COPY
-The copyright information,
-often the name of a file on the disc containing the copyright notice.
-There is space in the disc for 37 characters of information.
-May be overridden using the
-.B \-copyright
-command line option.
-.TP
-.B ABST
-The abstract information,
-often the name of a file on the disc containing an abstract.
-There is space in the disc for 37 characters of information.
-May be overridden using the
-.B \-abstract
-command line option.
-.TP
-.B BIBL
-The bibliographic information,
-often the name of a file on the disc containing a bibliography.
-There is space in the disc for 37 characters of information.
-May be overridden using the
-.B \-bilio
-command line option.
-.TP
-.B PREP
-This should describe the preparer of the CD-ROM,
-usually with a mailing address and phone number.
-There is space on the disc for 128 characters of information.
-May be overridden using the
-.B \-p
-command line option.
-.TP
-.B PUBL
-This should describe the publisher of the CD-ROM,
-usually with a mailing address and phone number.
-There is space on the disc for 128 characters of information.
-May be overridden using the
-.B \-publisher
-command line option.
-.TP
-.B SYSI
-The System Identifier.
-There is space on the disc for 32 characters of information.
-May be overridden using the
-.B \-sysid
-command line option.
-.TP
-.B VOLI
-The Volume Identifier.
-There is space on the disc for 32 characters of information.
-May be overridden using the
-.B \-V
-command line option.
-.TP
-.B VOLS
-The Volume Set Name.
-There is space on the disc for 128 characters of information.
-May be overridden using the
-.B \-volset
-command line option.
-.TP
-.B HFS_TYPE
-The default TYPE for Macintosh files. Must be exactly 4 characters.
-May be overridden using the
-.B \-hfs\-type
-command line option.
-.TP
-.B HFS_CREATOR
-The default CREATOR for Macintosh files. Must be exactly 4 characters.
-May be overridden using the
-.B \-hfs\-creator
-command line option.
-.PP
-.B mkisoimage
-can also be configured at compile time with defaults for many of these fields.
-See the file defaults.h.
-
-.SH EXAMPLES
-.PP
-To create a vanilla ISO9660 filesystem image in the file 
-.IR cd.iso ,
-where the directory
-.I cd_dir
-will become the root directory if the CD, call:
-.PP
-% mkisoimage \-o cd.iso cd_dir
-.PP
-To create a CD with Rock Ridge extensions of
-the source directory
-.IR cd_dir :
-.PP
-% mkisoimage \-o cd.iso \-R cd_dir
-.PP
-To create a CD with Rock Ridge extensions of
-the source directory
-.I cd_dir
-where all files have at least read permission and all files
-are owned by
-.IR root ,
-call:
-.PP
-% mkisoimage \-o cd.iso \-r cd_dir
-.PP
-To write a tar archive directly to a CD that will later contain a simple
-ISO9660 filesystem with the tar archive call:
-.PP
-% star \-c . | mkisoimage \-stream\-media\-size 333000 | \\
-.br
-wodim dev=b,t,l \-dao tsize=333000s \-
-.PP
-To create a HFS hybrid CD with the Joliet and Rock Ridge extensions of
-the source directory
-.IR cd_dir :
-.PP
-% mkisoimage \-o cd.iso \-R \-J \-hfs cd_dir
-.PP
-To create a HFS hybrid CD from the source directory 
-.I cd_dir
-that contains
-Netatalk Apple/Unix files:
-.PP
-% mkisoimage \-o cd.iso \-\-netatalk cd_dir
-.PP
-To create a HFS hybrid CD from the source directory
-.IR cd_dir ,
-giving all files
-CREATOR and TYPES based on just their filename extensions listed in the file 
-"mapping".:
-.PP
-% mkisoimage \-o cd.iso \-map mapping cd_dir
-.PP
-To create a CD with the 'Apple Extensions to ISO9660', from the source
-directories
-.I cd_dir
-and
-.IR another_dir.
-Files in all the known Apple/Unix format
-are decoded and any other files are given CREATOR and TYPE based on their
-magic number given in the file "magic":
-.PP
-% mkisoimage \-o cd.iso \-apple \-magic magic \-probe \\
-.br
-        cd_dir another_dir
-.PP
-The following example puts different files on the CD that all have
-the name README, but have different contents when seen as a
-ISO9660/Rock Ridge, Joliet or HFS CD.
-.PP
-Current directory contains:
-.PP
-% ls \-F
-.br
-README.hfs     README.joliet  README.Unix    cd_dir/
-.PP
-The following command puts the contents of the directory
-.I cd_dir
-on the
-CD along with the three README files - but only one will be seen from
-each of the three filesystems:
-.PP
-% mkisoimage \-o cd.iso \-hfs \-J \-r \-graft\-points \\
-.br
-        \-hide README.hfs \-hide README.joliet \\
-.br
-        \-hide\-joliet README.hfs \-hide\-joliet README.Unix \\
-.br
-        \-hide\-hfs README.joliet \-hide\-hfs README.Unix \\
-.br
-        README=README.hfs README=README.joliet \\
-.br
-        README=README.Unix cd_dir
-.PP
-i.e. the file README.hfs will be seen as README on the HFS CD and the
-other two README files will be hidden. Similarly for the Joliet and
-ISO9660/Rock Ridge CD.
-.PP
-There are probably all sorts of strange results possible with
-combinations of the hide options ...
-
-.SH AUTHOR
-.PP
-.br
-Eric Youngdale <ericy at gnu.ai.mit.edu> or <eric at andante.org> wrote the
-first versions (1993 .\|.\|. 1998) of the m\&kisofs utility.
-The copyright for old versions of the m\&kisofs utility is held by
-Yggdrasil Computing, Incorporated.
-.PP
-Major additional parts were written or contributed by the following authors. Also
-see the MAINTAINER section below for recent information.
-.PP
-J\*org Schilling 
-wrote the SCSI transport library and its adaptation layer to
-.B mkisoimage
-and newer parts (starting from 1999) of the utility, this makes
-.B mkisoimage
-.br
-Copyright (C) 1999, 2000, 2001 J\*org Schilling.
-.PP
-HFS hybrid code, Copyright (C) James Pearson 1997, 1998, 1999, 2000, 2001
-.PP
-libhfs code, Copyright (C) 1996, 1997 Robert Leslie
-.PP
-libunls code, Copyright (C) James Pearson 2000, (C) Joerg Schilling 2001-2006, (C) Jungshik Shin 2002
-.PP
-iconv code, Copyright (C) 2003 Jungshik Shin, (C) 2003 Jaakko Heinonen
-.PP
-See MAINTAINER section for contact information.
-.SH NOTES
-.PP
-.B mkisoimage
-is not based on the standard mk*fs tools for Unix, because we must generate
-a complete copy of an existing filesystem on a disk in the ISO9660
-filesystem.  The name mkisoimage is probably a bit of a misnomer, since it
-not only creates the filesystem, but it also populates it.
-However, the appropriate tool name for a Unix tool that creates populated
-filesystems - mkproto - is not well known.
-.PP
-.B mkisoimage
-may safely be installed suid root. This may be needed to allow
-.B mkisoimage
-to read the previous session when creating a multi session image.
-.PP
-If 
-.B mkisoimage 
-is creating a filesystem image with Rock Ridge attributes and the
-directory nesting level of the source directory tree is too much
-for ISO9660, 
-.B mkisoimage 
-will do deep directory relocation.
-This results in a directory called
-.B RR_MOVED
-in the root directory of the CD. You cannot avoid this directory.
-.PP
-The sparc boot support that is implemented with the
-.B \-sparc\-boot
-options completely follows the official Sparc CD boot requirements from
-the Boot prom in Sun Sparc systems. Some Linux distributions for Sparc
-systems use a boot loader called
-.B SILO
-that unfortunately is not Sparc CD boot compliant.
-It is annoyingly to see that the Authors of SILO don't fix SILO but instead
-provide a completely unneeded "patch" to mkisoimage that incorporates far
-more source than the fix for SILO would need.
-.SH BUGS
-.TP
-\(bu
-Any files that have hard links to files not in the tree being copied to the
-ISO9660 filesystem will have an incorrect file reference count.
-.TP
-\(bu
-Does not check for SUSP record(s) in "." entry of the
-root directory to verify the existence of Rock Ridge
-enhancements.
-.sp
-This problem is present when reading old sessions while
-adding data in multi-session mode.
-.TP
-\(bu
-Does not properly read relocated directories in multi-session
-mode when adding data.
-.sp
-Any relocated deep directory is lost if the new session does not
-include the deep directory.
-.sp
-Repeat by: create first session with deep directory relocation
-then add new session with a single dir that differs from the
-old deep path.
-.TP
-\(bu
-Does not re-use RR_MOVED when doing multi-session from TRANS.TBL
-.TP
-\(bu
-Does not create whole_name entry for RR_MOVED in multi-session
-mode.
-.PP
-There may be some other ones.  Please, report them to the author.
-
-.SH "HFS PROBLEMS/LIMITATIONS
-I have had to make several assumptions on how I expect the modified
-libhfs routines to work, however there may be situations that either
-I haven't thought of, or come across when these assumptions fail.
-Therefore I can't guarantee that mkisoimage will work as expected
-(although I haven't had a major problem yet). Most of the HFS features work
-fine, however, some are not fully tested. These are marked as
-.I Alpha
-above.
-.PP
-Although HFS filenames appear to support upper and lower case letters,
-the filesystem is case insensitive. i.e. the filenames "aBc" and "AbC"
-are the same. If a file is found in a directory with the same HFS name, then
-.I mkisoimage
-will attempt, where possible, to make a unique name by adding '_' characters
-to one of the filenames.
-.PP
-HFS file/directory names that share the first 31 characters have
-_N' (N == decimal number) substituted for the last few characters
-to generate unique names.
-.PP
-Care must be taken when "grafting" Apple/Unix files or directories (see
-above for the method and syntax involved). It is not possible to use a
-new name for an Apple/Unix encoded file/directory. e.g. If a Apple/Unix
-encoded file called "oldname" is to added to the CD, then you can not use
-the command line:
-.IP
-mkisoimage \-o output.raw \-hfs \-graft\-points newname=oldname cd_dir
-.LP
-mkisoimage will be unable to decode "oldname". However, you can graft
-Apple/Unix encoded files or directories as long as you do not attempt to
-give them new names as above.
-.PP
-When creating an HFS volume with the multisession options,
-.B \-M
-and
-.BR \-C ,
-only files in the last session will be in the HFS volume. i.e. mkisoimage can
-not
-.I add
-existing files from previous sessions to the HFS volume.
-.PP
-However, if each session is created with the
-.B \-part
-option, then each session will appear as 
-separate volumes when mounted on a Mac. In this case, it is worth using the 
-.B \-V
-or
-.B \-hfs\-volid
-option to give each session a unique volume name,
-otherwise each "volume" will appear on the Desktop with the same name.
-.PP
-Symbolic links (as with all other non-regular files) are not added to
-the HFS directory.
-.PP
-Hybrid volumes may be larger than pure ISO9660 volumes
-containing the same data. In some cases (e.g. DVD sized volumes) the hybrid
-volume may be significantly larger. As an HFS volume gets bigger, so does the
-allocation block size (the smallest amount of space a file can occupy).
-For a 650Mb CD, the allocation block is 10Kb, for a 4.7Gb DVD it will be
-about 70Kb.
-.PP
-The maximum number of files in an HFS volume is about 65500 - although
-the real limit will be somewhat less than this.
-.PP
-The resulting hybrid volume can be accessed on a Unix machine by using
-the hfsutils routines. However, no changes can be made to the volume as it
-is set as
-.B locked.
-The option
-.B \-hfs\-unlock
-will create an output image that is unlocked - however no changes should be
-made to the contents of the volume (unless you really know what you are
-doing) as it's not a "real" HFS volume.
-.PP
-Using the
-.B \-mac\-name
-option will not currently work with the
-.B \-T
-option - the Unix
-name will be used in the TRANS.TBL file, not the Macintosh name.
-.PP
-Although 
-.B mkisoimage
-does not alter the contents of a file, if a binary file has it's TYPE
-set as 'TEXT', it
-.I may
-be read incorrectly on a Macintosh. Therefore a better choice for the
-default TYPE may be '????'
-.PP
-The
-.B \-mac\-boot\-file
-option may not work at all...
-.PP
-May not work with PC Exchange v2.2 or higher files (available with MacOS 8.1).
-DOS media containing PC Exchange files should be mounted as type
-.B msdos
-(not
-.BR vfat )
-when using Linux.
-.PP
-The SFM format is only partially supported - see
-.B HFS MACINTOSH FILE FORMATS
-section above.
-.PP
-It is not possible to use the the
-.B \-sparc\-boot
-or
-.B \-generic\-boot
-options with the 
-.B \-boot\-hfs\-file
-or
-.B \-prep\-boot
-options.
-.PP
-.B mkisoimage
-should be able to create HFS hybrid images over 4Gb, although this has not
-been fully tested.
-
-.SH "SEE ALSO
-.BR wodim (1),
-.BR mkzftree (8),
-.BR magic (5),
-.BR apple_driver (8).
-
-.SH "FUTURE IMPROVEMENTS
-Some sort of gui interface.
-.SH AVAILABILITY
-.B m\&kisofs
-is available as part of the cdrkit package from
-http://alioth.debian.org/projects/debburn/. For other implementations/spinoffs
-of mkisoimage, look at the homepage of the particular developers.
-.B hfsutils
-from ftp://ftp.mars.org/pub/hfs
-.SH "MAILING LISTS
-If you want to actively take part on the development of m\&kisofs,
-you may join the Cdrkit developers mailing list by following the instructions on:
-.nf
-.sp
-https://alioth.debian.org/mail/?group_id=31006	
-.sp
-.fi
-and include the word
-.I subscribe
-in the body.
-The mail address of the list is:
-.nf
-.B
-debburn-devel at lists.alioth.debian.org
-.fi
-
-.SH MAINTAINER
-.PP
-This is the Cdrkit spinoff of the original mkisofs application. Maintained by:
-.nf
-Joerg Jaspert
-Eduard Bloch
-Steve McIntyre
-Ben Hutchings
-and other contributors
-.PP
-Cdrkit implementation of mkisoimage is derived from mkisofs in the Cdrtools
-package [1] (however now developed independently), having previous maintainers:
-.PP
-.nf
-J\*org Schilling
-Seestr. 110
-D-13353 Berlin
-Germany
-.fi
-.PP
-.nf
-James Pearson (HFS MKHYBRID MAINTAINER)
-j.pearson at ge.ucl.ac.uk
-
-.PP
-If you have support questions, send them to:
-.PP
-.B
-debburn-devel at lists.alioth.debian.org
-
-.PP
-Note that Cdrkit is not affiliated to Cdrtools and vice versa.
-
-.SH ACKNOWLEDGEMENTS
-UNIX is a registered trademark of The Open Group in the US and other countries.
-
-.SH SOURCES
-.PP
-.br
-[1] Cdrtools 2.01.01a08 from May 2006, http://cdrecord.berlios.de
-

Deleted: cdrkit/trunk/genisoimage/mkisoimage.c
===================================================================
--- cdrkit/trunk/mkisoimage/mkisoimage.c	2006-11-23 21:37:32 UTC (rev 450)
+++ cdrkit/trunk/genisoimage/mkisoimage.c	2006-11-23 22:11:41 UTC (rev 453)
@@ -1,3769 +0,0 @@
-/*
- * This file has been modified for the cdrkit suite.
- *
- * The behaviour and appearence of the program code below can differ to a major
- * extent from the version distributed by the original author(s).
- *
- * For details, see Changelog file distributed with the cdrkit package. If you
- * received this file from another source then ask the distributing person for
- * a log of modifications.
- *
- */
-
-/*
- *
- * Patched version with stuff from the Debian's cdrtools.
- * Replaced various warnings/disclaimers with more simple ones.
- *
- * Eduard Bloch <blade at debian.org>
-*/
-/* @(#)mkisoimage.c	1.167 06/01/30 joerg */
-#ifndef lint
-static	char sccsid[] =
-	"@(#)mkisoimage.c	1.167 06/01/30 joerg";
-#endif
-/*
- * Program mkisoimage.c - generate iso9660 filesystem  based upon directory
- * tree on hard disk.
- *
- * Written by Eric Youngdale (1993).
- *
- * Copyright 1993 Yggdrasil Computing, Incorporated
- * Copyright (c) 1999,2000-2004 J. Schilling
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-/* APPLE_HYB James Pearson j.pearson at ge.ucl.ac.uk 22/2/2000 */
-
-#include <mconfig.h>
-#include "mkisoimage.h"
-#include <errno.h>
-#include <timedefs.h>
-#include <fctldefs.h>
-#include <ctype.h>
-#include "match.h"
-#include "exclude.h"
-#include <unls.h>	/* For UNICODE translation */
-#include <schily.h>
-#ifdef UDF
-#include "udf.h"
-#endif
-
-#ifdef	NEED_O_BINARY
-#include <io.h>					/* for setmode() prototype */
-#endif
-
-#include "getopt.h"	/* Always include local (nonstandard) getopt.h */
-
-#ifdef VMS
-#include "vms.h"
-#endif
-
-#ifdef	no_more_needed
-#ifdef __NetBSD__
-#include <sys/resource.h>
-#endif
-#endif	/* no_more_needed */
-
-#ifdef USE_ICONV
-#include <locale.h>
-#include <langinfo.h>
-#endif
-
-struct directory *root = NULL;
-int		path_ind;
-
-char	version_string[] = "mkisoimage 2.01.01a05-unofficial-iconv";
-
-char		*outfile;
-FILE		*discimage;
-unsigned int	next_extent	= 0;
-unsigned int	last_extent	= 0;
-unsigned int	session_start	= 0;
-unsigned int	path_table_size	= 0;
-unsigned int	path_table[4]	= {0, };
-unsigned int	path_blocks	= 0;
-
-
-unsigned int	jpath_table_size = 0;
-unsigned int	jpath_table[4]	= {0, };
-unsigned int	jpath_blocks	= 0;
-
-struct iso_directory_record root_record;
-struct iso_directory_record jroot_record;
-
-char	*extension_record = NULL;
-int	extension_record_extent = 0;
-int	extension_record_size = 0;
-
-/* These variables are associated with command line options */
-int	check_oldnames = 0;
-int	check_session = 0;
-int	use_eltorito = 0;
-int	hard_disk_boot = 0;
-int	not_bootable = 0;
-int	no_emul_boot = 0;
-int	load_addr = 0;
-int	load_size = 0;
-int	boot_info_table = 0;
-int	use_alphaboot = 0;
-int	use_sparcboot = 0;
-int	use_hppaboot = 0;
-int	use_mipsboot = 0;
-int	use_mipselboot = 0;
-int	use_sunx86boot = 0;
-int	use_genboot = 0;
-int	use_RockRidge = 0;
-int	use_XA = 0;
-int	osecsize = 0;	/* Output-sector size, 0 means default secsize 2048 */
-int	use_Joliet = 0;
-int	jlen = JMAX;	/* maximum Joliet file name length */
-int	verbose = 1;
-int	debug = 0;
-int	gui = 0;
-int	all_files = 1;	/* New default is to include all files */
-int	follow_links = 0;
-#ifdef	IS_CYGWIN
-int	cache_inodes = 0; /* Do not cache inodes on Cygwin by default */
-#else
-int	cache_inodes = 1; /* Cache inodes if OS has unique inodes */
-#endif
-int	rationalize = 0;
-int	rationalize_uid = 0;
-int	rationalize_gid = 0;
-int	rationalize_filemode = 0;
-int	rationalize_dirmode = 0;
-uid_t	uid_to_use = 0;		/* when rationalizing uid */
-gid_t	gid_to_use = 0;		/* when rationalizing gid */
-int	filemode_to_use = 0;	/* if non-zero, when rationalizing file mode */
-int	dirmode_to_use = 0;	/* if non-zero, when rationalizing dir mode */
-int	new_dir_mode = 0555;
-int	generate_tables = 0;
-int	dopad = 1;	/* Now default to do padding */
-int	print_size = 0;
-int	split_output = 0;
-char	*icharset = NULL;	/* input charset to convert to UNICODE */
-char	*ocharset = NULL;	/* output charset to convert from UNICODE */
-char	*preparer = PREPARER_DEFAULT;
-char	*publisher = PUBLISHER_DEFAULT;
-char	*appid = APPID_DEFAULT;
-char	*copyright = COPYRIGHT_DEFAULT;
-char	*biblio = BIBLIO_DEFAULT;
-char	*abstract = ABSTRACT_DEFAULT;
-char	*volset_id = VOLSET_ID_DEFAULT;
-char	*volume_id = VOLUME_ID_DEFAULT;
-char	*system_id = SYSTEM_ID_DEFAULT;
-char	*boot_catalog = BOOT_CATALOG_DEFAULT;
-char	*boot_image = BOOT_IMAGE_DEFAULT;
-char	*genboot_image = BOOT_IMAGE_DEFAULT;
-int	ucs_level = 3;		/* We now have Unicode tables so use level 3 */
-int	volume_set_size = 1;
-int	volume_sequence_number = 1;
-
-struct eltorito_boot_entry_info *first_boot_entry = NULL;
-struct eltorito_boot_entry_info *last_boot_entry = NULL;
-struct eltorito_boot_entry_info *current_boot_entry = NULL;
-
-int	use_graft_ptrs;		/* Use graft points */
-int	jhide_trans_tbl;	/* Hide TRANS.TBL from Joliet tree */
-int	hide_rr_moved;		/* Name RR_MOVED .rr_moved in Rock Ridge tree */
-int	omit_period = 0;	/* Violates iso9660, but these are a pain */
-int	transparent_compression = 0; /* So far only works with linux */
-int	omit_version_number = 0; /* May violate iso9660, but noone uses vers */
-int	no_rr = 0;		/* Do not use RR attributes from old session */
-int	force_rr = 0;		/* Force to use RR attributes from old session */
-Uint	RR_relocation_depth = 6; /* Violates iso9660, but most systems work */
-int	iso9660_level = 1;
-int	iso9660_namelen = LEN_ISONAME; /* 31 characters, may be set to 37 */
-int	full_iso9660_filenames = 0; /* Full 31 character iso9660 filenames */
-int	relaxed_filenames = 0;	/* For Amiga.  Disc will not work with DOS */
-int	allow_lowercase = 0;	/* Allow lower case letters */
-int	allow_multidot = 0;	/* Allow more than on dot in filename */
-int	iso_translate = 1;	/* 1 == enables '#', '-' and '~' removal */
-int	allow_leading_dots = 0;	/* DOS cannot read names with leading dots */
-#ifdef	VMS
-int	use_fileversion = 1;	/* Use file version # from filesystem */
-#else
-int	use_fileversion = 0;	/* Use file version # from filesystem */
-#endif
-int	split_SL_component = 1;	/* circumvent a bug in the SunOS driver */
-int	split_SL_field = 1;	/* circumvent a bug in the SunOS */
-char	*trans_tbl = "TRANS.TBL"; /* default name for translation table */
-int	stream_media_size = 0;	/* # of blocks on the media */
-char	*stream_filename = "STREAM.IMG;1"; /* Default stream file name */
-
-#ifdef APPLE_HYB
-int	apple_hyb = 0;		/* create HFS hybrid flag */
-int	apple_ext = 0;		/* create HFS extensions flag */
-int	apple_both = 0;		/* common flag (for above) */
-int	hfs_extra = 0;		/* extra HFS blocks added to end of ISO vol */
-int	use_mac_name = 0;	/* use Mac name for ISO/Joliet/RR flag */
-hce_mem	*hce;			/* libhfs/mkisoimage extras */
-char	*hfs_boot_file = 0;	/* name of HFS boot file */
-int	gen_pt = 0;		/* generate HFS partition table */
-char	*autoname = 0;		/* AutoStart filename */
-char	*magic_filename = 0;	/* name of magic file */
-int	probe = 0;		/* search files for HFS/Unix type */
-int	nomacfiles = 0;		/* don't look for Mac/Unix files */
-int	hfs_select = 0;		/* Mac/Unix types to select */
-int	create_dt = 1;		/* create the Desktp files */
-int	afe_size = 0;		/* Apple File Exchange block size */
-int	hfs_last = MAG_LAST;	/* process magic file after map file */
-char	*deftype = APPLE_TYPE_DEFAULT;	/* default Apple TYPE */
-char	*defcreator = APPLE_CREATOR_DEFAULT;	/* default Apple CREATOR */
-char	*hfs_volume_id = NULL;	/* HFS volume ID */
-int	icon_pos = 0;		/* Keep icon position */
-char	*hfs_icharset = NULL;	/* input HFS charset name */
-char    *hfs_ocharset = NULL;	/* output HFS charset name */
-int	hfs_lock = 1;		/* lock HFS volume (read-only) */
-char	*hfs_bless = NULL;	/* name of folder to 'bless' (System Folder) */
-char	*hfs_parms = NULL;	/* low level HFS parameters */
-
-#ifdef PREP_BOOT
-char	*prep_boot_image[4];
-int	use_prep_boot = 0;
-int	use_chrp_boot = 0;
-#endif	/* PREP_BOOT */
-#endif	/* APPLE_HYB */
-
-#ifdef UDF
-int	use_udf = 0;
-#endif
-
-#ifdef DVD_VIDEO
-int	dvd_video = 0;
-#endif
-
-#ifdef SORTING
-int	do_sort = 0;		/* sort file data */
-#endif /* SORTING */
-
-#ifdef USE_ICONV
-int   iconv_possible;
-#endif
-
-struct unls_table *in_nls = NULL;  /* input UNICODE conversion table */
-struct unls_table *out_nls = NULL; /* output UNICODE conversion table */
-#ifdef APPLE_HYB
-struct unls_table *hfs_inls = NULL; /* input HFS UNICODE conversion table */
-struct unls_table *hfs_onls = NULL; /* output HFS UNICODE conversion table */
-#endif /* APPLE_HYB */
-
-struct rcopts {
-	char		*tag;
-	char		**variable;
-};
-
-struct rcopts rcopt[] = {
-	{"PREP", &preparer},
-	{"PUBL", &publisher},
-	{"APPI", &appid},
-	{"COPY", &copyright},
-	{"BIBL", &biblio},
-	{"ABST", &abstract},
-	{"VOLS", &volset_id},
-	{"VOLI", &volume_id},
-	{"SYSI", &system_id},
-#ifdef APPLE_HYB
-	{"HFS_TYPE", &deftype},
-	{"HFS_CREATOR", &defcreator},
-#endif	/* APPLE_HYB */
-	{NULL, NULL}
-};
-
-/*
- * In case it isn't obvious, the option handling code was ripped off
- * from GNU-ld.
- */
-struct ld_option {
-	/* The long option information.  */
-	struct option	opt;
-	/* The short option with the same meaning ('\0' if none).  */
-	char		shortopt;
-	/* The name of the argument (NULL if none).  */
-	const char	*arg;
-	/*
-	 * The documentation string.  If this is NULL, this is a synonym for
-	 * the previous option.
-	 */
-	const char	*doc;
-	enum {
-		/* Use one dash before long option name.  */
-		ONE_DASH,
-		/* Use two dashes before long option name.  */
-		TWO_DASHES,
-		/* Don't mention this option in --help output.  */
-		NO_HELP
-	} control;
-};
-
-/*
- * Codes used for the long options with no short synonyms. Note that all these
- * values must not be ASCII or EBCDIC.
- */
-#define	OPTION_HELP			1000
-#define	OPTION_QUIET			1001
-#define	OPTION_NOSPLIT_SL_COMPONENT	1002
-#define	OPTION_NOSPLIT_SL_FIELD		1003
-#define	OPTION_PRINT_SIZE		1004
-#define	OPTION_SPLIT_OUTPUT		1005
-#define	OPTION_ABSTRACT			1006
-#define	OPTION_BIBLIO			1007
-#define	OPTION_COPYRIGHT		1008
-#define	OPTION_SYSID			1009
-#define	OPTION_VOLSET			1010
-#define	OPTION_VOLSET_SIZE		1011
-#define	OPTION_VOLSET_SEQ_NUM		1012
-#define	OPTION_I_HIDE			1013
-#define	OPTION_J_HIDE			1014
-#define	OPTION_LOG_FILE			1015
-#define	OPTION_PVERSION			1016
-#define	OPTION_NOBAK			1017
-#define	OPTION_SPARCLABEL		1018
-#define	OPTION_HARD_DISK_BOOT		1019
-#define	OPTION_NO_EMUL_BOOT		1020
-#define	OPTION_NO_BOOT			1021
-#define	OPTION_BOOT_LOAD_ADDR		1022
-#define	OPTION_BOOT_LOAD_SIZE		1023
-#define	OPTION_BOOT_INFO_TABLE		1024
-#define	OPTION_HIDE_TRANS_TBL		1025
-#define	OPTION_HIDE_RR_MOVED		1026
-#define	OPTION_GUI			1027
-#define	OPTION_TRANS_TBL		1028
-#define	OPTION_P_LIST			1029
-#define	OPTION_I_LIST			1030
-#define	OPTION_J_LIST			1031
-#define	OPTION_X_LIST			1032
-#define	OPTION_NO_RR			1033
-#define	OPTION_JCHARSET			1034
-#define	OPTION_PAD			1035
-#define	OPTION_H_HIDE			1036
-#define	OPTION_H_LIST			1037
-#define	OPTION_CHECK_OLDNAMES		1038
-
-#ifdef SORTING
-#define	OPTION_SORT			1039
-#endif /* SORTING */
-#define	OPTION_UCS_LEVEL		1040
-#define	OPTION_ISO_TRANSLATE		1041
-#define	OPTION_ISO_LEVEL		1042
-#define	OPTION_RELAXED_FILENAMES	1043
-#define	OPTION_ALLOW_LOWERCASE		1044
-#define	OPTION_ALLOW_MULTIDOT		1045
-#define	OPTION_USE_FILEVERSION		1046
-#define	OPTION_MAX_FILENAMES		1047
-#define	OPTION_ALT_BOOT			1048
-#define	OPTION_USE_GRAFT		1049
-
-#define	OPTION_INPUT_CHARSET		1050
-#define	OPTION_OUTPUT_CHARSET		1051
-
-#define	OPTION_NOPAD			1052
-#define	OPTION_UID			1053
-#define	OPTION_GID			1054
-#define	OPTION_FILEMODE			1055
-#define	OPTION_DIRMODE			1056
-#define	OPTION_NEW_DIR_MODE		1057
-#define	OPTION_CACHE_INODES		1058
-#define	OPTION_NOCACHE_INODES		1059
-
-#define	OPTION_CHECK_SESSION		1060
-#define	OPTION_FORCE_RR			1061
-
-#define	OPTION_DEBUG			1062
-
-#define	OPTION_JLONG			1063
-
-#define	OPTION_STREAM_FILE_NAME		1064
-#define	OPTION_STREAM_CD_SIZE		1065
-
-#define	OPTION_XA			1066
-#define	OPTION_XA_RATIONALIZED		1067
-
-#define	OPTION_SUNX86BOOT		1068
-#define	OPTION_SUNX86LABEL		1069
-
-#define	OPTION_ALLOW_LEADING_DOTS	1070
-#define	OPTION_PUBLISHER		1071
-
-#ifdef		JIGDO_TEMPLATE
-#define	OPTION_JTT_OUTPUT		1101
-#define	OPTION_JTJ_OUTPUT		1102
-#define	OPTION_JT_MIN_SIZE		1103
-#define	OPTION_JT_PATH_MAP		1104
-#define	OPTION_JT_MD5_LIST		1105
-#define	OPTION_JT_INCLUDE		1106
-#define	OPTION_JT_EXCLUDE		1107
-#endif
-
-#define	OPTION_BOOTALPHA		1200
-
-#define	OPTION_HPPA_CMDLINE 		1210
-#define	OPTION_HPPA_KERNEL_32   	1211
-#define	OPTION_HPPA_KERNEL_64   	1212
-#define	OPTION_HPPA_BOOTLOADER  	1213
-#define	OPTION_HPPA_RAMDISK     	1214
-
-#define	OPTION_BOOTMIPS     		1220
-
-#define	OPTION_BOOTMIPSEL   		1230
-
-#ifdef UDF
-#define	OPTION_UDF			1500
-#endif
-#ifdef DVD_VIDEO
-#define	OPTION_DVD			1501
-#endif
-
-#ifdef APPLE_HYB
-#define	OPTION_CAP			2000
-#define	OPTION_NETA			2001
-#define	OPTION_DBL			2002
-#define	OPTION_ESH			2003
-#define	OPTION_FE			2004
-#define	OPTION_SGI			2005
-#define	OPTION_MBIN			2006
-#define	OPTION_SGL			2007
-/* aliases */
-#define	OPTION_USH			2008
-#define	OPTION_XIN			2009
-
-#define	OPTION_DAVE			2010
-#define	OPTION_SFM			2011
-#define	OPTION_XDBL			2012
-#define	OPTION_XHFS			2013
-
-#define	OPTION_PROBE			2020
-#define	OPTION_MACNAME			2021
-#define	OPTION_NOMACFILES		2022
-#define	OPTION_BOOT_HFS_FILE		2023
-#define	OPTION_MAGIC_FILE		2024
-
-#define	OPTION_HFS_LIST			2025
-
-#define	OPTION_GEN_PT			2026
-
-#define	OPTION_CREATE_DT		2027
-#define	OPTION_HFS_HIDE			2028
-
-#define	OPTION_AUTOSTART		2029
-#define	OPTION_BSIZE			2030
-#define	OPTION_HFS_VOLID		2031
-#define	OPTION_PREP_BOOT		2032
-#define	OPTION_ICON_POS			2033
-
-#define	OPTION_HFS_TYPE			2034
-#define	OPTION_HFS_CREATOR		2035
-
-#define	OPTION_ROOT_INFO		2036
-
-#define	OPTION_HFS_INPUT_CHARSET	2037
-#define	OPTION_HFS_OUTPUT_CHARSET	2038
-
-#define	OPTION_HFS_UNLOCK		2039
-#define	OPTION_HFS_BLESS		2040
-#define	OPTION_HFS_PARMS		2041
-
-#define	OPTION_CHRP_BOOT		2042
-
-#define	OPTION_RELOC_ROOT		2043
-#define	OPTION_RELOC_OLD_ROOT		2044
-
-#define	OPTION_MAP_FILE			2045
-
-#endif	/* APPLE_HYB */
-
-static int	save_pname = 0;
-
-static const struct ld_option ld_options[] =
-{
-	{{"nobak", no_argument, NULL, OPTION_NOBAK},
-	'\0', NULL, "Do not include backup files", ONE_DASH},
-	{{"no-bak", no_argument, NULL, OPTION_NOBAK},
-	'\0', NULL, "Do not include backup files", ONE_DASH},
-	{{"abstract", required_argument, NULL, OPTION_ABSTRACT},
-	'\0', "FILE", "Set Abstract filename", ONE_DASH},
-	{{"appid", required_argument, NULL, 'A'},
-	'A', "ID", "Set Application ID", ONE_DASH},
-	{{"biblio", required_argument, NULL, OPTION_BIBLIO},
-	'\0', "FILE", "Set Bibliographic filename", ONE_DASH},
-	{{"cache-inodes", no_argument, NULL, OPTION_CACHE_INODES},
-	'\0', NULL, "Cache inodes (needed to detect hard links)", ONE_DASH},
-	{{"no-cache-inodes", no_argument, NULL, OPTION_NOCACHE_INODES},
-	'\0', NULL, "Do not cache inodes (if filesystem has no unique unides)", ONE_DASH},
-	{{"check-oldnames", no_argument, NULL, OPTION_CHECK_OLDNAMES},
-	'\0', NULL, "Check all imported ISO9660 names from old session", ONE_DASH},
-	{{"check-session", required_argument, NULL, OPTION_CHECK_SESSION},
-	'\0', "FILE", "Check all ISO9660 names from previous session", ONE_DASH},
-	{{"copyright", required_argument, NULL, OPTION_COPYRIGHT},
-	'\0', "FILE", "Set Copyright filename", ONE_DASH},
-	{{"debug", no_argument, NULL, OPTION_DEBUG},
-	'\0', NULL, "Set debug flag", ONE_DASH},
-	{{"eltorito-boot", required_argument, NULL, 'b'},
-	'b', "FILE", "Set El Torito boot image name", ONE_DASH},
-	{{"eltorito-alt-boot", no_argument, NULL, OPTION_ALT_BOOT},
-	'\0', NULL, "Start specifying alternative El Torito boot parameters", ONE_DASH},
-	{{"sparc-boot", required_argument, NULL, 'B'},
-	'B', "FILES", "Set sparc boot image names", ONE_DASH},
-	{{"sunx86-boot", required_argument, NULL, OPTION_SUNX86BOOT},
-	'\0', "FILES", "Set sunx86 boot image names", ONE_DASH},
-	{{"generic-boot", required_argument, NULL, 'G'},
-	'G', "FILE", "Set generic boot image name", ONE_DASH},
-	{{"sparc-label", required_argument, NULL, OPTION_SPARCLABEL},
-	'\0', "label text", "Set sparc boot disk label", ONE_DASH},
-	{{"sunx86-label", required_argument, NULL, OPTION_SUNX86LABEL},
-	'\0', "label text", "Set sunx86 boot disk label", ONE_DASH},
-	{{"eltorito-catalog", required_argument, NULL, 'c'},
-	'c', "FILE", "Set El Torito boot catalog name", ONE_DASH},
-	{{"cdrecord-params", required_argument, NULL, 'C'},
-	'C', "PARAMS", "Magic paramters from cdrecord", ONE_DASH},
-	{{"omit-period", no_argument, NULL, 'd'},
-	'd', NULL, "Omit trailing periods from filenames (violates ISO9660)", ONE_DASH},
-	{{"dir-mode", required_argument, NULL, OPTION_DIRMODE},
-	'\0', "mode", "Make the mode of all directories this mode.", ONE_DASH},
-	{{"disable-deep-relocation", no_argument, NULL, 'D'},
-	'D', NULL, "Disable deep directory relocation (violates ISO9660)", ONE_DASH},
-	{{"file-mode", required_argument, NULL, OPTION_FILEMODE},
-	'\0', "mode", "Make the mode of all plain files this mode.", ONE_DASH},
-	{{"follow-links", no_argument, NULL, 'f'},
-	'f', NULL, "Follow symbolic links", ONE_DASH},
-	{{"gid", required_argument, NULL, OPTION_GID},
-	'\0', "gid", "Make the group owner of all files this gid.",
-	ONE_DASH},
-	{{"graft-points", no_argument, NULL, OPTION_USE_GRAFT},
-	'\0', NULL, "Allow to use graft points for filenames", ONE_DASH},
-	{{"root", required_argument, NULL, OPTION_RELOC_ROOT},
-	'\0', "DIR", "Set root directory for all new files and directories", ONE_DASH},
-	{{"old-root", required_argument, NULL, OPTION_RELOC_OLD_ROOT},
-	'\0', "DIR", "Set root directory in previous session that is searched for files", ONE_DASH},
-	{{"help", no_argument, NULL, OPTION_HELP},
-	'\0', NULL, "Print option help", ONE_DASH},
-	{{"hide", required_argument, NULL, OPTION_I_HIDE},
-	'\0', "GLOBFILE", "Hide ISO9660/RR file", ONE_DASH},
-	{{"hide-list", required_argument, NULL, OPTION_I_LIST},
-	'\0', "FILE", "File with list of ISO9660/RR files to hide", ONE_DASH},
-	{{"hidden", required_argument, NULL, OPTION_H_HIDE},
-	'\0', "GLOBFILE", "Set hidden attribute on ISO9660 file", ONE_DASH},
-	{{"hidden-list", required_argument, NULL, OPTION_H_LIST},
-	'\0', "FILE", "File with list of ISO9660 files with hidden attribute", ONE_DASH},
-	{{"hide-joliet", required_argument, NULL, OPTION_J_HIDE},
-	'\0', "GLOBFILE", "Hide Joliet file", ONE_DASH},
-	{{"hide-joliet-list", required_argument, NULL, OPTION_J_LIST},
-	'\0', "FILE", "File with list of Joliet files to hide", ONE_DASH},
-	{{"hide-joliet-trans-tbl", no_argument, NULL, OPTION_HIDE_TRANS_TBL},
-	'\0', NULL, "Hide TRANS.TBL from Joliet tree", ONE_DASH},
-	{{"hide-rr-moved", no_argument, NULL, OPTION_HIDE_RR_MOVED},
-	'\0', NULL, "Rename RR_MOVED to .rr_moved in Rock Ridge tree", ONE_DASH},
-	{{"gui", no_argument, NULL, OPTION_GUI},
-	'\0', NULL, "Switch behaviour for GUI", ONE_DASH},
-	{{NULL, required_argument, NULL, 'i'},
-	'i', "ADD_FILES", "No longer supported", TWO_DASHES},
-	{{"input-charset", required_argument, NULL, OPTION_INPUT_CHARSET},
-	'\0', "CHARSET", "Local input charset for file name conversion", ONE_DASH},
-	{{"output-charset", required_argument, NULL, OPTION_OUTPUT_CHARSET},
-	'\0', "CHARSET", "Output charset for file name conversion", ONE_DASH},
-	{{"iso-level", required_argument, NULL, OPTION_ISO_LEVEL},
-	'\0', "LEVEL", "Set ISO9660 conformance level (1..3) or 4 for ISO9660 version 2", ONE_DASH},
-	{{"joliet", no_argument, NULL, 'J'},
-	'J', NULL, "Generate Joliet directory information", ONE_DASH},
-	{{"joliet-long", no_argument, NULL, OPTION_JLONG},
-	'\0', NULL, "Allow Joliet file names to be 103 Unicode characters", ONE_DASH},
-	{{"jcharset", required_argument, NULL, OPTION_JCHARSET},
-	'\0', "CHARSET", "Local charset for Joliet directory information", ONE_DASH},
-	{{"full-iso9660-filenames", no_argument, NULL, 'l'},
-	'l', NULL, "Allow full 31 character filenames for ISO9660 names", ONE_DASH},
-	{{"max-iso9660-filenames", no_argument, NULL, OPTION_MAX_FILENAMES},
-	'\0', NULL, "Allow 37 character filenames for ISO9660 names (violates ISO9660)", ONE_DASH},
-
-	{{"allow-leading-dots", no_argument, NULL, OPTION_ALLOW_LEADING_DOTS},
-	'\0', NULL, "Allow ISO9660 filenames to start with '.' (violates ISO9660)", ONE_DASH},
-	{{"ldots", no_argument, NULL, OPTION_ALLOW_LEADING_DOTS},
-	'\0', NULL, "Allow ISO9660 filenames to start with '.' (violates ISO9660)", ONE_DASH},
-
-/* POSIX.1-2001 REMOVE -----> */
-	{{"allow-leading-dots", no_argument, NULL, 'L'},
-	'L', NULL, "OLD Pre-POSIX.1-2001 option - don't use -L", ONE_DASH},
-/* -----> END POSIX.1-2001 REMOVE */
-
-	{{"log-file", required_argument, NULL, OPTION_LOG_FILE},
-	'\0', "LOG_FILE", "Re-direct messages to LOG_FILE", ONE_DASH},
-	{{"exclude", required_argument, NULL, 'm'},
-	'm', "GLOBFILE", "Exclude file name", ONE_DASH},
-	{{"exclude-list", required_argument, NULL, OPTION_X_LIST},
-	'\0', "FILE", "File with list of file names to exclude", ONE_DASH},
-	{{"pad", no_argument, NULL, OPTION_PAD},
-	0, NULL, "Pad output to a multiple of 32k (default)", ONE_DASH},
-	{{"no-pad", no_argument, NULL, OPTION_NOPAD},
-	0, NULL, "Do not pad output to a multiple of 32k", ONE_DASH},
-	{{"prev-session", required_argument, NULL, 'M'},
-	'M', "FILE", "Set path to previous session to merge", ONE_DASH},
-	{{"dev", required_argument, NULL, 'M'},
-	'\0', "SCSIdev", "Set path to previous session to merge", ONE_DASH},
-	{{"omit-version-number", no_argument, NULL, 'N'},
-	'N', NULL, "Omit version number from ISO9660 filename (violates ISO9660)", ONE_DASH},
-	{{"new-dir-mode", required_argument, NULL, OPTION_NEW_DIR_MODE},
-	'\0', "mode", "Mode used when creating new directories.", ONE_DASH},
-	{{"force-rr", no_argument, NULL, OPTION_FORCE_RR},
-	0, NULL, "Inhibit automatic Rock Ridge detection for previous session", ONE_DASH},
-	{{"no-rr", no_argument, NULL, OPTION_NO_RR},
-	0, NULL, "Inhibit reading of Rock Ridge attributes from previous session", ONE_DASH},
-	{{"no-split-symlink-components", no_argument, NULL, OPTION_NOSPLIT_SL_COMPONENT},
-	0, NULL, "Inhibit splitting symlink components", ONE_DASH},
-	{{"no-split-symlink-fields", no_argument, NULL, OPTION_NOSPLIT_SL_FIELD},
-	0, NULL, "Inhibit splitting symlink fields", ONE_DASH},
-	{{"output", required_argument, NULL, 'o'},
-	'o', "FILE", "Set output file name", ONE_DASH},
-	{{"path-list", required_argument, NULL, OPTION_P_LIST},
-	'\0', "FILE", "File with list of pathnames to process", ONE_DASH},
-	{{"preparer", required_argument, NULL, 'p'},
-	'p', "PREP", "Set Volume preparer", ONE_DASH},
-	{{"print-size", no_argument, NULL, OPTION_PRINT_SIZE},
-	'\0', NULL, "Print estimated filesystem size and exit", ONE_DASH},
-	{{"publisher", required_argument, NULL, OPTION_PUBLISHER},
-	'\0', "PUB", "Set Volume publisher", ONE_DASH},
-/* POSIX.1-2001 REMOVE -----> */
-	{{"publisher", required_argument, NULL, 'P'},
-	'P', "PUB", "OLD Pre-POSIX.1-2001 option - don't use -P", ONE_DASH},
-/* -----> END POSIX.1-2001 REMOVE */
-	{{"quiet", no_argument, NULL, OPTION_QUIET},
-	'\0', NULL, "Run quietly", ONE_DASH},
-	{{"rational-rock", no_argument, NULL, 'r'},
-	'r', NULL, "Generate rationalized Rock Ridge directory information", ONE_DASH},
-	{{"rock", no_argument, NULL, 'R'},
-	'R', NULL, "Generate Rock Ridge directory information", ONE_DASH},
-	{{"sectype", required_argument, NULL, 's'},
-	's', "TYPE", "Set output sector type to e.g. data/xa1/raw", ONE_DASH},
-
-	{{"alpha-boot", required_argument, NULL, OPTION_BOOTALPHA},
-	'\0', "FILE", "Set alpha boot image name (relative to image root)", ONE_DASH},
-
-	{{"hppa-cmdline", required_argument, NULL, OPTION_HPPA_CMDLINE},
-	'\0', "CMDLINE", "Set hppa boot command line (relative to image root)", ONE_DASH},
-	{{"hppa-kernel-32", required_argument, NULL, OPTION_HPPA_KERNEL_32},
-	'\0', "FILE", "Set hppa 32-bit image name (relative to image root)", ONE_DASH},
-	{{"hppa-kernel-64", required_argument, NULL, OPTION_HPPA_KERNEL_64},
-	'\0', "FILE", "Set hppa 64-bit image name (relative to image root)", ONE_DASH},
-	{{"hppa-bootloader", required_argument, NULL, OPTION_HPPA_BOOTLOADER},
-	'\0', "FILE", "Set hppa boot loader file name (relative to image root)", ONE_DASH},
-	{{"hppa-ramdisk", required_argument, NULL, OPTION_HPPA_RAMDISK},
-	'\0', "FILE", "Set hppa ramdisk file name (relative to image root)", ONE_DASH},
-
-	{{"mips-boot", required_argument, NULL, OPTION_BOOTMIPS},
-	'\0', "FILE", "Set mips boot image name (relative to image root)", ONE_DASH},
-
-	{{"mipsel-boot", required_argument, NULL, OPTION_BOOTMIPSEL},
-	'\0', "FILE", "Set mipsel boot image name (relative to image root)", ONE_DASH},
-
-#ifdef JIGDO_TEMPLATE
-	{{"jigdo-jigdo", required_argument, NULL, OPTION_JTJ_OUTPUT},
-	'\0', "FILE", "Produce a jigdo .jigdo file as well as the .iso", ONE_DASH },
-	{{"jigdo-template", required_argument, NULL, OPTION_JTT_OUTPUT},
-	'\0', "FILE", "Produce a jigdo .template file as well as the .iso", ONE_DASH },
-	{{"jigdo-min-file-size", required_argument, NULL, OPTION_JT_MIN_SIZE},
-	'\0', "SIZE", "Minimum size for a file to be listed in the jigdo file", ONE_DASH },
-	{{"jigdo-force-md5", required_argument, NULL, OPTION_JT_INCLUDE},
-	'\0', "PATTERN", "Pattern(s) where files MUST match an externally-supplied MD5sum", ONE_DASH },
-	{{"jigdo-exclude", required_argument, NULL, OPTION_JT_EXCLUDE},
-	'\0', "PATTERN", "Pattern(s) to exclude from the jigdo file", ONE_DASH },
-	{{"jigdo-map", required_argument, NULL, OPTION_JT_PATH_MAP},
-	'\0', "PATTERN1=PATTERN2", "Pattern(s) to map paths (e.g. Debian=/mirror/debian)", ONE_DASH },
-	{{"md5-list", required_argument, NULL, OPTION_JT_MD5_LIST},
-	'\0', "FILE", "File containing MD5 sums of the files that should be checked", ONE_DASH },
-#endif
-
-#ifdef SORTING
-	{ {"sort", required_argument, NULL, OPTION_SORT},
-	'\0', "FILE", "Sort file content locations according to rules in FILE", ONE_DASH },
-#endif /* SORTING */
-
-	{{"split-output", no_argument, NULL, OPTION_SPLIT_OUTPUT},
-	'\0', NULL, "Split output into files of approx. 1GB size", ONE_DASH},
-	{{"stream-file-name", required_argument, NULL, OPTION_STREAM_FILE_NAME},
-	'\0', "FILE_NAME", "Set the stream file ISO9660 name (incl. version)", ONE_DASH},
-	{{"stream-media-size", required_argument, NULL, OPTION_STREAM_CD_SIZE},
-	'\0', "#", "Set the size of your CD media in sectors", ONE_DASH},
-	{{"sysid", required_argument, NULL, OPTION_SYSID},
-	'\0', "ID", "Set System ID", ONE_DASH},
-	{{"translation-table", no_argument, NULL, 'T'},
-	'T', NULL, "Generate translation tables for systems that don't understand long filenames", ONE_DASH},
-	{{"table-name", required_argument, NULL, OPTION_TRANS_TBL},
-	'\0', "TABLE_NAME", "Translation table file name", ONE_DASH},
-	{{"ucs-level", required_argument, NULL, OPTION_UCS_LEVEL},
-	'\0', "LEVEL", "Set Joliet UCS level (1..3)", ONE_DASH},
-
-#ifdef UDF
-	{{"udf", no_argument, NULL, OPTION_UDF},
-	'\0', NULL, "Generate UDF file system", ONE_DASH},
-#endif
-
-#ifdef DVD_VIDEO
-	{{"dvd-video", no_argument, NULL, OPTION_DVD},
-	'\0', NULL, "Generate DVD-Video compliant UDF file system", ONE_DASH},
-#endif
-
-	{{"uid", required_argument, NULL, OPTION_UID},
-	'\0', "uid", "Make the owner of all files this uid.",
-	ONE_DASH},
-	{{"untranslated-filenames", no_argument, NULL, 'U'},
-	/* CSTYLED */
-	'U', NULL, "Allow Untranslated filenames (for HPUX & AIX - violates ISO9660). Forces -l, -d, -N, -allow-leading-dots, -relaxed-filenames, -allow-lowercase, -allow-multidot", ONE_DASH},
-	{{"relaxed-filenames", no_argument, NULL, OPTION_RELAXED_FILENAMES},
-	'\0', NULL, "Allow 7 bit ASCII except lower case characters (violates ISO9660)", ONE_DASH},
-	{{"no-iso-translate", no_argument, NULL, OPTION_ISO_TRANSLATE},
-	'\0', NULL, "Do not translate illegal ISO characters '~', '-' and '#' (violates ISO9660)", ONE_DASH},
-	{{"allow-lowercase", no_argument, NULL, OPTION_ALLOW_LOWERCASE},
-	'\0', NULL, "Allow lower case characters in addition to the current character set (violates ISO9660)", ONE_DASH},
-	{{"allow-multidot", no_argument, NULL, OPTION_ALLOW_MULTIDOT},
-	'\0', NULL, "Allow more than one dot in filenames (e.g. .tar.gz) (violates ISO9660)", ONE_DASH},
-	{{"use-fileversion", no_argument, NULL, OPTION_USE_FILEVERSION},
-	'\0', "LEVEL", "Use file version # from filesystem", ONE_DASH},
-	{{"verbose", no_argument, NULL, 'v'},
-	'v', NULL, "Verbose", ONE_DASH},
-	{{"version", no_argument, NULL, OPTION_PVERSION},
-	'\0', NULL, "Print the current version", ONE_DASH},
-	{{"volid", required_argument, NULL, 'V'},
-	'V', "ID", "Set Volume ID", ONE_DASH},
-	{{"volset", required_argument, NULL, OPTION_VOLSET},
-	'\0', "ID", "Set Volume set ID", ONE_DASH},
-	{{"volset-size", required_argument, NULL, OPTION_VOLSET_SIZE},
-	'\0', "#", "Set Volume set size", ONE_DASH},
-	{{"volset-seqno", required_argument, NULL, OPTION_VOLSET_SEQ_NUM},
-	'\0', "#", "Set Volume set sequence number", ONE_DASH},
-	{{"old-exclude", required_argument, NULL, 'x'},
-	'x', "FILE", "Exclude file name(depreciated)", ONE_DASH},
-	{{"hard-disk-boot", no_argument, NULL, OPTION_HARD_DISK_BOOT},
-	'\0', NULL, "Boot image is a hard disk image", ONE_DASH},
-	{{"no-emul-boot", no_argument, NULL, OPTION_NO_EMUL_BOOT},
-	'\0', NULL, "Boot image is 'no emulation' image", ONE_DASH},
-	{{"no-boot", no_argument, NULL, OPTION_NO_BOOT},
-	'\0', NULL, "Boot image is not bootable", ONE_DASH},
-	{{"boot-load-seg", required_argument, NULL, OPTION_BOOT_LOAD_ADDR},
-	'\0', "#", "Set load segment for boot image", ONE_DASH},
-	{{"boot-load-size", required_argument, NULL, OPTION_BOOT_LOAD_SIZE},
-	'\0', "#", "Set numbers of load sectors", ONE_DASH},
-	{{"boot-info-table", no_argument, NULL, OPTION_BOOT_INFO_TABLE},
-	'\0', NULL, "Patch boot image with info table", ONE_DASH},
-	{{"XA", no_argument, NULL, OPTION_XA},
-	'\0', NULL, "Generate XA directory attruibutes", ONE_DASH},
-	{{"xa", no_argument, NULL, OPTION_XA_RATIONALIZED},
-	'\0', NULL, "Generate rationalized XA directory attruibutes", ONE_DASH},
-	{{"transparent-compression", no_argument, NULL, 'z'},
-	'z', NULL, "Enable transparent compression of files", ONE_DASH},
-
-#ifdef APPLE_HYB
-	{{"hfs-type", required_argument, NULL, OPTION_HFS_TYPE},
-	'\0', "TYPE", "Set HFS default TYPE", ONE_DASH},
-	{{"hfs-creator", required_argument, NULL, OPTION_HFS_CREATOR},
-	'\0', "CREATOR", "Set HFS default CREATOR", ONE_DASH},
-	{{"apple", no_argument, NULL, 'g'},
-	'g', NULL, "Add Apple ISO9660 extensions", ONE_DASH},
-	{{"hfs", no_argument, NULL, 'h'},
-	'h', NULL, "Create ISO9660/HFS hybrid", ONE_DASH},
-	{{"map", required_argument, NULL, OPTION_MAP_FILE},
-	'\0', "MAPPING_FILE", "Map file extensions to HFS TYPE/CREATOR", ONE_DASH},
-/* POSIX.1-2001 REMOVE -----> */
-	{{"map", required_argument, NULL, 'H'},
-	'H', "MAPPING_FILE", "OLD Pre-POSIX.1-2001 option - don't use -H", ONE_DASH},
-/* -----> END POSIX.1-2001 REMOVE */
-	{{"magic", required_argument, NULL, OPTION_MAGIC_FILE},
-	'\0', "FILE", "Magic file for HFS TYPE/CREATOR", ONE_DASH},
-	{{"probe", no_argument, NULL, OPTION_PROBE},
-	'\0', NULL, "Probe all files for Apple/Unix file types", ONE_DASH},
-	{{"mac-name", no_argument, NULL, OPTION_MACNAME},
-	'\0', NULL, "Use Macintosh name for ISO9660/Joliet/RockRidge file name",
-	ONE_DASH},
-	{{"no-mac-files", no_argument, NULL, OPTION_NOMACFILES},
-	'\0', NULL, "Do not look for Unix/Mac files (depreciated)", ONE_DASH},
-	{{"boot-hfs-file", required_argument, NULL, OPTION_BOOT_HFS_FILE},
-	'\0', "FILE", "Set HFS boot image name", ONE_DASH},
-	{{"part", no_argument, NULL, OPTION_GEN_PT},
-	'\0', NULL, "Generate HFS partition table", ONE_DASH},
-	{{"cluster-size", required_argument, NULL, OPTION_BSIZE},
-	'\0', "SIZE", "Cluster size for PC Exchange Macintosh files", ONE_DASH},
-	{{"auto", required_argument, NULL, OPTION_AUTOSTART},
-	'\0', "FILE", "Set HFS AutoStart file name", ONE_DASH},
-	{{"no-desktop", no_argument, NULL, OPTION_CREATE_DT},
-	'\0', NULL, "Do not create the HFS (empty) Desktop files", ONE_DASH},
-	{{"hide-hfs", required_argument, NULL, OPTION_HFS_HIDE},
-	'\0', "GLOBFILE", "Hide HFS file", ONE_DASH},
-	{{"hide-hfs-list", required_argument, NULL, OPTION_HFS_LIST},
-	'\0', "FILE", "List of HFS files to hide", ONE_DASH},
-	{{"hfs-volid", required_argument, NULL, OPTION_HFS_VOLID},
-	'\0', "HFS_VOLID", "Volume name for the HFS partition", ONE_DASH},
-	{{"icon-position", no_argument, NULL, OPTION_ICON_POS},
-	'\0', NULL, "Keep HFS icon position", ONE_DASH},
-	{{"root-info", required_argument, NULL, OPTION_ROOT_INFO},
-	'\0', "FILE", "finderinfo for root folder", ONE_DASH},
-	{{"input-hfs-charset", required_argument, NULL, OPTION_HFS_INPUT_CHARSET},
-	'\0', "CHARSET", "Local input charset for HFS file name conversion", ONE_DASH},
-	{{"output-hfs-charset", required_argument, NULL, OPTION_HFS_OUTPUT_CHARSET},
-	'\0', "CHARSET", "Output charset for HFS file name conversion", ONE_DASH},
-	{{"hfs-unlock", no_argument, NULL, OPTION_HFS_UNLOCK},
-	'\0', NULL, "Leave HFS Volume unlocked", ONE_DASH},
-	{{"hfs-bless", required_argument, NULL, OPTION_HFS_BLESS},
-	'\0', "FOLDER_NAME", "Name of Folder to be blessed", ONE_DASH},
-	{{"hfs-parms", required_argument, NULL, OPTION_HFS_PARMS},
-	'\0', "PARAMETERS", "Comma separated list of HFS parameters", ONE_DASH},
-#ifdef PREP_BOOT
-	{{"prep-boot", required_argument, NULL, OPTION_PREP_BOOT},
-	'\0', "FILE", "PReP boot image file -- up to 4 are allowed", ONE_DASH},
-	{{"chrp-boot", no_argument, NULL, OPTION_CHRP_BOOT},
-	'\0', NULL, "Add CHRP boot header", ONE_DASH},
-#endif	/* PREP_BOOT */
-	{{"cap", no_argument, NULL, OPTION_CAP},
-	'\0', NULL, "Look for AUFS CAP Macintosh files", TWO_DASHES},
-	{{"netatalk", no_argument, NULL, OPTION_NETA},
-	'\0', NULL, "Look for NETATALK Macintosh files", TWO_DASHES},
-	{{"double", no_argument, NULL, OPTION_DBL},
-	'\0', NULL, "Look for AppleDouble Macintosh files", TWO_DASHES},
-	{{"ethershare", no_argument, NULL, OPTION_ESH},
-	'\0', NULL, "Look for Helios EtherShare Macintosh files", TWO_DASHES},
-	{{"exchange", no_argument, NULL, OPTION_FE},
-	'\0', NULL, "Look for PC Exchange Macintosh files", TWO_DASHES},
-	{{"sgi", no_argument, NULL, OPTION_SGI},
-	'\0', NULL, "Look for SGI Macintosh files", TWO_DASHES},
-	{{"macbin", no_argument, NULL, OPTION_MBIN},
-	'\0', NULL, "Look for MacBinary Macintosh files", TWO_DASHES},
-	{{"single", no_argument, NULL, OPTION_SGL},
-	'\0', NULL, "Look for AppleSingle Macintosh files", TWO_DASHES},
-	{{"ushare", no_argument, NULL, OPTION_USH},
-	'\0', NULL, "Look for IPT UShare Macintosh files", TWO_DASHES},
-	{{"xinet", no_argument, NULL, OPTION_XIN},
-	'\0', NULL, "Look for XINET Macintosh files", TWO_DASHES},
-	{{"dave", no_argument, NULL, OPTION_DAVE},
-	'\0', NULL, "Look for DAVE Macintosh files", TWO_DASHES},
-	{{"sfm", no_argument, NULL, OPTION_SFM},
-	'\0', NULL, "Look for SFM Macintosh files", TWO_DASHES},
-	{{"osx-double", no_argument, NULL, OPTION_XDBL},
-	'\0', NULL, "Look for MacOS X AppleDouble Macintosh files", TWO_DASHES},
-	{{"osx-hfs", no_argument, NULL, OPTION_XHFS},
-	'\0', NULL, "Look for MacOS X HFS Macintosh files", TWO_DASHES},
-#endif	/* APPLE_HYB */
-};
-
-#define	OPTION_COUNT (sizeof ld_options / sizeof (ld_options[0]))
-
-static	void	read_rcfile(char *appname);
-static	void	susage(int excode);
-static	void	usage(int excode);
-int	iso9660_date(char *result, time_t crtime);
-static	void	hide_reloc_dir(void);
-static	char *get_pnames(int argc, char **argv, int opt, char *pname, 
-								  int pnsize, FILE *fp);
-char *findgequal(char *s);
-static	char *escstrcpy(char *to, char *from);
-void *e_malloc(size_t size);
-
-static void
-read_rcfile(char *appname)
-{
-	FILE		*rcfile = (FILE *) NULL;
-	struct rcopts	*rco;
-	char		*pnt,
-			*pnt1;
-	char		linebuffer[256];
-	static char	rcfn[] = ".mkisoimagerc";
-	char		filename[1000];
-	int		linum;
-
-	strcpy(filename, rcfn);
-	if (access(filename, R_OK) == 0)
-		rcfile = fopen(filename, "r");
-	if (!rcfile && errno != ENOENT)
-#ifdef	USE_LIBSCHILY
-		errmsg("Cannot open '%s'.\n", filename);
-#else
-		perror(filename);
-#endif
-
-	if (!rcfile) {
-		pnt = getenv("MKISOFSRC");
-		if (pnt && strlen(pnt) <= sizeof (filename)) {
-			strcpy(filename, pnt);
-			if (access(filename, R_OK) == 0)
-				rcfile = fopen(filename, "r");
-			if (!rcfile && errno != ENOENT)
-#ifdef	USE_LIBSCHILY
-				errmsg("Cannot open '%s'.\n", filename);
-#else
-				perror(filename);
-#endif
-		}
-	}
-	if (!rcfile) {
-		pnt = getenv("HOME");
-		if (pnt && strlen(pnt) + strlen(rcfn) + 2 <=
-							sizeof (filename)) {
-			strcpy(filename, pnt);
-			strcat(filename, "/");
-			strcat(filename, rcfn);
-			if (access(filename, R_OK) == 0)
-				rcfile = fopen(filename, "r");
-			if (!rcfile && errno != ENOENT)
-#ifdef	USE_LIBSCHILY
-				errmsg("Cannot open '%s'.\n", filename);
-#else
-				perror(filename);
-#endif
-		}
-	}
-	if (!rcfile && strlen(appname) + sizeof (rcfn) + 2 <=
-							sizeof (filename)) {
-		strcpy(filename, appname);
-		pnt = strrchr(filename, '/');
-		if (pnt) {
-			strcpy(pnt + 1, rcfn);
-			if (access(filename, R_OK) == 0)
-				rcfile = fopen(filename, "r");
-			if (!rcfile && errno != ENOENT)
-#ifdef	USE_LIBSCHILY
-				errmsg("Cannot open '%s'.\n", filename);
-#else
-				perror(filename);
-#endif
-		}
-	}
-	if (!rcfile)
-		return;
-	if (verbose > 0) {
-		fprintf(stderr, "Using \"%s\"\n", filename);
-	}
-	/* OK, we got it.  Now read in the lines and parse them */
-	linum = 0;
-	while (fgets(linebuffer, sizeof (linebuffer), rcfile)) {
-		char	*name;
-		char	*name_end;
-
-		++linum;
-		/* skip any leading white space */
-		pnt = linebuffer;
-		while (*pnt == ' ' || *pnt == '\t')
-			++pnt;
-		/*
-		 * If we are looking at a # character, this line is a comment.
-		 */
-		if (*pnt == '#')
-			continue;
-		/*
-		 * The name should begin in the left margin.  Make sure it is
-		 * in upper case.  Stop when we see white space or a comment.
-		 */
-		name = pnt;
-		while (*pnt && (isalpha((unsigned char) *pnt) || *pnt == '_')) {
-			if (islower((unsigned char) *pnt))
-				*pnt = toupper((unsigned char) *pnt);
-			pnt++;
-		}
-		if (name == pnt) {
-			fprintf(stderr, "%s:%d: name required\n", filename,
-					linum);
-			continue;
-		}
-		name_end = pnt;
-		/* Skip past white space after the name */
-		while (*pnt == ' ' || *pnt == '\t')
-			pnt++;
-		/* silently ignore errors in the rc file. */
-		if (*pnt != '=') {
-			fprintf(stderr, "%s:%d: equals sign required after '%.*s'\n",
-						filename, linum,
-						/* XXX Should not be > int */
-						(int)(name_end-name), name);
-			continue;
-		}
-		/* Skip pas the = sign, and any white space following it */
-		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;
-		while (*pnt1) {
-			if (*pnt1 == '\n') {
-				*pnt1 = 0;
-				break;
-			}
-			pnt1++;
-		}
-		/* OK, now figure out which option we have */
-		for (rco = rcopt; rco->tag; rco++) {
-			if (strcmp(rco->tag, name) == 0) {
-				*rco->variable = strdup(pnt);
-				break;
-			}
-		}
-		if (rco->tag == NULL) {
-			fprintf(stderr, "%s:%d: field name \"%s\" unknown\n",
-				filename, linum,
-				name);
-		}
-	}
-	if (ferror(rcfile))
-#ifdef	USE_LIBSCHILY
-		errmsg("Read error on '%s'.\n", filename);
-#else
-		perror(filename);
-#endif
-	fclose(rcfile);
-}
-
-char	*path_table_l = NULL;
-char	*path_table_m = NULL;
-
-char	*jpath_table_l = NULL;
-char	*jpath_table_m = NULL;
-
-int	goof = 0;
-
-#ifndef TRUE
-#define	TRUE 1
-#endif
-
-#ifndef FALSE
-#define	FALSE 0
-#endif
-
-static void
-susage(int excode)
-{
-	const char	*program_name = "mkisoimage";
-
-	fprintf(stderr, "Usage: %s [options] -o file directory ...\n", program_name);
-	fprintf(stderr, "\nUse %s -help\n", program_name);
-	fprintf(stderr, "to get a list of valid options.\n");
-	fprintf(stderr, 
-        "\nNOTE: This version of mkisoimage differs from the one published by Eric Youngdale\n"
-        "and from the one included in cdrtools (by Joerg Schilling).\n"
-        "It provides a different set of features and has different problems.\n"
-        "Report errors to debburn-devel at lists.alioth.debian.org.\n");
-
-	exit(excode);
-}
-
-static void
-usage(int excode)
-{
-	const char	*program_name = "mkisoimage";
-
-#if 0
-	fprintf(stderr, "Usage:\n");
-	fprintf(stderr,
-		"mkisoimage [-o outfile] [-R] [-V volid] [-v] [-a] \
-[-T]\n [-l] [-d] [-V] [-D] [-L] [-p preparer]"
-		"[-P publisher] [ -A app_id ] [-z] \n \
-[-b boot_image_name] [-c boot_catalog-name] \
-[-x path -x path ...] path\n");
-#endif
-
-	int	i;
-
-/*	const char **targets, **pp;*/
-
-	fprintf(stderr, "Usage: %s [options] file...\n", program_name);
-
-	fprintf(stderr, "Options:\n");
-	for (i = 0; i < (int)OPTION_COUNT; i++) {
-		if (ld_options[i].doc != NULL) {
-			int	comma;
-			int	len;
-			int	j;
-
-			fprintf(stderr, "  ");
-
-			comma = FALSE;
-			len = 2;
-
-			j = i;
-			do {
-				if (ld_options[j].shortopt != '\0' &&
-					ld_options[j].control != NO_HELP) {
-					fprintf(stderr, "%s-%c",
-						comma ? ", " : "",
-						ld_options[j].shortopt);
-					len += (comma ? 2 : 0) + 2;
-					if (ld_options[j].arg != NULL) {
-						if (ld_options[j].opt.has_arg != optional_argument) {
-							fprintf(stderr, " ");
-							++len;
-						}
-						fprintf(stderr, "%s",
-							ld_options[j].arg);
-						len += strlen(ld_options[j].arg);
-					}
-					comma = TRUE;
-				}
-				++j;
-			}
-			while (j < (int)OPTION_COUNT && ld_options[j].doc == NULL);
-
-			j = i;
-			do {
-				if (ld_options[j].opt.name != NULL &&
-					ld_options[j].control != NO_HELP) {
-					fprintf(stderr, "%s-%s%s",
-						comma ? ", " : "",
-						ld_options[j].control == TWO_DASHES ? "-" : "",
-						ld_options[j].opt.name);
-					len += ((comma ? 2 : 0)
-						+ 1
-						+ (ld_options[j].control == TWO_DASHES ? 1 : 0)
-						+ strlen(ld_options[j].opt.name));
-					if (ld_options[j].arg != NULL) {
-						fprintf(stderr, " %s",
-							ld_options[j].arg);
-						len += 1 +
-						    strlen(ld_options[j].arg);
-					}
-					comma = TRUE;
-				}
-				++j;
-			}
-			while (j < (int)OPTION_COUNT && ld_options[j].doc == NULL);
-
-			if (len >= 30) {
-				fprintf(stderr, "\n");
-				len = 0;
-			}
-			for (; len < 30; len++)
-				fputc(' ', stderr);
-
-			fprintf(stderr, "%s\n", ld_options[i].doc);
-		}
-	}
-	fprintf(stderr, 
-        "\nNOTE: This version of mkisoimage differs from the one published by Eric Youngdale\n"
-        "and from the one included in cdrtools (by Joerg Schilling).\n"
-        "It provides a different set of features and has different problems.\n"
-        "Report errors to debburn-devel at lists.alioth.debian.org.\n");
-	exit(excode);
-}
-
-
-/*
- * Fill in date in the iso9660 format
- *
- * The standards  state that the timezone offset is in multiples of 15
- * minutes, and is what you add to GMT to get the localtime.  The U.S.
- * is always at a negative offset, from -5h to -8h (can vary a little
- * with DST,  I guess).  The Linux iso9660 filesystem has had the sign
- * of this wrong for ages (mkisoimage had it wrong too for the longest time).
- */
-int
-iso9660_date(char *result, time_t crtime)
-{
-	struct tm	*local;
-
-	local = localtime(&crtime);
-	result[0] = local->tm_year;
-	result[1] = local->tm_mon + 1;
-	result[2] = local->tm_mday;
-	result[3] = local->tm_hour;
-	result[4] = local->tm_min;
-	result[5] = local->tm_sec;
-
-	/*
-	 * Must recalculate proper timezone offset each time, as some files use
-	 * daylight savings time and some don't...
-	 */
-	result[6] = local->tm_yday;	/* save yday 'cause gmtime zaps it */
-	local = gmtime(&crtime);
-	local->tm_year -= result[0];
-	local->tm_yday -= result[6];
-	local->tm_hour -= result[3];
-	local->tm_min -= result[4];
-	if (local->tm_year < 0) {
-		local->tm_yday = -1;
-	} else {
-		if (local->tm_year > 0)
-			local->tm_yday = 1;
-	}
-
-	result[6] = -(local->tm_min + 60 *
-			(local->tm_hour + 24 * local->tm_yday)) / 15;
-
-	return (0);
-}
-
-/* hide "./rr_moved" if all its contents are hidden */
-static void
-hide_reloc_dir()
-{
-	struct directory_entry *s_entry;
-
-	for (s_entry = reloc_dir->contents; s_entry; s_entry = s_entry->next) {
-		if (strcmp(s_entry->name, ".") == 0 ||
-				strcmp(s_entry->name, "..") == 0)
-			continue;
-
-		if ((s_entry->de_flags & INHIBIT_ISO9660_ENTRY) == 0)
-			return;
-	}
-
-	/* all entries are hidden, so hide this directory */
-	reloc_dir->dir_flags |= INHIBIT_ISO9660_ENTRY;
-	reloc_dir->self->de_flags |= INHIBIT_ISO9660_ENTRY;
-}
-
-/*
- * get pathnames from the command line, and then from given file
- */
-static char *
-get_pnames(int argc, char **argv, int opt, char *pname, int pnsize, FILE *fp)
-{
-	int	len;
-
-	/* we may of already read the first line from the pathnames file */
-	if (save_pname) {
-		save_pname = 0;
-		return (pname);
-	}
-
-	if (opt < argc)
-		return (argv[opt]);
-
-	if (fp == NULL)
-		return ((char *) 0);
-
-	if (fgets(pname, pnsize, fp)) {
-		/* Discard newline */
-		len = strlen(pname);
-		if (pname[len - 1] == '\n') {
-			pname[len - 1] = '\0';
-		}
-		return (pname);
-	}
-	return ((char *) 0);
-}
-
-extern char	*cdrecord_data;
-
-int
-main(int argc, char *argv[])
-{
-	struct directory_entry de;
-
-#ifdef HAVE_SBRK
-	unsigned long	mem_start;
-
-#endif
-	struct stat	statbuf;
-	char		*merge_image = NULL;
-	char		*reloc_root = NULL;
-	char		*reloc_old_root = NULL;
-	struct iso_directory_record *mrootp = NULL;
-	struct output_fragment *opnt;
-	int		longind;
-	char		shortopts[OPTION_COUNT * 3 + 2];
-	struct option	longopts[OPTION_COUNT + 1];
-	int		c;
-	int		n;
-	char		*log_file = 0;
-	char		*node = NULL;
-	char		*pathnames = 0;
-	FILE		*pfp = NULL;
-	char		pname[2*PATH_MAX + 1 + 1];	/* may be too short */
-	char		*arg;				/* if '\\' present  */
-	char		nodename[PATH_MAX + 1];
-	int		no_path_names = 1;
-	int		warn_violate = 0;
-	int		have_cmd_line_pathspec = 0;
-	int		rationalize_all = 0;
-
-#ifdef APPLE_HYB
-	char		*afpfile = "";	/* mapping file for TYPE/CREATOR */
-	int		hfs_ct = 0;
-	char		*root_info = 0;
-#endif	/* APPLE_HYB */
-
-
-#ifdef __EMX__
-	/* This gives wildcard expansion with Non-Posix shells with EMX */
-	_wildcard(&argc, &argv);
-#endif
-	save_args(argc, argv);
-
-	if (argc < 2) {
-#ifdef	USE_LIBSCHILY
-		errmsgno(EX_BAD, "Missing pathspec.\n");
-#endif
-		susage(1);
-	}
-	/* Get the defaults from the .mkisoimagerc file */
-	read_rcfile(argv[0]);
-
-	outfile = NULL;
-
-	/*
-	 * Copy long option initialization from GNU-ld.
-	 */
-	/*
-	 * Starting the short option string with '-' is for programs that
-	 * expect options and other ARGV-elements in any order and that care
-	 * about the ordering of the two.  We describe each non-option
-	 * ARGV-element as if it were the argument of an option with
-	 * character code 1.
-	 */
-	{
-		int		i,
-				is,
-				il;
-
-		shortopts[0] = '-';
-		is = 1;
-		il = 0;
-		for (i = 0; i < (int)OPTION_COUNT; i++) {
-			if (ld_options[i].shortopt != '\0') {
-				shortopts[is] = ld_options[i].shortopt;
-				++is;
-				if (ld_options[i].opt.has_arg ==
-					required_argument ||
-					ld_options[i].opt.has_arg ==
-							optional_argument) {
-					shortopts[is] = ':';
-					++is;
-					if (ld_options[i].opt.has_arg ==
-							optional_argument) {
-						shortopts[is] = ':';
-						++is;
-					}
-				}
-			}
-			if (ld_options[i].opt.name != NULL) {
-				longopts[il] = ld_options[i].opt;
-				++il;
-			}
-		}
-		shortopts[is] = '\0';
-		longopts[il].name = NULL;
-	}
-
-	while ((c = getopt_long_only(argc, argv, shortopts,
-						longopts, &longind)) != EOF)
-		switch (c) {
-		case 1:
-			/* A filename that we take as input. */
-			optind--;
-			have_cmd_line_pathspec = 1;
-			goto parse_input_files;
-
-		case OPTION_USE_GRAFT:
-			use_graft_ptrs = 1;
-			break;
-		case 'C':
-			/*
-			 * This is a temporary hack until cdrecord gets the
-			 * proper hooks in it.
-			 */
-			cdrecord_data = optarg;
-			break;
-		case OPTION_GUI:
-			gui++;
-			break;
-		case 'i':
-#ifdef	USE_LIBSCHILY
-			comerrno(EX_BAD, "-i option no longer supported.\n");
-#else
-			fprintf(stderr, "-i option no longer supported.\n");
-			exit(1);
-#endif
-			break;
-		case OPTION_ISO_LEVEL:
-			iso9660_level = atoi(optarg);
-
-			switch (iso9660_level) {
-
-			case 1:
-				/*
-				 * Only on file section
-				 * 8.3 d or d1 characters for files
-				 * 8   d or d1 characters for directories
-				 */
-				break;
-			case 2:
-				/*
-				 * Only on file section
-				 */
-				break;
-			case 3:
-				/*
-				 * No restrictions
-				 */
-				break;
-			case 4:
-				/*
-				 * This is ISO-9660:1988 (ISO-9660 version 2)
-				 */
-				iso9660_namelen = MAX_ISONAME_V2; /* allow 207 chars */
-				full_iso9660_filenames++;	/* 31+ chars	*/
-				omit_version_number++;
-				RR_relocation_depth = 32767;
-
-				/*
-				 * From -U ...
-				 */
-				omit_period++;			/* trailing dot */
-				allow_leading_dots++;
-				relaxed_filenames++;		/* all chars	*/
-				allow_lowercase++;		/* even lowcase	*/
-				allow_multidot++;		/* > 1 dots	*/
-				break;
-
-			default:
-				comerrno(EX_BAD, "Illegal iso9660 Level %d, use 1..3 or 4.\n",
-							iso9660_level);
-			}
-			break;
-		case 'J':
-			use_Joliet++;
-			break;
-		case OPTION_JLONG:
-			use_Joliet++;
-			jlen = JLONGMAX;
-			break;
-		case OPTION_JCHARSET:
-			use_Joliet++;
-			/* FALLTHROUGH */
-		case OPTION_INPUT_CHARSET:
-			icharset = optarg;
-			break;
-		case OPTION_OUTPUT_CHARSET:
-			ocharset = optarg;
-			break;
-#ifdef JIGDO_TEMPLATE
-		case OPTION_JTT_OUTPUT:
-			jtemplate_out = optarg;
-			break;
-		case OPTION_JTJ_OUTPUT:
-			jjigdo_out = optarg;
-			break;
-		case OPTION_JT_MD5_LIST:
-			jmd5_list = optarg;
-			break;
-		case OPTION_JT_MIN_SIZE:
-			jte_min_size = atoi(optarg);
-			if (jte_min_size < MIN_JIGDO_FILE_SIZE) {
-				fprintf(stderr, "Jigdo min size %d too small; using default %d instead\n", jte_min_size, MIN_JIGDO_FILE_SIZE);
-				jte_min_size = MIN_JIGDO_FILE_SIZE;
-			}
-			break;
-		case OPTION_JT_INCLUDE:
-			if (jte_add_include(optarg)) {
-#ifdef	USE_LIBSCHILY
-				comerrno(EX_BAD,
-				         "Failed to build jigdo-include list\n");
-#else
-				fprintf(stderr,
-				        "Failed to build jigdo-include list\n");
-				exit(1);
-#endif
-			}
-			break;
-		case OPTION_JT_EXCLUDE:
-			if (jte_add_exclude(optarg)) {
-#ifdef	USE_LIBSCHILY
-				comerrno(EX_BAD,
-				         "Failed to build jigdo-exclude list\n");
-#else
-				fprintf(stderr,
-				        "Failed to build jigdo-exclude list\n");
-				exit(1);
-#endif
-			}
-			break;
-		case OPTION_JT_PATH_MAP:
-			if (jte_add_mapping(optarg)) {
-#ifdef	USE_LIBSCHILY
-				comerrno(EX_BAD,
-				         "Failed to build jigdo mapping list\n");
-#else
-				fprintf(stderr,
-				        "Failed to build jigdo mapping list\n");
-				exit(1);
-#endif
-			}
-			break;
-#endif /* JIGDO_TEMPLATE */
-		case OPTION_NOBAK:
-			all_files = 0;
-			break;
-		case 'b':
-			do_sort++;		/* We sort bootcat/botimage */
-			use_eltorito++;
-			boot_image = optarg;	/* pathname of the boot image */
-						/* on disk */
-			if (boot_image == NULL) {
-#ifdef	USE_LIBSCHILY
-				comerrno(EX_BAD,
-				"Required Eltorito boot image pathname missing\n");
-#else
-				fprintf(stderr,
-				"Required Eltorito boot image pathname missing\n");
-				exit(1);
-#endif
-			}
-			get_boot_entry();
-			current_boot_entry->boot_image = boot_image;
-			break;
-		case OPTION_ALT_BOOT:
-			/*
-			 * Start new boot entry parameter list.
-			 */
-			new_boot_entry();
-			break;
-		case OPTION_BOOTALPHA:
-			use_alphaboot++;
-			/* list of pathnames of boot images */
-			add_boot_alpha_filename(optarg);
-			break;
-		case OPTION_HPPA_CMDLINE:
-			use_hppaboot++;
-			add_boot_hppa_cmdline(optarg);
-			break;
-		case OPTION_HPPA_KERNEL_32:
-			use_hppaboot++;
-			add_boot_hppa_kernel_32(optarg);
-			break;
-		case OPTION_HPPA_KERNEL_64:
-			use_hppaboot++;
-			add_boot_hppa_kernel_64(optarg);
-			break;
-		case OPTION_HPPA_BOOTLOADER:
-			use_hppaboot++;
-			add_boot_hppa_bootloader(optarg);
-			break;
-		case OPTION_HPPA_RAMDISK:
-			use_hppaboot++;
-			/* list of pathnames of boot images */
-			add_boot_hppa_ramdisk(optarg);
-			break;
-		case OPTION_BOOTMIPS:
-			use_mipsboot++;
-			/* list of pathnames of boot images */
-			add_boot_mips_filename(optarg);
-			break;
-		case OPTION_BOOTMIPSEL:
-			use_mipselboot++;
-			add_boot_mipsel_filename(optarg);
-			break;
-		case 'B':
-			if (use_sunx86boot)
-				comerrno(EX_BAD,
-				"-sparc-boot and -sunx86-boot are mutual exclusive.\n");
-			use_sparcboot++;
-			/* list of pathnames of boot images */
-			scan_sparc_boot(optarg);
-			break;
-		case OPTION_SUNX86BOOT:
-			if (use_sparcboot)
-				comerrno(EX_BAD,
-				"-sparc-boot and -sunx86-boot are mutual exclusive.\n");
-			use_sunx86boot++;
-			/* list of pathnames of boot images */
-			scan_sunx86_boot(optarg);
-			break;
-		case 'G':
-			use_genboot++;
-			/* pathname of the boot image on disk */
-			genboot_image = optarg;
-			if (genboot_image == NULL) {
-#ifdef	USE_LIBSCHILY
-				comerrno(EX_BAD,
-				"Required generic boot image pathname missing\n");
-#else
-				fprintf(stderr,
-				"Required generic boot image pathname missing\n");
-				exit(1);
-#endif
-			}
-			break;
-		case OPTION_SPARCLABEL:
-			/* Sun disk label string */
-			sparc_boot_label(optarg);
-			break;
-		case OPTION_SUNX86LABEL:
-			/* Sun disk label string */
-			sunx86_boot_label(optarg);
-			break;
-		case 'c':
-			use_eltorito++;
-			/* pathname of the boot image on cd */
-			boot_catalog = optarg;
-			if (boot_catalog == NULL) {
-#ifdef	USE_LIBSCHILY
-				comerrno(EX_BAD,
-				"Required boot catalog pathname missing\n");
-#else
-				fprintf(stderr,
-				"Required boot catalog pathname missing\n");
-				exit(1);
-#endif
-			}
-			break;
-		case OPTION_ABSTRACT:
-			abstract = optarg;
-			if (strlen(abstract) > 37) {
-#ifdef	USE_LIBSCHILY
-				comerrno(EX_BAD,
-				"Abstract filename string too long\n");
-#else
-				fprintf(stderr,
-				"Abstract filename string too long\n");
-				exit(1);
-#endif
-			}
-			break;
-		case 'A':
-			appid = optarg;
-			if (strlen(appid) > 128) {
-#ifdef	USE_LIBSCHILY
-				comerrno(EX_BAD,
-				"Application-id string too long\n");
-#else
-				fprintf(stderr,
-				"Application-id string too long\n");
-				exit(1);
-#endif
-			}
-			break;
-		case OPTION_BIBLIO:
-			biblio = optarg;
-			if (strlen(biblio) > 37) {
-#ifdef	USE_LIBSCHILY
-				comerrno(EX_BAD,
-				"Bibliographic filename string too long\n");
-#else
-				fprintf(stderr,
-				"Bibliographic filename string too long\n");
-				exit(1);
-#endif
-			}
-			break;
-		case OPTION_CACHE_INODES:
-			cache_inodes = 1;
-			break;
-		case OPTION_NOCACHE_INODES:
-			cache_inodes = 0;
-			break;
-		case OPTION_CHECK_OLDNAMES:
-			check_oldnames++;
-			break;
-		case OPTION_CHECK_SESSION:
-			check_session++;
-			check_oldnames++;
-			merge_image = optarg;
-			outfile = "/dev/null";
-			/*
-			 * cdrecord_data is handled specially in multi.c
-			 * as we cannot write to all strings.
-			 * If mkisoimage is called with -C xx,yy
-			 * our default is overwritten.
-			 */
-/*			cdrecord_data = "0,0";*/
-			break;
-		case OPTION_COPYRIGHT:
-			copyright = optarg;
-			if (strlen(copyright) > 37) {
-#ifdef	USE_LIBSCHILY
-				comerrno(EX_BAD,
-				"Copyright filename string too long\n");
-#else
-				fprintf(stderr,
-				"Copyright filename string too long\n");
-				exit(1);
-#endif
-			}
-			break;
-		case OPTION_DEBUG:
-			debug++;
-			break;
-		case 'd':
-			omit_period++;
-			warn_violate++;
-			break;
-		case 'D':
-			RR_relocation_depth = 32767;
-			break;
-		case 'f':
-			follow_links++;
-#ifdef	USE_LIBSCHILY
-			errmsgno(EX_BAD,
-			"Warning: -follow-links does not always work correctly; be careful.\n");
-#else
-			fprintf(stderr,
-			"Warning: -follow-links does not always work correctly; be careful.\n");
-#endif
-			break;
-		case 'l':
-			full_iso9660_filenames++;
-			break;
-		case OPTION_MAX_FILENAMES:
-			iso9660_namelen = MAX_ISONAME_V1; /* allow 37 chars */
-			full_iso9660_filenames++;
-			omit_version_number++;
-			warn_violate++;
-			break;
-		case 'L':
-			errmsgno(EX_BAD, "The option '-L' is reserved by POSIX.1-2001.\n");
-			errmsgno(EX_BAD, "The option '-L' means 'follow all symbolic links'.\n");
-			errmsgno(EX_BAD, "Mkisofs-2.02 will introduce POSIX semantics for '-L'.\n");
-			errmsgno(EX_BAD, "Use -allow-leading-dots in future to get old mkisoimage behavior.\n");
-			/* FALLTHRU */
-		case OPTION_ALLOW_LEADING_DOTS:
-			/*
-			 * -L Reserved by POSIX.1-2001
-			 * Meaning: Follow all symbolic links
-			 */
-			allow_leading_dots++;
-			warn_violate++;
-			break;
-		case OPTION_LOG_FILE:
-			log_file = optarg;
-			break;
-		case 'M':
-			merge_image = optarg;
-			break;
-		case OPTION_RELOC_ROOT:
-			reloc_root = optarg;
-			break;
-		case OPTION_RELOC_OLD_ROOT:
-			reloc_old_root = optarg;
-			break;
-		case 'N':
-			omit_version_number++;
-			warn_violate++;
-			break;
-		case OPTION_FORCE_RR:
-			force_rr++;
-			break;
-		case OPTION_NO_RR:
-			no_rr++;
-			break;
-		case 'o':
-			outfile = optarg;
-			break;
-		case OPTION_PAD:
-			dopad++;
-			break;
-		case OPTION_NOPAD:
-			dopad = 0;
-			break;
-		case OPTION_P_LIST:
-			pathnames = optarg;
-			break;
-		case 'p':
-			preparer = optarg;
-			if (strlen(preparer) > 128) {
-#ifdef	USE_LIBSCHILY
-				comerrno(EX_BAD, "Preparer string too long\n");
-#else
-				fprintf(stderr, "Preparer string too long\n");
-				exit(1);
-#endif
-			}
-			break;
-		case OPTION_PRINT_SIZE:
-			print_size++;
-			break;
-		case 'P':
-			errmsgno(EX_BAD, "The option '-P' is reserved by POSIX.1-2001.\n");
-			errmsgno(EX_BAD, "The option '-P' means 'do not follow symbolic links'.\n");
-			errmsgno(EX_BAD, "Mkisofs-2.02 will introduce POSIX semantics for '-P'.\n");
-			errmsgno(EX_BAD, "Use -publisher in future to get old mkisoimage behavior.\n");
-			/* FALLTHRU */
-		case OPTION_PUBLISHER:
-			/*
-			 * -P Reserved by POSIX.1-2001
-			 * Meaning: Do not follow symbolic links
-			 */
-			publisher = optarg;
-			if (strlen(publisher) > 128) {
-#ifdef	USE_LIBSCHILY
-				comerrno(EX_BAD,
-						"Publisher string too long\n");
-#else
-				fprintf(stderr, "Publisher string too long\n");
-				exit(1);
-#endif
-			}
-			break;
-		case OPTION_QUIET:
-			verbose = 0;
-			break;
-		case 'R':
-			use_RockRidge++;
-			break;
-		case 'r':
-			rationalize_all++;
-			use_RockRidge++;
-			break;
-		case OPTION_XA:
-			use_XA++;
-			break;
-		case OPTION_XA_RATIONALIZED:
-			rationalize_all++;
-			use_XA++;
-			break;
-
-		case 's':
-			if (strcmp(optarg, "data") == 0)
-				osecsize = 2048;
-			else if (strcmp(optarg, "xa1") == 0)
-				osecsize = 2056;
-			else if (strcmp(optarg, "raw") == 0) {
-				osecsize = 2352;
-				comerrno(EX_BAD,
-					"Unsupported sector type '%s'.\n",
-					optarg);
-			}
-			break;
-		case 'S':
-#ifdef	USE_LIBSCHILY
-			errmsgno(EX_BAD, "Option -%c is reserved for future use.\n", c);
-#else
-			fprintf(stderr, "Option -%c is reserved for future use.\n", c);
-#endif
-			susage(1);
-			/* NOTREACHED */
-
-		case OPTION_NEW_DIR_MODE:
-			rationalize++;
-		{
-			char	*end = 0;
-
-			new_dir_mode = strtol(optarg, &end, 8);
-			if (!end || *end != 0 ||
-			    new_dir_mode < 0 || new_dir_mode > 07777) {
-#ifdef	USE_LIBSCHILY
-				comerrno(EX_BAD, "Bad mode for -new-dir-mode\n");
-#else
-				fprintf(stderr, "Bad mode for -new-dir-mode\n");
-				exit(1);
-#endif
-			}
-			break;
-		}
-
-		case OPTION_UID:
-			rationalize++;
-			use_RockRidge++;
-			rationalize_uid++;
-		{
-			char	*end = 0;
-
-			uid_to_use = strtol(optarg, &end, 0);
-			if (!end || *end != 0) {
-#ifdef	USE_LIBSCHILY
-				comerrno(EX_BAD, "Bad value for -uid\n");
-#else
-				fprintf(stderr, "Bad value for -uid\n");
-				exit(1);
-#endif
-			}
-			break;
-		}
-
-		case OPTION_GID:
-			rationalize++;
-			use_RockRidge++;
-			rationalize_gid++;
-		{
-			char	*end = 0;
-
-			gid_to_use = strtol(optarg, &end, 0);
-			if (!end || *end != 0) {
-#ifdef	USE_LIBSCHILY
-				comerrno(EX_BAD, "Bad value for -gid\n");
-#else
-				fprintf(stderr, "Bad value for -gid\n");
-				exit(1);
-#endif
-			}
-			break;
-		}
-
-		case OPTION_FILEMODE:
-			rationalize++;
-			use_RockRidge++;
-			rationalize_filemode++;
-		{
-			char	*end = 0;
-
-			filemode_to_use = strtol(optarg, &end, 8);
-			if (!end || *end != 0 ||
-			    filemode_to_use < 0 || filemode_to_use > 07777) {
-#ifdef	USE_LIBSCHILY
-				comerrno(EX_BAD, "Bad mode for -file-mode\n");
-#else
-				fprintf(stderr, "Bad mode for -file-mode\n");
-				exit(1);
-#endif
-			}
-			break;
-		}
-
-		case OPTION_DIRMODE:
-			rationalize++;
-			use_RockRidge++;
-			rationalize_dirmode++;
-		{
-			char	*end = 0;
-
-			dirmode_to_use = strtol(optarg, &end, 8);
-			if (!end || *end != 0 ||
-			    dirmode_to_use < 0 || dirmode_to_use > 07777) {
-#ifdef	USE_LIBSCHILY
-				comerrno(EX_BAD, "Bad mode for -dir-mode\n");
-#else
-				fprintf(stderr, "Bad mode for -dir-mode\n");
-				exit(1);
-#endif
-			}
-			break;
-		}
-
-#ifdef SORTING
-		case OPTION_SORT:
-			do_sort++;
-			add_sort_list(optarg);
-			break;
-#endif /* SORTING */
-
-		case OPTION_SPLIT_OUTPUT:
-			split_output++;
-			break;
-
-		case OPTION_STREAM_FILE_NAME:
-			comerrno(EX_BAD, "-stream-file-name not yet implemented\n");
-			stream_filename = optarg;
-			break;
-
-		case OPTION_STREAM_CD_SIZE:
-			stream_media_size = atoi(optarg);
-			break;
-
-		case OPTION_SYSID:
-			system_id = optarg;
-			if (strlen(system_id) > 32) {
-#ifdef	USE_LIBSCHILY
-				comerrno(EX_BAD,
-						"System ID string too long\n");
-#else
-				fprintf(stderr, "System ID string too long\n");
-				exit(1);
-#endif
-			}
-			break;
-		case OPTION_TRANS_TBL:
-			trans_tbl = optarg;
-			/* FALLTHRU */
-		case 'T':
-			generate_tables++;
-			break;
-		case OPTION_UCS_LEVEL:
-			ucs_level = atoi(optarg);
-			if (ucs_level < 1 || ucs_level > 3)
-				comerrno(EX_BAD, "Illegal UCS Level %d, use 1..3.\n",
-							ucs_level);
-			break;
-#ifdef UDF
-		case OPTION_UDF:
-			use_udf++;
-			break;
-#endif
-
-#ifdef DVD_VIDEO
-		case OPTION_DVD:
-			use_udf++;
-			dvd_video++;
-			break;
-#endif
-		case OPTION_USE_FILEVERSION:
-			use_fileversion++;
-			break;
-		case 'U':
-			/*
-			 * Minimal (only truncation of 31+ characters)
-			 * translation of filenames.
-			 *
-			 * Forces -l, -d, -N, -allow-leading-dots,
-			 * -relaxed-filenames,
-			 * -allow-lowercase, -allow-multidot
-			 *
-			 * This is for HP-UX, which does not recognize ANY
-			 * extentions (Rock Ridge, Joliet), causing pain when
-			 * loading software. pfs_mount can be used to read the
-			 * extensions, but the untranslated filenames can be
-			 * read by the "native" cdfs mounter. Completely
-			 * violates iso9660.
-			 */
-			full_iso9660_filenames++;	/* 31 chars	*/
-			omit_period++;			/* trailing dot */
-			allow_leading_dots++;
-			omit_version_number++;
-			relaxed_filenames++;		/* all chars	*/
-			allow_lowercase++;		/* even lowcase	*/
-			allow_multidot++;		/* > 1 dots	*/
-			warn_violate++;
-			break;
-
-		case OPTION_RELAXED_FILENAMES:
-			relaxed_filenames++;
-			warn_violate++;
-			break;
-		case OPTION_ALLOW_LOWERCASE:
-			allow_lowercase++;
-			warn_violate++;
-			break;
-		case OPTION_ALLOW_MULTIDOT:
-			allow_multidot++;
-			warn_violate++;
-			break;
-		case OPTION_ISO_TRANSLATE:
-			iso_translate = 0;
-			warn_violate++;
-			break;
-		case 'V':
-			volume_id = optarg;
-			if (strlen(volume_id) > 32) {
-#ifdef	USE_LIBSCHILY
-				comerrno(EX_BAD,
-					"Volume ID string too long\n");
-#else
-				fprintf(stderr,
-					"Volume ID string too long\n");
-				exit(1);
-#endif
-			}
-			break;
-		case OPTION_VOLSET:
-			volset_id = optarg;
-			if (strlen(volset_id) > 128) {
-#ifdef	USE_LIBSCHILY
-				comerrno(EX_BAD,
-				"Volume set ID string too long\n");
-#else
-				fprintf(stderr,
-				"Volume set ID string too long\n");
-				exit(1);
-#endif
-			}
-			break;
-		case OPTION_VOLSET_SIZE:
-			volume_set_size = atoi(optarg);
-			if (volume_set_size <= 0) {
-#ifdef	USE_LIBSCHILY
-				comerrno(EX_BAD,
-				"Illegal Volume Set Size %s\n", optarg);
-#else
-				fprintf(stderr,
-				"Illegal Volume Set Size %s\n", optarg);
-				exit(1);
-#endif
-			}
-			if (volume_set_size > 1) {
-#ifdef	USE_LIBSCHILY
-				comerrno(EX_BAD,
-				"Volume Set Size > 1 not yet supported\n");
-#else
-				fprintf(stderr,
-				"Volume Set Size > 1 not yet supported\n");
-				exit(1);
-#endif
-			}
-			break;
-		case OPTION_VOLSET_SEQ_NUM:
-			volume_sequence_number = atoi(optarg);
-			if (volume_sequence_number > volume_set_size) {
-#ifdef	USE_LIBSCHILY
-				comerrno(EX_BAD,
-				"Volume set sequence number too big\n");
-#else
-				fprintf(stderr,
-				"Volume set sequence number too big\n");
-				exit(1);
-#endif
-			}
-			break;
-		case 'v':
-			verbose++;
-			break;
-		case 'z':
-#ifdef VMS
-#ifdef	USE_LIBSCHILY
-			comerrno(EX_BAD,
-			"Transparent compression not supported with VMS\n");
-#else
-			fprintf(stderr,
-			"Transparent compression not supported with VMS\n");
-			exit(1);
-#endif
-#else
-			transparent_compression++;
-#endif
-			break;
-		case 'x':
-		case 'm':
-			/*
-			 * Somehow two options to do basically the same thing
-			 * got added somewhere along the way.  The 'match'
-			 * code supports limited globbing, so this is the one
-			 * that got selected. Unfortunately the 'x' switch is
-			 * probably more intuitive.
-			 */
-			add_match(optarg);
-			break;
-		case OPTION_X_LIST:
-			add_list(optarg);
-			break;
-		case OPTION_I_HIDE:
-			i_add_match(optarg);
-			break;
-		case OPTION_I_LIST:
-			i_add_list(optarg);
-			break;
-		case OPTION_H_HIDE:
-			h_add_match(optarg);
-			break;
-		case OPTION_H_LIST:
-			h_add_list(optarg);
-			break;
-		case OPTION_J_HIDE:
-			j_add_match(optarg);
-			break;
-		case OPTION_J_LIST:
-			j_add_list(optarg);
-			break;
-		case OPTION_HIDE_TRANS_TBL:
-			jhide_trans_tbl++;
-			break;
-		case OPTION_HIDE_RR_MOVED:
-			hide_rr_moved++;
-			break;
-		case OPTION_HELP:
-			usage(0);
-			break;
-		case OPTION_PVERSION:
-			printf("%s (%s)\n", version_string, HOST_SYSTEM);
-#ifdef	OPTION_SILO_BOOT
-			printf("Warning: this is unofficial (modified) version of mkisoimage that incorporates\n");
-			printf("	support for a non Sparc compliant boot method called SILO.\n");
-			printf("	The official method to create Sparc boot CDs is to use -sparc-boot\n");
-			printf("	In case of problems first test with an official version of mkisoimage.\n");
-#endif
-			exit(0);
-			break;
-		case OPTION_NOSPLIT_SL_COMPONENT:
-			split_SL_component = 0;
-			break;
-		case OPTION_NOSPLIT_SL_FIELD:
-			split_SL_field = 0;
-			break;
-		case OPTION_HARD_DISK_BOOT:
-			use_eltorito++;
-			hard_disk_boot++;
-			get_boot_entry();
-			current_boot_entry->hard_disk_boot = 1;
-			break;
-		case OPTION_NO_EMUL_BOOT:
-			use_eltorito++;
-			no_emul_boot++;
-			get_boot_entry();
-			current_boot_entry->no_emul_boot = 1;
-			break;
-		case OPTION_NO_BOOT:
-			use_eltorito++;
-			not_bootable++;
-			get_boot_entry();
-			current_boot_entry->not_bootable = 1;
-			break;
-		case OPTION_BOOT_LOAD_ADDR:
-			use_eltorito++;
-			{
-				long	val;
-				char	*ptr;
-
-				val = strtol(optarg, &ptr, 0);
-				if (*ptr || val < 0 || val >= 0x10000) {
-#ifdef	USE_LIBSCHILY
-					comerrno(EX_BAD, "Boot image load address invalid.\n");
-#else
-					fprintf(stderr, "Boot image load address invalid.\n");
-					exit(1);
-#endif
-				}
-				load_addr = val;
-			}
-			get_boot_entry();
-			current_boot_entry->load_addr = load_addr;
-			break;
-		case OPTION_BOOT_LOAD_SIZE:
-			use_eltorito++;
-			{
-				long	val;
-				char	*ptr;
-
-				val = strtol(optarg, &ptr, 0);
-				if (*ptr || val < 0 || val >= 0x10000) {
-#ifdef	USE_LIBSCHILY
-					comerrno(EX_BAD,
-					"Boot image load size invalid.\n");
-#else
-					fprintf(stderr,
-					"Boot image load size invalid.\n");
-					exit(1);
-#endif
-				}
-				load_size = val;
-			}
-			get_boot_entry();
-			current_boot_entry->load_size = load_size;
-			break;
-		case OPTION_BOOT_INFO_TABLE:
-			use_eltorito++;
-			boot_info_table++;
-			get_boot_entry();
-			current_boot_entry->boot_info_table = 1;
-			break;
-#ifdef APPLE_HYB
-		case OPTION_HFS_TYPE:
-			deftype = optarg;
-			hfs_ct++;
-			if (strlen(deftype) != 4) {
-#ifdef	USE_LIBSCHILY
-				comerrno(EX_BAD,
-				"HFS default TYPE string has illegal length.\n");
-#else
-				fprintf(stderr,
-				"HFS default TYPE string has illegal length.\n");
-				exit(1);
-#endif
-			}
-			break;
-		case OPTION_HFS_CREATOR:
-			defcreator = optarg;
-			hfs_ct++;
-			if (strlen(defcreator) != 4) {
-#ifdef	USE_LIBSCHILY
-				comerrno(EX_BAD,
-				"HFS default CREATOR string has illegal length.\n");
-#else
-				fprintf(stderr,
-				"HFS default CREATOR string has illegal length.\n");
-				exit(1);
-#endif
-			}
-			break;
-		case 'H':
-			errmsgno(EX_BAD, "The option '-H' is reserved by POSIX.1-2001.\n");
-			errmsgno(EX_BAD, "The option '-H' means 'follow symbolic links on command line'.\n");
-			errmsgno(EX_BAD, "Mkisofs-2.02 will introduce POSIX semantics for '-H'.\n");
-			errmsgno(EX_BAD, "Use -map in future to get old mkisoimage behavior.\n");
-			/* FALLTHRU */
-		case OPTION_MAP_FILE:
-			/*
-			 * -H Reserved by POSIX.1-2001
-			 * Meaning: Follow symbolic links on command line
-			 * Symbolic links found by tree traversal are not
-			 * followed.
-			 */
-			afpfile = optarg;
-			hfs_last = MAP_LAST;
-			break;
-		case 'h':
-			apple_hyb = 1;
-			break;
-		case 'g':
-			apple_ext = 1;
-			break;
-		case OPTION_PROBE:
-			probe = 1;
-			break;
-		case OPTION_MACNAME:
-			use_mac_name = 1;
-			break;
-		case OPTION_NOMACFILES:
-#ifdef	USE_LIBSCHILY
-			errmsgno(EX_BAD,
-			"Warning: -no-mac-files no longer used ... ignoring\n");
-#else
-			fprintf(stderr,
-			"Warning: -no-mac-files no longer used ... ignoring\n");
-#endif
-			break;
-		case OPTION_BOOT_HFS_FILE:
-			hfs_boot_file = optarg;
-			/* FALLTHRU */
-		case OPTION_GEN_PT:
-			gen_pt = 1;
-			break;
-		case OPTION_MAGIC_FILE:
-#ifndef USE_MAGIC
-			fprintf(stderr, "This program has been compiled without magic library support.\n"
-				"Ignoring the -magic option.\n");
-#endif
-			magic_filename = optarg;
-			hfs_last = MAG_LAST;
-			break;
-		case OPTION_AUTOSTART:
-			autoname = optarg;
-			/* gen_pt = 1; */
-			break;
-		case OPTION_BSIZE:
-			afe_size = atoi(optarg);
-			hfs_select |= DO_FEU;
-			hfs_select |= DO_FEL;
-			break;
-		case OPTION_HFS_VOLID:
-			hfs_volume_id = optarg;
-			break;
-		case OPTION_ROOT_INFO:
-			root_info = optarg;
-			/* FALLTHRU */
-		case OPTION_ICON_POS:
-			icon_pos = 1;
-			break;
-		/* Mac/Unix types to include */
-		case OPTION_CAP:
-			hfs_select |= DO_CAP;
-			break;
-		case OPTION_NETA:
-			hfs_select |= DO_NETA;
-			break;
-		case OPTION_DBL:
-			hfs_select |= DO_DBL;
-			break;
-		case OPTION_ESH:
-		case OPTION_USH:
-			hfs_select |= DO_ESH;
-			break;
-		case OPTION_FE:
-			hfs_select |= DO_FEU;
-			hfs_select |= DO_FEL;
-			break;
-		case OPTION_SGI:
-		case OPTION_XIN:
-			hfs_select |= DO_SGI;
-			break;
-		case OPTION_MBIN:
-			hfs_select |= DO_MBIN;
-			break;
-		case OPTION_SGL:
-			hfs_select |= DO_SGL;
-			break;
-		case OPTION_DAVE:
-			hfs_select |= DO_DAVE;
-			break;
-		case OPTION_SFM:
-			hfs_select |= DO_SFM;
-			break;
-		case OPTION_XDBL:
-			hfs_select |= DO_XDBL;
-			break;
-		case OPTION_XHFS:
-#ifdef IS_MACOS_X
-			hfs_select |= DO_XHFS;
-#else /* IS_MACOS_X */
-#ifdef	USE_LIBSCHILY
-			errmsgno(EX_BAD,
-			"Warning: --osx-hfs only works on MacOS X ... ignoring\n");
-#else /* USE_LIBSCHILY */
-			fprintf(stderr,
-			"Warning: --osx-hfs only works on MacOS X ... ignoring\n");
-#endif /* USE_LIBSCHILY */
-#endif /* IS_MACOS_X */
-			break;
-		case OPTION_CREATE_DT:
-			create_dt = 0;
-			break;
-		case OPTION_HFS_HIDE:
-			hfs_add_match(optarg);
-			break;
-		case OPTION_HFS_LIST:
-			hfs_add_list(optarg);
-			break;
-		case OPTION_HFS_INPUT_CHARSET:
-			use_mac_name = 1;
-			hfs_icharset = optarg;
-			break;
-		case OPTION_HFS_OUTPUT_CHARSET:
-			hfs_ocharset = optarg;
-			break;
-		case OPTION_HFS_UNLOCK:
-			hfs_lock = 0;
-			break;
-		case OPTION_HFS_BLESS:
-			hfs_bless = optarg;
-			break;
-		case OPTION_HFS_PARMS:
-			hfs_parms = strdup(optarg);
-			break;
-#ifdef PREP_BOOT
-		case OPTION_PREP_BOOT:
-			use_prep_boot++;
-			if (use_prep_boot > 4 - use_chrp_boot) {
-#ifdef	USE_LIBSCHILY
-				comerrno(EX_BAD,
-				"Maximum of 4 PRep+CHRP partition entries are allowed\n");
-#else
-				fprintf(stderr,
-				"Maximum of 4 PRep+CHRP partition entries are allowed\n");
-#endif
-				exit(1);
-			}
-			/* pathname of the boot image on cd */
-			prep_boot_image[use_prep_boot - 1] = optarg;
-			if (prep_boot_image[use_prep_boot - 1] == NULL) {
-#ifdef	USE_LIBSCHILY
-				comerrno(EX_BAD,
-				"Required PReP boot image pathname missing\n");
-#else
-				fprintf(stderr,
-				"Required PReP boot image pathname missing\n");
-#endif
-				exit(1);
-			}
-			break;
-		case OPTION_CHRP_BOOT:
-			if (use_chrp_boot)
-				break;		/* silently allow duplicates */
-			use_chrp_boot = 1;
-			if (use_prep_boot > 3) {
-#ifdef USE_LIBSCHILY
-				comerrno(EX_BAD,
-				"Maximum of 4 PRep+CHRP partition entries are allowed\n");
-#else
-				fprintf(stderr,
-				"Maximum of 4 PRep+CHRP partition entries are allowed\n");
-#endif
-				exit(1);
-			}
-			break;
-#endif	/* PREP_BOOT */
-#endif	/* APPLE_HYB */
-		default:
-			susage(1);
-		}
-	/*
-	 * "--" was found, the next argument is a pathspec
-	 */
-	if (argc != optind)
-		have_cmd_line_pathspec = 1;
-
-parse_input_files:
-	path_ind = optind;
-
-	/*
-	 * XXX This is a hack until we have a decent separate name handling
-	 * XXX for UDF filenames.
-	 */
-	if (dvd_video && use_Joliet) {
-		use_Joliet = 0;
-		fprintf(stderr, "Warning: Disabling Joliet support for DVD-Video.\n");
-	}
-	if (use_udf && !use_Joliet)
-		jlen = 255;
-
-	if (use_RockRidge && (iso9660_namelen > MAX_ISONAME_V2_RR))
-		iso9660_namelen = MAX_ISONAME_V2_RR;
-
-	if (warn_violate)
-		fprintf(stderr, "Warning: creating filesystem that does not conform to ISO-9660.\n");
-	if (iso9660_level > 3)
-		fprintf(stderr, "Warning: Creating ISO-9660:1999 (version 2) filesystem.\n");
-	if (iso9660_namelen > LEN_ISONAME)
-		fprintf(stderr, "Warning: ISO-9660 filenames longer than %d may cause buffer overflows in the OS.\n",
-			LEN_ISONAME);
-	if (use_Joliet && !use_RockRidge) {
-		fprintf(stderr, "Warning: creating filesystem with (nonstandard) Joliet extensions\n");
-		fprintf(stderr, "         but without (standard) Rock Ridge extensions.\n");
-		fprintf(stderr, "         It is highly recommended to add Rock Ridge\n");
-	}
-	if (transparent_compression) {
-		fprintf(stderr, "Warning: using transparent compression. This is a nonstandard Rock Ridge\n");
-		fprintf(stderr, "         extension. The resulting filesystem can only be transparently\n");
-		fprintf(stderr, "         read on Linux. On other operating systems you need to call\n");
-		fprintf(stderr, "         mkzftree by hand to decompress the files.\n");
-	}
-	if (transparent_compression && !use_RockRidge) {
-		fprintf(stderr, "Warning: transparent decompression is a Linux Rock Ridge extension, but\n");
-		fprintf(stderr, "         creating filesystem without Rock Ridge attributes; files\n");
-		fprintf(stderr, "         will not be transparently decompressed.\n");
-	}
-	init_unls();		/* Initialize UNICODE tables */
-
-	/* initialize code tables from a file - if they exists */
-	init_unls_file(icharset);
-	init_unls_file(ocharset);
-#ifdef APPLE_HYB
-	init_unls_file(hfs_icharset);
-	init_unls_file(hfs_ocharset);
-#endif /* APPLE_HYB */
-
-#ifdef USE_ICONV
-	iconv_possible = !(iso9660_level >= 4 || ((ocharset &&
-		strcmp(ocharset, icharset ? icharset : "")) &&
-		use_RockRidge) || apple_ext || apple_hyb);
-
-	setlocale(LC_CTYPE, "");
-	
-  	if (icharset == NULL && iconv_possible) {
-		char *charset = nl_langinfo(CODESET);
-		/* set to detected value but only if it is not pure US-ASCII */
-  	if(charset) { /* workaround for SunOS, iconv is case-sensitive */
- 			char *t;
- 			charset = strdup(charset);
- 			for(t=charset;*t!='\0';t++)
- 				*t=tolower(*t);
- 		}
-
-		if(strcmp(charset, "ansi_x3.4-1968") != 0)
-			icharset = charset;
-
-		if(icharset && verbose > 0)
-			fprintf(stderr, "I: -input-charset not specified, using %s (detected in locale settings)\n",
-			icharset);
-	}
-
-	if(iconv_possible) {
-		/*
-		 * don't care if initialization fails
-		 */
-		init_nls_iconv(icharset);
-		init_nls_iconv(ocharset);
-	}
-#endif
-
-	if (icharset == NULL) {
-#if	(defined(__CYGWIN32__) || defined(__CYGWIN__) || defined(__DJGPP__)) && !defined(IS_CYGWIN_1)
-		in_nls = load_unls("cp437");
-#else
-		in_nls = load_unls("iso8859-1");
-#endif
-	} else {
-		if (strcmp(icharset, "default") == 0)
-			in_nls = load_unls_default();
-		else
-			in_nls = load_unls(icharset);
-	}
-	/*
-	 * set the output charset to the same as the input or the given output
-	 * charset
-	 */
-	if (ocharset == NULL) {
-		out_nls = in_nls;
-	} else {
-		if (strcmp(ocharset, "default") == 0)
-			out_nls = load_unls_default();
-		else
-			out_nls = load_unls(ocharset);
-	}
-	if (in_nls == NULL || out_nls == NULL) { /* Unknown charset specified */
-		fprintf(stderr, "Unknown charset\nKnown charsets are:\n");
-		list_unls();	/* List all known charset names */
-#ifdef USE_ICONV
-        fprintf(stderr, "\nAdditional input charsets are available for Joliet through the iconv support."
-                "\nRun \"iconv -l\" to display them. Iconv charsets cannot be used with HFS, Apple"
-                "\nextension, ISO9660 version 2 or Rock Ridge.\n"
-                "\nIMPORTANT: never report problems with charset support directly"
-                "\nto Joerg Schilling! Report them to debburn-devel at lists.alioth.debian.org.\n");
-#endif
-		exit(1);
-	}
-
-
-#ifdef APPLE_HYB
-	if (hfs_icharset == NULL || strcmp(hfs_icharset, "mac-roman")) {
-		hfs_inls = load_unls("cp10000");
-	} else {
-		if (strcmp(hfs_icharset, "default") == 0)
-			hfs_inls = load_unls_default();
-		else
-			hfs_inls = load_unls(hfs_icharset);
-	}
-	if (hfs_ocharset == NULL) {
-		hfs_onls = hfs_inls;
-	} else {
-		if (strcmp(hfs_ocharset, "default") == 0)
-			hfs_onls = load_unls_default();
-		else if (strcmp(hfs_ocharset, "mac-roman") == 0)
-			hfs_onls = load_unls("cp10000");
-		else
-			hfs_onls = load_unls(hfs_ocharset);
-	}
-
-	if (hfs_inls == NULL || hfs_onls == NULL) {
-		fprintf(stderr, "Unknown HFS charset\nKnown charsets are:\n");
-		list_unls();
-		exit(1);
-	}
-#endif /* APPLE_HYB */
-
-	if (merge_image != NULL) {
-		if (open_merge_image(merge_image) < 0) {
-			/* Complain and die. */
-#ifdef	USE_LIBSCHILY
-			comerr("Unable to open previous session image '%s'.\n",
-				merge_image);
-#else
-			fprintf(stderr,
-				"Unable to open previous session image '%s'.\n",
-				merge_image);
-			exit(1);
-#endif
-		}
-	}
-	/* We don't need root privilleges anymore. */
-#ifdef	HAVE_SETREUID
-	if (setreuid(-1, getuid()) < 0)
-#else
-#ifdef	HAVE_SETEUID
-	if (seteuid(getuid()) < 0)
-#else
-	if (setuid(getuid()) < 0)
-#endif
-#endif
-#ifdef	USE_LIBSCHILY
-		comerr("Panic cannot set back effective uid.\n");
-#else
-	{
-		perror("Panic cannot set back effective uid.");
-		exit(1);
-	}
-#endif
-
-
-#ifdef	no_more_needed
-#ifdef __NetBSD__
-	{
-		int		resource;
-		struct rlimit	rlp;
-
-		if (getrlimit(RLIMIT_DATA, &rlp) == -1)
-			perror("Warning: getrlimit");
-		else {
-			rlp.rlim_cur = 33554432;
-			if (setrlimit(RLIMIT_DATA, &rlp) == -1)
-				perror("Warning: setrlimit");
-		}
-	}
-#endif
-#endif	/* no_more_needed */
-#ifdef HAVE_SBRK
-	mem_start = (unsigned long) sbrk(0);
-#endif
-
-	/*
-	 * if the -hide-joliet option has been given, set the Joliet option
-	 */
-	if (!use_Joliet && j_ishidden())
-		use_Joliet++;
-
-#ifdef APPLE_HYB
-	if (apple_hyb && apple_ext) {
-#ifdef	USE_LIBSCHILY
-		comerrno(EX_BAD, "Can't have both -apple and -hfs options");
-#else
-		fprintf(stderr, "Can't have both -apple and -hfs options");
-		exit(1);
-#endif
-	}
-	/*
-	 * if -probe, -macname, any hfs selection and/or mapping file is given,
-	 * but no HFS option, then select apple_hyb
-	 */
-	if (!apple_hyb && !apple_ext) {
-		if (*afpfile || probe || use_mac_name || hfs_select ||
-				hfs_boot_file || magic_filename ||
-				hfs_ishidden() || gen_pt || autoname ||
-				afe_size || icon_pos || hfs_ct ||
-				hfs_icharset || hfs_ocharset) {
-			apple_hyb = 1;
-		}
-	}
-	if (apple_ext && hfs_boot_file) {
-#ifdef	USE_LIBSCHILY
-		comerrno(EX_BAD, "Can't have -hfs-boot-file with -apple\n");
-#else
-		fprintf(stderr, "Can't have -hfs-boot-file with -apple\n");
-		exit(1);
-#endif
-	}
-	if (apple_ext && autoname) {
-#ifdef	USE_LIBSCHILY
-		comerrno(EX_BAD, "Can't have -auto with -apple\n");
-#else
-		fprintf(stderr, "Can't have -auto with -apple\n");
-		exit(1);
-#endif
-	}
-	if (apple_hyb && (use_sparcboot || use_sunx86boot)) {
-#ifdef	USE_LIBSCHILY
-		comerrno(EX_BAD, "Can't have -hfs with -sparc-boot/-sunx86-boot\n");
-#else
-		fprintf(stderr, "Can't have -hfs with -sparc-boot/-sunx86-boot\n");
-		exit(1);
-#endif
-	}
-	if (apple_hyb && use_genboot) {
-#ifdef	USE_LIBSCHILY
-		comerrno(EX_BAD, "Can't have -hfs with -generic-boot\n");
-#else
-		fprintf(stderr, "Can't have -hfs with -generic-boot\n");
-		exit(1);
-#endif
-	}
-#ifdef PREP_BOOT
-	if (apple_ext && use_prep_boot) {
-#ifdef	USE_LIBSCHILY
-		comerrno(EX_BAD, "Can't have -prep-boot with -apple\n");
-#else
-		fprintf(stderr, "Can't have -prep-boot with -apple\n");
-		exit(1);
-#endif
-	}
-#endif	/* PREP_BOOT */
-
-	if (apple_hyb || apple_ext)
-		apple_both = 1;
-
-	if (probe)
-		/* we need to search for all types of Apple/Unix files */
-		hfs_select = ~0;
-
-	if (apple_both && verbose && !(hfs_select || *afpfile || magic_filename)) {
-#ifdef	USE_LIBSCHILY
-		errmsgno(EX_BAD,
-		"Warning: no Apple/Unix files will be decoded/mapped\n");
-#else
-		fprintf(stderr,
-		"Warning: no Apple/Unix files will be decoded/mapped\n");
-#endif
-	}
-	if (apple_both && verbose && !afe_size &&
-					(hfs_select & (DO_FEU | DO_FEL))) {
-#ifdef	USE_LIBSCHILY
-		errmsgno(EX_BAD,
-		"Warning: assuming PC Exchange cluster size of 512 bytes\n");
-#else
-		fprintf(stderr,
-		"Warning: assuming PC Exchange cluster size of 512 bytes\n");
-#endif
-		afe_size = 512;
-	}
-	if (apple_both) {
-		/* set up the TYPE/CREATOR mappings */
-		hfs_init(afpfile, 0, hfs_select);
-	}
-	if (apple_ext && !use_RockRidge) {
-#ifdef	nonono
-		/* use RockRidge to set the SystemUse field ... */
-		use_RockRidge++;
-		rationalize_all++;
-#else
-		/* EMPTY */
-#endif
-	}
-	if (apple_ext && !(use_XA || use_RockRidge)) {
-		comerrno(EX_BAD, "Need either -XA/-xa or -R/-r for -apple to become active.\n");
-	}
-
-#endif	/* APPLE_HYB */
-
-	if (rationalize_all) {
-		rationalize++;
-		rationalize_uid++;
-		rationalize_gid++;
-		rationalize_filemode++;
-		rationalize_dirmode++;
-	}
-
-	if (verbose > 1) {
-		fprintf(stderr, "%s (%s)\n", version_string, HOST_SYSTEM);
-	}
-	if (cdrecord_data == NULL && !check_session && merge_image != NULL) {
-#ifdef	USE_LIBSCHILY
-		comerrno(EX_BAD,
-		"Multisession usage bug: Must specify -C if -M is used.\n");
-#else
-		fprintf(stderr,
-		"Multisession usage bug: Must specify -C if -M is used.\n");
-		exit(1);
-#endif
-	}
-	if (cdrecord_data != NULL && merge_image == NULL) {
-#ifdef	USE_LIBSCHILY
-		errmsgno(EX_BAD,
-		"Warning: -C specified without -M: old session data will not be merged.\n");
-#else
-		fprintf(stderr,
-		"Warning: -C specified without -M: old session data will not be merged.\n");
-#endif
-	}
-#ifdef APPLE_HYB
-	if (merge_image != NULL && apple_hyb) {
-#ifdef	USE_LIBSCHILY
-		errmsgno(EX_BAD,
-		"Warning: files from previous sessions will not be included in the HFS volume.\n");
-#else
-		fprintf(stderr,
-		"Warning: files from previous sessions will not be included in the HFS volume.\n");
-#endif
-	}
-#endif	/* APPLE_HYB */
-
-	/*
-	 * see if we have a list of pathnames to process
-	 */
-	if (pathnames) {
-		/* "-" means take list from the standard input */
-		if (strcmp(pathnames, "-")) {
-			if ((pfp = fopen(pathnames, "r")) == NULL) {
-#ifdef	USE_LIBSCHILY
-				comerr("Unable to open pathname list %s.\n",
-								pathnames);
-#else
-				fprintf(stderr,
-					"Unable to open pathname list %s.\n",
-								pathnames);
-				exit(1);
-#endif
-			}
-		} else
-			pfp = stdin;
-	}
-
-	/* The first step is to scan the directory tree, and take some notes */
-
-	if ((arg = get_pnames(argc, argv, optind, pname,
-					sizeof (pname), pfp)) == NULL) {
-		if (check_session == 0 && !stream_media_size) {
-#ifdef	USE_LIBSCHILY
-			errmsgno(EX_BAD, "Missing pathspec.\n");
-#endif
-			susage(1);
-		}
-	}
-
-	/*
-	 * if we don't have a pathspec, then save the pathspec found
-	 * in the pathnames file (stored in pname) - we don't want
-	 * to skip this pathspec when we read the pathnames file again
-	 */
-	if (!have_cmd_line_pathspec && !stream_media_size) {
-		save_pname = 1;
-	}
-	if (stream_media_size) {
-		if (use_XA || use_RockRidge || use_udf || use_Joliet)
-			comerrno(EX_BAD,
-			"Cannot use XA, Rock Ridge, UDF or Joliet with -stream-media-size\n");
-		if (merge_image)
-			comerrno(EX_BAD,
-			"Cannot use multi session with -stream-media-size\n");
-		if (use_eltorito || use_sparcboot || use_sunx86boot ||
-		    use_genboot || use_prep_boot || hfs_boot_file)
-			comerrno(EX_BAD,
-			"Cannot use boot options with -stream-media-size\n");
-		if (apple_hyb)
-			comerrno(EX_BAD,
-			"Cannot use Apple hybrid options with -stream-media-size\n");
-	}
-
-	if (use_RockRidge) {
-		/* BEGIN CSTYLED */
-#if 1
-		extension_record = generate_rr_extension_record("RRIP_1991A",
-			"THE ROCK RIDGE INTERCHANGE PROTOCOL PROVIDES SUPPORT FOR POSIX FILE SYSTEM SEMANTICS",
-			"PLEASE CONTACT DISC PUBLISHER FOR SPECIFICATION SOURCE.  SEE PUBLISHER IDENTIFIER IN PRIMARY VOLUME DESCRIPTOR FOR CONTACT INFORMATION.",
-			&extension_record_size);
-#else
-		extension_record = generate_rr_extension_record("IEEE_P1282",
-			"THE IEEE P1282 PROTOCOL PROVIDES SUPPORT FOR POSIX FILE SYSTEM SEMANTICS",
-			"PLEASE CONTACT THE IEEE STANDARDS DEPARTMENT, PISCATAWAY, NJ, USA FOR THE P1282 SPECIFICATION.",
-			&extension_record_size);
-#endif
-		/* END CSTYLED */
-	}
-	if (log_file) {
-		FILE		*lfp;
-		int		i;
-
-		/* open log file - test that we can open OK */
-		if ((lfp = fopen(log_file, "w")) == NULL) {
-#ifdef	USE_LIBSCHILY
-			comerr("Can't open logfile: '%s'.\n", log_file);
-#else
-			fprintf(stderr, "Can't open logfile: '%s'.\n", log_file);
-			exit(1);
-#endif
-		}
-		fclose(lfp);
-
-		/* redirect all stderr message to log_file */
-		fprintf(stderr, "re-directing all messages to %s\n", log_file);
-		fflush(stderr);
-
-		/* associate stderr with the log file */
-		if (freopen(log_file, "w", stderr) == NULL) {
-#ifdef	USE_LIBSCHILY
-			comerr("Can't open logfile: '%s'.\n", log_file);
-#else
-			fprintf(stderr, "Can't open logfile: '%s'.\n", log_file);
-			exit(1);
-#endif
-		}
-		if (verbose > 1) {
-			for (i = 0; i < argc; i++)
-				fprintf(stderr, "%s ", argv[i]);
-
-			fprintf(stderr, "\n%s (%s)\n",
-				version_string, HOST_SYSTEM);
-		}
-	}
-	/* Find name of root directory. */
-	if (arg != NULL)
-		node = findgequal(arg);
-	if (!use_graft_ptrs)
-		node = NULL;
-	if (node == NULL) {
-		if (use_graft_ptrs && arg != NULL)
-			node = escstrcpy(nodename, arg);
-		else
-			node = arg;
-	} else {
-		/*
-		 * Remove '\\' escape chars which are located
-		 * before '\\' and '=' chars
-		 */
-		node = escstrcpy(nodename, ++node);
-	}
-
-	/*
-	 * See if boot catalog file exists in root directory, if not we will
-	 * create it.
-	 */
-	if (use_eltorito)
-		init_boot_catalog(node);
-
-	/*
-	 * Find the device and inode number of the root directory. Record this
-	 * in the hash table so we don't scan it more than once.
-	 */
-	stat_filter(node, &statbuf);
-	add_directory_hash(statbuf.st_dev, STAT_INODE(statbuf));
-
-	memset(&de, 0, sizeof (de));
-
-	/*
-	 * PO:
-	 * Isn't root NULL at this time anyway?
-	 * I think it is created by the first call to
-	 * find_or_create_directory() below.
-	 */
-	de.filedir = root;	/* We need this to bootstrap */
-
-	if (cdrecord_data != NULL && merge_image == NULL) {
-		/*
-		 * in case we want to add a new session, but don't want to
-		 * merge old one
-		 */
-		get_session_start(NULL);
-	}
-	if (merge_image != NULL) {
-		char	sector[SECTOR_SIZE];
-
-		errno = 0;
-		mrootp = merge_isofs(merge_image);
-		if (mrootp == NULL) {
-			/* Complain and die. */
-#ifdef	USE_LIBSCHILY
-			if (errno == 0)
-				errno = -1;
-			comerr("Unable to find previous session PVD '%s'.\n",
-				merge_image);
-#else
-			fprintf(stderr,
-				"Unable to find previous session PVD '%s'.\n",
-				merge_image);
-			exit(1);
-#endif
-		}
-		memcpy(de.isorec.extent, mrootp->extent, 8);
-
-		/*
-		 * Look for RR Attributes in '.' entry of root dir.
-		 * This is the first ISO directory entry in the root dir.
-		 */
-		c = isonum_733((unsigned char *)mrootp->extent);
-#ifdef  USE_SCG
-		readsecs(c, sector, 1);
-#else
-    lseek(fileno(in_image), c*2048, SEEK_SET);
-    read(fileno(in_image), sector, sizeof (sector));
-#endif
-		c = rr_flags((struct iso_directory_record *)sector);
-		if (c & RR_FLAG_XA)
-			fprintf(stderr, "XA signatures found\n");
-		if (c & RR_FLAG_AA)
-			fprintf(stderr, "AA signatures found\n");
-		if (c & ~(RR_FLAG_XA|RR_FLAG_AA)) {
-			if (c & RR_FLAG_SP) {
-				fprintf(stderr, "Rock Ridge signatures found\n");
-			} else {
-				fprintf(stderr, "Bad Rock Ridge signatures found (SU record missing)\n");
-				if (!force_rr)
-					no_rr++;
-			}
-		} else {
-			fprintf(stderr, "NO Rock Ridge present\n");
-			if ((c & (RR_FLAG_XA|RR_FLAG_AA)) == 0) {
-				if (!force_rr)
-					no_rr++;
-			}
-		}
-		if (no_rr)
-			fprintf(stderr, "Disabling Rock Ridge / XA / AA\n");
-	}
-	/*
-	 * Create an empty root directory. If we ever scan it for real,
-	 * we will fill in the contents.
-	 */
-	find_or_create_directory(NULL, "", &de, TRUE);
-
-#ifdef APPLE_HYB
-	/* may need to set window layout of the volume */
-	if (root_info)
-		set_root_info(root_info);
-#endif /* APPLE_HYB */
-
-	/*
-	 * Scan the actual directory (and any we find below it) for files to
-	 * write out to the output image.  Note - we take multiple source
-	 * directories and keep merging them onto the image.
-	 */
-if (check_session == 0)
-	while ((arg = get_pnames(argc, argv, optind, pname,
-					sizeof (pname), pfp)) != NULL) {
-		struct directory *graft_dir;
-		struct stat	st;
-		char		*short_name;
-		int		status;
-		char		graft_point[PATH_MAX + 1];
-
-		/*
-		 * We would like a syntax like:
-		 *
-		 *	/tmp=/usr/tmp/xxx
-		 *
-		 * where the user can specify a place to graft each component
-		 * of the tree.  To do this, we may have to create directories
-		 * along the way, of course. Secondly, I would like to allow
-		 * the user to do something like:
-		 *
-		 *	/home/baz/RMAIL=/u3/users/baz/RMAIL
-		 *
-		 * so that normal files could also be injected into the tree
-		 * at an arbitrary point.
-		 *
-		 * The idea is that the last component of whatever is being
-		 * entered would take the name from the last component of
-		 * whatever the user specifies.
-		 *
-		 * The default will be that the file is injected at the root of
-		 * the image tree.
-		 */
-		node = findgequal(arg);
-		if (!use_graft_ptrs)
-			node = NULL;
-		/*
-		 * Remove '\\' escape chars which are located
-		 * before '\\' and '=' chars ---> below in escstrcpy()
-		 */
-
-		short_name = NULL;
-
-		if (node != NULL || reloc_root) {
-			char		*pnt;
-			char		*xpnt;
-			size_t		len;
-
-			/* insert -root prefix */
-			if (reloc_root != NULL) {
-				strcpy(graft_point, reloc_root);
-				len = strlen(graft_point);
-				if (graft_point[len] != '/')
-					graft_point[len++] = '/';
-			} else {
-				len = 0;
-			}
-
-			if (node) {
-				*node = '\0';
-				escstrcpy(&graft_point[len], arg);
-				*node = '=';
-			}
-
-			/*
-			 * Remove unwanted "./" & "/" sequences from start...
-			 */
-			do {
-				xpnt = graft_point;
-				while (xpnt[0] == '.' && xpnt[1] == '/')
-					xpnt += 2;
-				while (*xpnt == PATH_SEPARATOR) {
-					xpnt++;
-				}
-				strcpy(graft_point, xpnt);
-			} while (xpnt > graft_point);
-
-			if (node) {
-				node = escstrcpy(nodename, ++node);
-			} else {
-				node = arg;
-			}
-
-			graft_dir = root;
-			xpnt = graft_point;
-
-			/*
-			 * If "node" points to a directory, then graft_point
-			 * needs to point to a directory too.
-			 */
-			if (follow_links)
-				status = stat_filter(node, &st);
-			else
-				status = lstat_filter(node, &st);
-			if (status == 0 && S_ISDIR(st.st_mode)) {
-				len = strlen(graft_point);
-
-				if ((len <= (sizeof (graft_point) -1)) &&
-				    graft_point[len-1] != '/') {
-					graft_point[len++] = '/';
-					graft_point[len] = '\0';
-				}
-			}
-			if (debug)
-				fprintf(stderr, "GRAFT:'%s'\n", xpnt);
-			/*
-			 * Loop down deeper and deeper until we find the
-			 * correct insertion spot.
-			 * Canonicalize the filename while parsing it.
-			 */
-			for (;;) {
-				do {
-					while (xpnt[0] == '.' && xpnt[1] == '/')
-						xpnt += 2;
-					while (xpnt[0] == '/')
-						xpnt += 1;
-					if (xpnt[0] == '.' && xpnt[1] == '.' && xpnt[2] == '/') {
-						if (graft_dir && graft_dir != root) {
-							graft_dir = graft_dir->parent;
-							xpnt += 2;
-						}
-					}
-				} while ((xpnt[0] == '/') || (xpnt[0] == '.' && xpnt[1] == '/'));
-				pnt = strchr(xpnt, PATH_SEPARATOR);
-				if (pnt == NULL) {
-					if (*xpnt != '\0') {
-						short_name = xpnt;
-					}
-					break;
-				}
-				*pnt = '\0';
-				if (debug) {
-					fprintf(stderr, "GRAFT Point:'%s' in '%s : %s' (%s)\n",
-						xpnt,
-						graft_dir->whole_name,
-						graft_dir->de_name,
-						graft_point);
-				}
-				graft_dir = find_or_create_directory(graft_dir,
-					graft_point,
-					NULL, TRUE);
-				*pnt = PATH_SEPARATOR;
-				xpnt = pnt + 1;
-			}
-		} else {
-			graft_dir = root;
-			if (use_graft_ptrs)
-				node = escstrcpy(nodename, arg);
-			else
-				node = arg;
-		}
-
-		/*
-		 * Now see whether the user wants to add a regular file, or a
-		 * directory at this point.
-		 */
-		if (follow_links)
-			status = stat_filter(node, &st);
-		else
-			status = lstat_filter(node, &st);
-		if (status != 0) {
-			/*
-			 * This is a fatal error - the user won't be getting
-			 * what they want if we were to proceed.
-			 */
-#ifdef	USE_LIBSCHILY
-			comerr("Invalid node - '%s'.\n", node);
-#else
-			fprintf(stderr, "Invalid node - '%s'.\n", node);
-			exit(1);
-#endif
-		} else {
-			if (S_ISDIR(st.st_mode)) {
-				if (debug) {
-					fprintf(stderr, "graft_dir: '%s : %s', node: '%s', (scan)\n",
-						graft_dir->whole_name,
-						graft_dir->de_name, node);
-				}
-				if (!scan_directory_tree(graft_dir,
-								node, &de)) {
-					exit(1);
-				}
-				if (debug) {
-					fprintf(stderr, "scan done\n");
-				}
-			} else {
-				if (short_name == NULL) {
-					short_name = strrchr(node,
-							PATH_SEPARATOR);
-					if (short_name == NULL ||
-							short_name < node) {
-						short_name = node;
-					} else {
-						short_name++;
-					}
-				}
-				if (debug) {
-					fprintf(stderr, "graft_dir: '%s : %s', node: '%s', short_name: '%s'\n",
-						graft_dir->whole_name,
-						graft_dir->de_name, node,
-						short_name);
-				}
-#ifdef APPLE_HYB
-				if (!insert_file_entry(graft_dir, node,
-								short_name, 0))
-#else
-				if (!insert_file_entry(graft_dir, node,
-								short_name))
-#endif	/* APPLE_HYB */
-				{
-					/*
-					 * Should we ignore this?
-					 */
-/*					exit(1);*/
-					/* EMPTY */
-				}
-			}
-		}
-
-		optind++;
-		no_path_names = 0;
-	}
-
-	if (pfp && pfp != stdin)
-		fclose(pfp);
-
-	/*
-	 * exit if we don't have any pathnames to process
-	 * - not going to happen at the moment as we have to have at least one
-	 * path on the command line
-	 */
-	if (no_path_names && !check_session && !stream_media_size) {
-#ifdef	USE_LIBSCHILY
-		errmsgno(EX_BAD, "No pathnames found.\n");
-#endif
-		susage(1);
-	}
-	/*
-	 * Now merge in any previous sessions.  This is driven on the source
-	 * side, since we may need to create some additional directories.
-	 */
-	if (merge_image != NULL) {
-		if (merge_previous_session(root, mrootp,
-					reloc_root, reloc_old_root) < 0) {
-#ifdef	USE_LIBSCHILY
-			comerrno(EX_BAD, "Cannot merge previous session.\n");
-#else
-			fprintf(stderr, "Cannot merge previous session.\n");
-			exit(1);
-#endif
-		}
-		close_merge_image();
-
-		/*
-		 * set up parent_dir and filedir in relocated entries which
-		 * were read from previous session so that
-		 * finish_cl_pl_entries can do its job
-		 */
-		match_cl_re_entries();
-	}
-#ifdef APPLE_HYB
-	/* free up any HFS filename mapping memory */
-	if (apple_both)
-		clean_hfs();
-#endif	/* APPLE_HYB */
-
-	/* hide "./rr_moved" if all its contents have been hidden */
-	if (reloc_dir && i_ishidden())
-		hide_reloc_dir();
-
-	/* insert the boot catalog if required */
-	if (use_eltorito)
-		insert_boot_cat();
-
-	/*
-	 * Free up any matching memory
-	 */
-	for (n = 0; n < MAX_MAT; n++)
-		gen_del_match(n);
-
-#ifdef SORTING
-	del_sort();
-#endif /* SORTING */
-
-	/*
-	 * Sort the directories in the required order (by ISO9660).  Also,
-	 * choose the names for the 8.3 filesystem if required, and do any
-	 * other post-scan work.
-	 */
-	goof += sort_tree(root);
-
-	if (goof) {
-#ifdef	USE_LIBSCHILY
-		comerrno(EX_BAD, "ISO9660/Rock Ridge tree sort failed.\n");
-#else
-		fprintf(stderr, "ISO9660/Rock Ridge tree sort failed.\n");
-		exit(1);
-#endif
-	}
-#ifdef UDF
-	if (use_Joliet || use_udf) {
-#else
-	if (use_Joliet) {
-#endif
-		goof += joliet_sort_tree(root);
-	}
-	if (goof) {
-#ifdef	USE_LIBSCHILY
-		comerrno(EX_BAD, "Joliet tree sort failed. The -joliet-long switch may help you.\n");
-#else
-		fprintf(stderr, "Joliet tree sort failed. The -joliet-long switch may help you.\n");
-		exit(1);
-#endif
-	}
-	/*
-	 * Fix a couple of things in the root directory so that everything is
-	 * self consistent. Fix this up so that the path tables get done right.
-	 */
-	root->self = root->contents;
-
-	/* OK, ready to write the file.  Open it up, and generate the thing. */
-	if (print_size) {
-		discimage = fopen("/dev/null", "wb");
-		if (!discimage) {
-#ifdef	USE_LIBSCHILY
-			comerr("Unable to open /dev/null\n");
-#else
-			fprintf(stderr, "Unable to open /dev/null\n");
-			exit(1);
-#endif
-		}
-	} else if (outfile) {
-		discimage = fopen(outfile, "wb");
-		if (!discimage) {
-#ifdef	USE_LIBSCHILY
-			comerr("Unable to open disc image file '%s'.\n", outfile);
-#else
-			fprintf(stderr, "Unable to open disc image file '%s'.\n", outfile);
-			exit(1);
-#endif
-		}
-		if (jtemplate_out || jjigdo_out) {
-			if (!jtemplate_out || !jjigdo_out || !jmd5_list) {
-#ifdef USE_LIBSCHILY
-				comerr("Bad options - need to specify output names for jigdo and template file, and also the md5-list input file!\n");
-#else
-				fprintf(stderr, "Bad options - need to specify output names for jigdo and template file, and also the md5-list input file!\n");
-				exit(1);
-#endif
-			}
-			jtjigdo = fopen(jjigdo_out, "wb");
-			jttemplate = fopen(jtemplate_out, "wb");
-			if (!jtjigdo || !jttemplate) {
-#ifdef USE_LIBSCHILY
-				comerr("Unable to open jigdo template image file\n");
-#else
-				fprintf(stderr, "Unable to open jigdo template image file\n");
-				exit(1);
-#endif
-			}
-			write_jt_header(jttemplate, jtjigdo);
-		}
-	} else {
-		discimage = stdout;
-
-#ifdef	NEED_O_BINARY
-		setmode(fileno(stdout), O_BINARY);
-#endif
-	}
-
-	/* Now assign addresses on the disc for the path table. */
-
-	path_blocks = ISO_BLOCKS(path_table_size);
-	if (path_blocks & 1)
-		path_blocks++;
-
-	jpath_blocks = ISO_BLOCKS(jpath_table_size);
-	if (jpath_blocks & 1)
-		jpath_blocks++;
-
-	/*
-	 * Start to set up the linked list that we use to track the contents
-	 * of the disc.
-	 */
-#ifdef APPLE_HYB
-#ifdef PREP_BOOT
-	if (apple_hyb || use_prep_boot || use_chrp_boot)
-#else	/* PREP_BOOT */
-	if (apple_hyb)
-#endif	/* PREP_BOOT */
-		outputlist_insert(&hfs_desc);
-#endif	/* APPLE_HYB */
-	if (use_sparcboot || use_sunx86boot)
-		outputlist_insert(&sunlabel_desc);
-	if (use_alphaboot)
-		outputlist_insert(&alphaboot_desc);
-	if (use_hppaboot)
-		outputlist_insert(&hppaboot_desc);
-	if (use_mipsboot)
-		outputlist_insert(&mipsboot_desc);
-	if (use_mipselboot)
-		outputlist_insert(&mipselboot_desc);
-	if (use_genboot)
-		outputlist_insert(&genboot_desc);
-	outputlist_insert(&startpad_desc);
-
-	/* PVD for disc. */
-	outputlist_insert(&voldesc_desc);
-
-	/* SVD for El Torito. MUST be immediately after the PVD! */
-	if (use_eltorito) {
-		outputlist_insert(&torito_desc);
-	}
-	/* Enhanced PVD for disc. neded if we write ISO-9660:1999 */
-	if (iso9660_level > 3)
-		outputlist_insert(&xvoldesc_desc);
-
-	/* SVD for Joliet. */
-	if (use_Joliet) {
-		outputlist_insert(&joliet_desc);
-	}
-	/* Finally the last volume descriptor. */
-	outputlist_insert(&end_vol);
-
-#ifdef UDF
-	if (use_udf) {
-		outputlist_insert(&udf_vol_recognition_area_frag);
-	}
-#endif
-
-	/* Insert the version descriptor. */
-	outputlist_insert(&version_desc);
-
-#ifdef UDF
-	if (use_udf) {
-		/*
-		 * Most of the space before sector 256 is wasted when
-		 * UDF is turned on. The waste could be reduced by
-		 * putting the ISO9660/Joliet structures before the
-		 * pad_to_sector_256; the problem is that they might
-		 * overshoot sector 256, so there would have to be some
-		 * ugly logic to detect this case and rearrange things
-		 * appropriately. I don't know if it's worth it.
-		 */
-		outputlist_insert(&udf_pad_to_sector_32_frag);
-		outputlist_insert(&udf_main_seq_frag);
-		outputlist_insert(&udf_main_seq_copy_frag);
-		outputlist_insert(&udf_integ_seq_frag);
-		outputlist_insert(&udf_pad_to_sector_256_frag);
-		outputlist_insert(&udf_anchor_vol_desc_frag);
-		outputlist_insert(&udf_file_set_desc_frag);
-		outputlist_insert(&udf_dirtree_frag);
-		outputlist_insert(&udf_file_entries_frag);
-	}
-#endif
-
-	/* Now start with path tables and directory tree info. */
-	if (!stream_media_size)
-		outputlist_insert(&pathtable_desc);
-	else
-		outputlist_insert(&strpath_desc);
-
-	if (use_Joliet) {
-		outputlist_insert(&jpathtable_desc);
-	}
-
-	if (!stream_media_size)
-		outputlist_insert(&dirtree_desc);
-
-	if (use_Joliet) {
-		outputlist_insert(&jdirtree_desc);
-	}
-	outputlist_insert(&dirtree_clean);
-
-	if (extension_record) {
-		outputlist_insert(&extension_desc);
-	}
-
-	if (!stream_media_size) {
-		outputlist_insert(&files_desc);
-	} else {
-		outputlist_insert(&strfile_desc);
-		outputlist_insert(&strdir_desc);
-	}
-
-	/*
-	 * Allow room for the various headers we will be writing.
-	 * There will always be a primary and an end volume descriptor.
-	 */
-	last_extent = session_start;
-
-	/*
-	 * Calculate the size of all of the components of the disc, and assign
-	 * extent numbers.
-	 */
-	for (opnt = out_list; opnt; opnt = opnt->of_next) {
-		opnt->of_start_extent = last_extent;
-		if (opnt->of_size != NULL) {
-			(*opnt->of_size) (last_extent);
-		}
-	}
-
-	/*
-	 * Generate the contents of any of the sections that we want to
-	 * generate. Not all of the fragments will do anything here
-	 * - most will generate the data on the fly when we get to the write
-	 * pass.
-	 */
-	for (opnt = out_list; opnt; opnt = opnt->of_next) {
-		if (opnt->of_generate != NULL) {
-			(*opnt->of_generate) ();
-		}
-	}
-
-	/*
-	 * Padding just after the ISO-9660 filesystem.
-	 *
-	 * files_desc does not have an of_size function. For this
-	 * reason, we must insert us after the files content has been
-	 * generated.
-	 */
-#ifdef UDF
-	if (use_udf) {
-		/* Single anchor volume descriptor pointer at end */
-		outputlist_insert(&udf_end_anchor_vol_desc_frag);
-		if (udf_end_anchor_vol_desc_frag.of_size != NULL) {
-			(*udf_end_anchor_vol_desc_frag.of_size) (last_extent);
-		}
-		if (dopad) {
-			/*
-			 * Pad with anchor volume descriptor pointer
-			 * blocks instead of zeroes.
-			 */
-			outputlist_insert(&udf_padend_avdp_frag);
-			if (udf_padend_avdp_frag.of_size != NULL) {
-				(*udf_padend_avdp_frag.of_size) (last_extent);
-			}
-		}
-	} else
-#endif
-	if (dopad && !(use_sparcboot || use_sunx86boot)) {
-		outputlist_insert(&endpad_desc);
-		if (endpad_desc.of_size != NULL) {
-			(*endpad_desc.of_size) (last_extent);
-		}
-	}
-	c = 0;
-	if (use_sparcboot) {
-		if (dopad) {
-			/* Padding before the boot partitions. */
-			outputlist_insert(&interpad_desc);
-			if (interpad_desc.of_size != NULL) {
-				(*interpad_desc.of_size) (last_extent);
-			}
-		}
-		c = make_sun_label();
-		last_extent += c;
-		outputlist_insert(&sunboot_desc);
-		if (dopad) {
-			outputlist_insert(&endpad_desc);
-			if (endpad_desc.of_size != NULL) {
-				(*endpad_desc.of_size) (last_extent);
-			}
-		}
-	} else if (use_sunx86boot) {
-		if (dopad) {
-			/* Padding before the boot partitions. */
-			outputlist_insert(&interpad_desc);
-			if (interpad_desc.of_size != NULL) {
-				(*interpad_desc.of_size) (last_extent);
-			}
-		}
-		c = make_sunx86_label();
-		last_extent += c;
-		outputlist_insert(&sunboot_desc);
-		if (dopad) {
-			outputlist_insert(&endpad_desc);
-			if (endpad_desc.of_size != NULL) {
-				(*endpad_desc.of_size) (last_extent);
-			}
-		}
-	}
-	if (print_size > 0) {
-		if (verbose > 0)
-			fprintf(stderr,
-			"Total extents scheduled to be written = %d\n",
-			(last_extent - session_start));
-		printf("%d\n", (last_extent - session_start));
-		exit(0);
-	}
-	/*
-	 * Now go through the list of fragments and write the data that
-	 * corresponds to each one.
-	 */
-	for (opnt = out_list; opnt; opnt = opnt->of_next) {
-		Uint	oext;
-
-		oext = last_extent_written;
-		if (opnt->of_start_extent != 0 &&
-		    opnt->of_start_extent != last_extent_written) {
-			/*
-			 * Consistency check.
-			 * XXX Should make sure that all entries have
-			 * XXXX of_start_extent set up correctly.
-			 */
-			comerrno(EX_BAD,
-			"Implementation botch: %s should start at %u but starts at %u.\n",
-			opnt->of_name, opnt->of_start_extent, last_extent_written);
-		}
-		if (opnt->of_write != NULL) {
-			if (verbose > 1)
-				fprintf(stderr, "Writing:   %-40sStart Block %u\n",
-					opnt->of_name, last_extent_written);
-			(*opnt->of_write) (discimage);
-			if (verbose > 1)
-				fprintf(stderr, "Done with: %-40sBlock(s)    %d\n",
-					opnt->of_name, last_extent_written-oext);
-		}
-	}
-	if (last_extent != last_extent_written) {
-		comerrno(EX_BAD,
-		"Implementation botch: FS should end at %u but ends at %u.\n",
-				last_extent, last_extent_written);
-	}
-
-	if (jttemplate) {
-		write_jt_footer();
-		fclose(jttemplate);
-	}
-	if (jtjigdo)
-		fclose(jtjigdo);
-
-	if (verbose > 0) {
-#ifdef HAVE_SBRK
-		fprintf(stderr, "Max brk space used %x\n",
-			(unsigned int)(((unsigned long) sbrk(0)) - mem_start));
-#endif
-		fprintf(stderr, "%d extents written (%d MB)\n",
-			last_extent, last_extent >> 9);
-	}
-#ifdef VMS
-	return (1);
-#else
-	return (0);
-#endif
-}
-
-/*
- * Find unescaped equal sign in graft pointer string.
- */
-char *
-findgequal(char *s)
-{
-	char	*p = s;
-
-	while ((p = strchr(p, '=')) != NULL) {
-		if (p > s && p[-1] != '\\')
-			return (p);
-		p++;
-	}
-	return (NULL);
-}
-
-/*
- * Find unescaped equal sign in string.
- */
-static char *
-escstrcpy(char *to, char *from)
-{
-	char	*p = to;
-
-	if (debug)
-		fprintf(stderr, "FROM: '%s'\n", from);
-
-	while ((*p = *from++) != '\0') {
-		if (*p == '\\') {
-			if ((*p = *from++) == '\0')
-				break;
-			if (*p != '\\' && *p != '=') {
-				p[1] = p[0];
-				*p++ = '\\';
-			}
-		}
-		p++;
-	}
-	if (debug)
-		fprintf(stderr, "ESC:  '%s'\n", to);
-	return (to);
-}
-
-void *
-e_malloc(size_t size)
-{
-	void		*pt = 0;
-
-	if ((size > 0) && ((pt = malloc(size)) == NULL)) {
-#ifdef	USE_LIBSCHILY
-		comerr("Not enough memory\n");
-#else
-		fprintf(stderr, "Not enough memory\n");
-		exit(1);
-#endif
-	}
-	/*
-	 * Not all code is clean yet.
-	 * Filling all allocated data with zeroes will help
-	 * to avoid core dumps.
-	 */
-	memset(pt, 0, size);
-	return (pt);
-}

Deleted: cdrkit/trunk/genisoimage/mkisoimage.h
===================================================================
--- cdrkit/trunk/mkisoimage/mkisoimage.h	2006-11-23 21:37:32 UTC (rev 450)
+++ cdrkit/trunk/genisoimage/mkisoimage.h	2006-11-23 22:11:41 UTC (rev 453)
@@ -1,800 +0,0 @@
-/*
- * This file has been modified for the cdrkit suite.
- *
- * The behaviour and appearence of the program code below can differ to a major
- * extent from the version distributed by the original author(s).
- *
- * For details, see Changelog file distributed with the cdrkit package. If you
- * received this file from another source then ask the distributing person for
- * a log of modifications.
- *
- */
-
-/* @(#)mkisoimage.h	1.95 05/05/01 joerg */
-/*
- * Header file mkisoimage.h - assorted structure definitions and typecasts.
- *
- * Written by Eric Youngdale (1993).
- *
- * Copyright 1993 Yggdrasil Computing, Incorporated
- * Copyright (c) 1999,2000-2003 J. Schilling
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-/* APPLE_HYB James Pearson j.pearson at ge.ucl.ac.uk 23/2/2000 */
-
-#define APPID_DEFAULT "MKISOFS ISO 9660/HFS FILESYSTEM BUILDER & CDRECORD CD-R/DVD CREATOR (C) 1993 E.YOUNGDALE (C) 1997 J.PEARSON/J.SCHILLING"
-
-
-#include <mconfig.h>	/* Must be before stdio.h for LARGEFILE support */
-#include <stdio.h>
-#include <statdefs.h>
-#include <stdxlib.h>
-#include <unixstd.h>	/* Needed for for LARGEFILE support */
-#include <strdefs.h>
-#include <dirdefs.h>
-#include <utypes.h>
-#include <standard.h>
-#include <libport.h>
-#include "scsi.h"
-#ifdef JIGDO_TEMPLATE
-#include "jte.h"
-#endif
-
-#ifdef	DVD_VIDEO
-#ifndef	UDF
-#define	UDF
-#endif
-#endif
-
-/*#if	_LFS_LARGEFILE*/
-#ifdef	HAVE_LARGEFILES
-/*
- * XXX Hack until fseeko()/ftello() are available everywhere or until
- * XXX we know a secure way to let autoconf ckeck for fseeko()/ftello()
- * XXX without defining FILE_OFFSETBITS to 64 in confdefs.h
- */
-#	define	fseek	fseeko
-#	define	ftell	ftello
-#endif
-
-#ifndef	HAVE_LSTAT
-#ifndef	VMS
-#define	lstat	stat
-#endif
-#endif
-
-#ifndef __SVR4
-extern int	optind;
-extern char	*optarg;
-
-/* extern int getopt (int __argc, char **__argv, char *__optstring); */
-#endif
-
-#include "iso9660.h"
-#include "defaults.h"
-#include <unls.h>
-
-extern struct unls_table *in_nls;	/* input UNICODE conversion table */
-extern struct unls_table *out_nls;	/* output UNICODE conversion table */
-extern struct unls_table *hfs_inls;	/* input HFS UNICODE conversion table */
-extern struct unls_table *hfs_onls;	/* output HFS UNICODE conversion table */
-
-#ifdef APPLE_HYB
-#include "mactypes.h"
-#include "hfs.h"
-
-struct hfs_info {
-	unsigned char	finderinfo[32];
-	char		name[HFS_MAX_FLEN + 1];
-	/* should have fields for dates here as well */
-	char		*keyname;
-	struct hfs_info *next;
-};
-
-#endif	/* APPLE_HYB */
-
-struct directory_entry {
-	struct directory_entry *next;
-	struct directory_entry *jnext;
-	struct iso_directory_record isorec;
-	unsigned int	starting_block;
-	off_t		size;
-	unsigned short	priority;
-	unsigned char	jreclen;	/* Joliet record len */
-	char		*name;
-	char		*table;
-	char		*whole_name;
-	struct directory *filedir;
-	struct directory_entry *parent_rec;
-	unsigned int	de_flags;
-	ino_t		inode;		/* Used in the hash table */
-	dev_t		dev;		/* Used in the hash table */
-	unsigned char	*rr_attributes;
-	unsigned int	rr_attr_size;
-	unsigned int	total_rr_attr_size;
-	unsigned int	got_rr_name;
-#ifdef APPLE_HYB
-	struct directory_entry *assoc;	/* entry has a resource fork */
-	hfsdirent	*hfs_ent;	/* HFS parameters */
-	off_t		hfs_off;	/* offset to real start of fork */
-	int		hfs_type;	/* type of HFS Unix file */
-#endif	/* APPLE_HYB */
-#ifdef SORTING
-	int		sort;		/* sort weight for entry */
-#endif /* SORTING */
-#ifdef UDF
-	int		udf_file_entry_sector;	/* also used as UDF unique ID */
-#endif
-};
-
-struct file_hash {
-	struct file_hash *next;
-	ino_t		inode;		/* Used in the hash table */
-	dev_t		dev;		/* Used in the hash table */
-	unsigned int	starting_block;
-	off_t		size;
-#ifdef SORTING
-	struct directory_entry *de;
-#endif /* SORTING */
-};
-
-
-/*
- * This structure is used to control the output of fragments to the cdrom
- * image.  Everything that will be written to the output image will eventually
- * go through this structure.   There are two pieces - first is the sizing where
- * we establish extent numbers for everything, and the second is when we actually
- * generate the contents and write it to the output image.
- *
- * This makes it trivial to extend mkisoimage to write special things in the image.
- * All you need to do is hook an additional structure in the list, and the rest
- * works like magic.
- *
- * The three passes each do the following:
- *
- * The 'size' pass determines the size of each component and assigns the extent number
- * for that component.
- *
- * The 'generate' pass will adjust the contents and pointers as required now that extent
- * numbers are assigned.  In some cases, the contents of the record are also generated.
- *
- * The 'write' pass actually writes the data to the disc.
- */
-struct output_fragment {
-	struct output_fragment *of_next;
-	int		(*of_size)(int);
-	int		(*of_generate)(void);
-	int		(*of_write)(FILE *);
-	char		*of_name;			/* Textual description */
-	unsigned int	of_start_extent;		/* For consist check */
-};
-
-extern struct output_fragment *out_list;
-extern struct output_fragment *out_tail;
-
-extern struct output_fragment startpad_desc;
-extern struct output_fragment voldesc_desc;
-extern struct output_fragment xvoldesc_desc;
-extern struct output_fragment joliet_desc;
-extern struct output_fragment torito_desc;
-extern struct output_fragment end_vol;
-extern struct output_fragment version_desc;
-extern struct output_fragment pathtable_desc;
-extern struct output_fragment jpathtable_desc;
-extern struct output_fragment dirtree_desc;
-extern struct output_fragment dirtree_clean;
-extern struct output_fragment jdirtree_desc;
-extern struct output_fragment extension_desc;
-extern struct output_fragment files_desc;
-extern struct output_fragment interpad_desc;
-extern struct output_fragment endpad_desc;
-extern struct output_fragment sunboot_desc;
-extern struct output_fragment sunlabel_desc;
-extern struct output_fragment genboot_desc;
-extern struct output_fragment strfile_desc;
-extern struct output_fragment strdir_desc;
-extern struct output_fragment strpath_desc;
-extern struct output_fragment alphaboot_desc;
-extern struct output_fragment hppaboot_desc;
-extern struct output_fragment mipsboot_desc;
-extern struct output_fragment mipselboot_desc;
-
-#ifdef APPLE_HYB
-extern struct output_fragment hfs_desc;
-
-#endif	/* APPLE_HYB */
-#ifdef DVD_VIDEO
-/*
- * This structure holds the information necessary to create a valid
- * DVD-Video image. Basically it's how much to pad the files so the
- * file offsets described in the video_ts.ifo and vts_xx_0.ifo are
- * the correct one in the image that we create.
- */
-typedef struct {
-	int	realsize_ifo;
-	int	realsize_menu;
-	int	realsize_bup;
-	int	size_ifo;
-	int	size_menu;
-	int	size_title;
-	int	size_bup;
-	int	pad_ifo;
-	int	pad_menu;
-	int	pad_title;
-	int	pad_bup;
-	int	number_of_vob_files;
-	int	realsize_vob[10];
-} title_set_t;
-
-typedef struct {
-	int		num_titles;
-	title_set_t	*title_set;
-} title_set_info_t;
-#endif /* DVD_VIDEO */
-
-/*
- * This structure describes one complete directory.  It has pointers
- * to other directories in the overall tree so that it is clear where
- * this directory lives in the tree, and it also must contain pointers
- * to the contents of the directory.  Note that subdirectories of this
- * directory exist twice in this stucture.  Once in the subdir chain,
- * and again in the contents chain.
- */
-struct directory {
-	struct directory *next;		/* Next directory at same level as this one */
-	struct directory *subdir;	/* First subdirectory in this directory */
-	struct directory *parent;
-	struct directory_entry *contents;
-	struct directory_entry *jcontents;
-	struct directory_entry *self;
-	char		*whole_name;	/* Entire path */
-	char		*de_name;	/* Entire path */
-	unsigned int	ce_bytes;	/* Number of bytes of CE entries read */
-					/* for this dir */
-	unsigned int	depth;
-	unsigned int	size;
-	unsigned int	extent;
-	unsigned int	jsize;
-	unsigned int	jextent;
-	unsigned int	path_index;
-	unsigned int	jpath_index;
-	unsigned short	dir_flags;
-	unsigned short	dir_nlink;
-#ifdef APPLE_HYB
-	hfsdirent	*hfs_ent;	/* HFS parameters */
-	struct hfs_info	*hfs_info;	/* list of info for all entries in dir */
-#endif	/* APPLE_HYB */
-#ifdef SORTING
-	int		sort;		/* sort weight for child files */
-#endif /* SORTING */
-};
-
-struct deferred_write {
-	struct deferred_write *next;
-	char		*table;
-	unsigned int	extent;
-	off_t		size;
-	char		*name;
-	struct directory_entry *s_entry;
-	unsigned int	pad;
-	off_t		off;
-};
-
-struct eltorito_boot_entry_info {
-	struct eltorito_boot_entry_info *next;
-	char		*boot_image;
-	int		not_bootable;
-	int		no_emul_boot;
-	int		hard_disk_boot;
-	int		boot_info_table;
-	int		load_size;
-	int		load_addr;
-};
-
-extern int	goof;
-extern struct directory *root;
-extern struct directory *reloc_dir;
-extern unsigned int next_extent;
-extern unsigned int last_extent;
-extern unsigned int last_extent_written;
-extern unsigned int session_start;
-
-extern unsigned int path_table_size;
-extern unsigned int path_table[4];
-extern unsigned int path_blocks;
-extern char	*path_table_l;
-extern char	*path_table_m;
-
-extern unsigned int jpath_table_size;
-extern unsigned int jpath_table[4];
-extern unsigned int jpath_blocks;
-extern char	*jpath_table_l;
-extern char	*jpath_table_m;
-
-extern struct iso_directory_record root_record;
-extern struct iso_directory_record jroot_record;
-
-extern int	check_oldnames;
-extern int	check_session;
-extern int	use_eltorito;
-extern int	hard_disk_boot;
-extern int	not_bootable;
-extern int	no_emul_boot;
-extern int	load_addr;
-extern int	load_size;
-extern int	boot_info_table;
-extern int	use_RockRidge;
-extern int	osecsize;
-extern int	use_XA;
-extern int	use_Joliet;
-extern int	rationalize;
-extern int	rationalize_uid;
-extern int	rationalize_gid;
-extern int	rationalize_filemode;
-extern int	rationalize_dirmode;
-extern uid_t	uid_to_use;
-extern gid_t	gid_to_use;
-extern int	filemode_to_use;
-extern int	dirmode_to_use;
-extern int	new_dir_mode;
-extern int	follow_links;
-extern int	cache_inodes;
-extern int	verbose;
-extern int	debug;
-extern int	gui;
-extern int	all_files;
-extern int	generate_tables;
-extern int	print_size;
-extern int	split_output;
-extern int	use_graft_ptrs;
-extern int	jhide_trans_tbl;
-extern int	hide_rr_moved;
-extern int	omit_period;
-extern int	omit_version_number;
-extern int	no_rr;
-extern int	transparent_compression;
-extern Uint	RR_relocation_depth;
-extern int	iso9660_level;
-extern int	iso9660_namelen;
-extern int	full_iso9660_filenames;
-extern int	relaxed_filenames;
-extern int	allow_lowercase;
-extern int	allow_multidot;
-extern int	iso_translate;
-extern int	allow_leading_dots;
-extern int	use_fileversion;
-extern int	split_SL_component;
-extern int	split_SL_field;
-extern char	*trans_tbl;
-char		*outfile;
-
-#define	JMAX		64	/* maximum Joliet file name length (spec) */
-#define	JLONGMAX	103	/* out of spec Joliet file name length */
-extern int	jlen;		/* selected maximum Joliet file name length */
-
-#ifdef DVD_VIDEO
-extern int	dvd_video;
-#endif /* DVD_VIDEO */
-
-
-#ifdef APPLE_HYB
-extern int	apple_hyb;	/* create HFS hybrid */
-extern int	apple_ext;	/* use Apple extensions */
-extern int	apple_both;	/* common flag (for above) */
-extern int	hfs_extra;	/* extra ISO extents (hfs_ce_size) */
-extern hce_mem	*hce;		/* libhfs/mkisoimage extras */
-extern int	use_mac_name;	/* use Mac name for ISO9660/Joliet/RR */
-extern int	create_dt;	/* create the Desktp files */
-extern char	*hfs_boot_file;	/* name of HFS boot file */
-extern char	*magic_filename;	/* magic file for CREATOR/TYPE matching */
-extern int	hfs_last;	/* order in which to process map/magic files */
-extern char	*deftype;	/* default Apple TYPE */
-extern char	*defcreator;	/* default Apple CREATOR */
-extern int	gen_pt;		/* generate HFS partition table */
-extern char	*autoname;	/* Autostart filename */
-extern int	afe_size;	/* Apple File Exchange block size */
-extern char	*hfs_volume_id;	/* HFS volume ID */
-extern int	icon_pos;	/* Keep Icon position */
-extern int	hfs_lock;	/* lock HFS volume (read-only) */
-extern char	*hfs_bless;	/* name of folder to 'bless' (System Folder) */
-extern char	*hfs_parms;	/* low level HFS parameters */
-
-#define	MAP_LAST	1	/* process magic then map file */
-#define	MAG_LAST	2	/* process map then magic file */
-
-#ifndef PREP_BOOT
-#define	PREP_BOOT
-#endif	/* PREP_BOOT */
-
-#ifdef PREP_BOOT
-extern char	*prep_boot_image[4];
-extern int	use_prep_boot;
-extern int	use_chrp_boot;
-
-#endif	/* PREP_BOOT */
-#endif	/* APPLE_HYB */
-
-#ifdef SORTING
-extern int	do_sort;
-#endif /* SORTING */
-
-/* tree.c */
-extern int stat_filter(char *, struct stat *);
-extern int lstat_filter(char *, struct stat *);
-extern int sort_tree(struct directory *);
-extern struct directory *
-find_or_create_directory(struct directory *, const char *, 
-								 struct directory_entry *self, int);
-extern void	finish_cl_pl_entries(void);
-extern int	scan_directory_tree(struct directory *this_dir, char *path,
-										  struct directory_entry *self);
-
-#ifdef APPLE_HYB
-extern int	insert_file_entry(struct directory *, char *, char *, int);
-#else
-extern int	insert_file_entry(struct directory *, char *, char *);
-#endif	/* APPLE_HYB */
-
-extern void generate_iso9660_directories(struct directory *, FILE *);
-extern void dump_tree(struct directory * node);
-extern struct directory_entry *
-search_tree_file(struct directory * node, char *filename);
-extern void update_nlink_field(struct directory * node);
-extern void init_fstatbuf(void);
-extern struct stat root_statbuf;
-extern struct stat fstatbuf;
-
-/* eltorito.c */
-extern void init_boot_catalog(const char *path);
-extern void insert_boot_cat(void);
-extern void get_boot_entry(void);
-extern void new_boot_entry(void);
-
-/* boot.c */
-extern void sparc_boot_label(char *label);
-extern void sunx86_boot_label(char *label);
-extern void scan_sparc_boot(char *files);
-extern void scan_sunx86_boot(char *files);
-extern int make_sun_label(void);
-extern int make_sunx86_label(void);
-
-/* boot-alpha.c */
-extern int add_boot_alpha_filename(char *filename);
-
-/* boot-hppa.c */
-extern int add_boot_hppa_cmdline(char *cmdline);
-extern int add_boot_hppa_kernel_32(char *filename);
-extern int add_boot_hppa_kernel_64(char *filename);
-extern int add_boot_hppa_bootloader(char *filename);
-extern int add_boot_hppa_ramdisk(char *filename);
-
-/* boot-mips.c */
-extern int add_boot_mips_filename(char *filename);
-
-/* boot-mipsel.c */
-extern int add_boot_mipsel_filename(char *filename);
-
-/* rsync.c */
-extern unsigned long long rsync64(unsigned char *mem, size_t size);
-
-/* write.c */
-extern int get_731(char *);
-extern int get_732(char *);
-extern int get_733(char *);
-extern int isonum_733(unsigned char *);
-extern void set_723(char *, unsigned int);
-extern void set_731(char *, unsigned int);
-extern void set_721(char *, unsigned int);
-extern void set_733(char *, unsigned int);
-extern int sort_directory(struct directory_entry **, int);
-extern void generate_one_directory(struct directory *, FILE *);
-extern void memcpy_max(char *, char *, int);
-extern int oneblock_size(int starting_extent);
-extern struct iso_primary_descriptor vol_desc;
-extern void xfwrite(void *buffer, int size, int count, FILE *file, int submode,
-						  BOOL islast);
-extern void set_732(char *pnt, unsigned int i);
-extern void set_722(char *pnt, unsigned int i);
-extern void outputlist_insert(struct output_fragment * frag);
-
-#ifdef APPLE_HYB
-extern Ulong get_adj_size(int Csize);
-extern int adj_size(int Csize, int start_extent, int extra);
-extern void adj_size_other(struct directory * dpnt);
-extern int insert_padding_file(int size);
-extern int gen_mac_label(struct deferred_write *);
-
-#ifdef PREP_BOOT
-extern void gen_prepboot_label(unsigned char *);
-
-#endif	/* PREP_BOOT */
-#endif	/* APPLE_HYB */
-
-/* multi.c */
-
-extern FILE	*in_image;
-extern int open_merge_image(char *path);
-extern int close_merge_image(void);
-extern struct iso_directory_record *
-merge_isofs(char *path);
-extern unsigned char	*parse_xa(unsigned char *pnt, int *lenp,
-										 struct directory_entry *dpnt);
-extern int	rr_flags(struct iso_directory_record *idr);
-extern int merge_previous_session(struct directory *, 
-											 struct iso_directory_record *, 
-											 char *, char *);
-extern int get_session_start(int *);
-
-/* joliet.c */
-#ifdef	UDF
-#   ifdef USE_ICONV
-extern	size_t	convert_to_unicode	(unsigned char *buffer,
-			int size, char *source, struct unls_table *inls);
-#   else
-extern	void	convert_to_unicode	(unsigned char *buffer,
-			int size, char *source, struct unls_table *inls);
->>>>>>> .merge-rechts.r368
-#   endif
-extern	int	joliet_strlen		__PR((const char *string, struct unls_table *inls));
-#endif
-extern unsigned char conv_charset(unsigned char, struct unls_table *,
-											 struct unls_table *);
-extern int joliet_sort_tree(struct directory * node);
-
-/* match.c */
-extern int matches(char *);
-extern int add_match(char *);
-
-/* files.c */
-struct dirent	*readdir_add_files(char **, char *, DIR *);
-
-/* name.c */
-
-extern void iso9660_check(struct iso_directory_record *idr, 
-								  struct directory_entry *ndr);
-extern int iso9660_file_length(const char *name, 
-										 struct directory_entry *sresult, int flag);
-
-/* various */
-extern int iso9660_date(char *, time_t);
-extern void add_hash(struct directory_entry *);
-extern struct file_hash *find_hash(dev_t, ino_t);
-
-extern void flush_hash(void);
-extern void add_directory_hash(dev_t, ino_t);
-extern struct file_hash *find_directory_hash(dev_t, ino_t);
-extern void flush_file_hash(void);
-extern int delete_file_hash(struct directory_entry *);
-extern struct directory_entry *find_file_hash(char *);
-extern void add_file_hash(struct directory_entry *);
-
-extern int	generate_xa_rr_attributes(char *, char *, struct directory_entry *,
-												  struct stat *, struct stat *, 
-												  int deep_flag);
-extern char	*generate_rr_extension_record(char *id, char *descriptor,
-														char *source, int *size);
-
-extern int	check_prev_session(struct directory_entry **, int len, 
-										 struct directory_entry *, struct stat *,
-										 struct stat *, struct directory_entry **);
-
-extern void	match_cl_re_entries(void);
-extern void	finish_cl_pl_for_prev_session(void);
-extern char	*find_rr_attribute(unsigned char *pnt, int len, char *attr_type);
-
-#ifdef APPLE_HYB
-/* volume.c */
-extern int make_mac_volume(struct directory * dpnt, int start_extent);
-extern int write_fork(hfsfile * hfp, long tot);
-
-/* apple.c */
-
-extern void del_hfs_info(struct hfs_info *);
-extern int get_hfs_dir(char *, char *, struct directory_entry *);
-extern int get_hfs_info(char *, char *, struct directory_entry *);
-extern int get_hfs_rname(char *, char *, char *);
-extern int hfs_exclude(char *);
-extern void print_hfs_info(struct directory_entry *);
-extern void hfs_init(char *, unsigned short, unsigned int);
-extern void delete_rsrc_ent(struct directory_entry *);
-extern void clean_hfs(void);
-extern void perr(char *);
-extern void set_root_info(char *);
-
-/* desktop.c */
-
-extern int make_desktop(hfsvol *, int);
-
-/* mac_label.c */
-
-#ifdef	_MAC_LABEL_H
-#ifdef PREP_BOOT
-extern void	gen_prepboot_label(MacLabel * mac_label);
-#endif
-extern int	gen_mac_label(defer *);
-#endif
-extern int	autostart(void);
-
-/* libfile */
-
-extern char	*get_magic_match(const char *);
-extern void	clean_magic(void);
-
-#endif	/* APPLE_HYB */
-
-extern char	*extension_record;
-extern int	extension_record_extent;
-extern int	n_data_extents;
-
-/*
- * These are a few goodies that can be specified on the command line, and are
- * filled into the root record
- */
-extern char	*preparer;
-extern char	*publisher;
-extern char	*copyright;
-extern char	*biblio;
-extern char	*abstract;
-extern char	*appid;
-extern char	*volset_id;
-extern char	*system_id;
-extern char	*volume_id;
-extern char	*boot_catalog;
-extern char	*boot_image;
-extern char	*genboot_image;
-extern int	ucs_level;
-extern int	volume_set_size;
-extern int	volume_sequence_number;
-
-extern struct eltorito_boot_entry_info *first_boot_entry;
-extern struct eltorito_boot_entry_info *last_boot_entry;
-extern struct eltorito_boot_entry_info *current_boot_entry;
-
-extern char	*findgequal(char *);
-extern void	*e_malloc(size_t);
-
-/*
- * Note: always use these macros to avoid problems.
- *
- * ISO_ROUND_UP(X)	may cause an integer overflow and thus give
- *			incorrect results. So avoid it if possible.
- *
- * ISO_BLOCKS(X)	is overflow safe. Prefer this when ever it is possible.
- */
-#define	SECTOR_SIZE	(2048)
-#define	ISO_ROUND_UP(X)	(((X) + (SECTOR_SIZE - 1)) & ~(SECTOR_SIZE - 1))
-#define	ISO_BLOCKS(X)	(((X) / SECTOR_SIZE) + (((X)%SECTOR_SIZE)?1:0))
-
-#define	ROUND_UP(X, Y)	(((X + (Y - 1)) / Y) * Y)
-
-#ifdef APPLE_HYB
-/*
- * ISO blocks == 2048, HFS blocks == 512
- */
-#define	HFS_BLK_CONV	(SECTOR_SIZE/HFS_BLOCKSZ)
-
-#define	HFS_ROUND_UP(X)	ISO_ROUND_UP(((X)*HFS_BLOCKSZ))	/* XXX ??? */
-#define	HFS_BLOCKS(X)	(ISO_BLOCKS(X) * HFS_BLK_CONV)
-
-#define	USE_MAC_NAME(E)	(use_mac_name && ((E)->hfs_ent != NULL) && (E)->hfs_type)
-#endif	/* APPLE_HYB */
-
-/*
- * Rock Ridge defines
- */
-#define	NEED_RE		1	/* Need Relocated Direcotry	*/
-#define	NEED_PL		2	/* Need Parent link		*/
-#define	NEED_CL		4	/* Need Child link		*/
-#define	NEED_CE		8	/* Need Continuation Area	*/
-#define	NEED_SP		16	/* Need SUSP record		*/
-
-#define	RR_FLAG_PX	1	/* POSIX attributes		*/
-#define	RR_FLAG_PN	2	/* POSIX device number		*/
-#define	RR_FLAG_SL	4	/* Symlink			*/
-#define	RR_FLAG_NM	8	/* Alternate Name		*/
-#define	RR_FLAG_CL	16	/* Child link			*/
-#define	RR_FLAG_PL	32	/* Parent link			*/
-#define	RR_FLAG_RE	64	/* Relocated Direcotry		*/
-#define	RR_FLAG_TF	128	/* Time stamp			*/
-
-#define	RR_FLAG_SP	1024	/* SUSP record			*/
-#define	RR_FLAG_AA	2048	/* Apple Signature record	*/
-#define	RR_FLAG_XA	4096	/* XA signature record		*/
-
-#define	RR_FLAG_CE	8192	/* SUSP Continuation aerea	*/
-#define	RR_FLAG_ER	16384	/* Extension record for RR signature */
-#define	RR_FLAG_RR	32768	/* RR Signature in every file	*/
-#define	RR_FLAG_ZF	65535	/* Linux compression extension	*/
-
-
-#define	PREV_SESS_DEV	(sizeof (dev_t) >= 4 ? 0x7ffffffd : 0x7ffd)
-#define	TABLE_INODE	(sizeof (ino_t) >= 4 ? 0x7ffffffe : 0x7ffe)
-#define	UNCACHED_INODE	(sizeof (ino_t) >= 4 ? 0x7fffffff : 0x7fff)
-#define	UNCACHED_DEVICE	(sizeof (dev_t) >= 4 ? 0x7fffffff : 0x7fff)
-
-#ifdef VMS
-#define	STAT_INODE(X)	(X.st_ino[0])
-#define	PATH_SEPARATOR	']'
-#define	SPATH_SEPARATOR	""
-#else
-#define	STAT_INODE(X)	(X.st_ino)
-#define	PATH_SEPARATOR	'/'
-#define	SPATH_SEPARATOR	"/"
-#endif
-
-/*
- * When using multi-session, indicates that we can reuse the
- * TRANS.TBL information for this directory entry. If this flag
- * is set for all entries in a directory, it means we can just
- * reuse the TRANS.TBL and not generate a new one.
- */
-#define	SAFE_TO_REUSE_TABLE_ENTRY  0x01		/* de_flags only  */
-#define	DIR_HAS_DOT		   0x02		/* dir_flags only */
-#define	DIR_HAS_DOTDOT		   0x04		/* dir_flags only */
-#define	INHIBIT_JOLIET_ENTRY	   0x08
-#define	INHIBIT_RR_ENTRY	   0x10		/* not used	  */
-#define	RELOCATED_DIRECTORY	   0x20		/* de_flags only  */
-#define	INHIBIT_ISO9660_ENTRY	   0x40
-#define	MEMORY_FILE		   0x80		/* de_flags only  */
-#define	HIDDEN_FILE		   0x100	/* de_flags only  */
-#define	DIR_WAS_SCANNED		   0x200	/* dir_flags only */
-
-/*
- * Volume sequence number to use in all of the iso directory records.
- */
-#define	DEF_VSN		1
-
-/*
- * Make sure we have a definition for this.  If not, take a very conservative
- * guess.
- * POSIX requires the max pathname component lenght to be defined in limits.h
- * If variable, it may be undefined. If undefined, there should be
- * a definition for _POSIX_NAME_MAX in limits.h or in unistd.h
- * As _POSIX_NAME_MAX is defined to 14, we cannot use it.
- * XXX Eric's wrong comment:
- * XXX From what I can tell SunOS is the only one with this trouble.
- */
-#ifdef	HAVE_LIMITS_H
-#include <limits.h>
-#endif
-#ifndef NAME_MAX
-#ifdef FILENAME_MAX
-#define	NAME_MAX	FILENAME_MAX
-#else
-#define	NAME_MAX	256
-#endif
-#endif
-
-#ifndef PATH_MAX
-#ifdef FILENAME_MAX
-#define	PATH_MAX	FILENAME_MAX
-#else
-#define	PATH_MAX	1024
-#endif
-#endif
-
-/*
- * XXX JS: Some structures have odd lengths!
- * Some compilers (e.g. on Sun3/mc68020) padd the structures to even length.
- * For this reason, we cannot use sizeof (struct iso_path_table) or
- * sizeof (struct iso_directory_record) to compute on disk sizes.
- * Instead, we use offsetof(..., name) and add the name size.
- * See iso9660.h
- */
-#ifndef	offsetof
-#define	offsetof(TYPE, MEMBER)	((size_t) &((TYPE *)0)->MEMBER)
-#endif

Deleted: cdrkit/trunk/genisoimage/multi.c
===================================================================
--- cdrkit/trunk/mkisoimage/multi.c	2006-11-23 21:37:32 UTC (rev 450)
+++ cdrkit/trunk/genisoimage/multi.c	2006-11-23 22:11:41 UTC (rev 453)
@@ -1,1915 +0,0 @@
-/*
- * This file has been modified for the cdrkit suite.
- *
- * The behaviour and appearence of the program code below can differ to a major
- * extent from the version distributed by the original author(s).
- *
- * For details, see Changelog file distributed with the cdrkit package. If you
- * received this file from another source then ask the distributing person for
- * a log of modifications.
- *
- */
-
-/* @(#)multi.c	1.68 05/05/15 joerg */
-#ifndef lint
-static	char sccsid[] =
-	"@(#)multi.c	1.68 05/05/15 joerg";
-#endif
-/*
- * File multi.c - scan existing iso9660 image and merge into
- * iso9660 filesystem.  Used for multisession support.
- *
- * Written by Eric Youngdale (1996).
- * Copyright (c) 1999-2003 J. Schilling
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <mconfig.h>
-#include "mkisoimage.h"
-#include <timedefs.h>
-#include <errno.h>
-#include <utypes.h>
-#include <schily.h>
-#include <ctype.h>			/* Needed for printasc()	*/
-
-#ifdef VMS
-
-#include <sys/file.h>
-#include <vms/fabdef.h>
-#include "vms.h"
-#endif
-
-#ifndef howmany
-#define	howmany(x, y)   (((x)+((y)-1))/(y))
-#endif
-#ifndef roundup
-#define	roundup(x, y)   ((((x)+((y)-1))/(y))*(y))
-#endif
-
-/*
- * Cannot debug memset() with gdb on Linux, so use fillbytes()
- */
-/*#define	memset(s, c, n)	fillbytes(s, n, c)*/
-
-#define	TF_CREATE 1
-#define	TF_MODIFY 2
-#define	TF_ACCESS 4
-#define	TF_ATTRIBUTES 8
-
-static	int	isonum_711(unsigned char *p);
-static	int	isonum_721(unsigned char *p);
-static	int	isonum_723(unsigned char *p);
-static	int	isonum_731(unsigned char *p);
-
-static	void	printasc(char *txt, unsigned char *p, int len);
-static	void	prbytes(char *txt, unsigned char *p, int len);
-unsigned char	*parse_xa(unsigned char *pnt, int *lenp,
-								 struct directory_entry *dpnt);
-int	rr_flags(struct iso_directory_record *idr);
-static	int	parse_rrflags(Uchar *pnt, int len, int cont_flag);
-static	BOOL	find_rr(struct iso_directory_record *idr, Uchar **pntp, 
-							  int *lenp);
-static	 int	parse_rr(unsigned char *pnt, int len, 
-								struct directory_entry *dpnt);
-static	int	check_rr_dates(struct directory_entry *dpnt,
-										struct directory_entry *current,
-										struct stat *statbuf,
-										struct stat *lstatbuf);
-static	struct directory_entry **
-		read_merging_directory(struct iso_directory_record *, int *);
-static	int	free_mdinfo(struct directory_entry **, int len);
-static	void	free_directory_entry(struct directory_entry * dirp);
-static	void	merge_remaining_entries(struct directory *,
-													struct directory_entry **, int);
-
-static	int	merge_old_directory_into_tree(struct directory_entry *,
-															struct directory *);
-static	void	check_rr_relocation(struct directory_entry *de);
-
-static int
-isonum_711(unsigned char *p)
-{
-	return (*p & 0xff);
-}
-
-static int
-isonum_721(unsigned char *p)
-{
-	return ((p[0] & 0xff) | ((p[1] & 0xff) << 8));
-}
-
-static int
-isonum_723(unsigned char *p)
-{
-#if 0
-	if (p[0] != p[3] || p[1] != p[2]) {
-#ifdef	USE_LIBSCHILY
-		comerrno(EX_BAD, "invalid format 7.2.3 number\n");
-#else
-		fprintf(stderr, "invalid format 7.2.3 number\n");
-		exit(1);
-#endif
-	}
-#endif
-	return (isonum_721(p));
-}
-
-static int
-isonum_731(unsigned char *p)
-{
-	return ((p[0] & 0xff)
-		| ((p[1] & 0xff) << 8)
-		| ((p[2] & 0xff) << 16)
-		| ((p[3] & 0xff) << 24));
-}
-
-int
-isonum_733(unsigned char *p)
-{
-	return (isonum_731(p));
-}
-
-FILE	*in_image = NULL;
-
-#ifndef	USE_SCG
-/*
- * Don't define readsecs if mkisoimage is linked with
- * the SCSI library.
- * readsecs() will be implemented as SCSI command in this case.
- *
- * Use global var in_image directly in readsecs()
- * the SCSI equivalent will not use a FILE* for I/O.
- *
- * The main point of this pointless abstraction is that Solaris won't let
- * you read 2K sectors from the cdrom driver.  The fact that 99.9% of the
- * discs out there have a 2K sectorsize doesn't seem to matter that much.
- * Anyways, this allows the use of a scsi-generics type of interface on
- * Solaris.
- */
-static int
-readsecs(int startsecno, void *buffer, int sectorcount)
-{
-	int		f = fileno(in_image);
-
-	if (lseek(f, (off_t) startsecno * SECTOR_SIZE, SEEK_SET) == (off_t) - 1) {
-#ifdef	USE_LIBSCHILY
-		comerr(" Seek error on old image\n");
-#else
-		fprintf(stderr, " Seek error on old image\n");
-		exit(10);
-#endif
-	}
-	if (read(f, buffer, (sectorcount * SECTOR_SIZE))
-		!= (sectorcount * SECTOR_SIZE)) {
-#ifdef	USE_LIBSCHILY
-		comerr(" Read error on old image\n");
-#else
-		fprintf(stderr, " Read error on old image\n");
-		exit(10);
-#endif
-	}
-	return (sectorcount * SECTOR_SIZE);
-}
-
-#endif
-
-static void
-printasc(char *txt, unsigned char *p, int len)
-{
-	int		i;
-
-	fprintf(stderr, "%s ", txt);
-	for (i = 0; i < len; i++) {
-		if (isprint(p[i]))
-			fprintf(stderr, "%c", p[i]);
-		else
-			fprintf(stderr, ".");
-	}
-	fprintf(stderr, "\n");
-}
-
-static void
-prbytes(char *txt, register Uchar *p, register int len)
-{
-	fprintf(stderr, "%s", txt);
-	while (--len >= 0)
-		fprintf(stderr, " %02X", *p++);
-	fprintf(stderr, "\n");
-}
-
-unsigned char *
-parse_xa(unsigned char *pnt, int *lenp, struct directory_entry *dpnt)
-{
-	struct iso_xa_dir_record *xadp;
-	int		len = *lenp;
-static	int		did_xa = 0;
-
-/*fprintf(stderr, "len: %d\n", len);*/
-
-	if (len >= 14) {
-		xadp = (struct iso_xa_dir_record *)pnt;
-
-/*		if (dpnt) prbytes("XA ", pnt, len);*/
-		if (xadp->signature[0] == 'X' && xadp->signature[1] == 'A' &&
-				xadp->reserved[0] == '\0') {
-			len -= 14;
-			pnt += 14;
-			*lenp = len;
-			if (!did_xa) {
-				did_xa = 1;
-				errmsgno(EX_BAD, "Found XA directory extension record.\n");
-			}
-		} else if (pnt[2] == 0) {
-			char *cp = NULL;
-
-			if (dpnt)
-				cp = (char *)&dpnt->isorec;
-			if (cp) {
-				prbytes("ISOREC:", (Uchar *)cp, 33+cp[32]);
-				printasc("ISOREC:", (Uchar *)cp, 33+cp[32]);
-				prbytes("XA REC:", pnt, len);
-				printasc("XA REC:", pnt, len);
-			}
-			if (no_rr == 0) {
-				errmsgno(EX_BAD, "Disabling RR / XA / AA.\n");
-				no_rr = 1;
-			}
-			*lenp = 0;
-			if (cp) {
-				errmsgno(EX_BAD, "Problems with old ISO directory entry for file: '%s'.\n", &cp[33]);
-			}
-			errmsgno(EX_BAD, "Illegal extended directory attributes found (bad XA disk?).\n");
-/*			errmsgno(EX_BAD, "Disabling Rock Ridge for old session.\n");*/
-			comerrno(EX_BAD, "Try again using the -no-rr option.\n");
-		}
-	}
-	if (len >= 4 && pnt[3] != 1 && pnt[3] != 2) {
-		prbytes("BAD RR ATTRIBUTES:", pnt, len);
-		printasc("BAD RR ATTRIBUTES:", pnt, len);
-	}
-	return (pnt);
-}
-
-static BOOL
-find_rr(struct iso_directory_record *idr, Uchar **pntp, int *lenp)
-{
-	struct iso_xa_dir_record *xadp;
-	int		len;
-	unsigned char	*pnt;
-	BOOL		ret = FALSE;
-
-	len = idr->length[0] & 0xff;
-	len -= sizeof (struct iso_directory_record);
-	len += sizeof (idr->name);
-	len -= idr->name_len[0];
-
-	pnt = (unsigned char *) idr;
-	pnt += sizeof (struct iso_directory_record);
-	pnt -= sizeof (idr->name);
-	pnt += idr->name_len[0];
-	if ((idr->name_len[0] & 1) == 0) {
-		pnt++;
-		len--;
-	}
-	if (len >= 14) {
-		xadp = (struct iso_xa_dir_record *)pnt;
-
-		if (xadp->signature[0] == 'X' && xadp->signature[1] == 'A' &&
-				xadp->reserved[0] == '\0') {
-			len -= 14;
-			pnt += 14;
-			ret = TRUE;
-		}
-	}
-	*pntp = pnt;
-	*lenp = len;
-	return (ret);
-}
-
-static int
-parse_rrflags(Uchar *pnt, int len, int cont_flag)
-{
-	int	ncount;
-	int	cont_extent;
-	int	cont_offset;
-	int	cont_size;
-	int	flag1;
-	int	flag2;
-
-	cont_extent = cont_offset = cont_size = 0;
-
-	ncount = 0;
-	flag1 = flag2 = 0;
-	while (len >= 4) {
-		if (pnt[3] != 1 && pnt[3] != 2) {
-#ifdef USE_LIBSCHILY
-			errmsgno(EX_BAD,
-				"**BAD RRVERSION (%d) for %c%c\n",
-				pnt[3], pnt[0], pnt[1]);
-#else
-			fprintf(stderr,
-				"**BAD RRVERSION (%d) for %c%c\n",
-				pnt[3], pnt[0], pnt[1]);
-#endif
-			return (0);	/* JS ??? Is this right ??? */
-		}
-		ncount++;
-		if (pnt[0] == 'R' && pnt[1] == 'R')
-			flag1 = pnt[4] & 0xff;
-
-		if (strncmp((char *) pnt, "PX", 2) == 0)	/* POSIX attributes */
-			flag2 |= 1;
-		if (strncmp((char *) pnt, "PN", 2) == 0)	/* POSIX device number */
-			flag2 |= 2;
-		if (strncmp((char *) pnt, "SL", 2) == 0)	/* Symlink */
-			flag2 |= 4;
-		if (strncmp((char *) pnt, "NM", 2) == 0)	/* Alternate Name */
-			flag2 |= 8;
-		if (strncmp((char *) pnt, "CL", 2) == 0)	/* Child link */
-			flag2 |= 16;
-		if (strncmp((char *) pnt, "PL", 2) == 0)	/* Parent link */
-			flag2 |= 32;
-		if (strncmp((char *) pnt, "RE", 2) == 0)	/* Relocated Direcotry */
-			flag2 |= 64;
-		if (strncmp((char *) pnt, "TF", 2) == 0)	/* Time stamp */
-			flag2 |= 128;
-		if (strncmp((char *) pnt, "SP", 2) == 0) {	/* SUSP record */
-			flag2 |= 1024;
-/*			su_version = pnt[3] & 0xff;*/
-		}
-		if (strncmp((char *) pnt, "AA", 2) == 0) {	/* Apple Signature record */
-			flag2 |= 2048;
-/*			aa_version = pnt[3] & 0xff;*/
-		}
-
-		if (strncmp((char *)pnt, "CE", 2) == 0) {	/* Continuation Area */
-			cont_extent = isonum_733(pnt+4);
-			cont_offset = isonum_733(pnt+12);
-			cont_size = isonum_733(pnt+20);
-		}
-
-		len -= pnt[2];
-		pnt += pnt[2];
-		if (len <= 3 && cont_extent) {
-			unsigned char   sector[SECTOR_SIZE];
-
-			readsecs(cont_extent, sector, 1);
-			flag2 |= parse_rrflags(&sector[cont_offset], cont_size, 1);
-		}
-	}
-	return (flag2);
-}
-
-int
-rr_flags(struct iso_directory_record *idr)
-{
-	int		len;
-	unsigned char	*pnt;
-	int		ret = 0;
-
-	if (find_rr(idr, &pnt, &len))
-		ret |= 4096;
-	ret |= parse_rrflags(pnt, len, 0);
-	return (ret);
-}
-
-/*
- * Parse the RR attributes so we can find the file name.
- */
-static int
-parse_rr(unsigned char *pnt, int len, struct directory_entry *dpnt)
-{
-	int		cont_extent;
-	int		cont_offset;
-	int		cont_size;
-	char		name_buf[256];
-
-	cont_extent = cont_offset = cont_size = 0;
-
-	pnt = parse_xa(pnt, &len, dpnt /* 0 */);
-
-	while (len >= 4) {
-		if (pnt[3] != 1 && pnt[3] != 2) {
-#ifdef	USE_LIBSCHILY
-			errmsgno(EX_BAD,
-				"**BAD RRVERSION (%d) for %c%c\n",
-				pnt[3], pnt[0], pnt[1]);
-#else
-			fprintf(stderr,
-				"**BAD RRVERSION (%d) for %c%c\n",
-				pnt[3], pnt[0], pnt[1]);
-#endif
-			return (-1);
-		}
-		if (strncmp((char *) pnt, "NM", 2) == 0) {
-			strncpy(name_buf, (char *) pnt + 5, pnt[2] - 5);
-			name_buf[pnt[2] - 5] = 0;
-			if (dpnt->name) {
-				size_t nlen = strlen(dpnt->name);
-
-				/*
-				 * append to name from previous NM records
-				 */
-				dpnt->name = realloc(dpnt->name, nlen +
-							strlen(name_buf) + 1);
-				strcpy(dpnt->name + nlen, name_buf);
-			} else {
-				dpnt->name = strdup(name_buf);
-				dpnt->got_rr_name = 1;
-			}
-			/* continue searching for more NM records */
-		} else 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);
-		}
-
-		len -= pnt[2];
-		pnt += pnt[2];
-		if (len <= 3 && cont_extent) {
-			unsigned char   sector[SECTOR_SIZE];
-
-			readsecs(cont_extent, sector, 1);
-			if (parse_rr(&sector[cont_offset],
-							cont_size, dpnt) == -1)
-				return (-1);
-		}
-	}
-
-	/* Fall back to the iso name if no RR name found */
-	if (dpnt->name == NULL) {
-		char	*cp;
-
-		strcpy(name_buf, dpnt->isorec.name);
-		cp = strchr(name_buf, ';');
-		if (cp != NULL) {
-			*cp = '\0';
-		}
-		dpnt->name = strdup(name_buf);
-	}
-	return (0);
-}/* parse_rr */
-
-
-/*
- * Returns 1 if the two files are identical
- * Returns 0 if the two files differ
- */
-static int
-check_rr_dates(struct directory_entry *dpnt, 
-					struct directory_entry *current, 
-					struct stat *statbuf, 
-					struct stat *lstatbuf)
-{
-	int		cont_extent;
-	int		cont_offset;
-	int		cont_size;
-	int		offset;
-	unsigned char	*pnt;
-	int		len;
-	int		same_file;
-	int		same_file_type;
-	mode_t		mode;
-	char		time_buf[7];
-
-
-	cont_extent = cont_offset = cont_size = 0;
-	same_file = 1;
-	same_file_type = 1;
-
-	pnt = dpnt->rr_attributes;
-	len = dpnt->rr_attr_size;
-	/*
-	 * We basically need to parse the rr attributes again, and dig out the
-	 * dates and file types.
-	 */
-	pnt = parse_xa(pnt, &len, /* dpnt */ 0);
-	while (len >= 4) {
-		if (pnt[3] != 1 && pnt[3] != 2) {
-#ifdef	USE_LIBSCHILY
-			errmsgno(EX_BAD,
-				"**BAD RRVERSION (%d) for %c%c\n",
-				pnt[3], pnt[0], pnt[1]);
-#else
-			fprintf(stderr,
-				"**BAD RRVERSION (%d) for %c%c\n",
-				pnt[3], pnt[0], pnt[1]);
-#endif
-			return (-1);
-		}
-
-		/*
-		 * If we have POSIX file modes, make sure that the file type is
-		 * the same.  If it isn't, then we must always write the new
-		 * file.
-		 */
-		if (strncmp((char *) pnt, "PX", 2) == 0) {
-			mode = isonum_733(pnt + 4);
-			if ((lstatbuf->st_mode & S_IFMT) != (mode & S_IFMT)) {
-				same_file_type = 0;
-				same_file = 0;
-			}
-		}
-		if (strncmp((char *) pnt, "TF", 2) == 0) {
-			offset = 5;
-			if (pnt[4] & TF_CREATE) {
-				iso9660_date((char *) time_buf,
-							lstatbuf->st_ctime);
-				if (memcmp(time_buf, pnt + offset, 7) != 0)
-					same_file = 0;
-				offset += 7;
-			}
-			if (pnt[4] & TF_MODIFY) {
-				iso9660_date((char *) time_buf,
-							lstatbuf->st_mtime);
-				if (memcmp(time_buf, pnt + offset, 7) != 0)
-					same_file = 0;
-				offset += 7;
-			}
-		}
-		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);
-		}
-
-		len -= pnt[2];
-		pnt += pnt[2];
-		if (len <= 3 && cont_extent) {
-			unsigned char   sector[SECTOR_SIZE];
-
-			readsecs(cont_extent, sector, 1);
-			/*
-			 * Continue to scan the extension record.
-			 * Note that this has not been tested yet, but it is
-			 * definitely more correct that calling parse_rr()
-			 * as done in Eric's old code.
-			 */
-			pnt = &sector[cont_offset];
-			len = cont_size;
-			/*
-			 * Clear the "pending extension record" state as
-			 * we did already read it now.
-			 */
-			cont_extent = cont_offset = cont_size = 0;
-		}
-	}
-
-	/*
-	 * If we have the same fundamental file type, then it is clearly safe
-	 * to reuse the TRANS.TBL entry.
-	 */
-	if (same_file_type) {
-		current->de_flags |= SAFE_TO_REUSE_TABLE_ENTRY;
-	}
-	return (same_file);
-}
-
-static struct directory_entry **
-read_merging_directory(struct iso_directory_record *mrootp, int *nentp)
-{
-	unsigned char	*cpnt;
-	unsigned char	*cpnt1;
-	char		*p;
-	char		*dirbuff;
-	int		i;
-	struct iso_directory_record *idr;
-	int		len;
-	int		nbytes;
-	int		nent;
-	struct directory_entry **pnt;
-	int		rlen;
-	struct directory_entry **rtn;
-	int		seen_rockridge;
-	unsigned char	*tt_buf;
-	int		tt_extent;
-	int		tt_size;
-
-	static int	warning_given = 0;
-
-	/*
-	 * This is the number of sectors we will need to read.  We need to
-	 * round up to get the last fractional sector - we are asking for the
-	 * data in terms of a number of sectors.
-	 */
-	nbytes = roundup(isonum_733((unsigned char *) mrootp->size),
-								SECTOR_SIZE);
-
-	/*
-	 * First, allocate a buffer large enough to read in the entire
-	 * directory.
-	 */
-	dirbuff = (char *) e_malloc(nbytes);
-
-	readsecs(isonum_733((unsigned char *) mrootp->extent), dirbuff,
-		nbytes / SECTOR_SIZE);
-
-	/*
-	 * Next look over the directory, and count up how many entries we have.
-	 */
-	len = isonum_733((unsigned char *) mrootp->size);
-	i = 0;
-	*nentp = 0;
-	nent = 0;
-	while (i < len) {
-		idr = (struct iso_directory_record *) & dirbuff[i];
-		if (idr->length[0] == 0) {
-			i = ISO_ROUND_UP(i);
-			continue;
-		}
-		nent++;
-		i += idr->length[0];
-	}
-
-	/*
-	 * Now allocate the buffer which will hold the array we are about to
-	 * return.
-	 */
-	rtn = (struct directory_entry **) e_malloc(nent * sizeof (*rtn));
-
-	/*
-	 * Finally, scan the directory one last time, and pick out the relevant
-	 * bits of information, and store it in the relevant bits of the
-	 * structure.
-	 */
-	i = 0;
-	pnt = rtn;
-	tt_extent = 0;
-	seen_rockridge = 0;
-	tt_size = 0;
-	while (i < len) {
-		idr = (struct iso_directory_record *) & dirbuff[i];
-		if (idr->length[0] == 0) {
-			i = ISO_ROUND_UP(i);
-			continue;
-		}
-		*pnt = (struct directory_entry *) e_malloc(sizeof (**rtn));
-		(*pnt)->next = NULL;
-#ifdef	DEBUG
-		fprintf(stderr, "IDR name: '%s' ist: %d soll: %d\n",
-			idr->name, strlen(idr->name), idr->name_len[0]);
-#endif
-		(*pnt)->isorec = *idr;
-		(*pnt)->starting_block =
-				isonum_733((unsigned char *) idr->extent);
-		(*pnt)->size = isonum_733((unsigned char *) idr->size);
-		(*pnt)->priority = 0;
-		(*pnt)->name = NULL;
-		(*pnt)->got_rr_name = 0;
-		(*pnt)->table = NULL;
-		(*pnt)->whole_name = NULL;
-		(*pnt)->filedir = NULL;
-		(*pnt)->parent_rec = NULL;
-		/*
-		 * Set this information so that we correctly cache previous
-		 * session bits of information.
-		 */
-		(*pnt)->inode = (*pnt)->starting_block;
-		(*pnt)->dev = PREV_SESS_DEV;
-		(*pnt)->rr_attributes = NULL;
-		(*pnt)->rr_attr_size = 0;
-		(*pnt)->total_rr_attr_size = 0;
-		(*pnt)->de_flags = SAFE_TO_REUSE_TABLE_ENTRY;
-#ifdef APPLE_HYB
-		(*pnt)->assoc = NULL;
-		(*pnt)->hfs_ent = NULL;
-#endif	/* APPLE_HYB */
-
-		/*
-		 * Check for and parse any RR attributes for the file. All we
-		 * are really looking for here is the original name of the
-		 * file.
-		 */
-		rlen = idr->length[0] & 0xff;
-		cpnt = (unsigned char *) idr;
-
-		rlen -= offsetof(struct iso_directory_record, name[0]);
-		cpnt += offsetof(struct iso_directory_record, name[0]);
-
-		rlen -= idr->name_len[0];
-		cpnt += idr->name_len[0];
-
-		if ((idr->name_len[0] & 1) == 0) {
-			cpnt++;
-			rlen--;
-		}
-
-		if (no_rr)
-			rlen = 0;
-		if (rlen > 0) {
-			(*pnt)->total_rr_attr_size =
-						(*pnt)->rr_attr_size = rlen;
-			(*pnt)->rr_attributes = e_malloc(rlen);
-			memcpy((*pnt)->rr_attributes, cpnt, rlen);
-			seen_rockridge = 1;
-		}
-#ifdef	DEBUG
-		fprintf(stderr, "INT name: '%s' ist: %d soll: %d\n",
-			(*pnt)->isorec.name, strlen((*pnt)->isorec.name),
-			idr->name_len[0]);
-#endif
-
-		if (idr->name_len[0] < sizeof ((*pnt)->isorec.name)) {
-			/*
-			 * Now zero out the remainder of the name field.
-			 */
-			cpnt = (unsigned char *) (*pnt)->isorec.name;
-			cpnt += idr->name_len[0];
-			memset(cpnt, 0,
-				sizeof ((*pnt)->isorec.name) - idr->name_len[0]);
-		} else {
-			/*
-			 * Simple sanity work to make sure that we have no
-			 * illegal data structures in our tree.
-			 */
-			(*pnt)->isorec.name[MAX_ISONAME] = '\0';
-			(*pnt)->isorec.name_len[0] = MAX_ISONAME;
-		}
-		/*
-		 * If the filename len from the old session is more
-		 * then 31 chars, there is a high risk of hard violations
-		 * if the ISO9660 standard.
-		 * Run it through our name canonication machine....
-		 */
-		if (idr->name_len[0] > LEN_ISONAME || check_oldnames) {
-			iso9660_check(idr, *pnt);
-		}
-
-		if (parse_rr((*pnt)->rr_attributes, rlen, *pnt) == -1) {
-#ifdef	USE_LIBSCHILY
-			comerrno(EX_BAD,
-			    "Cannot parse Rock Ridge attributes for '%s'.\n",
-								idr->name);
-#else
-			fprintf(stderr,
-			    "Cannot parse Rock Ridge attributes for '%s'.\n",
-								idr->name);
-			exit(1);
-#endif
-		}
-		if (((*pnt)->isorec.name_len[0] == 1) &&
-		    (((*pnt)->isorec.name[0] == 0) ||	/* "."  entry */
-		    ((*pnt)->isorec.name[0] == 1))) {	/* ".." entry */
-
-			if ((*pnt)->name != NULL) {
-				free((*pnt)->name);
-			}
-			if ((*pnt)->whole_name != NULL) {
-				free((*pnt)->whole_name);
-			}
-			if ((*pnt)->isorec.name[0] == 0) {
-				(*pnt)->name = strdup(".");
-			} else {
-				(*pnt)->name = strdup("..");
-			}
-		}
-#ifdef DEBUG
-		fprintf(stderr, "got DE name: %s\n", (*pnt)->name);
-#endif
-
-		if (strncmp(idr->name, trans_tbl, strlen(trans_tbl)) == 0) {
-			if ((*pnt)->name != NULL) {
-				free((*pnt)->name);
-			}
-			if ((*pnt)->whole_name != NULL) {
-				free((*pnt)->whole_name);
-			}
-/*			(*pnt)->name = strdup("<translation table>");*/
-			(*pnt)->name = strdup(trans_tbl);
-			tt_extent = isonum_733((unsigned char *) idr->extent);
-			tt_size = isonum_733((unsigned char *) idr->size);
-			if (tt_extent == 0)
-				tt_size = 0;
-		}
-		pnt++;
-		i += idr->length[0];
-	}
-#ifdef APPLE_HYB
-	/*
-	 * If we find an associated file, check if there is a file
-	 * with same ISO name and link it to this entry
-	 */
-	for (pnt = rtn, i = 0; i < nent; i++, pnt++) {
-		int	j;
-
-		rlen = isonum_711((*pnt)->isorec.name_len);
-		if ((*pnt)->isorec.flags[0] & ISO_ASSOCIATED) {
-			for (j = 0; j < nent; j++) {
-				if (strncmp(rtn[j]->isorec.name,
-				    (*pnt)->isorec.name, rlen) == 0 &&
-				    (rtn[j]->isorec.flags[0] & ISO_ASSOCIATED) == 0) {
-					rtn[j]->assoc = *pnt;
-
-					/*
-					 * don't want this entry to be
-					 * in the Joliet tree
-					 */
-					(*pnt)->de_flags |= INHIBIT_JOLIET_ENTRY;
-
-					/*
-					 * as we have associated files, then
-					 * assume we are are dealing with
-					 * Apple's extensions - if not already
-					 * set
-					 */
-					if (apple_both == 0) {
-						apple_both = apple_ext = 1;
-					}
-					break;
-				}
-			}
-		}
-	}
-#endif	/* APPLE_HYB */
-
-	/*
-	 * If there was a TRANS.TBL;1 entry, then grab it, read it, and use it
-	 * to get the filenames of the files.  Also, save the table info, just
-	 * in case we need to use it.
-	 *
-	 * The entries look something like: F ISODUMP.;1 isodump
-	 */
-	if (tt_extent != 0 && tt_size != 0) {
-		nbytes = roundup(tt_size, SECTOR_SIZE);
-		tt_buf = (unsigned char *) e_malloc(nbytes);
-		readsecs(tt_extent, tt_buf, nbytes / SECTOR_SIZE);
-
-		/*
-		 * Loop through the file, examine each entry, and attempt to
-		 * attach it to the correct entry.
-		 */
-		cpnt = tt_buf;
-		cpnt1 = tt_buf;
-		while (cpnt - tt_buf < tt_size) {
-			/* Skip to a line terminator, or end of the file. */
-			while ((cpnt1 - tt_buf < tt_size) &&
-				(*cpnt1 != '\n') &&
-				(*cpnt1 != '\0')) {
-				cpnt1++;
-			}
-			/* Zero terminate this particular line. */
-			if (cpnt1 - tt_buf < tt_size) {
-				*cpnt1 = '\0';
-			}
-			/*
-			 * Now dig through the actual directories, and try and
-			 * find the attachment for this particular filename.
-			 */
-			for (pnt = rtn, i = 0; i < nent; i++, pnt++) {
-				rlen = isonum_711((*pnt)->isorec.name_len);
-
-				/*
-				 * If this filename is so long that it would
-				 * extend past the end of the file, it cannot
-				 * be the one we want.
-				 */
-				if (cpnt + 2 + rlen - tt_buf >= tt_size) {
-					continue;
-				}
-				/*
-				 * Now actually compare the name, and make sure
-				 * that the character at the end is a ' '.
-				 */
-				if (strncmp((char *) cpnt + 2,
-					(*pnt)->isorec.name, rlen) == 0 &&
-					cpnt[2 + rlen] == ' ' &&
-					(p = strchr((char *)&cpnt[2 + rlen], '\t'))) {
-					p++;
-					/*
-					 * This is a keeper. Now determine the
-					 * correct table entry that we will
-					 * use on the new image.
-					 */
-					if (strlen(p) > 0) {
-						(*pnt)->table =
-						    e_malloc(strlen(p) + 4);
-						sprintf((*pnt)->table,
-							"%c\t%s\n",
-							*cpnt, p);
-					}
-					if (!(*pnt)->got_rr_name) {
-						if ((*pnt)->name != NULL) {
-							free((*pnt)->name);
-						}
-						(*pnt)->name = strdup(p);
-					}
-					break;
-				}
-			}
-			cpnt = cpnt1 + 1;
-			cpnt1 = cpnt;
-		}
-
-		free(tt_buf);
-	} else if (!seen_rockridge && !warning_given) {
-		/*
-		 * Warn the user that iso-9660 names were used because neither
-		 * Rock Ridge (-R) nor TRANS.TBL (-T) name translations were
-		 * found.
-		 */
-		fprintf(stderr,
-		    "Warning: Neither Rock Ridge (-R) nor TRANS.TBL (-T) \n");
-		fprintf(stderr,
-		    "name translations were found on previous session.\n");
-		fprintf(stderr,
-		    "ISO-9660 file names have been used instead.\n");
-		warning_given = 1;
-	}
-	if (dirbuff != NULL) {
-		free(dirbuff);
-	}
-	*nentp = nent;
-	return (rtn);
-}/* read_merging_directory */
-
-/*
- * Free any associated data related to the structures.
- */
-static int
-free_mdinfo(struct directory_entry **ptr, int len)
-{
-	int		i;
-	struct directory_entry **p;
-
-	p = ptr;
-	for (i = 0; i < len; i++, p++) {
-		/*
-		 * If the tree-handling code decided that it needed an entry, it
-		 * will have removed it from the list.  Thus we must allow for
-		 * null pointers here.
-		 */
-		if (*p == NULL) {
-			continue;
-		}
-		free_directory_entry(*p);
-	}
-
-	free(ptr);
-	return (0);
-}
-
-static void
-free_directory_entry(struct directory_entry *dirp)
-{
-	if (dirp->name != NULL)
-		free(dirp->name);
-
-	if (dirp->whole_name != NULL)
-		free(dirp->whole_name);
-
-	if (dirp->rr_attributes != NULL)
-		free(dirp->rr_attributes);
-
-	if (dirp->table != NULL)
-		free(dirp->table);
-
-	free(dirp);
-}
-
-/*
- * Search the list to see if we have any entries from the previous
- * session that match this entry.  If so, copy the extent number
- * over so we don't bother to write it out to the new session.
- */
-int
-check_prev_session(struct directory_entry **ptr, int len, 
-						 struct directory_entry *curr_entry, 
-						 struct stat *statbuf, 
-						 struct stat *lstatbuf, 
-						 struct directory_entry **odpnt)
-{
-	int		i;
-	int		rr;
-	int		retcode = 0;	/* Default not found */
-
-	for (i = 0; i < len; i++) {
-		if (ptr[i] == NULL) {	/* Used or empty entry skip */
-			continue;
-		}
-#if 0
-		if (ptr[i]->name != NULL && ptr[i]->isorec.name_len[0] == 1 &&
-		    ptr[i]->name[0] == '\0') {
-			continue;
-		}
-		if (ptr[i]->name != NULL && ptr[i]->isorec.name_len[0] == 1 &&
-		    ptr[i]->name[0] == 1) {
-			continue;
-		}
-#else
-		if (ptr[i]->name != NULL && strcmp(ptr[i]->name, ".") == 0) {
-			continue;
-		}
-		if (ptr[i]->name != NULL && strcmp(ptr[i]->name, "..") == 0) {
-			continue;
-		}
-#endif
-
-		if (ptr[i]->name != NULL &&
-		    strcmp(ptr[i]->name, curr_entry->name) != 0) {
-			/* Not the same name continue */
-			continue;
-		}
-		/*
-		 * It's a directory so we must always merge it with the new
-		 * session. Never ever reuse directory extents.  See comments
-		 * in tree.c for an explaination of why this must be the case.
-		 */
-		if ((curr_entry->isorec.flags[0] & ISO_DIRECTORY) != 0) {
-			retcode = 2;	/* Flag directory case */
-			goto found_it;
-		}
-		/*
-		 * We know that the files have the same name.  If they also
-		 * have the same file type (i.e. file, dir, block, etc), then
-		 * we can safely reuse the TRANS.TBL entry for this file. The
-		 * check_rr_dates() function will do this for us.
-		 *
-		 * Verify that the file type and dates are consistent. If not,
-		 * we probably have a different file, and we need to write it
-		 * out again.
-		 */
-		retcode = 1;	/* We found a non directory */
-
-		if (ptr[i]->rr_attributes != NULL) {
-			if ((rr = check_rr_dates(ptr[i], curr_entry, statbuf,
-							lstatbuf)) == -1)
-				return (-1);
-
-			if (rr == 0) {	/* Different files */
-				goto found_it;
-			}
-		}
-		/*
-		 * Verify size and timestamp.  If rock ridge is in use, we
-		 * need to compare dates from RR too.  Directories are special,
-		 * we calculate their size later.
-		 */
-		if (ptr[i]->size != curr_entry->size) {
-			/* Different files */
-			goto found_it;
-		}
-		if (memcmp(ptr[i]->isorec.date,
-					curr_entry->isorec.date, 7) != 0) {
-			/* Different files */
-			goto found_it;
-		}
-		/* We found it and we can reuse the extent */
-		memcpy(curr_entry->isorec.extent, ptr[i]->isorec.extent, 8);
-		curr_entry->de_flags |= SAFE_TO_REUSE_TABLE_ENTRY;
-		goto found_it;
-	}
-	return (retcode);
-
-found_it:
-	if (odpnt != NULL) {
-		*odpnt = ptr[i];
-	} else {
-		free(ptr[i]);
-	}
-	ptr[i] = NULL;
-	return (retcode);
-}
-
-/*
- * open_merge_image:  Open an existing image.
- */
-int
-open_merge_image(char *path)
-{
-#ifndef	USE_SCG
-	in_image = fopen(path, "rb");
-	if (in_image == NULL) {
-		return (-1);
-	}
-#else
-	in_image = fopen(path, "rb");
-	if (in_image == NULL) {
-		if (scsidev_open(path) < 0)
-			return (-1);
-	}
-#endif
-	return (0);
-}
-
-/*
- * close_merge_image:  Close an existing image.
- */
-int
-close_merge_image()
-{
-#ifdef	USE_SCG
-	return (scsidev_close());
-#else
-	return (fclose(in_image));
-#endif
-}
-
-/*
- * merge_isofs:  Scan an existing image, and return a pointer
- * to the root directory for this image.
- */
-struct iso_directory_record *
-merge_isofs(char *path)
-{
-	char		buffer[SECTOR_SIZE];
-	int		file_addr;
-	int		i;
-	struct iso_primary_descriptor *pri = NULL;
-	struct iso_directory_record *rootp;
-	struct iso_volume_descriptor *vdp;
-
-	/*
-	 * Start by searching for the volume header. Ultimately, we need to
-	 * search for volume headers in multiple places because we might be
-	 * starting with a multisession image. FIXME(eric).
-	 */
-	get_session_start(&file_addr);
-
-	for (i = 0; i < 100; i++) {
-		if (readsecs(file_addr, buffer,
-				sizeof (buffer) / SECTOR_SIZE) != sizeof (buffer)) {
-#ifdef	USE_LIBSCHILY
-			comerr(" Read error on old image %s\n", path);
-#else
-			fprintf(stderr, " Read error on old image %s\n", path);
-			exit(10);
-#endif
-		}
-		vdp = (struct iso_volume_descriptor *) buffer;
-
-		if ((strncmp(vdp->id, ISO_STANDARD_ID, sizeof (vdp->id)) == 0) &&
-		    (isonum_711((unsigned char *) vdp->type) == ISO_VD_PRIMARY)) {
-			break;
-		}
-		file_addr += 1;
-	}
-
-	if (i == 100) {
-		return (NULL);
-	}
-	pri = (struct iso_primary_descriptor *) vdp;
-
-	/* Check the blocksize of the image to make sure it is compatible. */
-	if (isonum_723((unsigned char *) pri->logical_block_size) != SECTOR_SIZE) {
-		errmsgno(EX_BAD,
-			"Previous session has incompatible sector size %d.\n",
-			isonum_723((unsigned char *) pri->logical_block_size));
-		return (NULL);
-	}
-	if (isonum_723((unsigned char *) pri->volume_set_size) != 1) {
-		errmsgno(EX_BAD,
-			"Previous session has volume set size %d (must be 1).\n",
-			isonum_723((unsigned char *) pri->volume_set_size));
-		return (NULL);
-	}
-	/* Get the location and size of the root directory. */
-	rootp = (struct iso_directory_record *)
-		e_malloc(sizeof (struct iso_directory_record));
-
-	memcpy(rootp, pri->root_directory_record, sizeof (*rootp));
-
-	return (rootp);
-}
-
-static void
-merge_remaining_entries(struct directory *this_dir, 
-								struct directory_entry **pnt, int n_orig)
-{
-	int		i;
-	struct directory_entry *s_entry;
-	unsigned int	ttbl_extent = 0;
-	unsigned int	ttbl_index = 0;
-	char		whole_path[PATH_MAX];
-
-	/*
-	 * Whatever is leftover in the list needs to get merged back into the
-	 * directory.
-	 */
-	for (i = 0; i < n_orig; i++) {
-		if (pnt[i] == NULL) {
-			continue;
-		}
-		if (pnt[i]->name != NULL && pnt[i]->whole_name == NULL) {
-			/* Set the name for this directory. */
-			strcpy(whole_path, this_dir->de_name);
-			strcat(whole_path, SPATH_SEPARATOR);
-			strcat(whole_path, pnt[i]->name);
-
-			pnt[i]->whole_name = strdup(whole_path);
-		}
-		if (pnt[i]->name != NULL &&
-/*			strcmp(pnt[i]->name, "<translation table>") == 0 )*/
-			strcmp(pnt[i]->name, trans_tbl) == 0) {
-			ttbl_extent =
-			    isonum_733((unsigned char *)pnt[i]->isorec.extent);
-			ttbl_index = i;
-			continue;
-		}
-
-		/*
-		 * Skip directories for now - these need to be treated
-		 * differently.
-		 */
-		if ((pnt[i]->isorec.flags[0] & ISO_DIRECTORY) != 0) {
-			/*
-			 * FIXME - we need to insert this directory into the
-			 * tree, so that the path tables we generate will be
-			 * correct.
-			 */
-			if ((strcmp(pnt[i]->name, ".") == 0) ||
-				(strcmp(pnt[i]->name, "..") == 0)) {
-				free_directory_entry(pnt[i]);
-				pnt[i] = NULL;
-				continue;
-			} else {
-				merge_old_directory_into_tree(pnt[i], this_dir);
-			}
-		}
-		pnt[i]->next = this_dir->contents;
-		pnt[i]->filedir = this_dir;
-		this_dir->contents = pnt[i];
-		pnt[i] = NULL;
-	}
-
-
-	/*
-	 * If we don't have an entry for the translation table, then don't
-	 * bother trying to copy the starting extent over. Note that it is
-	 * possible that if we are copying the entire directory, the entry for
-	 * the translation table will have already been inserted into the
-	 * linked list and removed from the old entries list, in which case we
-	 * want to leave the extent number as it was before.
-	 */
-	if (ttbl_extent == 0) {
-		return;
-	}
-	/*
-	 * Finally, check the directory we are creating to see whether there
-	 * are any new entries in it.  If there are not, we can reuse the same
-	 * translation table.
-	 */
-	for (s_entry = this_dir->contents; s_entry; s_entry = s_entry->next) {
-		/*
-		 * Don't care about '.' or '..'.  They are never in the table
-		 * anyways.
-		 */
-		if (s_entry->name != NULL && strcmp(s_entry->name, ".") == 0) {
-			continue;
-		}
-		if (s_entry->name != NULL && strcmp(s_entry->name, "..") == 0) {
-			continue;
-		}
-/*		if (strcmp(s_entry->name, "<translation table>") == 0)*/
-		if (strcmp(s_entry->name, trans_tbl) == 0) {
-			continue;
-		}
-		if ((s_entry->de_flags & SAFE_TO_REUSE_TABLE_ENTRY) == 0) {
-			return;
-		}
-	}
-
-	/*
-	 * Locate the translation table, and re-use the same extent. It isn't
-	 * clear that there should ever be one in there already so for now we
-	 * try and muddle through the best we can.
-	 */
-	for (s_entry = this_dir->contents; s_entry; s_entry = s_entry->next) {
-/*		if (strcmp(s_entry->name, "<translation table>") == 0)*/
-		if (strcmp(s_entry->name, trans_tbl) == 0) {
-			fprintf(stderr, "Should never get here\n");
-			set_733(s_entry->isorec.extent, ttbl_extent);
-			return;
-		}
-	}
-
-	pnt[ttbl_index]->next = this_dir->contents;
-	pnt[ttbl_index]->filedir = this_dir;
-	this_dir->contents = pnt[ttbl_index];
-	pnt[ttbl_index] = NULL;
-}
-
-
-/*
- * Here we have a case of a directory that has completely disappeared from
- * the face of the earth on the tree we are mastering from.  Go through and
- * merge it into the tree, as well as everything beneath it.
- *
- * Note that if a directory has been moved for some reason, this will
- * incorrectly pick it up and attempt to merge it back into the old
- * location.  FIXME(eric).
- */
-static int
-merge_old_directory_into_tree(struct directory_entry *dpnt, 
-										struct directory *parent)
-{
-	struct directory_entry **contents = NULL;
-	int		i;
-	int		n_orig;
-	struct directory *this_dir,
-			*next_brother;
-	char		whole_path[PATH_MAX];
-
-	this_dir = (struct directory *) e_malloc(sizeof (struct directory));
-	memset(this_dir, 0, sizeof (struct directory));
-	this_dir->next = NULL;
-	this_dir->subdir = NULL;
-	this_dir->self = dpnt;
-	this_dir->contents = NULL;
-	this_dir->size = 0;
-	this_dir->extent = 0;
-	this_dir->depth = parent->depth + 1;
-	this_dir->parent = parent;
-	if (!parent->subdir)
-		parent->subdir = this_dir;
-	else {
-		next_brother = parent->subdir;
-		while (next_brother->next)
-			next_brother = next_brother->next;
-		next_brother->next = this_dir;
-	}
-
-	/* Set the name for this directory. */
-	strcpy(whole_path, parent->de_name);
-	strcat(whole_path, SPATH_SEPARATOR);
-	strcat(whole_path, dpnt->name);
-	this_dir->de_name = strdup(whole_path);
-	this_dir->whole_name = strdup(whole_path);
-
-	/*
-	 * Now fill this directory using information from the previous session.
-	 */
-	contents = read_merging_directory(&dpnt->isorec, &n_orig);
-	/*
-	 * Start by simply copying the '.', '..' and non-directory entries to
-	 * this directory.  Technically we could let merge_remaining_entries
-	 * handle this, but it gets rather confused by the '.' and '..' entries
-	 */
-	for (i = 0; i < n_orig; i++) {
-		/*
-		 * We can always reuse the TRANS.TBL in this particular case.
-		 */
-		contents[i]->de_flags |= SAFE_TO_REUSE_TABLE_ENTRY;
-
-		if (((contents[i]->isorec.flags[0] & ISO_DIRECTORY) != 0) &&
-							(i >= 2)) {
-			continue;
-		}
-		/* If we have a directory, don't reuse the extent number. */
-		if ((contents[i]->isorec.flags[0] & ISO_DIRECTORY) != 0) {
-			memset(contents[i]->isorec.extent, 0, 8);
-
-			if (strcmp(contents[i]->name, ".") == 0)
-				this_dir->dir_flags |= DIR_HAS_DOT;
-
-			if (strcmp(contents[i]->name, "..") == 0)
-				this_dir->dir_flags |= DIR_HAS_DOTDOT;
-		}
-		/*
-		 * for regilar files, we do it here.
-		 * If it has CL or RE attributes, remember its extent
-		 */
-		check_rr_relocation(contents[i]);
-
-		/*
-		 * Set the whole name for this file.
-		 */
-		strcpy(whole_path, this_dir->whole_name);
-		strcat(whole_path, SPATH_SEPARATOR);
-		strcat(whole_path, contents[i]->name);
-
-		contents[i]->whole_name = strdup(whole_path);
-
-		contents[i]->next = this_dir->contents;
-		contents[i]->filedir = this_dir;
-		this_dir->contents = contents[i];
-		contents[i] = NULL;
-	}
-
-	/*
-	 * and for directories, we do it here.
-	 * If it has CL or RE attributes, remember its extent
-	 */
-	check_rr_relocation(dpnt);
-
-	/*
-	 * Zero the extent number for ourselves.
-	 */
-	memset(dpnt->isorec.extent, 0, 8);
-
-	/*
-	 * Anything that is left are other subdirectories that need to be
-	 * merged.
-	 */
-	merge_remaining_entries(this_dir, contents, n_orig);
-	free_mdinfo(contents, n_orig);
-#if 0
-	/*
-	 * This is no longer required.  The post-scan sort will handle all of
-	 * this for us.
-	 */
-	sort_n_finish(this_dir);
-#endif
-
-	return (0);
-}
-
-
-char	*cdrecord_data = NULL;
-
-int
-get_session_start(int *file_addr)
-{
-	char		*pnt;
-
-#ifdef CDRECORD_DETERMINES_FIRST_WRITABLE_ADDRESS
-	/*
-	 * FIXME(eric).  We need to coordinate with cdrecord to obtain the
-	 * parameters.  For now, we assume we are writing the 2nd session, so
-	 * we start from the session that starts at 0.
-	 */
-	if (file_addr != NULL)
-		*file_addr = 16;
-
-	/*
-	 * We need to coordinate with cdrecord to get the next writable address
-	 * from the device.  Here is where we use it.
-	 */
-	session_start = last_extent = last_extent_written = cdrecord_result();
-#else
-
-	if (file_addr != NULL)
-		*file_addr = 0L;
-	session_start = last_extent = last_extent_written = 0L;
-	if (check_session && cdrecord_data == NULL)
-		return (0);
-
-	if (cdrecord_data == NULL) {
-#ifdef	USE_LIBSCHILY
-		comerrno(EX_BAD,
-		    "Special parameters for cdrecord not specified with -C\n");
-#else
-		fprintf(stderr,
-		    "Special parameters for cdrecord not specified with -C\n");
-		exit(1);
-#endif
-	}
-	/*
-	 * Next try and find the ',' in there which delimits the two numbers.
-	 */
-	pnt = strchr(cdrecord_data, ',');
-	if (pnt == NULL) {
-#ifdef	USE_LIBSCHILY
-		comerrno(EX_BAD, "Malformed cdrecord parameters\n");
-#else
-		fprintf(stderr, "Malformed cdrecord parameters\n");
-		exit(1);
-#endif
-	}
-
-	*pnt = '\0';
-	if (file_addr != NULL) {
-		*file_addr = atol(cdrecord_data);
-	}
-	pnt++;
-
-	session_start = last_extent = last_extent_written = atol(pnt);
-
-	pnt--;
-	*pnt = ',';
-
-#endif
-	return (0);
-}
-
-/*
- * This function scans the directory tree, looking for files, and it makes
- * note of everything that is found.  We also begin to construct the ISO9660
- * directory entries, so that we can determine how large each directory is.
- */
-int
-merge_previous_session(struct directory *this_dir, 
-							  struct iso_directory_record *mrootp, 
-							  char *reloc_root, 
-							  char *reloc_old_root)
-{
-	struct directory_entry **orig_contents = NULL;
-	struct directory_entry *odpnt = NULL;
-	int		n_orig;
-	struct directory_entry *s_entry;
-	int		status;
-	int		lstatus;
-	struct stat	statbuf,
-			lstatbuf;
-	int		retcode;
-
-	/* skip leading slash */
-	while (reloc_old_root && reloc_old_root[0] == PATH_SEPARATOR) {
-		reloc_old_root++;
-	}
-	while (reloc_root && reloc_root[0] == PATH_SEPARATOR) {
-		reloc_root++;
-	}
-
-	/*
-	 * Parse the same directory in the image that we are merging for
-	 * multisession stuff.
-	 */
-	orig_contents = read_merging_directory(mrootp, &n_orig);
-	if (orig_contents == NULL) {
-		if (reloc_old_root) {
-#ifdef	USE_LIBSCHILY
-			comerrno(EX_BAD,
-			"Reading old session failed, cannot execute -old-root.\n");
-#else
-			fprintf(stderr,
-			"Reading old session failed, cannot execute -old-root.\n");
-			exit(1);
-#endif
-		}
-		return (0);
-	}
-
-	if (reloc_old_root && reloc_old_root[0]) {
-		struct directory_entry	**new_orig_contents = orig_contents;
-		int			new_n_orig = n_orig;
-
-		/* decend until we reach the original root */
-		while (reloc_old_root[0]) {
-			int	i;
-			char	*next;
-			int	last;
-
-			for (next = reloc_old_root; *next && *next != PATH_SEPARATOR; next++);
-			if (*next) {
-				last = 0;
-				*next = 0;
-				next++;
-			} else {
-				last = 1;
-			}
-			while (*next == PATH_SEPARATOR) {
-				next++;
-			}
-
-			for (i = 0; i < new_n_orig; i++) {
-				struct iso_directory_record subroot;
-
-				if (new_orig_contents[i]->name != NULL &&
-				    strcmp(new_orig_contents[i]->name, reloc_old_root) != 0) {
-					/* Not the same name continue */
-					continue;
-				}
-				/*
-				 * enter directory, free old one only if not the top level,
-				 * which is still needed
-				 */
-				subroot = new_orig_contents[i]->isorec;
-				if (new_orig_contents != orig_contents) {
-					free_mdinfo(new_orig_contents, new_n_orig);
-				}
-				new_orig_contents = read_merging_directory(&subroot, &new_n_orig);
-
-				if (!new_orig_contents) {
-#ifdef	USE_LIBSCHILY
-					comerrno(EX_BAD,
-					"Reading directory %s in old session failed, cannot execute -old-root.\n",
-							reloc_old_root);
-#else
-					fprintf(stderr,
-					"Reading directory %s in old session failed, cannot execute -old-root.\n",
-							reloc_old_root);
-					exit(1);
-#endif
-				}
-				i = -1;
-				break;
-			}
-
-			if (i == new_n_orig) {
-#ifdef	USE_LIBSCHILY
-				comerrno(EX_BAD,
-				"-old-root (sub)directory %s not found in old session.\n",
-						reloc_old_root);
-#else
-				fprintf(stderr,
-				"-old-root (sub)directory %s not found in old session.\n",
-						reloc_old_root);
-				exit(1);
-#endif
-			}
-
-			/* restore string, proceed to next sub directory */
-			if (!last) {
-				reloc_old_root[strlen(reloc_old_root)] = PATH_SEPARATOR;
-			}
-			reloc_old_root = next;
-		}
-
-		/*
-		 * preserve the old session, skipping those dirs/files that are found again
-		 * in the new root
-		 */
-		for (s_entry = this_dir->contents; s_entry; s_entry = s_entry->next) {
-			status = stat_filter(s_entry->whole_name, &statbuf);
-			lstatus = lstat_filter(s_entry->whole_name, &lstatbuf);
-
-			/*
-			 * check_prev_session() will search for s_entry and remove it from
-			 * orig_contents if found
-			 */
-			retcode = check_prev_session(orig_contents, n_orig, s_entry,
-			    &statbuf, &lstatbuf, NULL);
-			if (retcode == -1)
-				return (-1);
-		}
-		merge_remaining_entries(this_dir, orig_contents, n_orig);
-
-		/* use new directory */
-		free_mdinfo(orig_contents, n_orig);
-		orig_contents = new_orig_contents;
-		n_orig = new_n_orig;
-
-		if (reloc_root && reloc_root[0]) {
-			/* also decend into new root before searching for files */
-			this_dir = find_or_create_directory(this_dir, reloc_root, NULL, TRUE);
-			if (!this_dir) {
-				return (-1);
-			}
-		}
-	}
-
-
-	/*
-	 * Now we scan the directory itself, and look at what is inside of it.
-	 */
-	for (s_entry = this_dir->contents; s_entry; s_entry = s_entry->next) {
-		status = stat_filter(s_entry->whole_name, &statbuf);
-		lstatus = lstat_filter(s_entry->whole_name, &lstatbuf);
-
-		/*
-		 * We always should create an entirely new directory tree
-		 * whenever we generate a new session, unless there were
-		 * *no* changes whatsoever to any of the directories, in which
-		 * case it would be kind of pointless to generate a new
-		 * session.
-		 * I believe it is possible to rigorously prove that any change
-		 * anywhere in the filesystem will force the entire tree to be
-		 * regenerated because the modified directory will get a new
-		 * extent number.  Since each subdirectory of the changed
-		 * directory has a '..' entry, all of them will need to be
-		 * rewritten too, and since the parent directory of the
-		 * modified directory will have an extent pointer to the
-		 * directory it too will need to be rewritten.  Thus we will
-		 * never be able to reuse any directory information when
-		 * writing new sessions.
-		 *
-		 * We still check the previous session so we can mark off the
-		 * equivalent entry in the list we got from the original disc,
-		 * however.
-		 */
-
-		/*
-		 * The check_prev_session function looks for an identical
-		 * entry in the previous session.  If we see it, then we copy
-		 * the extent number to s_entry, and cross it off the list.
-		 * It returns 2 if it's a directory
-		 */
-		retcode = check_prev_session(orig_contents, n_orig, s_entry,
-			&statbuf, &lstatbuf, &odpnt);
-		if (retcode == -1)
-			return (-1);
-
-		if (retcode == 2 && odpnt != NULL) {
-			int	dflag;
-
-			if (strcmp(s_entry->name, ".") != 0 &&
-					strcmp(s_entry->name, "..") != 0) {
-				struct directory *child;
-
-				/*
-				 * XXX It seems that the tree that has been
-				 * XXX read from the previous session does not
-				 * XXX carry whole_name entries. We provide a
-				 * XXX hack in
-				 * XXX multi.c:find_or_create_directory()
-				 * XXX that should be removed when a
-				 * XXX reasonable method could be found.
-				 */
-				child = find_or_create_directory(this_dir,
-					s_entry->whole_name,
-					s_entry, 1);
-				dflag = merge_previous_session(child,
-					&odpnt->isorec,
-					NULL, reloc_old_root);
-				if (dflag == -1) {
-					return (-1);
-				}
-				free(odpnt);
-				odpnt = NULL;
-			}
-		}
-	}
-
-	if (!reloc_old_root) {
-		/*
-		 * Whatever is left over, are things which are no longer in the tree on
-		 * disk. We need to also merge these into the tree.
-		 */
-		merge_remaining_entries(this_dir, orig_contents, n_orig);
-	}
-	free_mdinfo(orig_contents, n_orig);
-	return (1);
-}
-
-/*
- * This code deals with relocated directories which may exist
- * in the previous session.
- */
-struct dir_extent_link  {
-	unsigned int		extent;
-	struct directory_entry	*de;
-	struct dir_extent_link	*next;
-};
-
-static struct dir_extent_link	*cl_dirs = NULL;
-static struct dir_extent_link	*re_dirs = NULL;
-
-static void
-check_rr_relocation(struct directory_entry *de)
-{
-	unsigned char	sector[SECTOR_SIZE];
-	unsigned char	*pnt = de->rr_attributes;
-		int	len = de->rr_attr_size;
-		int	cont_extent = 0,
-			cont_offset = 0,
-			cont_size = 0;
-
-	pnt = parse_xa(pnt, &len, /* dpnt */ 0);
-	while (len >= 4) {
-		if (pnt[3] != 1 && pnt[3] != 2) {
-#ifdef USE_LIBSCHILY
-			errmsgno(EX_BAD, "**BAD RRVERSION (%d) for %c%c\n", pnt[3], pnt[0], pnt[1]);
-#else
-			fprintf(stderr, "**BAD RRVERSION (%d) for %c%c\n", pnt[3], pnt[0], pnt[1]);
-#endif
-		}
-		if (strncmp((char *) pnt, "CL", 2) == 0) {
-			struct dir_extent_link *dlink = e_malloc(sizeof (*dlink));
-
-			dlink->extent = isonum_733(pnt + 4);
-			dlink->de = de;
-			dlink->next = cl_dirs;
-			cl_dirs = dlink;
-
-		} else if (strncmp((char *) pnt, "RE", 2) == 0) {
-			struct dir_extent_link *dlink = e_malloc(sizeof (*dlink));
-
-			dlink->extent = de->starting_block;
-			dlink->de = de;
-			dlink->next = re_dirs;
-			re_dirs = dlink;
-
-		} else 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);
-
-		} else if (strncmp((char *) pnt, "ST", 2) == 0) {
-			len = pnt[2];
-		}
-		len -= pnt[2];
-		pnt += pnt[2];
-		if (len <= 3 && cont_extent) {
-			/* ??? What if cont_offset+cont_size > SECTOR_SIZE */
-			readsecs(cont_extent, sector, 1);
-			pnt = sector + cont_offset;
-			len = cont_size;
-			cont_extent = cont_offset = cont_size = 0;
-		}
-	}
-
-}
-
-void
-match_cl_re_entries()
-{
-	struct dir_extent_link *re = re_dirs;
-
-	/* for each relocated directory */
-	for (; re; re = re->next) {
-		struct dir_extent_link *cl = cl_dirs;
-
-		for (; cl; cl = cl->next) {
-			/* find a place where it was relocated from */
-			if (cl->extent == re->extent) {
-				/* set link to that place */
-				re->de->parent_rec = cl->de;
-				re->de->filedir = cl->de->filedir;
-
-				/*
-				 * see if it is in rr_moved
-				 */
-				if (reloc_dir != NULL) {
-					struct directory_entry *rr_moved_e = reloc_dir->contents;
-
-					for (; rr_moved_e; rr_moved_e = rr_moved_e->next) {
-						/* yes it is */
-						if (re->de == rr_moved_e) {
-							/* forget it */
-							re->de = NULL;
-						}
-					}
-				}
-				break;
-			}
-		}
-	}
-}
-
-void
-finish_cl_pl_for_prev_session()
-{
-	struct dir_extent_link *re = re_dirs;
-
-	/* for those that were relocated, but NOT to rr_moved */
-	re = re_dirs;
-	for (; re; re = re->next) {
-		if (re->de != NULL) {
-			/*
-			 * here we have hypothetical case when previous session
-			 * was not created by mkisoimage and contains relocations
-			 */
-			struct directory_entry *s_entry = re->de;
-			struct directory_entry *s_entry1;
-			struct directory *d_entry = reloc_dir->subdir;
-
-			/* do the same as finish_cl_pl_entries */
-			if (s_entry->de_flags & INHIBIT_ISO9660_ENTRY) {
-				continue;
-			}
-			while (d_entry) {
-				if (d_entry->self == s_entry)
-					break;
-				d_entry = d_entry->next;
-			}
-			if (!d_entry) {
-#ifdef USE_LIBSCHILY
-				comerrno(EX_BAD, "Unable to locate directory parent\n");
-#else
-				fprintf(stderr, "Unable to locate directory parent\n");
-				exit(1);
-#endif
-			}
-
-			if (s_entry->filedir != NULL && s_entry->parent_rec != NULL) {
-				char	*rr_attr;
-
-				/*
-				 * First fix the PL pointer in the directory in the
-				 * rr_reloc dir
-				 */
-				s_entry1 = d_entry->contents->next;
-				rr_attr = find_rr_attribute(s_entry1->rr_attributes,
-					s_entry1->total_rr_attr_size, "PL");
-				if (rr_attr != NULL)
-					set_733(rr_attr + 4, s_entry->filedir->extent);
-
-				/* Now fix the CL pointer */
-				s_entry1 = s_entry->parent_rec;
-
-				rr_attr = find_rr_attribute(s_entry1->rr_attributes,
-					s_entry1->total_rr_attr_size, "CL");
-				if (rr_attr != NULL)
-					set_733(rr_attr + 4, d_entry->extent);
-			}
-		}
-	}
-	/* free memory */
-	re = re_dirs;
-	while (re) {
-		struct dir_extent_link *next = re->next;
-
-		free(re);
-		re = next;
-	}
-	re = cl_dirs;
-	while (re) {
-		struct dir_extent_link *next = re->next;
-
-		free(re);
-		re = next;
-	}
-}

Copied: cdrkit/trunk/genisoimage/multi.c (from rev 452, cdrkit/trunk/mkisoimage/multi.c)

Deleted: cdrkit/trunk/genisoimage/name.c
===================================================================
--- cdrkit/trunk/mkisoimage/name.c	2006-11-23 21:37:32 UTC (rev 450)
+++ cdrkit/trunk/genisoimage/name.c	2006-11-23 22:11:41 UTC (rev 453)
@@ -1,536 +0,0 @@
-/*
- * This file has been modified for the cdrkit suite.
- *
- * The behaviour and appearence of the program code below can differ to a major
- * extent from the version distributed by the original author(s).
- *
- * For details, see Changelog file distributed with the cdrkit package. If you
- * received this file from another source then ask the distributing person for
- * a log of modifications.
- *
- */
-
-/* @(#)name.c	1.28 04/03/05 joerg */
-#ifndef lint
-static	char sccsid[] =
-	"@(#)name.c	1.28 04/03/05 joerg";
-
-#endif
-/*
- * File name.c - map full Unix file names to unique 8.3 names that
- * would be valid on DOS.
- *
- *
- * Written by Eric Youngdale (1993).
- * Almost totally rewritten by J. Schilling (2000).
- *
- * Copyright 1993 Yggdrasil Computing, Incorporated
- * Copyright (c) 1999,2000 J. Schilling
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <mconfig.h>
-#include "mkisoimage.h"
-#include <standard.h>
-#include <schily.h>
-#include <ctype.h>
-
-void	iso9660_check(struct iso_directory_record *idr,	
-						  struct directory_entry *ndr);
-int	iso9660_file_length(const char *name,
-								  struct directory_entry *sresult,
-								  int dirflag);
-
-void
-iso9660_check(struct iso_directory_record *idr, 
-				  struct directory_entry *ndr)
-{
-	int	nlen;
-	char	schar;
-	char	*p;
-	char	*np;
-
-	nlen = idr->name_len[0];
-	schar = idr->name[nlen];
-
-	if (nlen == 1 && (idr->name[0] == '\0' || idr->name[0] == '\001'))
-		return;
-
-	idr->name[nlen] = '\0';		/* Make it null terminated */
-	if ((p = strrchr(idr->name, ';')) != NULL) {
-		*p = '\0';		/* Strip off old version # */
-	}
-	iso9660_file_length(idr->name, ndr,
-				(idr->flags[0] & ISO_DIRECTORY) != 0);
-
-	if ((np = strrchr(ndr->isorec.name, ';')) != NULL) {
-		*np = '\0';		/* Strip off new version # */
-	}
-	if (strcmp(idr->name, ndr->isorec.name)) {
-		if (p)
-			*p = ';';	/* Restore old version # */
-		if (np)
-			*np = ';';	/* Restore new version # */
-		errmsgno(EX_BAD,
-			"Old session has illegal name '%.*s' length %d\n",
-			idr->name_len[0],
-			idr->name,
-			idr->name_len[0]);
-		errmsgno(EX_BAD,
-			"New session will use    name '%s'\n",
-			ndr->isorec.name);
-	}
-	if (p)
-		*p = ';';		/* Restore old version # */
-	if (np)
-		*np = ';';		/* Restore new version # */
-	idr->name[nlen] = schar;	/* Restore old iso record*/
-}
-
-/*
- * Function:	iso9660_file_length
- *
- * Purpose:	Map file name to 8.3 format, return length
- *		of result.
- *
- * Arguments:	name	file name we need to map.
- *		sresult	directory entry structure to contain mapped name.
- *		dirflag	flag indicating whether this is a directory or not.
- *
- * Note:	name being const * is a bug introduced by Eric but hard to
- *		fix without going through the whole source.
- */
-int
-iso9660_file_length(const char *name /* Not really const !!! */, 
-						  struct directory_entry *sresult, int dirflag)
-{
-	char		c;
-	char		*cp;
-	int		before_dot = 8;
-	int		after_dot = 3;
-	int		chars_after_dot = 0;
-	int		chars_before_dot = 0;
-	int		current_length = 0;
-	int		extra = 0;
-	int		ignore = 0;
-	char		*last_dot;
-	const char	*pnt;
-	int		priority = 32767;
-	char		*result;
-	int		ochars_after_dot;
-	int		ochars_before_dot;
-	int		seen_dot = 0;
-	int		seen_semic = 0;
-	int		tildes = 0;
-
-	result = sresult->isorec.name;
-
-	if (sresult->priority)
-		priority = sresult->priority;
-
-	/*
-	 * For the '.' entry, generate the correct record, and return 1 for
-	 * the length.
-	 */
-	if (strcmp(name, ".") == 0) {
-		*result = 0;
-		return (1);
-	}
-	/*
-	 * For the '..' entry, generate the correct record, and return 1
-	 * for the length.
-	 */
-	if (strcmp(name, "..") == 0) {
-		*result++ = 1;
-		*result++ = 0;
-		return (1);
-	}
-	/*
-	 * Now scan the directory one character at a time, and figure out
-	 * what to do.
-	 */
-	pnt = name;
-
-	/*
-	 * Find the '.' that we intend to use for the extension.
-	 * Usually this is the last dot, but if we have . followed by nothing
-	 * or a ~, we would consider this to be unsatisfactory, and we keep
-	 * searching.
-	 */
-	last_dot = strrchr(pnt, '.');
-	if ((last_dot != NULL) &&
-	    ((last_dot[1] == '~') || (last_dot[1] == '\0'))) {
-		cp = last_dot;
-		*cp = '\0';
-		last_dot = strrchr(pnt, '.');
-		*cp = '.';
-		/*
-		 * If we found no better '.' back up to the last match.
-		 */
-		if (last_dot == NULL)
-			last_dot = cp;
-	}
-
-	if (last_dot != NULL) {
-		ochars_after_dot = strlen(last_dot);	/* dot counts */
-		ochars_before_dot = last_dot - pnt;
-	} else {
-		ochars_before_dot = 128;
-		ochars_after_dot = 0;
-	}
-	/*
-	 * If we have full names, the names we generate will not work
-	 * on a DOS machine, since they are not guaranteed to be 8.3.
-	 * Nonetheless, in many cases this is a useful option.  We
-	 * still only allow one '.' character in the name, however.
-	 */
-	if (full_iso9660_filenames || iso9660_level > 1) {
-		before_dot = iso9660_namelen;
-		after_dot = before_dot - 1;
-
-		if (!dirflag) {
-			if (ochars_after_dot > ((iso9660_namelen/2)+1)) {
-				/*
-				 * The minimum number of characters before
-				 * the dot is 3 to allow renaming.
-				 * Let us allow to have 15 characters after
-				 * dot to give more rational filenames.
-				 */
-				before_dot = iso9660_namelen/2;
-				after_dot = ochars_after_dot;
-			} else {
-				before_dot -= ochars_after_dot; /* dot counts */
-				after_dot = ochars_after_dot;
-			}
-		}
-	}
-
-	while (*pnt) {
-#ifdef VMS
-		if (strcmp(pnt, ".DIR;1") == 0) {
-			break;
-		}
-#endif
-
-#ifdef		Eric_code_does_not_work
-		/*
-		 * XXX If we make this code active we get corrupted direcrory
-		 * XXX trees with infinite loops.
-		 */
-		/*
-		 * This character indicates a Unix style of backup file
-		 * generated by some editors.  Lower the priority of the file.
-		 */
-		if (iso_translate && *pnt == '#') {
-			priority = 1;
-			pnt++;
-			continue;
-		}
-		/*
-		 * This character indicates a Unix style of backup file
-		 * generated by some editors.  Lower the priority of the file.
-		 */
-		if (iso_translate && *pnt == '~') {
-			priority = 1;
-			tildes++;
-			pnt++;
-			continue;
-		}
-#endif
-		/*
-		 * This might come up if we had some joker already try and put
-		 * iso9660 version numbers into the file names.  This would be
-		 * a silly thing to do on a Unix box, but we check for it
-		 * anyways.  If we see this, then we don't have to add our own
-		 * version number at the end. UNLESS the ';' is part of the
-		 * filename and no valid version number is following.
-		 */
-		if (use_fileversion && *pnt == ';' && seen_dot) {
-			/*
-			 * Check if a valid version number follows.
-			 * The maximum valid version number is 32767.
-			 */
-			for (c = 1, cp = (char *)&pnt[1]; c < 6 && *cp; c++, cp++) {
-				if (*cp < '0' || *cp > '9')
-					break;
-			}
-			if (c <= 6 && *cp == '\0' && atoi(&pnt[1]) <= 32767)
-				seen_semic++;
-		}
-		/*
-		 * If we have a name with multiple '.' characters, we ignore
-		 * everything after we have gotten the extension.
-		 */
-		if (ignore) {
-			pnt++;
-			continue;
-		}
-		if (current_length >= iso9660_namelen) {
-#ifdef	nono
-			/*
-			 * Does not work as we may truncate before the dot.
-			 */
-			fprintf(stderr, "Truncating '%s' to '%.*s'.\n",
-				name,
-				current_length, sresult->isorec.name);
-			ignore++;
-#endif
-			pnt++;
-			continue;
-		}
-		/* Spin past any iso9660 version number we might have. */
-		if (seen_semic) {
-			if (seen_semic == 1) {
-				seen_semic++;
-				*result++ = ';';
-			}
-			if (*pnt >= '0' && *pnt <= '9') {
-				*result++ = *pnt;
-			}
-			extra++;
-			pnt++;
-			continue;
-		}
-
-		if (*pnt == '.') {
-			if (!allow_multidot) {
-				if (strcmp(pnt, ".tar.gz") == 0)
-					pnt = last_dot = ".tgz";
-				if (strcmp(pnt, ".ps.gz") == 0)
-					pnt = last_dot = ".psz";
-			}
-
-			if (!chars_before_dot && !allow_leading_dots) {
-				/*
-				 * DOS can't read files with dot first
-				 */
-				chars_before_dot++;
-				*result++ = '_'; /* Substitute underscore */
-
-			} else if (pnt == last_dot) {
-				if (seen_dot) {
-					ignore++;
-					continue;
-				}
-				*result++ = '.';
-				seen_dot++;
-			} else if (allow_multidot) {
-				if (chars_before_dot < before_dot) {
-					chars_before_dot++;
-					*result++ = '.';
-				}
-			} else {
-				/*
-				 * If this isn't the dot that we use
-				 * for the extension, then change the
-				 * character into a '_' instead.
-				 */
-				if (chars_before_dot < before_dot) {
-					chars_before_dot++;
-					*result++ = '_';
-				}
-			}
-		} else {
-			if ((seen_dot && (chars_after_dot < after_dot) &&
-						++chars_after_dot) ||
-			    (!seen_dot && (chars_before_dot < before_dot) &&
-			    ++chars_before_dot)) {
-
-				c = *pnt;
-				if (c & 0x80) {
-					/*
-					 * We allow 8 bit chars if -iso-level
-					 * is at least 4
-					 *
-					 * XXX We should check if the output
-					 * XXX character set is a 7 Bit ASCI
-					 * extension.
-					 */
-					if (iso9660_level >= 4) {
-						c = conv_charset(c, in_nls, out_nls);
-					} else {
-						c = '_';
-					}
-				} else if (!allow_lowercase) {
-					c = islower((unsigned char)c) ?
-						toupper((unsigned char)c) : c;
-				}
-				if (relaxed_filenames) {
-					/*
-					 * Here we allow a more relaxed syntax.
-					 */
-					if (c == '/')
-						c = '_';
-					*result++ = c;
-				} else switch (c) {
-					/*
-					 * Dos style filenames.
-					 * We really restrict the names here.
-					 */
-
-				default:
-					*result++ = c;
-					break;
-
-				/*
-				 * Descriptions of DOS's 'Parse Filename'
-				 * (function 29H) describes V1 and V2.0+
-				 * separator and terminator characters. These
-				 * characters in a DOS name make the file
-				 * visible but un-manipulable (all useful
-				 * operations error off.
-				 */
-				/* separators */
-				case '+':
-				case '=':
-				case '%': /* not legal DOS */
-						/* filename */
-				case ':':
-				case ';': /* already handled */
-				case '.': /* already handled */
-				case ',': /* already handled */
-				case '\t':
-				case ' ':
-				/* V1 only separators */
-				case '/':
-				case '"':
-				case '[':
-				case ']':
-				/* terminators */
-				case '>':
-				case '<':
-				case '|':
-				/*
-				 * Other characters that are not valid ISO-9660
-				 * characters.
-				 */
-				case '!':
-/*				case '#':*/
-				case '$':
-				case '&':
-				case '\'':
-				case '(':
-				case ')':
-				case '*':
-/*				case '-':*/
-				case '?':
-				case '@':
-				case '\\':
-				case '^':
-				case '`':
-				case '{':
-				case '}':
-/*				case '~':*/
-				/*
-				 * All characters below 32 (space) are not
-				 * allowed too.
-				 */
-				case 1: case 2: case 3: case 4:
-				case 5: case 6: case 7: case 8:
-				/* case 9: */
-				case 10: case 11: case 12:
-				case 13: case 14: case 15:
-				case 16: case 17: case 18:
-				case 19: case 20: case 21:
-				case 22: case 23: case 24:
-				case 25: case 26: case 27:
-				case 28: case 29: case 30:
-				case 31:
-
-					/*
-					 * Hmm - what to do here? Skip? Win95
-					 * looks like it substitutes '_'
-					 */
-					*result++ = '_';
-					break;
-
-				case '#':
-				case '-':
-				case '~':
-					/*
-					 * Check if we should allow these
-					 * illegal characters used by
-					 * Microsoft.
-					 */
-					if (iso_translate)
-						*result++ = '_';
-					else
-						*result++ = c;
-					break;
-				}	/* switch (*pnt) */
-			} else {	/* if (chars_{after,before}_dot) ... */
-				pnt++;
-				continue;
-			}
-		}	/* else *pnt == '.' */
-		current_length++;
-		pnt++;
-	}	/* while (*pnt) */
-
-	/*
-	 * OK, that wraps up the scan of the name.  Now tidy up a few other
-	 * things.
-	 * Look for emacs style of numbered backups, like foo.c.~3~.  If we
-	 * see this, convert the version number into the priority number.
-	 * In case of name conflicts, this is what would end up being used as
-	 * the 'extension'.
-	 */
-	if (tildes == 2) {
-		int	prio1 = 0;
-
-		pnt = name;
-		while (*pnt && *pnt != '~') {
-			pnt++;
-		}
-		if (*pnt) {
-			pnt++;
-		}
-		while (*pnt && *pnt != '~') {
-			prio1 = 10 * prio1 + *pnt - '0';
-			pnt++;
-		}
-		priority = prio1;
-	}
-	/*
-	 * If this is not a directory, force a '.' in case we haven't seen one,
-	 * and add a version number if we haven't seen one of those either.
-	 */
-	if (!dirflag) {
-		if (!seen_dot && !omit_period) {
-			if (chars_before_dot >= (iso9660_namelen-1)) {
-				chars_before_dot--;
-				result--;
-			}
-			*result++ = '.';
-			extra++;
-		}
-		if (!omit_version_number && !seen_semic) {
-			*result++ = ';';
-			*result++ = '1';
-			extra += 2;
-		}
-	}
-	*result++ = 0;
-	sresult->priority = priority;
-
-/*#define	DEBBUG*/
-#ifdef	DEBBUG
-	fprintf(stderr, "NAME: '%s'\n", sresult->isorec.name);
-	fprintf(stderr, "chars_before_dot %d chars_after_dot %d seen_dot %d extra %d\n",
-		chars_before_dot, chars_after_dot, seen_dot, extra);
-#endif
-	return (chars_before_dot + chars_after_dot + seen_dot + extra);
-}

Copied: cdrkit/trunk/genisoimage/name.c (from rev 452, cdrkit/trunk/mkisoimage/name.c)

Deleted: cdrkit/trunk/genisoimage/rock.c
===================================================================
--- cdrkit/trunk/mkisoimage/rock.c	2006-11-23 21:37:32 UTC (rev 450)
+++ cdrkit/trunk/genisoimage/rock.c	2006-11-23 22:11:41 UTC (rev 453)
@@ -1,868 +0,0 @@
-/*
- * This file has been modified for the cdrkit suite.
- *
- * The behaviour and appearence of the program code below can differ to a major
- * extent from the version distributed by the original author(s).
- *
- * For details, see Changelog file distributed with the cdrkit package. If you
- * received this file from another source then ask the distributing person for
- * a log of modifications.
- *
- */
-
-/* @(#)rock.c	1.43 05/05/01 joerg */
-#ifndef lint
-static	char sccsid[] =
-	"@(#)rock.c	1.43 05/05/01 joerg";
-#endif
-/*
- * File rock.c - generate RRIP  records for iso9660 filesystems.
- *
- * Written by Eric Youngdale (1993).
- *
- * Copyright 1993 Yggdrasil Computing, Incorporated
- * Copyright (c) 1999,2000-2003 J. Schilling
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <mconfig.h>
-#include "mkisoimage.h"
-#include <device.h>
-#include <schily.h>
-
-#define	SU_VERSION 1
-
-#define	SL_ROOT    8
-#define	SL_PARENT  4
-#define	SL_CURRENT 2
-#define	SL_CONTINUE 1
-
-#define	CE_SIZE 28	/* SUSP	Continuation aerea			*/
-#define	CL_SIZE 12	/* RR	Child Link for deep dir relocation	*/
-#define	ER_SIZE 8	/* RR	Extension record for RR signature	*/
-#define	NM_SIZE 5	/* RR	Real name				*/
-#define	PL_SIZE 12	/* RR	Paren Link for deep dir relocation	*/
-#define	PN_SIZE 20	/* RR	POSIX device modes (Major/Minor)	*/
-#define	PX_SIZE 36	/* RR	POSIX Extensions (mode/nlink(uid/gid)	*/
-#define	RE_SIZE 4	/* RR	Relocated directory			*/
-#define	RR_SIZE 5	/* RR	RR Signature in every file		*/
-#define	SL_SIZE 20	/* RR	Symlink					*/
-#define	ZF_SIZE 16	/* RR*	Linux compression extension		*/
-#ifdef APPLE_HYB
-#define	AA_SIZE 14	/* size of Apple extension */
-#endif	/* APPLE_HYB */
-#if defined(__QNX__) && !defined(__QNXNTO__)	/* Not on Neutrino! never OK? */
-#define	TF_SIZE (5 + 4 * 7)	/* RR	Time field			*/
-#else
-#define	TF_SIZE (5 + 3 * 7)
-#endif
-
-static	void	rstrncpy(char *t, char *f, int c,
-							struct unls_table *inls,
-							struct unls_table *onls);
-static	void	add_CE_entry(char *field, int line);
-static	int	gen_xa_attr(mode_t attr);
-static	void	gen_xa(struct stat *lstatbuf);
-int generate_xa_rr_attributes(char *whole_name, char *name,
-									 	struct directory_entry *s_entry,
-										struct stat *statbuf,
-										struct stat *lstatbuf,
-										int deep_opt);
-char *generate_rr_extension_record(char *id, char *descriptor, char *source,
-											  int *size);
-/*
- * If we need to store this number of bytes, make sure we
- * do not box ourselves in so that we do not have room for
- * a CE entry for the continuation record
- */
-#define	RR_CUR_USE	(CE_SIZE + currlen + (ipnt - recstart))
-
-#define	MAYBE_ADD_CE_ENTRY(BYTES) \
-	(((int)(BYTES)) + CE_SIZE + currlen + (ipnt - recstart) > reclimit ? 1 : 0)
-
-/*
- * Buffer to build RR attributes
- */
-static	Uchar	Rock[16384];
-static	Uchar	symlink_buff[PATH_MAX+1];
-static	int	ipnt = 0;	/* Current "write" offset in Rock[]	*/
-static	int	recstart = 0;	/* Start offset in Rock[] for this area	*/
-static	int	currlen = 0;	/* # of non RR bytes used in this area	*/
-static	int	mainrec = 0;	/* # of RR bytes use in main dir area	*/
-static	int	reclimit;	/* Max. # of bytes usable in this area	*/
-
-/* if we are using converted filenames, we don't want the '/' character */
-static void
-rstrncpy(char *t, char *f, int c, struct unls_table *inls, 
-			struct unls_table *onls)
-{
-	while (c-- && *f) {
-		*t = conv_charset(*f, inls, onls);
-		if (*t == '/') {
-			*t = '_';
-		}
-		t++;
-		f++;
-	}
-}
-
-static void
-add_CE_entry(char *field, int line)
-{
-	if (MAYBE_ADD_CE_ENTRY(0)) {
-		errmsgno(EX_BAD,
-		"Panic: no space, cannot add RR CE entry (%d bytes mising) for %s line %d.\n",
-		(CE_SIZE + currlen + (ipnt - recstart) - reclimit),
-		field, line);
-		errmsgno(EX_BAD, "currlen: %d ipnt: %d, recstart: %d\n",
-				currlen, ipnt, recstart);
-		errmsgno(EX_BAD, "Send  bug report to the maintainer.\n");
-		comerrno(EX_BAD, "Aborting.\n");
-	}
-
-	if (recstart)
-		set_733((char *) Rock + recstart - 8, ipnt + 28 - recstart);
-	Rock[ipnt++] = 'C';
-	Rock[ipnt++] = 'E';
-	Rock[ipnt++] = CE_SIZE;
-	Rock[ipnt++] = SU_VERSION;
-	set_733((char *) Rock + ipnt, 0);
-	ipnt += 8;
-	set_733((char *) Rock + ipnt, 0);
-	ipnt += 8;
-	set_733((char *) Rock + ipnt, 0);
-	ipnt += 8;
-	recstart = ipnt;
-	currlen = 0;
-	if (!mainrec)
-		mainrec = ipnt;
-	reclimit = SECTOR_SIZE - 8;	/* Limit to one sector */
-}
-
-static int
-gen_xa_attr(mode_t attr)
-{
-	int	ret = 0;
-
-	if (attr & S_IRUSR)
-		ret |= XA_O_READ;
-	if (attr & S_IXUSR)
-		ret |= XA_O_EXEC;
-
-	if (attr & S_IRGRP)
-		ret |= XA_G_READ;
-	if (attr & S_IXGRP)
-		ret |= XA_G_EXEC;
-
-	if (attr & S_IROTH)
-		ret |= XA_W_READ;
-	if (attr & S_IXOTH)
-		ret |= XA_W_EXEC;
-
-	ret |= XA_FORM1;
-
-	if (S_ISDIR(attr))
-		ret |= XA_DIR;
-
-	return (ret);
-}
-
-static void
-gen_xa(struct stat *lstatbuf)
-{
-		/*
-		 * Group ID
-		 */
-		set_722((char *) Rock + ipnt, lstatbuf->st_gid);
-		ipnt += 2;
-		/*
-		 * User ID
-		 */
-		set_722((char *) Rock + ipnt, lstatbuf->st_uid);
-		ipnt += 2;
-		/*
-		 * Attributes
-		 */
-		set_722((char *) Rock + ipnt, gen_xa_attr(lstatbuf->st_mode));
-		ipnt += 2;
-
-		Rock[ipnt++] = 'X';	/* XA Signature */
-		Rock[ipnt++] = 'A';
-		Rock[ipnt++] = 0;	/* File number (we always use '0' */
-
-		Rock[ipnt++] = 0;	/* Reserved (5 Byte) */
-		Rock[ipnt++] = 0;
-		Rock[ipnt++] = 0;
-		Rock[ipnt++] = 0;
-		Rock[ipnt++] = 0;
-
-}
-
-int
-generate_xa_rr_attributes(char *whole_name, char *name,
-								  struct directory_entry *s_entry,
-								  struct stat *statbuf,
-								  struct stat *lstatbuf,
-								  int deep_opt)
-{
-	int		flagpos;
-	int		flagval;
-	int		need_ce;
-
-	statbuf = statbuf;	/* this shuts up unreferenced compiler */
-				/* warnings */
-	mainrec = recstart = ipnt = 0;
-
-	if (use_XA) {
-		gen_xa(lstatbuf);
-	}
-
-/*	reclimit = 0xf8; XXX we now use 254 == 0xfe */
-	reclimit = MAX_ISODIR;
-
-	/* no need to fill in the RR stuff if we won't see the file */
-	if (s_entry->de_flags & INHIBIT_ISO9660_ENTRY)
-		return (0);
-
-	/*
-	 * Obtain the amount of space that is currently used for the directory
-	 * record.  We may safely use the current name length; because if name
-	 * confilcts force us to change the ISO-9660 name later, the name will
-	 * never become longer than now.
-	 */
-	if (strcmp(name, ".") == 0 || strcmp(name, "..") == 0) {
-		s_entry->isorec.name_len[0] = 1;
-	} else {
-		s_entry->isorec.name_len[0] = strlen(s_entry->isorec.name);
-	}
-	currlen = s_entry->isorec.length[0] = s_entry->isorec.name_len[0] +
-				offsetof(struct iso_directory_record, name[0]);
-	if (currlen & 1)
-		s_entry->isorec.length[0] = ++currlen;
-
-	if (currlen < 33+37) {
-		/*
-		 * If the ISO-9660 name length is less than 37, we may use
-		 * ISO-9660:1988 name rules and for this reason, the name len
-		 * may later increase from adding e.g. ".;1"; in this case
-		 * just use the upper limit.
-		 */
-		currlen = 33+37;
-	}
-
-#ifdef APPLE_HYB
-	/* if we have regular file, then add Apple extensions */
-	if (S_ISREG(lstatbuf->st_mode) && apple_ext && s_entry->hfs_ent) {
-		if (MAYBE_ADD_CE_ENTRY(AA_SIZE))
-			add_CE_entry("AA", __LINE__);
-		Rock[ipnt++] = 'A';	/* AppleSignature */
-		Rock[ipnt++] = 'A';
-		Rock[ipnt++] = AA_SIZE;	/* includes AppleSignature bytes */
-		Rock[ipnt++] = 0x02;	/* SystemUseID */
-		Rock[ipnt++] = s_entry->hfs_ent->u.file.type[0];
-		Rock[ipnt++] = s_entry->hfs_ent->u.file.type[1];
-		Rock[ipnt++] = s_entry->hfs_ent->u.file.type[2];
-		Rock[ipnt++] = s_entry->hfs_ent->u.file.type[3];
-		Rock[ipnt++] = s_entry->hfs_ent->u.file.creator[0];
-		Rock[ipnt++] = s_entry->hfs_ent->u.file.creator[1];
-		Rock[ipnt++] = s_entry->hfs_ent->u.file.creator[2];
-		Rock[ipnt++] = s_entry->hfs_ent->u.file.creator[3];
-		Rock[ipnt++] = (s_entry->hfs_ent->fdflags >> 8) & 0xff;
-		Rock[ipnt++] = s_entry->hfs_ent->fdflags & 0xff;
-	}
-#endif	/* APPLE_HYB */
-
-	if (!use_RockRidge)
-		goto xa_only;
-
-	/* Identify that we are using the SUSP protocol */
-	if (deep_opt & NEED_SP) {
-		/*
-		 * We may not use a CE record here but we never will need to
-		 * do so, as this SP record is only used for the "." entry
-		 * of the root directory.
-		 */
-		Rock[ipnt++] = 'S';
-		Rock[ipnt++] = 'P';
-		Rock[ipnt++] = 7;
-		Rock[ipnt++] = SU_VERSION;
-		Rock[ipnt++] = 0xbe;
-		Rock[ipnt++] = 0xef;
-		if (use_XA)
-			Rock[ipnt++] = sizeof (struct iso_xa_dir_record);
-		else
-			Rock[ipnt++] = 0;
-	}
-
-	/* First build the posix name field */
-	if (MAYBE_ADD_CE_ENTRY(RR_SIZE))
-		add_CE_entry("RR", __LINE__);
-	Rock[ipnt++] = 'R';
-	Rock[ipnt++] = 'R';
-	Rock[ipnt++] = 5;
-	Rock[ipnt++] = SU_VERSION;
-	flagpos = ipnt;
-	flagval = 0;
-	Rock[ipnt++] = 0;	/* We go back and fix this later */
-
-	if (strcmp(name, ".") && strcmp(name, "..")) {
-		char		*npnt;
-		int		remain;	/* Remaining name length  */
-		int		use;	/* Current name part used */
-
-#ifdef APPLE_HYB
-		/* use the HFS name if it exists */
-		if (USE_MAC_NAME(s_entry)) {
-			remain = strlen(s_entry->hfs_ent->name);
-			npnt = s_entry->hfs_ent->name;
-		} else {
-#endif	/* APPLE_HYB */
-
-			remain = strlen(name);
-			npnt = name;
-#ifdef APPLE_HYB
-		}
-#endif	/* APPLE_HYB */
-
-		if (MAYBE_ADD_CE_ENTRY(NM_SIZE+1))
-			add_CE_entry("NM", __LINE__);
-		while (remain) {
-			use = remain;
-			need_ce = 0;
-			/* Can we fit this SUSP and a CE entry? */
-			if (MAYBE_ADD_CE_ENTRY(NM_SIZE+use)) {
-				use = reclimit - NM_SIZE - RR_CUR_USE;
-				need_ce++;
-			}
-			/* Only room for 256 per SUSP field */
-			if (use > 0xf8) {
-				use = 0xf8;
-				need_ce++;
-			}
-			if (use < 0) {
-				comerrno(EX_BAD,
-				"Negative RR name length residual: %d\n",
-					use);
-			}
-
-			/* First build the posix name field */
-			Rock[ipnt++] = 'N';
-			Rock[ipnt++] = 'M';
-			Rock[ipnt++] = NM_SIZE + use;
-			Rock[ipnt++] = SU_VERSION;
-			Rock[ipnt++] = (remain != use ? 1 : 0);
-			flagval |= (1 << 3);
-
-			/* convert charsets as required */
-#ifdef APPLE_HYB
-			if (USE_MAC_NAME(s_entry))
-				rstrncpy((char *) &Rock[ipnt], npnt, use,
-							hfs_inls, out_nls);
-			else
-#endif	/* APPLE_HYB */
-				rstrncpy((char *) &Rock[ipnt], npnt, use,
-							in_nls, out_nls);
-			npnt += use;
-			ipnt += use;
-			remain -= use;
-			if (remain && need_ce)
-				add_CE_entry("NM", __LINE__);
-		}
-	}
-
-	/* Add the posix modes */
-	if (MAYBE_ADD_CE_ENTRY(PX_SIZE))
-		add_CE_entry("PX", __LINE__);
-	Rock[ipnt++] = 'P';
-	Rock[ipnt++] = 'X';
-	Rock[ipnt++] = PX_SIZE;
-	Rock[ipnt++] = SU_VERSION;
-	flagval |= (1 << 0);
-	set_733((char *) Rock + ipnt, lstatbuf->st_mode);
-	ipnt += 8;
-	set_733((char *) Rock + ipnt, lstatbuf->st_nlink);
-	ipnt += 8;
-	set_733((char *) Rock + ipnt, lstatbuf->st_uid);
-	ipnt += 8;
-	set_733((char *) Rock + ipnt, lstatbuf->st_gid);
-	ipnt += 8;
-
-	/* Check for special devices */
-#if	defined(S_IFCHR) || defined(S_IFBLK)
-	/*
-	 * The code in this if statement used to be #ifdef'd with NON_UNIXFS.
-	 * But as statdefs.h always provides the macros S_ISCHR() & S_ISBLK()
-	 * and device.h always provides major()/minor() it is not needed
-	 * anymore.
-	 */
-	if (S_ISCHR(lstatbuf->st_mode) || S_ISBLK(lstatbuf->st_mode)) {
-		if (MAYBE_ADD_CE_ENTRY(PN_SIZE))
-			add_CE_entry("PN", __LINE__);
-		Rock[ipnt++] = 'P';
-		Rock[ipnt++] = 'N';
-		Rock[ipnt++] = PN_SIZE;
-		Rock[ipnt++] = SU_VERSION;
-		flagval |= (1 << 1);
-#if 1
-		/* This is the new and only code which uses <device.h> */
-		set_733((char *) Rock + ipnt, major(lstatbuf->st_rdev));
-		ipnt += 8;
-		set_733((char *) Rock + ipnt, minor(lstatbuf->st_rdev));
-		ipnt += 8;
-#else
-		/*
-		 * If we don't have sysmacros.h, then we have to guess as to
-		 * how best to pick apart the device number for major/minor.
-		 * Note: this may very well be wrong for many systems, so it
-		 * is always best to use the major/minor macros if the system
-		 * supports it.
-		 */
-		if (sizeof (dev_t) <= 2) {
-			set_733((char *)Rock + ipnt, (lstatbuf->st_rdev >> 8));
-			ipnt += 8;
-			set_733((char *)Rock + ipnt, lstatbuf->st_rdev & 0xff);
-			ipnt += 8;
-		} else if (sizeof (dev_t) <= 4) {
-			set_733((char *)Rock + ipnt,
-						(lstatbuf->st_rdev >> 8) >> 8);
-			ipnt += 8;
-			set_733((char *)Rock + ipnt,
-						lstatbuf->st_rdev & 0xffff);
-			ipnt += 8;
-		} else {
-			set_733((char *)Rock + ipnt,
-						(lstatbuf->st_rdev >> 16)>>16);
-			ipnt += 8;
-			set_733((char *)Rock + ipnt, lstatbuf->st_rdev);
-			ipnt += 8;
-		}
-#endif
-	}
-#endif	/* defined(S_IFCHR) || defined(S_IFBLK) */
-
-	/* Check for and symbolic links.  VMS does not have these. */
-#ifdef S_IFLNK
-	if (S_ISLNK(lstatbuf->st_mode)) {
-		int		lenpos;
-		int		lenval;
-		int		j0;
-		int		j1;
-		int		nchar;
-		Uchar		*cpnt;
-		Uchar		*cpnt1;
-
-#ifdef	HAVE_READLINK
-		nchar = readlink(whole_name, (char *)symlink_buff,
-						sizeof (symlink_buff)-1);
-#else
-		nchar = -1;
-#endif	/* HAVE_READLINK */
-		symlink_buff[nchar < 0 ? 0 : nchar] = 0;
-		nchar = strlen((char *) symlink_buff);
-		set_733(s_entry->isorec.size, 0);
-		cpnt = &symlink_buff[0];
-		flagval |= (1 << 2);
-
-		if (!split_SL_field) {
-			int		sl_bytes = 0;
-
-			for (cpnt1 = cpnt; *cpnt1 != '\0'; cpnt1++) {
-				if (*cpnt1 == '/') {
-					sl_bytes += 4;
-				} else {
-					sl_bytes += 1;
-				}
-			}
-			if (sl_bytes > 250) {
-				/*
-				 * the symbolic link won't fit into one
-				 * SL System Use Field print an error message
-				 * and continue with splited one
-				 */
-				fprintf(stderr,
-				"symbolic link ``%s'' to long for one SL System Use Field, splitting",
-								cpnt);
-			}
-			if (MAYBE_ADD_CE_ENTRY(SL_SIZE + sl_bytes))
-				add_CE_entry("SL+", __LINE__);
-		}
-		while (nchar) {
-			if (MAYBE_ADD_CE_ENTRY(SL_SIZE))
-				add_CE_entry("SL", __LINE__);
-			Rock[ipnt++] = 'S';
-			Rock[ipnt++] = 'L';
-			lenpos = ipnt;
-			Rock[ipnt++] = SL_SIZE;
-			Rock[ipnt++] = SU_VERSION;
-			Rock[ipnt++] = 0;	/* Flags */
-			lenval = 5;
-			while (*cpnt) {
-				cpnt1 = (Uchar *)
-						strchr((char *)cpnt, '/');
-				if (cpnt1) {
-					nchar--;
-					*cpnt1 = 0;
-				}
-
-				/*
-				 * We treat certain components in a special
-				 * way.
-				 */
-				if (cpnt[0] == '.' && cpnt[1] == '.' &&
-								cpnt[2] == 0) {
-					if (MAYBE_ADD_CE_ENTRY(2)) {
-						add_CE_entry("SL-parent", __LINE__);
-						if (cpnt1) {
-							*cpnt1 = '/';
-							nchar++;
-							/*
-							 * A kluge so that we
-							 * can restart properly
-							 */
-							cpnt1 = NULL;
-						}
-						break;
-					}
-					Rock[ipnt++] = SL_PARENT;
-					Rock[ipnt++] = 0; /* length is zero */
-					lenval += 2;
-					nchar -= 2;
-				} else if (cpnt[0] == '.' && cpnt[1] == 0) {
-					if (MAYBE_ADD_CE_ENTRY(2)) {
-						add_CE_entry("SL-current", __LINE__);
-						if (cpnt1) {
-							*cpnt1 = '/';
-							nchar++;
-							/*
-							 * A kluge so that we
-							 * can restart properly
-							 */
-							cpnt1 = NULL;
-						}
-						break;
-					}
-					Rock[ipnt++] = SL_CURRENT;
-					Rock[ipnt++] = 0; /* length is zero */
-					lenval += 2;
-					nchar -= 1;
-				} else if (cpnt[0] == 0) {
-					if (MAYBE_ADD_CE_ENTRY(2)) {
-						add_CE_entry("SL-root", __LINE__);
-						if (cpnt1) {
-							*cpnt1 = '/';
-							nchar++;
-							/*
-							 * A kluge so that we
-							 * can restart properly
-							 */
-							cpnt1 = NULL;
-						}
-						break;
-					}
-					Rock[ipnt++] = SL_ROOT;
-					Rock[ipnt++] = 0; /* length is zero */
-					lenval += 2;
-				} else {
-					/*
-					 * If we do not have enough room for a
-					 * component, start a new continuations
-					 * segment now
-					 */
-					if (split_SL_component ?
-						MAYBE_ADD_CE_ENTRY(6) :
-						MAYBE_ADD_CE_ENTRY(6 + strlen((char *) cpnt))) {
-						add_CE_entry("SL++", __LINE__);
-						if (cpnt1) {
-							*cpnt1 = '/';
-							nchar++;
-							/*
-							 * A kluge so that we
-							 * can restart properly
-							 */
-							cpnt1 = NULL;
-						}
-						break;
-					}
-					j0 = strlen((char *) cpnt);
-					while (j0) {
-						j1 = j0;
-						if (j1 > 0xf8)
-							j1 = 0xf8;
-						need_ce = 0;
-						if (j1 + currlen + 2 + CE_SIZE +
-						    (ipnt - recstart) >
-								reclimit) {
-
-							j1 = reclimit -
-							    (currlen + 2) -
-							    CE_SIZE -
-							    (ipnt - recstart);
-							need_ce++;
-						}
-						Rock[ipnt++] =
-							(j1 != j0 ?
-							SL_CONTINUE : 0);
-						Rock[ipnt++] = j1;
-						strncpy((char *)Rock + ipnt,
-							(char *) cpnt, j1);
-						ipnt += j1;
-						lenval += j1 + 2;
-						cpnt += j1;
-						/*
-						 * Number we processed
-						 * this time
-						 */
-						nchar -= j1;
-						j0 -= j1;
-						if (need_ce) {
-							add_CE_entry(
-							    "SL-path-split",
-							    __LINE__);
-							if (cpnt1) {
-								*cpnt1 = '/';
-								nchar++;
-								/*
-								 * A kluge so
-								 * that we can
-								 * restart
-								 * properly
-								 */
-								cpnt1 = NULL;
-							}
-							break;
-						}
-					}
-				}
-				if (cpnt1) {
-					cpnt = cpnt1 + 1;
-				} else
-					break;
-			}
-			Rock[lenpos] = lenval;
-			if (nchar) {
-				/* We need another SL entry */
-				Rock[lenpos + 2] = SL_CONTINUE;
-			}
-		}	/* while nchar */
-	}	/* Is a symbolic link */
-#endif	/* S_IFLNK */
-
-	/* Add in the Rock Ridge TF time field */
-	if (MAYBE_ADD_CE_ENTRY(TF_SIZE))
-		add_CE_entry("TF", __LINE__);
-	Rock[ipnt++] = 'T';
-	Rock[ipnt++] = 'F';
-	Rock[ipnt++] = TF_SIZE;
-	Rock[ipnt++] = SU_VERSION;
-#if defined(__QNX__) && !defined(__QNXNTO__)	/* Not on Neutrino! never OK? */
-	Rock[ipnt++] = 0x0f;
-#else
-	Rock[ipnt++] = 0x0e;
-#endif
-	flagval |= (1 << 7);
-
-#if defined(__QNX__) && !defined(__QNXNTO__)	/* Not on Neutrino! never OK? */
-	iso9660_date((char *) &Rock[ipnt], lstatbuf->st_ftime);
-	ipnt += 7;
-#endif
-	iso9660_date((char *) &Rock[ipnt], lstatbuf->st_mtime);
-	ipnt += 7;
-	iso9660_date((char *) &Rock[ipnt], lstatbuf->st_atime);
-	ipnt += 7;
-	iso9660_date((char *) &Rock[ipnt], lstatbuf->st_ctime);
-	ipnt += 7;
-
-	/* Add in the Rock Ridge RE (relocated dir) field */
-	if (deep_opt & NEED_RE) {
-		if (MAYBE_ADD_CE_ENTRY(RE_SIZE))
-			add_CE_entry("RE", __LINE__);
-		Rock[ipnt++] = 'R';
-		Rock[ipnt++] = 'E';
-		Rock[ipnt++] = RE_SIZE;
-		Rock[ipnt++] = SU_VERSION;
-		flagval |= (1 << 6);
-	}
-	/* Add in the Rock Ridge PL record, if required. */
-	if (deep_opt & NEED_PL) {
-		if (MAYBE_ADD_CE_ENTRY(PL_SIZE))
-			add_CE_entry("PL", __LINE__);
-		Rock[ipnt++] = 'P';
-		Rock[ipnt++] = 'L';
-		Rock[ipnt++] = PL_SIZE;
-		Rock[ipnt++] = SU_VERSION;
-		set_733((char *) Rock + ipnt, 0);
-		ipnt += 8;
-		flagval |= (1 << 5);
-	}
-
-	/* Add in the Rock Ridge CL field, if required. */
-	if (deep_opt & NEED_CL) {
-		if (MAYBE_ADD_CE_ENTRY(CL_SIZE))
-			add_CE_entry("CL", __LINE__);
-		Rock[ipnt++] = 'C';
-		Rock[ipnt++] = 'L';
-		Rock[ipnt++] = CL_SIZE;
-		Rock[ipnt++] = SU_VERSION;
-		set_733((char *) Rock + ipnt, 0);
-		ipnt += 8;
-		flagval |= (1 << 4);
-	}
-
-#ifndef VMS
-	/*
-	 * If transparent compression was requested, fill in the correct field
-	 * for this file, if (and only if) it is actually a compressed file!
-	 * This relies only on magic number, but it should in general not
-	 * be an issue since if you're using -z odds are most of your
-	 * files are already compressed.
-	 *
-	 * In the future it would be nice if mkisoimage actually did the
-	 * compression.
-	 */
-	if (transparent_compression && S_ISREG(lstatbuf->st_mode)) {
-		static const Uchar zisofs_magic[8] =
-			{ 0x37, 0xE4, 0x53, 0x96, 0xC9, 0xDB, 0xD6, 0x07 };
-		FILE		*zffile;
-		unsigned int	file_size;
-		Uchar		header[16];
-		int		OK_flag;
-		int		blocksize;
-		int		headersize;
-
-		/*
-		 * First open file and verify that the correct algorithm was
-		 * used
-		 */
-		file_size = 0;
-		OK_flag = 1;
-
-		memset(header, 0, sizeof (header));
-
-		zffile = fopen(whole_name, "rb");
-		if (zffile != NULL) {
-			if (fread(header, 1, sizeof (header), zffile) != sizeof (header))
-				OK_flag = 0;
-
-			/* Check magic number */
-			if (memcmp(header, zisofs_magic, sizeof (zisofs_magic)))
-				OK_flag = 0;
-
-			/* Get the real size of the file */
-			file_size = get_731((char *)header+8);
-
-			/* Get the header size (>> 2) */
-			headersize = header[12];
-
-			/* Get the block size (log2) */
-			blocksize = header[13];
-
-			fclose(zffile);
-		} else {
-			OK_flag = 0;
-			blocksize = headersize = 0; /* Make silly GCC quiet */
-		}
-
-		if (OK_flag) {
-			if (MAYBE_ADD_CE_ENTRY(ZF_SIZE))
-				add_CE_entry("ZF", __LINE__);
-			Rock[ipnt++] = 'Z';
-			Rock[ipnt++] = 'F';
-			Rock[ipnt++] = ZF_SIZE;
-			Rock[ipnt++] = SU_VERSION;
-			Rock[ipnt++] = 'p'; /* Algorithm: "paged zlib" */
-			Rock[ipnt++] = 'z';
-			/* 2 bytes for algorithm-specific information */
-			Rock[ipnt++] = headersize;
-			Rock[ipnt++] = blocksize;
-			set_733((char *) Rock + ipnt, file_size); /* Real file size */
-			ipnt += 8;
-		}
-	}
-#endif
-	/*
-	 * Add in the Rock Ridge CE field, if required.  We use  this for the
-	 * extension record that is stored in the root directory.
-	 */
-	if (deep_opt & NEED_CE)
-		add_CE_entry("ER", __LINE__);
-
-	/*
-	 * Done filling in all of the fields.  Now copy it back to a buffer
-	 * for the file in question.
-	 */
-	/* Now copy this back to the buffer for the file */
-	Rock[flagpos] = flagval;
-
-	/* If there was a CE, fill in the size field */
-	if (recstart)
-		set_733((char *) Rock + recstart - 8, ipnt - recstart);
-
-xa_only:
-	s_entry->rr_attributes = (Uchar *) e_malloc(ipnt);
-	s_entry->total_rr_attr_size = ipnt;
-	s_entry->rr_attr_size = (mainrec ? mainrec : ipnt);
-	memcpy(s_entry->rr_attributes, Rock, ipnt);
-	return (ipnt);
-}
-
-/*
- * Guaranteed to  return a single sector with the relevant info
- */
-char *
-generate_rr_extension_record(char *id, char *descriptor, char *source, 
-									  int *size)
-{
-	int		lipnt = 0;
-	char		*pnt;
-	int		len_id;
-	int		len_des;
-	int		len_src;
-
-	len_id = strlen(id);
-	len_des = strlen(descriptor);
-	len_src = strlen(source);
-	Rock[lipnt++] = 'E';
-	Rock[lipnt++] = 'R';
-	Rock[lipnt++] = ER_SIZE + len_id + len_des + len_src;
-	Rock[lipnt++] = 1;
-	Rock[lipnt++] = len_id;
-	Rock[lipnt++] = len_des;
-	Rock[lipnt++] = len_src;
-	Rock[lipnt++] = 1;
-
-	memcpy(Rock + lipnt, id, len_id);
-	lipnt += len_id;
-
-	memcpy(Rock + lipnt, descriptor, len_des);
-	lipnt += len_des;
-
-	memcpy(Rock + lipnt, source, len_src);
-	lipnt += len_src;
-
-	if (lipnt > SECTOR_SIZE) {
-#ifdef	USE_LIBSCHILY
-		comerrno(EX_BAD, "Extension record too long\n");
-#else
-		fprintf(stderr, "Extension record too long\n");
-		exit(1);
-#endif
-	}
-	pnt = (char *) e_malloc(SECTOR_SIZE);
-	memset(pnt, 0, SECTOR_SIZE);
-	memcpy(pnt, Rock, lipnt);
-	*size = lipnt;
-	return (pnt);
-}

Copied: cdrkit/trunk/genisoimage/rock.c (from rev 452, cdrkit/trunk/mkisoimage/rock.c)

Deleted: cdrkit/trunk/genisoimage/rsync.c
===================================================================
--- cdrkit/trunk/mkisoimage/rsync.c	2006-11-23 21:37:32 UTC (rev 450)
+++ cdrkit/trunk/genisoimage/rsync.c	2006-11-23 22:11:41 UTC (rev 453)
@@ -1,112 +0,0 @@
-/*
- * This file has been modified for the cdrkit suite.
- *
- * The behaviour and appearence of the program code below can differ to a major
- * extent from the version distributed by the original author(s).
- *
- * For details, see Changelog file distributed with the cdrkit package. If you
- * received this file from another source then ask the distributing person for
- * a log of modifications.
- *
- */
-
-#include "mkisoimage.h"
-#include "utypes.h"
-#include <ctype.h>
-#include <mconfig.h>
-
-/* Borrowed from jigdo; original notice:
-
-   These are purely random, no patterns or anything... (I hope)
-
-   I do not claim copyright for the actual numbers below, you may use them
-   for a re-implementation of the algorithm under a license of your choice.
-   -- Richard Atterer. */
-static UInt32_t charTable[256] = {
-  0x51d65c0f, 0x083cd94b, 0x77f73dd8, 0xa0187d36,
-  0x29803d07, 0x7ea8ac0e, 0xea4c16c9, 0xfc576443,
-  0x6213df29, 0x1c012392, 0xb38946ae, 0x2e20ca31,
-  0xe4dc532f, 0xcb281c47, 0x8508b6a5, 0xb93c210d,
-  0xef02b5f3, 0x66548c74, 0x9ae2deab, 0x3b59f472,
-  0x4e546447, 0x45232d1f, 0x0ac0a4b1, 0x6c4c264b,
-  0x5d24ce84, 0x0f2752cc, 0xa35c7ac7, 0x3e31af51,
-  0x79675a59, 0x581f0e81, 0x49053122, 0x7339c9d8,
-  0xf9833565, 0xa3dbe5b3, 0xcc06eeb9, 0x92d0671c,
-  0x3eb220a7, 0x64864eae, 0xca100872, 0xc50977a1,
-  0xd90378e1, 0x7a36cab9, 0x15c15f4b, 0x8b9ef749,
-  0xcc1432dc, 0x1ec578ed, 0x27e6e092, 0xbb06db8f,
-  0x67f661ac, 0x8dd1a3db, 0x2a0ca16b, 0xb229ab84,
-  0x127a3337, 0x347d846f, 0xe1ea4b50, 0x008dbb91,
-  0x414c1426, 0xd2be76f0, 0x08789a39, 0xb4d93e30,
-  0x61667760, 0x8871bee9, 0xab7da12d, 0xe3c58620,
-  0xe9fdfbbe, 0x64fb04f7, 0x8cc5bbf0, 0xf5272d30,
-  0x8f161b50, 0x11122b05, 0x7695e72e, 0xa1c5d169,
-  0x1bfd0e20, 0xef7e6169, 0xf652d08e, 0xa9d0f139,
-  0x2f70aa04, 0xae2c7d6d, 0xa3cb9241, 0x3ae7d364,
-  0x348788f8, 0xf483b8f1, 0x55a011da, 0x189719dc,
-  0xb0c5d723, 0x8b344e33, 0x300d46eb, 0xd44fe34f,
-  0x1a2016c1, 0x66ce4cd7, 0xa45ea5e3, 0x55cb708a,
-  0xbce430df, 0xb01ae6e0, 0x3551163b, 0x2c5b157a,
-  0x574c4209, 0x430fd0e4, 0x3387e4a5, 0xee1d7451,
-  0xa9635623, 0x873ab89b, 0xb96bc6aa, 0x59898937,
-  0xe646c6e7, 0xb79f8792, 0x3f3235d8, 0xef1b5acf,
-  0xd975b22b, 0x427acce6, 0xe47a2411, 0x75f8c1e8,
-  0xa63f799d, 0x53886ad8, 0x9b2d6d32, 0xea822016,
-  0xcdee2254, 0xd98bcd98, 0x2933a544, 0x961f379f,
-  0x49219792, 0xc61c360f, 0x77cc0c64, 0x7b872046,
-  0xb91c7c12, 0x7577154b, 0x196573be, 0xf788813f,
-  0x41e2e56a, 0xec3cd244, 0x8c7401f1, 0xc2e805fe,
-  0xe8872fbe, 0x9e2faf7d, 0x6766456b, 0x888e2197,
-  0x28535c6d, 0x2ce45f3f, 0x24261d2a, 0xd6faab8b,
-  0x7a7b42b8, 0x15f0f6fa, 0xfe1711df, 0x7e5685a6,
-  0x00930268, 0x74755331, 0x1998912c, 0x7b60498b,
-  0x501a5786, 0x92ace0f6, 0x1d9752fe, 0x5a731add,
-  0x5b3b44fc, 0x473673f9, 0xa42c0321, 0xd82f9f18,
-  0xb4b225da, 0xfc89ece2, 0x072e1130, 0x5772aae3,
-  0x29010857, 0x542c970c, 0x94f67fe5, 0x71209e9b,
-  0xdb97ea39, 0x2689b41b, 0xae815804, 0xfc5e2651,
-  0xd4521674, 0x48ed979a, 0x2f617da3, 0xc350353d,
-  0xc3accd94, 0xbd8d313a, 0xc61a8e77, 0xf34940a4,
-  0x8d2c6b0f, 0x0f0e7225, 0x39e183db, 0xd19ebba9,
-  0x6a0f37b9, 0xd18922f3, 0x106420c5, 0xaa5a640b,
-  0x7cf0d273, 0xcf3238a7, 0x3b33204f, 0x476be7bb,
-  0x09d23bca, 0xbe84b2f7, 0xb7a3bace, 0x2528cee1,
-  0x3dcaa1dd, 0x900ad31a, 0xf21dea6d, 0x9ce51463,
-  0xf1540bba, 0x0fab1bdd, 0x89cfb79a, 0x01a2a6e6,
-  0x6f85d67c, 0xd1669ec4, 0x355db722, 0x00ebd5c4,
-  0x926eb385, 0x69ead869, 0x0da2b122, 0x402779fe,
-  0xdaed92d0, 0x57e9aabb, 0x3df64854, 0xfcc774b5,
-  0x2e1740ed, 0xa615e024, 0xf7bac938, 0x377dfd1a,
-  0xd0559d66, 0x25499be8, 0x2d8f2006, 0xfaa9e486,
-  0x95e980e7, 0x82aeba67, 0x5a7f2561, 0xbc60dff6,
-  0x6c8739a2, 0x7ec59a8b, 0x9998f265, 0xdfe37e5e,
-  0xb47cee1e, 0x4dd8bc9e, 0x35c57e09, 0x07850b63,
-  0x06eadbcb, 0x6c1f2956, 0x01685c2c, 0xf5725eef,
-  0xf13b98b5, 0xaab739c2, 0x200b1da2, 0xa716b98b,
-  0xd9ee3058, 0x76acf20b, 0x2f259e04, 0xed11658b,
-  0x1532b331, 0x0ab43204, 0xf0beb023, 0xb1685483,
-  0x58cbdc4f, 0x079384d3, 0x049b141c, 0xc38184b9,
-  0xaf551d9a, 0x66222560, 0x059deeca, 0x535f99e2
-};
-
-unsigned long long rsync64(unsigned char *mem, size_t size)
-{
-    UInt32_t a = 0;
-    UInt32_t b = 0;
-    unsigned char *limit = mem + size;
-    unsigned long long result = 0;
-
-    while (mem < limit)
-    {
-        a += charTable[*mem++];
-        b += a;
-    }
-
-    a = a & 0xffffffff; /* Just in case uint32 can be 64 bits */
-    b = b & 0xffffffff;
-
-    result = ((unsigned long long)b << 32) | a;
-
-    return result;
-}
-

Copied: cdrkit/trunk/genisoimage/rsync.c (from rev 452, cdrkit/trunk/mkisoimage/rsync.c)

Deleted: cdrkit/trunk/genisoimage/scsi.c
===================================================================
--- cdrkit/trunk/mkisoimage/scsi.c	2006-11-23 21:37:32 UTC (rev 450)
+++ cdrkit/trunk/genisoimage/scsi.c	2006-11-23 22:11:41 UTC (rev 453)
@@ -1,199 +0,0 @@
-/*
- * This file has been modified for the cdrkit suite.
- *
- * The behaviour and appearence of the program code below can differ to a major
- * extent from the version distributed by the original author(s).
- *
- * For details, see Changelog file distributed with the cdrkit package. If you
- * received this file from another source then ask the distributing person for
- * a log of modifications.
- *
- */
-
-/* @(#)scsi.c	1.20 05/05/01 Copyright 1997 J. Schilling */
-#ifndef lint
-static	char sccsid[] =
-	"@(#)scsi.c	1.20 05/05/01 Copyright 1997 J. Schilling";
-#endif
-/*
- *	Copyright (c) 1997 J. Schilling
- */
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; see the file COPYING.  If not, write to the Free Software
- * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifdef	USE_SCG
-#include <mconfig.h>
-
-#include <stdio.h>
-#include <standard.h>
-#include <stdxlib.h>
-#include <unixstd.h>
-#include <schily.h>
-
-#include "mkisoimage.h"
-#include <usal/scsireg.h>
-#include <usal/scsitransp.h>
-
-#include "wodim.h"
-#include "../wodim/defaults.h"
-
-/*
- * NOTICE:	You should not make BUF_SIZE more than
- *		the buffer size of the CD-Recorder.
- *
- * Do not set BUF_SIZE to be more than 126 KBytes
- * if you are running cdrecord on a sun4c machine.
- *
- * WARNING:	Philips CDD 521 dies if BUF_SIZE is to big.
- */
-#define	BUF_SIZE	(62*1024)	/* Must be a multiple of 2048	   */
-
-static	SCSI	*usalp;
-static	long	bufsize;		/* The size of the transfer buffer */
-
-int	readsecs(int startsecno, void *buffer, int sectorcount);
-int	scsidev_open(char *path);
-int	scsidev_close(void);
-
-int
-readsecs(int startsecno, void *buffer, int sectorcount)
-{
-	int	f;
-	int	secsize;	/* The drive's SCSI sector size		*/
-	long	amount;		/* The number of bytes to be transfered	*/
-	long	secno;		/* The sector number to read from	*/
-	long	secnum;		/* The number of sectors to read	*/
-	char	*bp;
-	long	amt;
-
-	if (in_image == NULL) {
-		/*
-		 * We are using the standard CD-ROM sectorsize of 2048 bytes
-		 * while the drive may be switched to 512 bytes per sector.
-		 *
-		 * XXX We assume that secsize is no more than SECTOR_SIZE
-		 * XXX and that SECTOR_SIZE / secsize is not a fraction.
-		 */
-		secsize = usalp->cap->c_bsize;
-		amount = sectorcount * SECTOR_SIZE;
-		secno = startsecno * (SECTOR_SIZE / secsize);
-		bp = buffer;
-
-		while (amount > 0) {
-			amt = amount;
-			if (amount > bufsize)
-				amt = bufsize;
-			secnum = amt / secsize;
-
-			if (read_scsi(usalp, bp, secno, secnum) < 0 ||
-						usal_getresid(usalp) != 0) {
-#ifdef	OLD
-				return (-1);
-#else
-				comerr("Read error on old image\n");
-#endif
-			}
-
-			amount	-= secnum * secsize;
-			bp	+= secnum * secsize;
-			secno	+= secnum;
-		}
-		return (SECTOR_SIZE * sectorcount);
-	}
-
-	f = fileno(in_image);
-
-	if (lseek(f, (off_t)startsecno * SECTOR_SIZE, SEEK_SET) == (off_t)-1) {
-#ifdef	USE_LIBSCHILY
-		comerr("Seek error on old image\n");
-#else
-		fprintf(stderr, "Seek error on old image\n");
-		exit(10);
-#endif
-	}
-	if ((amt = read(f, buffer, (sectorcount * SECTOR_SIZE)))
-			!= (sectorcount * SECTOR_SIZE)) {
-#ifdef	USE_LIBSCHILY
-		if (amt < 0)
-			comerr("Read error on old image\n");
-		comerrno(EX_BAD, "Short read on old image\n"); /* < secnt aber > 0 */
-#else
-		if (amt < 0)
-			fprintf(stderr, "Read error on old image\n");
-		else
-			fprintf(stderr, "Short read on old image\n");
-	
-		exit(10);
-#endif
-	}
-	return (sectorcount * SECTOR_SIZE);
-}
-
-int
-scsidev_open(char *path)
-{
-	char	errstr[80];
-	char	*buf;	/* ignored, bit OS/2 ASPI layer needs memory which */
-			/* has been allocated by scsi_getbuf()		   */
-
-	/*
-	 * Call usal_remote() to force loading the remote SCSI transport library
-	 * code that is located in librusal instead of the dummy remote routines
-	 * that are located inside libusal.
-	 */
-	usal_remote();
-
-	cdr_defaults(&path, NULL, NULL, NULL);
-			/* path, debug, verboseopen */
-	usalp = usal_open(path, errstr, sizeof (errstr), 0, 0);
-	if (usalp == 0) {
-		errmsg("%s%sCannot open SCSI driver.\n", errstr, errstr[0]?". ":"");
-		return (-1);
-	}
-
-	bufsize = usal_bufsize(usalp, BUF_SIZE);
-	if ((buf = usal_getbuf(usalp, bufsize)) == NULL) {
-		errmsg("Cannot get SCSI I/O buffer.\n");
-		usal_close(usalp);
-		return (-1);
-	}
-
-	bufsize = (bufsize / SECTOR_SIZE) * SECTOR_SIZE;
-
-	allow_atapi(usalp, TRUE);
-
-	if (!wait_unit_ready(usalp, 60)) { /* Eat Unit att / Wait for drive */
-		usalp->silent--;
-		return (-1);
-	}
-
-	usalp->silent++;
-	read_capacity(usalp);	/* Set Capacity/Sectorsize for I/O */
-	usalp->silent--;
-
-	return (1);
-}
-
-int
-scsidev_close()
-{
-	if (in_image == NULL) {
-		return (usal_close(usalp));
-	} else {
-		return (fclose(in_image));
-	}
-}
-
-#endif	/* USE_SCG */

Copied: cdrkit/trunk/genisoimage/scsi.c (from rev 452, cdrkit/trunk/mkisoimage/scsi.c)

Deleted: cdrkit/trunk/genisoimage/stream.c
===================================================================
--- cdrkit/trunk/mkisoimage/stream.c	2006-11-23 21:37:32 UTC (rev 450)
+++ cdrkit/trunk/genisoimage/stream.c	2006-11-23 22:11:41 UTC (rev 453)
@@ -1,274 +0,0 @@
-/*
- * This file has been modified for the cdrkit suite.
- *
- * The behaviour and appearence of the program code below can differ to a major
- * extent from the version distributed by the original author(s).
- *
- * For details, see Changelog file distributed with the cdrkit package. If you
- * received this file from another source then ask the distributing person for
- * a log of modifications.
- *
- */
-
-/* @(#)stream.c	1.3 04/03/04 Copyright 2002-2003 J. Schilling */
-#ifndef lint
-static	char sccsid[] =
-	"@(#)stream.c	1.3 04/03/04 Copyright 2002-2003 J. Schilling";
-#endif
-/*
- *	ISO-9660 stream (pipe) file module for mkisoimage
- *
- *	Copyright (c) 2002-2003 J. Schilling
- *	Implemented after an idea from M.H. Voase
- */
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; see the file COPYING.  If not, write to the Free Software
- * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#include <mconfig.h>
-#include "mkisoimage.h"
-#include "iso9660.h"
-
-static int	size_str_file(int starting_extent);
-static int	size_str_dir(int starting_extent);
-static int	size_str_path(int starting_extent);
-
-static int	gen_str_path(void);
-
-static int	write_str_file(FILE *outfile);
-static int	write_str_dir(FILE *outfile);
-static int	write_str_path(FILE *outfile);
-
-extern struct directory *root;
-extern unsigned int	session_start;
-extern int		stream_media_size;
-extern char		*stream_filename;
-extern time_t		begun;
-extern int		volume_sequence_number;
-
-static unsigned int	avail_extent;
-static unsigned int	stream_extent;
-static unsigned int	stream_size;
-static unsigned int	stream_pad;
-static char		*l_path;
-static char		*m_path;
-static struct iso_directory_record s_dir;
-static int		stream_finished = 0;
-
-/*
- * Compute the size of the file
- */
-static int
-size_str_file(int starting_extent)
-{
-	int	n;
-extern	int	dopad;
-
-	stream_extent = last_extent;	/* Start of stream file content */
-
-	avail_extent = stream_media_size;
-	n = last_extent;		/* Room for FS blocks before file */
-	n += 1;				/* Room for the directory block */
-	stream_pad = 0;
-	if (n < 50) {
-		stream_pad = 50 - n;
-		n = 50;			/* Make net. size easy to compute */
-	}
-	if (dopad)
-		n += 150;		/* Room for final padding */
-	avail_extent -= n;
-
-	last_extent += avail_extent + stream_pad;
-
-	return (0);
-}
-
-/*
- * The size of the directory record - one sector
- */
-static int
-size_str_dir(int starting_extent)
-{
-	root->extent = last_extent;
-	last_extent += 1;
-	return (0);
-}
-
-/*
- * The size of the path tables - two sectors
- */
-static int
-size_str_path(int starting_extent)
-{
-	path_table[0] = starting_extent;
-	path_table[1] = 0;
-	path_table[2] = path_table[0] + 1;
-	path_table[3] = 0;
-	last_extent += 2 * 1;
-	return (0);
-}
-
-/*
- * Generate the path table data
- */
-static int
-gen_str_path()
-{
-	/*
-	 * Basically add the root directory entry
-	 */
-	l_path = (char *)e_malloc(SECTOR_SIZE);
-	m_path = (char *)e_malloc(SECTOR_SIZE);
-	memset(l_path, 0, SECTOR_SIZE);
-	memset(m_path, 0, SECTOR_SIZE);
-	l_path[0] = 1;
-	m_path[0] = 1;
-	set_731(l_path + 2, root->extent);
-	set_732(m_path + 2, root->extent);
-	set_721(l_path + 6, 1);
-	set_722(m_path + 6, 1);
-	l_path[8] = '\0'; l_path[9] = '\0';
-	m_path[8] = '\0'; m_path[9] = '\0';
-	return (0);
-}
-
-/*
- * Write the file content
- */
-static int
-write_str_file(FILE *outfile)
-{
-	unsigned int	idx = 0;
-	unsigned int	iso_blocks;
-	int		count;
-	char		*buf;
-
-	buf = e_malloc(SECTOR_SIZE);
-	stream_size = 0;
-	while ((idx + SECTOR_SIZE) < (avail_extent * SECTOR_SIZE)) {
-		memset(buf, 0, SECTOR_SIZE);
-		count = fread(buf, 1, SECTOR_SIZE, stdin);
-		if (count <= 0) {
-			stream_finished = 1;
-			break;
-		}
-		idx += count;
-		jtwrite(buf, count, 1, 0, FALSE);
-		xfwrite(buf, count, 1, outfile, 0, FALSE);
-	}
-
-	stream_size = idx;
-	iso_blocks = ISO_BLOCKS(idx);
-	memset(buf, 0, SECTOR_SIZE);
-	if (SECTOR_SIZE * iso_blocks - idx)
-    {
-		jtwrite(buf, SECTOR_SIZE * iso_blocks - idx, 1, 0, FALSE);
-		xfwrite(buf, SECTOR_SIZE * iso_blocks - idx, 1, outfile, 0, FALSE);
-    }
-	/*
-	 * If we didn't fill the available area, pad to directory block
-	 */
-	for (count = 0; count < (avail_extent - iso_blocks); count++)
-    {
-		jtwrite(buf, SECTOR_SIZE, 1, 0, FALSE);
-		xfwrite(buf, SECTOR_SIZE, 1, outfile, 0, FALSE);
-    }
-	for (count = 0; count < stream_pad; count++)
-    {
-		jtwrite(buf, SECTOR_SIZE, 1, 0, FALSE);
-		xfwrite(buf, SECTOR_SIZE, 1, outfile, 0, FALSE);
-    }
-
-	last_extent_written += avail_extent + stream_pad;
-	return (0);
-}
-
-/*
- * Generate and write the directory record data
- */
-static int
-write_str_dir(FILE *outfile)
-{
-	int	to_write;
-	char	*buf;
-
-	buf = e_malloc(SECTOR_SIZE); memset(buf, 0, SECTOR_SIZE);
-	memset(&s_dir, 0, sizeof (struct iso_directory_record));
-	s_dir.length[0] = 34;			/* BAD: Hardcoded - Will fix, MHV */
-	s_dir.ext_attr_length[0] = 0;
-	set_733((char *)s_dir.extent, root->extent);
-	set_733((char *)s_dir.size, SECTOR_SIZE);
-	iso9660_date(s_dir.date, begun);
-	s_dir.flags[0] = 2;
-	s_dir.file_unit_size[0] = 0;
-	s_dir.interleave[0] = 0;
-	set_723((char *)s_dir.volume_sequence_number, volume_sequence_number);
-	s_dir.name_len[0] = 1;
-	s_dir.name[0] = 0;
-	jtwrite(&s_dir, offsetof(struct iso_directory_record, name[0]) + 1, 1, 0, FALSE);
-	xfwrite(&s_dir, offsetof(struct iso_directory_record, name[0]) + 1, 1, outfile, 0, FALSE);
-	jtwrite(&s_dir, offsetof(struct iso_directory_record, name[0]) + 1, 1, 0, FALSE);
-	xfwrite(&s_dir, offsetof(struct iso_directory_record, name[0]) + 1, 1, outfile, 0, FALSE);
-	memset(&s_dir, 0, sizeof (struct iso_directory_record));
-	s_dir.length[0] = 34 + strlen(stream_filename);
-	s_dir.ext_attr_length[0] = 0;
-	set_733((char *) s_dir.extent, stream_extent);
-	set_733((char *) s_dir.size, stream_size);
-	iso9660_date(s_dir.date, begun);
-	s_dir.flags[0] = 0;
-	s_dir.file_unit_size[0] = 0;
-	set_723((char *)s_dir.volume_sequence_number, volume_sequence_number);
-	s_dir.name_len[0] = strlen(stream_filename);
-	memcpy(s_dir.name, stream_filename, s_dir.name_len[0]);
-	jtwrite(&s_dir, offsetof(struct iso_directory_record, name[0])
-		+ s_dir.name_len[0], 1, 0, FALSE);
-	xfwrite(&s_dir, offsetof(struct iso_directory_record, name[0])
-		+ s_dir.name_len[0], 1, outfile, 0, FALSE);
-
-	/*
-	 * This calc is: 2 single char directory entries (34) + an additional entry
-	 * with filename length stream_filename + round up for even lenght count
-	 */
-	to_write = (s_dir.name_len[0] % 2) ? 0 : 1;
-	jtwrite(buf, SECTOR_SIZE - ((3 * 34) + s_dir.name_len[0]) +
-		to_write, 1, 0, FALSE);
-	xfwrite(buf, SECTOR_SIZE - ((3 * 34) + s_dir.name_len[0]) +
-		to_write, 1, outfile, 0, FALSE);
-	free(buf);
-	last_extent_written++;
-	return (0);
-}
-
-/*
- * Generate the path table data
- */
-static int
-write_str_path(FILE *outfile)
-{
-	jtwrite(l_path, SECTOR_SIZE, 1, 0, FALSE);
-	xfwrite(l_path, SECTOR_SIZE, 1, outfile, 0, FALSE);
-	last_extent_written++;
-	jtwrite(m_path, SECTOR_SIZE, 1, 0, FALSE);
-	xfwrite(m_path, SECTOR_SIZE, 1, outfile, 0, FALSE);
-	last_extent_written++;
-	free(l_path);
-	free(m_path);
-	path_table_l = NULL;
-	path_table_m = NULL;
-	return (0);
-}
-
-struct output_fragment strfile_desc  = { NULL, size_str_file, NULL,	   write_str_file, "Stream File" };
-struct output_fragment strdir_desc  = { NULL, size_str_dir,  NULL,	   write_str_dir,  "Stream File Directory"  };
-struct output_fragment strpath_desc = { NULL, size_str_path, gen_str_path, write_str_path, "Stream File Path table" };

Copied: cdrkit/trunk/genisoimage/stream.c (from rev 452, cdrkit/trunk/mkisoimage/stream.c)

Deleted: cdrkit/trunk/genisoimage/sunlabel.h
===================================================================
--- cdrkit/trunk/mkisoimage/sunlabel.h	2006-11-23 21:37:32 UTC (rev 450)
+++ cdrkit/trunk/genisoimage/sunlabel.h	2006-11-23 22:11:41 UTC (rev 453)
@@ -1,206 +0,0 @@
-/*
- * This file has been modified for the cdrkit suite.
- *
- * The behaviour and appearence of the program code below can differ to a major
- * extent from the version distributed by the original author(s).
- *
- * For details, see Changelog file distributed with the cdrkit package. If you
- * received this file from another source then ask the distributing person for
- * a log of modifications.
- *
- */
-
-/* @(#)sunlabel.h	1.5 03/12/28 Copyright 1999-2003 J. Schilling */
-/*
- *	Support for Sun disk label
- *
- *	Copyright (c) 1999-2003 J. Schilling
- */
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; see the file COPYING.  If not, write to the Free Software
- * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef howmany
-#define	howmany(x, y)	(((x)+((y)-1))/(y))
-#endif
-#ifndef roundup
-#define	roundup(x, y)	((((x)+((y)-1))/(y))*(y))
-#endif
-
-#define	NDKMAP		8		/* # of sparc partitions */
-#define	NX86MAP		16		/* # if x86   partitions */
-#define	DKL_MAGIC	0xDABE		/* magic number */
-#define	DKL_MAGIC_0	0xDA		/* magic number high byte */
-#define	DKL_MAGIC_1	0xBE		/* magic number low byte  */
-
-#define	CD_DEFLABEL	"CD-ROM Disc with Sun sparc boot created by mkisoimage"
-#define	CD_X86LABEL	"CD-ROM Disc with Sun x86 boot created by mkisoimage"
-
-/*
- * Define a virtual geometry for the CD disk label.
- * The current values are stolen from Sun install disks and do not seem to be
- * a good idea as they limit the size of the CD to 327680 sectors which is less
- * than 74 minutes.
- * There are 84 minute CD's with 378000 sectors and there will be DVD's with
- * even more.
- */
-#define	CD_RPM		350
-#define	CD_PCYL		2048
-#define	CD_APC		0
-#define	CD_INTRLV	1
-#define	CD_NCYL		2048
-#define	CD_ACYL		0
-#define	CD_NHEAD	1
-#define	CD_NSECT	640
-
-/*
- * NOTE: The virtual cylinder size on CD must be a mutiple of 2048.
- *	 This is true if CD_NSECT is a multiple of 4.
- */
-#define	CD_CYLSIZE	(CD_NSECT*CD_NHEAD*512)
-
-#define	V_VERSION	1		/* The VTOC version	 */
-#define	VTOC_SANE	0x600DDEEE	/* Indicates a sane VTOC */
-
-#define	V_ROOT		0x02		/* Root partiton	 */
-#define	V_USR		0x04		/* Usr partiton		 */
-
-#define	V_RONLY		0x10		/* Read only		 */
-
-/*
- * The Sun sparc disk label (at offset 0 on a disk)
- */
-struct sun_label {
-	char		dkl_ascilabel[128];
-	struct dk_vtoc {
-		Uchar	v_version[4];	/* layout version	 */
-		char	v_volume[8];	/* volume name		 */
-		Uchar	v_nparts[2];	/* number of partitions	 */
-		struct dk_map2 {
-			Uchar	p_tag[2]; /* ID tag of partition */
-			Uchar	p_flag[2]; /* permission flag	 */
-
-		}	v_part[NDKMAP];
-		Uchar	v_xxpad[2];	/* To come over Sun's alignement problem */
-		Uchar	v_bootinfo[3*4]; /* info for mboot	 */
-		Uchar	v_sanity[4];	/* to verify vtoc sanity */
-		Uchar	v_reserved[10*4];
-		Uchar	v_timestamp[NDKMAP*4];
-
-	}		dkl_vtoc;	/* vtoc inclusions from AT&T SVr4 */
-	char		dkl_pad[512-(128+sizeof (struct dk_vtoc)+NDKMAP*8+14*2)];
-	Uchar		dkl_rpm[2];	/* rotations per minute */
-	Uchar		dkl_pcyl[2];	/* # physical cylinders */
-	Uchar		dkl_apc[2];	/* alternates per cylinder */
-	Uchar		dkl_obs1[2];	/* obsolete */
-	Uchar		dkl_obs2[2];	/* obsolete */
-	Uchar		dkl_intrlv[2];	/* interleave factor */
-	Uchar		dkl_ncyl[2];	/* # of data cylinders */
-	Uchar		dkl_acyl[2];	/* # of alternate cylinders */
-	Uchar		dkl_nhead[2];	/* # of heads in this partition */
-	Uchar		dkl_nsect[2];	/* # of 512 byte sectors per track */
-	Uchar		dkl_obs3[2];	/* obsolete */
-	Uchar		dkl_obs4[2];	/* obsolete */
-
-	struct dk_map {			/* logical partitions */
-		Uchar	dkl_cylno[4];	/* starting cylinder */
-		Uchar	dkl_nblk[4];	/* number of blocks */
-	}		dkl_map[NDKMAP]; /* logical partition headers */
-
-	Uchar		dkl_magic[2];	/* identifies this label format */
-	Uchar		dkl_cksum[2];	/* xor checksum of sector */
-};
-
-/*
- * The Sun x86 / AT&T disk label (at offset 512 on a fdisk partition)
- */
-struct x86_label {
-	struct x86_vtoc {
-		Uchar	v_bootinfo[3*4]; /* unsupported		  */
-		Uchar	v_sanity[4];	/* to verify vtoc sanity  */
-		Uchar	v_version[4];	/* layout version	  */
-		char    v_volume[8];	/* volume name		  */
-		Uchar	v_sectorsz[2]; 	/* # of bytes in a sector */
-		Uchar	v_nparts[2]; 	/* # of partitions */
-		Uchar	v_reserved[10*4];
-		struct dkl_partition    {
-			Uchar	p_tag[2];	/* ID tag of partition */
-			Uchar	p_flag[2];	/* permission flag    */
-			Uchar	p_start[4];	/* starting sector    */
-			Uchar	p_size[4];	/* number of blocks   */
-		}	v_part[NX86MAP];
-		Uchar	timestamp[NX86MAP][4];
-		char    v_asciilabel[128];
-	}		dkl_vtoc;	/* vtoc inclusions from AT&T SVr4 */
-	Uchar		dkl_pcyl[4];	/* # physical cylinders */
-	Uchar		dkl_ncyl[4];	/* # of data cylinders */
-	Uchar		dkl_acyl[2];	/* # of alternate cylinders */
-	Uchar		dkl_bcyl[2];
-	Uchar		dkl_nhead[4];	/* # of heads in this partition */
-	Uchar		dkl_nsect[4];	/* # of 512 byte sectors per track */
-	Uchar		dkl_intrlv[2];	/* interleave factor */
-	Uchar		dkl_skew[2];
-	Uchar		dkl_apc[2];	/* alternates per cylinder */
-	Uchar		dkl_rpm[2];	/* rotations per minute */
-	Uchar		dkl_write_reinstruct[2];
-	Uchar		dkl_read_reinstruct[2];
-	Uchar		dkl_extra[4*2];	/* for later expansions */
-	char		dkl_pad[512-(sizeof (struct x86_vtoc)+4*4+14*2)];
-	Uchar		dkl_magic[2];	/* identifies this label format */
-	Uchar		dkl_cksum[2];	/* xor checksum of sector */
-};
-
-/*
- * One x86 PC fdisk partition record.
- */
-struct pc_pr {
-	Uchar	pr_status;		/* Boot status */
-	Uchar	pr_head;		/* Starting head # */
-	char	pr_sec_cyl[2];		/* Starting sec+cyl # */
-	Uchar	pr_type;		/* Partition type */
-	Uchar	pr_e_head;		/* Ending head # */
-	char	pr_e_sec_cyl[2];	/* Ending sec+cyl # */
-	char	pr_partoff[4];		/* Partition start sector # */
-	char	pr_nsect[4];		/* # of sectors in partition */
-};
-
-/*
- * Flags and macros for above partition record.
- */
-#define	SEC_MASK	0x3F
-#define	GET_SEC(a)	((a) & SEC_MASK)
-#define	GET_CYL(a)	((((a) & 0xFF) >> 8) | (((a) & 0xC0) << 2))
-
-#define	STATUS_INACT	0		/* Marked non bootable	*/
-#define	STATUS_ACTIVE	0x80		/* Marked as bootable	*/
-
-#define	TYPE_FREE		0	/* Unused partition	*/
-#define	TYPE_DOS12		0x01	/* FAT12 fileystem	*/
-#define	TYPE_XENIX		0x02	/* XENIX root		*/
-#define	TYPE_XENIX2		0x03	/* XENIX usr		*/
-#define	TYPE_DOS16		0x04	/* FAT16 filesystem	*/
-#define	TYPE_XDOS		0x05	/* Extended DOS part	*/
-#define	TYPE_DOS4		0x06	/* FAT16 >= 32 MB	*/
-#define	TYPE_SOLARIS		0x82	/* Solaris x86		*/
-#define	TYPE_SOLARIS_BOOT	0xBE	/* Solaris boot		*/
-#define	TYPE_CDOS4		0xDB	/* CPM			*/
-
-/*
- * The first sector on a disk from a x86 PC (at offset 0 on a disk)
- */
-struct pc_part {
-	char		bootcode[0x1BE]; /* Master boot record	    */
-	struct pc_pr	part[4];	/* The 4 primary partitions */
-	Uchar		magic[2];	/* Fixed at 0x55 0xAA	    */
-};

Copied: cdrkit/trunk/genisoimage/sunlabel.h (from rev 452, cdrkit/trunk/mkisoimage/sunlabel.h)

Deleted: cdrkit/trunk/genisoimage/tree.c
===================================================================
--- cdrkit/trunk/mkisoimage/tree.c	2006-11-23 21:37:32 UTC (rev 450)
+++ cdrkit/trunk/genisoimage/tree.c	2006-11-23 22:11:41 UTC (rev 453)
@@ -1,2682 +0,0 @@
-/*
- * This file has been modified for the cdrkit suite.
- *
- * The behaviour and appearence of the program code below can differ to a major
- * extent from the version distributed by the original author(s).
- *
- * For details, see Changelog file distributed with the cdrkit package. If you
- * received this file from another source then ask the distributing person for
- * a log of modifications.
- *
- */
-
-/* @(#)tree.c	1.82 04/06/12 joerg */
-#ifndef lint
-static	char sccsid[] =
-	"@(#)tree.c	1.82 04/06/12 joerg";
-#endif
-/*
- * File tree.c - scan directory  tree and build memory structures for iso9660
- * filesystem
- *
- * Written by Eric Youngdale (1993).
- *
- * Copyright 1993 Yggdrasil Computing, Incorporated
- * Copyright (c) 1999,2000-2004 J. Schilling
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-/* ADD_FILES changes made by Ross Biro biro at yggdrasil.com 2/23/95 */
-
-/* APPLE_HYB James Pearson j.pearson at ge.ucl.ac.uk 23/2/2000 */
-
-#include <mconfig.h>
-#include "mkisoimage.h"
-#include "match.h"
-#include "exclude.h"
-#include <timedefs.h>
-#include <errno.h>
-#include <fctldefs.h>
-#include <device.h>
-#include <schily.h>
-
-#ifdef UDF
-#include "udf.h"
-#endif
-
-#ifdef VMS
-#include <sys/file.h>
-#include <vms/fabdef.h>
-#include "vms.h"
-#endif
-
-/*
- * Autoconf should be able to figure this one out for us and let us know
- * whether the system has memmove or not.
- */
-#ifndef HAVE_MEMMOVE
-#define	memmove(d, s, n)	bcopy((s), (d), (n))
-#endif
-
-static	Uchar	symlink_buff[PATH_MAX+1];
-
-static	char	*filetype(int t);
-static	char	*rstr(char *s1, char *s2);
-static	void	stat_fix(struct stat * st);
-int	stat_filter(char *path, struct stat *st);
-int	lstat_filter(char *path, struct stat *st);
-static	int	sort_n_finish(struct directory *this_dir);
-static	void	generate_reloc_directory(void);
-static	void	attach_dot_entries(struct directory *dirnode,
-											 struct stat *parent_stat);
-static	void	update_nlink(struct directory_entry *s_entry, int value);
-static	void	increment_nlink(struct directory_entry *s_entry);
-char	*find_rr_attribute(unsigned char *pnt, int len, char *attr_type);
-void	finish_cl_pl_entries(void);
-int	scan_directory_tree(struct directory *this_dir, char *path,
-								  struct directory_entry *de);
-#ifdef APPLE_HYB
-int	insert_file_entry(struct directory *this_dir,
-								char *whole_path,
-								char *short_name,
-								int have_rsrc);
-#else
-int	insert_file_entry(struct directory *this_dir,
-								char *whole_path,
-								char *short_name);
-#endif
-void	generate_iso9660_directories(struct directory *node,
-											  FILE *outfile);
-struct directory *find_or_create_directory(struct directory *parent,
-														 const char *path,
-														 struct directory_entry *de,
-														 int flag);
-static	void	delete_directory(struct directory *parent,
-										  struct directory *child);
-int	sort_tree(struct directory *node);
-void	dump_tree(struct directory *node);
-void	update_nlink_field(struct directory *node);
-struct directory_entry *search_tree_file(struct directory *node,
-													  char *filename);
-void	init_fstatbuf(void);
-
-extern int	verbose;
-struct stat	fstatbuf;		/* We use this for the artificial */
-					/* entries we create		  */
-struct stat	root_statbuf;		/* Stat buffer for root directory */
-struct directory *reloc_dir;
-
-static char *
-filetype(int t)
-{
-	static	char	unkn[32];
-
-	if (S_ISFIFO(t))		/* 1 */
-		return ("fifo");
-	if (S_ISCHR(t))			/* 2 */
-		return ("chr");
-	if (S_ISMPC(t))			/* 3 */
-		return ("multiplexed chr");
-	if (S_ISDIR(t))			/* 4 */
-		return ("dir");
-	if (S_ISNAM(t))			/* 5 */
-		return ("named file");
-	if (S_ISBLK(t))			/* 6 */
-		return ("blk");
-	if (S_ISMPB(t))			/* 7 */
-		return ("multiplexed blk");
-	if (S_ISREG(t))			/* 8 */
-		return ("regular file");
-	if (S_ISCNT(t))			/* 9 */
-		return ("contiguous file");
-	if (S_ISLNK(t))			/* 10 */
-		return ("symlink");
-	if (S_ISSHAD(t))		/* 11 */
-		return ("Solaris shadow inode");
-	if (S_ISSOCK(t))		/* 12 */
-		return ("socket");
-	if (S_ISDOOR(t))		/* 13 */
-		return ("door");
-	if (S_ISWHT(t))			/* 14 */
-		return ("whiteout");
-	if (S_ISEVC(t))			/* 15 */
-		return ("event count");
-
-	/*
-	 * Needs to be last in case somebody makes this
-	 * a supported file type.
-	 */
-	if ((t & S_IFMT) == 0)		/* 0 (unallocated) */
-		return ("unallocated");
-
-	sprintf(unkn, "octal '%o'", t & S_IFMT);
-	return (unkn);
-}
-
-/*
- * Check if s1 ends in strings s2
- */
-static char *
-rstr(char *s1, char *s2)
-{
-	int	l1;
-	int	l2;
-
-	l1 = strlen(s1);
-	l2 = strlen(s2);
-	if (l2 > l1)
-		return ((char *) NULL);
-
-	if (strcmp(&s1[l1 - l2], s2) == 0)
-		return (&s1[l1 - l2]);
-	return ((char *) NULL);
-}
-
-static void
-stat_fix(struct stat *st)
-{
-	int adjust_modes = 0;
-
-	if (S_ISREG(st->st_mode))
-		adjust_modes = rationalize_filemode;
-	else if (S_ISDIR(st->st_mode))
-		adjust_modes = rationalize_dirmode;
-	else
-		adjust_modes = (rationalize_filemode || rationalize_dirmode);
-
-	/*
-	 * If rationalizing, override the uid and gid, since the
-	 * originals will only be useful on the author's system.
-	 */
-	if (rationalize_uid)
-		st->st_uid = uid_to_use;
-	if (rationalize_gid)
-		st->st_gid = gid_to_use;
-
-	if (adjust_modes) {
-
-		if (S_ISREG(st->st_mode) && (filemode_to_use != 0)) {
-			st->st_mode = filemode_to_use | S_IFREG;
-		} else if (S_ISDIR(st->st_mode) && (dirmode_to_use != 0)) {
-			st->st_mode = dirmode_to_use | S_IFDIR;
-		} else {
-			/*
-			 * 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 !defined(_WIN32) && !defined(__DJGPP__)	/* make all file "executable" */
-			if (st->st_mode & 0111)
-#endif
-				st->st_mode |= 0111;
-			st->st_mode &= ~07222;
-		}
-	}
-}
-
-int
-stat_filter(char *path, struct stat *st)
-{
-	int	result = stat(path, st);
-
-	if (result >= 0 && rationalize)
-		stat_fix(st);
-	return (result);
-}
-
-int
-lstat_filter(char *path, struct stat *st)
-{
-	int	result = lstat(path, st);
-
-	if (result >= 0 && rationalize)
-		stat_fix(st);
-	return (result);
-}
-
-static int
-sort_n_finish(struct directory *this_dir)
-{
-	struct directory_entry *s_entry;
-	struct directory_entry *s_entry1;
-	struct directory_entry *table;
-	int		count;
-	int		d1;
-	int		d2;
-	int		d3;
-	register int	new_reclen;
-	char		*c;
-	int		status = 0;
-	int		tablesize = 0;
-	char		newname[MAX_ISONAME+1];
-	char		rootname[MAX_ISONAME+1];
-	char		extname[MAX_ISONAME+1];
-
-	/*
-	 * Here we can take the opportunity to toss duplicate entries from the
-	 * directory.
-	 */
-	/* ignore if it's hidden */
-	if (this_dir->dir_flags & INHIBIT_ISO9660_ENTRY) {
-		return (0);
-	}
-	table = NULL;
-
-	init_fstatbuf();
-
-	/*
-	 * If we had artificially created this directory, then we might be
-	 * missing the required '.' entries.  Create these now if we need
-	 * them.
-	 */
-	if ((this_dir->dir_flags & (DIR_HAS_DOT | DIR_HAS_DOTDOT)) !=
-		(DIR_HAS_DOT | DIR_HAS_DOTDOT)) {
-		attach_dot_entries(this_dir, &fstatbuf);
-	}
-	flush_file_hash();
-	s_entry = this_dir->contents;
-	while (s_entry) {
-		/* ignore if it's hidden */
-		if (s_entry->de_flags & INHIBIT_ISO9660_ENTRY) {
-			s_entry = s_entry->next;
-			continue;
-		}
-		/* First assume no conflict, and handle this case */
-		if (!(s_entry1 = find_file_hash(s_entry->isorec.name))) {
-			add_file_hash(s_entry);
-			s_entry = s_entry->next;
-			continue;
-		}
-#ifdef APPLE_HYB
-		/*
-		 * if the pair are associated, then skip (as they have the
-		 * same name!)
-		 */
-		if (apple_both && s_entry1->assoc &&
-						s_entry1->assoc == s_entry) {
-			s_entry = s_entry->next;
-			continue;
-		}
-#endif	/* APPLE_HYB */
-
-		if (s_entry1 == s_entry) {
-#ifdef	USE_LIBSCHILY
-			comerrno(EX_BAD,
-			"Fatal goof, file '%s' already in hash table.\n",
-			s_entry->isorec.name);
-#else
-			fprintf(stderr,
-			"Fatal goof, file '%s' already in hash table.\n",
-			s_entry->isorec.name);
-			exit(1);
-#endif
-		}
-		/*
-		 * OK, handle the conflicts.  Try substitute names until we
-		 * come up with a winner
-		 */
-		strcpy(rootname, s_entry->isorec.name);
-		/*
-		 * Strip off the non-significant part of the name so that we
-		 * are left with a sensible root filename.  If we don't find
-		 * a '.', then try a ';'.
-		 */
-		c = strchr(rootname, '.');
-		/*
-		 * In case we ever allow more than on dot, only modify the
-		 * section past the last dot if the file name starts with a
-		 * dot.
-		 */
-		if (c != NULL && c == rootname && c != strrchr(rootname, '.')) {
-			c = strrchr(rootname, '.');
-		}
-		extname[0] = '\0';		/* In case we have no ext.  */
-		if (c) {
-			strcpy(extname, c);
-			*c = 0;			/* Cut off complete ext.    */
-		} else {
-			/*
-			 * Could not find any '.'.
-			 */
-			c = strchr(rootname, ';');
-			if (c) {
-				*c = 0;		/* Cut off version number    */
-			}
-		}
-		c = strchr(extname, ';');
-		if (c) {
-			*c = 0;			/* Cut off version number    */
-		}
-		d1 = strlen(rootname);
-		if (full_iso9660_filenames || iso9660_level > 1) {
-			d2 = strlen(extname);
-			/*
-			 * 31/37 chars minus the 3 characters we are
-			 * appending below to create unique filenames.
-			 */
-			if ((d1 + d2) > (iso9660_namelen - 3))
-				rootname[iso9660_namelen - 3 - d2] = 0;
-		} else {
-			if (d1 > 5)
-				rootname[5] = 0;
-		}
-		new_reclen = strlen(rootname);
-		sprintf(newname, "%s000%s%s",
-				rootname,
-				extname,
-				((s_entry->isorec.flags[0] & ISO_DIRECTORY) ||
-				omit_version_number ? "" : ";1"));
-
-		for (d1 = 0; d1 < 36; d1++) {
-			for (d2 = 0; d2 < 36; d2++) {
-				for (d3 = 0; d3 < 36; d3++) {
-					newname[new_reclen + 0] =
-					    (d1 <= 9 ? '0' + d1 : 'A' + d1 - 10);
-					newname[new_reclen + 1] =
-					    (d2 <= 9 ? '0' + d2 : 'A' + d2 - 10);
-					newname[new_reclen + 2] =
-					    (d3 <= 9 ? '0' + d3 : 'A' + d3 - 10);
-					if (debug)
-						fprintf(stderr, "NEW name '%s'\n", newname);
-
-#ifdef VMS
-					/* Sigh.  VAXCRTL seems to be broken here */
-					{
-						int	ijk = 0;
-
-						while (newname[ijk]) {
-							if (newname[ijk] == ' ')
-								newname[ijk] = '0';
-							ijk++;
-						}
-					}
-#endif
-
-					if (!find_file_hash(newname))
-						goto got_valid_name;
-				}
-			}
-		}
-
-		/* If we fell off the bottom here, we were in real trouble. */
-#ifdef	USE_LIBSCHILY
-		comerrno(EX_BAD,
-			"Unable to generate unique name for file %s\n",
-			s_entry->name);
-#else
-		fprintf(stderr,
-			"Unable to generate unique name for file %s\n",
-			s_entry->name);
-		exit(1);
-#endif
-
-got_valid_name:
-		/*
-		 * OK, now we have a good replacement name.  Now decide which
-		 * one of these two beasts should get the name changed
-		 */
-		if (s_entry->priority < s_entry1->priority) {
-			if (verbose > 0) {
-				fprintf(stderr, "Using %s for  %s%s%s (%s)\n",
-					newname,
-					this_dir->whole_name, SPATH_SEPARATOR,
-					s_entry->name, s_entry1->name);
-			}
-			s_entry->isorec.name_len[0] = strlen(newname);
-			new_reclen = offsetof(struct iso_directory_record,
-				name[0]) +
-				strlen(newname);
-			if (use_XA || use_RockRidge) {
-				if (new_reclen & 1)
-					new_reclen++; /* Pad to an even byte */
-				new_reclen += s_entry->rr_attr_size;
-			}
-			if (new_reclen & 1)
-				new_reclen++;	/* Pad to an even byte */
-			s_entry->isorec.length[0] = new_reclen;
-			strcpy(s_entry->isorec.name, newname);
-#ifdef APPLE_HYB
-			/* has resource fork - needs new name */
-			if (apple_both && s_entry->assoc) {
-				struct directory_entry *s_entry2 =
-								s_entry->assoc;
-
-				/*
-				 * resource fork name *should* be the same as
-				 * the data fork
-				 */
-				s_entry2->isorec.name_len[0] =
-						s_entry->isorec.name_len[0];
-				strcpy(s_entry2->isorec.name,
-						s_entry->isorec.name);
-				s_entry2->isorec.length[0] = new_reclen;
-			}
-#endif	/* APPLE_HYB */
-		} else {
-			delete_file_hash(s_entry1);
-			if (verbose > 0) {
-				fprintf(stderr, "Using %s for  %s%s%s (%s)\n",
-					newname,
-					this_dir->whole_name, SPATH_SEPARATOR,
-					s_entry1->name, s_entry->name);
-			}
-			s_entry1->isorec.name_len[0] = strlen(newname);
-			new_reclen = offsetof(struct iso_directory_record,
-					name[0]) +
-					strlen(newname);
-			if (use_XA || use_RockRidge) {
-				if (new_reclen & 1)
-					new_reclen++; /* Pad to an even byte */
-				new_reclen += s_entry1->rr_attr_size;
-			}
-			if (new_reclen & 1)
-				new_reclen++;	/* Pad to an even byte */
-			s_entry1->isorec.length[0] = new_reclen;
-			strcpy(s_entry1->isorec.name, newname);
-			add_file_hash(s_entry1);
-#ifdef APPLE_HYB
-			/* has resource fork - needs new name */
-			if (apple_both && s_entry1->assoc) {
-				struct directory_entry *s_entry2 =
-							s_entry1->assoc;
-
-				/*
-				 * resource fork name *should* be the same as
-				 * the data fork
-				 */
-				s_entry2->isorec.name_len[0] =
-						s_entry1->isorec.name_len[0];
-				strcpy(s_entry2->isorec.name,
-							s_entry1->isorec.name);
-				s_entry2->isorec.length[0] = new_reclen;
-			}
-#endif	/* APPLE_HYB */
-		}
-		add_file_hash(s_entry);
-		s_entry = s_entry->next;
-	}
-
-	if (generate_tables &&
-	    !find_file_hash(trans_tbl) &&
-	    (reloc_dir != this_dir) &&
-	    (this_dir->extent == 0)) {
-		/* First we need to figure out how big this table is */
-		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;
-#ifdef APPLE_HYB
-			/* skip table entry for the resource fork */
-			if (apple_both &&
-			    (s_entry->isorec.flags[0] & ISO_ASSOCIATED))
-				continue;
-#endif	/* APPLE_HYB */
-			if (s_entry->de_flags & INHIBIT_ISO9660_ENTRY)
-				continue;
-			if (s_entry->table) {
-				/*
-				 * Max namelen, a space before and a space
-				 * after the iso filename.
-				 */
-				tablesize += MAX_ISONAME + 2 +
-						strlen(s_entry->table);
-			}
-		}
-	}
-	if (tablesize > 0) {
-		table = (struct directory_entry *)
-			e_malloc(sizeof (struct directory_entry));
-		memset(table, 0, sizeof (struct directory_entry));
-		table->table = NULL;
-		table->next = this_dir->contents;
-		this_dir->contents = table;
-
-		table->filedir = root;
-		table->isorec.flags[0] = ISO_FILE;
-		table->priority = 32768;
-		iso9660_date(table->isorec.date, fstatbuf.st_mtime);
-		table->inode = TABLE_INODE;
-		table->dev = (dev_t) UNCACHED_DEVICE;
-		set_723(table->isorec.volume_sequence_number,
-						volume_sequence_number);
-		set_733((char *) table->isorec.size, tablesize);
-		table->size = tablesize;
-		table->filedir = this_dir;
-		if (jhide_trans_tbl)
-			table->de_flags |= INHIBIT_JOLIET_ENTRY;
-/*		table->name = strdup("<translation table>");*/
-		table->name = strdup(trans_tbl);
-		/*
-		 * We use sprintf() to create the strings, for this reason
-		 * we need to add one byte for the null character at the
-		 * end of the string even though we don't use it.
-		 */
-		table->table = (char *) e_malloc(ISO_ROUND_UP(tablesize)+1);
-		memset(table->table, 0, ISO_ROUND_UP(tablesize)+1);
-		iso9660_file_length(trans_tbl, table, 0);
-
-		if (use_XA || use_RockRidge) {
-			fstatbuf.st_mode = 0444 | S_IFREG;
-			fstatbuf.st_nlink = 1;
-			generate_xa_rr_attributes("",
-				trans_tbl, table,
-				&fstatbuf, &fstatbuf, 0);
-		}
-	}
-	/*
-	 * We have now chosen the 8.3 names and we should now know the length
-	 * of every entry in the directory.
-	 */
-	for (s_entry = this_dir->contents; s_entry; s_entry = s_entry->next) {
-		/* skip if it's hidden */
-		if (s_entry->de_flags & INHIBIT_ISO9660_ENTRY) {
-			continue;
-		}
-		new_reclen = strlen(s_entry->isorec.name);
-
-		/* First update the path table sizes for directories. */
-		if (s_entry->isorec.flags[0] & ISO_DIRECTORY) {
-			if (strcmp(s_entry->name, ".") != 0 &&
-					strcmp(s_entry->name, "..") != 0) {
-				path_table_size += new_reclen +
-						offsetof(struct iso_path_table,
-						name[0]);
-				if (new_reclen & 1)
-					path_table_size++;
-			} else {
-				new_reclen = 1;
-				if (this_dir == root && strlen(s_entry->name)
-									== 1) {
-					path_table_size += new_reclen +
-						offsetof(struct iso_path_table,
-						name[0]);
-				}
-			}
-		}
-		if (path_table_size & 1)
-			path_table_size++;	/* For odd lengths we pad */
-		s_entry->isorec.name_len[0] = new_reclen;
-
-		new_reclen += offsetof(struct iso_directory_record, name[0]);
-
-		if (new_reclen & 1)
-			new_reclen++;
-
-		new_reclen += s_entry->rr_attr_size;
-
-		if (new_reclen & 1)
-			new_reclen++;
-
-		if (new_reclen > 0xff) {
-#ifdef	USE_LIBSCHILY
-			comerrno(EX_BAD,
-				"Fatal error - RR overflow (reclen %d) for file %s\n",
-				new_reclen,
-				s_entry->name);
-#else
-			fprintf(stderr,
-				"Fatal error - RR overflow (reclen %d) for file %s\n",
-				new_reclen,
-				s_entry->name);
-			exit(1);
-#endif
-		}
-		s_entry->isorec.length[0] = new_reclen;
-	}
-
-	status = sort_directory(&this_dir->contents, (reloc_dir == this_dir));
-	if (status > 0) {
-#ifdef	USE_LIBSCHILY
-		comerrno(EX_BAD, "Unable to sort directory %s\n",
-			this_dir->whole_name);
-#else
-		fprintf(stderr, "Unable to sort directory %s\n",
-			this_dir->whole_name);
-		exit(1);
-#endif
-	}
-	/*
-	 * If we are filling out a TRANS.TBL, generate the entries that will
-	 * go in the thing.
-	 */
-	if (table) {
-		count = 0;
-		for (s_entry = this_dir->contents; s_entry;
-						s_entry = s_entry->next) {
-			if (s_entry == table)
-				continue;
-			if (!s_entry->table)
-				continue;
-			if (strcmp(s_entry->name, ".") == 0 ||
-				strcmp(s_entry->name, "..") == 0)
-				continue;
-#ifdef APPLE_HYB
-			/* skip table entry for the resource fork */
-			if (apple_both &&
-			    (s_entry->isorec.flags[0] & ISO_ASSOCIATED))
-				continue;
-#endif	/* APPLE_HYB */
-			if (s_entry->de_flags & INHIBIT_ISO9660_ENTRY)
-				continue;
-			/*
-			 * Warning: we cannot use the return value of sprintf
-			 * because old BSD based sprintf() implementations
-			 * will return a pointer to the result instead of a
-			 * count.
-			 * Old mkiofs introduced a space after the iso
-			 * filename to make parsing TRANS.TBL easier.
-			 */
-			sprintf(table->table + count, "%c %-*s%s",
-				s_entry->table[0],
-				MAX_ISONAME + 1,
-				s_entry->isorec.name, s_entry->table + 1);
-			count += strlen(table->table + count);
-			free(s_entry->table);
-			/*
-			 * for a memory file, set s_entry->table to the
-			 * correct data - which is stored in
-			 * s_entry->whole_name
-			 */
-			if (s_entry->de_flags & MEMORY_FILE) {
-				s_entry->table = s_entry->whole_name;
-				s_entry->whole_name = NULL;
-			} else {
-				s_entry->table = NULL;
-			}
-		}
-
-		if (count != tablesize) {
-#ifdef	USE_LIBSCHILY
-			comerrno(EX_BAD,
-				"Translation table size mismatch %d %d\n",
-				count, tablesize);
-#else
-			fprintf(stderr,
-				"Translation table size mismatch %d %d\n",
-				count, tablesize);
-			exit(1);
-#endif
-		}
-	}
-	/*
-	 * Now go through the directory and figure out how large this one will
-	 * be. Do not split a directory entry across a sector boundary
-	 */
-	s_entry = this_dir->contents;
-	this_dir->ce_bytes = 0;
-	while (s_entry) {
-		/* skip if it's hidden */
-		if (s_entry->de_flags & INHIBIT_ISO9660_ENTRY) {
-			s_entry = s_entry->next;
-			continue;
-		}
-		new_reclen = s_entry->isorec.length[0];
-		if ((this_dir->size & (SECTOR_SIZE - 1)) + new_reclen
-								>= SECTOR_SIZE)
-
-			this_dir->size = (this_dir->size + (SECTOR_SIZE - 1)) &
-				~(SECTOR_SIZE - 1);
-		this_dir->size += new_reclen;
-
-		/* See if continuation entries were used on disc */
-		if (use_RockRidge &&
-			s_entry->rr_attr_size != s_entry->total_rr_attr_size) {
-			unsigned char	*pnt;
-			int		len;
-			int		nbytes;
-
-			pnt = s_entry->rr_attributes;
-			len = s_entry->total_rr_attr_size;
-			pnt = parse_xa(pnt, &len, 0);
-/*			pnt = parse_xa(pnt, &len, s_entry);*/
-
-			/*
-			 * We make sure that each continuation entry record is
-			 * not split across sectors, but each file could in
-			 * theory have more than one CE, so we scan through
-			 * and figure out what we need.
-			 */
-			while (len > 3) {
-				if (pnt[0] == 'C' && pnt[1] == 'E') {
-					nbytes = get_733((char *) pnt + 20);
-
-					if ((this_dir->ce_bytes & (SECTOR_SIZE - 1)) + nbytes >=
-						SECTOR_SIZE)
-						this_dir->ce_bytes =
-							ISO_ROUND_UP(this_dir->ce_bytes);
-					/*
-					 * Now store the block in the
-					 * ce buffer
-					 */
-					this_dir->ce_bytes += nbytes;
-					if (this_dir->ce_bytes & 1)
-						this_dir->ce_bytes++;
-				}
-				len -= pnt[2];
-				pnt += pnt[2];
-			}
-		}
-		s_entry = s_entry->next;
-	}
-	return (status);
-}
-
-static void
-generate_reloc_directory()
-{
-	time_t		current_time;
-	struct directory_entry *s_entry;
-
-	/* Create an  entry for our internal tree */
-	time(&current_time);
-	reloc_dir = (struct directory *)
-		e_malloc(sizeof (struct directory));
-	memset(reloc_dir, 0, sizeof (struct directory));
-	reloc_dir->parent = root;
-	reloc_dir->next = root->subdir;
-	root->subdir = reloc_dir;
-	reloc_dir->depth = 1;
-	if (hide_rr_moved) {
-		reloc_dir->whole_name = strdup("./.rr_moved");
-		reloc_dir->de_name = strdup(".rr_moved");
-	} else {
-		reloc_dir->whole_name = strdup("./rr_moved");
-		reloc_dir->de_name = strdup("rr_moved");
-	}
-	reloc_dir->extent = 0;
-
-
-	/* Now create an actual directory  entry */
-	s_entry = (struct directory_entry *)
-		e_malloc(sizeof (struct directory_entry));
-	memset(s_entry, 0, sizeof (struct directory_entry));
-	s_entry->next = root->contents;
-	reloc_dir->self = s_entry;
-
-	/* The rr_moved entry will not appear in the Joliet tree. */
-	reloc_dir->dir_flags |= INHIBIT_JOLIET_ENTRY;
-	s_entry->de_flags |= INHIBIT_JOLIET_ENTRY;
-
-	/* Hiding RR_MOVED seems not to be possible..... */
-#ifdef	HIDE_RR
-	reloc_dir->dir_flags |= INHIBIT_ISO9660_ENTRY;
-	s_entry->de_flags |= INHIBIT_ISO9660_ENTRY;
-#endif
-
-	root->contents = s_entry;
-	root->contents->name = strdup(reloc_dir->de_name);
-	root->contents->filedir = root;
-	root->contents->isorec.flags[0] = ISO_DIRECTORY;
-	root->contents->priority = 32768;
-	iso9660_date(root->contents->isorec.date, current_time);
-	root->contents->inode = UNCACHED_INODE;
-	root->contents->dev = (dev_t) UNCACHED_DEVICE;
-	set_723(root->contents->isorec.volume_sequence_number,
-						volume_sequence_number);
-	iso9660_file_length(reloc_dir->de_name, root->contents, 1);
-
-	init_fstatbuf();
-
-	if (use_XA || use_RockRidge) {
-		fstatbuf.st_mode = 0555 | S_IFDIR;
-		fstatbuf.st_nlink = 2;
-		generate_xa_rr_attributes("",
-			hide_rr_moved ? ".rr_moved" : "rr_moved",
-			s_entry, &fstatbuf, &fstatbuf, 0);
-	};
-
-	/* Now create the . and .. entries in rr_moved */
-	/* Now create an actual directory  entry */
-	attach_dot_entries(reloc_dir, &root_statbuf);
-}
-
-/*
- * Function:		attach_dot_entries
- *
- * Purpose:		Create . and .. entries for a new directory.
- *
- * Notes:		Only used for artificial directories that
- *			we are creating.
- */
-static void
-attach_dot_entries(struct directory *dirnode, 
-						 struct stat *parent_stat)
-{
-	struct directory_entry *s_entry;
-	struct directory_entry *orig_contents;
-	int		deep_flag = 0;
-
-	init_fstatbuf();
-
-	orig_contents = dirnode->contents;
-
-	if ((dirnode->dir_flags & DIR_HAS_DOTDOT) == 0) {
-		s_entry = (struct directory_entry *)
-			e_malloc(sizeof (struct directory_entry));
-		memcpy(s_entry, dirnode->self,
-			sizeof (struct directory_entry));
-#ifdef	APPLE_HYB
-		if (dirnode->self->hfs_ent) {
-			s_entry->hfs_ent = (hfsdirent *)
-				e_malloc(sizeof (hfsdirent));
-			memcpy(s_entry->hfs_ent, dirnode->self->hfs_ent,
-				sizeof (hfsdirent));
-		}
-#endif
-		s_entry->name = strdup("..");
-		s_entry->whole_name = NULL;
-		s_entry->isorec.name_len[0] = 1;
-		s_entry->isorec.flags[0] = ISO_DIRECTORY;
-		iso9660_file_length("..", s_entry, 1);
-		iso9660_date(s_entry->isorec.date, fstatbuf.st_mtime);
-		set_723(s_entry->isorec.volume_sequence_number,
-						volume_sequence_number);
-		set_733(s_entry->isorec.size, SECTOR_SIZE);
-		memset(s_entry->isorec.extent, 0, 8);
-		s_entry->filedir = dirnode->parent;
-
-		dirnode->contents = s_entry;
-		dirnode->contents->next = orig_contents;
-		orig_contents = s_entry;
-
-		if (use_XA || use_RockRidge) {
-			if (parent_stat == NULL) {
-				parent_stat = &fstatbuf;
-			}
-			generate_xa_rr_attributes("",
-				"..", s_entry,
-				parent_stat,
-				parent_stat, 0);
-		}
-		dirnode->dir_flags |= DIR_HAS_DOTDOT;
-	}
-	if ((dirnode->dir_flags & DIR_HAS_DOT) == 0) {
-		s_entry = (struct directory_entry *)
-			e_malloc(sizeof (struct directory_entry));
-		memcpy(s_entry, dirnode->self,
-			sizeof (struct directory_entry));
-#ifdef	APPLE_HYB
-		if (dirnode->self->hfs_ent) {
-			s_entry->hfs_ent = (hfsdirent *)
-				e_malloc(sizeof (hfsdirent));
-			memcpy(s_entry->hfs_ent, dirnode->self->hfs_ent,
-				sizeof (hfsdirent));
-		}
-#endif
-		s_entry->name = strdup(".");
-		s_entry->whole_name = NULL;
-		s_entry->isorec.name_len[0] = 1;
-		s_entry->isorec.flags[0] = ISO_DIRECTORY;
-		iso9660_file_length(".", s_entry, 1);
-		iso9660_date(s_entry->isorec.date, fstatbuf.st_mtime);
-		set_723(s_entry->isorec.volume_sequence_number,
-						volume_sequence_number);
-		set_733(s_entry->isorec.size, SECTOR_SIZE);
-		memset(s_entry->isorec.extent, 0, 8);
-		s_entry->filedir = dirnode;
-
-		dirnode->contents = s_entry;
-		dirnode->contents->next = orig_contents;
-
-		if (use_XA || use_RockRidge) {
-			fstatbuf.st_mode = new_dir_mode | S_IFDIR;
-			fstatbuf.st_nlink = 2;
-
-			if (dirnode == root) {
-				deep_flag |= NEED_CE | NEED_SP;	/* For extension record */
-			}
-			generate_xa_rr_attributes("",
-				".", s_entry,
-				&fstatbuf, &fstatbuf, deep_flag);
-		}
-		dirnode->dir_flags |= DIR_HAS_DOT;
-	}
-}
-
-static void
-update_nlink(struct directory_entry *s_entry, int value)
-{
-	unsigned char	*pnt;
-	int		len;
-
-	pnt = s_entry->rr_attributes;
-	len = s_entry->total_rr_attr_size;
-	pnt = parse_xa(pnt, &len, 0);
-	while (len >= 4) {
-		if (pnt[3] != 1 && pnt[3] != 2) {
-#ifdef USE_LIBSCHILY
-			errmsgno(EX_BAD,
-				"**BAD RRVERSION (%d) for %c%c\n",
-				pnt[3], pnt[0], pnt[1]);
-#else
-			fprintf(stderr,
-				"**BAD RRVERSION (%d) for %c%c\n",
-				pnt[3], pnt[0], pnt[1]);
-#endif
-		}
-		if (pnt[0] == 'P' && pnt[1] == 'X') {
-			set_733((char *) pnt + 12, value);
-			break;
-		}
-		len -= pnt[2];
-		pnt += pnt[2];
-	}
-}
-
-static void
-increment_nlink(struct directory_entry *s_entry)
-{
-	unsigned char	*pnt;
-	int		len,
-			nlink;
-
-	pnt = s_entry->rr_attributes;
-	len = s_entry->total_rr_attr_size;
-	pnt = parse_xa(pnt, &len, 0);
-	while (len >= 4) {
-		if (pnt[3] != 1 && pnt[3] != 2) {
-#ifdef USE_LIBSCHILY
-			errmsgno(EX_BAD,
-				"**BAD RRVERSION (%d) for %c%c\n",
-				pnt[3], pnt[0], pnt[1]);
-#else
-			fprintf(stderr,
-				"**BAD RRVERSION (%d) for %c%c\n",
-				pnt[3], pnt[0], pnt[1]);
-#endif
-		}
-		if (pnt[0] == 'P' && pnt[1] == 'X') {
-			nlink = get_733((char *) pnt + 12);
-			set_733((char *) pnt + 12, nlink + 1);
-			break;
-		}
-		len -= pnt[2];
-		pnt += pnt[2];
-	}
-}
-
-char *
-find_rr_attribute(unsigned char *pnt, int len, char *attr_type)
-{
-	pnt = parse_xa(pnt, &len, 0);
-	while (len >= 4) {
-		if (pnt[3] != 1 && pnt[3] != 2) {
-#ifdef USE_LIBSCHILY
-			errmsgno(EX_BAD,
-				"**BAD RRVERSION (%d) for %c%c\n",
-				pnt[3], pnt[0], pnt[1]);
-#else
-			fprintf(stderr,
-				"**BAD RRVERSION (%d) for %c%c\n",
-				pnt[3], pnt[0], pnt[1]);
-#endif
-		}
-		if (strncmp((char *) pnt, attr_type, 2) == 0)
-			return ((char *) pnt);
-		else if (strncmp((char *) pnt, "ST", 2) == 0)
-			return (NULL);
-		len -= pnt[2];
-		pnt += pnt[2];
-	}
-	return (NULL);
-}
-
-void
-finish_cl_pl_entries()
-{
-	struct directory_entry	*s_entry;
-	struct directory_entry	*s_entry1;
-	struct directory	*d_entry;
-
-	/* if the reloc_dir is hidden (empty), then return */
-	if (reloc_dir->dir_flags & INHIBIT_ISO9660_ENTRY)
-		return;
-
-	s_entry = reloc_dir->contents;
-	s_entry = s_entry->next->next;	/* Skip past . and .. */
-	for (; s_entry; s_entry = s_entry->next) {
-		/* skip if it's hidden */
-		if (s_entry->de_flags & INHIBIT_ISO9660_ENTRY) {
-			continue;
-		}
-		d_entry = reloc_dir->subdir;
-		while (d_entry) {
-			if (d_entry->self == s_entry)
-				break;
-			d_entry = d_entry->next;
-		};
-		if (!d_entry) {
-#ifdef	USE_LIBSCHILY
-			comerrno(EX_BAD,
-					"Unable to locate directory parent\n");
-#else
-			fprintf(stderr, "Unable to locate directory parent\n");
-			exit(1);
-#endif
-		};
-
-		if (s_entry->filedir != NULL && s_entry->parent_rec != NULL) {
-			char	*rr_attr;
-
-			/*
-			 * First fix the PL pointer in the directory in the
-			 * rr_reloc dir
-			 */
-			s_entry1 = d_entry->contents->next;
-
-/*			set_733((char *) s_entry1->rr_attributes +*/
-/*				s_entry1->total_rr_attr_size - 8,*/
-/*				s_entry->filedir->extent); */
-			/*
-			 * The line above won't work when entry was read from
-			 * the previous session, because if total_rr_attr_size
-			 * was odd when recording previous session, now we have
-			 * total_rr_attr_size off by 1 due to padding.
-			 *
-			 * So, just search for the attributes by name
-			 */
-			rr_attr = find_rr_attribute(s_entry1->rr_attributes,
-				s_entry1->total_rr_attr_size, "PL");
-			if (rr_attr != NULL)
-				set_733(rr_attr + 4, s_entry->filedir->extent);
-
-
-			/* Now fix the CL pointer */
-			s_entry1 = s_entry->parent_rec;
-
-/*			set_733((char *) s_entry1->rr_attributes +*/
-/*			s_entry1->total_rr_attr_size - 8, d_entry->extent); */
-			rr_attr = find_rr_attribute(s_entry1->rr_attributes,
-				s_entry1->total_rr_attr_size, "CL");
-			if (rr_attr != NULL)
-				set_733(rr_attr + 4, d_entry->extent);
-		}
-		s_entry->filedir = reloc_dir;	/* Now we can fix this */
-	}
-	/*
-	 * Next we need to modify the NLINK terms in the assorted root
-	 * directory records to account for the presence of the RR_MOVED
-	 * directory
-	 */
-	increment_nlink(root->self);
-	increment_nlink(root->self->next);
-	d_entry = root->subdir;
-	while (d_entry) {
-		increment_nlink(d_entry->contents->next);
-		d_entry = d_entry->next;
-	};
-
-	finish_cl_pl_for_prev_session();
-}
-
-/*
- * Function:		scan_directory_tree
- *
- * Purpose:		Walk through a directory on the local machine
- *			filter those things we don't want to include
- *			and build our representation of a dir.
- *
- * Notes:
- */
-int
-scan_directory_tree(struct directory *this_dir, char *path, 
-						  struct directory_entry *de)
-{
-	DIR		*current_dir;
-	char		whole_path[PATH_MAX];
-	struct dirent	*d_entry;
-	struct directory *parent;
-	int		dflag;
-	char		*old_path;
-
-	if (verbose > 1) {
-		fprintf(stderr, "Scanning %s\n", path);
-	}
-/*#define	check_needed*/
-#ifdef	check_needed
-	/*
-	 * Trying to use this to avoid directory loops from hard links
-	 * or followed symlinks does not work. It would prevent us from
-	 * implementing merge directories.
-	 */
-	if (this_dir->dir_flags & DIR_WAS_SCANNED) {
-		fprintf(stderr, "Already scanned directory %s\n", path);
-		return (1);	/* It's a directory */
-	}
-#endif
-	this_dir->dir_flags |= DIR_WAS_SCANNED;
-
-	errno = 0;	/* Paranoia */
-	current_dir = opendir(path);
-	d_entry = NULL;
-
-	/*
-	 * Apparently NFS sometimes allows you to open the directory, but then
-	 * refuses to allow you to read the contents.  Allow for this
-	 */
-	old_path = path;
-
-	if (current_dir) {
-		errno = 0;
-		d_entry = readdir(current_dir);
-	}
-
-	if (!current_dir || !d_entry) {
-		int	ret = 1;
-
-#ifdef	USE_LIBSCHILY
-		errmsg("Unable to open directory %s\n", path);
-#else
-		fprintf(stderr, "Unable to open directory %s\n", path);
-#endif
-		if (errno == ENOTDIR) {
-			/* Mark as not a directory */
-			de->isorec.flags[0] &= ~ISO_DIRECTORY;
-			ret = 0;
-		}
-		if (current_dir)
-			closedir(current_dir);
-		return (ret);
-	}
-#ifdef	ABORT_DEEP_ISO_ONLY
-	if ((this_dir->depth > RR_relocation_depth) && !use_RockRidge) {
-		static	BOOL	did_hint = FALSE;
-
-		errmsgno(EX_BAD,
-			"Directories too deep for '%s' (%d) max is %d; ignored - continuing.\n",
-			path, this_dir->depth, RR_relocation_depth);
-		if (!did_hint) {
-			did_hint = TRUE;
-			errmsgno(EX_BAD, "To incude the complete directory tree,\n");
-			errmsgno(EX_BAD, "use Rock Ridge extensions via -R or -r,\n");
-			errmsgno(EX_BAD, "or allow deep ISO9660 directory nesting via -D.\n");
-		}
-		closedir(current_dir);
-		return (1);
-	}
-#endif
-
-	parent = de->filedir;
-	/*
-	 * Set up the struct for the current directory, and insert it into
-	 * the tree
-	 */
-#ifdef VMS
-	vms_path_fixup(path);
-#endif
-
-	/*
-	 * if entry for this sub-directory is hidden, then hide this directory
-	 */
-	if (de->de_flags & INHIBIT_ISO9660_ENTRY)
-		this_dir->dir_flags |= INHIBIT_ISO9660_ENTRY;
-
-	if (de->de_flags & INHIBIT_JOLIET_ENTRY)
-		this_dir->dir_flags |= INHIBIT_JOLIET_ENTRY;
-
-#ifdef SORTING
-	/*
-	 * set any sort weighting from it's own directory entry - if a
-	 * directory is given a weighting, then all the contents will use
-	 * this as the default weighting
-	 */
-	this_dir->sort = de->sort;
-#endif /* SORTING */
-
-	/*
-	 * Now we scan the directory itself, and look at what is inside of it.
-	 */
-	dflag = 0;
-	while (1 == 1) {
-
-		/*
-		 * The first time through, skip this, since we already asked
-		 * for the first entry when we opened the directory.
-		 */
-		if (dflag)
-			d_entry = readdir(current_dir);
-		dflag++;
-
-		if (!d_entry)
-			break;
-
-		/* OK, got a valid entry */
-
-		/* If we do not want all files, then pitch the backups. */
-		if (!all_files) {
-			if (strchr(d_entry->d_name, '~') ||
-			    strchr(d_entry->d_name, '#') ||
-			    rstr(d_entry->d_name, ".bak")) {
-				if (verbose > 0) {
-					fprintf(stderr,
-						"Ignoring file %s\n",
-						d_entry->d_name);
-				}
-				continue;
-			}
-		}
-#ifdef APPLE_HYB
-		if (apple_both) {
-			/*
-			 * exclude certain HFS type files/directories for the
-			 * time being
-			 */
-			if (hfs_exclude(d_entry->d_name))
-				continue;
-		}
-#endif	/* APPLE_HYB */
-
-		if (strlen(path) + strlen(d_entry->d_name) + 2 >
-							sizeof (whole_path)) {
-#ifdef	USE_LIBSCHILY
-			errmsgno(EX_BAD, "Path name %s/%s too long.\n",
-					path, d_entry->d_name);
-			comerrno(EX_BAD, "Overflow of stat buffer\n");
-#else
-			fprintf(stderr, "Path name %s/%s too long.\n",
-					path, d_entry->d_name);
-			fprintf(stderr, "Overflow of stat buffer\n");
-			exit(1);
-#endif
-		};
-
-		/* Generate the complete ASCII path for this file */
-		strcpy(whole_path, path);
-#ifndef VMS
-		if (whole_path[strlen(whole_path) - 1] != '/')
-			strcat(whole_path, "/");
-#endif
-		strcat(whole_path, d_entry->d_name);
-
-		/** Should we exclude this file ? */
-		if (matches(d_entry->d_name) || matches(whole_path)) {
-			if (verbose > 1) {
-				fprintf(stderr,
-					"Excluded by match: %s\n", whole_path);
-			}
-			continue;
-		}
-		if (generate_tables &&
-		    strcmp(d_entry->d_name, trans_tbl) == 0) {
-			/*
-			 * Ignore this entry.  We are going to be generating
-			 * new versions of these files, and we need to ignore
-			 * any originals that we might have found.
-			 */
-			if (verbose > 1) {
-				fprintf(stderr, "Excluded: %s\n", whole_path);
-			}
-			continue;
-		}
-		/*
-		 * If we already have a '.' or a '..' entry, then don't insert
-		 * new ones.
-		 */
-		if (strcmp(d_entry->d_name, ".") == 0 &&
-		    this_dir->dir_flags & DIR_HAS_DOT) {
-			continue;
-		}
-		if (strcmp(d_entry->d_name, "..") == 0 &&
-		    this_dir->dir_flags & DIR_HAS_DOTDOT) {
-			continue;
-		}
-#if 0
-		if (verbose > 1)
-			fprintf(stderr, "%s\n", whole_path);
-#endif
-		/* This actually adds the entry to the directory in question.*/
-#ifdef APPLE_HYB
-		insert_file_entry(this_dir, whole_path, d_entry->d_name, 0);
-#else
-		insert_file_entry(this_dir, whole_path, d_entry->d_name);
-#endif	/* APPLE_HYB */
-	}
-	closedir(current_dir);
-
-#ifdef APPLE_HYB
-	/*
-	 * if we cached the HFS info stuff for this directory, then delete it
-	 */
-	if (this_dir->hfs_info) {
-		del_hfs_info(this_dir->hfs_info);
-		this_dir->hfs_info = 0;
-	}
-#endif	/* APPLE_HYB */
-
-	return (1);
-}
-
-
-/*
- * Function:		insert_file_entry
- *
- * Purpose:		Insert one entry into our directory node.
- *
- * Note:
- * This function inserts a single entry into the directory.  It
- * is assumed that all filtering and decision making regarding what
- * we want to include has already been made, so the purpose of this
- * is to insert one entry (file, link, dir, etc), into this directory.
- * Note that if the entry is a dir (or if we are following links,
- * and the thing it points to is a dir), then we will scan those
- * trees before we return.
- */
-#ifdef APPLE_HYB
-int
-insert_file_entry(struct directory *this_dir, char *whole_path, 
-						char *short_name, int have_rsrc)
-#else
-int
-insert_file_entry(struct directory *this_dir, char *whole_path, 
-						char *short_name)
-#endif	/* APPLE_HYB */
-{
-	struct stat	statbuf,
-			lstatbuf;
-	struct directory_entry *s_entry,
-			*s_entry1;
-	int		lstatus;
-	int		status;
-	int		deep_flag;
-	int		no_scandir = 0;
-
-#ifdef APPLE_HYB
-	int		x_hfs = 0;
-	int		htype = TYPE_NONE;
-
-#endif	/* APPLE_HYB */
-
-	status = stat_filter(whole_path, &statbuf);
-
-	lstatus = lstat_filter(whole_path, &lstatbuf);
-
-	if ((status == -1) && (lstatus == -1)) {
-		/*
-		 * This means that the file doesn't exist, or isn't accessible.
-		 * Sometimes this is because of NFS permissions problems.
-		 */
-#ifdef	USE_LIBSCHILY
-		errmsg("Non-existent or inaccessible: %s\n", whole_path);
-#else
-		fprintf(stderr, "Non-existent or inaccessible: %s\n",
-								whole_path);
-#endif
-		return (0);
-	}
-	if (this_dir == root && strcmp(short_name, ".") == 0)
-		root_statbuf = statbuf;	/* Save this for later on */
-
-	/* We do this to make sure that the root entries are consistent */
-	if (this_dir == root && strcmp(short_name, "..") == 0) {
-		statbuf = root_statbuf;
-		lstatbuf = root_statbuf;
-	}
-	if (S_ISLNK(lstatbuf.st_mode)) {
-
-		/*
-		 * Here we decide how to handle the symbolic links.  Here we
-		 * handle the general case - if we are not following links or
-		 * there is an error, then we must change something.  If RR
-		 * is in use, it is easy, we let RR describe the file.  If
-		 * not, then we punt the file.
-		 */
-		if ((status || !follow_links)) {
-			if (use_RockRidge) {
-				status = 0;
-				statbuf.st_size = (off_t)0;
-				STAT_INODE(statbuf) = UNCACHED_INODE;
-				statbuf.st_dev = (dev_t) UNCACHED_DEVICE;
-				statbuf.st_mode =
-					(statbuf.st_mode & ~S_IFMT) | S_IFREG;
-			} else {
-				if (follow_links) {
-#ifdef	USE_LIBSCHILY
-					/* XXX errno may be wrong! */
-					errmsg("Unable to stat file %s - ignoring and continuing.\n",
-						whole_path);
-#else
-					fprintf(stderr,
-						"Unable to stat file %s - ignoring and continuing.\n",
-						whole_path);
-#endif
-				} else {
-#ifdef	USE_LIBSCHILY
-					errmsgno(EX_BAD,
-						"Symlink %s ignored - continuing.\n",
-						whole_path);
-#else
-					fprintf(stderr,
-						"Symlink %s ignored - continuing.\n",
-						whole_path);
-#endif
-					return (0); /* Non Rock Ridge discs */
-						    /* - ignore all symlinks */
-				}
-			}
-		}
-		/*
-		 * Here we handle a different kind of case.  Here we have a
-		 * symlink, but we want to follow symlinks.  If we run across
-		 * a directory loop, then we need to pretend that we are not
-		 * following symlinks for this file.  If this is the first
-		 * time we have seen this, then make this seem as if there was
-		 * no symlink there in the first place
-		 */
-		if (follow_links &&
-		    S_ISDIR(statbuf.st_mode)) {
-			if (strcmp(short_name, ".") &&
-			    strcmp(short_name, "..")) {
-				if (find_directory_hash(statbuf.st_dev,
-							STAT_INODE(statbuf))) {
-					if (!use_RockRidge) {
-						fprintf(stderr,
-						"Already cached directory seen (%s)\n",
-							whole_path);
-						return (0);
-					}
-					lstatbuf = statbuf;
-					/*
-					 * XXX when this line was active,
-					 * XXX mkisoimage did not include all
-					 * XXX files if it was called with '-f'
-					 * XXX (follow symlinks).
-					 * XXX Now scan_directory_tree()
-					 * XXX checks if the directory has
-					 * XXX already been scanned via the
-					 * XXX DIR_WAS_SCANNED flag.
-					 */
-/*					no_scandir = 1;*/
-				} else {
-					lstatbuf = statbuf;
-					add_directory_hash(statbuf.st_dev,
-							STAT_INODE(statbuf));
-				}
-			}
-		}
-		/*
-		 * For non-directories, we just copy the stat information over
-		 * so we correctly include this file.
-		 */
-		if (follow_links &&
-		    !S_ISDIR(statbuf.st_mode)) {
-			lstatbuf = statbuf;
-		}
-	}
-	/*
-	 * Add directories to the cache so that we don't waste space even if
-	 * we are supposed to be following symlinks.
-	 */
-	if (follow_links &&
-	    strcmp(short_name, ".") &&
-	    strcmp(short_name, "..") &&
-	    S_ISDIR(statbuf.st_mode)) {
-		add_directory_hash(statbuf.st_dev, STAT_INODE(statbuf));
-	}
-#ifdef VMS
-	if (!S_ISDIR(lstatbuf.st_mode) && (statbuf.st_fab_rfm != FAB$C_FIX &&
-			statbuf.st_fab_rfm != FAB$C_STMLF)) {
-		fprintf(stderr,
-			"Warning - file %s has an unsupported VMS record"
-			" format (%d)\n",
-			whole_path, statbuf.st_fab_rfm);
-	}
-#endif
-
-	if (S_ISREG(lstatbuf.st_mode) && (status = access(whole_path, R_OK))) {
-#ifdef	USE_LIBSCHILY
-		errmsg("File %s is not readable - ignoring\n",
-			whole_path);
-#else
-		fprintf(stderr,
-			"File %s is not readable (errno = %d) - ignoring\n",
-			whole_path, errno);
-#endif
-		return (0);
-	}
-#ifdef	HAVE_LARGEFILES
-	/*
-	 * XXX What happens with Apple HFS? Does it allow files >= 2 GB?
-	 */
-	if (S_ISREG(lstatbuf.st_mode) && (lstatbuf.st_size >= (off_t)0xFFFFFFFF)) {
-#else
-	/*
-	 * >= is required by the large file summit standard.
-	 */
-	if (S_ISREG(lstatbuf.st_mode) && (lstatbuf.st_size >= (off_t)0x7FFFFFFF)) {
-#endif
-#ifdef	EOVERFLOW
-		errno = EOVERFLOW;
-#else
-		errno = EFBIG;
-#endif
-#ifdef	USE_LIBSCHILY
-		errmsg("File %s is too large - ignoring\n",
-			whole_path);
-#else
-		fprintf(stderr,
-			"File %s is too large (errno = %d) - ignoring\n",
-			whole_path, errno);
-#endif
-		return (0);
-	}
-	/*
-	 * Add this so that we can detect directory loops with hard links.
-	 * If we are set up to follow symlinks, then we skip this checking.
-	 */
-	if (!follow_links &&
-	    S_ISDIR(lstatbuf.st_mode) &&
-	    strcmp(short_name, ".") &&
-	    strcmp(short_name, "..")) {
-		if (find_directory_hash(statbuf.st_dev, STAT_INODE(statbuf))) {
-#ifdef	USE_LIBSCHILY
-/*			comerrno(EX_BAD,*/
-/*			"Directory loop - fatal goof (%s %lx %lu).\n",*/
-			errmsgno(EX_BAD,
-			"Warning: Directory loop (%s dev: %lx ino: %lu).\n",
-				whole_path, (unsigned long) statbuf.st_dev,
-				(unsigned long) STAT_INODE(statbuf));
-#else
-/*			fprintf(stderr,*/
-/*			"Directory loop - fatal goof (%s %lx %lu).\n",*/
-			fprintf(stderr,
-			"Warning: Directory loop (%s dev: %lx ino: %lu).\n",
-				whole_path, (unsigned long) statbuf.st_dev,
-				(unsigned long) STAT_INODE(statbuf));
-#endif
-		}
-		add_directory_hash(statbuf.st_dev, STAT_INODE(statbuf));
-	}
-	if (!S_ISCHR(lstatbuf.st_mode) && !S_ISBLK(lstatbuf.st_mode) &&
-		!S_ISFIFO(lstatbuf.st_mode) && !S_ISSOCK(lstatbuf.st_mode) &&
-		!S_ISLNK(lstatbuf.st_mode) && !S_ISREG(lstatbuf.st_mode) &&
-		!S_ISDIR(lstatbuf.st_mode)) {
-		fprintf(stderr,
-		"Unknown file type (%s) %s - ignoring and continuing.\n",
-			filetype((int) lstatbuf.st_mode), whole_path);
-		return (0);
-	}
-	/* Who knows what trash this is - ignore and continue */
-
-	if (status) {
-#ifdef	USE_LIBSCHILY
-		errmsg("Unable to stat file %s - ignoring and continuing.\n",
-			whole_path);
-#else
-		fprintf(stderr,
-			"Unable to stat file %s - ignoring and continuing.\n",
-			whole_path);
-#endif
-		return (0);
-	}
-	/*
-	 * Check to see if we have already seen this directory node. If so,
-	 * then we don't create a new entry for it, but we do want to recurse
-	 * beneath it and add any new files we do find.
-	 */
-	if (S_ISDIR(statbuf.st_mode)) {
-		int	dflag;
-
-		for (s_entry = this_dir->contents; s_entry;
-						s_entry = s_entry->next) {
-			if (strcmp(s_entry->name, short_name) == 0) {
-				break;
-			}
-		}
-		if (s_entry != NULL &&
-		    strcmp(short_name, ".") &&
-		    strcmp(short_name, "..")) {
-			struct directory *child;
-
-			if ((s_entry->de_flags & RELOCATED_DIRECTORY) != 0) {
-				for (s_entry = reloc_dir->contents; s_entry;
-						s_entry = s_entry->next) {
-					if (strcmp(s_entry->name, short_name)
-									== 0) {
-						break;
-					}
-				}
-				child = find_or_create_directory(reloc_dir,
-					whole_path,
-					s_entry, 1);
-			} else {
-				child = find_or_create_directory(this_dir,
-					whole_path,
-					s_entry, 1);
-				/*
-				 * If unable to scan directory, mark this as a
-				 * non-directory
-				 */
-			}
-/*			if (no_scandir)*/
-			if (0)
-				dflag = 1;
-			else
-				dflag = scan_directory_tree(child,
-							whole_path, s_entry);
-			if (!dflag) {
-				lstatbuf.st_mode =
-					(lstatbuf.st_mode & ~S_IFMT) | S_IFREG;
-			}
-			return (0);
-		}
-	}
-#ifdef APPLE_HYB
-	/* Should we exclude this HFS file ? - only works with -hfs */
-	if (!have_rsrc && apple_hyb && strcmp(short_name, ".") &&
-						strcmp(short_name, "..")) {
-		if ((x_hfs = (hfs_matches(short_name) ||
-					hfs_matches(whole_path))) == 1) {
-			if (verbose > 1) {
-				fprintf(stderr, "Hidden from HFS tree: %s\n",
-							whole_path);
-			}
-		}
-	}
-	/*
-	 * check we are a file, using Apple extensions and have a .resource
-	 * part and not excluded
-	 */
-	if (S_ISREG(lstatbuf.st_mode) && !have_rsrc && apple_both && !x_hfs) {
-		char	rsrc_path[PATH_MAX];	/* rsrc fork filename */
-
-		/* construct the resource full path */
-		htype = get_hfs_rname(whole_path, short_name, rsrc_path);
-		/* check we can read the resouce fork */
-		if (htype) {
-			struct stat	rstatbuf,
-					rlstatbuf;
-
-			/* some further checks on the file */
-			status = stat_filter(rsrc_path, &rstatbuf);
-
-			lstatus = lstat_filter(rsrc_path, &rlstatbuf);
-
-/*			if (!status && !lstatus && S_ISREG(rlstatbuf.st_mode)*/
-/*					&& rlstatbuf.st_size > (off_t)0) { */
-			if (!status && !lstatus && S_ISREG(rstatbuf.st_mode) &&
-					rstatbuf.st_size > (off_t)0) {
-
-				/*
-				 * have a resource file - insert it into the
-				 * current directory but flag that we have a
-				 * resource fork
-				 */
-				insert_file_entry(this_dir, rsrc_path,
-							short_name, htype);
-			}
-		}
-	}
-#endif	/* APPLE_HYB */
-
-	s_entry = (struct directory_entry *)
-		e_malloc(sizeof (struct directory_entry));
-	/* memset the whole struct, not just the isorec.extent part JCP */
-	memset(s_entry, 0, sizeof (struct directory_entry));
-	s_entry->next = this_dir->contents;
-/*	memset(s_entry->isorec.extent, 0, 8); */
-	this_dir->contents = s_entry;
-	deep_flag = 0;
-	s_entry->table = NULL;
-
-	s_entry->name = strdup(short_name);
-	s_entry->whole_name = strdup(whole_path);
-
-	s_entry->de_flags = 0;
-
-	/*
-	 * If the current directory is hidden, then hide all it's members
-	 * otherwise check if this entry needs to be hidden as well
-	 */
-	if (this_dir->dir_flags & INHIBIT_ISO9660_ENTRY) {
-		s_entry->de_flags |= INHIBIT_ISO9660_ENTRY;
-	} else if (strcmp(short_name, ".") != 0 && strcmp(short_name, "..")
-									!= 0) {
-		if (i_matches(short_name) || i_matches(whole_path)) {
-			if (verbose > 1) {
-				fprintf(stderr,
-					"Hidden from ISO9660 tree: %s\n",
-					whole_path);
-			}
-			s_entry->de_flags |= INHIBIT_ISO9660_ENTRY;
-		}
-		if (h_matches(short_name) || h_matches(whole_path)) {
-			if (verbose > 1) {
-				fprintf(stderr,
-					"Hidden ISO9660 attribute: %s\n",
-					whole_path);
-			}
-			s_entry->de_flags |= HIDDEN_FILE;
-		}
-	}
-	if (this_dir != reloc_dir &&
-				this_dir->dir_flags & INHIBIT_JOLIET_ENTRY) {
-		s_entry->de_flags |= INHIBIT_JOLIET_ENTRY;
-	} else if (strcmp(short_name, ".") != 0 && strcmp(short_name, "..")
-									!= 0) {
-		if (j_matches(short_name) || j_matches(whole_path)) {
-			if (verbose > 1) {
-				fprintf(stderr,
-					"Hidden from Joliet tree: %s\n",
-					whole_path);
-			}
-			s_entry->de_flags |= INHIBIT_JOLIET_ENTRY;
-		}
-	}
-
-#ifdef SORTING
-	/* inherit any sort weight from parent directory */
-	s_entry->sort = this_dir->sort;
-
-#ifdef  DVD_VIDEO
-	/*
-	 * No use at all to do a sort if we don't make a dvd video/audio
-	 */
-	/*
-	 * Assign special weights to VIDEO_TS and AUDIO_TS files.
-	 * This can't be done with sort_matches for two reasons:
-	 * first, we need to match against the destination (DVD)
-	 * path rather than the source path, and second, there are
-	 * about 2400 different file names to check, each needing
-	 * a different priority, and adding that many patterns to
-	 * sort_matches would slow things to a crawl.
-	 */
-
-	if (dvd_video) {
-		s_entry->sort = assign_dvd_weights(s_entry->name, this_dir, s_entry->sort);
-		/* turn on sorting if necessary, regardless of cmd-line options */
-		if ((s_entry->sort != this_dir->sort) && do_sort == 0)
-			do_sort++;
-	}
-#endif
-
-	/* see if this entry should have a new weighting */
-	if (do_sort && strcmp(short_name, ".") != 0 &&
-			strcmp(short_name, "..") != 0) {
-		s_entry->sort = sort_matches(whole_path, s_entry->sort);
-	}
-#endif /* SORTING */
-
-	s_entry->filedir = this_dir;
-	s_entry->isorec.flags[0] = ISO_FILE;
-	if (s_entry->de_flags & HIDDEN_FILE)
-		s_entry->isorec.flags[0] |= ISO_EXISTENCE;
-	s_entry->isorec.ext_attr_length[0] = 0;
-	iso9660_date(s_entry->isorec.date, statbuf.st_mtime);
-	s_entry->isorec.file_unit_size[0] = 0;
-	s_entry->isorec.interleave[0] = 0;
-
-#ifdef APPLE_HYB
-	if (apple_both && !x_hfs) {
-		s_entry->hfs_ent = NULL;
-		s_entry->assoc = NULL;
-		s_entry->hfs_off = (off_t)0;
-		s_entry->hfs_type = htype;
-		if (have_rsrc) {
-			/* associated (rsrc) file */
-			s_entry->isorec.flags[0] |= ISO_ASSOCIATED;
-			/* set the type of HFS file */
-			s_entry->hfs_type = have_rsrc;
-			/*
-			 * don't want the rsrc file to be included in any
-			 * Joliet tree
-			 */
-			s_entry->de_flags |= INHIBIT_JOLIET_ENTRY;
-		} else if (s_entry->next) {
-			/*
-			 * if previous entry is an associated file,
-			 * then "link" it to this file i.e. we have a
-			 * data/resource pair
-			 */
-			if (s_entry->next->isorec.flags[0] & ISO_ASSOCIATED) {
-				s_entry->assoc = s_entry->next;
-				/* share the same HFS parameters */
-				s_entry->hfs_ent = s_entry->next->hfs_ent;
-				s_entry->hfs_type = s_entry->next->hfs_type;
-			}
-		}
-		/* allocate HFS entry if required */
-		if (apple_both && strcmp(short_name, ".") &&
-						strcmp(short_name, "..")) {
-			if (!s_entry->hfs_ent) {
-				hfsdirent	*hfs_ent;
-
-				hfs_ent =
-				(hfsdirent *) e_malloc(sizeof (hfsdirent));
-
-				/* fill in the defaults */
-				memset(hfs_ent, 0, sizeof (hfsdirent));
-
-				s_entry->hfs_ent = hfs_ent;
-			}
-			/*
-			 * the resource fork is processed first, but the
-			 * data fork's time info is used in preference
-			 * i.e. time info is set from the resource fork
-			 * initially, then it is set from the data fork
-			 */
-			if (have_rsrc) {
-				/* set rsrc size */
-				s_entry->hfs_ent->u.file.rsize = lstatbuf.st_size;
-				/*
-				 * this will be overwritten - but might as
-				 * well set it here ...
-				 */
-				s_entry->hfs_ent->crdate = lstatbuf.st_ctime;
-				s_entry->hfs_ent->mddate = lstatbuf.st_mtime;
-			} else {
-				/* set data size */
-				s_entry->hfs_ent->u.file.dsize = lstatbuf.st_size;
-				s_entry->hfs_ent->crdate = lstatbuf.st_ctime;
-				s_entry->hfs_ent->mddate = lstatbuf.st_mtime;
-			}
-		}
-	}
-#endif	/* APPLE_HYB */
-
-	if (strcmp(short_name, ".") == 0) {
-		this_dir->dir_flags |= DIR_HAS_DOT;
-	}
-	if (strcmp(short_name, "..") == 0) {
-		this_dir->dir_flags |= DIR_HAS_DOTDOT;
-	}
-	if (this_dir->parent &&
-	    this_dir->parent == reloc_dir &&
-	    strcmp(short_name, "..") == 0) {
-		s_entry->inode = UNCACHED_INODE;
-		s_entry->dev = (dev_t) UNCACHED_DEVICE;
-		deep_flag = NEED_PL;
-	} else
-#ifdef APPLE_HYB
-	if (have_rsrc) {
-		/* don't want rsrc files to be cached */
-		s_entry->inode = UNCACHED_INODE;
-		s_entry->dev = (dev_t) UNCACHED_DEVICE;
-	} else
-#endif	/* APPLE_HYB */
-	{
-		s_entry->inode = STAT_INODE(statbuf);
-		s_entry->dev = statbuf.st_dev;
-	}
-	set_723(s_entry->isorec.volume_sequence_number,
-						volume_sequence_number);
-	iso9660_file_length(short_name, s_entry, S_ISDIR(statbuf.st_mode));
-	s_entry->rr_attr_size = 0;
-	s_entry->total_rr_attr_size = 0;
-	s_entry->rr_attributes = NULL;
-
-	/* Directories are assigned sizes later on */
-	if (!S_ISDIR(statbuf.st_mode)) {
-		if (S_ISCHR(lstatbuf.st_mode) || S_ISBLK(lstatbuf.st_mode) ||
-			S_ISFIFO(lstatbuf.st_mode) ||
-				S_ISSOCK(lstatbuf.st_mode) ||
-				S_ISLNK(lstatbuf.st_mode)) {
-			s_entry->size = (off_t)0;
-			statbuf.st_size = (off_t)0;
-		} else {
-			s_entry->size = statbuf.st_size;
-		}
-
-		set_733((char *) s_entry->isorec.size, statbuf.st_size);
-	} else {
-		s_entry->isorec.flags[0] |= ISO_DIRECTORY;
-	}
-#ifdef APPLE_HYB
-	/* if the directory is HFS excluded, then we don't have an hfs_ent */
-	if (apple_both && s_entry->hfs_ent &&
-				(s_entry->isorec.flags[0] & ISO_DIRECTORY)) {
-		/* get the Mac directory name */
-		get_hfs_dir(whole_path, short_name, s_entry);
-
-		/* if required, set ISO directory name from HFS name */
-		if (use_mac_name)
-			iso9660_file_length(s_entry->hfs_ent->name, s_entry, 1);
-	}
-#endif	/* APPLE_HYB */
-
-	if (strcmp(short_name, ".") != 0 && strcmp(short_name, "..") != 0 &&
-		S_ISDIR(statbuf.st_mode) &&
-				this_dir->depth > RR_relocation_depth) {
-		struct directory *child;
-
-		if (!reloc_dir)
-			generate_reloc_directory();
-
-		/*
-		 * Replicate the entry for this directory.  The old one will
-		 * stay where it is, and it will be neutered so that it no
-		 * longer looks like a directory. The new one will look like
-		 * a directory, and it will be put in the reloc_dir.
-		 */
-		s_entry1 = (struct directory_entry *)
-			e_malloc(sizeof (struct directory_entry));
-		memcpy(s_entry1, s_entry, sizeof (struct directory_entry));
-		s_entry1->table = NULL;
-		s_entry1->name = strdup(this_dir->contents->name);
-		s_entry1->whole_name = strdup(this_dir->contents->whole_name);
-		s_entry1->next = reloc_dir->contents;
-		reloc_dir->contents = s_entry1;
-		s_entry1->priority = 32768;
-		s_entry1->parent_rec = this_dir->contents;
-		set_723(s_entry1->isorec.volume_sequence_number,
-						volume_sequence_number);
-
-		deep_flag = NEED_RE;
-
-		if (use_XA || use_RockRidge) {
-			generate_xa_rr_attributes(whole_path,
-				short_name, s_entry1,
-				&statbuf, &lstatbuf, deep_flag);
-		}
-		deep_flag = 0;
-
-		/*
-		 * We need to set this temporarily so that the parent to this
-		 * is correctly determined.
-		 */
-		s_entry1->filedir = reloc_dir;
-		child = find_or_create_directory(reloc_dir, whole_path,
-			s_entry1, 0);
-/*		if (!no_scandir)*/
-		if (!0)
-			scan_directory_tree(child, whole_path, s_entry1);
-		s_entry1->filedir = this_dir;
-
-		statbuf.st_size = (off_t)0;
-		statbuf.st_mode &= 0777;
-		set_733((char *) s_entry->isorec.size, 0);
-		s_entry->size = 0;
-		s_entry->isorec.flags[0] = ISO_FILE;
-		s_entry->inode = UNCACHED_INODE;
-		s_entry->de_flags |= RELOCATED_DIRECTORY;
-		deep_flag = NEED_CL;
-	}
-	if (generate_tables &&
-	    strcmp(s_entry->name, ".") != 0 &&
-	    strcmp(s_entry->name, "..") != 0) {
-
-		char	buffer[SECTOR_SIZE];
-		int	nchar;
-
-		switch (lstatbuf.st_mode & S_IFMT) {
-		case S_IFDIR:
-			sprintf(buffer, "D\t%s\n",
-				s_entry->name);
-			break;
-
-/*
- * extra for WIN32 - if it doesn't have the major/minor defined, then
- * S_IFBLK and S_IFCHR type files are unlikely to exist anyway ...
- * code similar to that in rock.c
- */
-#if 0
-/*
- * Use the device handling code from <device.h>
- */
-#ifndef major
-#define	major(dev) (sizeof (dev_t) <= 2 ? ((dev) >> 8) : \
-	(sizeof (dev_t) <= 4 ? (((dev) >> 8) >> 8) : \
-	(((dev) >> 16) >> 16)))
-#define	minor(dev) (sizeof (dev_t) <= 2 ? (dev) & 0xff : \
-	(sizeof (dev_t) <= 4 ? (dev) & 0xffff : \
-	(dev) & 0xffffffff))
-#endif
-#endif
-
-#ifdef S_IFBLK
-		case S_IFBLK:
-			sprintf(buffer, "B\t%s\t%lu %lu\n",
-				s_entry->name,
-				(unsigned long) major(statbuf.st_rdev),
-				(unsigned long) minor(statbuf.st_rdev));
-			break;
-#endif
-#ifdef S_IFIFO
-		case S_IFIFO:
-			sprintf(buffer, "P\t%s\n",
-				s_entry->name);
-			break;
-#endif
-#ifdef S_IFCHR
-		case S_IFCHR:
-			sprintf(buffer, "C\t%s\t%lu %lu\n",
-				s_entry->name,
-				(unsigned long) major(statbuf.st_rdev),
-				(unsigned long) minor(statbuf.st_rdev));
-			break;
-#endif
-#ifdef S_IFLNK
-		case S_IFLNK:
-#ifdef	HAVE_READLINK
-			nchar = readlink(whole_path,
-				(char *) symlink_buff,
-				sizeof (symlink_buff)-1);
-#else
-			nchar = -1;
-#endif
-			symlink_buff[nchar < 0 ? 0 : nchar] = 0;
-			sprintf(buffer, "L\t%s\t%s\n",
-				s_entry->name, symlink_buff);
-			break;
-#endif
-#ifdef S_IFSOCK
-		case S_IFSOCK:
-			sprintf(buffer, "S\t%s\n",
-				s_entry->name);
-			break;
-#endif
-		case S_IFREG:
-		default:
-			sprintf(buffer, "F\t%s\n",
-				s_entry->name);
-			break;
-		};
-		s_entry->table = strdup(buffer);
-	}
-	if (S_ISDIR(statbuf.st_mode)) {
-		int	dflag;
-
-		if (strcmp(short_name, ".") != 0 && strcmp(short_name, "..")
-									!= 0) {
-			struct directory *child;
-
-			child = find_or_create_directory(this_dir, whole_path,
-				s_entry, 1);
-			if (no_scandir)
-				dflag = 1;
-			else
-				dflag = scan_directory_tree(child, whole_path,
-								s_entry);
-
-			if (!dflag) {
-				lstatbuf.st_mode =
-					(lstatbuf.st_mode & ~S_IFMT) | S_IFREG;
-				if (child->contents == NULL) {
-					delete_directory(this_dir, child);
-				}
-			}
-		}
-		/* If unable to scan directory, mark this as a non-directory */
-	}
-	if (use_RockRidge && this_dir == root && strcmp(s_entry->name, ".")
-									== 0) {
-		deep_flag |= NEED_CE | NEED_SP;	/* For extension record */
-	}
-	/* Now figure out how much room this file will take in the directory */
-
-#ifdef APPLE_HYB
-	/* if the file is HFS excluded, then we don't have an hfs_ent */
-	if (apple_both && !have_rsrc && s_entry->hfs_ent) {
-		if (S_ISREG(lstatbuf.st_mode)) { /* it's a regular file */
-
-			/* fill in the rest of the HFS entry */
-			get_hfs_info(whole_path, short_name, s_entry);
-
-			/* if required, set ISO directory name from HFS name */
-			if (use_mac_name)
-				iso9660_file_length(s_entry->hfs_ent->name,
-								s_entry, 0);
-
-			/* print details about the HFS file */
-			if (verbose > 2)
-				print_hfs_info(s_entry);
-
-			/*
-			 * copy the new ISO9660 name to the rsrc fork
-			 * - if it exists
-			 */
-			if (s_entry->assoc)
-				strcpy(s_entry->assoc->isorec.name,
-							s_entry->isorec.name);
-
-			/*
-			 * we can't handle hard links in the hybrid case, so we
-			 * "uncache" the file. The downside to this is that
-			 * hard linked files are added to the output image
-			 * more than once (we've already done this for rsrc
-			 * files)
-			 */
-			if (apple_hyb) {
-				s_entry->inode = UNCACHED_INODE;
-				s_entry->dev = (dev_t) UNCACHED_DEVICE;
-			}
-		} else if (!(s_entry->isorec.flags[0] & ISO_DIRECTORY)) {
-			/* not a directory .. */
-
-			/*
-			 * no mac equivalent, so ignore - have to be careful
-			 * here, the hfs_ent may be also be for a relocated
-			 * directory
-			 */
-			if (s_entry->hfs_ent &&
-				!(s_entry->de_flags & RELOCATED_DIRECTORY))
-				free(s_entry->hfs_ent);
-			s_entry->hfs_ent = NULL;
-		}
-		/*
-		 * if the rsrc size is zero, then we don't need the entry, so
-		 * we might as well delete it - this will only happen if we
-		 * didn't know the rsrc size from the rsrc file size
-		 */
-		if (s_entry->assoc && s_entry->assoc->size == 0)
-			delete_rsrc_ent(s_entry);
-	}
-	if (apple_ext && s_entry->assoc) {
-		/* need Apple extensions for the resource fork as well */
-		generate_xa_rr_attributes(whole_path,
-			short_name, s_entry->assoc,
-			&statbuf, &lstatbuf, deep_flag);
-	}
-	/* leave out resource fork for the time being */
-	/*
-	 * XXX This is most likely wrong and should just be:
-	 * XXX if (use_XA || use_RockRidge) {
-	 */
-/*	if ((use_XA || use_RockRidge) && !have_rsrc) {*/
-	if (use_XA || use_RockRidge) {
-#else
-	if (use_XA || use_RockRidge) {
-#endif	/* APPLE_HYB */
-		generate_xa_rr_attributes(whole_path,
-			short_name, s_entry,
-			&statbuf, &lstatbuf, deep_flag);
-
-	}
-	return (1);
-}
-
-
-void
-generate_iso9660_directories(struct directory *node, FILE *outfile)
-{
-	struct directory *dpnt;
-
-	dpnt = node;
-
-	while (dpnt) {
-		if (dpnt->extent > session_start) {
-			generate_one_directory(dpnt, outfile);
-		}
-		if (dpnt->subdir)
-			generate_iso9660_directories(dpnt->subdir, outfile);
-		dpnt = dpnt->next;
-	}
-}
-
-/*
- * Function:	find_or_create_directory
- *
- * Purpose:	Locate a directory entry in the tree, create if needed.
- *
- * Arguments:	parent & de are never NULL at the same time.
- */
-struct directory *
-find_or_create_directory(struct directory *parent, const char *path, 
-								 struct directory_entry *de, int flag)
-{
-	struct directory *dpnt;
-	struct directory_entry *orig_de;
-	struct directory *next_brother;
-	const char	*cpnt;
-	const char	*pnt;
-
-	orig_de = de;
-
-	/*
-	 * XXX It seems that the tree that has been read from the
-	 * XXX previous session does not carry whole_name entries.
-	 * XXX We provide a hack in multi.c:find_or_create_directory()
-	 * XXX that should be removed when a reasonable method could
-	 * XXX be found.
-	 */
-	if (path == NULL) {
-		fprintf(stderr, "Warning: missing whole name for: '%s'\n", de->name);
-		path = de->name;
-	}
-	pnt = strrchr(path, PATH_SEPARATOR);
-	if (pnt == NULL) {
-		pnt = path;
-	} else {
-		pnt++;
-	}
-
-	if (parent != NULL) {
-		dpnt = parent->subdir;
-
-		while (dpnt) {
-			/*
-			 * Weird hack time - if there are two directories by
-			 * the same name in the reloc_dir, they are not
-			 * treated as the same thing unless the entire path
-			 * matches completely.
-			 */
-			if (flag && strcmp(dpnt->de_name, pnt) == 0) {
-				return (dpnt);
-			}
-			dpnt = dpnt->next;
-		}
-	}
-	/*
-	 * We don't know if we have a valid directory entry for this one yet.
-	 * If not, we need to create one.
-	 */
-	if (de == NULL) {
-		de = (struct directory_entry *)
-			e_malloc(sizeof (struct directory_entry));
-		memset(de, 0, sizeof (struct directory_entry));
-		de->next = parent->contents;
-		parent->contents = de;
-		de->name = strdup(pnt);
-		de->whole_name = strdup(path);
-		de->filedir = parent;
-		de->isorec.flags[0] = ISO_DIRECTORY;
-		de->priority = 32768;
-		de->inode = UNCACHED_INODE;
-		de->dev = (dev_t) UNCACHED_DEVICE;
-		set_723(de->isorec.volume_sequence_number,
-						volume_sequence_number);
-		iso9660_file_length(pnt, de, 1);
-
-		init_fstatbuf();
-		/*
-		 * It doesn't exist for real, so we cannot add any
-		 * XA or Rock Ridge attributes.
-		 */
-		if (use_XA || use_RockRidge) {
-			fstatbuf.st_mode = new_dir_mode | S_IFDIR;
-			fstatbuf.st_nlink = 2;
-			generate_xa_rr_attributes("",
-				(char *) pnt, de,
-				&fstatbuf,
-				&fstatbuf, 0);
-		}
-		iso9660_date(de->isorec.date, fstatbuf.st_mtime);
-#ifdef APPLE_HYB
-		if (apple_both) {
-			/* give the directory an HFS entry */
-			hfsdirent	*hfs_ent;
-
-			hfs_ent = (hfsdirent *) e_malloc(sizeof (hfsdirent));
-
-			/* fill in the defaults */
-			memset(hfs_ent, 0, sizeof (hfsdirent));
-			hfs_ent->crdate = fstatbuf.st_ctime;
-			hfs_ent->mddate = fstatbuf.st_mtime;
-
-			de->hfs_ent = hfs_ent;
-
-			/* get the Mac directory name */
-			get_hfs_dir((char *) path, (char *) pnt, de);
-		}
-#endif	/* APPLE_HYB */
-	}
-	/*
-	 * If we don't have a directory for this one yet, then allocate it now,
-	 * and patch it into the tree in the appropriate place.
-	 */
-	dpnt = (struct directory *) e_malloc(sizeof (struct directory));
-	memset(dpnt, 0, sizeof (struct directory));
-	dpnt->next = NULL;
-	dpnt->subdir = NULL;
-	dpnt->self = de;
-	dpnt->contents = NULL;
-	dpnt->whole_name = strdup(path);
-	cpnt = strrchr(path, PATH_SEPARATOR);
-	if (cpnt)
-		cpnt++;
-	else
-		cpnt = path;
-	dpnt->de_name = strdup(cpnt);
-	dpnt->size = 0;
-	dpnt->extent = 0;
-	dpnt->jextent = 0;
-	dpnt->jsize = 0;
-#ifdef APPLE_HYB
-	dpnt->hfs_ent = de->hfs_ent;
-#endif	/* APPLE_HYB */
-
-	if (orig_de == NULL) {
-		struct stat	xstatbuf;
-		int		sts;
-
-		/*
-		 * Now add a . and .. entry in the directory itself. This is a
-		 * little tricky - if the real directory exists, we need to
-		 * stat it first. Otherwise, we use the fictitious fstatbuf
-		 * which points to the time at which mkisoimage was started.
-		 */
-		if (parent == NULL || parent->whole_name[0] == '\0')
-			sts = -1;
-		else
-			sts = stat_filter(parent->whole_name, &xstatbuf);
-		if (debug && parent) {
-			fprintf(stderr, "stat parent->whole_name: '%s' -> %d.\n",
-				parent->whole_name, sts);
-		}
-		if (sts == 0) {
-			attach_dot_entries(dpnt, &xstatbuf);
-		} else {
-			attach_dot_entries(dpnt, &fstatbuf);
-		}
-	}
-	if (!parent || parent == root) {
-		if (!root) {
-			root = dpnt;	/* First time through for root	*/
-					/* directory only		*/
-			root->depth = 0;
-			root->parent = root;
-		} else {
-			dpnt->depth = 1;
-			if (!root->subdir) {
-				root->subdir = dpnt;
-			} else {
-				next_brother = root->subdir;
-				while (next_brother->next)
-					next_brother = next_brother->next;
-				next_brother->next = dpnt;
-			}
-			dpnt->parent = parent;
-		}
-	} else {
-		/* Come through here for  normal traversal of  tree */
-#ifdef DEBUG
-		fprintf(stderr, "%s(%d) ", path, dpnt->depth);
-#endif
-		if (parent->depth > RR_relocation_depth) {
-			/*
-			 * XXX to prevent this, we would need to add
-			 * XXX support for RR directory relocation
-			 * XXX to find_or_create_directory()
-			 */
-#ifdef	USE_LIBSCHILY
-			comerrno(EX_BAD,
-			"Directories too deep for '%s' (%d) max is %d.\n",
-				path, parent->depth, RR_relocation_depth);
-#else
-			fprintf(stderr,
-			"Directories too deep for '%s' (%d) max is %d.\n",
-				path, parent->depth, RR_relocation_depth);
-			exit(1);
-#endif
-		}
-		dpnt->parent = parent;
-		dpnt->depth = parent->depth + 1;
-
-		if (!parent->subdir) {
-			parent->subdir = dpnt;
-		} else {
-			next_brother = parent->subdir;
-			while (next_brother->next)
-				next_brother = next_brother->next;
-			next_brother->next = dpnt;
-		}
-	}
-
-	return (dpnt);
-}
-
-/*
- * Function:	delete_directory
- *
- * Purpose:	Locate a directory entry in the tree, create if needed.
- *
- * Arguments:
- */
-static void
-delete_directory(parent, child)
-	struct directory	*parent;
-	struct directory	*child;
-{
-	struct directory *tdir;
-
-	if (child->contents != NULL) {
-#ifdef	USE_LIBSCHILY
-		comerrno(EX_BAD, "Unable to delete non-empty directory\n");
-#else
-		fprintf(stderr, "Unable to delete non-empty directory\n");
-		exit(1);
-#endif
-	}
-	free(child->whole_name);
-	child->whole_name = NULL;
-
-	free(child->de_name);
-	child->de_name = NULL;
-
-#ifdef APPLE_HYB
-	if (apple_both && child->hfs_ent)
-		free(child->hfs_ent);
-#endif	/* APPLE_HYB */
-
-	if (parent->subdir == child) {
-		parent->subdir = child->next;
-	} else {
-		for (tdir = parent->subdir; tdir->next != NULL;
-							tdir = tdir->next) {
-			if (tdir->next == child) {
-				tdir->next = child->next;
-				break;
-			}
-		}
-		if (tdir == NULL) {
-#ifdef	USE_LIBSCHILY
-			comerrno(EX_BAD,
-			"Unable to locate child directory in parent list\n");
-#else
-			fprintf(stderr,
-			"Unable to locate child directory in parent list\n");
-			exit(1);
-#endif
-		}
-	}
-	free(child);
-}
-
-int
-sort_tree(struct directory *node)
-{
-	struct directory *dpnt;
-	int		ret = 0;
-
-	dpnt = node;
-
-	while (dpnt) {
-		ret = sort_n_finish(dpnt);
-		if (ret) {
-			break;
-		}
-		if (dpnt->subdir)
-			sort_tree(dpnt->subdir);
-		dpnt = dpnt->next;
-	}
-	return (ret);
-}
-
-void
-dump_tree(struct directory *node)
-{
-	struct directory *dpnt;
-
-	dpnt = node;
-
-	while (dpnt) {
-		fprintf(stderr, "%4d %5d %s\n",
-				dpnt->extent, dpnt->size, dpnt->de_name);
-		if (dpnt->subdir)
-			dump_tree(dpnt->subdir);
-		dpnt = dpnt->next;
-	}
-}
-
-void
-update_nlink_field(struct directory *node)
-{
-	struct directory *dpnt;
-	struct directory *xpnt;
-	struct directory_entry *s_entry;
-	int		i;
-
-	dpnt = node;
-
-	while (dpnt) {
-		if (dpnt->dir_flags & INHIBIT_ISO9660_ENTRY) {
-			dpnt = dpnt->next;
-			continue;
-		}
-		/*
-		 * First, count up the number of subdirectories this guy has.
-		 */
-		for (i = 0, xpnt = dpnt->subdir; xpnt; xpnt = xpnt->next)
-			if ((xpnt->dir_flags & INHIBIT_ISO9660_ENTRY) == 0)
-				i++;
-		/*
-		 * Next check to see if we have any relocated directories in
-		 * this directory. The nlink field will include these as
-		 * real directories when they are properly relocated.
-		 * In the non-rockridge disk, the relocated entries appear as
-		 * zero length files.
-		 */
-		for (s_entry = dpnt->contents; s_entry;
-						s_entry = s_entry->next) {
-			if ((s_entry->de_flags & RELOCATED_DIRECTORY) != 0 &&
-				(s_entry->de_flags & INHIBIT_ISO9660_ENTRY) ==
-									0) {
-				i++;
-			}
-		}
-		/* Now update the field in the Rock Ridge entry. */
-		update_nlink(dpnt->self, i + 2);
-
-		/* Update the '.' entry for this directory. */
-		update_nlink(dpnt->contents, i + 2);
-
-		/* Update all of the '..' entries that point to this guy. */
-		for (xpnt = dpnt->subdir; xpnt; xpnt = xpnt->next)
-			update_nlink(xpnt->contents->next, i + 2);
-
-		if (dpnt->subdir)
-			update_nlink_field(dpnt->subdir);
-		dpnt = dpnt->next;
-	}
-}
-
-/*
- * something quick and dirty to locate a file given a path
- * recursively walks down path in filename until it finds the
- * directory entry for the desired file
- */
-struct directory_entry *
-search_tree_file(struct directory *node, char *filename)
-{
-	struct directory_entry *depnt;
-	struct directory *dpnt;
-	char		*p1;
-	char		*rest;
-	char		*subdir;
-
-	/* strip off next directory name from filename */
-	subdir = strdup(filename);
-
-	if ((p1 = strchr(subdir, '/')) == subdir) {
-		fprintf(stderr,
-		"call to search_tree_file with an absolute path, stripping\n");
-		fprintf(stderr,
-		"initial path separator. Hope this was intended...\n");
-		memmove(subdir, subdir + 1, strlen(subdir) - 1);
-		p1 = strchr(subdir, '/');
-	}
-	/* do we need to find a subdirectory */
-	if (p1) {
-		*p1 = '\0';
-
-#ifdef DEBUG_TORITO
-		fprintf(stderr, "Looking for subdir called %s\n", p1);
-#endif
-
-		rest = p1 + 1;
-
-#ifdef DEBUG_TORITO
-		fprintf(stderr, "Remainder of path name is now %s\n", rest);
-#endif
-
-		dpnt = node->subdir;
-		while (dpnt) {
-#ifdef DEBUG_TORITO
-			fprintf(stderr,
-				"%4d %5d %s\n", dpnt->extent, dpnt->size,
-				dpnt->de_name);
-#endif
-			if (strcmp(subdir, dpnt->de_name) == 0) {
-#ifdef DEBUG_TORITO
-				fprintf(stderr,
-				"Calling next level with filename = %s", rest);
-#endif
-				return (search_tree_file(dpnt, rest));
-			}
-			dpnt = dpnt->next;
-		}
-
-		/* if we got here means we couldnt find the subdir */
-		return (NULL);
-	} else {
-		/* look for a normal file now */
-		depnt = node->contents;
-		while (depnt) {
-#ifdef DEBUG_TORITO
-			fprintf(stderr, "%4d %5d %s\n", depnt->isorec.extent,
-				depnt->size, depnt->name);
-#endif
-			if (strcmp(filename, depnt->name) == 0) {
-#ifdef DEBUG_TORITO
-				fprintf(stderr, "Found our file %s", filename);
-#endif
-				return (depnt);
-			}
-			depnt = depnt->next;
-		}
-		/* if we got here means we couldnt find the subdir */
-		return (NULL);
-	}
-#ifdef	ERIC_FUN
-	fprintf(stderr, "We cant get here in search_tree_file :-/ \n");
-#endif
-}
-
-void
-init_fstatbuf()
-{
-	time_t	current_time;
-
-	if (fstatbuf.st_ctime == 0) {
-		time(&current_time);
-		if (rationalize_uid)
-			fstatbuf.st_uid = uid_to_use;
-		else
-			fstatbuf.st_uid = getuid();
-		if (rationalize_gid)
-			fstatbuf.st_gid = gid_to_use;
-		else
-			fstatbuf.st_gid = getgid();
-		fstatbuf.st_ctime = current_time;
-		fstatbuf.st_mtime = current_time;
-		fstatbuf.st_atime = current_time;
-	}
-}

Copied: cdrkit/trunk/genisoimage/tree.c (from rev 452, cdrkit/trunk/mkisoimage/tree.c)

Deleted: cdrkit/trunk/genisoimage/udf.c
===================================================================
--- cdrkit/trunk/mkisoimage/udf.c	2006-11-23 21:37:32 UTC (rev 450)
+++ cdrkit/trunk/genisoimage/udf.c	2006-11-23 22:11:41 UTC (rev 453)
@@ -1,1224 +0,0 @@
-/*
- * This file has been modified for the cdrkit suite.
- *
- * The behaviour and appearence of the program code below can differ to a major
- * extent from the version distributed by the original author(s).
- *
- * For details, see Changelog file distributed with the cdrkit package. If you
- * received this file from another source then ask the distributing person for
- * a log of modifications.
- *
- */
-
-/* @(#)udf.c	1.14 04/04/15 Copyright 2001 J. Schilling */
-#ifndef lint
-static	char sccsid[] =
-	"@(#)udf.c	1.14 04/04/15 Copyright 2001 J. Schilling";
-#endif
-/*
- * udf.c - UDF support for mkisoimage
- *
- * Written by Ben Rudiak-Gould (2001).
- *
- * Copyright 2001 J. Schilling.
- */
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; see the file COPYING.  If not, write to the Free Software
- * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-/*
- * Some remaining issues:
- *
- * - Do not forget to edit joliet.c and remove the VIDEO_TS lines after
- *   we did implement a decent own file name handling for UDF.
- *
- * - UDF supports UNIX-style file permissions and uid/gid, but currently
- *   this code just sets them to default values and ignores their Rock
- *   Ridge counterparts. This would be easy to fix.
- *
- * - There's no support for symlinks, Mac type/creator, or Mac resource
- *   forks. Hard links and followed symlinks may work, but if so, it's
- *   only by accident.
- *
- * - The file system mirrors the Joliet file system, so files excluded
- *   from Joliet will also be excluded from UDF, the -jcharset option
- *   also applies to UDF, file names too long for Joliet will also be
- *   truncated on UDF, and characters not allowed by Joliet will also
- *   be translated on UDF. (Fortunately, Joliet is pretty lenient.)
- *
- * - convert_to_unicode is always called with in_nls, not hfs_nls. This
- *   may lead to incorrect name conversion sometimes when using a Mac
- *   filesystem. See joliet.c for an example of what's supposed to be
- *   done.
- *
- * - DVD-Video discs are supposed to have Copyright Management Information
- *   in both the ISO and UDF filesystems. This is not implemented in ISO,
- *   and the code to do it in UDF is currently #ifdef'd out. I'm not sure
- *   whether discs without this information are actually DVD-Video
- *   compliant. The Copyright Management Information is described in ECMA
- *   Technical Report TR/71.
- *
- * - Most of the space before sector 256 on the disc (~480K) is wasted,
- *   because UDF Bridge requires a pointer block at sector 256. ISO 9660
- *   structures could be moved below sector 256 if they're small enough, but
- *   this would be ugly to implement since it breaks the output_fragment
- *   abstraction.
- *
- * - Each file must have a File Entry, and each File Entry seems to
- *   require its own 2K sector. As a result, there is an overhead of more
- *   than 2K *per file* when using UDF. I couldn't see any way to avoid
- *   this.
- *
- * - Read performance would probably be improved by placing the File Entry
- *   for each file just before the file itself, instead of at the beginning
- *   of the disc. But this would not work for DVD-Video files, which have
- *   to be stored contiguously. So there would have to be an override
- *   mechanism to handle this case. I don't know if it's worth the trouble.
- */
-
-#ifdef UDF
-
-#include "config.h"
-#include "mkisoimage.h"
-#include <timedefs.h>
-#include <schily.h>
-
-#include "udf.h"
-#include "udf_fs.h"
-
-extern	int	use_sparcboot;
-
-extern struct directory *root;
-extern time_t		begun;
-
-static unsigned lba_main_seq;
-static unsigned lba_main_seq_copy;
-static unsigned lba_integ_seq;
-static unsigned lba_udf_partition_start;
-static unsigned lba_last_file_entry;
-static unsigned lba_end_anchor_vol_desc;
-
-static unsigned num_udf_files;
-static unsigned num_udf_directories;
-
-static unsigned volume_set_id[2];
-
-#define	UDF_MAIN_SEQ_LENGTH (16)
-#define	UDF_INTEG_SEQ_LENGTH (2)
-
-/* only works for granularity a power of 2! */
-#define	PAD(val, granularity)	(((val)+(granularity)-1)&~((granularity)-1))
-
-#define	read_733(field) ((0[field]&255)+(1[field]&255)*256+(2[field]&255)*65536+(3[field]&255)*16777216)
-
-
-/**************** SIZE ****************/
-
-static int set_file_ident_desc(unsigned char *, unsigned, char *, int, 
-										 unsigned, unsigned);
-
-static unsigned
-directory_size(struct directory *dpnt)
-{
-	unsigned size_in_bytes;
-	struct directory_entry *de;
-	Uchar dummy_buf[SECTOR_SIZE];
-
-	/* parent directory */
-	size_in_bytes = set_file_ident_desc(dummy_buf, 0, 0, 0, 0, 0);
-
-	/* directory contents */
-	for (de = dpnt->jcontents; de; de = de->jnext) {
-		if (!(de->de_flags & INHIBIT_JOLIET_ENTRY)) {
-			char *name = USE_MAC_NAME(de) ? de->hfs_ent->name : de->name;
-			/* skip . and .. */
-			if (name[0] == '.' && (name[1] == 0 || (name[1] == '.' && name[2] == 0)))
-				continue;
-			size_in_bytes += set_file_ident_desc(dummy_buf, 0, name, 0, 0, 0);
-		}
-	}
-	return (size_in_bytes);
-}
-
-static void
-assign_udf_directory_addresses(struct directory *dpnt)
-{
-	if (!(dpnt->dir_flags & INHIBIT_JOLIET_ENTRY)) {
-		dpnt->self->udf_file_entry_sector = last_extent;
-		last_extent += 1 + ISO_BLOCKS(directory_size(dpnt));
-		++num_udf_directories;
-	}
-	if (!(dpnt->dir_flags & INHIBIT_JOLIET_ENTRY) || dpnt == reloc_dir) {
-		for (dpnt = dpnt->subdir; dpnt; dpnt = dpnt->next) {
-			assign_udf_directory_addresses(dpnt);
-		}
-	}
-}
-
-static void
-assign_udf_file_entry_addresses(struct directory *dpnt)
-{
-	if (!(dpnt->dir_flags & INHIBIT_JOLIET_ENTRY)) {
-		struct directory_entry *de;
-		for (de = dpnt->jcontents; de; de = de->jnext) {
-			if (!(de->de_flags & RELOCATED_DIRECTORY) &&
-			    !(de->isorec.flags[0] & ISO_DIRECTORY)) {
-				de->udf_file_entry_sector = last_extent++;
-				++num_udf_files;
-			}
-		}
-	}
-	if (!(dpnt->dir_flags & INHIBIT_JOLIET_ENTRY) || dpnt == reloc_dir) {
-		for (dpnt = dpnt->subdir; dpnt; dpnt = dpnt->next) {
-			assign_udf_file_entry_addresses(dpnt);
-		}
-	}
-}
-
-/****************************/
-
-static int
-udf_vol_recognition_area_size(int starting_extent)
-{
-	last_extent = starting_extent+3;
-	return (0);
-}
-
-static int
-udf_main_seq_size(int starting_extent)
-{
-	lba_main_seq = starting_extent;
-	last_extent = starting_extent + UDF_MAIN_SEQ_LENGTH;
-	return (0);
-}
-
-static int
-udf_main_seq_copy_size(int starting_extent)
-{
-	lba_main_seq_copy = starting_extent;
-	last_extent = starting_extent + UDF_MAIN_SEQ_LENGTH;
-	return (0);
-}
-
-static int
-udf_integ_seq_size(int starting_extent)
-{
-	lba_integ_seq = starting_extent;
-	last_extent = starting_extent + UDF_INTEG_SEQ_LENGTH;
-	return (0);
-}
-
-static int
-udf_end_anchor_vol_desc_size(int starting_extent)
-{
-	lba_end_anchor_vol_desc = starting_extent;
-	last_extent = starting_extent+1;
-	return (0);
-}
-
-static int
-udf_file_set_desc_size(int starting_extent)
-{
-	lba_udf_partition_start = starting_extent;
-	last_extent = starting_extent+2;
-	return (0);
-}
-
-static int
-udf_dirtree_size(int starting_extent)
-{
-	num_udf_directories = 0;
-	assign_udf_directory_addresses(root);
-	return (0);
-}
-
-static int
-udf_file_entries_size(int starting_extent)
-{
-	num_udf_files = 0;
-	assign_udf_file_entry_addresses(root);
-	lba_last_file_entry = last_extent-1;
-	return (0);
-}
-
-static int
-udf_pad_to_sector_32_size(int starting_extent)
-{
-	if (last_extent < session_start+32)
-		last_extent = session_start+32;
-	return (0);
-}
-
-static int
-udf_pad_to_sector_256_size(int starting_extent)
-{
-	if (last_extent < session_start+256)
-		last_extent = session_start+256;
-	return (0);
-}
-
-static int
-udf_padend_avdp_size(int starting_extent)
-{
-	lba_end_anchor_vol_desc = starting_extent;
-
-	/* add at least 16 and at most 31 sectors, ending at a mult. of 16 */
-	last_extent = (starting_extent+31) & ~15;
-	if (!use_sparcboot)
-		last_extent = starting_extent + 150;
-	return (0);
-}
-
-extern int oneblock_size(int);
-
-/**************** WRITE ****************/
-
-static unsigned
-crc_ccitt(unsigned char *buf, unsigned len)
-{
-	const unsigned poly = 0x11021;
-	static unsigned short lookup[256];
-	unsigned int r;
-	unsigned int i;
-
-	if (lookup[1] == 0) {
-		unsigned int j, k;
-		for (j = 0; j < 256; ++j) {
-			unsigned int temp = j << 8;
-			for (k = 0; k < 8; ++k) {
-				unsigned int hibit = temp & 32768;
-				temp <<= 1;
-				if (hibit)
-					temp ^= poly;
-			}
-			lookup[j] = temp;
-		}
-	}
-
-	r = 0;
-	for (i = 0; i < len; ++i) {
-		r = (r << 8) ^ lookup[((r >> 8) ^ buf[i]) & 255];
-	}
-
-	return (r & 65535);
-}
-
-#define	set8(dst, src)	do { *(dst) = (src); } while (0)
-
-static void
-set16(udf_Uint16 *dst, unsigned int src)
-{
-	dst->l = (char)(src);
-	dst->h = (char)(src>>8);
-}
-
-static void
-set32(udf_Uint32 *dst, unsigned src)
-{
-	dst->l  = (char)(src);
-	dst->ml = (char)(src>>8);
-	dst->mh = (char)(src>>16);
-	dst->h  = (char)(src>>24);
-}
-
-static void
-set64(udf_Uint64 *dst, unsigned src)
-{
-	set32(&dst->l, src);
-	/*
-	 * src>>32 actually does the wrong thing on x86 with at least
-	 * one compiler, because of x86's shift count masking. Since
-	 * we never pass more than 32 sig. bits to the function anyway,
-	 * and all the structures we fill in are zeroed beforehand,
-	 * just skip setting the high word.
-	 */
-	/*set32(&dst->h, src>>32);*/
-}
-
-static int
-set_ostaunicode(unsigned char *dst, int dst_size, char *src)
-{
-	unsigned char buf[1024];
-	int i;
-	int expanded_length;
-
-	expanded_length = joliet_strlen(src, in_nls);
-	if (expanded_length > 1024)
-		expanded_length = 1024;
-	if (expanded_length > (dst_size-1)*2)
-		expanded_length = (dst_size-1)*2;
-
-	convert_to_unicode(buf, expanded_length, src, in_nls);
-	dst[0] = 8;	/* use 8-bit representation by default */
-	for (i = 0; i < (expanded_length>>1); ++i) {
-		dst[i + 1] = buf[i*2+1];
-		if (buf[i*2] != 0) {
-			/*
-			 * There's a Unicode character with value >=256.
-			 * Use 16-bit representation instead.
-			 */
-			int length_to_copy = (dst_size-1) & ~1;
-			if (length_to_copy > expanded_length)
-				length_to_copy = expanded_length;
-			dst[0] = 16;
-			memcpy(dst+1, buf, length_to_copy);
-			return (length_to_copy + 1);
-		}
-	}
-	return ((expanded_length>>1) + 1);
-}
-
-static void
-set_extent(udf_extent_ad *ext, unsigned lba, unsigned length_bytes)
-{
-	set32(&ext->extent_length, length_bytes);
-	set32(&ext->extent_location, lba);
-}
-
-static void
-set_dstring(udf_dstring *dst, char *src, int n)
-{
-	dst[n-1] = set_ostaunicode((Uchar *)dst, n-1, src);
-}
-
-static void
-set_charspec(udf_charspec *dst)
-{
-	/*set8(&dst->character_set_type, 0);*/
-	memcpy(dst->character_set_info, "OSTA Compressed Unicode", 23);
-}
-
-static void
-set_impl_ident(udf_EntityID *ent)
-{
-	strcpy((char *)ent->ident, "*mkisoimage");
-}
-
-static void
-set_tag(udf_tag *t, unsigned tid, unsigned lba, int crc_length)
-{
-	unsigned char checksum;
-	int i;
-
-	set16(&t->tag_ident, tid);
-	set16(&t->desc_version, 2);
-	set16(&t->desc_crc, crc_ccitt((unsigned char *)t+16, crc_length-16));
-	set16(&t->desc_crc_length, crc_length-16);
-	set32(&t->tag_location, lba);
-	set8(&t->tag_checksum, 0);
-	checksum = 0;
-	for (i = 0; i < 16; ++i)
-		checksum += ((unsigned char *)t)[i];
-	set8(&t->tag_checksum, checksum);
-}
-
-static void
-set_timestamp_from_iso_date(udf_timestamp *ts, const char *iso_date_raw)
-{
-	struct {
-		unsigned char years_since_1900;
-		unsigned char month, day;
-		unsigned char hour, minute, second;
-		signed char offset_from_gmt;
-	} *iso_date = (void *)iso_date_raw;
-
-	set16(&ts->type_and_time_zone,
-		4096 + ((iso_date->offset_from_gmt * 15) & 4095));
-	set16(&ts->year, 1900 + iso_date->years_since_1900);
-	set8(&ts->month, iso_date->month);
-	set8(&ts->day, iso_date->day);
-	set8(&ts->hour, iso_date->hour);
-	set8(&ts->minute, iso_date->minute);
-	set8(&ts->second, iso_date->second);
-	/*set8(&ts->centiseconds, 0);*/
-	/*set8(&ts->hundreds_of_microseconds, 0);*/
-	/*set8(&ts->microseconds, 0);*/
-}
-
-static void
-set_timestamp_from_time_t(udf_timestamp *ts, time_t t)
-{
-	char iso_date[7];
-	iso9660_date(iso_date, t);
-	set_timestamp_from_iso_date(ts, iso_date);
-}
-
-
-static void
-set_anchor_volume_desc_pointer(unsigned char *buf, unsigned lba)
-{
-	udf_anchor_volume_desc_ptr *avdp = (udf_anchor_volume_desc_ptr *)buf;
-	set_extent(&avdp->main_volume_desc_seq_extent,
-		lba_main_seq, SECTOR_SIZE*UDF_MAIN_SEQ_LENGTH);
-	set_extent(&avdp->reserve_volume_desc_seq_extent,
-		lba_main_seq_copy, SECTOR_SIZE*UDF_MAIN_SEQ_LENGTH);
-	set_tag(&avdp->desc_tag, UDF_TAGID_ANCHOR_VOLUME_DESC_PTR, lba, 512);
-}
-
-static void
-set_primary_vol_desc(unsigned char *buf, unsigned lba)
-{
-	char temp[17];
-
-	udf_primary_volume_desc *pvd = (udf_primary_volume_desc *)buf;
-	/*set32(&pvd->volume_desc_seq_number, 0);*/
-	/*set32(&pvd->primary_volume_desc_number, 0);*/
-	set_dstring(pvd->volume_ident, volume_id, sizeof (pvd->volume_ident));
-	set16(&pvd->volume_seq_number, 1);
-	set16(&pvd->maximum_volume_seq_number, 1);
-	set16(&pvd->interchange_level, 2);
-	set16(&pvd->maximum_interchange_level, 2);
-	set32(&pvd->character_set_list, 1);
-	set32(&pvd->maximum_character_set_list, 1);
-	sprintf(temp, "%08X%08X", volume_set_id[0], volume_set_id[1]);
-	set_dstring(pvd->volume_set_ident, temp,
-					sizeof (pvd->volume_set_ident));
-	set_charspec(&pvd->desc_character_set);
-	set_charspec(&pvd->explanatory_character_set);
-	/*pvd->volume_abstract;*/
-	/*pvd->volume_copyright_notice;*/
-	/*pvd->application_ident;*/
-	set_timestamp_from_time_t(&pvd->recording_date_and_time, begun);
-	set_impl_ident(&pvd->impl_ident);
-	set_tag(&pvd->desc_tag, UDF_TAGID_PRIMARY_VOLUME_DESC, lba, 512);
-}
-
-static void
-set_impl_use_vol_desc(unsigned char *buf, unsigned lba)
-{
-	udf_impl_use_volume_desc *iuvd = (udf_impl_use_volume_desc *)buf;
-	set32(&iuvd->volume_desc_seq_number, 1);
-	strcpy((char *)iuvd->impl_ident.ident, "*UDF LV Info");
-	iuvd->impl_ident.ident_suffix[0] = 2;
-	iuvd->impl_ident.ident_suffix[1] = 1;
-	set_charspec(&iuvd->impl_use.lvi_charset);
-	set_dstring(iuvd->impl_use.logical_volume_ident, volume_id,
-		sizeof (iuvd->impl_use.logical_volume_ident));
-	/*set_dstring(iuvd->impl_use.lv_info1, "", sizeof (iuvd->impl_use.lv_info1));*/
-	/*set_dstring(iuvd->impl_use.lv_info2, "", sizeof (iuvd->impl_use.lv_info2));*/
-	/*set_dstring(iuvd->impl_use.lv_info3, "", sizeof (iuvd->impl_use.lv_info3));*/
-	set_impl_ident(&iuvd->impl_use.impl_id);
-	set_tag(&iuvd->desc_tag, UDF_TAGID_IMPL_USE_VOLUME_DESC, lba, 512);
-}
-
-static void
-set_partition_desc(unsigned char *buf, unsigned lba)
-{
-	udf_partition_desc *pd = (udf_partition_desc *)buf;
-	set32(&pd->volume_desc_seq_number, 2);
-	set16(&pd->partition_flags, UDF_PARTITION_FLAG_ALLOCATED);
-	/*set16(&pd->partition_number, 0);*/
-	set8(&pd->partition_contents.flags, UDF_ENTITYID_FLAG_PROTECTED);	/*???*/
-	strcpy((char *)pd->partition_contents.ident, "+NSR02");
-	set32(&pd->access_type, UDF_ACCESSTYPE_READONLY);
-	set32(&pd->partition_starting_location, lba_udf_partition_start);
-	set32(&pd->partition_length,
-			lba_end_anchor_vol_desc - lba_udf_partition_start);
-	set_impl_ident(&pd->impl_ident);
-	set_tag(&pd->desc_tag, UDF_TAGID_PARTITION_DESC, lba, 512);
-}
-
-static void
-set_domain_ident(udf_EntityID *ent)
-{
-	strcpy((char *)ent->ident, "*OSTA UDF Compliant");
-	memcpy(ent->ident_suffix, "\002\001\003", 3);
-}
-
-static void
-set_logical_vol_desc(unsigned char *buf, unsigned lba)
-{
-	udf_logical_volume_desc *lvd = (udf_logical_volume_desc *)buf;
-	set32(&lvd->volume_desc_seq_number, 3);
-	set_charspec(&lvd->desc_character_set);
-	set_dstring(lvd->logical_volume_ident, volume_id,
-					sizeof (lvd->logical_volume_ident));
-	set32(&lvd->logical_block_size, SECTOR_SIZE);
-	set_domain_ident(&lvd->domain_ident);
-	set32(&lvd->logical_volume_contents_use.extent_length, 2*SECTOR_SIZE);
-	/*set32(&lvd->logical_volume_contents_use.extent_location.logical_block_number, 0);*/
-	/*set16(&lvd->logical_volume_contents_use.extent_location.partition_reference_number, 0);*/
-	set32(&lvd->map_table_length, 6);
-	set32(&lvd->number_of_partition_maps, 1);
-	set_impl_ident(&lvd->impl_ident);
-	set_extent(&lvd->integrity_seq_extent, lba_integ_seq,
-					SECTOR_SIZE*UDF_INTEG_SEQ_LENGTH);
-	set8(&lvd->partition_map[0].partition_map_type,
-					UDF_PARTITION_MAP_TYPE_1);
-	set8(&lvd->partition_map[0].partition_map_length, 6);
-	set16(&lvd->partition_map[0].volume_seq_number, 1);
-	/*set16(&lvd->partition_map[0].partition_number, 0);*/
-	set_tag(&lvd->desc_tag, UDF_TAGID_LOGICAL_VOLUME_DESC, lba, 446);
-}
-
-static void
-set_unallocated_space_desc(unsigned char *buf, unsigned lba)
-{
-	udf_unallocated_space_desc *usd = (udf_unallocated_space_desc *)buf;
-	set32(&usd->volume_desc_seq_number, 4);
-	/*set32(&usd->number_of_allocation_descs, 0);*/
-	set_tag(&usd->desc_tag, UDF_TAGID_UNALLOCATED_SPACE_DESC, lba, 24);
-}
-
-static void
-set_terminating_desc(unsigned char *buf, unsigned lba)
-{
-	udf_terminating_desc *td = (udf_terminating_desc *)buf;
-	set_tag(&td->desc_tag, UDF_TAGID_TERMINATING_DESC, lba, 512);
-}
-
-static void
-set_logical_vol_integrity_desc(unsigned char *buf, unsigned lba)
-{
-	udf_logical_volume_integrity_desc *lvid =
-				(udf_logical_volume_integrity_desc *)buf;
-
-	set_timestamp_from_time_t(&lvid->recording_date, begun);
-	set32(&lvid->integrity_type, UDF_INTEGRITY_TYPE_CLOSE);
-	/*lvid->next_integrity_extent;*/
-	set64(&lvid->logical_volume_contents_use.unique_id,
-						lba_last_file_entry+1);
-	set32(&lvid->number_of_partitions, 1);
-	set32(&lvid->length_of_impl_use, 46);
-	/*set32(&lvid->free_space_table, 0);*/
-	set32(&lvid->size_table,
-			lba_end_anchor_vol_desc - lba_udf_partition_start);
-	set_impl_ident(&lvid->impl_use.impl_id);
-	set32(&lvid->impl_use.number_of_files, num_udf_files);
-	set32(&lvid->impl_use.number_of_directories, num_udf_directories);
-	set16(&lvid->impl_use.minimum_udf_read_revision, 0x102);
-	set16(&lvid->impl_use.minimum_udf_write_revision, 0x102);
-	set16(&lvid->impl_use.maximum_udf_write_revision, 0x102);
-	set_tag(&lvid->desc_tag, UDF_TAGID_LOGICAL_VOLUME_INTEGRITY_DESC,
-								lba, 88+46);
-}
-
-static void
-set_file_set_desc(unsigned char *buf, unsigned rba)
-{
-	udf_file_set_desc *fsd = (udf_file_set_desc *)buf;
-
-	set_timestamp_from_time_t(&fsd->recording_date_and_time, begun);
-	set16(&fsd->interchange_level, 3);
-	set16(&fsd->maximum_interchange_level, 3);
-	set32(&fsd->character_set_list, 1);
-	set32(&fsd->maximum_character_set_list, 1);
-	/*set32(&fsd->file_set_number, 0);*/
-	/*set32(&fsd->file_set_desc_number, 0);*/
-	set_charspec(&fsd->logical_volume_ident_character_set);
-	set_dstring(fsd->logical_volume_ident, volume_id,
-					sizeof (fsd->logical_volume_ident));
-	set_charspec(&fsd->file_set_character_set);
-	set_dstring(fsd->file_set_ident, volume_id,
-					sizeof (fsd->file_set_ident));
-	/*fsd->copyright_file_ident;*/
-	/*fsd->abstract_file_ident;*/
-	set32(&fsd->root_directory_icb.extent_length, SECTOR_SIZE);
-	set32(&fsd->root_directory_icb.extent_location.logical_block_number,
-		root->self->udf_file_entry_sector - lba_udf_partition_start);
-	set_domain_ident(&fsd->domain_ident);
-	/*fsd->next_extent;*/
-	set_tag(&fsd->desc_tag, UDF_TAGID_FILE_SET_DESC, rba, 512);
-}
-
-static int
-set_file_ident_desc(unsigned char *buf, unsigned rba, char *name, 
-						  int is_directory, unsigned file_entry_rba, 
-						  unsigned unique_id)
-{
-	udf_file_ident_desc *fid = (udf_file_ident_desc *)buf;
-	int length_of_file_ident, length, padded_length;
-	set16(&fid->file_version_number, 1);
-	set8(&fid->file_characteristics,
-		(is_directory ? UDF_FILE_CHARACTERISTIC_DIRECTORY : 0)
-		+ (name == 0) * UDF_FILE_CHARACTERISTIC_PARENT);
-	set32(&fid->icb.extent_length, SECTOR_SIZE);
-	set32(&fid->icb.extent_location.logical_block_number, file_entry_rba);
-	set16(&fid->icb.extent_location.partition_reference_number, 0);
-	set32(&fid->icb.impl_use.unique_id, unique_id);
-	set16(&fid->length_of_impl_use, 0);
-	if (name) {
-		length_of_file_ident =
-			set_ostaunicode((Uchar *)fid->file_ident, 512, name);
-	} else {
-		length_of_file_ident = 0;
-	}
-	set8(&fid->length_of_file_ident, length_of_file_ident);
-	length = 38 + length_of_file_ident;
-	padded_length = PAD(length, 4);
-	while (length < padded_length) {
-		buf[length++] = 0;
-	}
-	set_tag(&fid->desc_tag, UDF_TAGID_FILE_IDENT_DESC, rba, length);
-	return (length);
-}
-
-static void
-set_file_entry(unsigned char *buf, unsigned rba, unsigned file_rba,
-					unsigned length, const char *iso_date, int is_directory,
-					unsigned link_count, unsigned unique_id)
-{
-	udf_short_ad	*allocation_desc;
-	unsigned	chunk;
-
-	udf_file_entry *fe = (udf_file_entry *)buf;
-
-	/*set32(&fe->icb_tag.prior_recorded_number_of_direct_entries, 0);*/
-	set16(&fe->icb_tag.strategy_type, 4);
-	/*set16(&fe->icb_tag.strategy_parameter, 0);*/
-	set16(&fe->icb_tag.maximum_number_of_entries, 1);
-	set8(&fe->icb_tag.file_type, is_directory
-		? UDF_ICBTAG_FILETYPE_DIRECTORY : UDF_ICBTAG_FILETYPE_BYTESEQ);
-	/*fe->icb_tag.parent_icb_location;*/
-	set16(&fe->icb_tag.flags, UDF_ICBTAG_FLAG_NONRELOCATABLE
-		| UDF_ICBTAG_FLAG_ARCHIVE | UDF_ICBTAG_FLAG_CONTIGUOUS);
-	if (rationalize_uid)
-		set32(&fe->uid, uid_to_use);
-	else
-		set32(&fe->uid, -1);
-	if (rationalize_gid)
-		set32(&fe->gid, gid_to_use);
-	else
-		set32(&fe->gid, -1);
-	if (is_directory) {
-		set32(&fe->permissions,
-		    UDF_FILEENTRY_PERMISSION_OR | UDF_FILEENTRY_PERMISSION_OX |
-		    UDF_FILEENTRY_PERMISSION_GR | UDF_FILEENTRY_PERMISSION_GX |
-		    UDF_FILEENTRY_PERMISSION_UR | UDF_FILEENTRY_PERMISSION_UX);
-	} else {
-		set32(&fe->permissions, UDF_FILEENTRY_PERMISSION_OR
-		| UDF_FILEENTRY_PERMISSION_GR | UDF_FILEENTRY_PERMISSION_UR);
-	}
-	set16(&fe->file_link_count, link_count);
-	/*fe->record_format;*/
-	/*fe->record_display_attributes;*/
-	/*fe->record_length;*/
-	set64(&fe->info_length, length);
-	set64(&fe->logical_blocks_recorded, ISO_BLOCKS(length));
-	if (iso_date) {
-		set_timestamp_from_iso_date(&fe->access_time, iso_date);
-		fe->modification_time = fe->access_time;
-		fe->attribute_time = fe->access_time;
-	}
-	set32(&fe->checkpoint, 1);
-	/*fe->ext_attribute_icb;*/
-	set_impl_ident(&fe->impl_ident);
-	set64(&fe->unique_id, unique_id);
-	/*
-	 * Extended attributes that may (?) be required for DVD-Video
-	 * compliance
-	 */
-#if 0
-	set32(&fe->length_of_ext_attributes, 24+52+56);
-	set32(&fe->ext_attribute_header.impl_attributes_location, 24);
-	set32(&fe->ext_attribute_header.application_attributes_location,
-								24+52+56);
-	set_tag(&fe->ext_attribute_header.desc_tag,
-			UDF_TAGID_EXT_ATTRIBUTE_HEADER_DESC, rba, 24 /*???*/);
-	set32(&fe->ext_attribute_free_ea_space.attribute_type, SECTOR_SIZE);
-	set8(&fe->ext_attribute_free_ea_space.attribute_subtype, 1);
-	set32(&fe->ext_attribute_free_ea_space.attribute_length, 52);
-	set32(&fe->ext_attribute_free_ea_space.impl_use_length, 4);
-	strcpy((char *)fe->ext_attribute_free_ea_space.impl_ident.ident,
-							"*UDF FreeAppEASpace");
-	set32(&fe->ext_attribute_dvd_cgms_info.attribute_type, SECTOR_SIZE);
-	set8(&fe->ext_attribute_dvd_cgms_info.attribute_subtype, 1);
-	set32(&fe->ext_attribute_dvd_cgms_info.attribute_length, 56);
-	set32(&fe->ext_attribute_dvd_cgms_info.impl_use_length, 8);
-	strcpy((char *)fe->ext_attribute_free_ea_space.impl_ident.ident,
-							"*UDF DVD CGMS Info");
-	fe->ext_attribute_free_ea_space.impl_ident.ident_suffix[0] = 2;
-	fe->ext_attribute_free_ea_space.impl_ident.ident_suffix[1] = 1;
-#else
-	/*set32(&fe->length_of_ext_attributes, 0);*/
-#endif
-
-	allocation_desc = &fe->allocation_desc;
-	/*
-	 * Only a file size less than 1GB can be expressed by a single
-	 * AllocationDescriptor. When the size of a file is larger than 1GB,
-	 * 2 or more AllocationDescriptors should be used. We don't know
-	 * whether a singl 8-byte AllocationDescriptor should be written or no
-	 * one should be written if the size of a file is 0 byte. - FIXME.
-	 *
-	 * XXX We get called with buf[2048]. This allows a max. file size of
-	 * XXX 234 GB. With more we would cause a buffer overflow.
-	 * XXX We need to check whether UDF would allow files > 234 GB.
-	 */
-	for (; length > 0; length -= chunk) {
-		chunk = (length > 0x3ffff800) ? 0x3ffff800 : length;
-		set32(&allocation_desc->extent_length, chunk);
-		set32(&allocation_desc->extent_position, file_rba);
-		file_rba += chunk >> 11;
-		allocation_desc++;
-	}
-	set32(&fe->length_of_allocation_descs,
-				(unsigned char *) allocation_desc -
-				(unsigned char *) &fe->allocation_desc);
-	set_tag(&fe->desc_tag, UDF_TAGID_FILE_ENTRY, rba,
-		(unsigned char *) allocation_desc - buf);
-}
-
-static unsigned
-directory_link_count(struct directory *dpnt)
-{
-	/*
-	 * The link count is equal to 1 (for the parent) plus the
-	 * number of subdirectories.
-	 */
-	unsigned link_count = 1;
-	struct directory_entry *de;
-
-	/* count relocated subdirectories */
-	for (de = dpnt->jcontents; de; de = de->jnext) {
-		if ((de->de_flags &
-		    (INHIBIT_JOLIET_ENTRY | RELOCATED_DIRECTORY)) ==
-							RELOCATED_DIRECTORY) {
-			link_count++;
-		}
-	}
-	/* count ordinary subdirectories */
-	for (dpnt = dpnt->subdir; dpnt; dpnt = dpnt->next) {
-		if (!(dpnt->dir_flags & INHIBIT_JOLIET_ENTRY)) {
-			link_count++;
-		}
-	}
-	return (link_count);
-}
-
-static void
-write_one_udf_directory(struct directory *dpnt, FILE *outfile)
-{
-	unsigned size_in_bytes, padded_size_in_bytes;
-	struct directory_entry *de;
-	unsigned ident_size;
-	unsigned base_sector;
-	struct directory *parent;
-	Uchar buf[SECTOR_SIZE];
-
-	memset(buf, 0, SECTOR_SIZE);
-	set_file_entry(
-		buf,
-		last_extent_written - lba_udf_partition_start,
-		last_extent_written+1 - lba_udf_partition_start,
-		directory_size(dpnt),
-		dpnt->self->isorec.date,
-		1,	/* is_directory */
-		directory_link_count(dpnt),
-		(dpnt == root) ? 0 : dpnt->self->udf_file_entry_sector);
-	jtwrite(buf, SECTOR_SIZE, 1, 0, FALSE);
-	xfwrite(buf, SECTOR_SIZE, 1, outfile, 0, FALSE);
-	last_extent_written++;
-
-	base_sector = last_extent_written - lba_udf_partition_start;
-
-	/* parent directory */
-	parent = dpnt->parent;
-	if (parent == reloc_dir) {
-		parent = dpnt->self->parent_rec->filedir;
-	}
-	ident_size = set_file_ident_desc(
-		buf,
-		base_sector,
-		0,
-		1,
-		parent->self->udf_file_entry_sector - lba_udf_partition_start,
-		(parent == root) ? 0 : parent->self->udf_file_entry_sector);
-	jtwrite(buf, ident_size, 1, 0, FALSE);
-	xfwrite(buf, ident_size, 1, outfile, 0, FALSE);
-	size_in_bytes = ident_size;
-
-	/* directory contents */
-	for (de = dpnt->jcontents; de; de = de->jnext) {
-		char *name;
-		struct directory_entry *de1;
-
-		if (de->de_flags & INHIBIT_JOLIET_ENTRY)
-			continue;
-
-		name = USE_MAC_NAME(de) ? de->hfs_ent->name : de->name;
-
-		/* skip . and .. */
-		if (name[0] == '.' && (name[1] == 0 ||
-		    (name[1] == '.' && name[2] == 0)))
-			continue;
-
-		/* look in RR_MOVED for relocated directories */
-		de1 = de;
-		if (de->de_flags & RELOCATED_DIRECTORY) {
-			for (de1 = reloc_dir->contents; de1; de1 = de1->next) {
-				if (de1->parent_rec == de) {
-					break;
-				}
-			}
-			if (!de1) {
-#ifdef	USE_LIBSCHILY
-				comerrno(EX_BAD,
-				"Unable to locate relocated directory\n");
-#else
-				fprintf(stderr,
-				"Unable to locate relocated directory\n");
-				exit(1);
-#endif
-			}
-		}
-
-		ident_size = set_file_ident_desc(
-			buf,
-			base_sector + (size_in_bytes / SECTOR_SIZE),
-			name,
-			!!(de1->isorec.flags[0] & ISO_DIRECTORY),
-			de1->udf_file_entry_sector - lba_udf_partition_start,
-			de1->udf_file_entry_sector);
-		jtwrite(buf, ident_size, 1, 0, FALSE);
-		xfwrite(buf, ident_size, 1, outfile, 0, FALSE);
-		size_in_bytes += ident_size;
-	}
-
-	padded_size_in_bytes = PAD(size_in_bytes, SECTOR_SIZE);
-	if (size_in_bytes < padded_size_in_bytes) {
-		memset(buf, 0, padded_size_in_bytes - size_in_bytes);
-		jtwrite(buf, padded_size_in_bytes - size_in_bytes, 1, 0, FALSE);
-		xfwrite(buf, padded_size_in_bytes - size_in_bytes, 1, outfile, 0, FALSE);
-	}
-
-	last_extent_written += padded_size_in_bytes / SECTOR_SIZE;
-}
-
-static void
-write_udf_directories(struct directory *dpnt, FILE *outfile)
-{
-	if (!(dpnt->dir_flags & INHIBIT_JOLIET_ENTRY)) {
-		write_one_udf_directory(dpnt, outfile);
-	}
-	if (!(dpnt->dir_flags & INHIBIT_JOLIET_ENTRY) || dpnt == reloc_dir) {
-		for (dpnt = dpnt->subdir; dpnt; dpnt = dpnt->next) {
-			write_udf_directories(dpnt, outfile);
-		}
-	}
-}
-
-static void
-write_udf_file_entries(struct directory *dpnt, FILE *outfile)
-{
-	Uchar buf[SECTOR_SIZE];
-
-	memset(buf, 0, SECTOR_SIZE);
-
-	if (!(dpnt->dir_flags & INHIBIT_JOLIET_ENTRY)) {
-		struct directory_entry *de;
-		for (de = dpnt->jcontents; de; de = de->jnext) {
-			if (!(de->de_flags & RELOCATED_DIRECTORY) &&
-			    !(de->isorec.flags[0] & ISO_DIRECTORY)) {
-
-				memset(buf, 0, 512);
-				set_file_entry(
-					buf,
-					(last_extent_written++) - lba_udf_partition_start,
-					read_733(de->isorec.extent) - lba_udf_partition_start,
-					read_733(de->isorec.size),
-					de->isorec.date,
-					0,	/* is_directory */
-					1,	/* link_count */
-					de->udf_file_entry_sector);
-				jtwrite(buf, SECTOR_SIZE, 1, 0, FALSE);
-				xfwrite(buf, SECTOR_SIZE, 1, outfile, 0, FALSE);
-			}
-		}
-	}
-	if (!(dpnt->dir_flags & INHIBIT_JOLIET_ENTRY) || dpnt == reloc_dir) {
-		for (dpnt = dpnt->subdir; dpnt; dpnt = dpnt->next) {
-			write_udf_file_entries(dpnt, outfile);
-		}
-	}
-}
-
-/****************************/
-
-static int
-udf_vol_recognition_area_write(FILE *out)
-{
-	static const char *identifiers[3] = { "BEA01", "NSR02", "TEA01" };
-	int i;
-	char buf[SECTOR_SIZE];
-	udf_volume_recognition_desc *vsd = (udf_volume_recognition_desc *)buf;
-
-	memset(buf, 0, sizeof (buf));
-	/*set8(&vsd->structure_type, 0);*/
-	set8(&vsd->structure_version, 1);
-	for (i = 0; i < 3; ++i) {
-		memcpy(vsd->standard_identifier, identifiers[i], 5);
-		jtwrite(buf, SECTOR_SIZE, 1, 0, FALSE);
-		xfwrite(buf, SECTOR_SIZE, 1, out, 0, FALSE);
-	}
-	last_extent_written += 3;
-	return (0);
-}
-
-static int
-udf_main_seq_write(FILE *out)
-{
-	Uchar buf[SECTOR_SIZE];
-	int i;
-
-	/*
-	 * volume_set_id needs to be set to a (64-bit) "unique" number.
-	 * This will have to do for now.
-	 */
-	volume_set_id[0] = begun;
-	volume_set_id[1] = (unsigned)clock();	/* XXX Maybe non-portable */
-
-	memset(buf, 0, sizeof (buf));
-	set_primary_vol_desc(buf, last_extent_written++);
-	jtwrite(buf, SECTOR_SIZE, 1, 0, FALSE);
-	xfwrite(buf, SECTOR_SIZE, 1, out, 0, FALSE);
-
-	memset(buf, 0, sizeof (buf));
-	set_impl_use_vol_desc(buf, last_extent_written++);
-	jtwrite(buf, SECTOR_SIZE, 1, 0, FALSE);
-	xfwrite(buf, SECTOR_SIZE, 1, out, 0, FALSE);
-
-	memset(buf, 0, sizeof (buf));
-	set_partition_desc(buf, last_extent_written++);
-	jtwrite(buf, SECTOR_SIZE, 1, 0, FALSE);
-	xfwrite(buf, SECTOR_SIZE, 1, out, 0, FALSE);
-
-	memset(buf, 0, sizeof (buf));
-	set_logical_vol_desc(buf, last_extent_written++);
-	jtwrite(buf, SECTOR_SIZE, 1, 0, FALSE);
-	xfwrite(buf, SECTOR_SIZE, 1, out, 0, FALSE);
-
-	memset(buf, 0, sizeof (buf));
-	set_unallocated_space_desc(buf, last_extent_written++);
-	jtwrite(buf, SECTOR_SIZE, 1, 0, FALSE);
-	xfwrite(buf, SECTOR_SIZE, 1, out, 0, FALSE);
-
-	memset(buf, 0, sizeof (buf));
-	set_terminating_desc(buf, last_extent_written++);
-	jtwrite(buf, SECTOR_SIZE, 1, 0, FALSE);
-	xfwrite(buf, SECTOR_SIZE, 1, out, 0, FALSE);
-
-	memset(buf, 0, sizeof (buf));
-	for (i = 6; i < UDF_MAIN_SEQ_LENGTH; ++i) {
-        jtwrite(buf, SECTOR_SIZE, 1, 0, FALSE);
-		xfwrite(buf, SECTOR_SIZE, 1, out, 0, FALSE);
-		last_extent_written++;
-	}
-
-	return (0);
-}
-
-static int
-udf_integ_seq_write(FILE *out)
-{
-	Uchar buf[SECTOR_SIZE*UDF_INTEG_SEQ_LENGTH];
-
-	memset(buf, 0, sizeof (buf));
-
-	set_logical_vol_integrity_desc(buf+0*SECTOR_SIZE,
-						last_extent_written++);
-	set_terminating_desc(buf+1*SECTOR_SIZE, last_extent_written++);
-
-	jtwrite(buf, SECTOR_SIZE, UDF_INTEG_SEQ_LENGTH, 0, FALSE);
-	xfwrite(buf, SECTOR_SIZE, UDF_INTEG_SEQ_LENGTH, out, 0, FALSE);
-	return (0);
-}
-
-static int
-udf_anchor_vol_desc_write(FILE *out)
-{
-	Uchar buf[SECTOR_SIZE];
-
-	memset(buf, 0, sizeof (buf));
-	set_anchor_volume_desc_pointer(buf, last_extent_written++);
-	jtwrite(buf, SECTOR_SIZE, 1, 0, FALSE);
-	xfwrite(buf, SECTOR_SIZE, 1, out, 0, FALSE);
-	return (0);
-}
-
-static int
-udf_file_set_desc_write(FILE *out)
-{
-	Uchar buf[SECTOR_SIZE*2];
-
-	memset(buf, 0, sizeof (buf));
-
-	set_file_set_desc(buf+0*SECTOR_SIZE,
-			(last_extent_written++) - lba_udf_partition_start);
-	set_terminating_desc(buf+1*SECTOR_SIZE,
-			(last_extent_written++) - lba_udf_partition_start);
-
-	jtwrite(buf, SECTOR_SIZE, 2, 0, FALSE);
-	xfwrite(buf, SECTOR_SIZE, 2, out, 0, FALSE);
-
-	return (0);
-}
-
-static int
-udf_dirtree_write(FILE *out)
-{
-	write_udf_directories(root, out);
-	return (0);
-}
-
-static int
-udf_file_entries_write(FILE *out)
-{
-	write_udf_file_entries(root, out);
-	return (0);
-}
-
-static int
-pad_to(unsigned last_extent_to_write, FILE *out)
-{
-	char buf[SECTOR_SIZE];
-	memset(buf, 0, sizeof (buf));
-	while (last_extent_written < last_extent_to_write) {
-		jtwrite(buf, SECTOR_SIZE, 1, 0, FALSE);
-		xfwrite(buf, SECTOR_SIZE, 1, out, 0, FALSE);
-		++last_extent_written;
-	}
-	return (0);
-}
-
-static int
-udf_pad_to_sector_32_write(FILE *out)
-{
-	return (pad_to(session_start+32, out));
-}
-
-static int
-udf_pad_to_sector_256_write(FILE *out)
-{
-	return (pad_to(session_start+256, out));
-}
-
-static int
-udf_padend_avdp_write(FILE *out)
-{
-	Uchar buf[SECTOR_SIZE];
-	unsigned last_extent_to_write = (last_extent_written+31) & ~15;
-
-	if (!use_sparcboot)
-		last_extent_to_write = last_extent_written + 150;
-
-	memset(buf, 0, sizeof (buf));
-	while (last_extent_written < last_extent_to_write) {
-		set_anchor_volume_desc_pointer(buf, last_extent_written++);
-		jtwrite(buf, SECTOR_SIZE, 1, 0, FALSE);
-		xfwrite(buf, SECTOR_SIZE, 1, out, 0, FALSE);
-	}
-	return (0);
-}
-
-
-struct output_fragment udf_vol_recognition_area_frag = { NULL, udf_vol_recognition_area_size, NULL, udf_vol_recognition_area_write, "UDF volume recognition area" };
-struct output_fragment udf_main_seq_frag = { NULL, udf_main_seq_size, NULL, udf_main_seq_write, "UDF main seq" };
-struct output_fragment udf_main_seq_copy_frag = { NULL, udf_main_seq_copy_size, NULL, udf_main_seq_write, "UDF second seq" };
-struct output_fragment udf_integ_seq_frag = { NULL, udf_integ_seq_size, NULL, udf_integ_seq_write, "UDF integ seq" };
-struct output_fragment udf_anchor_vol_desc_frag = { NULL, oneblock_size, NULL, udf_anchor_vol_desc_write, "UDF Anchor volume" };
-struct output_fragment udf_file_set_desc_frag = { NULL, udf_file_set_desc_size, NULL, udf_file_set_desc_write, "UDF file set" };
-struct output_fragment udf_dirtree_frag = { NULL, udf_dirtree_size, NULL, udf_dirtree_write, "UDF directory tree" };
-struct output_fragment udf_file_entries_frag = { NULL, udf_file_entries_size, NULL, udf_file_entries_write, "UDF file entries" };
-struct output_fragment udf_end_anchor_vol_desc_frag = { NULL, udf_end_anchor_vol_desc_size, NULL, udf_anchor_vol_desc_write, "UDF Anchor end volume" };
-
-struct output_fragment udf_pad_to_sector_32_frag = { NULL, udf_pad_to_sector_32_size, NULL, udf_pad_to_sector_32_write, "UDF pad to sector 32" };
-struct output_fragment udf_pad_to_sector_256_frag = { NULL, udf_pad_to_sector_256_size, NULL, udf_pad_to_sector_256_write, "UDF pad to sector 256" };
-struct output_fragment udf_padend_avdp_frag = { NULL, udf_padend_avdp_size, NULL, udf_padend_avdp_write, "UDF Pad end" };
-
-/*
- * This function assigns weights as follows:
- *
- * /VIDEO_TS/VIDEO_TS.IFO   11199
- * /VIDEO_TS/VIDEO_TS.VOB   11198
- * /VIDEO_TS/VIDEO_TS.BUP   11188
- * /VIDEO_TS/VTS_01_0.IFO   11187
- * /VIDEO_TS/VTS_01_0.VOB   11186
- *            :               :
- * /VIDEO_TS/VTS_01_9.VOB   11177
- * /VIDEO_TS/VTS_01_0.BUP   11176
- *            :               :
- * /VIDEO_TS/VTS_99_0.BUP   10000
- *
- * This ensures that DVD-Video files are laid out properly on the disc.
- * The same thing is done for AUDIO_TS files, except in the 20000 range
- * instead of the 10000 range.
- *
- * Question: what about JACKET_P files?
- *
- * Answer: At least as far as I know :)
- * JACKET_P files are still images (single frame mpeg video .i.e mp2
- * format). The DVD Jacket pictures will be displayed on the TV screen
- * when the player is in a stop/resume mode.
- * The location is not dependent on IFO information and the only must
- * as far as I know is that they are in upper case (both dir and files).
- * This sparce information makes me conclude that they don't need any
- * weight. This obviously needs to be tested.
- */
-int
-assign_dvd_weights(char *name, struct directory *this_dir, int val)
-{
-	int ts_number;
-	int segment;
-	int audio;
-
-	if (name[0] != 'A' && name[0] != 'V')
-		return (val);
-
-	if (memcmp(name, "VIDEO_TS", 8) == 0) {
-		ts_number = 0;
-		audio = 0;
-	} else if (memcmp(name, "VTS_", 4) == 0) {
-		ts_number = 1;
-		audio = 0;
-	} else if (memcmp(name, "AUDIO_TS", 8) == 0) {
-		ts_number = 0;
-		audio = 1;
-	} else if (memcmp(name, "ATS_", 4) == 0) {
-		ts_number = 1;
-		audio = 1;
-	} else {
-		return (val);
-	}
-
-	if (this_dir->parent != root ||
-	    strcmp(this_dir->de_name, "VIDEO_TS") != 0)
-		return (val);
-
-	if (ts_number == 0) {
-		segment = 0;
-	} else {
-		if (name[4] >= '0' && name[4] <= '9' &&
-		    name[5] >= '0' && name[5] <= '9' &&
-		    name[6] == '_' &&
-		    name[7] >= '0' && name[7] <= '9') {
-			ts_number = name[4] * 10 + name[5] - ('0' * 11);
-			segment = name[7] - '0';
-		} else {
-			return (val);
-		}
-	}
-
-	if (strcmp(name+8, audio ? ".AOB" : ".VOB") == 0) {
-		return (audio * 10000 - ts_number * 12 - segment + 11198);
-	} else if (strcmp(name+8, ".IFO") == 0) {
-		return (audio * 10000 - ts_number * 12 + 11199);
-	} else if (strcmp(name+8, ".BUP") == 0) {
-		return (audio * 10000 - ts_number * 12 + 11188);
-	} else {
-		return (val);
-	}
-}
-
-#endif  /* UDF */

Copied: cdrkit/trunk/genisoimage/udf.c (from rev 452, cdrkit/trunk/mkisoimage/udf.c)

Deleted: cdrkit/trunk/genisoimage/udf.h
===================================================================
--- cdrkit/trunk/mkisoimage/udf.h	2006-11-23 21:37:32 UTC (rev 450)
+++ cdrkit/trunk/genisoimage/udf.h	2006-11-23 22:11:41 UTC (rev 453)
@@ -1,53 +0,0 @@
-/*
- * This file has been modified for the cdrkit suite.
- *
- * The behaviour and appearence of the program code below can differ to a major
- * extent from the version distributed by the original author(s).
- *
- * For details, see Changelog file distributed with the cdrkit package. If you
- * received this file from another source then ask the distributing person for
- * a log of modifications.
- *
- */
-
-/* @(#)udf.h	1.2 04/03/01 Copyright 2001-2004 J. Schilling */
-/*
- *	UDF external definitions for mkisoimage
- *
- *	Copyright (c) 2001-2004 J. Schilling
- */
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; see the file COPYING.  If not, write to the Free Software
- * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef	_UDF_H
-#define	_UDF_H
-
-extern struct output_fragment udf_vol_recognition_area_frag;
-extern struct output_fragment udf_main_seq_frag;
-extern struct output_fragment udf_main_seq_copy_frag;
-extern struct output_fragment udf_integ_seq_frag;
-extern struct output_fragment udf_anchor_vol_desc_frag;
-extern struct output_fragment udf_file_set_desc_frag;
-extern struct output_fragment udf_dirtree_frag;
-extern struct output_fragment udf_file_entries_frag;
-extern struct output_fragment udf_end_anchor_vol_desc_frag;
-
-extern struct output_fragment udf_pad_to_sector_32_frag;
-extern struct output_fragment udf_pad_to_sector_256_frag;
-extern struct output_fragment udf_padend_avdp_frag;
-
-int assign_dvd_weights(char *name, struct directory *this_dir, int val);
-
-#endif	/* _UDF_H */

Copied: cdrkit/trunk/genisoimage/udf.h (from rev 452, cdrkit/trunk/mkisoimage/udf.h)

Deleted: cdrkit/trunk/genisoimage/udf_fs.h
===================================================================
--- cdrkit/trunk/mkisoimage/udf_fs.h	2006-11-23 21:37:32 UTC (rev 450)
+++ cdrkit/trunk/genisoimage/udf_fs.h	2006-11-23 22:11:41 UTC (rev 453)
@@ -1,462 +0,0 @@
-/*
- * This file has been modified for the cdrkit suite.
- *
- * The behaviour and appearence of the program code below can differ to a major
- * extent from the version distributed by the original author(s).
- *
- * For details, see Changelog file distributed with the cdrkit package. If you
- * received this file from another source then ask the distributing person for
- * a log of modifications.
- *
- */
-
-/* @(#)udf_fs.h	1.2 04/03/01 Copyright 2001-2004 J. Schilling */
-/*
- * udf_fs.h - UDF structure definitions for mkisoimage
- *
- * Written by Ben Rudiak-Gould (2001).
- *
- * Copyright 2001-2004 J. Schilling.
- */
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; see the file COPYING.  If not, write to the Free Software
- * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef	_UDF_FS_H
-#define	_UDF_FS_H
-
-/*
- * Abbreviations:
- *
- * ad		allocation descriptor
- * desc		descriptor
- * ext		extended
- * ident	identifier
- * impl		implementation
- * info		information
- * ptr		pointer
- * seq		sequence
- */
-
-typedef char udf_Uint8;
-typedef char udf_dchar;
-typedef char udf_dstring;
-typedef char udf_byte;
-typedef char udf_zerobyte;
-
-/* Is this safe? Are there compilers so perverse as to pad these structs? */
-typedef struct udf_Uint16_ {
-	char	l;
-	char	h;
-} udf_Uint16;
-
-typedef struct udf_Uint32_ {
-	char	l;
-	char	ml;
-	char	mh;
-	char	h;
-} udf_Uint32;
-typedef struct udf_Uint64_ {
-	udf_Uint32	l;
-	udf_Uint32	h;
-} udf_Uint64;
-
-typedef struct udf_tag_ {			/* ECMA-167 3/7.2 */
-/* 0*/	udf_Uint16	tag_ident;
-/* 2*/	udf_Uint16	desc_version;
-/* 4*/	udf_Uint8	tag_checksum;
-/* 5*/	udf_zerobyte	reserved;
-/* 6*/	udf_Uint16	tag_serial_number;
-/* 8*/	udf_Uint16	desc_crc;
-/*10*/	udf_Uint16	desc_crc_length;
-/*12*/	udf_Uint32	tag_location;
-/*16*/
-} udf_tag;
-
-#define	UDF_TAGID_PRIMARY_VOLUME_DESC		1
-#define	UDF_TAGID_ANCHOR_VOLUME_DESC_PTR	2
-#define	UDF_TAGID_IMPL_USE_VOLUME_DESC		4
-#define	UDF_TAGID_PARTITION_DESC		5
-#define	UDF_TAGID_LOGICAL_VOLUME_DESC		6
-#define	UDF_TAGID_UNALLOCATED_SPACE_DESC	7
-#define	UDF_TAGID_TERMINATING_DESC		8
-#define	UDF_TAGID_LOGICAL_VOLUME_INTEGRITY_DESC	9
-#define	UDF_TAGID_FILE_SET_DESC			256
-#define	UDF_TAGID_FILE_IDENT_DESC		257
-#define	UDF_TAGID_FILE_ENTRY			261
-#define	UDF_TAGID_EXT_ATTRIBUTE_HEADER_DESC	262
-
-typedef struct udf_extent_ad_ {			/* ECMA-167 3/7.1 */
-/*0*/	udf_Uint32	extent_length;
-/*4*/	udf_Uint32	extent_location;
-/*8*/
-} udf_extent_ad;
-
-typedef struct udf_charspec_ {			/* ECMA-167 1/7.2.1 */
-/* 0*/	udf_Uint8	character_set_type;
-/* 1*/	udf_byte	character_set_info[63];
-/*64*/
-} udf_charspec;
-
-typedef struct udf_EntityID_ {			/* ECMA-167 1/7.4 */
-/* 0*/	udf_Uint8	flags;
-/* 1*/	udf_byte	ident[23];
-/*24*/	udf_byte	ident_suffix[8];
-/*32*/
-} udf_EntityID;
-
-#define	UDF_ENTITYID_FLAG_PROTECTED	2	/* ECMA-167 1/7.4.1 */
-
-typedef struct udf_lb_addr_ {			/* ECMA-167 4/7.1 */
-/*0*/	udf_Uint32	logical_block_number;
-/*4*/	udf_Uint16	partition_reference_number;
-/*6*/
-} udf_lb_addr;
-
-typedef struct udf_short_ad_ {			/* ECMA-167 4/14.14.1 */
-/*0*/	udf_Uint32	extent_length;
-/*4*/	udf_Uint32	extent_position;
-/*8*/
-} udf_short_ad;
-
-typedef struct udf_long_ad_impl_use_field_ {	/* UDF 2.01 2.3.4.3 */
-/*0*/	udf_Uint16	flags;
-/*2*/	udf_Uint32	unique_id;
-/*6*/
-} udf_long_ad_impl_use_field;
-
-typedef struct udf_long_ad_ {			/* ECMA-167 4/14.14.2 */
-/* 0*/	udf_Uint32	extent_length;
-/* 4*/	udf_lb_addr	extent_location;
-/*10*/	udf_long_ad_impl_use_field	impl_use;
-/*16*/
-} udf_long_ad;
-
-typedef struct udf_timestamp_ {			/* TR/71 1.5.4 */
-/* 0*/	udf_Uint16	type_and_time_zone;
-/* 2*/	udf_Uint16	year;
-/* 4*/	udf_Uint8	month;
-/* 5*/	udf_Uint8	day;
-/* 6*/	udf_Uint8	hour;
-/* 7*/	udf_Uint8	minute;
-/* 8*/	udf_Uint8	second;
-/* 9*/	udf_Uint8	centiseconds;
-/*10*/	udf_Uint8	hundreds_of_microseconds;
-/*11*/	udf_Uint8	microseconds;
-/*12*/
-} udf_timestamp;
-
-typedef struct udf_volume_recognition_desc_ {	/* TR/71 2.4.{1,2,3} */
-	udf_Uint8	structure_type;
-	udf_byte	standard_identifier[5];
-	udf_Uint8	structure_version;
-	udf_zerobyte	structure_data[2041];
-} udf_volume_recognition_desc;
-
-typedef struct udf_anchor_volume_desc_ptr_ {	/* TR/71 2.5.1 */
-/*  0*/	udf_tag		desc_tag;
-/* 16*/	udf_extent_ad	main_volume_desc_seq_extent;
-/* 24*/	udf_extent_ad	reserve_volume_desc_seq_extent;
-/* 32*/	udf_zerobyte	reserved[480];
-/*512*/
-} udf_anchor_volume_desc_ptr;
-
-typedef struct udf_primary_volume_desc_ {	/* TR/71 2.6.1 */
-/*  0*/	udf_tag		desc_tag;
-/* 16*/	udf_Uint32	volume_desc_seq_number;
-/* 20*/	udf_Uint32	primary_volume_desc_number;
-/* 24*/	udf_dstring	volume_ident[32];
-/* 56*/	udf_Uint16	volume_seq_number;
-/* 58*/	udf_Uint16	maximum_volume_seq_number;
-/* 60*/	udf_Uint16	interchange_level;
-/* 62*/	udf_Uint16	maximum_interchange_level;
-/* 64*/	udf_Uint32	character_set_list;
-/* 68*/	udf_Uint32	maximum_character_set_list;
-/* 72*/	udf_dstring	volume_set_ident[128];
-/*200*/	udf_charspec	desc_character_set;
-/*264*/	udf_charspec	explanatory_character_set;
-/*328*/	udf_extent_ad	volume_abstract;
-/*336*/	udf_extent_ad	volume_copyright_notice;
-/*344*/	udf_EntityID	application_ident;
-/*376*/	udf_timestamp	recording_date_and_time;
-/*388*/	udf_EntityID	impl_ident;
-/*420*/	udf_byte	impl_use[64];
-/*484*/	udf_Uint32	predecessor_volume_desc_seq_location;
-/*488*/	udf_Uint16	flags;
-/*490*/	udf_zerobyte	reserved[22];
-/*512*/
-} udf_primary_volume_desc;
-
-typedef struct udf_impl_use_volume_desc_impl_use_field_ {	/* TR/71 2.6.3 */
-/*  0*/	udf_charspec	lvi_charset;
-/* 64*/	udf_dstring	logical_volume_ident[128];
-/*192*/	udf_dstring	lv_info1[36];
-/*228*/	udf_dstring	lv_info2[36];
-/*264*/	udf_dstring	lv_info3[36];
-/*300*/	udf_EntityID	impl_id;
-/*332*/	udf_byte	impl_use[128];
-/*460*/
-} udf_impl_use_volume_desc_impl_use_field;
-
-typedef struct udf_impl_use_volume_desc_ {	/* TR/71 2.6.2 */
-/*  0*/	udf_tag		desc_tag;
-/* 16*/	udf_Uint32	volume_desc_seq_number;
-/* 20*/	udf_EntityID	impl_ident;
-/* 52*/	udf_impl_use_volume_desc_impl_use_field	impl_use;
-/*512*/
-} udf_impl_use_volume_desc;
-
-typedef struct udf_partition_desc_ {		/* TR/71 2.6.4 */
-/*  0*/	udf_tag		desc_tag;
-/* 16*/	udf_Uint32	volume_desc_seq_number;
-/* 20*/	udf_Uint16	partition_flags;
-/* 22*/	udf_Uint16	partition_number;
-/* 24*/	udf_EntityID	partition_contents;
-/* 56*/	udf_byte	partition_contents_use[128];
-/*184*/	udf_Uint32	access_type;
-/*188*/	udf_Uint32	partition_starting_location;
-/*192*/	udf_Uint32	partition_length;
-/*196*/	udf_EntityID	impl_ident;
-/*228*/	udf_byte	impl_use[128];
-/*356*/	udf_zerobyte	reserved[156];
-/*512*/
-} udf_partition_desc;
-
-#define	UDF_PARTITION_FLAG_ALLOCATED	1	/* ECMA-167 3/10.5.3 */
-#define	UDF_ACCESSTYPE_READONLY		1	/* ECMA-167 3/10.5.7 */
-
-typedef struct udf_type_1_partition_map_ {	/* TR/71 2.6.8 */
-/*0*/	udf_Uint8	partition_map_type;
-/*1*/	udf_Uint8	partition_map_length;
-/*2*/	udf_Uint16	volume_seq_number;
-/*4*/	udf_Uint16	partition_number;
-/*6*/
-} udf_type_1_partition_map;
-
-#define	UDF_PARTITION_MAP_TYPE_1	1
-
-typedef struct udf_logical_volume_desc_ {	/* TR/71 2.6.7 */
-/*  0*/	udf_tag		desc_tag;
-/* 16*/	udf_Uint32	volume_desc_seq_number;
-/* 20*/	udf_charspec	desc_character_set;
-/* 84*/	udf_dstring	logical_volume_ident[128];
-/*212*/	udf_Uint32	logical_block_size;
-/*216*/	udf_EntityID	domain_ident;
-/*248*/	udf_long_ad	logical_volume_contents_use;
-/*264*/	udf_Uint32	map_table_length;
-/*268*/	udf_Uint32	number_of_partition_maps;
-/*272*/	udf_EntityID	impl_ident;
-/*304*/	udf_byte	impl_use[128];
-/*432*/	udf_extent_ad	integrity_seq_extent;
-/*440*/	udf_type_1_partition_map	partition_map[1];
-/*446*/
-} udf_logical_volume_desc;
-
-typedef struct udf_unallocated_space_desc_ {	/* TR/71 2.6.9 */
-/* 0*/	udf_tag		desc_tag;
-/*16*/	udf_Uint32	volume_desc_seq_number;
-/*20*/	udf_Uint32	number_of_allocation_descs;
-/*24*/	/*udf_extent_ad	allocation_descs[0];*/
-} udf_unallocated_space_desc;
-
-typedef struct udf_terminating_desc_ {		/* TR/71 2.6.10 */
-/*  0*/	udf_tag		desc_tag;
-/* 16*/	udf_zerobyte	reserved[496];
-/*512*/
-} udf_terminating_desc;
-
-typedef struct udf_logical_volume_integrity_desc_impl_use_field_ {	/* TR/71 2.7.3 */
-/* 0*/	udf_EntityID	impl_id;
-/*32*/	udf_Uint32	number_of_files;
-/*36*/	udf_Uint32	number_of_directories;
-/*40*/	udf_Uint16	minimum_udf_read_revision;
-/*42*/	udf_Uint16	minimum_udf_write_revision;
-/*44*/	udf_Uint16	maximum_udf_write_revision;
-/*46*/	/*udf_byte	impl_use[0];*/
-} udf_logical_volume_integrity_desc_impl_use_field;
-
-typedef struct udf_logical_volume_integrity_desc_contents_use_field_ {	/* TR/71 2.7.2 */
-	udf_Uint64	unique_id;
-	udf_zerobyte	reserved[24];
-} udf_logical_volume_integrity_desc_contents_use_field;
-
-typedef struct udf_logical_volume_integrity_desc_ {	/* TR/71 2.7.1 */
-/* 0*/	udf_tag		desc_tag;
-/*16*/	udf_timestamp	recording_date;
-/*28*/	udf_Uint32	integrity_type;
-/*32*/	udf_extent_ad	next_integrity_extent;
-/*40*/	udf_logical_volume_integrity_desc_contents_use_field	logical_volume_contents_use;
-/*72*/	udf_Uint32	number_of_partitions;
-/*76*/	udf_Uint32	length_of_impl_use;
-/*80*/	udf_Uint32	free_space_table;
-/*84*/	udf_Uint32	size_table;
-/*88*/	udf_logical_volume_integrity_desc_impl_use_field	impl_use;
-} udf_logical_volume_integrity_desc;
-
-#define	UDF_INTEGRITY_TYPE_CLOSE	1	/* ECMA-167 3/10.10.3 */
-
-typedef struct udf_file_set_desc_ {		/* TR/71 3.3.1 */
-/* 0*/	udf_tag		desc_tag;
-/*16*/	udf_timestamp	recording_date_and_time;
-/*28*/	udf_Uint16	interchange_level;
-/*30*/	udf_Uint16	maximum_interchange_level;
-/*32*/	udf_Uint32	character_set_list;
-/*36*/	udf_Uint32	maximum_character_set_list;
-/*40*/	udf_Uint32	file_set_number;
-/*44*/	udf_Uint32	file_set_desc_number;
-/*48*/	udf_charspec	logical_volume_ident_character_set;
-/*112*/	udf_dstring	logical_volume_ident[128];
-/*240*/	udf_charspec	file_set_character_set;
-/*304*/	udf_dstring	file_set_ident[32];
-/*336*/	udf_dstring	copyright_file_ident[32];
-/*368*/	udf_dstring	abstract_file_ident[32];
-/*400*/	udf_long_ad	root_directory_icb;
-/*416*/	udf_EntityID	domain_ident;
-/*448*/	udf_long_ad	next_extent;
-/*464*/	udf_zerobyte	reserved[48];
-/*512*/
-} udf_file_set_desc;
-
-typedef struct udf_file_ident_desc_ {		/* TR/71 3.4.1 */
-/* 0*/	udf_tag		desc_tag;
-/*16*/	udf_Uint16	file_version_number;
-/*18*/	udf_Uint8	file_characteristics;
-/*19*/	udf_Uint8	length_of_file_ident;
-/*20*/	udf_long_ad	icb;
-/*36*/	udf_Uint16	length_of_impl_use;
-/*38*/	/*udf_EntityID	impl_use;*/
-/*38*/	udf_dchar	file_ident[1];
-	/*udf_zerobyte	padding[0/1/2/3];*/
-} udf_file_ident_desc;
-
-#define	UDF_FILE_CHARACTERISTIC_HIDDEN		1	/* ECMA-167 4/14.4.3 */
-#define	UDF_FILE_CHARACTERISTIC_DIRECTORY	2
-#define	UDF_FILE_CHARACTERISTIC_DELETED		4
-#define	UDF_FILE_CHARACTERISTIC_PARENT		8
-
-typedef struct udf_icbtag_ {			/* TR/71 3.5.2 */
-/* 0*/	udf_Uint32	prior_recorded_number_of_direct_entries;
-/* 4*/	udf_Uint16	strategy_type;
-/* 6*/	udf_Uint16	strategy_parameter;
-/* 8*/	udf_Uint16	maximum_number_of_entries;
-/*10*/	udf_zerobyte	reserved;
-/*11*/	udf_Uint8	file_type;
-/*12*/	udf_lb_addr	parent_icb_location;
-/*18*/	udf_Uint16	flags;
-/*20*/
-} udf_icbtag;
-
-#define	UDF_ICBTAG_FILETYPE_DIRECTORY	4	/* ECMA-167 4/14.6.6 */
-#define	UDF_ICBTAG_FILETYPE_BYTESEQ	5
-
-#define	UDF_ICBTAG_FLAG_MASK_AD_TYPE	7	/* TR/71 3.5.3 */
-#define	UDF_ICBTAG_FLAG_SHORT_AD	0
-#define	UDF_ICBTAG_FLAG_DIRECTORY_SORT	8
-#define	UDF_ICBTAG_FLAG_NONRELOCATABLE	16
-#define	UDF_ICBTAG_FLAG_ARCHIVE		32
-#define	UDF_ICBTAG_FLAG_SETUID		64
-#define	UDF_ICBTAG_FLAG_SETGID		128
-#define	UDF_ICBTAG_FLAG_STICKY		256
-#define	UDF_ICBTAG_FLAG_CONTIGUOUS	512
-#define	UDF_ICBTAG_FLAG_SYSTEM		1024
-#define	UDF_ICBTAG_FLAG_TRANSFORMED	2048
-#define	UDF_ICBTAG_FLAG_MULTI_VERSIONS	4096
-
-typedef struct udf_ext_attribute_header_desc_ {	/* TR/71 3.6.1 */
-/* 0*/	udf_tag		desc_tag;
-/*16*/	udf_Uint32	impl_attributes_location;
-/*20*/	udf_Uint32	application_attributes_location;
-/*24*/
-} udf_ext_attribute_header_desc;
-
-typedef struct udf_ext_attribute_free_ea_space_ {	/* TR/71 3.6.{2,3} */
-/* 0*/	udf_Uint32	attribute_type;		/* = 2048 */
-/* 4*/	udf_Uint8	attribute_subtype;	/* = 1 */
-/* 5*/	udf_zerobyte	reserved[3];
-/* 8*/	udf_Uint32	attribute_length;	/* = 52 */
-/*12*/	udf_Uint32	impl_use_length;	/* = 4 */
-/*16*/	udf_EntityID	impl_ident;		/* "*UDF FreeEASpace" */
-/*48*/	udf_Uint16	header_checksum;
-/*50*/	udf_Uint16	free_ea_space;		/* = 0 */
-/*52*/
-} udf_ext_attribute_free_ea_space;
-
-typedef struct udf_ext_attribute_dvd_cgms_info_ {	/* TR/71 3.6.{2,4} */
-/* 0*/	udf_Uint32	attribute_type;		/* = 2048 */
-/* 4*/	udf_Uint8	attribute_subtype;	/* = 1 */
-/* 5*/	udf_zerobyte	reserved[3];
-/* 8*/	udf_Uint32	attribute_length;	/* = 56 */
-/*12*/	udf_Uint32	impl_use_length;	/* = 8 */
-/*16*/	udf_EntityID	impl_ident;		/* "*UDF DVD CGMS Info" */
-/*48*/	udf_Uint16	header_checksum;
-/*50*/	udf_byte	cgms_info;
-/*51*/	udf_Uint8	data_structure_type;
-/*52*/	udf_byte	protection_system_info[4];
-/*56*/
-} udf_ext_attribute_dvd_cgms_info;
-
-#define	UDF_CGMSINFO_NO_COPIES			48	/* TR/71 3.6.4 */
-#define	UDF_CGMSINFO_ONE_GENERATION		32
-#define	UDF_CGMSINFO_UNLIMITED_COPIES		0
-#define	UDF_CGMSINFO_FLAG_COPYRIGHTED_MATERIAL	128
-
-typedef struct udf_file_entry_ {		/* TR/71 3.5.1 */
-/* 0*/	udf_tag		desc_tag;
-/*16*/	udf_icbtag	icb_tag;
-/*36*/	udf_Uint32	uid;
-/*40*/	udf_Uint32	gid;
-/*44*/	udf_Uint32	permissions;
-/*48*/	udf_Uint16	file_link_count;
-/*50*/	udf_Uint8	record_format;
-/*51*/	udf_Uint8	record_display_attributes;
-/*52*/	udf_Uint32	record_length;
-/*56*/	udf_Uint64	info_length;
-/*64*/	udf_Uint64	logical_blocks_recorded;
-/*72*/	udf_timestamp	access_time;
-/*84*/	udf_timestamp	modification_time;
-/*96*/	udf_timestamp	attribute_time;
-/*108*/	udf_Uint32	checkpoint;
-/*112*/	udf_long_ad	ext_attribute_icb;
-/*128*/	udf_EntityID	impl_ident;
-/*160*/	udf_Uint64	unique_id;
-/*168*/	udf_Uint32	length_of_ext_attributes;
-/*172*/	udf_Uint32	length_of_allocation_descs;
-#if 0
-/*176*/	udf_ext_attribute_header_desc	ext_attribute_header;
-/*200*/	udf_ext_attribute_free_ea_space	ext_attribute_free_ea_space;
-/*252*/	udf_ext_attribute_dvd_cgms_info	ext_attribute_dvd_cgms_info;
-/*308*/	udf_short_ad	allocation_desc;
-/*316*/
-#else
-/*176*/	udf_short_ad	allocation_desc;
-/*184*/
-#endif
-} udf_file_entry;
-
-/*
- * (U,G,O) = (owner, group, other)
- * (X,R) = (execute, read)
- *
- * There are Write, Change Attribute and Delete permissions also,
- * but it is not permitted to set them on DVD Read-Only media.
- */
-#define	UDF_FILEENTRY_PERMISSION_OX	1	/* TR/71 3.5.4 */
-#define	UDF_FILEENTRY_PERMISSION_OR	4
-#define	UDF_FILEENTRY_PERMISSION_GX	32
-#define	UDF_FILEENTRY_PERMISSION_GR	128
-#define	UDF_FILEENTRY_PERMISSION_UX	1024
-#define	UDF_FILEENTRY_PERMISSION_UR	4096
-
-
-#endif	/* _UDF_FS_H */

Copied: cdrkit/trunk/genisoimage/udf_fs.h (from rev 452, cdrkit/trunk/mkisoimage/udf_fs.h)

Deleted: cdrkit/trunk/genisoimage/vms.c
===================================================================
--- cdrkit/trunk/mkisoimage/vms.c	2006-11-23 21:37:32 UTC (rev 450)
+++ cdrkit/trunk/genisoimage/vms.c	2006-11-23 22:11:41 UTC (rev 453)
@@ -1,325 +0,0 @@
-/*
- * This file has been modified for the cdrkit suite.
- *
- * The behaviour and appearence of the program code below can differ to a major
- * extent from the version distributed by the original author(s).
- *
- * For details, see Changelog file distributed with the cdrkit package. If you
- * received this file from another source then ask the distributing person for
- * a log of modifications.
- *
- */
-
-/* @(#)vms.c	1.9 04/03/04 joerg */
-#ifndef lint
-static	char sccsid[] =
-	"@(#)vms.c	1.9 04/03/04 joerg";
-
-#endif
-/*
- * File vms.c - assorted bletcherous hacks for VMS.
- *
- * Written by Eric Youngdale (1993).
- *
- */
-
-#include <mconfig.h>
-#ifdef VMS
-#define	opendir	fake_opendir
-#include "mkisoimage.h"
-#undef opendir
-#include <rms.h>
-#include <descrip.h>
-#include <ssdef.h>
-
-static struct RAB	*rab;		/* used for external mailfiles */
-static int		rms_status;
-
-static
-error_exit(char *text)
-{
-	fprintf(stderr, "%s\n", text);
-	exit(33);
-}
-
-
-char *strrchr(const char *, char);
-
-int
-VMS_stat(char *path, struct stat * spnt)
-{
-	char		*spath;
-	char		sbuffer[255];
-	char		*pnt,
-			*ppnt;
-	char		*pnt1;
-
-	ppnt = strrchr(path, ']');
-	if (ppnt)
-		ppnt++;
-	else
-		ppnt = path;
-
-	spath = path;
-
-	if (strcmp(ppnt, ".") == 0 || strcmp(ppnt, "..") == 0) {
-		strcpy(sbuffer, path);
-
-		/* Find end of actual name */
-		pnt = strrchr(sbuffer, ']');
-		if (!pnt)
-			return (0);
-
-		pnt1 = pnt;
-		while (*pnt1 != '[' && *pnt1 != '.')
-			pnt1--;
-
-		if (*pnt1 != '[' && strcmp(ppnt, "..") == 0) {
-			pnt1--;
-			while (*pnt1 != '[' && *pnt1 != '.')
-				pnt1--;
-		};
-
-		if (*pnt1 == '.') {
-			*pnt1 = ']';
-			pnt = pnt1;
-			while (*pnt != '.' && *pnt != ']')
-				pnt++;
-			*pnt++ = ']';
-			while (*pnt != '.' && *pnt != ']')
-				pnt++;
-			*pnt = 0;
-			strcat(sbuffer, ".DIR;1");
-		};
-
-		if (*pnt1 == '[') {
-			pnt1++;
-			*pnt1 = 0;
-			strcat(pnt1, "000000]");
-			pnt1 = strrchr(path, '[') + 1;
-			pnt = sbuffer + strlen(sbuffer);
-			while (*pnt1 && *pnt1 != '.' && *pnt1 != ']')
-				*pnt++ = *pnt1++;
-			*pnt = 0;
-			strcat(sbuffer, ".DIR;1");
-		};
-
-		spath = sbuffer;
-	};
-	return (stat_filter(spath, spnt));
-}
-
-static int		dircontext[32] = {0, };
-static char		*searchpath[32];
-static struct direct	d_entry[32];
-
-int			optind = 0;
-char			*optarg;
-
-int
-getopt(int argc, char *argv[], char *flags)
-{
-	char		*pnt;
-	char		c;
-
-	optind++;
-	if (*argv[optind] != '-')
-		return (EOF);
-	optarg = 0;
-
-	c = *(argv[optind] + 1);
-	pnt = (char *) strchr(flags, c);
-	if (!pnt)
-		return (c);	/* Not found */
-	if (pnt[1] == ':') {
-		optind++;
-		optarg = argv[optind];
-	};
-	return (c);
-}
-
-void
-vms_path_fixup(char *name)
-{
-	char		*pnt1;
-
-	pnt1 = name + strlen(name) - 6;
-
-	/* First strip the .DIR;1 */
-	if (strcmp(pnt1, ".DIR;1") == 0)
-		*pnt1 = 0;
-
-	pnt1 = (char *) strrchr(name, ']');
-	if (pnt1) {
-		if (pnt1[1] == 0)
-			return;
-		*pnt1 = '.';
-		strcat(name, "]");
-		return;
-	};
-	pnt1 = (char *) strrchr(name, '>');
-	if (pnt1) {
-		if (pnt1[1] == 0)
-			return;
-		*pnt1 = '.';
-		strcat(name, ">");
-		return;
-	};
-}
-
-int
-opendir(char *path)
-{
-	int		i;
-
-	for (i = 1; i < 32; i++) {
-		if (dircontext[i] == 0) {
-			dircontext[i] = -1;
-			searchpath[i] = (char *) e_malloc(strlen(path) + 6);
-			strcpy(searchpath[i], path);
-			vms_path_fixup(searchpath[i]);
-			strcat(searchpath[i], "*.*.*");
-			return (i);
-		};
-	};
-	exit(0);
-}
-
-struct direct  *
-readdir(int context)
-{
-	int		i;
-	char		cresult[100];
-	char		*pnt;
-	int		status;
-
-	$DESCRIPTOR(dpath, searchpath[context]);
-	$DESCRIPTOR(result, cresult);
-
-	if (dircontext[context] == -1) {
-		dircontext[context] = -2;
-		strcpy(d_entry[context].d_name, ".");
-		return (&d_entry[context]);
-	};
-
-	if (dircontext[context] == -2) {
-		dircontext[context] = -3;
-		strcpy(d_entry[context].d_name, "..");
-		return (&d_entry[context]);
-	};
-
-	if (dircontext[context] == -3)
-		dircontext[context] = 0;
-
-	dpath.dsc$w_length = strlen(searchpath[context]);
-	lib$find_file(&dpath, &result, &dircontext[context],
-		0, 0, &status, 0);
-
-	if (status == SS$_NOMOREFILES)
-		return (0);
-
-	/* Now trim trailing spaces from the name */
-	i = result.dsc$w_length - 1;
-	while (i && cresult[i] == ' ')
-		i--;
-	cresult[i + 1] = 0;
-
-	/* Now locate the actual portion of the file we want */
-
-	pnt = (char *) strrchr(cresult, ']');
-	if (pnt)
-		pnt++;
-	else
-		pnt = cresult;
-
-	strcpy(d_entry[context].d_name, pnt);
-	return (&d_entry[context]);
-}
-
-void
-closedir(int context)
-{
-	lib$find_file_end(&dircontext[context]);
-	free(searchpath[context]);
-	searchpath[context] = (char *) 0;
-	dircontext[context] = 0;
-}
-
-static
-open_file(char *fn)
-{
-	/*
-	 * this routine initializes a rab and  fab required to get the
-	 * correct definition of the external data file used by mail
-	 */
-	struct FAB	*fab;
-
-	rab = (struct RAB *) e_malloc(sizeof (struct RAB));
-	fab = (struct FAB *) e_malloc(sizeof (struct FAB));
-
-	*rab = cc$rms_rab;	/* initialize RAB */
-	rab->rab$l_fab = fab;
-
-	*fab = cc$rms_fab;	/* initialize FAB */
-	fab->fab$l_fna = fn;
-	fab->fab$b_fns = strlen(fn);
-	fab->fab$w_mrs = 512;
-	fab->fab$b_fac = FAB$M_BIO | FAB$M_GET;
-	fab->fab$b_org = FAB$C_SEQ;
-	fab->fab$b_rfm = FAB$C_FIX;
-	fab->fab$l_xab = (char *) 0;
-
-	rms_status = sys$open(rab->rab$l_fab);
-	if (rms_status != RMS$_NORMAL && rms_status != RMS$_CREATED)
-		error_exit("$OPEN");
-	rms_status = sys$connect(rab);
-	if (rms_status != RMS$_NORMAL)
-		error_exit("$CONNECT");
-	return (1);
-}
-
-static
-close_file(struct RAB * prab)
-{
-	rms_status = sys$close(prab->rab$l_fab);
-	free(prab->rab$l_fab);
-	free(prab);
-	if (rms_status != RMS$_NORMAL)
-		error_exit("$CLOSE");
-}
-
-#define	NSECT 16
-extern unsigned int last_extent_written;
-
-int
-vms_write_one_file(char *filename, off_t size, FILE * outfile)
-{
-	int		status,
-			i;
-	char		buffer[SECTOR_SIZE * NSECT];
-	int		count;
-	int		use;
-	off_t		remain;
-
-	open_file(filename);
-
-	remain = size;
-
-	while (remain > 0) {
-		use = (remain > SECTOR_SIZE * NSECT - 1 ? NSECT * SECTOR_SIZE : remain);
-		use = ROUND_UP(use);	/* Round up to nearest sector boundary */
-		memset(buffer, 0, use);
-		rab->rab$l_ubf = buffer;
-		rab->rab$w_usz = sizeof (buffer);
-		status = sys$read(rab);
-		fwrite(buffer, 1, use, outfile);
-		last_extent_written += use / SECTOR_SIZE;
-		if ((last_extent_written % 1000) < use / SECTOR_SIZE)
-			fprintf(stderr, "%d..", last_extent_written);
-		remain -= use;
-	};
-
-	close_file(rab);
-}
-
-#endif

Copied: cdrkit/trunk/genisoimage/vms.c (from rev 452, cdrkit/trunk/mkisoimage/vms.c)

Deleted: cdrkit/trunk/genisoimage/vms.h
===================================================================
--- cdrkit/trunk/mkisoimage/vms.h	2006-11-23 21:37:32 UTC (rev 450)
+++ cdrkit/trunk/genisoimage/vms.h	2006-11-23 22:11:41 UTC (rev 453)
@@ -1,29 +0,0 @@
-/*
- * This file has been modified for the cdrkit suite.
- *
- * The behaviour and appearence of the program code below can differ to a major
- * extent from the version distributed by the original author(s).
- *
- * For details, see Changelog file distributed with the cdrkit package. If you
- * received this file from another source then ask the distributing person for
- * a log of modifications.
- *
- */
-
-/* @(#)vms.h	1.3 04/03/01 eric */
-/*
- * Header file mkisoimage.h - assorted structure definitions and typecasts.
- *
- *   Written by Eric Youngdale (1993).
- */
-
-#ifdef VMS
-#define	stat(X, Y)	VMS_stat(X, Y)
-#define	lstat		VMS_stat
-
-/* gmtime not available under VMS - make it look like we are in Greenwich */
-#define	gmtime	localtime
-
-extern int	vms_write_one_file(char *filename, off_t size, FILE * outfile);
-
-#endif

Copied: cdrkit/trunk/genisoimage/vms.h (from rev 452, cdrkit/trunk/mkisoimage/vms.h)

Deleted: cdrkit/trunk/genisoimage/volume.c
===================================================================
--- cdrkit/trunk/mkisoimage/volume.c	2006-11-23 21:37:32 UTC (rev 450)
+++ cdrkit/trunk/genisoimage/volume.c	2006-11-23 22:11:41 UTC (rev 453)
@@ -1,732 +0,0 @@
-/*
- * This file has been modified for the cdrkit suite.
- *
- * The behaviour and appearence of the program code below can differ to a major
- * extent from the version distributed by the original author(s).
- *
- * For details, see Changelog file distributed with the cdrkit package. If you
- * received this file from another source then ask the distributing person for
- * a log of modifications.
- *
- */
-
-/* @(#)volume.c	1.14 04/07/09 joerg, Copyright 1997, 1998, 1999, 2000 James Pearson */
-#ifndef lint
-static	char sccsid[] =
-	"@(#)volume.c	1.14 04/07/09 joerg, Copyright 1997, 1998, 1999, 2000 James Pearson";
-#endif
-/*
- *      Copyright (c) 1997, 1998, 1999, 2000 James Pearson
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING.  If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-/*
- *	volume.c: prepare HFS volume for mkhybrid
- *
- *	James Pearson 17/7/97
- *	modified JCP 29/7/97 to improve allocation sizes to cut
- *	down on wasted space. Now uses the HFS "allocation" size rounded
- *	up to the nearest 2048 bytes. Savings can be significant with
- *	a large volume containing lots of smallish files.
- *
- *	Updated for v1.12 - now uses the built in RELOCATED_DIRECTORY
- *	flag for finding the real directory location JCP 8/1/97
- */
-
-#ifdef APPLE_HYB
-
-#include <mconfig.h>
-#include "mkisoimage.h"
-#include <errno.h>
-
-#define	HFS_MIN_SIZE	1600	/* 800k == 1600 HFS blocks */
-
-static hfsvol  *vol_save = 0;	/* used to "destroy" an HFS volume */
-
-static	int	AlcSiz(Ulong);
-static	int	XClpSiz(Ulong);
-static	int	get_vol_size(int);
-int	write_fork(hfsfile * hfp, long tot);
-int	make_mac_volume(struct directory *, int);
-static	int	copy_to_mac_vol(hfsvol *, struct directory *);
-static void	set_dir_info(hfsvol *, struct directory *);
-
-/*
- *	AlcSiz: find allocation size for given volume size
- */
-static int
-AlcSiz(Ulong vlen)
-{
-	int	lpa,
-		drAlBlkSiz;
-
-	/* code extracted from hfs_format() */
-	lpa = 1 + vlen / 65536;
-	drAlBlkSiz = lpa * HFS_BLOCKSZ;
-
-	/*
-	 * now set our "allocation size" to the allocation block rounded up to
-	 * the nearest SECTOR_SIZE (2048 bytes)
-	 */
-	drAlBlkSiz = ROUND_UP(drAlBlkSiz, SECTOR_SIZE);
-
-	return (drAlBlkSiz);
-}
-
-/*
- *	XClpSiz: find the default size of the catalog/extent file
- */
-static int
-XClpSiz(Ulong vlen)
-{
-	int	olpa,
-		lpa,
-		drNmAlBlks,
-		drAlBlkSiz;
-	int	vbmsz,
-		drXTClpSiz;
-
-	/* code extracted from hfs_format() */
-
-	/* get the lpa from our calculated allocation block size */
-	drAlBlkSiz = AlcSiz(vlen);
-	lpa = drAlBlkSiz / HFS_BLOCKSZ;
-
-	vbmsz = (vlen / lpa + 4095) / 4096;
-	drNmAlBlks = (vlen - 5 - vbmsz) / lpa;
-	drXTClpSiz = drNmAlBlks / 128 * drAlBlkSiz;
-
-	/* override the drXTClpSiz size for large volumes */
-	if (drXTClpSiz > hce->max_XTCsize) {
-		drXTClpSiz = hce->max_XTCsize;
-	} else {
-		/*
-		 * make allowances because we have possibly rounded up the
-		 * allocation size get the "original" lpa "
-		 */
-		olpa = 1 + vlen / 65536;
-
-		/* adjust size upwards */
-		drXTClpSiz = ((Ullong)drXTClpSiz * lpa) / olpa;
-	}
-
-	/* round up to the nearest allocation size */
-	drXTClpSiz = ROUND_UP(drXTClpSiz, drAlBlkSiz);
-
-	return (drXTClpSiz);
-}
-
-/*
- *	get_vol_size: get the size of the volume including the extent/catalog
- */
-static int
-get_vol_size(int vblen)
-{
-	int	drXTClpSiz;
-	int	drAlBlkSiz;
-	int	new_vblen;
-
-	/*
-	 * try to estimate a "volume size" based on the code in hfs_format
-	 * - we need the size of the catalog/extents and Desktop files included
-	 * in the volume, as we add this to the end of the ISO volume
-	 */
-	drXTClpSiz = XClpSiz(vblen);
-	drAlBlkSiz = AlcSiz(vblen);
-
-	/*
-	 * catalog file is set at CTC times (default twice) the extents
-	 * file size - hence the (ctc_size + 1) below. The Desktop starts of
-	 * the same size as the "clump size" == 4 x drAlBlkSiz,
-	 * plus a spare drAlBlkSiz for the alternative MDB
-	 */
-	new_vblen = vblen +
-	    ((hce->ctc_size + 1) * drXTClpSiz + 5 * drAlBlkSiz) / HFS_BLOCKSZ;
-
-	return (new_vblen);
-}
-
-/*
- *	write_fork: "write" file data to the volume
- *
- *	This is used to update the HFS file internal structures
- *	but no data is actually written (it's trapped deep down in
- *	libhfs).
- */
-int
-write_fork(hfsfile *hfp, long tot)
-{
-	char		blk[HFS_BLOCKSZ];
-	unsigned short	start;
-	long		len;
-
-	len = tot;
-	/* we need to know where this fork starts */
-	start = hfs_get_drAllocPtr(hfp);
-
-	/* loop through the data a block at a time */
-	while (len >= HFS_BLOCKSZ) {
-		if (hfs_write(hfp, blk, HFS_BLOCKSZ) < 0)
-			return (-1);
-		len -= HFS_BLOCKSZ;
-	}
-	/* write out anything left */
-	if (len)
-		if (hfs_write(hfp, blk, len) < 0)
-			return (-1);
-
-	/*
-	 * set the start of the allocation search to be immediately after
-	 * this fork
-	 */
-	hfs_set_drAllocPtr(hfp, start, tot);
-
-	return (0);
-}
-
-/*
- *	make_mac_volume: "create" an HFS volume using the ISO data
- *
- *	The HFS volume structures are set up (but no data is written yet).
- *
- *	ISO volumes have a allocation size of 2048 bytes - regardless
- *	of the size of the volume. HFS allocation size is depends on volume
- *	size, so we may have to update the ISO structures to add in any
- *	padding.
- */
-int
-make_mac_volume(struct directory  *dpnt, int start_extent)
-{
-	char	vol_name[HFS_MAX_VLEN + 1];	/* Mac volume name */
-	hfsvol	*vol;			/* Mac volume */
-	int	vblen;			/* vol length (HFS blocks) */
-	int	Csize,
-		lastCsize;		/* allocation sizes */
-	int	ret = 0;		/* return value */
-	int	loop = 1;
-
-	/* umount volume if we have had a previous attempt */
-	if (vol_save)
-		if (hfs_umount(vol_save, 0, hfs_lock) < 0)
-			return (-1);
-
-	/* set the default clump size to the ISO block size */
-	Csize = lastCsize = SECTOR_SIZE;
-
-	if (verbose > 1)
-		fprintf(stderr, "Creating HFS Volume info\n");
-
-	/* name or copy ISO volume name to Mac Volume name */
-	strncpy(vol_name, hfs_volume_id ? hfs_volume_id : volume_id,
-								HFS_MAX_VLEN);
-	vol_name[HFS_MAX_VLEN] = '\0';
-
-	/* get initial size of HFS volume (size of current ISO volume) */
-	vblen = (last_extent - session_start) * HFS_BLK_CONV;
-
-	/* make sure volume is at least 800k */
-	if (vblen < HFS_MIN_SIZE)
-		vblen += insert_padding_file(HFS_MIN_SIZE - vblen);
-
-	/*
-	 * add on size of extents/catalog file, but this may mean the
-	 * allocation size will change, so loop round until the
-	 * allocation size doesn't change
-	 */
-	while (loop) {
-		hce->XTCsize = XClpSiz(vblen);
-		vblen = get_vol_size(vblen);
-		Csize = AlcSiz(vblen);
-
-		if (Csize == lastCsize) {
-			/* allocation size hasn't changed, so carry on */
-			loop = 0;
-		} else {
-			/*
-			 * allocation size has changed, so update
-			 * ISO volume size
-			 */
-			if ((vblen = get_adj_size(Csize)) < 0) {
-				sprintf(hce->error,
-					"too many files for HFS volume");
-				return (-1);
-			}
-			vblen +=
-				ROUND_UP((start_extent - session_start) *
-						HFS_BLK_CONV, Csize);
-			lastCsize = Csize;
-		}
-	}
-
-	/* take off the label/map size */
-	vblen -= hce->hfs_map_size;
-
-	hce->hfs_vol_size = vblen;
-
-	/* set the default allocation size for libhfs */
-	hce->Csize = Csize;
-
-	/* format and mount the "volume" */
-	if (hfs_format(hce, 0, vol_name) < 0) {
-		sprintf(hce->error, "can't HFS format %s", vol_name);
-		return (-1);
-	}
-	/*
-	 * update the ISO structures with new start extents and any
-	 * padding required
-	 */
-	if (Csize != SECTOR_SIZE) {
-		last_extent = adj_size(Csize, start_extent,
-					hce->hfs_hdr_size + hce->hfs_map_size);
-		adj_size_other(dpnt);
-	}
-	if ((vol = hfs_mount(hce, 0, 0)) == 0) {
-		sprintf(hce->error, "can't HFS mount %s", vol_name);
-		return (-1);
-	}
-	/* save the volume for possible later use */
-	vol_save = vol;
-
-	/*
-	 * Recursively "copy" the files to the volume
-	 * - we need to know the first allocation block in the volume as
-	 * starting blocks of files are relative to this.
-	 */
-	ret = copy_to_mac_vol(vol, dpnt);
-	if (ret < 0)
-		return (ret);
-
-	/*
-	 * make the Desktop files - I *think* this stops the Mac rebuilding the
-	 * desktop when the CD is mounted on a Mac These will be ignored if they
-	 * already exist
-	 */
-	if (create_dt)
-		ret = make_desktop(vol,
-				(last_extent - session_start) * HFS_BLK_CONV);
-	if (ret < 0)
-		return (ret);
-
-	/* close the volume */
-	if (hfs_flush(vol) < 0)
-		return (-1);
-
-	/* unmount and set the start blocks for the catalog/extents files */
-	if (hfs_umount(vol, (last_extent - session_start) * HFS_BLK_CONV, hfs_lock) < 0)
-		return (-1);
-
-	return (Csize);
-}
-
-#define	TEN 10	/* well, it is! */
-#define	LCHAR "_"
-
-/*
- *	copy_to_mac_vol: copy all files in a directory to corresponding
- *			 Mac folder.
- *
- *	Files are copied recursively to corresponding folders on the Mac
- *	volume. The caller routine needs to do a hfs_chdir before calling this
- *	routine.
- */
-static int
-copy_to_mac_vol(hfsvol *vol, struct directory *node)
-{
-	struct directory_entry	*s_entry;	/* ISO directory entry */
-	struct directory_entry	*s_entry1;	/* tmp ISO directory entry */
-	struct directory	*dpnt;		/* ISO directory */
-
-	hfsfile			*hfp;		/* HFS file */
-	hfsdirent		*ent;		/* HFS file entities */
-	long			id;		/* current HFS folder */
-	long			dext,
-				rext;		/* real data/rsrc start blk */
-	int			ret;		/* result code */
-	int			new_name;	/* HFS file has modified name */
-
-	int			tens;
-	int			digits;
-	int			i;
-
-	/* store the current HFS directory ID */
-	if ((id = hfs_getcwd(vol)) == 0)
-		return (-1);
-
-	if (verbose > 1)
-		fprintf(stderr, "HFS scanning %s\n", node->whole_name);
-
-	/* loop through the ISO directory entries and process files */
-	for (s_entry = node->contents; s_entry; s_entry = s_entry->next) {
-		/* ignore directory and associated (rsrc) files */
-		if (s_entry->isorec.flags[0] & (ISO_DIRECTORY|ISO_ASSOCIATED))
-			continue;
-
-		/* ignore any non-Mac type file */
-		if (!s_entry->hfs_ent)
-			continue;
-
-		/*
-		 * ignore if from a previous session
-		 * - should be trapped above
-		 */
-		if (s_entry->starting_block < session_start)
-			continue;
-
-#ifdef DEBUG
-		fprintf(stderr, " Name = %s", s_entry->whole_name);
-		fprintf(stderr, "   Startb =  %d\n", s_entry->starting_block);
-#endif	/* DEBUG */
-
-		ent = s_entry->hfs_ent;
-
-		/* create file */
-		i = HFS_MAX_FLEN - strlen(ent->name);
-		new_name = 0;
-		tens = TEN;
-		digits = 1;
-
-		while (1) {
-			/*
-			 * try to open file - if it exists,
-			 * then append '_' to the name and try again
-			 */
-			errno = 0;
-			if ((hfs_create(vol, ent->name, ent->u.file.type,
-						ent->u.file.creator)) < 0) {
-				if (errno != EEXIST) {
-					/*
-					 * not an "exist" error, or we can't
-					 * append as the filename is already
-					 * HFS_MAX_FLEN chars
-					 */
-					sprintf(hce->error,
-						"can't HFS create file %s",
-						s_entry->whole_name);
-					return (-1);
-				} else if (i == 0) {
-					/*
-					 * File name at max HFS length
-					 * - make unique name
-					 */
-					if (!new_name)
-						new_name++;
-
-					sprintf(ent->name +
-						HFS_MAX_FLEN - digits - 1,
-						"%s%d", LCHAR, new_name);
-					new_name++;
-					if (new_name == tens) {
-						tens *= TEN;
-						digits++;
-					}
-				} else {
-					/* append '_' to get new name */
-					strcat(ent->name, LCHAR);
-					i--;
-					new_name = 1;
-				}
-			} else
-				break;
-		}
-
-		/* warn that we have a new name */
-		if (new_name && verbose > 0) {
-			fprintf(stderr, "Using HFS name: %s for %s\n",
-				ent->name,
-				s_entry->whole_name);
-		}
-		/* open file */
-		if ((hfp = hfs_open(vol, ent->name)) == 0) {
-			sprintf(hce->error, "can't HFS open %s",
-				s_entry->whole_name);
-			return (-1);
-		}
-		/* if it has a data fork, then "write" it out */
-		if (ent->u.file.dsize)
-			write_fork(hfp, ent->u.file.dsize);
-
-		/* if it has a resource fork, set the fork and "write" it out */
-		if (ent->u.file.rsize) {
-			if ((hfs_setfork(hfp, 1)) < 0)
-				return (-1);
-			write_fork(hfp, ent->u.file.rsize);
-		}
-
-		/* make file invisible if ISO9660 hidden */
-		if (s_entry->de_flags & HIDDEN_FILE)
-			ent->fdflags |= HFS_FNDR_ISINVISIBLE;
-
-		/* update any HFS file attributes */
-		if ((hfs_fsetattr(hfp, ent)) < 0) {
-			sprintf(hce->error, "can't HFS set attributes %s",
-				s_entry->whole_name);
-			return (-1);
-		}
-		/*
-		 * get the ISO starting block of data fork (may be zero)
-		 * and convert to the equivalent HFS block
-		 */
-		if (ent->u.file.dsize) {
-			dext = (s_entry->starting_block - session_start) *
-								HFS_BLK_CONV;
-		} else {
-			dext = 0;
-		}
-
-		/*
-		 * if the file has a resource fork (associated file),
-		 * get it's ISO starting block and convert as above
-		 */
-		if (s_entry->assoc && ent->u.file.rsize) {
-			rext =
-			    (s_entry->assoc->starting_block - session_start) *
-								HFS_BLK_CONV;
-		} else {
-			rext = 0;
-		}
-
-		/* close the file and update the starting blocks */
-		if (hfs_close(hfp, dext, rext) < 0) {
-			sprintf(hce->error, "can't HFS close file %s",
-				s_entry->whole_name);
-			return (-1);
-		}
-	}
-
-	/* set folder info and custom icon (if it exists) */
-	set_dir_info(vol, node);
-
-	/*
-	 * process sub-directories  - have a slight problem here,
-	 * if the directory had been relocated, then we need to find the
-	 * real directory - we do this by first finding the
-	 * real directory_entry, and then finding it's directory info
-	 */
-
-	/* following code taken from joliet.c */
-	for (s_entry = node->contents; s_entry; s_entry = s_entry->next) {
-		if ((s_entry->de_flags & RELOCATED_DIRECTORY) != 0) {
-			/*
-			 * if the directory has been reloacted, then search the
-			 * relocated directory for the real entry
-			 */
-			for (s_entry1 = reloc_dir->contents; s_entry1;
-						s_entry1 = s_entry1->next) {
-				if (s_entry1->parent_rec == s_entry)
-					break;
-			}
-
-			/* have a problem - can't find the real directory */
-			if (s_entry1 == NULL) {
-				sprintf(hce->error,
-					"can't locate relocated directory %s",
-					s_entry->whole_name);
-				return (-1);
-			}
-		} else
-			s_entry1 = s_entry;
-
-		/* now have the correct entry - now find the actual directory */
-		if ((s_entry1->isorec.flags[0] & ISO_DIRECTORY) &&
-				strcmp(s_entry1->name, ".") &&
-				strcmp(s_entry1->name, "..")) {
-			if ((s_entry->de_flags & RELOCATED_DIRECTORY) != 0)
-				dpnt = reloc_dir->subdir;
-			else
-				dpnt = node->subdir;
-
-			while (1) {
-				if (dpnt->self == s_entry1)
-					break;
-				dpnt = dpnt->next;
-				if (!dpnt) {
-					sprintf(hce->error,
-					    "can't find directory location %s",
-							s_entry1->whole_name);
-					return (-1);
-				}
-			}
-			/*
-			 * now have the correct directory
-			 * - so do the HFS stuff
-			 */
-			ent = dpnt->hfs_ent;
-
-			/*
-			 * if we don't have hfs entries, then this is a "deep"
-			 * directory - this will be processed later
-			 */
-			if (!ent)
-				continue;
-
-			/* make sub-folder */
-			i = HFS_MAX_FLEN - strlen(ent->name);
-			new_name = 0;
-			tens = TEN;
-			digits = 1;
-
-			while (1) {
-				/*
-				 * try to create new directory
-				 * - if it exists, then append '_' to the name
-				 * and try again
-				 */
-				errno = 0;
-				if (hfs_mkdir(vol, ent->name) < 0) {
-					if (errno != EEXIST) {
-						/*
-						 * not an "exist" error,
-						 * or we can't append as the
-						 * filename is already
-						 * HFS_MAX_FLEN chars
-						 */
-						sprintf(hce->error,
-						    "can't HFS create folder %s",
-							s_entry->whole_name);
-						return (-1);
-					} else if (i == 0) {
-						/*
-						 * File name at max HFS length
-						 * - make unique name
-						 */
-						if (!new_name)
-							new_name++;
-
-						sprintf(ent->name +
-						    HFS_MAX_FLEN - digits - 1,
-						    "%s%d", LCHAR, new_name);
-						new_name++;
-						if (new_name == tens) {
-							tens *= TEN;
-							digits++;
-						}
-					} else {
-						/* append '_' to get new name */
-						strcat(ent->name, LCHAR);
-						i--;
-						new_name = 1;
-					}
-				} else
-					break;
-			}
-
-			/* warn that we have a new name */
-			if (new_name && verbose > 0) {
-				fprintf(stderr, "Using HFS name: %s for %s\n",
-							ent->name,
-							s_entry->whole_name);
-			}
-			/* see if we need to "bless" this folder */
-			if (hfs_bless && strcmp(s_entry->whole_name, hfs_bless)
-					== 0) {
-				hfs_stat(vol, ent->name, ent);
-				hfs_vsetbless(vol, ent->cnid);
-				if (verbose > 0) {
-					fprintf(stderr, "Blessing %s (%s)\n",
-							ent->name,
-							s_entry->whole_name);
-				}
-				/* stop any further checks */
-				hfs_bless = NULL;
-			}
-			/* change to sub-folder */
-			if (hfs_chdir(vol, ent->name) < 0)
-				return (-1);
-
-			/* recursively copy files ... */
-			ret = copy_to_mac_vol(vol, dpnt);
-			if (ret < 0)
-				return (ret);
-
-			/* change back to this folder */
-			if (hfs_setcwd(vol, id) < 0)
-				return (-1);
-		}
-	}
-
-	return (0);
-}
-
-/*
- *	set_dir_info:	Set directory info for a file - also use a custom
- *			Icon - if it exists.
- *
- *	Sets folder' layout (window layout, view, scroll bars etc)
- *
- *	Set the 'HFS_FNDR_HASCUSTOMICON' bit of the folder flags
- *	if a file called 'Icon\r' exists in the folder
- *
- *	Also makes sure the Icon file is invisible
- *	Don't worry if any of this fails ...
- *
- *	Thanks to Rob Leslie <rob at mars.org> for how to do this.
- */
-
-#define	ICON	"Icon"
-
-static void
-set_dir_info(hfsvol *vol, struct directory *de)
-{
-	hfsdirent	*ent = de->hfs_ent;
-	hfsdirent	ent1;
-	char		name[HFS_MAX_FLEN + 1];
-	unsigned short	flags = 0;
-
-	memset(&ent1, 0, sizeof (hfsdirent));
-
-	sprintf(name, "%s\r", ICON);
-
-	/* get the attributes for the Icon file */
-	if (hfs_stat(vol, name, &ent1) == 0) {
-
-		/* make sure it is invisible */
-		ent1.fdflags |= HFS_FNDR_ISINVISIBLE;
-
-		/* set the new attributes for the Icon file */
-		hfs_setattr(vol, name, &ent1);
-
-		/* flag the folder as having a custom icon */
-		flags |= HFS_FNDR_HASCUSTOMICON;
-	}
-
-	/* make the current folder invisible if ISO9660 hidden */
-	if (de->self->de_flags & HIDDEN_FILE) {
-		flags |= HFS_FNDR_ISINVISIBLE;
-	}
-
-	/* may not have an hfs_ent for this directory */
-	if (ent == NULL) {
-		ent = &ent1;
-		memset(ent, 0, sizeof (hfsdirent));
-
-		/* get the attributes for the folder */
-		if (hfs_stat(vol, ":", ent) < 0)
-			return;
-	}
-
-	/* set HFS_FNDR_HASCUSTOMICON/HFS_FNDR_ISINVISIBLE if needed */
-	ent->fdflags |= flags;
-
-	/* set the new attributes for the folder */
-	if (hfs_setattr(vol, ":", ent) < 0) {
-		/*
-		 * Only needed if we add things after this if statement.
-		 */
-/*		return;*/
-	}
-}
-
-#endif	/* APPLE_HYB */

Copied: cdrkit/trunk/genisoimage/volume.c (from rev 452, cdrkit/trunk/mkisoimage/volume.c)

Deleted: cdrkit/trunk/genisoimage/write.c
===================================================================
--- cdrkit/trunk/mkisoimage/write.c	2006-11-23 21:37:32 UTC (rev 450)
+++ cdrkit/trunk/genisoimage/write.c	2006-11-23 22:11:41 UTC (rev 453)
@@ -1,2847 +0,0 @@
-/*
- * This file has been modified for the cdrkit suite.
- *
- * The behaviour and appearence of the program code below can differ to a major
- * extent from the version distributed by the original author(s).
- *
- * For details, see Changelog file distributed with the cdrkit package. If you
- * received this file from another source then ask the distributing person for
- * a log of modifications.
- *
- */
-
-/* @(#)write.c	1.88 06/02/01 joerg */
-#ifndef lint
-static	char sccsid[] =
-	"@(#)write.c	1.88 06/02/01 joerg";
-#endif
-/*
- * Program write.c - dump memory  structures to  file for iso9660 filesystem.
- *
- * Written by Eric Youngdale (1993).
- *
- * Copyright 1993 Yggdrasil Computing, Incorporated
- * Copyright (c) 1999-2003 J. Schilling
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-/* APPLE_HYB James Pearson j.pearson at ge.ucl.ac.uk 23/2/2000 */
-
-#include <mconfig.h>
-#include "mkisoimage.h"
-#include <timedefs.h>
-#include <fctldefs.h>
-#ifdef SORTING
-#include "match.h"
-#endif /* SORTING */
-#include <errno.h>
-#include <schily.h>
-#ifdef DVD_VIDEO
-#include "dvd_reader.h"
-#include "dvd_file.h"
-#include "ifo_read.h"
-#endif
-#ifdef APPLE_HYB
-#include <ctype.h>
-#endif
-
-#ifdef	VMS
-#include "vms.h"
-#endif
-
-/* Max number of sectors we will write at  one time */
-#define	NSECT 16
-
-/* Counters for statistics */
-
-static int	table_size = 0;
-static int	total_dir_size = 0;
-static int	rockridge_size = 0;
-static struct directory **pathlist;
-static int	next_path_index = 1;
-static int	sort_goof;
-
-static int	is_rr_dir = 0;
-
-struct output_fragment *out_tail;
-struct output_fragment *out_list;
-
-struct iso_primary_descriptor vol_desc;
-
-void	set_721(char *pnt, unsigned int i);
-void	set_722(char *pnt, unsigned int i);
-void	set_723(char *pnt, unsigned int i);
-void	set_731(char *pnt, unsigned int i);
-void	set_732(char *pnt, unsigned int i);
-void	set_733(char *pnt, unsigned int i);
-int	get_731(char *p);
-int	get_732(char *p);
-int	get_733(char *p);
-static	int	xawrite(void *buffer, int size, int count, FILE *file, 
-							  int submode, BOOL islast);
-void	xfwrite(void *buffer, int size, int count, FILE *file, int submode, 
-				  BOOL islast);
-static 	int	assign_directory_addresses(struct directory *node);
-#ifdef APPLE_HYB
-static 	void	write_one_file(char *filename, off_t size, FILE *outfile, 
-										off_t off);
-#else
-static 	void	write_one_file(char *filename, off_t size, FILE *outfile);
-#endif
-static 	void	write_files(FILE *outfile);
-#if 0
-static 	void	dump_filelist	__PR((void));
-#endif
-static 	int	compare_dirs(const void *rr, const void *ll);
-int	sort_directory(struct directory_entry **sort_dir, int rr);
-static 	int	root_gen(void);
-static 	BOOL	assign_file_addresses(struct directory *dpnt);
-static 	void	free_one_directory(struct directory *dpnt);
-static 	void	free_directories(struct directory *dpnt);
-void	generate_one_directory(struct directory *dpnt, FILE *outfile);
-static 	void	build_pathlist(struct directory *node);
-static 	int	compare_paths(void const *r, void const *l);
-static 	int	generate_path_tables(void);
-void	memcpy_max(char *to, char *from, int max);
-void	outputlist_insert(struct output_fragment *frag);
-static 	int	file_write(FILE *outfile);
-static 	int	pvd_write(FILE *outfile);
-static 	int	xpvd_write(FILE *outfile);
-static 	int	evd_write(FILE *outfile);
-static 	int	vers_write(FILE *outfile);
-static 	int	graftcp(char *to, char *from, char *ep);
-static 	int	pathcp(char *to, char *from, char *ep);
-static 	int	pathtab_write(FILE *outfile);
-static 	int	exten_write(FILE *outfile);
-int	oneblock_size(int starting_extent);
-static 	int	pathtab_size(int starting_extent);
-static 	int	startpad_size(int starting_extent);
-static 	int	interpad_size(int starting_extent);
-static 	int	endpad_size(int starting_extent);
-static 	int	file_gen(void);
-static 	int	dirtree_dump(void);
-static 	int	dirtree_fixup(int starting_extent);
-static 	int	dirtree_size(int starting_extent);
-static 	int	ext_size(int starting_extent);
-static 	int	dirtree_write(FILE *outfile);
-static 	int	dirtree_cleanup(FILE *outfile);
-static 	int	startpad_write(FILE *outfile);
-static 	int	interpad_write(FILE *outfile);
-static 	int	endpad_write(FILE *outfile);
-#ifdef APPLE_HYB
-static 	int	hfs_pad;
-static 	int	hfs_get_parms(char *key);
-static 	void	hfs_file_gen(int start_extent);
-static 	void	gen_prepboot(void);
-Ulong	get_adj_size(int Csize);
-int	adj_size(int Csize, int start_extent, int extra);
-void	adj_size_other(struct directory *dpnt);
-static 	int	hfs_hce_write(FILE * outfile);
-int	insert_padding_file(int size);
-#endif	/* APPLE_HYB */
-
-#ifdef SORTING
-static 	int	compare_sort(const void * rr, const void * ll);
-static 	void	reassign_link_addresses(struct directory * dpnt);
-static 	int	sort_file_addresses(void);
-#endif /* SORTING */
-
-/*
- * Routines to actually write the disc.  We write sequentially so that
- * we could write a tape, or write the disc directly
- */
-#define	FILL_SPACE(X)	memset(vol_desc.X, ' ', sizeof (vol_desc.X))
-
-void
-set_721(char *pnt, unsigned int i)
-{
-	pnt[0] = i & 0xff;
-	pnt[1] = (i >> 8) & 0xff;
-}
-
-void
-set_722(char *pnt, unsigned int i)
-{
-	pnt[0] = (i >> 8) & 0xff;
-	pnt[1] = i & 0xff;
-}
-
-void
-set_723(char *pnt, unsigned int i)
-{
-	pnt[3] = pnt[0] = i & 0xff;
-	pnt[2] = pnt[1] = (i >> 8) & 0xff;
-}
-
-void
-set_731(char *pnt, unsigned int i)
-{
-	pnt[0] = i & 0xff;
-	pnt[1] = (i >> 8) & 0xff;
-	pnt[2] = (i >> 16) & 0xff;
-	pnt[3] = (i >> 24) & 0xff;
-}
-
-void
-set_732(char *pnt, unsigned int i)
-{
-	pnt[3] = i & 0xff;
-	pnt[2] = (i >> 8) & 0xff;
-	pnt[1] = (i >> 16) & 0xff;
-	pnt[0] = (i >> 24) & 0xff;
-}
-
-void
-set_733(char *pnt, unsigned int i)
-{
-	pnt[7] = pnt[0] = i & 0xff;
-	pnt[6] = pnt[1] = (i >> 8) & 0xff;
-	pnt[5] = pnt[2] = (i >> 16) & 0xff;
-	pnt[4] = pnt[3] = (i >> 24) & 0xff;
-}
-
-int
-get_731(char *p)
-{
-	return ((p[0] & 0xff)
-		| ((p[1] & 0xff) << 8)
-		| ((p[2] & 0xff) << 16)
-		| ((p[3] & 0xff) << 24));
-}
-
-int
-get_732(char *p)
-{
-	return ((p[3] & 0xff)
-		| ((p[2] & 0xff) << 8)
-		| ((p[1] & 0xff) << 16)
-		| ((p[0] & 0xff) << 24));
-}
-
-int
-get_733(char *p)
-{
-	return ((p[0] & 0xff)
-		| ((p[1] & 0xff) << 8)
-		| ((p[2] & 0xff) << 16)
-		| ((p[3] & 0xff) << 24));
-}
-
-void
-xfwrite(void *buffer, int size, int count, FILE *file, int submode, BOOL islast)
-{
-	/*
-	 * This is a hack that could be made better.
-	 * XXXIs this the only place?
-	 * It is definitely needed on Operating Systems that do not allow to
-	 * write files that are > 2GB. If the system is fast enough to be able
-	 * to feed 1400 KB/s writing speed of a DVD-R drive, use stdout.
-	 * If the system cannot do this reliable, you need to use this hacky
-	 * option.
-	 */
-	static int	idx = 0;
-
-#ifdef	XFWRITE_DEBUG
-	if (count != 1 || (size % 2048) != 0)
-		fprintf(stderr, "Count: %d, size: %d\n", count, size);
-#endif
-
-	if (split_output != 0 &&
-		(idx == 0 || ftell(file) >= ((off_t)1024 * 1024 * 1024))) {
-		char		nbuf[512];
-		extern char	*outfile;
-
-		if (idx == 0)
-			unlink(outfile);
-		sprintf(nbuf, "%s_%02d", outfile, idx++);
-		file = freopen(nbuf, "wb", file);
-		if (file == NULL) {
-#ifdef	USE_LIBSCHILY
-			comerr("Cannot open '%s'.\n", nbuf);
-#else
-			fprintf(stderr, "Cannot open '%s'.\n", nbuf);
-			exit(1);
-#endif
-		}
-	}
-	while (count) {
-		int	got;
-
-		if (osecsize != 0)
-			got = xawrite(buffer, size, count, file, submode, islast);
-		else
-			got = fwrite(buffer, size, count, file);
-
-		if (got <= 0) {
-#ifdef	USE_LIBSCHILY
-			comerr("cannot fwrite %d*%d\n", size, count);
-#else
-			fprintf(stderr, "cannot fwrite %d*%d\n", size, count);
-			exit(1);
-#endif
-		}
-		/*
-		 * This comment is in hope to prevent silly people from
-		 * e.g. SuSE (who did not yet learn C but believe that
-		 * they need to patch other peoples code) from changing the
-		 * next cast into an illegal lhs cast expression.
-		 * The cast below is the correct way to handle the problem.
-		 * The (void *) cast is to avoid a GCC warning like:
-		 * "warning: dereferencing type-punned pointer will break \
-		 * strict-aliasing rules"
-		 * which is wrong this code. (void *) introduces a compatible
-		 * intermediate type in the cast list.
-		 */
-		count -= got, *(char **)(void *)&buffer += size * got;
-	}
-}
-
-static int
-xawrite(void *buffer, int size, int count, FILE *file, int submode, BOOL islast)
-{
-	register char	*p = buffer;
-	register int	amt = size * count;
-	register int	n;
-	struct xa_subhdr subhdr[2];
-
-	if (osecsize == 2048)
-		return (fwrite(buffer, size, count, file));
-
-	if (amt % 2048)
-		comerrno(EX_BAD,
-			"Trying to write %d bytes (not a multiple of 2048).\n",
-			amt);
-
-	subhdr[0].file_number		= subhdr[1].file_number		= 0;
-	subhdr[0].channel_number	= subhdr[1].channel_number	= 0;
-	subhdr[0].coding		= subhdr[1].coding		= 0;
-
-	while (amt > 0) {
-#ifdef	LATER
-		if (submode < 0)
-			subhdr[0].sub_mode = subhdr[1].sub_mode = XA_SUBH_DATA;
-		else
-			subhdr[0].sub_mode = subhdr[1].sub_mode = submode;
-#else
-		subhdr[0].sub_mode = subhdr[1].sub_mode = XA_SUBH_DATA;
-#endif
-
-		if ((amt <= 2048) && islast) {
-			subhdr[0].sub_mode = subhdr[1].sub_mode
-						|= (XA_SUBH_EOR|XA_SUBH_EOF);
-		}
-		n = fwrite(&subhdr, sizeof (subhdr), 1, file);
-		if (n <= 0)
-			return (n);
-
-		n = fwrite(p, 2048, 1, file);
-		if (n <= 0)
-			return (n);
-
-		p += 2048;
-		amt -= 2048;
-	}
-	return (1);
-}
-
-#ifdef APPLE_HYB
-/*
- * use the deferred_write struct to store info about the hfs_boot_file
- */
-static struct deferred_write mac_boot;
-
-#endif	/* APPLE_HYB */
-static struct deferred_write	*dw_head = NULL,
-				*dw_tail = NULL;
-
-unsigned int	last_extent_written = 0;
-static	Uint	path_table_index;
-time_t	begun;
-
-/*
- * We recursively walk through all of the directories and assign extent
- * numbers to them.  We have already assigned extent numbers to everything that
- * goes in front of them
- */
-static int
-assign_directory_addresses(struct directory *node)
-{
-	int		dir_size;
-	struct directory *dpnt;
-
-	dpnt = node;
-
-	while (dpnt) {
-		/* skip if it's hidden */
-		if (dpnt->dir_flags & INHIBIT_ISO9660_ENTRY) {
-			dpnt = dpnt->next;
-			continue;
-		}
-		/*
-		 * If we already have an extent for this (i.e. it came from a
-		 * multisession disc), then don't reassign a new extent.
-		 */
-		dpnt->path_index = next_path_index++;
-		if (dpnt->extent == 0) {
-			dpnt->extent = last_extent;
-			dir_size = ISO_BLOCKS(dpnt->size);
-
-			last_extent += dir_size;
-
-			/*
-			 * Leave room for the CE entries for this directory.
-			 * Keep them close to the reference directory so that
-			 * access will be quick.
-			 */
-			if (dpnt->ce_bytes) {
-				last_extent += ISO_BLOCKS(dpnt->ce_bytes);
-			}
-		}
-		if (dpnt->subdir) {
-			assign_directory_addresses(dpnt->subdir);
-		}
-		dpnt = dpnt->next;
-	}
-	return (0);
-}
-
-#ifdef APPLE_HYB
-static void
-write_one_file(char *filename, off_t size, FILE *outfile, off_t off)
-#else
-static void
-write_one_file(char *filename, off_t size, FILE *outfile)
-#endif	/* APPLE_HYB */
-{
-	/*
-	 * It seems that there are still stone age C-compilers
-	 * around.
-	 * The Metrowerks C found on BeOS/PPC does not allow
-	 * more than 32kB of local vars.
-	 * As we do not need to call write_one_file() recursively
-	 * we make buffer static.
-	 */
-static	char		buffer[SECTOR_SIZE * NSECT];
-	FILE		*infile;
-	off_t		remain;
-	int	use;
-
-	char *mirror_name;
-	unsigned char md5[16];
-	int include_in_jigdo = list_file_in_jigdo(filename, size, &mirror_name, md5);
-
-	if ((infile = fopen(filename, "rb")) == NULL) {
-#ifdef	USE_LIBSCHILY
-		comerr("cannot open '%s'\n", filename);
-#else
-#ifndef	HAVE_STRERROR
-		fprintf(stderr, "cannot open '%s': (%d)\n",
-				filename, errno);
-#else
-		fprintf(stderr, "cannot open '%s': %s\n",
-				filename, strerror(errno));
-#endif
-		exit(1);
-#endif
-	}
-#ifdef APPLE_HYB
-	fseek(infile, off, SEEK_SET);
-#endif	/* APPLE_HYB */
-	remain = size;
-
-	if (include_in_jigdo)
-		write_jt_match_record(filename, mirror_name, SECTOR_SIZE, size, md5);
-
-	while (remain > 0) {
-		int	amt;
-
-		use = (remain > SECTOR_SIZE * NSECT - 1 ?
-				NSECT * SECTOR_SIZE : remain);
-		use = ISO_ROUND_UP(use);	/* Round up to nearest sector */
-						/* boundary */
-		memset(buffer, 0, use);
-		seterrno(0);
-		amt = fread(buffer, 1, use, infile);
-		if (amt < use && amt != remain) {
-			/*
-			 * Note that mkisoimage is not star and no 100% archiver.
-			 * We only detect file growth if the new size does not
-			 * match 'use' at the last read.
-			 */
-			if (geterrno() == 0) {
-#ifdef	USE_LIBSCHILY
-				comerrno(EX_BAD,
-					"File '%s' did %s.\n",
-						filename,
-						amt < remain ?
-						"shrink":"grow");
-#else
-				fprintf(stderr,
-					"File '%s' did %s.\n",
-						filename,
-						amt < remain ?
-						"shrink":"grow");
-				exit(EX_BAD);
-#endif
-			}
-#ifdef	USE_LIBSCHILY
-			comerr("Cannot read from '%s'\n", filename);
-#else
-			fprintf(stderr, "Cannot read from '%s'\n", filename);
-			exit(1);
-#endif
-		}
-		if (!include_in_jigdo)
-			jtwrite(buffer, use, 1,
-			        XA_SUBH_DATA, remain <= (SECTOR_SIZE * NSECT));
-		xfwrite(buffer, use, 1, outfile,
-				XA_SUBH_DATA, remain <= (SECTOR_SIZE * NSECT));
-		last_extent_written += use / SECTOR_SIZE;
-#if 0
-		if ((last_extent_written % 1000) < use / SECTOR_SIZE) {
-			fprintf(stderr, "%d..", last_extent_written);
-		}
-#else
-		if (verbose > 0 &&
-		    (int)(last_extent_written % (gui ? 500 : 5000)) <
-							use / SECTOR_SIZE) {
-			time_t	now;
-			time_t	the_end;
-			double	frac;
-
-			time(&now);
-			frac = last_extent_written / (1.0 * last_extent);
-			the_end = begun + (now - begun) / frac;
-#ifndef NO_FLOATINGPOINT
-			fprintf(stderr, "%6.2f%% done, estimate finish %s",
-				frac * 100., ctime(&the_end));
-#else
-			fprintf(stderr, "%3d.%-02d%% done, estimate finish %s",
-				(int)(frac * 100.),
-				(int)((frac+.00005) * 10000.)%100,
-				ctime(&the_end));
-#endif
-			fflush(stderr);
-		}
-#endif
-		remain -= use;
-	}
-	fclose(infile);
-}/* write_one_file(... */
-
-static void
-write_files(FILE *outfile)
-{
-	struct deferred_write	*dwpnt,
-				*dwnext;
-
-	dwpnt = dw_head;
-	while (dwpnt) {
-/*#define DEBUG*/
-#ifdef DEBUG
-		fprintf(stderr,
-		"The file name is %s and pad is %d, size is %lld and extent is %d\n",
-				dwpnt->name, dwpnt->pad,
-				(Llong)dwpnt->size, dwpnt->extent);
-#endif
-		if (dwpnt->table) {
-			jtwrite(dwpnt->table, ISO_ROUND_UP(dwpnt->size), 1, XA_SUBH_DATA, TRUE);
-			xfwrite(dwpnt->table, ISO_ROUND_UP(dwpnt->size), 1,
-							outfile,
-							XA_SUBH_DATA, TRUE);
-			last_extent_written += ISO_BLOCKS(dwpnt->size);
-			table_size += dwpnt->size;
-/*			fprintf(stderr, "Size %lld ", (Llong)dwpnt->size); */
-			free(dwpnt->table);
-			dwpnt->table = NULL;
-		} else {
-
-#ifdef VMS
-			vms_write_one_file(dwpnt->name, dwpnt->size, outfile);
-#else
-#ifdef APPLE_HYB
-			write_one_file(dwpnt->name, dwpnt->size, outfile,
-								dwpnt->off);
-#else
-			write_one_file(dwpnt->name, dwpnt->size, outfile);
-#endif	/* APPLE_HYB */
-#endif
-			free(dwpnt->name);
-			dwpnt->name = NULL;
-		}
-
-
-#ifndef DVD_VIDEO
-#define	dvd_video	0
-#endif
-
-#ifndef APPLE_HYB
-#define	apple_hyb	0
-#endif
-
-#if	defined(APPLE_HYB) || defined(DVD_VIDEO)
-
-		if (apple_hyb || dvd_video) {
-			/*
-			 * we may have to pad out ISO files to work with HFS
-			 * clump sizes
-			 */
-			char	blk[SECTOR_SIZE];
-			Uint	i;
-
-			for (i = 0; i < dwpnt->pad; i++) {
-				jtwrite(blk, SECTOR_SIZE, 1, 0, FALSE);
-				xfwrite(blk, SECTOR_SIZE, 1, outfile, 0, FALSE);
-				last_extent_written++;
-			}
-		}
-#endif	/* APPLE_HYB || DVD_VIDEO */
-
-
-		dwnext = dwpnt;
-		dwpnt = dwpnt->next;
-		free(dwnext);
-		dwnext = NULL;
-	}
-}/* write_files(... */
-
-#if 0
-static void
-dump_filelist()
-{
-	struct deferred_write *dwpnt;
-
-	dwpnt = dw_head;
-	while (dwpnt) {
-		fprintf(stderr, "File %s\n", dwpnt->name);
-		dwpnt = dwpnt->next;
-	}
-	fprintf(stderr, "\n");
-}
-
-#endif
-
-static int
-compare_dirs(const void *rr, const void *ll)
-{
-	char		*rpnt,
-			*lpnt;
-	struct directory_entry **r,
-			**l;
-
-	r = (struct directory_entry **) rr;
-	l = (struct directory_entry **) ll;
-	rpnt = (*r)->isorec.name;
-	lpnt = (*l)->isorec.name;
-
-#ifdef APPLE_HYB
-	/*
-	 * resource fork MUST (not sure if this is true for HFS volumes) be
-	 * before the data fork - so force it here
-	 */
-	if ((*r)->assoc && (*r)->assoc == (*l))
-		return (1);
-	if ((*l)->assoc && (*l)->assoc == (*r))
-		return (-1);
-#endif	/* APPLE_HYB */
-
-	/* If the entries are the same, this is an error. */
-	if (strcmp(rpnt, lpnt) == 0) {
-#ifdef	USE_LIBSCHILY
-		errmsgno(EX_BAD,
-			"Error: '%s' and '%s' have the same ISO9660 name '%s'.\n",
-			(*r)->whole_name, (*l)->whole_name,
-			rpnt);
-#else
-		fprintf(stderr,
-			"Error: '%s' and '%s' have the same ISO9660 name '%s'.\n",
-			(*r)->whole_name, (*l)->whole_name,
-			rpnt);
-#endif
-		sort_goof++;
-	}
-	/* Check we don't have the same RR name */
-	if (use_RockRidge && !is_rr_dir) {
-		/*
-		 * entries *can* have the same RR name in the "rr_moved"
-		 * directory so skip checks if we're in reloc_dir
-		 */
-		if (!(strcmp((*r)->name, (*l)->name))) {
-#ifdef	USE_LIBSCHILY
-			errmsgno(EX_BAD,
-			"Error: '%s' and '%s' have the same Rock Ridge name '%s'.\n",
-				(*r)->whole_name, (*l)->whole_name,
-				(*r)->name);
-#else
-			fprintf(stderr,
-			"Error: '%s' and '%s' have the same Rock Ridge name '%s'.\n",
-				(*r)->whole_name, (*l)->whole_name,
-				(*r)->name);
-#endif
-			sort_goof++;
-		}
-	}
-	/*
-	 * Put the '.' and '..' entries on the head of the sorted list. For
-	 * normal ASCII, this always happens to be the case, but out of band
-	 * characters cause this not to be the case sometimes.
-	 * FIXME(eric) - these tests seem redundant, in that the name is never
-	 * assigned these values.  It will instead be \000 or \001, and thus
-	 * should always be sorted correctly.   I need to figure out why I
-	 * thought I needed this in the first place.
-	 */
-#if 0
-	if (strcmp(rpnt, ".") == 0)
-		return (-1);
-	if (strcmp(lpnt, ".") == 0)
-		return (1);
-
-	if (strcmp(rpnt, "..") == 0)
-		return (-1);
-	if (strcmp(lpnt, "..") == 0)
-		return (1);
-#else
-	/*
-	 * The code above is wrong (as explained in Eric's comment), leading to
-	 * incorrect sort order iff the -L option ("allow leading dots") is in
-	 * effect and a directory contains entries that start with a dot.
-	 *  (TF, Tue Dec 29 13:49:24 CET 1998)
-	 */
-	if ((*r)->isorec.name_len[0] == 1 && *rpnt == 0)
-		return (-1);	/* '.' */
-	if ((*l)->isorec.name_len[0] == 1 && *lpnt == 0)
-		return (1);
-
-	if ((*r)->isorec.name_len[0] == 1 && *rpnt == 1)
-		return (-1);	/* '..' */
-	if ((*l)->isorec.name_len[0] == 1 && *lpnt == 1)
-		return (1);
-#endif
-
-	while (*rpnt && *lpnt) {
-		if (*rpnt == ';' && *lpnt != ';')
-			return (-1);
-		if (*rpnt != ';' && *lpnt == ';')
-			return (1);
-
-		if (*rpnt == ';' && *lpnt == ';')
-			return (0);
-
-		if (*rpnt == '.' && *lpnt != '.')
-			return (-1);
-		if (*rpnt != '.' && *lpnt == '.')
-			return (1);
-
-		if ((unsigned char) *rpnt < (unsigned char) *lpnt)
-			return (-1);
-		if ((unsigned char) *rpnt > (unsigned char) *lpnt)
-			return (1);
-		rpnt++;
-		lpnt++;
-	}
-	if (*rpnt)
-		return (1);
-	if (*lpnt)
-		return (-1);
-	return (0);
-}
-
-/*
- * Function:		sort_directory
- *
- * Purpose:		Sort the directory in the appropriate ISO9660
- *			order.
- *
- * Notes:		Returns 0 if OK, returns > 0 if an error occurred.
- */
-int
-sort_directory(struct directory_entry **sort_dir, int rr)
-{
-	int		dcount = 0;
-	int		xcount = 0;
-	int		j;
-	int		i,
-			len;
-	struct directory_entry *s_entry;
-	struct directory_entry **sortlist;
-
-	/* need to keep a count of how many entries are hidden */
-	s_entry = *sort_dir;
-	while (s_entry) {
-		if (s_entry->de_flags & INHIBIT_ISO9660_ENTRY)
-			xcount++;
-		dcount++;
-		s_entry = s_entry->next;
-	}
-
-	if (dcount == 0) {
-		return (0);
-	}
-	/* OK, now we know how many there are.  Build a vector for sorting. */
-	sortlist = (struct directory_entry **)
-		e_malloc(sizeof (struct directory_entry *) * dcount);
-
-	j = dcount - 1;
-	dcount = 0;
-	s_entry = *sort_dir;
-	while (s_entry) {
-		if (s_entry->de_flags & INHIBIT_ISO9660_ENTRY) {
-			/* put any hidden entries at the end of the vector */
-			sortlist[j--] = s_entry;
-		} else {
-			sortlist[dcount] = s_entry;
-			dcount++;
-		}
-		len = s_entry->isorec.name_len[0];
-		s_entry->isorec.name[len] = 0;
-		s_entry = s_entry->next;
-	}
-
-	/* Each directory is required to contain at least . and .. */
-	if (dcount < 2) {
-#ifdef	USE_LIBSCHILY
-		errmsgno(EX_BAD,
-			"Directory size too small (. or .. missing ??%s)\n",
-			"?");	/* Try to avoid a GCC trigraph warning */
-#else
-		fprintf(stderr,
-			"Directory size too small (. or .. missing ??%s)\n",
-			"?");	/* Try to avoid a GCC trigraph warning */
-#endif
-		sort_goof = 1;
-
-	} else {
-		/* only sort the non-hidden entries */
-		sort_goof = 0;
-		is_rr_dir = rr;
-#ifdef PROTOTYPES
-		qsort(sortlist, dcount, sizeof (struct directory_entry *),
-			(int (*) (const void *, const void *)) compare_dirs);
-#else
-		qsort(sortlist, dcount, sizeof (struct directory_entry *),
-			compare_dirs);
-#endif
-
-		/*
-		 * Now reassemble the linked list in the proper sorted order
-		 * We still need the hidden entries, as they may be used in
-		 * the Joliet tree.
-		 */
-		for (i = 0; i < dcount + xcount - 1; i++) {
-			sortlist[i]->next = sortlist[i + 1];
-		}
-
-		sortlist[dcount + xcount - 1]->next = NULL;
-		*sort_dir = sortlist[0];
-	}
-
-	free(sortlist);
-	sortlist = NULL;
-	return (sort_goof);
-}
-
-static int
-root_gen()
-{
-	init_fstatbuf();
-
-	root_record.length[0] = 1 +
-			offsetof(struct iso_directory_record, name[0]);
-	root_record.ext_attr_length[0] = 0;
-	set_733((char *) root_record.extent, root->extent);
-	set_733((char *) root_record.size, ISO_ROUND_UP(root->size));
-	iso9660_date(root_record.date, root_statbuf.st_mtime);
-	root_record.flags[0] = ISO_DIRECTORY;
-	root_record.file_unit_size[0] = 0;
-	root_record.interleave[0] = 0;
-	set_723(root_record.volume_sequence_number, volume_sequence_number);
-	root_record.name_len[0] = 1;
-	return (0);
-}
-
-#ifdef SORTING
-/*
- *	sorts deferred_write entries based on the sort weight
- */
-static int
-compare_sort(const void *rr, const void *ll)
-{
-	struct deferred_write	**r;
-	struct deferred_write	**l;
-	int			r_sort;
-	int			l_sort;
-
-	r = (struct deferred_write **) rr;
-	l = (struct deferred_write **) ll;
-	r_sort = (*r)->s_entry->sort;
-	l_sort = (*l)->s_entry->sort;
-
-	if (r_sort != l_sort)
-		return (r_sort < l_sort ? 1 : -1);
-	else
-		return ((*r)->extent - (*l)->extent);
-}
-
-/*
- *	reassign start extents to files that are "hard links" to
- *	files that may have been sorted
- */
-static void
-reassign_link_addresses(struct directory *dpnt)
-{
-	struct directory_entry	*s_entry;
-	struct file_hash	*s_hash;
-
-	while (dpnt) {
-		s_entry = dpnt->contents;
-		for (s_entry = dpnt->contents; s_entry; s_entry = s_entry->next) {
-			/* link files have already been given the weight NOT_SORTED */
-			if (s_entry->sort == NOT_SORTED)
-			{
-				/* update the start extent */
-				s_hash = find_hash(s_entry->dev, s_entry->inode);
-				if (s_hash) {
-					set_733((char *) s_entry->isorec.extent,
-							s_hash->starting_block);
-					s_entry->starting_block = s_hash->starting_block;
-				}
-			}
-
-			if (verbose > 2 && s_entry->size != 0) {
-				fprintf(stderr, "%8d %8d ",
-					s_entry->starting_block,
-					s_entry->starting_block + ISO_BLOCKS(s_entry->size) - 1);
-
-				if (s_entry->inode != TABLE_INODE) {
-					fprintf(stderr, "%s\n", s_entry->whole_name);
-				} else {
-					fprintf(stderr, "%s%s%s\n",
-						s_entry->filedir->whole_name,
-						SPATH_SEPARATOR, trans_tbl);
-				}
-			}
-		}
-		if (dpnt->subdir) {
-			reassign_link_addresses(dpnt->subdir);
-		}
-
-		dpnt = dpnt->next;
-	}
-}
-
-/*
- *	sort files in order of the given sort weight
- */
-static int
-sort_file_addresses()
-{
-	struct deferred_write	*dwpnt;
-	struct deferred_write	**sortlist;
-	struct directory_entry	*s_entry;
-	int			start_extent;
-	int			num = 0;
-	int			i;
-
-	/* need to store start extents for linked files */
-	flush_hash();
-
-	/* find out how many files we have */
-	dwpnt = dw_head;
-	while (dwpnt) {
-		num++;
-		dwpnt = dwpnt->next;
-	}
-
-	/* return if we have none */
-	if (num == 0) {
-		return (1);
-	}
-
-	/* save the start extent of the first file */
-	start_extent = dw_head->extent;
-
-	/* set up vector to store entries */
-	sortlist = (struct deferred_write **)
-		e_malloc(sizeof (struct deferred_write *) * num);
-
-	for (i = 0, dwpnt = dw_head; i < num; i++, dwpnt = dwpnt->next)
-		sortlist[i] = dwpnt;
-
-	/* sort the list */
-#ifdef PROTOTYPES
-	qsort(sortlist, num, sizeof (struct deferred_write *),
-		(int (*)(const void *, const void *))compare_sort);
-#else
-	qsort(sortlist, num, sizeof (struct deferred_write *), compare_sort);
-#endif
-
-	/* reconstruct the linked list */
-	for (i = 0; i < num-1; i++) {
-		sortlist[i]->next = sortlist[i+1];
-	}
-
-	sortlist[num-1]->next = NULL;
-	dw_head = sortlist[0];
-
-	free(sortlist);
-
-	/* set the new start extents for the sorted list */
-	for (i = 0, dwpnt = dw_head; i < num; i++, dwpnt = dwpnt->next) {
-		s_entry = dwpnt->s_entry;
-		dwpnt->extent = s_entry->starting_block = start_extent;
-		set_733((char *) s_entry->isorec.extent, start_extent);
-
-		start_extent += ISO_BLOCKS(s_entry->size);
-#ifdef DVD_VIDEO
-		/*
-		 * Shouldn't this be done for every type of sort? Otherwise
-		 * we will loose every pad info we add if we sort the files
-		 */
-		if (dvd_video) {
-			start_extent += dwpnt->pad;
-		}
-#endif /* DVD_VIDEO */
-
-		/* cache start extents for any linked files */
-		add_hash(s_entry);
-	}
-
-	return (0);
-}
-#endif /* SORTING */
-
-
-
-static BOOL
-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[PATH_MAX];
-#ifdef DVD_VIDEO
-	char		dvd_path[PATH_MAX];
-	title_set_info_t * title_set_info = NULL;
-#endif
-	BOOL	ret = FALSE;
-
-	while (dpnt) {
-#ifdef DVD_VIDEO
-		if (dvd_video && (strstr(dpnt->whole_name, "VIDEO_TS") != 0)) {
-			int	maxlen = strlen(dpnt->whole_name)-8;
-
-			if (maxlen > (sizeof (dvd_path)-1))
-				maxlen = sizeof (dvd_path)-1;
-			strncpy(dvd_path, dpnt->whole_name, maxlen);
-			dvd_path[maxlen] = '\0';
-#ifdef DEBUG
-			fprintf(stderr, "Found 'VIDEO_TS', the path is %s \n", dvd_path);
-#endif
-			title_set_info = DVDGetFileSet(dvd_path);
-			if (title_set_info == 0) {
-				/*
-				 * Do not switch off -dvd-video but let is fail later.
-				 */
-/*				dvd_video = 0;*/
-				errmsgno(EX_BAD, "Unable to parse DVD-Video structures.\n");
-			} else {
-				ret = TRUE;
-			}
-		}
-#endif /* DVD_VIDEO */
-
-		s_entry = dpnt->contents;
-		for (s_entry = dpnt->contents; s_entry;
-						s_entry = s_entry->next) {
-			/*
-			 * If we already have an  extent for this entry, then
-			 * don't assign a new one.  It must have come from a
-			 * previous session on the disc.  Note that we don't
-			 * end up scheduling the thing for writing either.
-			 */
-			if (isonum_733((unsigned char *)
-						s_entry->isorec.extent) != 0) {
-				continue;
-			}
-			/*
-			 * This saves some space if there are symlinks present
-			 */
-			s_hash = find_hash(s_entry->dev, s_entry->inode);
-			if (s_hash) {
-				if (verbose > 2) {
-					fprintf(stderr, "Cache hit for '%s%s%s'\n", s_entry->filedir->de_name,
-						SPATH_SEPARATOR,
-						s_entry->name);
-				}
-				set_733((char *) s_entry->isorec.extent,
-						s_hash->starting_block);
-				set_733((char *) s_entry->isorec.size,
-						s_hash->size);
-#ifdef SORTING
-				/* check for non-directory files */
-				if (do_sort && ((s_entry->isorec.flags[0] & ISO_DIRECTORY) == 0)) {
-					/* make sure the real file has the highest weighting */
-					s_hash->de->sort = MAX(s_entry->sort, s_hash->de->sort);
-					/* flag this as a potential non-sorted file */
-					s_entry->sort = NOT_SORTED;
-				}
-#endif /* SORTING */
-				continue;
-			}
-			/*
-			 * If this is for a directory that is not a . or
-			 * a .. entry, then look up the information for the
-			 * entry.  We have already assigned extents for
-			 * directories, so we just need to fill in the blanks
-			 * here.
-			 */
-			if (strcmp(s_entry->name, ".") != 0 &&
-					strcmp(s_entry->name, "..") != 0 &&
-					s_entry->isorec.flags[0] & ISO_DIRECTORY) {
-				finddir = dpnt->subdir;
-				while (1 == 1) {
-					if (finddir->self == s_entry)
-						break;
-					finddir = finddir->next;
-					if (!finddir) {
-#ifdef	USE_LIBSCHILY
-#ifdef	DVD_VIDEO
-						if (title_set_info != 0) {
-							DVDFreeFileSet(title_set_info);
-						}
-#endif
-						comerrno(EX_BAD,
-							"Fatal goof - could not find dir entry for '%s'\n",
-							s_entry->name);
-#else
-						fprintf(stderr,
-							"Fatal goof - could not find dir entry for '%s'\n",
-							s_entry->name);
-#ifdef DVD_VIDEO
-						if (title_set_info != 0) {
-							DVDFreeFileSet(title_set_info);
-						}
-#endif
-						exit(1);
-#endif
-					}
-				}
-				set_733((char *) s_entry->isorec.extent,
-						finddir->extent);
-				s_entry->starting_block = finddir->extent;
-				s_entry->size = ISO_ROUND_UP(finddir->size);
-				total_dir_size += s_entry->size;
-				add_hash(s_entry);
-				set_733((char *) s_entry->isorec.size,
-						ISO_ROUND_UP(finddir->size));
-				continue;
-			}
-			/*
-			 * If this is . or .., then look up the relevant info
-			 * from the tables.
-			 */
-			if (strcmp(s_entry->name, ".") == 0) {
-				set_733((char *) s_entry->isorec.extent,
-								dpnt->extent);
-
-				/*
-				 * Set these so that the hash table has the
-				 * correct information
-				 */
-				s_entry->starting_block = dpnt->extent;
-				s_entry->size = ISO_ROUND_UP(dpnt->size);
-
-				add_hash(s_entry);
-				s_entry->starting_block = dpnt->extent;
-				set_733((char *) s_entry->isorec.size,
-						ISO_ROUND_UP(dpnt->size));
-				continue;
-			}
-			if (strcmp(s_entry->name, "..") == 0) {
-				if (dpnt == root) {
-					total_dir_size += root->size;
-				}
-				set_733((char *) s_entry->isorec.extent,
-							dpnt->parent->extent);
-
-				/*
-				 * Set these so that the hash table has the
-				 * correct information
-				 */
-				s_entry->starting_block = dpnt->parent->extent;
-				s_entry->size =
-					ISO_ROUND_UP(dpnt->parent->size);
-
-				add_hash(s_entry);
-				s_entry->starting_block = dpnt->parent->extent;
-				set_733((char *) s_entry->isorec.size,
-					ISO_ROUND_UP(dpnt->parent->size));
-				continue;
-			}
-			/*
-			 * Some ordinary non-directory file.  Just schedule
-			 * the file to be written.  This is all quite
-			 * straightforward, just make a list and assign
-			 * extents as we go.  Once we get through writing all
-			 * of the directories, we should be ready write out
-			 * these files
-			 */
-			if (s_entry->size) {
-				dwpnt = (struct deferred_write *)
-					e_malloc(sizeof (struct deferred_write));
-				/* save this directory entry for later use */
-				dwpnt->s_entry = s_entry;
-				/* set the initial padding to zero */
-				dwpnt->pad = 0;
-#ifdef DVD_VIDEO
-				if (dvd_video && (title_set_info != 0)) {
-					int pad;
-
-					pad = DVDGetFilePad(title_set_info, s_entry->name);
-					if (pad < 0) {
-						errmsgno(EX_BAD,
-						"Implementation botch. Video pad for file %s is %d\n",
-						s_entry->name, pad),
-						comerrno(EX_BAD,
-						"Either the *.IFO file is bad or you found a mkisoimage bug.\n");
-					}
-					dwpnt->pad = pad;
-					if (verbose > 0 && pad != 0) {
-						fprintf(stderr,
-							"The pad was %d for file %s\n", dwpnt->pad, s_entry->name);
-					}
-				}
-#endif /* DVD_VIDEO */
-#ifdef APPLE_HYB
-				/*
-				 * maybe an offset to start of the real
-				 * file/fork
-				 */
-				dwpnt->off = s_entry->hfs_off;
-#else
-				dwpnt->off = (off_t)0;
-#endif	/* APPLE_HYB */
-				if (dw_tail) {
-					dw_tail->next = dwpnt;
-					dw_tail = dwpnt;
-				} else {
-					dw_head = dwpnt;
-					dw_tail = dwpnt;
-				}
-				if (s_entry->inode == TABLE_INODE) {
-					dwpnt->table = s_entry->table;
-					dwpnt->name = NULL;
-					sprintf(whole_path, "%s%s%s",
-						s_entry->filedir->whole_name,
-						SPATH_SEPARATOR, trans_tbl);
-				} else {
-					dwpnt->table = NULL;
-					strcpy(whole_path,
-							s_entry->whole_name);
-					dwpnt->name = strdup(whole_path);
-				}
-				dwpnt->next = NULL;
-				dwpnt->size = s_entry->size;
-				dwpnt->extent = last_extent;
-				set_733((char *) s_entry->isorec.extent,
-								last_extent);
-				s_entry->starting_block = last_extent;
-				add_hash(s_entry);
-				last_extent += ISO_BLOCKS(s_entry->size);
-#ifdef DVD_VIDEO
-				/* Shouldn't we always add the pad info? */
-				if (dvd_video) {
-					last_extent += dwpnt->pad;
-				}
-#endif /* DVD_VIDEO */
-				if (verbose > 2 && !do_sort) {
-					fprintf(stderr, "%8d %8d %s\n",
-						s_entry->starting_block,
-						last_extent - 1, whole_path);
-				}
-#ifdef DBG_ISO
-				if (ISO_BLOCKS(s_entry->size) > 500) {
-					fprintf(stderr,
-						"Warning: large file '%s'\n",
-						whole_path);
-					fprintf(stderr,
-						"Starting block is %d\n",
-						s_entry->starting_block);
-					fprintf(stderr,
-					"Reported file size is %lld\n",
-						(Llong)s_entry->size);
-
-				}
-#endif
-#ifdef	NOT_NEEDED	/* Never use this code if you like to create a DVD */
-
-				if (last_extent > (800000000 >> 11)) {
-					/* More than 800Mb? Punt */
-					fprintf(stderr,
-					"Extent overflow processing file '%s'\n",
-						whole_path);
-					fprintf(stderr,
-						"Starting block is %d\n",
-						s_entry->starting_block);
-					fprintf(stderr,
-					"Reported file size is %lld\n",
-							(Llong)s_entry->size);
-					exit(1);
-				}
-#endif
-				continue;
-			}
-			/*
-			 * This is for zero-length files.  If we leave the
-			 * extent 0, then we get screwed, because many readers
-			 * simply drop files that have an extent of zero.
-			 * Thus we leave the size 0, and just assign the
-			 * extent number.
-			 */
-			set_733((char *) s_entry->isorec.extent, last_extent);
-		}
-		if (dpnt->subdir) {
-			if (assign_file_addresses(dpnt->subdir))
-				ret = TRUE;
-		}
-		dpnt = dpnt->next;
-	}
-#ifdef DVD_VIDEO
-	if (title_set_info != NULL) {
-		DVDFreeFileSet(title_set_info);
-	}
-#endif /* DVD_VIDEO */
-	return (ret);
-}/* assign_file_addresses(... */
-
-static void
-free_one_directory(struct directory *dpnt)
-{
-	struct directory_entry *s_entry;
-	struct directory_entry *s_entry_d;
-
-	s_entry = dpnt->contents;
-	while (s_entry) {
-		s_entry_d = s_entry;
-		s_entry = s_entry->next;
-
-		if (s_entry_d->rr_attributes) {
-			free(s_entry_d->rr_attributes);
-			s_entry_d->rr_attributes = NULL;
-		}
-		if (s_entry_d->name != NULL) {
-			free(s_entry_d->name);
-			s_entry_d->name = NULL;
-		}
-		if (s_entry_d->whole_name != NULL) {
-			free(s_entry_d->whole_name);
-			s_entry_d->whole_name = NULL;
-		}
-#ifdef APPLE_HYB
-		if (apple_both && s_entry_d->hfs_ent && !s_entry_d->assoc)
-			free(s_entry_d->hfs_ent);
-#endif	/* APPLE_HYB */
-
-		free(s_entry_d);
-		s_entry_d = NULL;
-	}
-	dpnt->contents = NULL;
-}/* free_one_directory(... */
-
-static void
-free_directories(struct directory *dpnt)
-{
-	while (dpnt) {
-		free_one_directory(dpnt);
-		if (dpnt->subdir)
-			free_directories(dpnt->subdir);
-		dpnt = dpnt->next;
-	}
-}
-
-void
-generate_one_directory(struct directory *dpnt, FILE *outfile)
-{
-	unsigned int	ce_address = 0;
-	char		*ce_buffer;
-	unsigned int	ce_index = 0;
-	unsigned int	ce_size;
-	unsigned int	dir_index;
-	char		*directory_buffer;
-	int		new_reclen;
-	struct directory_entry *s_entry;
-	struct directory_entry *s_entry_d;
-	unsigned int	total_size;
-
-	total_size = ISO_ROUND_UP(dpnt->size);
-	directory_buffer = (char *) e_malloc(total_size);
-	memset(directory_buffer, 0, total_size);
-	dir_index = 0;
-
-	ce_size = ISO_ROUND_UP(dpnt->ce_bytes);
-	ce_buffer = NULL;
-
-	if (ce_size > 0) {
-		ce_buffer = (char *) e_malloc(ce_size);
-		memset(ce_buffer, 0, ce_size);
-
-		ce_index = 0;
-
-		/* Absolute byte address of CE entries for this directory */
-		ce_address = last_extent_written + (total_size >> 11);
-		ce_address = ce_address << 11;
-	}
-	s_entry = dpnt->contents;
-	while (s_entry) {
-		/* skip if it's hidden */
-		if (s_entry->de_flags & INHIBIT_ISO9660_ENTRY) {
-			s_entry = s_entry->next;
-			continue;
-		}
-		/*
-		 * We do not allow directory entries to cross sector
-		 * boundaries. Simply pad, and then start the next entry at
-		 * the next sector
-		 */
-		new_reclen = s_entry->isorec.length[0];
-		if ((dir_index & (SECTOR_SIZE - 1)) + new_reclen >=
-								SECTOR_SIZE) {
-			dir_index = ISO_ROUND_UP(dir_index);
-		}
-		memcpy(directory_buffer + dir_index, &s_entry->isorec,
-			offsetof(struct iso_directory_record, name[0]) +
-			s_entry->isorec.name_len[0]);
-		dir_index += offsetof(struct iso_directory_record, name[0]) +
-			s_entry->isorec.name_len[0];
-
-		/* Add the Rock Ridge attributes, if present */
-		if (s_entry->rr_attr_size) {
-			if (dir_index & 1) {
-				directory_buffer[dir_index++] = 0;
-			}
-			/*
-			 * If the RR attributes were too long, then write the
-			 * CE records, as required.
-			 */
-			if (s_entry->rr_attr_size != s_entry->total_rr_attr_size) {
-				struct iso_xa_dir_record *xadp;
-				unsigned char	*pnt;
-				int		len,
-						nbytes;
-
-				/*
-				 * Go through the entire record, first skip
-				 * the XA record and then fix up the
-				 * CE entries so that the extent and offset
-				 * are correct
-				 */
-				pnt = s_entry->rr_attributes;
-				len = s_entry->total_rr_attr_size;
-
-				if (len >= 14) {
-					xadp = (struct iso_xa_dir_record *)pnt;
-
-					if (xadp->signature[0] == 'X' && xadp->signature[1] == 'A' &&
-									xadp->reserved[0] == '\0') {
-						len -= 14;
-						pnt += 14;
-					}
-				}
-
-				while (len > 3) {
-#ifdef DEBUG
-					if (ce_size <= 0) {
-						fprintf(stderr,
-						"Warning: ce_index(%d) && ce_address(%d) not initialized\n",
-							ce_index, ce_address);
-					}
-#endif
-
-					if (pnt[0] == 'C' && pnt[1] == 'E') {
-						nbytes = get_733((char *) pnt + 20);
-
-						if ((ce_index & (SECTOR_SIZE - 1)) + nbytes >=
-							SECTOR_SIZE) {
-							ce_index = ISO_ROUND_UP(ce_index);
-						}
-						set_733((char *) pnt + 4,
-							(ce_address + ce_index) >> 11);
-						set_733((char *) pnt + 12,
-							(ce_address + ce_index) & (SECTOR_SIZE - 1));
-
-
-						/*
-						 * Now store the block in the
-						 * ce buffer
-						 */
-						memcpy(ce_buffer + ce_index,
-							pnt + pnt[2], nbytes);
-						ce_index += nbytes;
-						if (ce_index & 1) {
-							ce_index++;
-						}
-					}
-					len -= pnt[2];
-					pnt += pnt[2];
-				}
-
-			}
-			rockridge_size += s_entry->total_rr_attr_size;
-			memcpy(directory_buffer + dir_index,
-				s_entry->rr_attributes,
-				s_entry->rr_attr_size);
-			dir_index += s_entry->rr_attr_size;
-		}
-		if (dir_index & 1) {
-			directory_buffer[dir_index++] = 0;
-		}
-		s_entry_d = s_entry;
-		s_entry = s_entry->next;
-
-		/*
-		 * Joliet doesn't use the Rock Ridge attributes, so we free
-		 * it here.
-		 */
-		if (s_entry_d->rr_attributes) {
-			free(s_entry_d->rr_attributes);
-			s_entry_d->rr_attributes = NULL;
-		}
-	}
-
-	if (dpnt->size != dir_index) {
-#ifdef	USE_LIBSCHILY
-		errmsgno(EX_BAD,
-			"Unexpected directory length %lld expected: %d '%s'\n",
-			(Llong)dpnt->size,
-			dir_index, dpnt->de_name);
-#else
-		fprintf(stderr,
-			"Unexpected directory length %lld expected: %d '%s'\n",
-			(Llong)dpnt->size,
-			dir_index, dpnt->de_name);
-#endif
-	}
-	jtwrite(directory_buffer, total_size, 1, 0, FALSE);
-	xfwrite(directory_buffer, total_size, 1, outfile, 0, FALSE);
-	last_extent_written += total_size >> 11;
-	free(directory_buffer);
-	directory_buffer = NULL;
-
-	if (ce_size > 0) {
-		if (ce_index != dpnt->ce_bytes) {
-#ifdef	USE_LIBSCHILY
-			errmsgno(EX_BAD,
-			"Continuation entry record length mismatch %d expected: %d.\n",
-				ce_index, dpnt->ce_bytes);
-#else
-			fprintf(stderr,
-			"Continuation entry record length mismatch %d expected: %d.\n",
-				ce_index, dpnt->ce_bytes);
-#endif
-		}
-		jtwrite(ce_buffer, ce_size, 1, 0, FALSE);
-		xfwrite(ce_buffer, ce_size, 1, outfile, 0, FALSE);
-		last_extent_written += ce_size >> 11;
-		free(ce_buffer);
-		ce_buffer = NULL;
-	}
-}/* generate_one_directory(... */
-
-static void
-build_pathlist(struct directory *node)
-{
-	struct directory *dpnt;
-
-	dpnt = node;
-
-	while (dpnt) {
-		/* skip if it's hidden */
-		if ((dpnt->dir_flags & INHIBIT_ISO9660_ENTRY) == 0)
-			pathlist[dpnt->path_index] = dpnt;
-
-		if (dpnt->subdir)
-			build_pathlist(dpnt->subdir);
-		dpnt = dpnt->next;
-	}
-}/* build_pathlist(... */
-
-static int
-compare_paths(void const *r, void const *l)
-{
-	struct directory const *ll = *(struct directory * const *) l;
-	struct directory const *rr = *(struct directory * const *) r;
-
-	if (rr->parent->path_index < ll->parent->path_index) {
-		return (-1);
-	}
-	if (rr->parent->path_index > ll->parent->path_index) {
-		return (1);
-	}
-	return (strcmp(rr->self->isorec.name, ll->self->isorec.name));
-
-}/* compare_paths(... */
-
-static int
-generate_path_tables()
-{
-	struct directory_entry *de = NULL;
-	struct directory *dpnt;
-	int		fix;
-	int		i;
-	int		j;
-	int		namelen;
-	char		*npnt;
-	char		*npnt1;
-	int		tablesize;
-
-	/* First allocate memory for the tables and initialize the memory */
-	tablesize = path_blocks << 11;
-	path_table_m = (char *) e_malloc(tablesize);
-	path_table_l = (char *) e_malloc(tablesize);
-	memset(path_table_l, 0, tablesize);
-	memset(path_table_m, 0, tablesize);
-
-	/*
-	 * Now start filling in the path tables.  Start with root directory
-	 */
-
-	path_table_index = 0;
-	pathlist = (struct directory **) e_malloc(sizeof (struct directory *)
-		* next_path_index);
-	memset(pathlist, 0, sizeof (struct directory *) * next_path_index);
-	build_pathlist(root);
-
-	do {
-		fix = 0;
-#ifdef PROTOTYPES
-		qsort(&pathlist[1], next_path_index - 1,
-			sizeof (struct directory *),
-			(int (*) (const void *, const void *)) compare_paths);
-#else
-		qsort(&pathlist[1], next_path_index - 1,
-			sizeof (struct directory *),
-			compare_paths);
-#endif
-
-		for (j = 1; j < next_path_index; j++) {
-			if (pathlist[j]->path_index != j) {
-				pathlist[j]->path_index = j;
-				fix++;
-			}
-		}
-	} while (fix);
-
-	for (j = 1; j < next_path_index; j++) {
-		dpnt = pathlist[j];
-		if (!dpnt) {
-#ifdef	USE_LIBSCHILY
-			comerrno(EX_BAD, "Entry %d not in path tables\n", j);
-#else
-			fprintf(stderr, "Entry %d not in path tables\n", j);
-			exit(1);
-#endif
-		}
-		npnt = dpnt->de_name;
-
-		/* So the root comes out OK */
-		if ((*npnt == 0) || (dpnt == root)) {
-			npnt = ".";
-		}
-		npnt1 = strrchr(npnt, PATH_SEPARATOR);
-		if (npnt1) {
-			npnt = npnt1 + 1;
-		}
-		de = dpnt->self;
-		if (!de) {
-#ifdef	USE_LIBSCHILY
-			comerrno(EX_BAD,
-			"Fatal ISO9660 goof - directory has amnesia\n");
-#else
-			fprintf(stderr,
-			"Fatal ISO9660 goof - directory has amnesia\n");
-			exit(1);
-#endif
-		}
-		namelen = de->isorec.name_len[0];
-
-		path_table_l[path_table_index] = namelen;
-		path_table_m[path_table_index] = namelen;
-		path_table_index += 2;
-
-		set_731(path_table_l + path_table_index, dpnt->extent);
-		set_732(path_table_m + path_table_index, dpnt->extent);
-		path_table_index += 4;
-
-		if (dpnt->parent->path_index > 0xffff) {
-#ifdef	USE_LIBSCHILY
-			comerrno(EX_BAD,
-			"Unable to generate sane path tables - too many directories (%d)\n",
-				dpnt->parent->path_index);
-#else
-			fprintf(stderr,
-			"Unable to generate sane path tables - too many directories (%d)\n",
-				dpnt->parent->path_index);
-			exit(1);
-#endif
-		}
-
-		set_721(path_table_l + path_table_index,
-			dpnt->parent->path_index);
-		set_722(path_table_m + path_table_index,
-			dpnt->parent->path_index);
-		path_table_index += 2;
-
-		for (i = 0; i < namelen; i++) {
-			path_table_l[path_table_index] = de->isorec.name[i];
-			path_table_m[path_table_index] = de->isorec.name[i];
-			path_table_index++;
-		}
-		if (path_table_index & 1) {
-			path_table_index++;	/* For odd lengths we pad */
-		}
-	}
-
-	free(pathlist);
-	pathlist = NULL;
-	if (path_table_index != path_table_size) {
-#ifdef	USE_LIBSCHILY
-		errmsgno(EX_BAD,
-			"Path table lengths do not match %d expected: %d\n",
-			path_table_index,
-			path_table_size);
-#else
-		fprintf(stderr,
-			"Path table lengths do not match %d expected: %d\n",
-			path_table_index,
-			path_table_size);
-#endif
-	}
-	return (0);
-}/* generate_path_tables(... */
-
-void
-memcpy_max(char *to, char *from, int max)
-{
-	int	n = strlen(from);
-
-	if (n > max) {
-		n = max;
-	}
-	memcpy(to, from, n);
-
-}/* memcpy_max(... */
-
-void
-outputlist_insert(struct output_fragment *frag)
-{
-	struct output_fragment *nfrag;
-
-	nfrag = e_malloc(sizeof (*frag));
-	movebytes(frag, nfrag, sizeof (*frag));
-	nfrag->of_start_extent = 0;
-
-	if (out_tail == NULL) {
-		out_list = out_tail = nfrag;
-	} else {
-		out_tail->of_next = nfrag;
-		out_tail = nfrag;
-	}
-}
-
-static int
-file_write(FILE *outfile)
-{
-	Uint	should_write;
-
-#ifdef APPLE_HYB
-	char	buffer[SECTOR_SIZE];
-
-	memset(buffer, 0, sizeof (buffer));
-
-	if (apple_hyb) {
-
-		int	i;
-
-		/*
-		 * write out padding to round up to HFS allocation block
-		 */
-		for (i = 0; i < hfs_pad; i++) {
-			jtwrite(buffer, sizeof (buffer), 1, 0, FALSE);
-			xfwrite(buffer, sizeof (buffer), 1, outfile, 0, FALSE);
-			last_extent_written++;
-		}
-	}
-#endif	/* APPLE_HYB */
-
-	/*
-	 * OK, all done with that crap.  Now write out the directories. This is
-	 * where the fur starts to fly, because we need to keep track of each
-	 * file as we find it and keep track of where we put it.
-	 */
-	should_write = last_extent - session_start;
-
-	if (verbose > 2) {
-#ifdef DBG_ISO
-		fprintf(stderr,
-			"Total directory extents being written = %d\n",
-							last_extent);
-#endif
-
-#ifdef APPLE_HYB
-		if (apple_hyb)
-			fprintf(stderr,
-			"Total extents scheduled to be written (inc HFS) = %d\n",
-				last_extent - session_start);
-		else
-#endif	/* APPLE_HYB */
-
-			fprintf(stderr,
-				"Total extents scheduled to be written = %d\n",
-				last_extent - session_start);
-	}
-	/* Now write all of the files that we need. */
-	write_files(outfile);
-
-#ifdef APPLE_HYB
-	/* write out extents/catalog/dt file */
-	if (apple_hyb) {
-
-		jtwrite(hce->hfs_ce, HFS_BLOCKSZ, hce->hfs_tot_size, 0, FALSE);
-		xfwrite(hce->hfs_ce, HFS_BLOCKSZ, hce->hfs_tot_size, outfile, 0, FALSE);
-
-		/* round up to a whole CD block */
-		if (HFS_ROUND_UP(hce->hfs_tot_size) -
-					hce->hfs_tot_size * HFS_BLOCKSZ) {
-			jtwrite(buffer,
-				HFS_ROUND_UP(hce->hfs_tot_size) -
-				hce->hfs_tot_size * HFS_BLOCKSZ, 1, 0, FALSE);
-			xfwrite(buffer,
-				HFS_ROUND_UP(hce->hfs_tot_size) -
-				hce->hfs_tot_size * HFS_BLOCKSZ, 1, outfile, 0, FALSE);
-		}
-		last_extent_written += ISO_ROUND_UP(hce->hfs_tot_size *
-						HFS_BLOCKSZ) / SECTOR_SIZE;
-
-		/* write out HFS boot block */
-		if (mac_boot.name)
-			write_one_file(mac_boot.name, mac_boot.size, outfile,
-								mac_boot.off);
-	}
-#endif	/* APPLE_HYB */
-
-	/* The rest is just fluff. */
-	if (verbose == 0) {
-		return (0);
-	}
-#ifdef APPLE_HYB
-	if (apple_hyb) {
-		fprintf(stderr,
-			"Total extents actually written (inc HFS) = %d\n",
-			last_extent_written - session_start);
-		fprintf(stderr, "(Size of ISO volume = %d, HFS extra = %d)\n",
-			last_extent_written - session_start - hfs_extra,
-			hfs_extra);
-	} else
-#else
-	fprintf(stderr, "Total extents actually written = %d\n",
-		last_extent_written - session_start);
-#endif	/* APPLE_HYB */
-
-	/* Hard links throw us off here */
-	if (should_write != (last_extent - session_start)) {
-		fprintf(stderr,
-		"Number of extents written not what was predicted.  Please fix.\n");
-		fprintf(stderr, "Predicted = %d, written = %d\n",
-						should_write, last_extent);
-	}
-	fprintf(stderr, "Total translation table size: %d\n", table_size);
-	fprintf(stderr, "Total rockridge attributes bytes: %d\n",
-						rockridge_size);
-	fprintf(stderr, "Total directory bytes: %d\n", total_dir_size);
-	fprintf(stderr, "Path table size(bytes): %d\n", path_table_size);
-
-#ifdef DEBUG
-	fprintf(stderr,
-		"next extent, last_extent, last_extent_written %d %d %d\n",
-		next_extent, last_extent, last_extent_written);
-#endif
-
-	return (0);
-
-}/* iso_write(... */
-
-/*
- * Function to write the PVD for the disc.
- */
-static int
-pvd_write(FILE *outfile)
-{
-	char		iso_time[17];
-	int		should_write;
-	struct tm	local;
-	struct tm	gmt;
-
-
-	time(&begun);
-
-	local = *localtime(&begun);
-	gmt = *gmtime(&begun);
-
-	/*
-	 * There was a comment here about breaking in the year 2000.
-	 * That's not true, in 2000 tm_year == 100, so 1900+tm_year == 2000.
-	 */
-	sprintf(iso_time, "%4.4d%2.2d%2.2d%2.2d%2.2d%2.2d00",
-		1900 + local.tm_year,
-		local.tm_mon + 1, local.tm_mday,
-		local.tm_hour, local.tm_min, local.tm_sec);
-
-	local.tm_min -= gmt.tm_min;
-	local.tm_hour -= gmt.tm_hour;
-	local.tm_yday -= gmt.tm_yday;
-	iso_time[16] = (local.tm_min + 60 *
-				(local.tm_hour + 24 * local.tm_yday)) / 15;
-
-	/* Next we write out the primary descriptor for the disc */
-	memset(&vol_desc, 0, sizeof (vol_desc));
-	vol_desc.type[0] = ISO_VD_PRIMARY;
-	memcpy(vol_desc.id, ISO_STANDARD_ID, sizeof (ISO_STANDARD_ID));
-	vol_desc.version[0] = 1;
-
-	memset(vol_desc.system_id, ' ', sizeof (vol_desc.system_id));
-	memcpy_max(vol_desc.system_id, system_id, strlen(system_id));
-
-	memset(vol_desc.volume_id, ' ', sizeof (vol_desc.volume_id));
-	memcpy_max(vol_desc.volume_id, volume_id, strlen(volume_id));
-
-	should_write = last_extent - session_start;
-	set_733((char *) vol_desc.volume_space_size, should_write);
-	set_723(vol_desc.volume_set_size, volume_set_size);
-	set_723(vol_desc.volume_sequence_number, volume_sequence_number);
-	set_723(vol_desc.logical_block_size, SECTOR_SIZE);
-
-	/*
-	 * The path tables are used by DOS based machines to cache directory
-	 * locations
-	 */
-	set_733((char *) vol_desc.path_table_size, path_table_size);
-	set_731(vol_desc.type_l_path_table, path_table[0]);
-	set_731(vol_desc.opt_type_l_path_table, path_table[1]);
-	set_732(vol_desc.type_m_path_table, path_table[2]);
-	set_732(vol_desc.opt_type_m_path_table, path_table[3]);
-
-	/* Now we copy the actual root directory record */
-	memcpy(vol_desc.root_directory_record, &root_record,
-		offsetof(struct iso_directory_record, name[0]) + 1);
-
-	/*
-	 * The rest is just fluff.  It looks nice to fill in many of these
-	 * fields, though.
-	 */
-	FILL_SPACE(volume_set_id);
-	if (volset_id)
-		memcpy_max(vol_desc.volume_set_id, volset_id, strlen(volset_id));
-
-	FILL_SPACE(publisher_id);
-	if (publisher)
-		memcpy_max(vol_desc.publisher_id, publisher, strlen(publisher));
-
-	FILL_SPACE(preparer_id);
-	if (preparer)
-		memcpy_max(vol_desc.preparer_id, preparer, strlen(preparer));
-
-	FILL_SPACE(application_id);
-	if (appid)
-		memcpy_max(vol_desc.application_id, appid, strlen(appid));
-
-	FILL_SPACE(copyright_file_id);
-	if (copyright)
-		memcpy_max(vol_desc.copyright_file_id, copyright,
-			strlen(copyright));
-
-	FILL_SPACE(abstract_file_id);
-	if (abstract)
-		memcpy_max(vol_desc.abstract_file_id, abstract,
-			strlen(abstract));
-
-	FILL_SPACE(bibliographic_file_id);
-	if (biblio)
-		memcpy_max(vol_desc.bibliographic_file_id, biblio,
-			strlen(biblio));
-
-	FILL_SPACE(creation_date);
-	FILL_SPACE(modification_date);
-	FILL_SPACE(expiration_date);
-	FILL_SPACE(effective_date);
-	vol_desc.file_structure_version[0] = 1;
-	FILL_SPACE(application_data);
-
-	memcpy(vol_desc.creation_date, iso_time, 17);
-	memcpy(vol_desc.modification_date, iso_time, 17);
-	memcpy(vol_desc.expiration_date, "0000000000000000", 17);
-	memcpy(vol_desc.effective_date, iso_time, 17);
-
-	if (use_XA) {
-		char	*xap = &((char *)&vol_desc)[1024];
-
-		memcpy(&xap[0], "CD-XA001", 8);			/* XA Sign.  */
-		memcpy(&xap[8], "\0\0", 2);			/* XA flags  */
-		memcpy(&xap[10], "\0\0\0\0\0\0\0\0", 8);	/* Start dir */
-		memcpy(&xap[18], "\0\0\0\0\0\0\0\0", 8);	/* Reserved  */
-	}
-
-	/* if not a bootable cd do it the old way */
-	jtwrite(&vol_desc, SECTOR_SIZE, 1, 0, FALSE);
-	xfwrite(&vol_desc, SECTOR_SIZE, 1, outfile, 0, FALSE);
-	last_extent_written++;
-	return (0);
-}
-
-/*
- * Function to write the Extended PVD for the disc.
- */
-static int
-xpvd_write(FILE *outfile)
-{
-	vol_desc.type[0] = ISO_VD_SUPPLEMENTARY;
-	vol_desc.version[0] = 2;
-	vol_desc.file_structure_version[0] = 2;
-
-	/* if not a bootable cd do it the old way */
-	jtwrite(&vol_desc, SECTOR_SIZE, 1, 0, FALSE);
-	xfwrite(&vol_desc, SECTOR_SIZE, 1, outfile, 0, FALSE);
-	last_extent_written++;
-	return (0);
-}
-
-/*
- * Function to write the EVD for the disc.
- */
-static int
-evd_write(FILE *outfile)
-{
-	struct iso_primary_descriptor evol_desc;
-
-	/*
-	 * Now write the end volume descriptor.  Much simpler than the other
-	 * one
-	 */
-	memset(&evol_desc, 0, sizeof (evol_desc));
-	evol_desc.type[0] = (unsigned char) ISO_VD_END;
-	memcpy(evol_desc.id, ISO_STANDARD_ID, sizeof (ISO_STANDARD_ID));
-	evol_desc.version[0] = 1;
-	jtwrite(&evol_desc, SECTOR_SIZE, 1, 0, TRUE);
-	xfwrite(&evol_desc, SECTOR_SIZE, 1, outfile, 0, TRUE);
-	last_extent_written += 1;
-	return (0);
-}
-
-/*
- * Function to write the version information for the disc.
- */
-static int
-vers_write(FILE *outfile)
-{
-	char		vers[SECTOR_SIZE+1];
-	int		X_ac;
-	char		**X_av;
-	char		*cp;
-	int		i;
-	int		idx = 4;
-	int		len;
-	extern char	version_string[];
-	extern int	path_ind;
-
-	/* Now write the version descriptor. */
-	memset(vers, 0, sizeof (vers));
-	strcpy(vers, "MKI ");
-
-	cp = vers;
-	X_ac = saved_ac();
-	X_av = saved_av();
-	strcpy(&cp[idx], ctime(&begun));
-	idx += 25;
-	strcpy(&cp[idx], version_string);
-	idx += strlen(version_string);
-	for (i = 1; i < X_ac; i++) {
-		len = strlen(X_av[i]);
-		if ((idx + len + 2) >= SECTOR_SIZE)
-			break;
-		cp[idx++] = ' ';
-		/*
-		 * Do not give away secret information when not in debug mode.
-		 */
-		if (debug)
-			strcpy(&cp[idx], X_av[i]);
-		else if (i >= path_ind)
-			len = graftcp(&cp[idx], X_av[i], &vers[SECTOR_SIZE-1]);
-		else if (X_av[i][0] == '/')
-			len = pathcp(&cp[idx], X_av[i], &vers[SECTOR_SIZE-1]);
-		else
-			strcpy(&cp[idx], X_av[i]);
-		idx += len;
-	}
-
-	cp[SECTOR_SIZE - 1] = '\0';
- 	/* Per default: keep privacy. Blackout the version and arguments. */
-	if(getenv("ISODEBUG")) {
-		jtwrite(vers, SECTOR_SIZE, 1, 0, TRUE);
-		xfwrite(vers, SECTOR_SIZE, 1, outfile, 0, TRUE);
-	} else {
-		jtwrite(calloc(SECTOR_SIZE, 1), SECTOR_SIZE, 1, 0, TRUE);
-		xfwrite(calloc(SECTOR_SIZE, 1), SECTOR_SIZE, 1, outfile, 0, TRUE);
-	}
-    last_extent_written += 1;
-	return (0);
-}
-
-/*
- * Avoid to write unwanted information into the version info string.
- */
-static int
-graftcp(char *to, char *from, char *ep)
-{
-	int	len = strlen(from);
-	char	*node = NULL;
-
-	if (use_graft_ptrs)
-		node = findgequal(from);
-
-	if (node == NULL) {
-		len = 0;
-		node = from;
-	} else {
-		len = node - from;
-		*node = '\0';
-		strncpy(to, from, ep - to);
-		*node++ = '=';
-		to += len++;
-		*to++ = '=';
-	}
-	return (len + pathcp(to, node, ep));
-}
-
-static int
-pathcp(char *to, char *from, char *ep)
-{
-	int	len = strlen(from);
-	char	*p;
-
-	p = strrchr(from, '/');
-	if (p == NULL) {
-		strncpy(to, from, ep - to);
-	} else {
-		if (p[1] == '\0') {
-			--p;
-			while (p > from && *p != '/')
-				--p;
-		}
-		len = 0;
-		if (*p == '/') {
-			strncpy(to, "...", ep - to);
-			to += 3;
-			len = 3;
-		}
-		if (to < ep) {
-			strncpy(to, p, ep - to);
-			len += strlen(to);
-		}
-	}
-	return (len);
-}
-
-
-/*
- * Function to write the path table for the disc.
- */
-static int
-pathtab_write(FILE *outfile)
-{
-	/* Next we write the path tables */
-	jtwrite(path_table_l, path_blocks << 11, 1, 0, FALSE);
-	xfwrite(path_table_l, path_blocks << 11, 1, outfile, 0, FALSE);
-	last_extent_written += path_blocks;
-	jtwrite(path_table_m, path_blocks << 11, 1, 0, FALSE);
-	xfwrite(path_table_m, path_blocks << 11, 1, outfile, 0, FALSE);
-	last_extent_written += path_blocks;
-	free(path_table_l);
-	free(path_table_m);
-	path_table_l = NULL;
-	path_table_m = NULL;
-	return (0);
-}
-
-static int
-exten_write(FILE *outfile)
-{
-	jtwrite(extension_record, SECTOR_SIZE, 1, 0, FALSE);
-	xfwrite(extension_record, SECTOR_SIZE, 1, outfile, 0, FALSE);
-	last_extent_written++;
-	return (0);
-}
-
-/*
- * Functions to describe padding block at the start of the disc.
- */
-int
-oneblock_size(int starting_extent)
-{
-	last_extent++;
-	return (0);
-}
-
-/*
- * Functions to describe path table size.
- */
-static int
-pathtab_size(int starting_extent)
-{
-	path_table[0] = starting_extent;
-
-	path_table[1] = 0;
-	path_table[2] = path_table[0] + path_blocks;
-	path_table[3] = 0;
-	last_extent += 2 * path_blocks;
-	return (0);
-}
-
-/*
- * Functions to describe padding blocks before PVD.
- */
-static int
-startpad_size(int starting_extent)
-{
-	last_extent = session_start + 16;
-	return (0);
-}
-
-/*
- * Functions to describe padding blocks between sections.
- */
-static int
-interpad_size(int starting_extent)
-{
-	int	emod = 0;
-
-#ifdef	needed
-	starting_extent += 16;	/* First add 16 pad blocks */
-#endif
-	if ((emod = starting_extent % 16) != 0) {
-		starting_extent += 16 - emod;	/* Now pad to mod 16 #	   */
-	}
-	last_extent = starting_extent;
-	return (0);
-}
-
-/*
- * Functions to describe padding blocks at end of disk.
- */
-static int
-endpad_size(int starting_extent)
-{
-	starting_extent += 150;			/* 150 pad blocks (post gap) */
-	last_extent = starting_extent;
-	return (0);
-}
-
-static int
-file_gen()
-{
-#ifdef APPLE_HYB
-	int	start_extent = last_extent;	/* orig ISO files start */
-
-#endif	/* APPLE_HYB */
-
-	if (!assign_file_addresses(root)) {
-#ifdef DVD_VIDEO
-		if (dvd_video) {
-			comerrno(EX_BAD, "Unable to make a DVD-Video image.\n"
-            "Possible reasons:\n"
-            "  - VIDEO_TS subdirectory was not found on specified location\n"
-            "  - VIDEO_TS has invalid contents\n"
-            );
-		}
-#else
-		;	/* EMPTY */
-#endif
-	}
-
-
-#ifdef SORTING
-	if (do_sort) {
-		if (sort_file_addresses() == 0)
-			reassign_link_addresses(root);
-	}
-#endif /* SORTING */
-
-#ifdef APPLE_HYB
-	/*
-	 * put this here for the time being - may when I've worked out how to
-	 * use Eric's new system for creating/writing parts of the image it
-	 * may move to it's own routine
-	 */
-	if (apple_hyb)
-		hfs_file_gen(start_extent);
-#ifdef PREP_BOOT
-	else if (use_prep_boot || use_chrp_boot)
-		gen_prepboot();
-#endif	/* PREP_BOOT */
-#endif	/* APPLE_HYB */
-
-	return (0);
-}
-
-static int
-dirtree_dump()
-{
-	if (verbose > 2) {
-		dump_tree(root);
-	}
-	return (0);
-}
-
-static int
-dirtree_fixup(int starting_extent)
-{
-	if (use_RockRidge && reloc_dir)
-		finish_cl_pl_entries();
-
-	if (use_RockRidge)
-		update_nlink_field(root);
-	return (0);
-}
-
-static int
-dirtree_size(int starting_extent)
-{
-	assign_directory_addresses(root);
-	return (0);
-}
-
-static int
-ext_size(int starting_extent)
-{
-	extern int		extension_record_size;
-	struct directory_entry *s_entry;
-
-	extension_record_extent = starting_extent;
-	s_entry = root->contents;
-	set_733((char *) s_entry->rr_attributes + s_entry->rr_attr_size - 24,
-		extension_record_extent);
-	set_733((char *) s_entry->rr_attributes + s_entry->rr_attr_size - 8,
-		extension_record_size);
-	last_extent++;
-	return (0);
-}
-
-static int
-dirtree_write(FILE *outfile)
-{
-	generate_iso9660_directories(root, outfile);
-	return (0);
-}
-
-static int
-dirtree_cleanup(FILE *outfile)
-{
-	free_directories(root);
-	return (0);
-}
-
-static int
-startpad_write(FILE *outfile)
-{
-	char	buffer[SECTOR_SIZE];
-	int	i;
-	int	npad;
-
-	memset(buffer, 0, sizeof (buffer));
-
-	npad = session_start + 16 - last_extent_written;
-
-	for (i = 0; i < npad; i++) {
-		jtwrite(buffer, sizeof (buffer), 1, 0, FALSE);
-		xfwrite(buffer, sizeof (buffer), 1, outfile, 0, FALSE);
-		last_extent_written++;
-	}
-
-	return (0);
-}
-
-static int
-interpad_write(FILE *outfile)
-{
-	char	buffer[SECTOR_SIZE];
-	int	i;
-	int	npad = 0;
-
-	memset(buffer, 0, sizeof (buffer));
-
-#ifdef	needed
-	npad = 16;
-#endif
-	if ((i = last_extent_written % 16) != 0)
-		npad += 16 - i;
-
-	for (i = 0; i < npad; i++) {
-		jtwrite(buffer, sizeof (buffer), 1, 0, FALSE);
-		xfwrite(buffer, sizeof (buffer), 1, outfile, 0, FALSE);
-		last_extent_written++;
-	}
-
-	return (0);
-}
-
-static int
-endpad_write(FILE *outfile)
-{
-	char	buffer[SECTOR_SIZE];
-	int	i;
-
-	memset(buffer, 0, sizeof (buffer));
-
-	for (i = 0; i < 150; i++) {
-		jtwrite(buffer, sizeof (buffer), 1, 0, FALSE);
-		xfwrite(buffer, sizeof (buffer), 1, outfile, 0, FALSE);
-		last_extent_written++;
-	}
-
-	return (0);
-}
-
-#ifdef APPLE_HYB
-
-/*
- *	hfs_get_parms:	get HFS parameters from the command line
- */
-
-static int
-hfs_get_parms(char *key)
-{
-	int	ret = 0;
-	char	*p;
-
-	if (hfs_parms == NULL)
-		return (ret);
-
-	if ((p = strstr(hfs_parms, key)) != NULL) {
-		p += strlen(key) + 1;
-		sscanf(p, "%d", &ret);
-	}
-
-	return (ret);
-}
-
-/*
- *	hfs_file_gen:	set up "fake" HFS volume using the ISO9660 tree
- */
-static void
-hfs_file_gen(int start_extent)
-{
-	int	Csize;	/* clump size for HFS vol */
-	int	loop;
-	int	last_extent_save = last_extent;
-	char	*p;
-
-	/* allocate memory for the libhfs/mkisoimage extra info */
-	hce = (hce_mem *) e_malloc(sizeof (hce_mem));
-
-	hce->error = (char *) e_malloc(1024);
-
-	/* mark as unallocated for use later */
-	hce->hfs_ce = hce->hfs_hdr = hce->hfs_map = 0;
-
-	/* reserve space for the label partition - if it is needed */
-#ifdef PREP_BOOT
-	/* a PReP bootable partition needs the map.. */
-	if (gen_pt || use_prep_boot || use_chrp_boot)
-#else
-	if (gen_pt)
-#endif	/* PREP_BOOT */
-		hce->hfs_map_size = HFS_MAP_SIZE;
-	else
-		hce->hfs_map_size = 0;
-
-	/* set the HFS parameter string to upper case */
-	if (hfs_parms) {
-		for (p = hfs_parms; *p; p++)
-			*p = toupper(*p);
-	}
-
-	/* set the initial factor to increase Catalog file size */
-	if ((hce->ctc_size = hfs_get_parms("CTC")) == 0)
-		hce->ctc_size = CTC;
-
-	/* set the max size of the Catalog file */
-	if ((hce->max_XTCsize = hfs_get_parms("MAX_XTCSIZE")) == 0)
-		hce->max_XTCsize = MAX_XTCSIZE;
-
-	/* set the number of time to try to make an HFS volume */
-	if ((loop = hfs_get_parms("CTC_LOOP")) == 0)
-		loop = CTC_LOOP;
-
-	/*
-	 * "create" the HFS volume (just the header, catalog/extents files) if
-	 * there's a problem with the Catalog file being too small, we keep on
-	 * increasing the size (up to CTC_LOOP) times and try again.
-	 * Unfortunately I don't know enough about the inner workings of HFS,
-	 * so I can't workout the size of the Catalog file in advance (and I
-	 * don't want to "grow" as is is normally allowed to), therefore, this
-	 * approach is a bit over the top as it involves throwing away the
-	 * "volume" we have created and trying again ...
-	 */
-	do {
-		hce->error[0] = '\0';
-
-		/* attempt to create the Mac volume */
-		Csize = make_mac_volume(root, start_extent);
-
-		/* if we have a problem ... */
-		if (Csize < 0) {
-			/*
-			 * we've made too many attempts, or got some other
-			 * error
-			 */
-			if (loop == 0 || errno != HCE_ERROR) {
-				/* HCE_ERROR is not a valid errno value */
-				if (errno == HCE_ERROR)
-					errno = 0;
-
-				/* exit with the error */
-				if (*hce->error)
-					fprintf(stderr, "%s\n", hce->error);
-				perr(hfs_error);
-			} else {
-				/* increase Catalog file size factor */
-				hce->ctc_size *= CTC;
-
-				/*
-				 * reset the initial "last_extent" and try
-				 * again
-				 */
-				last_extent = last_extent_save;
-			}
-		} else {
-			/* everything OK - just carry on ... */
-			loop = 0;
-		}
-	}
-	while (loop--);
-
-	hfs_extra = HFS_ROUND_UP(hce->hfs_tot_size) / SECTOR_SIZE;
-
-	last_extent += hfs_extra;
-
-	/* generate the Mac label and HFS partition maps */
-	mac_boot.name = hfs_boot_file;
-
-	/*
-	 * only generate the partition tables etc. if we are making a bootable
-	 * CD - or if the -part option is given
-	 */
-	if (gen_pt) {
-		if (gen_mac_label(&mac_boot)) {
-			if (*hce->error)
-				fprintf(stderr, "%s\n", hce->error);
-			perr(hfs_error);
-		}
-	}
-	/* set Autostart filename if required */
-	if (autoname) {
-		if (autostart())
-			perr("Autostart filename must less than 12 characters");
-	}
-	/* finished with any HFS type errors */
-	free(hce->error);
-	hce->error = 0;
-
-	/*
-	 * the ISO files need to start on a multiple of the HFS allocation
-	 * blocks, so find out how much padding we need
-	 */
-
-	/*
-	 * take in accout alignment of files wrt HFS volume start - remove any
-	 * previous session as well
-	 */
-	start_extent -= session_start;
-	hfs_pad = ROUND_UP(start_extent*SECTOR_SIZE +
-			(hce->hfs_hdr_size + hce->hfs_map_size) * HFS_BLOCKSZ,
-							Csize) / SECTOR_SIZE;
-
-	hfs_pad -= (start_extent + (hce->hfs_hdr_size + hce->hfs_map_size) /
-							HFS_BLK_CONV);
-
-#ifdef PREP_BOOT
-	gen_prepboot_label(hce->hfs_map);
-#endif	/* PREP_BOOT */
-
-}
-
-#ifdef PREP_BOOT
-static void
-gen_prepboot()
-{
-	/*
-	 * we need to allocate the hce struct since hce->hfs_map is used to
-	 * generate the fdisk partition map required for PReP booting
-	 */
-	hce = (hce_mem *) e_malloc(sizeof (hce_mem));
-
-	/* mark as unallocated for use later */
-	hce->hfs_ce = hce->hfs_hdr = hce->hfs_map = 0;
-
-	/* reserve space for the label partition - if it is needed */
-	hce->hfs_map_size = HFS_MAP_SIZE;
-
-	hce->hfs_map = (unsigned char *) e_malloc(hce->hfs_map_size * HFS_BLOCKSZ);
-	gen_prepboot_label(hce->hfs_map);
-}
-
-#endif	/* PREP_BOOT */
-
-/*
- *	get_adj_size:	get the ajusted size of the volume with the HFS
- *			allocation block size for each file
- */
-Ulong
-get_adj_size(int Csize)
-{
-	struct deferred_write *dw;
-	Ulong		size = 0;
-	int		count = 0;
-
-	/* loop through all the files finding the new total size */
-	for (dw = dw_head; dw; dw = dw->next) {
-		size += (ROUND_UP(dw->size, Csize)/HFS_BLOCKSZ);
-		count++;
-	}
-
-	/*
-	 * crude attempt to prevent overflows - HFS can only cope with a
-	 * maximum of about 65536 forks (actually less) - this will trap cases
-	 * when we have far too many files
-	 */
-
-	if (count >= 65536)
-		return (-1);
-	else
-		return (size);
-}
-
-/*
- *	adj_size:	adjust the ISO record entries for all files
- *			based on the HFS allocation block size
- */
-int
-adj_size(int Csize, int start_extent, int extra)
-{
-	struct deferred_write *dw;
-	struct directory_entry *s_entry;
-	int		size;
-
-	/* get the adjusted start_extent (with padding) */
-	/* take in accout alignment of files wrt HFS volume start */
-
-	start_extent -= session_start;
-
-	start_extent = ROUND_UP(start_extent*SECTOR_SIZE + extra*HFS_BLOCKSZ,
-						Csize) / SECTOR_SIZE;
-
-	start_extent -= (extra / HFS_BLK_CONV);
-
-	start_extent += session_start;
-
-	/* initialise file hash */
-	flush_hash();
-
-	/*
-	 * loop through all files changing their starting blocks and finding
-	 * any padding needed to written out latter
-	 */
-	for (dw = dw_head; dw; dw = dw->next) {
-		s_entry = dw->s_entry;
-		s_entry->starting_block = dw->extent = start_extent;
-		set_733((char *) s_entry->isorec.extent, start_extent);
-		size = ROUND_UP(dw->size, Csize) / SECTOR_SIZE;
-		dw->pad = size - ISO_ROUND_UP(dw->size) / SECTOR_SIZE;
-
-		/*
-		 * cache non-HFS files - as there may be multiple links to
-		 * these files (HFS files can't have multiple links). We will
-		 * need to change the starting extent of the other links later
-		 */
-		if (!s_entry->hfs_ent)
-			add_hash(s_entry);
-
-		start_extent += size;
-	}
-
-	return (start_extent);
-}
-
-/*
- *	adj_size_other:	adjust any non-HFS files that may be linked
- *			to an existing file (i.e. not have a deferred_write
- *			entry of it's own
- */
-void
-adj_size_other(struct directory *dpnt)
-{
-	struct directory_entry *s_entry;
-	struct file_hash *s_hash;
-
-	while (dpnt) {
-		s_entry = dpnt->contents;
-		for (s_entry = dpnt->contents; s_entry;
-						s_entry = s_entry->next) {
-			/*
-			 * if it's an HFS file or a directory - then ignore
-			 * (we're after non-HFS files)
-			 */
-			if (s_entry->hfs_ent ||
-			    (s_entry->isorec.flags[0] & ISO_DIRECTORY))
-				continue;
-
-			/*
-			 * find any cached entry and assign new starting
-			 * extent
-			 */
-			s_hash = find_hash(s_entry->dev, s_entry->inode);
-			if (s_hash) {
-				set_733((char *) s_entry->isorec.extent,
-						s_hash->starting_block);
-				/* not vital - but tidy */
-				s_entry->starting_block =
-							s_hash->starting_block;
-			}
-		}
-		if (dpnt->subdir) {
-			adj_size_other(dpnt->subdir);
-		}
-		dpnt = dpnt->next;
-	}
-
-	/* clear file hash */
-	flush_hash();
-}
-
-/*
- *	hfs_hce_write:	write out the HFS header stuff
- */
-static int
-hfs_hce_write(FILE *outfile)
-{
-	char	buffer[SECTOR_SIZE];
-	int	n = 0;
-	int	r;	/* HFS hdr output */
-	int	tot_size = hce->hfs_map_size + hce->hfs_hdr_size;
-
-	memset(buffer, 0, sizeof (buffer));
-
-	/*
-	 * hack time ... if the tot_size is greater than 32Kb then
-	 * it won't fit in the first 16 blank SECTORS (64 512 byte
-	 * blocks, as most of this is padding, we just truncate this
-	 * data to 64x4xHFS_BLOCKSZ ... hope this is OK ...
-	 */
-
-	if (tot_size > 64) tot_size = 64;
-
-	/* get size in CD blocks == 4xHFS_BLOCKSZ == 2048 */
-	n = tot_size / HFS_BLK_CONV;
-	r = tot_size % HFS_BLK_CONV;
-
-	/* write out HFS volume header info */
-	jtwrite(hce->hfs_map, HFS_BLOCKSZ, tot_size, 0, FALSE);
-	xfwrite(hce->hfs_map, HFS_BLOCKSZ, tot_size, outfile, 0, FALSE);
-
-	/* fill up to a complete CD block */
-	if (r) {
-		jtwrite(buffer, HFS_BLOCKSZ, HFS_BLK_CONV - r, 0, FALSE);
-		xfwrite(buffer, HFS_BLOCKSZ, HFS_BLK_CONV - r, outfile, 0, FALSE);
-		n++;
-	}
-	last_extent_written += n;
-	return (0);
-}
-
-/*
- *	insert_padding_file : insert a dumy file to make volume at least
- *				800k
- *
- *	XXX If we ever need to write more then 2 GB, make size off_t
- */
-int
-insert_padding_file(int size)
-{
-	struct deferred_write *dwpnt;
-
-	/* get the size in bytes */
-	size *= HFS_BLOCKSZ;
-
-	dwpnt = (struct deferred_write *)
-		e_malloc(sizeof (struct deferred_write));
-	dwpnt->s_entry = 0;
-	/* set the padding to zero */
-	dwpnt->pad = 0;
-	/* set offset to zero */
-	dwpnt->off = (off_t)0;
-
-	/*
-	 * don't need to wory about the s_entry stuff as it won't be touched#
-	 * at this point onwards
-	 */
-
-	/* insert the entry in the list */
-	if (dw_tail) {
-		dw_tail->next = dwpnt;
-		dw_tail = dwpnt;
-	} else {
-		dw_head = dwpnt;
-		dw_tail = dwpnt;
-	}
-
-	/* aloocate memory as a "Table" file */
-	dwpnt->table = e_malloc(size);
-	dwpnt->name = NULL;
-
-	dwpnt->next = NULL;
-	dwpnt->size = size;
-	dwpnt->extent = last_extent;
-	last_extent += ISO_BLOCKS(size);
-
-	/* retune the size in HFS blocks */
-	return (ISO_ROUND_UP(size) / HFS_BLOCKSZ);
-}
-
-struct output_fragment hfs_desc		= {NULL, NULL, NULL, hfs_hce_write, "HFS volume header"};
-
-#endif	/* APPLE_HYB */
-
-struct output_fragment startpad_desc	= {NULL, startpad_size,	NULL,	  startpad_write, "Initial Padblock"};
-struct output_fragment voldesc_desc	= {NULL, oneblock_size,	root_gen, pvd_write,	  "Primary Volume Descriptor"};
-struct output_fragment xvoldesc_desc	= {NULL, oneblock_size,	NULL,	  xpvd_write,	  "Enhanced Volume Descriptor"};
-struct output_fragment end_vol		= {NULL, oneblock_size,	NULL,	  evd_write,	  "End Volume Descriptor" };
-struct output_fragment version_desc	= {NULL, oneblock_size,	NULL,	  vers_write,	  "Version block" };
-struct output_fragment pathtable_desc	= {NULL, pathtab_size,	generate_path_tables, pathtab_write, "Path table"};
-struct output_fragment dirtree_desc	= {NULL, dirtree_size,	NULL,	  dirtree_write,  "Directory tree" };
-struct output_fragment dirtree_clean	= {NULL, dirtree_fixup,	dirtree_dump, dirtree_cleanup, "Directory tree cleanup" };
-struct output_fragment extension_desc	= {NULL, ext_size,	NULL,	  exten_write,	  "Extension record" };
-struct output_fragment files_desc	= {NULL, NULL,		file_gen, file_write,	  "The File(s)"};
-struct output_fragment interpad_desc	= {NULL, interpad_size,	NULL,	  interpad_write, "Intermediate Padblock"};
-struct output_fragment endpad_desc	= {NULL, endpad_size,	NULL,	  endpad_write,	  "Ending Padblock"};

Copied: cdrkit/trunk/genisoimage/write.c (from rev 452, cdrkit/trunk/mkisoimage/write.c)




More information about the Debburn-changes mailing list