Robert Millan 2009-11-08 22:52:08 +00:00
parent 63eb2d63b1
commit 11e9a11511
18 changed files with 1364 additions and 218 deletions

View file

@ -2,12 +2,14 @@
* Header file defaults.h - assorted default values for character strings in
* the volume descriptor.
*
* $Id: defaults.h,v 1.6 1998/06/02 02:40:37 eric Exp $
* $Id: defaults.h,v 1.8 1999/03/02 03:41:25 eric Exp $
*/
#define PREPARER_DEFAULT NULL
#define PUBLISHER_DEFAULT NULL
#define APPID_DEFAULT NULL
#ifndef APPID_DEFAULT
#define APPID_DEFAULT "MKISOFS ISO 9660 FILESYSTEM BUILDER"
#endif
#define COPYRIGHT_DEFAULT NULL
#define BIBLIO_DEFAULT NULL
#define ABSTRACT_DEFAULT NULL
@ -24,7 +26,7 @@
#endif
#ifdef __sun
#ifdef __svr4__
#ifdef __SVR4
#define SYSTEM_ID_DEFAULT "Solaris"
#else
#define SYSTEM_ID_DEFAULT "SunOS"

View file

@ -21,7 +21,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
static char rcsid[] ="$Id: eltorito.c,v 1.12 1998/06/02 02:40:37 eric Exp $";
static char rcsid[] ="$Id: eltorito.c,v 1.13 1999/03/02 03:41:25 eric Exp $";
#include <stdio.h>
#include <sys/types.h>
@ -44,8 +44,9 @@ static char rcsid[] ="$Id: eltorito.c,v 1.12 1998/06/02 02:40:37 eric Exp $";
static struct eltorito_validation_entry valid_desc;
static struct eltorito_defaultboot_entry default_desc;
static struct eltorito_boot_descriptor boot_desc;
static struct eltorito_boot_descriptor gboot_desc;
static int tvd_write __PR((FILE * outfile));
/*
* Check for presence of boot catalog. If it does not exist then make it
@ -275,13 +276,13 @@ void FDECL1(get_torito_desc, struct eltorito_boot_descriptor *, boot_desc)
/*
* Function to write the EVD for the disc.
*/
int FDECL1(tvd_write, FILE *, outfile)
static int FDECL1(tvd_write, FILE *, outfile)
{
/*
* Next we write out the boot volume descriptor for the disc
*/
get_torito_desc(&boot_desc);
xfwrite(&boot_desc, 1, 2048, outfile);
get_torito_desc(&gboot_desc);
xfwrite(&gboot_desc, 1, 2048, outfile);
last_extent_written ++;
return 0;
}

View file

@ -3,8 +3,8 @@
* added 'exclude' option (-x) to specify pathnames NOT to be included in
* CD image.
*
* $Id: exclude.h,v 1.1 1997/02/23 15:53:19 eric Rel $
* $Id: exclude.h,v 1.2 1999/03/02 03:41:25 eric Exp $
*/
void exclude();
int is_excluded();
void exclude __PR((char * fn));
int is_excluded __PR((char * fn));

View file

@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
static char rcsid[] ="$Id: fnmatch.c,v 1.3 1997/03/22 02:53:13 eric Rel $";
static char rcsid[] ="$Id: fnmatch.c,v 1.4 1999/03/02 03:41:25 eric Exp $";
#ifdef HAVE_CONFIG_H
#include <config.h>
@ -26,6 +26,10 @@ static char rcsid[] ="$Id: fnmatch.c,v 1.3 1997/03/22 02:53:13 eric Rel $";
#include <errno.h>
#include <fnmatch.h>
#ifndef __STDC__
#define const
#endif
#ifndef FNM_FILE_NAME
#define FNM_FILE_NAME FNM_PATHNAME /* Preferred GNU name. */
#endif
@ -81,7 +85,7 @@ fnmatch (pattern, string, flags)
while ((c = *p++) != '\0')
{
c = FOLD (c);
c = FOLD ((unsigned char)c);
switch (c)
{
@ -99,9 +103,9 @@ fnmatch (pattern, string, flags)
if (!(flags & FNM_NOESCAPE))
{
c = *p++;
c = FOLD (c);
c = FOLD ((unsigned char )c);
}
if (FOLD (*n) != c)
if (FOLD ((unsigned char )*n) != c)
return FNM_NOMATCH;
break;
@ -120,9 +124,9 @@ fnmatch (pattern, string, flags)
{
char c1 = (!(flags & FNM_NOESCAPE) && c == '\\') ? *p : c;
c1 = FOLD (c1);
c1 = FOLD ((unsigned char )c1);
for (--p; *n != '\0'; ++n)
if ((c == '[' || FOLD (*n) == c1) &&
if ((c == '[' || FOLD ((unsigned char )*n) == c1) &&
fnmatch (p, n, flags & ~FNM_PERIOD) == 0)
return 0;
return FNM_NOMATCH;
@ -152,14 +156,14 @@ fnmatch (pattern, string, flags)
if (!(flags & FNM_NOESCAPE) && c == '\\')
cstart = cend = *p++;
cstart = cend = FOLD (cstart);
cstart = cend = FOLD ((unsigned char)cstart);
if (c == '\0')
/* [ (unterminated) loses. */
return FNM_NOMATCH;
c = *p++;
c = FOLD (c);
c = FOLD ((unsigned char)c);
if ((flags & FNM_FILE_NAME) && c == '/')
/* [/] can never match. */
@ -172,12 +176,12 @@ fnmatch (pattern, string, flags)
cend = *p++;
if (cend == '\0')
return FNM_NOMATCH;
cend = FOLD (cend);
cend = FOLD ((unsigned char)cend);
c = *p++;
}
if (FOLD (*n) >= cstart && FOLD (*n) <= cend)
if (FOLD ((unsigned char)*n) >= cstart && FOLD ((unsigned char)*n) <= cend)
goto matched;
if (c == ']')
@ -206,7 +210,7 @@ fnmatch (pattern, string, flags)
break;
default:
if (c != FOLD (*n))
if (c != FOLD ((unsigned char)*n))
return FNM_NOMATCH;
}

View file

@ -0,0 +1,57 @@
/* @(#)fctldefs.h 1.2 98/10/08 Copyright 1996 J. Schilling */
/*
* Generic header for users of open(), creat() and chmod()
*
* Copyright (c) 1996 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; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef _FCTLDEFS_H
#define _FCTLDEFS_H
#ifndef _MCONFIG_H
#include <mconfig.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#else /* HAVE_FCNTL_H */
# include <sys/file.h>
#endif /* HAVE_FCNTL_H */
/*
* Do not define more than O_RDONLY / O_WRONLY / O_RDWR
* The values may differ.
*/
#ifndef O_RDONLY
#define O_RDONLY 0
#endif
#ifndef O_WRONLY
#define O_WRONLY 1
#endif
#ifndef O_RDWR
#define O_RDWR 2
#endif
#endif /* _FCTLDEFS_H */

View file

@ -0,0 +1,268 @@
/* @(#)mconfig.h 1.24 98/12/14 Copyright 1995 J. Schilling */
/*
* definitions for machine configuration
*
* Copyright (c) 1995 J. Schilling
*
* This file must be included before any other file.
* Use only cpp instructions.
*
* NOTE: SING: (Schily Is Not Gnu)
*/
/*
* 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.
*/
#ifndef _MCONFIG_H
#define _MCONFIG_H
/*
* This hack that is needed as long as VMS has no POSIX shell.
*/
#ifdef VMS
# define USE_STATIC_CONF
#endif
#ifdef VANILLA_AUTOCONF
#include <config.h>
#else
#ifdef USE_STATIC_CONF
#include <xmconfig.h> /* This is the current static autoconf stuff */
#else
#include <xconfig.h> /* This is the current dynamic autoconf stuff */
#endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
#if defined(unix) || defined(__unix) || defined(__unix__)
# define IS_UNIX
#endif
#ifdef __MSDOS__
# define IS_MSDOS
#endif
#if defined(tos) || defined(__tos)
# define IS_TOS
#endif
#ifdef THINK_C
# define IS_MAC
#endif
#if defined(sun) || defined(__sun) || defined(__sun__)
# define IS_SUN
#endif
#if defined(__CYGWIN32__)
# define IS_GCC_WIN32
#endif
/*--------------------------------------------------------------------------*/
/*
* Some magic that cannot (yet) be figured out with autoconf.
*/
#ifdef sparc
# ifndef HAVE_LDSTUB
# define HAVE_LDSTUB
# endif
# ifndef HAVE_SCANSTACK
# define HAVE_SCANSTACK
# endif
#endif
#if defined(__i386_) || defined(i386)
# ifndef HAVE_XCHG
# define HAVE_XCHG
# endif
# ifndef HAVE_SCANSTACK
# define HAVE_SCANSTACK
# endif
#endif
#if defined(SOL2) || defined(SOL2) || defined(S5R4) || defined(__S5R4) \
|| defined(SVR4)
# ifndef __SVR4
# define __SVR4
# endif
#endif
#ifdef __SVR4
# ifndef SVR4
# define SVR4
# endif
#endif
/*
* SunOS 4.x / SunOS 5.x
*/
#if defined(IS_SUN)
# define HAVE_GETAV0
#endif
/*
* AIX
*/
#if defined(_IBMR2) || defined(_AIX)
# define IS_UNIX /* ??? really ??? */
#endif
/*
* Silicon Graphics (must be before SVR4)
*/
#if defined(sgi) || defined(__sgi)
# define __NOT_SVR4__ /* Not a real SVR4 implementation */
#endif
/*
* Data General
*/
#if defined(__DGUX__)
#ifdef XXXXXXX
# undef HAVE_MTGET_DSREG
# undef HAVE_MTGET_RESID
# undef HAVE_MTGET_FILENO
# undef HAVE_MTGET_BLKNO
#endif
# define mt_type mt_model
# define mt_dsreg mt_status1
# define mt_erreg mt_status2
/*
* DGUX hides its flock as dg_flock.
*/
# define HAVE_FLOCK
# define flock dg_flock
/*
* Use the BSD style wait on DGUX to get the resource usages of child
* processes.
*/
# define _BSD_WAIT_FLAVOR
#endif
/*
* Apple Rhapsody
*/
#if defined(__NeXT__) && defined(__TARGET_OSNAME) && __TARGET_OSNAME == rhapsody
# define HAVE_OSDEF /* prevent later definitions to overwrite current */
#endif
/*
* NextStep
*/
#if defined(__NeXT__) && !defined(HAVE_OSDEF)
#define NO_PRINT_OVR
#undef HAVE_USG_STDIO /*
* NeXT Step 3.x uses __flsbuf(unsigned char , FILE *)
* instead of __flsbuf(int, FILE *)
*/
#endif
/*
* NextStep 3.x has a broken linker that does not allow us to override
* these functions.
*/
#ifndef __OPRINTF__
#ifdef NO_PRINT_OVR
# define printf Xprintf
# define fprintf Xfprintf
# define sprintf Xsprintf
#endif
#endif /* __OPRINTF__ */
/*--------------------------------------------------------------------------*/
/*
* If there is no flock defined by the system, use emulation
* through fcntl record locking.
*/
#ifndef HAVE_FLOCK
#define LOCK_SH 1 /* shared lock */
#define LOCK_EX 2 /* exclusive lock */
#define LOCK_NB 4 /* don't block when locking */
#define LOCK_UN 8 /* unlock */
#endif
#include <prototyp.h>
/*
* gcc 2.x generally implements the long long type.
*/
#ifdef __GNUC__
# if __GNUC__ > 1
# ifndef HAVE_LONGLONG
# define HAVE_LONGLONG
# endif
# endif
#endif
/*
* Convert to GNU name
*/
#ifdef HAVE_STDC_HEADERS
# ifndef STDC_HEADERS
# define STDC_HEADERS
# endif
#endif
/*
* Convert to SCHILY name
*/
#ifdef STDC_HEADERS
# ifndef HAVE_STDC_HEADERS
# define HAVE_STDC_HEADERS
# endif
#endif
#ifdef IS_UNIX
# define PATH_DELIM '/'
# define PATH_DELIM_STR "/"
# define far
# define near
#endif
#ifdef IS_GCC_WIN32
# define PATH_DELIM '/'
# define PATH_DELIM_STR "/"
# define far
# define near
#endif
#ifdef IS_MSDOS
# define PATH_DELIM '\\'
# define PATH_DELIM_STR "\\"
#endif
#ifdef IS_TOS
# define PATH_DELIM '\\'
# define PATH_DELIM_STR "\\"
# define far
# define near
#endif
#ifdef IS_MAC
# define PATH_DELIM ':'
# define PATH_DELIM_STR ":"
# define far
# define near
#endif
#ifdef __cplusplus
}
#endif
#endif /* _MCONFIG_H */

View file

@ -0,0 +1,74 @@
/* @(#)prototyp.h 1.7 98/10/08 Copyright 1995 J. Schilling */
/*
* Definitions for dealing with ANSI / KR C-Compilers
*
* Copyright (c) 1995 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; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef _PROTOTYP_H
#define _PROTOTYP_H
#ifndef PROTOTYPES
/*
* If this has already been defined,
* someone else knows better than us...
*/
# ifdef __STDC__
# if __STDC__ /* ANSI C */
# define PROTOTYPES
# endif
# if defined(sun) && __STDC__ - 0 == 0 /* Sun C */
# define PROTOTYPES
# endif
# endif
#endif /* PROTOTYPES */
/*
* If we have prototypes, we should have stdlib.h string.h stdarg.h
*/
#ifdef PROTOTYPES
#if !(defined(SABER) && defined(sun))
# ifndef HAVE_STDARG_H
# define HAVE_STDARG_H
# endif
#endif
# ifndef HAVE_STDLIB_H
# define HAVE_STDLIB_H
# endif
# ifndef HAVE_STRING_H
# define HAVE_STRING_H
# endif
# ifndef HAVE_STDC_HEADERS
# define HAVE_STDC_HEADERS
# endif
# ifndef STDC_HEADERS
# define STDC_HEADERS /* GNU name */
# endif
#endif
#ifdef NO_PROTOTYPES /* Force not to use prototypes */
# undef PROTOTYPES
#endif
#ifdef PROTOTYPES
# define __PR(a) a
#else
# define __PR(a) ()
#endif
#endif /* _PROTOTYP_H */

View file

@ -0,0 +1,139 @@
/* @(#)statdefs.h 1.1 98/11/22 Copyright 1998 J. Schilling */
/*
* Definitions for stat() file mode
*
* Copyright (c) 1998 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; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef _STATDEFS_H
#define _STATDEFS_H
#ifndef _MCONFIG_H
#include <mconfig.h>
#endif
#ifdef STAT_MACROS_BROKEN
#undef S_ISFIFO /* Named pipe */
#undef S_ISCHR /* Character special */
#undef S_ISMPC /* UNUSED multiplexed c */
#undef S_ISDIR /* Directory */
#undef S_ISNAM /* Named file (XENIX) */
#undef S_ISBLK /* Block special */
#undef S_ISMPB /* UNUSED multiplexed b */
#undef S_ISREG /* Regular file */
#undef S_ISCNT /* Contiguous file */
#undef S_ISLNK /* Symbolic link */
#undef S_ISSHAD /* Solaris shadow inode */
#undef S_ISSOCK /* UNIX domain socket */
#undef S_ISDOOR /* Solaris DOOR */
#endif
#ifndef S_ISFIFO /* Named pipe */
# ifdef S_IFIFO
# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
# else
# define S_ISFIFO(m) (0)
# endif
#endif
#ifndef S_ISCHR /* Character special */
# ifdef S_IFCHR
# define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
# else
# define S_ISCHR(m) (0)
# endif
#endif
#ifndef S_ISMPC /* UNUSED multiplexed c */
# ifdef S_IFMPC
# define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
# else
# define S_ISMPC(m) (0)
# endif
#endif
#ifndef S_ISDIR /* Directory */
# ifdef S_IFDIR
# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
# else
# define S_ISDIR(m) (0)
# endif
#endif
#ifndef S_ISNAM /* Named file (XENIX) */
# ifdef S_IFNAM
# define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM)
# else
# define S_ISNAM(m) (0)
# endif
#endif
#ifndef S_ISBLK /* Block special */
# ifdef S_IFBLK
# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
# else
# define S_ISBLK(m) (0)
# endif
#endif
#ifndef S_ISMPB /* UNUSED multiplexed b */
# ifdef S_IFMPB
# define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
# else
# define S_ISMPB(m) (0)
# endif
#endif
#ifndef S_ISREG /* Regular file */
# ifdef S_IFREG
# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
# else
# define S_ISREG(m) (0)
# endif
#endif
#ifndef S_ISCNT /* Contiguous file */
# ifdef S_IFCNT
# define S_ISCNT(m) (((m) & S_IFMT) == S_IFCNT)
# else
# define S_ISCNT(m) (0)
# endif
#endif
#ifndef S_ISLNK /* Symbolic link */
# ifdef S_IFLNK
# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
# else
# define S_ISLNK(m) (0)
# endif
#endif
#ifndef S_ISSHAD /* Solaris shadow inode */
# ifdef S_IFSHAD
# define S_ISSHAD(m) (((m) & S_IFMT) == S_IFSHAD)
# else
# define S_ISSHAD(m) (0)
# endif
#endif
#ifndef S_ISSOCK /* UNIX domain socket */
# ifdef S_IFSOCK
# define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
# else
# define S_ISSOCK(m) (0)
# endif
#endif
#ifndef S_ISDOOR /* Solaris DOOR */
# ifdef S_IFDOOR
# define S_ISDOOR(m) (((m) & S_IFMT) == S_IFDOOR)
# else
# define S_ISDOOR(m) (0)
# endif
#endif
#endif /* _STATDEFS_H */

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
static char rcsid[] ="$Id: joliet.c,v 1.12 1998/06/02 02:40:37 eric Exp $";
static char rcsid[] ="$Id: joliet.c,v 1.14 1999/03/07 17:41:19 eric Exp $";
/*
@ -77,13 +77,15 @@ static char rcsid[] ="$Id: joliet.c,v 1.12 1998/06/02 02:40:37 eric Exp $";
#include <stdlib.h>
#include <time.h>
static jpath_table_index;
static int jpath_table_index;
static struct directory ** jpathlist;
static next_jpath_index = 1;
static int next_jpath_index = 1;
static int sort_goof;
static int generate_joliet_path_tables __PR((void));
static int DECL(joliet_sort_directory, (struct directory_entry ** sort_dir));
static void DECL(assign_joliet_directory_addresses, (struct directory * node));
static int jroot_gen __PR((void));
/*
* Function: convert_to_unicode
@ -121,7 +123,14 @@ static void FDECL3(convert_to_unicode, unsigned char *, buffer, int, size, char
for(i=0; i < size ; i += 2, j++)
{
buffer[i] = 0;
if( tmpbuf[j] < 0x1f && tmpbuf[j] != 0 )
/*
* JS integrated from: Achim_Kaiser@t-online.de
*
* Let all valid unicode characters pass through (assuming ISO-8859-1).
* Others are set to '_' .
*/
if( tmpbuf[j] != 0 &&
(tmpbuf[j] <= 0x1f || (tmpbuf[j] >= 0x7F && tmpbuf[j] <= 0xA0)) )
{
buffer[i+1] = '_';
}
@ -166,7 +175,6 @@ static void FDECL3(convert_to_unicode, unsigned char *, buffer, int, size, char
static int FDECL1(joliet_strlen, const char *, string)
{
int rtn;
struct iso_directory_record foobar;
rtn = strlen(string) << 1;
@ -192,32 +200,36 @@ static int FDECL1(joliet_strlen, const char *, string)
* already present in the buffer. Just modifiy the
* appropriate fields.
*/
static void FDECL1(get_joliet_vol_desc, struct iso_primary_descriptor *, vol_desc)
static void FDECL1(get_joliet_vol_desc, struct iso_primary_descriptor *, jvol_desc)
{
vol_desc->type[0] = ISO_VD_SUPPLEMENTARY;
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?
* FIXME(eric) - how does Romeo fit in here? As mkisofs just
* "expands" 8 bit character codes to 16 bits and does nothing
* special with the Unicode characters, therefore shouldn't mkisofs
* really be stating that it's using UCS-2 Level 1, not Level 3 for
* the Joliet directory tree.
*/
strcpy(vol_desc->escape_sequences, "%/E");
strcpy(jvol_desc->escape_sequences, "%/@");
/*
* Until we have Unicode path tables, leave these unset.
*/
set_733((char *) vol_desc->path_table_size, jpath_table_size);
set_731(vol_desc->type_l_path_table, jpath_table[0]);
set_731(vol_desc->opt_type_l_path_table, jpath_table[1]);
set_732(vol_desc->type_m_path_table, jpath_table[2]);
set_732(vol_desc->opt_type_m_path_table, jpath_table[3]);
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(vol_desc->root_directory_record, &jroot_record,
sizeof(struct iso_directory_record) + 1);
memcpy(jvol_desc->root_directory_record, &jroot_record,
sizeof(struct iso_directory_record));
/*
* Finally, we have a bunch of strings to convert to Unicode.
@ -225,15 +237,15 @@ static void FDECL1(get_joliet_vol_desc, struct iso_primary_descriptor *, vol_des
* just be really lazy and do a char -> short conversion. We probably
* will want to filter any characters >= 0x80.
*/
convert_to_unicode((u_char *)vol_desc->system_id, sizeof(vol_desc->system_id), NULL);
convert_to_unicode((u_char *)vol_desc->volume_id, sizeof(vol_desc->volume_id), NULL);
convert_to_unicode((u_char *)vol_desc->volume_set_id, sizeof(vol_desc->volume_set_id), NULL);
convert_to_unicode((u_char *)vol_desc->publisher_id, sizeof(vol_desc->publisher_id), NULL);
convert_to_unicode((u_char *)vol_desc->preparer_id, sizeof(vol_desc->preparer_id), NULL);
convert_to_unicode((u_char *)vol_desc->application_id, sizeof(vol_desc->application_id), NULL);
convert_to_unicode((u_char *)vol_desc->copyright_file_id, sizeof(vol_desc->copyright_file_id), NULL);
convert_to_unicode((u_char *)vol_desc->abstract_file_id, sizeof(vol_desc->abstract_file_id), NULL);
convert_to_unicode((u_char *)vol_desc->bibliographic_file_id, sizeof(vol_desc->bibliographic_file_id), NULL);
convert_to_unicode((u_char *)jvol_desc->system_id, sizeof(jvol_desc->system_id), NULL);
convert_to_unicode((u_char *)jvol_desc->volume_id, sizeof(jvol_desc->volume_id), NULL);
convert_to_unicode((u_char *)jvol_desc->volume_set_id, sizeof(jvol_desc->volume_set_id), NULL);
convert_to_unicode((u_char *)jvol_desc->publisher_id, sizeof(jvol_desc->publisher_id), NULL);
convert_to_unicode((u_char *)jvol_desc->preparer_id, sizeof(jvol_desc->preparer_id), NULL);
convert_to_unicode((u_char *)jvol_desc->application_id, sizeof(jvol_desc->application_id), NULL);
convert_to_unicode((u_char *)jvol_desc->copyright_file_id, sizeof(jvol_desc->copyright_file_id), NULL);
convert_to_unicode((u_char *)jvol_desc->abstract_file_id, sizeof(jvol_desc->abstract_file_id), NULL);
convert_to_unicode((u_char *)jvol_desc->bibliographic_file_id, sizeof(jvol_desc->bibliographic_file_id), NULL);
}
@ -261,8 +273,9 @@ static void FDECL1(assign_joliet_directory_addresses, struct directory *, node)
last_extent += dir_size;
}
}
if(dpnt->subdir)
/* 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);
}
@ -341,6 +354,12 @@ static int generate_joliet_path_tables()
memset(jpath_table_l, 0, tablesize);
memset(jpath_table_m, 0, tablesize);
if( next_jpath_index > 0xffff )
{
fprintf(stderr, "Unable to generate sane path tables - too many directories (%d)\n",
next_jpath_index);
exit(1);
}
/*
* Now start filling in the path tables. Start with root directory
*/
@ -353,8 +372,13 @@ static int generate_joliet_path_tables()
do
{
fix = 0;
#ifdef __STDC__
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++)
{
@ -478,8 +502,11 @@ static void FDECL2(generate_one_joliet_directory, struct directory *, dpnt, FILE
s_entry = dpnt->jcontents;
while(s_entry)
{
if( (s_entry->de_flags & INHIBIT_JOLIET_ENTRY) == 0 )
{
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
@ -617,8 +644,8 @@ static void FDECL2(generate_one_joliet_directory, struct directory *, dpnt, FILE
{
directory_buffer[dir_index++] = 0;
}
}
s_entry = s_entry->jnext;
s_entry = s_entry->jnext;
}
if(dpnt->jsize != dir_index)
@ -637,8 +664,15 @@ static int FDECL1(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;
@ -707,6 +741,10 @@ static int FDECL1(joliet_sort_n_finish, struct directory *, this_dir)
* 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;
@ -798,14 +836,16 @@ static int FDECL2(joliet_compare_dirs, const void *, rr, const void *, ll)
static int FDECL1(joliet_sort_directory, struct directory_entry **, sort_dir)
{
int dcount = 0;
int i, len;
int i;
struct directory_entry * s_entry;
struct directory_entry ** sortlist;
s_entry = *sort_dir;
while(s_entry)
{
dcount++;
/* skip hidden entries */
if (!(s_entry->de_flags & INHIBIT_JOLIET_ENTRY))
dcount++;
s_entry = s_entry->next;
}
@ -819,14 +859,22 @@ static int FDECL1(joliet_sort_directory, struct directory_entry **, sort_dir)
s_entry = *sort_dir;
while(s_entry)
{
sortlist[dcount] = s_entry;
dcount++;
/* skip hidden entries */
if (!(s_entry->de_flags & INHIBIT_JOLIET_ENTRY)) {
sortlist[dcount] = s_entry;
dcount++;
}
s_entry = s_entry->next;
}
sort_goof = 0;
#ifdef __STDC__
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
@ -846,24 +894,24 @@ static int FDECL1(joliet_sort_directory, struct directory_entry **, sort_dir)
int FDECL1(joliet_sort_tree, struct directory *, node)
{
struct directory * dpnt;
int goof = 0;
int ret = 0;
dpnt = node;
while (dpnt){
goof = joliet_sort_n_finish(dpnt);
if( goof )
ret = joliet_sort_n_finish(dpnt);
if( ret )
{
break;
}
if(dpnt->subdir) goof = joliet_sort_tree(dpnt->subdir);
if( goof )
if(dpnt->subdir) ret = joliet_sort_tree(dpnt->subdir);
if( ret )
{
break;
}
dpnt = dpnt->next;
}
return goof;
return ret;
}
static void FDECL2(generate_joliet_directories, struct directory *, node, FILE*, outfile){
@ -879,12 +927,14 @@ static void FDECL2(generate_joliet_directories, struct directory *, node, FILE*,
* In theory we should never reuse a directory, so this doesn't
* make much sense.
*/
if( dpnt->extent > session_start )
if( dpnt->jextent > session_start )
{
generate_one_joliet_directory(dpnt, outfile);
}
}
if(dpnt->subdir) generate_joliet_directories(dpnt->subdir, 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;
}
}
@ -925,7 +975,7 @@ static int jroot_gen()
jroot_record.flags[0] = 2;
jroot_record.file_unit_size[0] = 0;
jroot_record.interleave[0] = 0;
set_723(jroot_record.volume_sequence_number, DEF_VSN);
set_723(jroot_record.volume_sequence_number, volume_sequence_number);
jroot_record.name_len[0] = 1;
return 0;
}

View file

@ -4,8 +4,10 @@
* in the CD image.
*/
static char rcsid[] ="$Id: match.c,v 1.2 1997/02/23 16:10:42 eric Rel $";
static char rcsid[] ="$Id: match.c,v 1.3 1999/03/02 03:41:25 eric Exp $";
#include "config.h"
#include <prototyp.h>
#include <stdio.h>
#ifndef VMS
#ifdef HAVE_MALLOC_H
@ -54,3 +56,92 @@ char * fn;
}
return 0; /* not found -> not excluded */
}
/* ISO9660/RR hide */
static char *i_mat[MAXMATCH];
void i_add_match(fn)
char * fn;
{
register int i;
for (i=0; i_mat[i] && i<MAXMATCH; i++);
if (i == MAXMATCH) {
fprintf(stderr,"Can't exclude RE '%s' - too many entries in table\n",fn);
return;
}
i_mat[i] = (char *) malloc(strlen(fn)+1);
if (! i_mat[i]) {
fprintf(stderr,"Can't allocate memory for excluded filename\n");
return;
}
strcpy(i_mat[i],fn);
}
int i_matches(fn)
char * fn;
{
/* very dumb search method ... */
register int i;
for (i=0; i_mat[i] && i<MAXMATCH; i++) {
if (fnmatch(i_mat[i], fn, FNM_FILE_NAME) != FNM_NOMATCH) {
return 1; /* found -> excluded filenmae */
}
}
return 0; /* not found -> not excluded */
}
int i_ishidden()
{
return((int)i_mat[0]);
}
/* Joliet hide */
static char *j_mat[MAXMATCH];
void j_add_match(fn)
char * fn;
{
register int i;
for (i=0; j_mat[i] && i<MAXMATCH; i++);
if (i == MAXMATCH) {
fprintf(stderr,"Can't exclude RE '%s' - too many entries in table\n",fn);
return;
}
j_mat[i] = (char *) malloc(strlen(fn)+1);
if (! j_mat[i]) {
fprintf(stderr,"Can't allocate memory for excluded filename\n");
return;
}
strcpy(j_mat[i],fn);
}
int j_matches(fn)
char * fn;
{
/* very dumb search method ... */
register int i;
for (i=0; j_mat[i] && i<MAXMATCH; i++) {
if (fnmatch(j_mat[i], fn, FNM_FILE_NAME) != FNM_NOMATCH) {
return 1; /* found -> excluded filenmae */
}
}
return 0; /* not found -> not excluded */
}
int j_ishidden()
{
return((int)j_mat[0]);
}

View file

@ -5,10 +5,18 @@
*/
/*
* $Id: match.h,v 1.1 1997/02/23 15:56:12 eric Rel $
* $Id: match.h,v 1.2 1999/03/02 03:41:25 eric Exp $
*/
#include "fnmatch.h"
void add_match();
int matches();
void add_match __PR((char *fn));
int matches __PR((char *fn));
void i_add_match __PR((char *fn));
int i_matches __PR((char *fn));
int i_ishidden __PR((void));
void j_add_match __PR((char *fn));
int j_matches __PR((char *fn));
int j_ishidden __PR((void));

View file

@ -20,11 +20,12 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
static char rcsid[] ="$Id: mkisofs.c,v 1.29 1998/06/02 03:43:45 eric Exp $";
static char rcsid[] ="$Id: mkisofs.c,v 1.32 1999/03/07 21:48:49 eric Exp $";
#include <errno.h>
#include "config.h"
#include "mkisofs.h"
#include "match.h"
#ifdef linux
#include <getopt.h>
@ -50,6 +51,7 @@ static char rcsid[] ="$Id: mkisofs.c,v 1.29 1998/06/02 03:43:45 eric Exp $";
#include <unistd.h>
#endif
#endif
#include <fctldefs.h>
#include "exclude.h"
@ -60,8 +62,9 @@ static char rcsid[] ="$Id: mkisofs.c,v 1.29 1998/06/02 03:43:45 eric Exp $";
struct directory * root = NULL;
static char version_string[] = "mkisofs 1.12b4";
static char version_string[] = "mkisofs 1.12b5";
char * outfile;
FILE * discimage;
unsigned int next_extent = 0;
unsigned int last_extent = 0;
@ -104,6 +107,8 @@ char * volume_id = VOLUME_ID_DEFAULT;
char * system_id = SYSTEM_ID_DEFAULT;
char * boot_catalog = BOOT_CATALOG_DEFAULT;
char * boot_image = BOOT_IMAGE_DEFAULT;
int volume_set_size = 1;
int volume_sequence_number = 1;
int omit_period = 0; /* Violates iso9660, but these are a pain */
int transparent_compression = 0; /* So far only works with linux */
@ -166,19 +171,35 @@ struct ld_option
#define OPTION_NOSPLIT_SL_FIELD 153
#define OPTION_PRINT_SIZE 154
#define OPTION_SPLIT_OUTPUT 155
#define OPTION_ABSTRACT 156
#define OPTION_BIBLIO 157
#define OPTION_COPYRIGHT 158
#define OPTION_SYSID 159
#define OPTION_VOLSET 160
#define OPTION_VOLSET_SIZE 161
#define OPTION_VOLSET_SEQ_NUM 162
#define OPTION_I_HIDE 163
#define OPTION_J_HIDE 164
#define OPTION_LOG_FILE 165
static const struct ld_option ld_options[] =
{
{ {"all-files", no_argument, NULL, 'a'},
'a', NULL, "Process all files (don't skip 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 },
{ {"copyright", required_argument, NULL, OPTION_COPYRIGHT},
'\0', "FILE", "Set Copyright filename" , ONE_DASH },
{ {"eltorito-boot", required_argument, NULL, 'b'},
'b', "FILE", "Set El Torito boot image name" , ONE_DASH },
{ {"eltorito-catalog", required_argument, NULL, 'c'},
'c', "FILE", "Set El Torito boot catalog name" , ONE_DASH },
{ {"cdwrite-params", required_argument, NULL, 'C'},
'C', "PARAMS", "Magic paramters from cdwrite" , ONE_DASH },
'C', "PARAMS", "Magic paramters from cdrecord" , ONE_DASH },
{ {"omit-period", no_argument, NULL, 'd'},
'd', NULL, "Omit trailing periods from filenames", ONE_DASH },
{ {"disable-deep-relocation", no_argument, NULL, 'D'},
@ -187,6 +208,10 @@ static const struct ld_option ld_options[] =
'f', NULL, "Follow symbolic links", 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-joliet", required_argument, NULL, OPTION_J_HIDE},
'\0', "GLOBFILE", "Hide Joliet file" , ONE_DASH },
{ {NULL, required_argument, NULL, 'i'},
'i', "ADD_FILES", "No longer supported" , TWO_DASHES },
{ {"joliet", no_argument, NULL, 'J'},
@ -195,6 +220,8 @@ static const struct ld_option ld_options[] =
'l', NULL, "Allow full 32 character filenames for iso9660 names", ONE_DASH },
{ {"allow-leading-dots", no_argument, NULL, 'L'},
'L', NULL, "Allow iso9660 filenames to start with '.'", ONE_DASH },
{ {"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 },
{ {"prev-session", required_argument, NULL, 'M'},
@ -221,12 +248,20 @@ static const struct ld_option ld_options[] =
'R', NULL, "Generate Rock Ridge directory information", ONE_DASH },
{ {"split-output", no_argument, NULL, OPTION_SPLIT_OUTPUT},
'\0', NULL, "Split output into files of approx. 1GB size", 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 },
{ {"verbose", no_argument, NULL, 'v'},
'v', NULL, "Verbose", 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 }
#ifdef ERIC_neverdef
@ -242,6 +277,10 @@ char *strdup(s)
char *s;{char *c;if(c=(char *)malloc(strlen(s)+1))strcpy(c,s);return c;}
#endif
void read_rcfile __PR((char * appname));
void usage __PR((void));
static void hide_reloc_dir __PR((void));
void FDECL1(read_rcfile, char *, appname)
{
FILE * rcfile;
@ -318,10 +357,10 @@ void FDECL1(read_rcfile, char *, appname)
/* 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(*pnt))
while (*pnt && isalpha((unsigned char)*pnt))
{
if(islower(*pnt))
*pnt = toupper(*pnt);
if(islower((unsigned char)*pnt))
*pnt = toupper((unsigned char)*pnt);
pnt++;
}
if (name == pnt)
@ -408,7 +447,7 @@ void usage(){
#endif
int i;
const char **targets, **pp;
/* const char **targets, **pp;*/
fprintf (stderr, "Usage: %s [options] file...\n", program_name);
@ -500,9 +539,9 @@ void usage(){
* with DST, I guess). The Linux iso9660 filesystem has had the sign
* of this wrong for ages (mkisofs had it wrong too for the longest time).
*/
int FDECL2(iso9660_date,char *, result, time_t, ctime){
int FDECL2(iso9660_date,char *, result, time_t, crtime){
struct tm *local;
local = localtime(&ctime);
local = localtime(&crtime);
result[0] = local->tm_year;
result[1] = local->tm_mon + 1;
result[2] = local->tm_mday;
@ -515,7 +554,7 @@ int FDECL2(iso9660_date,char *, result, time_t, ctime){
* as some files use daylight savings time and some don't...
*/
result[6] = local->tm_yday; /* save yday 'cause gmtime zaps it */
local = gmtime(&ctime);
local = gmtime(&crtime);
local->tm_year -= result[0];
local->tm_yday -= result[6];
local->tm_hour -= result[3];
@ -534,11 +573,28 @@ int FDECL2(iso9660_date,char *, result, time_t, ctime){
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;
}
extern char * cdwrite_data;
int FDECL2(main, int, argc, char **, argv){
char * outfile;
struct directory_entry de;
#ifdef HAVE_SBRK
unsigned long mem_start;
@ -552,6 +608,7 @@ int FDECL2(main, int, argc, char **, argv){
char shortopts[OPTION_COUNT * 3 + 2];
struct option longopts[OPTION_COUNT + 1];
int c;
char *log_file = 0;
if (argc < 2)
usage();
@ -643,6 +700,13 @@ int FDECL2(main, int, argc, char **, argv){
exit(1);
}
break;
case OPTION_ABSTRACT:
abstract = optarg;
if(strlen(abstract) > 37) {
fprintf(stderr,"Abstract filename string too long\n");
exit(1);
};
break;
case 'A':
appid = optarg;
if(strlen(appid) > 128) {
@ -650,6 +714,20 @@ int FDECL2(main, int, argc, char **, argv){
exit(1);
};
break;
case OPTION_BIBLIO:
biblio = optarg;
if(strlen(biblio) > 37) {
fprintf(stderr,"Bibliographic filename string too long\n");
exit(1);
};
break;
case OPTION_COPYRIGHT:
copyright = optarg;
if(strlen(copyright) > 37) {
fprintf(stderr,"Copyright filename string too long\n");
exit(1);
};
break;
case 'd':
omit_period++;
break;
@ -665,6 +743,9 @@ int FDECL2(main, int, argc, char **, argv){
case 'L':
allow_leading_dots++;
break;
case OPTION_LOG_FILE:
log_file = optarg;
break;
case 'M':
merge_image = optarg;
break;
@ -704,11 +785,39 @@ int FDECL2(main, int, argc, char **, argv){
case OPTION_SPLIT_OUTPUT:
split_output++;
break;
case OPTION_SYSID:
system_id = optarg;
if(strlen(system_id) > 32) {
fprintf(stderr,"System ID string too long\n");
exit(1);
};
break;
case 'T':
generate_tables++;
break;
case 'V':
volume_id = optarg;
if(strlen(volume_id) > 32) {
fprintf(stderr,"Volume ID string too long\n");
exit(1);
};
break;
case OPTION_VOLSET:
volset_id = optarg;
if(strlen(volset_id) > 128) {
fprintf(stderr,"Volume set ID string too long\n");
exit(1);
};
break;
case OPTION_VOLSET_SIZE:
volume_set_size = atoi(optarg);
break;
case OPTION_VOLSET_SEQ_NUM:
volume_sequence_number = atoi(optarg);
if (volume_sequence_number > volume_set_size) {
fprintf(stderr,"Volume set sequence number too big\n");
exit(1);
}
break;
case 'v':
verbose++;
@ -730,6 +839,12 @@ int FDECL2(main, int, argc, char **, argv){
*/
add_match(optarg);
break;
case OPTION_I_HIDE:
i_add_match(optarg);
break;
case OPTION_J_HIDE:
j_add_match(optarg);
break;
case OPTION_HELP:
usage ();
exit (0);
@ -764,15 +879,23 @@ parse_input_files:
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++;
if(verbose > 1) fprintf(stderr,"%s\n", version_string);
if( (cdwrite_data != NULL && merge_image == NULL)
|| (cdwrite_data == NULL && merge_image != NULL) )
if(cdwrite_data == NULL && merge_image != NULL)
{
fprintf(stderr,"Multisession usage bug - both -C and -M must be specified.\n");
fprintf(stderr,"Multisession usage bug: Must specify -C if -M is used.\n");
exit(0);
}
if(cdwrite_data != NULL && merge_image == NULL)
{
fprintf(stderr,"Warning: -C specified without -M: old session data will not be merged.\n");
}
/* The first step is to scan the directory tree, and take some notes */
scan_tree = argv[optind];
@ -803,6 +926,34 @@ parse_input_files:
#endif
}
if (log_file) {
FILE *lfp;
int i;
/* open log file - test that we can open OK */
if ((lfp = fopen(log_file, "w")) == NULL) {
fprintf(stderr,"can't open logfile: %s\n", log_file);
exit (1);
}
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) {
fprintf(stderr,"can't open logfile: %s\n", log_file);
exit (1);
}
if(verbose > 1) {
for (i=0;i<argc;i++)
fprintf(stderr,"%s ", argv[i]);
fprintf(stderr,"\n%s\n", version_string);
}
}
/*
* See if boot catalog file exists in root directory, if not
* we will create it.
@ -822,6 +973,11 @@ parse_input_files:
de.filedir = root; /* We need this to bootstrap */
if (cdwrite_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 )
{
mrootp = merge_isofs(merge_image);
@ -988,6 +1144,10 @@ parse_input_files:
merge_previous_session(root, mrootp);
}
/* hide "./rr_moved" if all its contents have been hidden */
if (reloc_dir && i_ishidden())
hide_reloc_dir();
/*
* Sort the directories in the required order (by ISO9660). Also,
* choose the names for the 8.3 filesystem if required, and do
@ -1000,7 +1160,11 @@ parse_input_files:
goof += joliet_sort_tree(root);
}
if (goof) exit(1);
if (goof)
{
fprintf(stderr, "Joliet tree sort failed.\n");
exit(1);
}
/*
* Fix a couple of things in the root directory so that everything
@ -1013,21 +1177,26 @@ parse_input_files:
* OK, ready to write the file. Open it up, and generate the thing.
*/
if (print_size){
discimage = fopen("/dev/null", "w");
discimage = fopen("/dev/null", "wb");
if (!discimage){
fprintf(stderr,"Unable to open /dev/null\n");
exit(1);
}
} else if (outfile){
discimage = fopen(outfile, "w");
discimage = fopen(outfile, "wb");
if (!discimage){
fprintf(stderr,"Unable to open disc image file\n");
exit(1);
};
} else
} else {
discimage = stdout;
#if defined(__CYGWIN32__)
setmode(fileno(stdout), O_BINARY);
#endif
}
/* Now assign addresses on the disc for the path table. */
path_blocks = (path_table_size + (SECTOR_SIZE - 1)) >> 11;

View file

@ -20,10 +20,11 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/*
* $Id: mkisofs.h,v 1.17 1998/06/02 02:40:38 eric Exp $
* $Id: mkisofs.h,v 1.20 1999/03/02 04:16:41 eric Exp $
*/
#include <stdio.h>
#include <prototyp.h>
/* This symbol is used to indicate that we do not have things like
symlinks, devices, and so forth available. Just files and dirs */
@ -108,7 +109,7 @@ extern char *strdup();
#endif
#ifdef __svr4__
#ifdef __SVR4
#include <stdlib.h>
#else
extern int optind;
@ -138,6 +139,7 @@ struct directory_entry{
unsigned char * rr_attributes;
unsigned int rr_attr_size;
unsigned int total_rr_attr_size;
unsigned int got_rr_name;
};
struct file_hash{
@ -173,9 +175,15 @@ struct file_hash{
struct output_fragment
{
struct output_fragment * of_next;
#ifdef __STDC__
int (*of_size)(int);
int (*of_generate)(void);
int (*of_write)(FILE *);
#else
int (*of_size)();
int (*of_generate)();
int (*of_write)();
#endif
};
extern struct output_fragment * out_list;
@ -332,6 +340,8 @@ extern int
DECL(merge_previous_session, (struct directory *,
struct iso_directory_record *));
extern int DECL(get_session_start, (int *));
/* joliet.c */
int DECL(joliet_sort_tree, (struct directory * node));
@ -370,8 +380,13 @@ extern int DECL(check_prev_session, (struct directory_entry **, int len,
#ifdef USE_SCG
/* scsi.c */
#ifdef __STDC__
extern int readsecs(int startsecno, void *buffer, int sectorcount);
extern int scsidev_open(char *path);
#else
extern int readsecs();
extern int scsidev_open();
#endif
#endif
extern char * extension_record;
@ -392,6 +407,8 @@ extern char * system_id;
extern char * volume_id;
extern char * boot_catalog;
extern char * boot_image;
extern int volume_set_size;
extern int volume_sequence_number;
extern void * DECL(e_malloc,(size_t));
@ -432,6 +449,7 @@ extern void * DECL(e_malloc,(size_t));
#define INHIBIT_JOLIET_ENTRY 0x08
#define INHIBIT_RR_ENTRY 0x10
#define RELOCATED_DIRECTORY 0x20
#define INHIBIT_ISO9660_ENTRY 0x40
/*
* Volume sequence number to use in all of the iso directory records.

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
static char rcsid[] ="$Id: multi.c,v 1.12 1998/06/02 02:40:38 eric Exp $";
static char rcsid[] ="$Id: multi.c,v 1.14 1999/03/02 04:16:41 eric Exp $";
#include <stdlib.h>
#include <string.h>
@ -51,24 +51,46 @@ extern char * strdup(const char *);
#define TF_ACCESS 4
#define TF_ATTRIBUTES 8
static int DECL(get_session_start, (int *));
static int isonum_711 __PR((unsigned char * p));
static int isonum_721 __PR((unsigned char * p));
static int isonum_723 __PR((unsigned char * p));
static int isonum_731 __PR((unsigned char * p));
static int DECL(merge_old_directory_into_tree, (struct directory_entry *,
struct directory *));
#ifdef __STDC__
static int
isonum_711 (unsigned char * p)
#else
static int
isonum_711 (p)
unsigned char * p;
#endif
{
return (*p & 0xff);
}
int
#ifdef __STDC__
static int
isonum_721 (unsigned char * p)
#else
static int
isonum_721 (p)
unsigned char * p;
#endif
{
return ((p[0] & 0xff) | ((p[1] & 0xff) << 8));
}
#ifdef __STDC__
static int
isonum_723 (unsigned char * p)
#else
static int
isonum_723 (p)
unsigned char * p;
#endif
{
#if 0
if (p[0] != p[3] || p[1] != p[2]) {
@ -79,8 +101,14 @@ isonum_723 (unsigned char * p)
return (isonum_721 (p));
}
int
#ifdef __STDC__
static int
isonum_731 (unsigned char * p)
#else
static int
isonum_731 (p)
unsigned char * p;
#endif
{
return ((p[0] & 0xff)
| ((p[1] & 0xff) << 8)
@ -88,8 +116,14 @@ isonum_731 (unsigned char * p)
| ((p[3] & 0xff) << 24));
}
#ifdef __STDC__
int
isonum_733 (unsigned char * p)
#else
int
isonum_733 (p)
unsigned char * p;
#endif
{
return (isonum_731 (p));
}
@ -111,8 +145,16 @@ FILE * in_image = NULL;
* Anyways, this allows the use of a scsi-generics type of interface on
* Solaris.
*/
#ifdef __STDC__
static int
readsecs(int startsecno, void *buffer, int sectorcount)
#else
static int
readsecs(startsecno, buffer, sectorcount)
int startsecno;
void *buffer;
int sectorcount;
#endif
{
int f = fileno(in_image);
@ -144,6 +186,7 @@ FDECL3(parse_rr, unsigned char *, pnt, int, len, struct directory_entry *,dpnt)
strncpy(name_buf, (char *) pnt+5, pnt[2] - 5);
name_buf[pnt[2] - 5] = 0;
dpnt->name = strdup(name_buf);
dpnt->got_rr_name = 1;
return 0;
}
@ -161,8 +204,22 @@ FDECL3(parse_rr, unsigned char *, pnt, int, len, struct directory_entry *,dpnt)
parse_rr(&sector[cont_offset], cont_size, dpnt);
};
};
/* 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 */
static int
@ -275,6 +332,8 @@ FDECL2(read_merging_directory, struct iso_directory_record *, mrootp,
int tt_extent;
int tt_size;
static int warning_given = 0;
/*
* First, allocate a buffer large enough to read in the entire
* directory.
@ -334,6 +393,7 @@ FDECL2(read_merging_directory, struct iso_directory_record *, mrootp,
(*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;
@ -410,6 +470,10 @@ FDECL2(read_merging_directory, struct iso_directory_record *, mrootp,
}
}
#ifdef DEBUG
fprintf(stderr, "got DE name: %s\n", (*pnt)->name);
#endif
if( strncmp(idr->name, "TRANS.TBL", 9) == 0)
{
if( (*pnt)->name != NULL )
@ -457,11 +521,14 @@ FDECL2(read_merging_directory, struct iso_directory_record *, mrootp,
rlen) == 0
&& cpnt[2+rlen] == ' ')
{
(*pnt)->table = e_malloc(strlen((char*)cpnt) - 34);
(*pnt)->table = e_malloc(strlen((char*)cpnt) - 33);
sprintf((*pnt)->table, "%c\t%s\n",
*cpnt, cpnt+37);
if( (*pnt)->name == NULL )
if( !(*pnt)->got_rr_name )
{
if ((*pnt)->name != NULL) {
free((*pnt)->name);
}
(*pnt)->name = strdup((char *) cpnt+37);
}
break;
@ -473,19 +540,16 @@ FDECL2(read_merging_directory, struct iso_directory_record *, mrootp,
free(tt_buf);
}
else if( !seen_rockridge )
else if( !seen_rockridge && !warning_given )
{
/*
* This is a fatal error right now because we must have some mechanism
* for taking the 8.3 names back to the original unix names.
* In principle we could do this the hard way, and try and translate
* the unix names that we have seen forwards, but this would be
* a real pain in the butt.
* Warn the user that iso (8.3) names were used because neither
* Rock Ridge (-R) nor TRANS.TBL (-T) name translations were found.
*/
fprintf(stderr,"Previous session must have either Rock Ridge (-R) or\n");
fprintf(stderr,"TRANS.TBL (-T) for mkisofs to be able to correctly\n");
fprintf(stderr,"generate additional sessions.\n");
exit(3);
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 (8.3) file names have been used instead.\n");
warning_given = 1;
}
if( dirbuff != NULL )
@ -494,7 +558,7 @@ FDECL2(read_merging_directory, struct iso_directory_record *, mrootp,
}
return rtn;
}
} /* read_merging_directory */
/*
* Free any associated data related to the structures.
@ -1000,7 +1064,7 @@ FDECL2(merge_old_directory_into_tree, struct directory_entry *, dpnt,
char * cdwrite_data = NULL;
static int
int
FDECL1(get_session_start, int *, file_addr)
{
char * pnt;
@ -1039,7 +1103,9 @@ FDECL1(get_session_start, int *, file_addr)
}
*pnt = '\0';
*file_addr = atol(cdwrite_data) * SECTOR_SIZE;
if (file_addr != NULL) {
*file_addr = atol(cdwrite_data) * SECTOR_SIZE;
}
pnt++;
session_start = last_extent = last_extent_written = atol(pnt);
@ -1065,7 +1131,6 @@ FDECL2(merge_previous_session,struct directory *, this_dir,
struct directory_entry * odpnt = NULL;
int n_orig;
struct directory_entry * s_entry;
int dflag;
int status, lstatus;
struct stat statbuf, lstatbuf;
@ -1082,7 +1147,6 @@ FDECL2(merge_previous_session,struct directory *, this_dir,
/* Now we scan the directory itself, and look at what is inside of it. */
dflag = 0;
for(s_entry = this_dir->contents; s_entry; s_entry = s_entry->next)
{
status = stat_filter(s_entry->whole_name, &statbuf);

View file

@ -21,7 +21,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
static char rcsid[] ="$Id: name.c,v 1.10 1998/06/02 02:40:38 eric Exp $";
static char rcsid[] ="$Id: name.c,v 1.11 1999/03/02 03:41:26 eric Exp $";
#include "config.h"
#include "mkisofs.h"
@ -219,7 +219,7 @@ int FDECL3(iso9660_file_length,
}
else
{
*result++ = (islower(*pnt) ? toupper(*pnt) : *pnt);
*result++ = (islower((unsigned char)*pnt) ? toupper((unsigned char)*pnt) : *pnt);
}
}
}
@ -287,7 +287,7 @@ int FDECL3(iso9660_file_length,
}
else
{
*result++ = islower(*pnt) ? toupper(*pnt) : *pnt;
*result++ = islower((unsigned char)*pnt) ? toupper((unsigned char)*pnt) : *pnt;
}
break;

View file

@ -19,7 +19,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
static char rcsid[] ="$Id: rock.c,v 1.7 1998/02/18 04:48:23 eric Exp $";
static char rcsid[] ="$Id: rock.c,v 1.8 1999/03/02 03:41:26 eric Exp $";
#include <stdlib.h>
@ -44,6 +44,8 @@ static char rcsid[] ="$Id: rock.c,v 1.7 1998/02/18 04:48:23 eric Exp $";
#include "iso9660.h"
#include <string.h>
#ifdef DOESNT_WORK
#ifdef NON_UNIXFS
#define S_ISLNK(m) (0)
#else
@ -52,6 +54,10 @@ static char rcsid[] ="$Id: rock.c,v 1.7 1998/02/18 04:48:23 eric Exp $";
#endif
#endif
#else
#include <statdefs.h>
#endif
#define SU_VERSION 1
#define SL_ROOT 8
@ -94,6 +100,8 @@ static int currlen = 0;
static int mainrec = 0;
static int reclimit;
static void add_CE_entry __PR((void));
static void add_CE_entry(){
if(recstart)
set_733((char*)Rock + recstart - 8, ipnt + 28 - recstart);
@ -137,6 +145,10 @@ int deep_opt;
mainrec = recstart = ipnt = 0;
reclimit = 0xf8;
/* 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. Assume max for name, since name conflicts may cause us
to rename the file later on */
@ -266,7 +278,7 @@ int deep_opt;
int lenpos, lenval, j0, j1;
int nchar;
unsigned char * cpnt, *cpnt1;
nchar = readlink(whole_name, symlink_buff, sizeof(symlink_buff));
nchar = readlink(whole_name, (char *)symlink_buff, sizeof(symlink_buff));
symlink_buff[nchar < 0 ? 0 : nchar] = 0;
nchar = strlen((char *) symlink_buff);
set_733(s_entry->isorec.size, 0);
@ -465,7 +477,7 @@ int deep_opt;
file_size = 0;
OK_flag = 1;
zipfile = fopen(whole_name, "r");
zipfile = fopen(whole_name, "rb");
fread(header, 1, sizeof(header), zipfile);
/* Check some magic numbers from gzip. */
@ -497,7 +509,7 @@ int deep_opt;
checkname = strdup(whole_name);
checkname[strlen(whole_name)-3] = 0;
zipfile = fopen(checkname, "r");
zipfile = fopen(checkname, "rb");
if(zipfile) {
OK_flag = 0;
fprintf(stderr,"Unable to insert transparent compressed file - name conflict\n");
@ -548,38 +560,38 @@ int deep_opt;
char * FDECL4(generate_rr_extension_record, char *, id, char *, descriptor,
char *, source, int *, size){
int ipnt = 0;
int lipnt = 0;
char * pnt;
int len_id, len_des, len_src;
len_id = strlen(id);
len_des = strlen(descriptor);
len_src = strlen(source);
Rock[ipnt++] ='E';
Rock[ipnt++] ='R';
Rock[ipnt++] = ER_SIZE + len_id + len_des + len_src;
Rock[ipnt++] = 1;
Rock[ipnt++] = len_id;
Rock[ipnt++] = len_des;
Rock[ipnt++] = len_src;
Rock[ipnt++] = 1;
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 + ipnt, id, len_id);
ipnt += len_id;
memcpy(Rock + lipnt, id, len_id);
lipnt += len_id;
memcpy(Rock + ipnt, descriptor, len_des);
ipnt += len_des;
memcpy(Rock + lipnt, descriptor, len_des);
lipnt += len_des;
memcpy(Rock + ipnt, source, len_src);
ipnt += len_src;
memcpy(Rock + lipnt, source, len_src);
lipnt += len_src;
if(ipnt > SECTOR_SIZE) {
if(lipnt > SECTOR_SIZE) {
fprintf(stderr,"Extension record too long\n");
exit(1);
};
pnt = (char *) e_malloc(SECTOR_SIZE);
memset(pnt, 0, SECTOR_SIZE);
memcpy(pnt, Rock, ipnt);
*size = ipnt;
memcpy(pnt, Rock, lipnt);
*size = lipnt;
return pnt;
}

View file

@ -20,7 +20,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
static char rcsid[] ="$Id: tree.c,v 1.26 1998/06/02 03:14:58 eric Exp $";
static char rcsid[] ="$Id: tree.c,v 1.29 1999/03/07 17:41:19 eric Exp $";
/* ADD_FILES changes made by Ross Biro biro@yggdrasil.com 2/23/95 */
@ -39,6 +39,7 @@ static char rcsid[] ="$Id: tree.c,v 1.26 1998/06/02 03:14:58 eric Exp $";
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <fctldefs.h>
#if defined(MAJOR_IN_MKDEV)
#include <sys/types.h>
@ -61,11 +62,14 @@ extern char * strdup(const char *);
#include "mkisofs.h"
#include "iso9660.h"
#include "match.h"
#include <sys/stat.h>
#include "exclude.h"
#ifdef DOESNT_WORK
#ifdef NON_UNIXFS
#define S_ISLNK(m) (0)
#define S_ISSOCK(m) (0)
@ -83,11 +87,20 @@ extern char * strdup(const char *);
#endif
#endif
#ifdef __svr4__
#else
#include <statdefs.h>
#endif
#ifdef __SVR4
extern char * strdup(const char *);
#endif
static unsigned char symlink_buff[256];
static void stat_fix __PR((struct stat * st));
static void generate_reloc_directory __PR((void));
static void DECL(attach_dot_entries, (struct directory * dirnode,
struct stat * parent_stat));
static void DECL(delete_directory, (struct directory * parent, struct directory * child));
@ -100,7 +113,7 @@ struct stat root_statbuf = {0, }; /* Stat buffer for root directory */
struct directory * reloc_dir = NULL;
void
static void
FDECL1(stat_fix, struct stat *, st)
{
/* Remove the uid and gid, they will only be useful on the author's
@ -159,6 +172,12 @@ static int FDECL1(sort_n_finish, struct directory *, this_dir)
/* 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();
@ -178,6 +197,12 @@ static int FDECL1(sort_n_finish, struct directory *, this_dir)
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
@ -319,6 +344,7 @@ got_valid_name:
{
if(strcmp(s_entry->name, ".") == 0 ||
strcmp(s_entry->name, "..") == 0) continue;
if(s_entry->de_flags & INHIBIT_ISO9660_ENTRY) continue;
if(s_entry->table) tablesize += 35 + strlen(s_entry->table);
}
}
@ -338,7 +364,7 @@ got_valid_name:
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, DEF_VSN);
set_723(table->isorec.volume_sequence_number, volume_sequence_number);
set_733((char *) table->isorec.size, tablesize);
table->size = tablesize;
table->filedir = this_dir;
@ -366,6 +392,12 @@ got_valid_name:
*/
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);
/*
@ -429,15 +461,16 @@ got_valid_name:
if(!s_entry->table) continue;
if(strcmp(s_entry->name, ".") == 0 ||
strcmp(s_entry->name, "..") == 0) continue;
#if (defined(__sun) && !defined(__svr4__))
count += strlen(sprintf(table->table + count, "%c %-34s%s",
s_entry->table[0],
s_entry->isorec.name, s_entry->table+1));
#else
count += sprintf(table->table + count, "%c %-34s%s",
s_entry->table[0],
s_entry->isorec.name, s_entry->table+1);
#endif /* __sun && !__svr4__ */
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.
*/
sprintf(table->table + count, "%c %-34s%s",
s_entry->table[0],
s_entry->isorec.name, s_entry->table+1);
count += strlen(table->table + count);
free(s_entry->table);
s_entry->table = NULL;
}
@ -458,6 +491,12 @@ got_valid_name:
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)) &
@ -542,7 +581,7 @@ static void generate_reloc_directory()
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, DEF_VSN);
set_723(root->contents->isorec.volume_sequence_number, volume_sequence_number);
iso9660_file_length (reloc_dir->de_name, root->contents, 1);
if(use_RockRidge){
@ -689,9 +728,17 @@ void finish_cl_pl_entries(){
struct directory_entry *s_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;
@ -748,6 +795,11 @@ FDECL3(scan_directory_tree,struct directory *, this_dir,
int dflag;
char * old_path;
if (verbose > 1)
{
fprintf(stderr, "Scanning %s\n", path);
}
current_dir = opendir(path);
d_entry = NULL;
@ -774,6 +826,14 @@ FDECL3(scan_directory_tree,struct directory *, this_dir,
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;
/*
* Now we scan the directory itself, and look at what is inside of it.
@ -1120,8 +1180,36 @@ FDECL3(insert_file_entry,struct directory *, this_dir,
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,".") && strcmp(short_name,"..")) {
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 (this_dir != reloc_dir && this_dir->dir_flags & INHIBIT_JOLIET_ENTRY) {
s_entry->de_flags |= INHIBIT_JOLIET_ENTRY;
}
else if (strcmp(short_name,".") && strcmp(short_name,"..")) {
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;
}
}
s_entry->filedir = this_dir;
s_entry->isorec.flags[0] = 0;
s_entry->isorec.ext_attr_length[0] = 0;
@ -1152,7 +1240,7 @@ FDECL3(insert_file_entry,struct directory *, this_dir,
s_entry->inode = STAT_INODE(statbuf);
s_entry->dev = statbuf.st_dev;
}
set_723(s_entry->isorec.volume_sequence_number, DEF_VSN);
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;
@ -1244,38 +1332,61 @@ FDECL3(insert_file_entry,struct directory *, this_dir,
sprintf(buffer,"D\t%s\n",
s_entry->name);
break;
#ifndef NON_UNIXFS
#ifdef S_IFBLK
/* 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 */
/* for some reason, MAJOR_IN_SYSMACROS isn't defined on a SunOS when
it should be, so see if major() is defined instead */
/*
#if !(defined(MAJOR_IN_SYSMACROS) || defined(MAJOR_IN_MKDEV))
*/
#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
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:
nchar = readlink(whole_path,
symlink_buff,
(char *)symlink_buff,
sizeof(symlink_buff));
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
#endif /* NON_UNIXFS */
case S_IFREG:
default:
sprintf(buffer,"F\t%s\n",
@ -1408,7 +1519,7 @@ struct directory * FDECL4(find_or_create_directory, struct directory *, parent,
de->priority = 32768;
de->inode = UNCACHED_INODE;
de->dev = (dev_t) UNCACHED_DEVICE;
set_723(de->isorec.volume_sequence_number, DEF_VSN);
set_723(de->isorec.volume_sequence_number, volume_sequence_number);
iso9660_file_length (pnt, de, 1);
init_fstatbuf();
@ -1574,13 +1685,13 @@ static void FDECL2(delete_directory, struct directory *, parent, struct director
int FDECL1(sort_tree, struct directory *, node){
struct directory * dpnt;
int goof = 0;
int ret = 0;
dpnt = node;
while (dpnt){
goof = sort_n_finish(dpnt);
if( goof )
ret = sort_n_finish(dpnt);
if( ret )
{
break;
}
@ -1588,7 +1699,7 @@ int FDECL1(sort_tree, struct directory *, node){
if(dpnt->subdir) sort_tree(dpnt->subdir);
dpnt = dpnt->next;
}
return goof;
return ret;
}
void FDECL1(dump_tree, struct directory *, node){
@ -1614,12 +1725,17 @@ void FDECL1(update_nlink_field, struct directory *, 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, i++)
continue;
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
@ -1630,7 +1746,8 @@ void FDECL1(update_nlink_field, struct directory *, node)
*/
for(s_entry = dpnt->contents; s_entry; s_entry = s_entry->next)
{
if( (s_entry->de_flags & RELOCATED_DIRECTORY) != 0 )
if( (s_entry->de_flags & RELOCATED_DIRECTORY) != 0 &&
(s_entry->de_flags & INHIBIT_ISO9660_ENTRY) == 0)
{
i++;
}

View file

@ -19,7 +19,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
static char rcsid[] ="$Id: write.c,v 1.18 1998/06/02 02:40:39 eric Exp $";
static char rcsid[] ="$Id: write.c,v 1.21 1999/03/07 17:41:19 eric Exp $";
#include <string.h>
#include <stdlib.h>
@ -37,7 +37,7 @@ static char rcsid[] ="$Id: write.c,v 1.18 1998/06/02 02:40:39 eric Exp $";
#include <unistd.h>
#endif
#ifdef __svr4__
#ifdef __SVR4
extern char * strdup(const char *);
#endif
@ -55,7 +55,7 @@ static int table_size = 0;
static int total_dir_size = 0;
static int rockridge_size = 0;
static struct directory ** pathlist;
static next_path_index = 1;
static int next_path_index = 1;
static int sort_goof;
struct output_fragment * out_tail;
@ -63,6 +63,11 @@ struct output_fragment * out_list;
struct iso_primary_descriptor vol_desc;
static int root_gen __PR((void));
static int generate_path_tables __PR((void));
static int file_gen __PR((void));
static int dirtree_dump __PR((void));
/* Routines to actually write the disc. We write sequentially so that
we could write a tape, or write the disc directly */
@ -121,30 +126,33 @@ void FDECL2(set_733, char *, pnt, unsigned int, i)
void FDECL4(xfwrite, void *, buffer, int, count, int, size, FILE *, file)
{
/*
* 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.
*/
if (split_output != 0 && ftell(file) > (1024 * 1024 * 1024) ) {
static int idx = 0;
char nbuf[128];
sprintf(nbuf, "part_%02d", idx++);
file = freopen(nbuf, "w", file);
if (file == NULL) {
fprintf(stderr, "Cannot open '%s'.\n", nbuf);
exit(1);
}
}
/*
* 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;
if (split_output != 0 &&
(idx == 0 || ftell(file) >= (1024 * 1024 * 1024) )) {
char nbuf[512];
extern char *outfile;
while(count)
{
if (idx == 0)
unlink(outfile);
sprintf(nbuf, "%s_%02d", outfile, idx++);
file = freopen(nbuf, "wb", file);
if (file == NULL) {
fprintf(stderr, "Cannot open '%s'.\n", nbuf);
exit(1);
}
}
while(count)
{
int got = fwrite(buffer,size,count,file);
if(got<=0)
@ -168,7 +176,7 @@ struct deferred_write
static struct deferred_write * dw_head = NULL, * dw_tail = NULL;
unsigned int last_extent_written =0;
static path_table_index;
static int path_table_index;
static time_t begun;
/* We recursively walk through all of the directories and assign extent
@ -184,6 +192,12 @@ static int FDECL1(assign_directory_addresses, struct directory *, 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.
@ -346,11 +360,26 @@ static int FDECL2(compare_dirs, const void *, rr, const void *, ll)
* 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)
{
@ -382,13 +411,18 @@ static int FDECL2(compare_dirs, const void *, rr, const void *, ll)
int FDECL1(sort_directory, struct directory_entry **, sort_dir)
{
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;
}
@ -404,15 +438,24 @@ int FDECL1(sort_directory, struct directory_entry **, sort_dir)
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;
len = s_entry->isorec.name_len[0];
s_entry->isorec.name[len] = 0;
dcount++;
s_entry = s_entry->next;
}
len = s_entry->isorec.name_len[0];
s_entry->isorec.name[len] = 0;
s_entry = s_entry->next;
}
/*
@ -425,19 +468,27 @@ int FDECL1(sort_directory, struct directory_entry **, sort_dir)
}
else
{
/* only sort the non-hidden entries */
sort_goof = 0;
#ifdef __STDC__
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-1; i++)
for(i=0; i<dcount+xcount-1; i++)
{
sortlist[i]->next = sortlist[i+1];
}
sortlist[dcount-1]->next = NULL;
sortlist[dcount+xcount-1]->next = NULL;
*sort_dir = sortlist[0];
}
@ -458,7 +509,7 @@ static int root_gen()
root_record.flags[0] = 2;
root_record.file_unit_size[0] = 0;
root_record.interleave[0] = 0;
set_723(root_record.volume_sequence_number, DEF_VSN);
set_723(root_record.volume_sequence_number, volume_sequence_number);
root_record.name_len[0] = 1;
return 0;
}
@ -470,13 +521,12 @@ static void FDECL1(assign_file_addresses, struct directory *, dpnt)
struct file_hash *s_hash;
struct deferred_write * dwpnt;
char whole_path[1024];
while (dpnt)
{
s_entry = dpnt->contents;
for(s_entry = dpnt->contents; s_entry; s_entry = s_entry->next)
{
/*
* If we already have an extent for this entry,
* then don't assign a new one. It must have come
@ -495,7 +545,7 @@ static void FDECL1(assign_file_addresses, struct directory *, dpnt)
s_hash = find_hash(s_entry->dev, s_entry->inode);
if(s_hash)
{
if(verbose > 1)
if(verbose > 2)
{
fprintf(stderr, "Cache hit for %s%s%s\n",s_entry->filedir->de_name,
SPATH_SEPARATOR, s_entry->name);
@ -618,7 +668,7 @@ static void FDECL1(assign_file_addresses, struct directory *, dpnt)
s_entry->starting_block = last_extent;
add_hash(s_entry);
last_extent += ROUND_UP(s_entry->size) >> 11;
if(verbose > 1)
if(verbose > 2)
{
fprintf(stderr,"%d %d %s\n", s_entry->starting_block,
last_extent-1, whole_path);
@ -633,6 +683,7 @@ static void FDECL1(assign_file_addresses, struct directory *, dpnt)
}
#endif
#ifdef NOT_NEEDED /* Never use this code if you like to create a DVD */
if(last_extent > (800000000 >> 11))
{
/*
@ -640,7 +691,7 @@ static void FDECL1(assign_file_addresses, struct directory *, dpnt)
*/
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 %d bytes\n", s_entry->size);
fprintf(stderr,"Reported file size is %d extents\n", s_entry->size);
exit(1);
}
#endif
@ -735,6 +786,11 @@ void FDECL2(generate_one_directory, struct directory *, dpnt, FILE *, outfile)
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.
@ -878,9 +934,12 @@ void FDECL1(build_pathlist, struct directory *, 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;
if(dpnt->subdir) build_pathlist(dpnt->subdir);
dpnt = dpnt->next;
}
} /* build_pathlist(... */
@ -927,6 +986,13 @@ static int generate_path_tables()
/*
* Now start filling in the path tables. Start with root directory
*/
if( next_path_index > 0xffff )
{
fprintf(stderr, "Unable to generate sane path tables - too many directories (%d)\n",
next_path_index);
exit(1);
}
path_table_index = 0;
pathlist = (struct directory **) e_malloc(sizeof(struct directory *)
* next_path_index);
@ -936,8 +1002,13 @@ static int generate_path_tables()
do
{
fix = 0;
#ifdef __STDC__
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++)
{
@ -1061,8 +1132,7 @@ static int FDECL1(file_write, FILE *, outfile)
last_extent - session_start);
exit(0);
}
if( verbose > 0 )
if( verbose > 2 )
{
#ifdef DBG_ISO
fprintf(stderr,"Total directory extents being written = %d\n", last_extent);
@ -1156,8 +1226,8 @@ static int FDECL1(pvd_write, FILE *, outfile)
should_write = last_extent - session_start;
set_733((char *) vol_desc.volume_space_size, should_write);
set_723(vol_desc.volume_set_size, 1);
set_723(vol_desc.volume_sequence_number, DEF_VSN);
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, 2048);
/*
@ -1175,7 +1245,7 @@ static int FDECL1(pvd_write, FILE *, outfile)
* Now we copy the actual root directory record
*/
memcpy(vol_desc.root_directory_record, &root_record,
sizeof(struct iso_directory_record));
sizeof(struct iso_directory_record) + 1);
/*
* The rest is just fluff. It looks nice to fill in many of these fields,
@ -1230,16 +1300,16 @@ static int FDECL1(pvd_write, FILE *, outfile)
*/
static int FDECL1(evd_write, FILE *, outfile)
{
struct iso_primary_descriptor vol_desc;
struct iso_primary_descriptor evol_desc;
/*
* Now write the end volume descriptor. Much simpler than the other one
*/
memset(&vol_desc, 0, sizeof(vol_desc));
vol_desc.type[0] = ISO_VD_END;
memcpy(vol_desc.id, ISO_STANDARD_ID, sizeof(ISO_STANDARD_ID));
vol_desc.version[0] = 1;
xfwrite(&vol_desc, 1, 2048, outfile);
memset(&evol_desc, 0, sizeof(evol_desc));
evol_desc.type[0] = ISO_VD_END;
memcpy(evol_desc.id, ISO_STANDARD_ID, sizeof(ISO_STANDARD_ID));
evol_desc.version[0] = 1;
xfwrite(&evol_desc, 1, 2048, outfile);
last_extent_written += 1;
return 0;
}
@ -1306,8 +1376,10 @@ static int file_gen()
static int dirtree_dump()
{
if (verbose > 1)
dump_tree(root);
if (verbose > 2)
{
dump_tree(root);
}
return 0;
}