diff --git a/util/mkisofs/defaults.h b/util/mkisofs/defaults.h index 9e8f3331a..dc9ad380c 100644 --- a/util/mkisofs/defaults.h +++ b/util/mkisofs/defaults.h @@ -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" diff --git a/util/mkisofs/eltorito.c b/util/mkisofs/eltorito.c index 3ff50e92e..b577c731d 100644 --- a/util/mkisofs/eltorito.c +++ b/util/mkisofs/eltorito.c @@ -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 #include @@ -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; } diff --git a/util/mkisofs/exclude.h b/util/mkisofs/exclude.h index b9581a9e9..87cd6948a 100644 --- a/util/mkisofs/exclude.h +++ b/util/mkisofs/exclude.h @@ -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)); diff --git a/util/mkisofs/fnmatch.c b/util/mkisofs/fnmatch.c index cd5c0b27c..44de92e07 100644 --- a/util/mkisofs/fnmatch.c +++ b/util/mkisofs/fnmatch.c @@ -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 @@ -26,6 +26,10 @@ static char rcsid[] ="$Id: fnmatch.c,v 1.3 1997/03/22 02:53:13 eric Rel $"; #include #include +#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; } diff --git a/util/mkisofs/include/fctldefs.h b/util/mkisofs/include/fctldefs.h new file mode 100644 index 000000000..de6b6a394 --- /dev/null +++ b/util/mkisofs/include/fctldefs.h @@ -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 +#endif + +#include +#include + +#ifdef HAVE_FCNTL_H + +# include + +#else /* HAVE_FCNTL_H */ + +# include + +#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 */ diff --git a/util/mkisofs/include/mconfig.h b/util/mkisofs/include/mconfig.h new file mode 100644 index 000000000..1725217d3 --- /dev/null +++ b/util/mkisofs/include/mconfig.h @@ -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 +#else +#ifdef USE_STATIC_CONF +#include /* This is the current static autoconf stuff */ +#else +#include /* 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 + +/* + * 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 */ diff --git a/util/mkisofs/include/prototyp.h b/util/mkisofs/include/prototyp.h new file mode 100644 index 000000000..c74ae0af8 --- /dev/null +++ b/util/mkisofs/include/prototyp.h @@ -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 */ diff --git a/util/mkisofs/include/statdefs.h b/util/mkisofs/include/statdefs.h new file mode 100644 index 000000000..0e34805ce --- /dev/null +++ b/util/mkisofs/include/statdefs.h @@ -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 +#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 */ + diff --git a/util/mkisofs/joliet.c b/util/mkisofs/joliet.c index d3e8cb0e3..0aa866854 100644 --- a/util/mkisofs/joliet.c +++ b/util/mkisofs/joliet.c @@ -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 #include -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; jjcontents; 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; } diff --git a/util/mkisofs/match.c b/util/mkisofs/match.c index 0f5c7d8a7..e01314b0b 100644 --- a/util/mkisofs/match.c +++ b/util/mkisofs/match.c @@ -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 #include #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 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 excluded filenmae */ + } + } + return 0; /* not found -> not excluded */ +} + +int j_ishidden() +{ + return((int)j_mat[0]); +} + diff --git a/util/mkisofs/match.h b/util/mkisofs/match.h index 90def7c2d..7367dd211 100644 --- a/util/mkisofs/match.h +++ b/util/mkisofs/match.h @@ -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)); diff --git a/util/mkisofs/mkisofs.c b/util/mkisofs/mkisofs.c index 3344a921a..11959c0ca 100644 --- a/util/mkisofs/mkisofs.c +++ b/util/mkisofs/mkisofs.c @@ -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 #include "config.h" #include "mkisofs.h" +#include "match.h" #ifdef linux #include @@ -50,6 +51,7 @@ static char rcsid[] ="$Id: mkisofs.c,v 1.29 1998/06/02 03:43:45 eric Exp $"; #include #endif #endif +#include #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