ReactOS 0.4.16-dev-311-g9382aa2
mkisofs.c File Reference
#include <schily/mconfig.h>
#include "mkisofs.h"
#include "rock.h"
#include <schily/errno.h>
#include <schily/time.h>
#include <schily/fcntl.h>
#include <schily/ctype.h>
#include "match.h"
#include <schily/schily.h>
#include <schily/nlsdefs.h>
#include <schily/checkerr.h>
#include <schily/io.h>
#include <schily/getargs.h>
#include "../cdrecord/version.h"
Include dependency graph for mkisofs.c:

Go to the source code of this file.

Classes

struct  rcopts
 
struct  mki_option
 

Macros

#define dysize(A)   (((A)%4)? 365 : (((A)%100) == 0 && ((A)%400)) ? 365 : 366)
 
#define OPTION_COUNT   (sizeof mki_options / sizeof (mki_options[0]))
 
#define TRUE   1
 
#define FALSE   0
 

Functions

LOCAL int getH __PR ((const char *arg, void *valp, int *pac, char *const **pav, const char *opt))
 
LOCAL int get_boot_image __PR ((char *opt_arg))
 
LOCAL void ldate_error __PR ((char *arg))
 
LOCAL char *strntoi __PR ((char *p, int n, int *ip))
 
LOCAL int mosize __PR ((int y, int m))
 
LOCAL char *parse_date __PR ((char *arg, struct tm *tp))
 
LOCAL int get_ldate __PR ((char *opt_arg, void *valp))
 
LOCAL int get_boot_image (char *opt_arg)
 
LOCAL int get_hd_boot (char *opt_arg)
 
LOCAL int get_ne_boot (char *opt_arg)
 
LOCAL int get_no_boot (char *opt_arg)
 
LOCAL int get_boot_addr (char *opt_arg)
 
LOCAL int get_boot_size (char *opt_arg)
 
LOCAL int get_boot_platid (char *opt_arg)
 
LOCAL int get_boot_table (char *opt_arg)
 
LOCAL void ldate_error (char *arg)
 
LOCAL charstrntoi (char *p, int n, int *ip)
 
LOCAL int mosize (int y, int m)
 
LOCAL charparse_date (char *arg, struct tm *tp)
 
LOCAL int get_ldate (char *opt_arg, void *valp)
 
LOCAL int getH (char *arg, void *valp, int *pac, char *const **pav, const char *opt) const
 
LOCAL int getL (char *arg, void *valp, int *pac, char *const **pav, const char *opt) const
 
LOCAL int getP (char *arg, void *valp, int *pac, char *const **pav, const char *opt) const
 
LOCAL int dolegacy (char *arg, void *valp, int *pac, char *const **pav, const char *opt) const
 
LOCAL void read_rcfile __PR ((char *appname))
 
LOCAL void susage __PR ((int excode))
 
EXPORT int iso9660_date __PR ((char *result, time_t crtime))
 
LOCAL void hide_reloc_dir __PR ((void))
 
LOCAL char *get_pnames __PR ((int argc, char *const *argv, int opt, char *pname, int pnsize, FILE *fp))
 
EXPORT int main __PR ((int argc, char *argv[]))
 
EXPORT char *findgequal __PR ((char *s))
 
LOCAL char *escstrcpy __PR ((char *to, size_t tolen, char *from))
 
struct directory *get_graft __PR ((char *arg, char *graft_point, size_t glen, char *nodename, size_t nlen, char **short_namep, BOOL do_insert))
 
EXPORT void *e_malloc __PR ((size_t size))
 
EXPORT char *e_strdup __PR ((const char *s))
 
LOCAL void ovstrcpy __PR ((char *p2, char *p1))
 
LOCAL void checkarch __PR ((char *name))
 
LOCAL void read_rcfile (char *appname)
 
LOCAL void susage (int excode)
 
const char *optend __PR ((const char *fmt))
 
const charoptend (char *fmt) const
 
int printopts __PR ((FILE *f, const char *fmt, const char *arg, int twod))
 
int printopts (FILE *f, const char *fmt, const char *arg, int twod)
 
const char *docstr __PR ((const char *str, int *no_help))
 
const chardocstr (char *str, int *no_help) const
 
LOCAL void usage (int excode)
 
EXPORT int iso9660_date (char *result, time_t crtime)
 
EXPORT int iso9660_ldate (char *result, time_t crtime, int nsec, int gmtoff)
 
LOCAL void hide_reloc_dir ()
 
LOCAL charget_pnames (int argc, char *const *argv, int opt, char *pname, int pnsize, FILE *fp)
 
EXPORT int main (int argc, argv)
 
LOCAL void list_locales ()
 
EXPORT charfindgequal (char *s)
 
LOCAL charescstrcpy (char *to, size_t tolen, char *from)
 
struct directoryget_graft (char *arg, char *graft_point, size_t glen, char *nodename, size_t nlen, char **short_namep, BOOL do_insert)
 
EXPORT voide_malloc (size_t size)
 
EXPORT chare_strdup (char *s) const
 
LOCAL void ovstrcpy (char *p2, char *p1)
 
LOCAL void checkarch (char *name)
 

Variables

static UConst char sccsid []
 
struct directoryroot = NULL
 
int path_ind
 
char version_string [] = VERSION
 
charoutfile
 
FILEdiscimage
 
UInt32_t next_extent = 0
 
UInt32_t last_extent = 0
 
UInt32_t session_start = 0
 
unsigned int path_table_size = 0
 
unsigned int path_table [4] = {0, }
 
unsigned int path_blocks = 0
 
unsigned int jpath_table_size = 0
 
unsigned int jpath_table [4] = {0, }
 
unsigned int jpath_blocks = 0
 
struct iso_directory_record root_record
 
struct iso_directory_record jroot_record
 
charextension_record = NULL
 
UInt32_t extension_record_extent = 0
 
int extension_record_size = 0
 
BOOL archive_isreg
 
dev_t archive_dev
 
ino_t archive_ino
 
int check_oldnames = 0
 
int check_session = 0
 
int use_eltorito = 0
 
int hard_disk_boot = 0
 
int not_bootable = 0
 
int no_emul_boot = 0
 
int load_addr = 0
 
int load_size = 0
 
int boot_info_table = 0
 
int use_sparcboot = 0
 
int use_sunx86boot = 0
 
int use_genboot = 0
 
int use_RockRidge = 0
 
int use_XA = 0
 
int osecsize = 0
 
int use_Joliet = 0
 
int jlen = JMAX
 
int verbose = 1
 
int debug = 0
 
int gui = 0
 
BOOL legacy = FALSE
 
int all_files = 1
 
BOOL Hflag = FALSE
 
BOOL follow_links = FALSE
 
int cache_inodes = -1
 
int rationalize = 0
 
int rationalize_uid = 0
 
int rationalize_gid = 0
 
int rationalize_filemode = 0
 
int rationalize_dirmode = 0
 
uid_t uid_to_use = 0
 
gid_t gid_to_use = 0
 
int filemode_to_use = 0
 
int dirmode_to_use = 0
 
int new_dir_mode = 0555
 
int generate_tables = 0
 
int dopad = 1
 
int print_size = 0
 
int split_output = 0
 
charicharset = NULL
 
charocharset = NULL
 
charpreparer = PREPARER_DEFAULT
 
charpublisher = PUBLISHER_DEFAULT
 
charappid = APPID_DEFAULT
 
charcopyright = COPYRIGHT_DEFAULT
 
charbiblio = BIBLIO_DEFAULT
 
char *abstract charvolset_id = VOLSET_ID_DEFAULT
 
charvolume_id = VOLUME_ID_DEFAULT
 
charsystem_id = SYSTEM_ID_DEFAULT
 
charboot_catalog
 
charboot_image = BOOT_IMAGE_DEFAULT
 
chargenboot_image = BOOT_IMAGE_DEFAULT
 
int ucs_level = 3
 
int volume_set_size = 1
 
int volume_sequence_number = 1
 
charmerge_image
 
charcheck_image
 
charreloc_root = NULL
 
charreloc_old_root = NULL
 
charcdrecord_data
 
int disable_deep_reloc
 
chardirmode_str
 
charfilemode_str
 
chargid_str
 
int help
 
int joliet_long
 
charjcharset
 
int max_filenames
 
charlog_file
 
charnew_dirmode_str
 
charpathnames
 
int rationalize_rr
 
charsectype
 
charuid_str
 
int untranslated_filenames
 
int pversion
 
int rationalize_xa
 
ldate modification_date
 
BOOL nodesc = FALSE
 
LOCAL int walkflags = 0
 
time_t begun
 
struct timeval tv_begun
 
LOCAL BOOL data_change_warn
 
struct eltorito_boot_entry_infofirst_boot_entry = NULL
 
struct eltorito_boot_entry_infolast_boot_entry = NULL
 
struct eltorito_boot_entry_infocurrent_boot_entry = NULL
 
int use_graft_ptrs
 
int match_igncase
 
int jhide_trans_tbl
 
int hide_rr_moved
 
int omit_period = 0
 
int transparent_compression = 0
 
int omit_version_number = 0
 
int no_rr = 0
 
int force_rr = 0
 
Uint RR_relocation_depth = 6
 
int do_largefiles = 0
 
off_t maxnonlarge = (off_t)0xFFFFFFFF
 
int iso9660_level = 1
 
int iso9660_namelen = LEN_ISONAME
 
int full_iso9660_filenames = 0
 
int nolimitpathtables = 0
 
int relaxed_filenames = 0
 
int allow_lowercase = 0
 
int no_allow_lowercase = 0
 
int allow_multidot = 0
 
int iso_translate = 1
 
int allow_leading_dots = 0
 
int use_fileversion = 0
 
int split_SL_component = 1
 
int split_SL_field = 1
 
chartrans_tbl
 
int stream_media_size = 0
 
charstream_filename
 
int donotwrite_macpart = 1
 
UInt32_t null_inodes = NULL_INO_MAX
 
BOOL correct_inodes = TRUE
 
BOOL rrip112 = TRUE
 
BOOL long_rr_time = FALSE
 
siconvt_tin_nls = NULL
 
siconvt_tout_nls = NULL
 
struct rcopts rcopt []
 
static int dmsize [12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
 
LOCAL struct ga_flagsgl_flags
 
LOCAL int save_pname = 0
 
LOCAL const struct mki_option mki_options []
 
charpath_table_l = NULL
 
charpath_table_m = NULL
 
charjpath_table_l = NULL
 
charjpath_table_m = NULL
 
int goof = 0
 

Macro Definition Documentation

◆ dysize

#define dysize (   A)    (((A)%4)? 365 : (((A)%100) == 0 && ((A)%400)) ? 365 : 366)

Definition at line 723 of file mkisofs.c.

◆ FALSE

#define FALSE   0

Definition at line 1644 of file mkisofs.c.

◆ OPTION_COUNT

#define OPTION_COUNT   (sizeof mki_options / sizeof (mki_options[0]))

Definition at line 1467 of file mkisofs.c.

◆ TRUE

#define TRUE   1

Definition at line 1640 of file mkisofs.c.

Function Documentation

◆ __PR() [1/23]

LOCAL void read_rcfile __PR ( (char *appname)  )

◆ __PR() [2/23]

LOCAL void ldate_error __PR ( (char *arg )

◆ __PR() [3/23]

struct directory *get_graft __PR ( (char *arg, char *graft_point, size_t glen, char *nodename, size_t nlen, char **short_namep, BOOL do_insert)  )

◆ __PR() [4/23]

LOCAL char *parse_date __PR ( (char *arg, struct tm *tp )

◆ __PR() [5/23]

LOCAL void checkarch __PR ( (char *name )

◆ __PR() [6/23]

LOCAL int get_boot_image __PR ( (char *opt_arg)  )

◆ __PR() [7/23]

LOCAL int get_ldate __PR ( (char *opt_arg, void *valp)  )

◆ __PR() [8/23]

LOCAL char *strntoi __PR ( (char *p, int n, int *ip )

◆ __PR() [9/23]

LOCAL void ovstrcpy __PR ( (char *p2, char *p1)  )

◆ __PR() [10/23]

EXPORT int iso9660_date __PR ( (char *result, time_t crtime)  )

◆ __PR() [11/23]

EXPORT char *findgequal __PR ( (char *s )

◆ __PR() [12/23]

LOCAL char *escstrcpy __PR ( (char *to, size_t tolen, char *from )

◆ __PR() [13/23]

LOCAL int getH __PR ( (const char *arg, void *valp, int *pac, char *const **pav, const char *opt)  )

◆ __PR() [14/23]

const char *optend __PR ( (const char *fmt )

◆ __PR() [15/23]

EXPORT char *e_strdup __PR ( (const char *s )

◆ __PR() [16/23]

const char *docstr __PR ( (const char *str, int *no_help)  )

◆ __PR() [17/23]

int printopts __PR ( (FILE *f, const char *fmt, const char *arg, int twod)  )

◆ __PR() [18/23]

EXPORT int main __PR ( (int argc, char *argv[])  )

◆ __PR() [19/23]

LOCAL char *get_pnames __PR ( (int argc, char *const *argv, int opt, char *pname, int pnsize, FILE *fp)  )

◆ __PR() [20/23]

LOCAL void susage __PR ( (int excode)  )

◆ __PR() [21/23]

LOCAL int mosize __PR ( (int y, int m )

◆ __PR() [22/23]

EXPORT void *e_malloc __PR ( (size_t size )

◆ __PR() [23/23]

LOCAL void hide_reloc_dir __PR ( (void )

◆ checkarch()

LOCAL void checkarch ( char name)

Definition at line 3964 of file mkisofs.c.

3966{
3967 struct stat stbuf;
3968
3970 archive_dev = (dev_t)0;
3971 archive_ino = (ino_t)0;
3972
3973 if (name == NULL)
3974 return;
3975 if (stat(name, &stbuf) < 0)
3976 return;
3977
3978 if (S_ISREG(stbuf.st_mode)) {
3979 archive_dev = stbuf.st_dev;
3980 archive_ino = stbuf.st_ino;
3982 } else if (((stbuf.st_mode & S_IFMT) == 0) ||
3983 S_ISFIFO(stbuf.st_mode) ||
3984 S_ISSOCK(stbuf.st_mode)) {
3985 /*
3986 * This is a pipe or similar on different UNIX implementations.
3987 * (stbuf.st_mode & S_IFMT) == 0 may happen in stange cases.
3988 */
3990 archive_ino = (ino_t)-1;
3991 }
3992}
#define stat
Definition: acwin.h:99
#define S_ISREG(mode)
Definition: various.h:17
#define NULL
Definition: types.h:112
#define NODEV
Definition: fs.h:27
__kernel_dev_t dev_t
Definition: linux.h:197
__kernel_ino_t ino_t
Definition: linux.h:198
#define S_ISSOCK(m)
Definition: ext2fs.h:372
#define S_ISFIFO(m)
Definition: ext2fs.h:378
#define S_IFMT
Definition: ext2fs.h:358
ino_t archive_ino
Definition: mkisofs.c:95
BOOL archive_isreg
Definition: mkisofs.c:93
#define TRUE
Definition: mkisofs.c:1640
#define FALSE
Definition: mkisofs.c:1644
dev_t archive_dev
Definition: mkisofs.c:94
Definition: name.c:39
Definition: stat.h:55

Referenced by main().

◆ docstr()

const char * docstr ( char str,
int no_help 
) const

Definition at line 1763 of file mkisofs.c.

1766{
1767 if (no_help)
1768 *no_help = 0;
1769 if (str == NULL)
1770 return (str);
1771
1772 if (*str == '-' || *str == '\\')
1773 str++;
1774
1775 if (*str == '\1') {
1776 str++;
1777 while (*str != '\0' && *str != '\1' && *str != '\2')
1778 str++;
1779 }
1780 if (*str == '\1') {
1781 str++;
1782 } else if (*str == '\2') {
1783 str++;
1784 if (no_help)
1785 *no_help = 1;
1786 }
1787
1788 if (*str == '\0')
1789 return (NULL);
1790 return (str);
1791}
const WCHAR * str

Referenced by test_SetDocString(), and usage().

◆ dolegacy()

LOCAL int dolegacy ( char arg,
void valp,
int pac,
char *const **  pav,
const char opt 
) const

Definition at line 1002 of file mkisofs.c.

1008{
1009 legacy = TRUE;
1010#ifdef APPLE_HYB
1011 gl_flags[2].ga_format = "H&"; /* Apple Hybrid "-map" */
1012#endif
1013#ifdef OPT_L_HAS_ARG /* never ;-) */
1014 gl_flags[4].ga_format = "L&"; /* -allow-leading-dots */
1015#endif
1016 gl_flags[6].ga_format = "P&"; /* -publisher */
1017 return (1);
1018}
BOOL legacy
Definition: mkisofs.c:131
LOCAL struct ga_flags * gl_flags
Definition: mkisofs.c:999

◆ e_malloc()

EXPORT void * e_malloc ( size_t  size)

Definition at line 3921 of file mkisofs.c.

3923{
3924 void *pt = 0;
3925
3926 if (size == 0)
3927 size = 1;
3928 if ((pt = malloc(size)) == NULL) {
3929 comerr(_("Not enough memory\n"));
3930 }
3931 /*
3932 * Not all code is clean yet.
3933 * Filling all allocated data with zeroes will help
3934 * to avoid core dumps.
3935 */
3936 memset(pt, 0, size);
3937 return (pt);
3938}
EXPORT void comerr(char *msg, va_alist)
Definition: comerr.c:84
#define malloc
Definition: debug_ros.c:4
#define pt(x, y)
Definition: drawing.c:79
GLsizeiptr size
Definition: glext.h:5919
#define _(X)
Definition: i386-dis.c:35
#define memset(x, y, z)
Definition: compat.h:39

Referenced by add_directory_hash(), add_file_hash(), add_hash(), assign_file_addresses(), attach_dot_entries(), check_rr_relocation(), convert_to_unicode(), dup_directory_entry(), dup_relocated_dir(), find_or_create_directory(), gen_str_path(), generate_joliet_path_tables(), generate_one_directory(), generate_one_joliet_directory(), generate_path_tables(), generate_reloc_directory(), generate_rr_extension_record(), generate_xa_rr_attributes(), get_boot_entry(), init_boot_catalog(), insert_boot_cat(), insert_file_entry(), joliet_sort_directory(), merge_isofs(), merge_old_directory_into_tree(), outputlist_insert(), read_merging_directory(), set_de_path(), sort_directory(), sort_n_finish(), write_str_dir(), and write_str_file().

◆ e_strdup()

EXPORT char * e_strdup ( char s) const

Definition at line 3941 of file mkisofs.c.

3943{
3944 char *ret = strdup(s);
3945
3946 if (s == NULL)
3947 comerr(_("Not enough memory for strdup(%s)\n"), s);
3948 return (ret);
3949}
GLdouble s
Definition: gl.h:2039
_Check_return_ _CRTIMP char *__cdecl strdup(_In_opt_z_ const char *_Src)
int ret

Referenced by assign_file_addresses(), attach_dot_entries(), dup_directory_entry(), dup_relocated_dir(), find_or_create_directory(), generate_reloc_directory(), insert_boot_cat(), insert_file_entry(), main(), merge_old_directory_into_tree(), merge_remaining_entries(), parse_rr(), read_merging_directory(), read_rcfile(), search_tree_file(), and sort_n_finish().

◆ escstrcpy()

LOCAL char * escstrcpy ( char to,
size_t  tolen,
char from 
)

Definition at line 3659 of file mkisofs.c.

3663{
3664 char *p = to;
3665
3666 if (debug)
3667 error("FROM: '%s'\n", from);
3668
3669 to[0] = '\0';
3670 if (tolen > 0) {
3671 to[--tolen] = '\0'; /* Fill in last nul char */
3672 }
3673 while ((*p = *from++) != '\0' && tolen-- > 0) {
3674 if (*p == '\\') {
3675 if ((*p = *from++) == '\0')
3676 break;
3677 if (*p != '\\' && *p != '=') {
3678 p[1] = p[0];
3679 *p++ = '\\';
3680 }
3681 }
3682 p++;
3683 }
3684 if (debug)
3685 error("ESC: '%s'\n", to);
3686 return (to);
3687}
GLfloat GLfloat p
Definition: glext.h:8902
#define error(str)
Definition: mkdosfs.c:1605
int debug
Definition: mkisofs.c:129
CardRegion * from
Definition: spigame.cpp:19

Referenced by get_graft(), and main().

◆ findgequal()

EXPORT char * findgequal ( char s)

Definition at line 3642 of file mkisofs.c.

3644{
3645 char *p = s;
3646
3647 while ((p = strchr(p, '=')) != NULL) {
3648 if (p > s && p[-1] != '\\')
3649 return (p);
3650 p++;
3651 }
3652 return (NULL);
3653}
char * strchr(const char *String, int ch)
Definition: utclib.c:501

Referenced by get_graft(), graftcp(), and main().

◆ get_boot_addr()

LOCAL int get_boot_addr ( char opt_arg)

Definition at line 458 of file mkisofs.c.

460{
461 long val;
462 char *ptr;
463
464 use_eltorito++;
465 val = strtol(opt_arg, &ptr, 0);
466 if (*ptr || val < 0 || val >= 0x10000) {
467 comerrno(EX_BAD, _("Boot image load address invalid.\n"));
468 }
469 load_addr = val;
471 current_boot_entry->load_addr = load_addr;
472 return (1);
473}
EXPORT void comerrno(int err, char *msg, va_alist)
Definition: comerr.c:137
EXPORT void get_boot_entry()
Definition: eltorito.c:629
GLuint GLfloat * val
Definition: glext.h:7180
_Check_return_ long __cdecl strtol(_In_z_ const char *_Str, _Out_opt_ _Deref_post_z_ char **_EndPtr, _In_ int _Radix)
int use_eltorito
Definition: mkisofs.c:100
struct eltorito_boot_entry_info * current_boot_entry
Definition: mkisofs.c:228
int load_addr
Definition: mkisofs.c:104
static PVOID ptr
Definition: dispmode.c:27
#define EX_BAD
Definition: standard.h:62

◆ get_boot_image()

LOCAL int get_boot_image ( char opt_arg)

Definition at line 408 of file mkisofs.c.

410{
411 do_sort++; /* We sort bootcat/botimage */
412 use_eltorito++;
413 boot_image = opt_arg; /* pathname of the boot image */
414 /* on disk */
415 if (boot_image == NULL || *boot_image == '\0') {
417 _("Required Eltorito boot image pathname missing\n"));
418 }
420 current_boot_entry->boot_image = boot_image;
421 return (1);
422}
char * boot_image
Definition: mkisofs.c:169

◆ get_boot_platid()

LOCAL int get_boot_platid ( char opt_arg)

Definition at line 495 of file mkisofs.c.

497{
498 long val;
499 char *ptr;
500
501 use_eltorito++;
502 if (streql(opt_arg, "x86")) {
504 } else if (streql(opt_arg, "PPC")) {
506 } else if (streql(opt_arg, "Mac")) {
508 } else if (streql(opt_arg, "efi")) {
510 } else {
511 val = strtol(opt_arg, &ptr, 0);
512 if (*ptr || val < 0 || val >= 0x100) {
513 comerrno(EX_BAD, _("Bad boot system ID.\n"));
514 }
515 }
516
517 /*
518 * If there is already a boot entry and the boot file name has been set
519 * for this boot entry and the new platform id differs from the
520 * previous value, we start a new boot section.
521 */
522 if (current_boot_entry &&
523 current_boot_entry->boot_image != NULL &&
524 current_boot_entry->boot_platform != val) {
526 }
529 current_boot_entry->boot_platform = val;
530 return (1);
531}
EXPORT int new_boot_entry()
Definition: eltorito.c:650
#define EL_TORITO_ARCH_PPC
Definition: iso9660.h:51
#define EL_TORITO_ARCH_EFI
Definition: iso9660.h:53
#define EL_TORITO_ARCH_MAC
Definition: iso9660.h:52
#define EL_TORITO_ARCH_x86
Definition: iso9660.h:50
#define ELTORITO_BOOT_ID
Definition: mkisofs.h:321
EXPORT int streql(char *a, const char *b) const
Definition: streql.c:23

◆ get_boot_size()

LOCAL int get_boot_size ( char opt_arg)

Definition at line 476 of file mkisofs.c.

478{
479 long val;
480 char *ptr;
481
482 use_eltorito++;
483 val = strtol(opt_arg, &ptr, 0);
484 if (*ptr || val < 0 || val >= 0x10000) {
486 _("Boot image load size invalid.\n"));
487 }
488 load_size = val;
490 current_boot_entry->load_size = load_size;
491 return (1);
492}
int load_size
Definition: mkisofs.c:105

◆ get_boot_table()

LOCAL int get_boot_table ( char opt_arg)

Definition at line 534 of file mkisofs.c.

536{
537 use_eltorito++;
540 current_boot_entry->boot_info_table = 1;
541 return (1);
542}
int boot_info_table
Definition: mkisofs.c:106

◆ get_graft()

struct directory * get_graft ( char arg,
char graft_point,
size_t  glen,
char nodename,
size_t  nlen,
char **  short_namep,
BOOL  do_insert 
)

Definition at line 3690 of file mkisofs.c.

3698{
3699 char *node = NULL;
3700 struct directory_entry de;
3701 struct directory *graft_dir = root;
3702 struct stat st;
3703 char *short_name;
3704 int status;
3705
3706 fillbytes(&de, sizeof (de), '\0');
3707 /*
3708 * We would like a syntax like:
3709 *
3710 * /tmp=/usr/tmp/xxx
3711 *
3712 * where the user can specify a place to graft each component
3713 * of the tree. To do this, we may have to create directories
3714 * along the way, of course. Secondly, I would like to allow
3715 * the user to do something like:
3716 *
3717 * /home/baz/RMAIL=/u3/users/baz/RMAIL
3718 *
3719 * so that normal files could also be injected into the tree
3720 * at an arbitrary point.
3721 *
3722 * The idea is that the last component of whatever is being
3723 * entered would take the name from the last component of
3724 * whatever the user specifies.
3725 *
3726 * The default will be that the file is injected at the root of
3727 * the image tree.
3728 */
3729 node = findgequal(arg);
3730 if (!use_graft_ptrs)
3731 node = NULL;
3732 /*
3733 * Remove '\\' escape chars which are located
3734 * before '\\' and '=' chars ---> below in escstrcpy()
3735 */
3736
3737 short_name = NULL;
3738
3739 if (node != NULL || reloc_root) {
3740 char *pnt;
3741 char *xpnt;
3742 size_t len;
3743
3744 /* insert -root prefix */
3745 if (reloc_root != NULL) {
3746 strlcpy(graft_point, reloc_root, glen);
3747 len = strlen(graft_point);
3748
3749 if ((len < (glen -1)) &&
3750 (len == 0 || graft_point[len-1] != '/')) {
3751 graft_point[len++] = '/';
3752 graft_point[len] = '\0';
3753 }
3754 } else {
3755 len = 0;
3756 }
3757
3758 if (node) {
3759 *node = '\0';
3760 escstrcpy(&graft_point[len], glen - len, arg);
3761 *node = '=';
3762 }
3763
3764 /*
3765 * Remove unwanted "./" & "/" sequences from start...
3766 */
3767 do {
3768 xpnt = graft_point;
3769 while (xpnt[0] == '.' && xpnt[1] == '/')
3770 xpnt += 2;
3771 while (*xpnt == PATH_SEPARATOR) {
3772 xpnt++;
3773 }
3774 /*
3775 * The string becomes shorter, there is no need to check
3776 * the length. Make sure to support overlapping strings.
3777 */
3778 ovstrcpy(graft_point, xpnt);
3779 } while (xpnt > graft_point);
3780
3781 if (node) {
3782 node = escstrcpy(nodename, nlen, ++node);
3783 } else {
3784 node = arg;
3785 }
3786
3787 graft_dir = root;
3788 xpnt = graft_point;
3789
3790 /*
3791 * If "node" points to a directory, then graft_point
3792 * needs to point to a directory too.
3793 */
3794 if (follow_links)
3795 status = stat_filter(node, &st);
3796 else
3797 status = lstat_filter(node, &st);
3798 if (status == 0 && S_ISDIR(st.st_mode)) {
3799 len = strlen(graft_point);
3800
3801 if ((len < (glen -1)) &&
3802 (len == 0 || graft_point[len-1] != '/')) {
3803 graft_point[len++] = '/';
3804 graft_point[len] = '\0';
3805 }
3806 }
3807 if (debug)
3808 error("GRAFT:'%s'\n", xpnt);
3809 /*
3810 * Loop down deeper and deeper until we find the
3811 * correct insertion spot.
3812 * Canonicalize the filename while parsing it.
3813 */
3814 for (;;) {
3815 do {
3816 while (xpnt[0] == '.' && xpnt[1] == '/')
3817 xpnt += 2;
3818 while (xpnt[0] == '/')
3819 xpnt += 1;
3820 if (xpnt[0] == '.' && xpnt[1] == '.' && xpnt[2] == '/') {
3821 if (graft_dir && graft_dir != root) {
3822 graft_dir = graft_dir->parent;
3823 xpnt += 2;
3824 }
3825 }
3826 } while ((xpnt[0] == '/') || (xpnt[0] == '.' && xpnt[1] == '/'));
3827 pnt = strchr(xpnt, PATH_SEPARATOR);
3828 if (pnt == NULL) {
3829 if (*xpnt != '\0') {
3830 short_name = xpnt;
3831 if (short_namep)
3832 *short_namep = xpnt;
3833 }
3834 break;
3835 }
3836 *pnt = '\0';
3837 if (debug) {
3838 error("GRAFT Point:'%s' in '%s : %s' (%s)\n",
3839 xpnt,
3840 graft_dir->whole_name,
3841 graft_dir->de_name,
3842 graft_point);
3843 }
3844 graft_dir = find_or_create_directory(graft_dir,
3845 graft_point,
3846 NULL, TRUE);
3847 *pnt = PATH_SEPARATOR;
3848 xpnt = pnt + 1;
3849 }
3850 } else {
3851 graft_dir = root;
3852 if (use_graft_ptrs)
3853 node = escstrcpy(nodename, nlen, arg);
3854 else
3855 node = arg;
3856 }
3857
3858 /*
3859 * Now see whether the user wants to add a regular file, or a
3860 * directory at this point.
3861 */
3862 if (follow_links || Hflag)
3863 status = stat_filter(node, &st);
3864 else
3865 status = lstat_filter(node, &st);
3866 if (status != 0) {
3867 /*
3868 * This is a fatal error - the user won't be getting
3869 * what they want if we were to proceed.
3870 */
3871 comerr(_("Invalid node - '%s'.\n"), node);
3872 } else {
3873 if (S_ISDIR(st.st_mode)) {
3874 if (debug) {
3875 error(_("graft_dir: '%s : %s', node: '%s', (scan)\n"),
3876 graft_dir->whole_name,
3877 graft_dir->de_name, node);
3878 }
3879 if (!do_insert)
3880 return (graft_dir);
3881 if (!scan_directory_tree(graft_dir,
3882 node, &de)) {
3883 exit(1);
3884 }
3885 if (debug) {
3886 error(_("scan done\n"));
3887 }
3888 } else {
3889 if (short_name == NULL) {
3892 if (short_name == NULL ||
3893 short_name < node) {
3894 short_name = node;
3895 } else {
3896 short_name++;
3897 }
3898 }
3899 if (debug) {
3900 error(_("graft_dir: '%s : %s', node: '%s', short_name: '%s'\n"),
3901 graft_dir->whole_name,
3902 graft_dir->de_name, node,
3903 short_name);
3904 }
3905 if (!do_insert)
3906 return (graft_dir);
3907 if (!insert_file_entry(graft_dir, node,
3908 short_name, NULL, 0)) {
3909 /*
3910 * Should we ignore this?
3911 */
3912/* exit(1);*/
3913 /* EMPTY */
3914 }
3915 }
3916 }
3917 return (graft_dir);
3918}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
const WCHAR * short_name
Definition: reg.c:29
#define S_ISDIR(mode)
Definition: various.h:18
size_t strlcpy(char *d, const char *s, size_t bufsize)
Definition: compat.c:3
EXPORT char * fillbytes(void *tov, ssize_t cnt, char val)
Definition: fillbytes.c:36
GLenum GLsizei len
Definition: glext.h:6722
EXPORT char * findgequal(char *s)
Definition: mkisofs.c:3642
char * reloc_root
Definition: mkisofs.c:177
BOOL Hflag
Definition: mkisofs.c:133
struct directory * root
Definition: mkisofs.c:68
LOCAL void ovstrcpy(char *p2, char *p1)
Definition: mkisofs.c:3955
int use_graft_ptrs
Definition: mkisofs.c:230
BOOL follow_links
Definition: mkisofs.c:134
LOCAL char * escstrcpy(char *to, size_t tolen, char *from)
Definition: mkisofs.c:3659
_CRT_RESTORE_GCC_WARNINGS _CRT_DISABLE_GCC_WARNINGS _Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
#define exit(n)
Definition: config.h:202
EXPORT int insert_file_entry(struct directory *this_dir, char *whole_path, char *short_name, struct stat *statp, int have_rsrc)
Definition: tree.c:1444
EXPORT int stat_filter(char *path, struct stat *st)
Definition: tree.c:232
EXPORT int lstat_filter(char *path, struct stat *st)
Definition: tree.c:244
EXPORT int scan_directory_tree(struct directory *this_dir, char *path, struct directory_entry *de)
Definition: tree.c:1147
EXPORT struct directory * find_or_create_directory(struct directory *parent, char *path, struct directory_entry *de, int flag)
Definition: tree.c:2508
Definition: mkisofs.h:107
struct directory * parent
Definition: mkisofs.h:269
char * de_name
Definition: mkisofs.h:275
char * whole_name
Definition: mkisofs.h:273
Definition: ps.c:97
Definition: dlist.c:348
void * arg
Definition: msvc.h:10
#define PATH_SEPARATOR
Definition: xmllint.c:205

Referenced by main().

◆ get_hd_boot()

LOCAL int get_hd_boot ( char opt_arg)

Definition at line 425 of file mkisofs.c.

427{
428 use_eltorito++;
431 current_boot_entry->hard_disk_boot = 1;
432 return (1);
433}
int hard_disk_boot
Definition: mkisofs.c:101

◆ get_ldate()

LOCAL int get_ldate ( char opt_arg,
void valp 
)

Definition at line 832 of file mkisofs.c.

835{
836 time_t t;
837 int usec = 0;
838 int gmtoff = -100;
839 struct tm tm;
840 char *p;
841 char *arg;
842
843 p = parse_date(opt_arg, &tm);
844 if (*p == '.') {
845 p++;
846 arg = p;
847 p = strntoi(arg, 2, &usec);
848 if ((p - arg) != 2)
849 ldate_error(opt_arg);
850 if (usec > 99)
851 ldate_error(opt_arg);
852 usec *= 10000;
853 }
854 if (*p == ' ')
855 p++;
856 if (*p == '+' || *p == '-') {
857 int i;
858 char *s = p++;
859
860 arg = p;
861 p = strntoi(arg, 2, &gmtoff);
862 if ((p - arg) != 2)
863 ldate_error(opt_arg);
864 arg = p;
865 p = strntoi(arg, 2, &i);
866 if ((p - arg) != 2)
867 ldate_error(opt_arg);
868 if (i > 59)
869 ldate_error(opt_arg);
870 gmtoff *= 60;
871 gmtoff += i;
872 if (gmtoff % 15)
873 ldate_error(opt_arg);
874 if (*s == '-')
875 gmtoff *= -1;
876 gmtoff /= 15;
877 if (gmtoff < -48 || gmtoff > 52)
878 ldate_error(opt_arg);
879 }
880 if (*p != '\0')
881 ldate_error(opt_arg);
882
883 seterrno(0);
884 t = mktime(&tm);
885 if (t == -1 && geterrno() != 0)
886 comerr(_("Date '%s' is out of range.\n"), opt_arg);
887
888 ((ldate *)valp)->l_sec = t;
889 ((ldate *)valp)->l_usec = usec;
890 ((ldate *)valp)->l_gmtoff = gmtoff;
891
892 return (1);
893}
__kernel_time_t time_t
Definition: linux.h:252
EXPORT int geterrno()
Definition: geterrno.c:34
GLdouble GLdouble t
Definition: gl.h:2047
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
LOCAL char * strntoi(char *p, int n, int *ip)
Definition: mkisofs.c:698
LOCAL void ldate_error(char *arg)
Definition: mkisofs.c:691
LOCAL char * parse_date(char *arg, struct tm *tp)
Definition: mkisofs.c:739
_CRTIMP time_t __cdecl mktime(struct tm *_Tm)
Definition: time.h:418
EXPORT int seterrno(int err)
Definition: seterrno.c:34
Definition: mkisofs.h:331
Definition: time.h:68

◆ get_ne_boot()

LOCAL int get_ne_boot ( char opt_arg)

Definition at line 436 of file mkisofs.c.

438{
439 use_eltorito++;
440 no_emul_boot++;
442 current_boot_entry->no_emul_boot = 1;
443 return (1);
444}
int no_emul_boot
Definition: mkisofs.c:103

◆ get_no_boot()

LOCAL int get_no_boot ( char opt_arg)

Definition at line 447 of file mkisofs.c.

449{
450 use_eltorito++;
451 not_bootable++;
453 current_boot_entry->not_bootable = 1;
454 return (1);
455}
int not_bootable
Definition: mkisofs.c:102

◆ get_pnames()

LOCAL char * get_pnames ( int  argc,
char * const argv,
int  opt,
char pname,
int  pnsize,
FILE fp 
)

Definition at line 1969 of file mkisofs.c.

1976{
1977 int len;
1978
1979 /* we may of already read the first line from the pathnames file */
1980 if (save_pname) {
1981 save_pname = 0;
1982 return (pname);
1983 }
1984
1985#ifdef USE_FIND
1986 if (dofind && opt < (find_pav - argv))
1987 return (argv[opt]);
1988 else if (!dofind && opt < argc)
1989 return (argv[opt]);
1990#else
1991 if (opt < argc)
1992 return (argv[opt]);
1993#endif
1994
1995 if (fp == NULL)
1996 return ((char *)0);
1997
1998 if (fgets(pname, pnsize, fp)) {
1999 /* Discard newline */
2000 len = strlen(pname);
2001 if (pname[len - 1] == '\n') {
2002 pname[len - 1] = '\0';
2003 }
2004 return (pname);
2005 }
2006 return ((char *)0);
2007}
static int argc
Definition: ServiceArgs.c:12
GLenum pname
Definition: glext.h:5645
_Check_return_opt_ _CRTIMP char *__cdecl fgets(_Out_writes_z_(_MaxCount) char *_Buf, _In_ int _MaxCount, _Inout_ FILE *_File)
LOCAL int save_pname
Definition: mkisofs.c:1043
#define argv
Definition: mplay32.c:18

Referenced by main().

◆ getH()

LOCAL int getH ( char arg,
void valp,
int pac,
char *const **  pav,
const char opt 
) const

Definition at line 914 of file mkisofs.c.

920{
921/*error("getH\n");*/
922 if (opt[0] == '-' && opt[1] == 'H' && opt[2] == '\0') {
923#ifdef APPLE_HYB
924 if (legacy) {
925 errmsgno(EX_BAD, _("The option '-H' is deprecated since 2002.\n"));
926 errmsgno(EX_BAD, _("The option '-H' was disabled in 2006.\n"));
927 errmsgno(EX_BAD, _("Use '-map' instead of '-H' as documented instead of using the legacy mode.\n"));
928 afpfile = (char *)arg;
929 return (1);
930 }
931#endif
932 return (BADFLAG); /* POSIX -H is not yet active */
933 }
935 Hflag = TRUE;
936#ifdef USE_FIND
937 *(int *)valp |= WALK_ARGFOLLOW;
938#endif
939 return (1);
940}
EXPORT int errmsgno(int err, char *msg, va_alist)
Definition: comerr.c:219
#define BADFLAG
Definition: getargs.h:58

◆ getL()

LOCAL int getL ( char arg,
void valp,
int pac,
char *const **  pav,
const char opt 
) const

Definition at line 944 of file mkisofs.c.

950{
951/*error("getL\n");*/
952 if (opt[0] == '-' && opt[1] == 'L' && opt[2] == '\0') {
953 if (legacy) {
954 errmsgno(EX_BAD, _("The option '-L' is deprecated since 2002.\n"));
955 errmsgno(EX_BAD, _("The option '-L' was disabled in 2006.\n"));
957 _("Use '-allow-leading-dots' instead of '-L' as documented instead of using the legacy mode.\n"));
959 return (1);
960 }
961 return (BADFLAG); /* POSIX -L is not yet active */
962 }
964 Hflag = FALSE;
965#ifdef USE_FIND
966 *(int *)valp |= WALK_ALLFOLLOW;
967#endif
968 return (1);
969}
int allow_leading_dots
Definition: mkisofs.c:251

◆ getP()

LOCAL int getP ( char arg,
void valp,
int pac,
char *const **  pav,
const char opt 
) const

Definition at line 973 of file mkisofs.c.

979{
980/*error("getP\n");*/
981 if (opt[0] == '-' && opt[1] == 'P' && opt[2] == '\0') {
982 if (legacy) {
983 errmsgno(EX_BAD, _("The option '-P' is deprecated since 2002.\n"));
984 errmsgno(EX_BAD, _("The option '-P' was disabled in 2006.\n"));
985 errmsgno(EX_BAD, _("Use '-publisher' instead of '-P' as documented instead of using the legacy mode.\n"));
986 publisher = (char *)arg;
987 return (1);
988 }
989 return (BADFLAG); /* POSIX -P is not yet active */
990 }
992 Hflag = FALSE;
993#ifdef USE_FIND
994 *(int *)valp &= ~(WALK_ARGFOLLOW | WALK_ALLFOLLOW);
995#endif
996 return (1);
997}
char * publisher
Definition: mkisofs.c:160

◆ hide_reloc_dir()

LOCAL void hide_reloc_dir ( )

Definition at line 1947 of file mkisofs.c.

1948{
1949 struct directory_entry *s_entry;
1950
1951 for (s_entry = reloc_dir->contents; s_entry; s_entry = s_entry->next) {
1952 if (strcmp(s_entry->name, ".") == 0 ||
1953 strcmp(s_entry->name, "..") == 0)
1954 continue;
1955
1956 if ((s_entry->de_flags & INHIBIT_ISO9660_ENTRY) == 0)
1957 return;
1958 }
1959
1960 /* all entries are hidden, so hide this directory */
1961 reloc_dir->dir_flags |= INHIBIT_ISO9660_ENTRY;
1962 reloc_dir->self->de_flags |= INHIBIT_ISO9660_ENTRY;
1963}
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
struct directory * reloc_dir
Definition: tree.c:111
#define INHIBIT_ISO9660_ENTRY
Definition: mkisofs.h:802
struct directory_entry * next
Definition: mkisofs.h:108
char * name
Definition: mkisofs.h:116
unsigned int de_flags
Definition: mkisofs.h:122

Referenced by main().

◆ iso9660_date()

EXPORT int iso9660_date ( char result,
time_t  crtime 
)

Definition at line 1868 of file mkisofs.c.

1871{
1872 struct tm local;
1873 struct tm gmt;
1874
1875 local = *localtime(&crtime);
1876 gmt = *gmtime(&crtime);
1877
1878 result[0] = local.tm_year;
1879 result[1] = local.tm_mon + 1;
1880 result[2] = local.tm_mday;
1881 result[3] = local.tm_hour;
1882 result[4] = local.tm_min;
1883 result[5] = local.tm_sec;
1884
1885 local.tm_min -= gmt.tm_min;
1886 local.tm_hour -= gmt.tm_hour;
1887 local.tm_yday -= gmt.tm_yday;
1888 local.tm_year -= gmt.tm_year;
1889 if (local.tm_year) /* Hit new-year limit */
1890 local.tm_yday = local.tm_year; /* yday = +-1 */
1891
1892 result[6] = (local.tm_min + 60 *
1893 (local.tm_hour + 24 * local.tm_yday)) / 15;
1894
1895 return (0);
1896}
#define local
Definition: zutil.h:30
GLuint64EXT * result
Definition: glext.h:11304
_CRTIMP struct tm *__cdecl gmtime(const time_t *_Time)
Definition: time.h:415
_CRTIMP struct tm *__cdecl localtime(const time_t *_Time)
Definition: time.h:416

Referenced by attach_dot_entries(), check_rr_dates(), dup_relocated_dir(), find_or_create_directory(), generate_reloc_directory(), generate_xa_rr_attributes(), insert_boot_cat(), insert_file_entry(), jroot_gen(), root_gen(), sort_n_finish(), and write_str_dir().

◆ iso9660_ldate()

EXPORT int iso9660_ldate ( char result,
time_t  crtime,
int  nsec,
int  gmtoff 
)

Definition at line 1907 of file mkisofs.c.

1912{
1913 struct tm local;
1914 struct tm gmt;
1915
1916 local = *localtime(&crtime);
1917 gmt = *gmtime(&crtime);
1918
1919 /*
1920 * There was a comment here about breaking in the year 2000.
1921 * That's not true, in 2000 tm_year == 100, so 1900+tm_year == 2000.
1922 */
1923 sprintf(result, "%4.4d%2.2d%2.2d%2.2d%2.2d%2.2d%2.2d",
1924 1900 + local.tm_year,
1925 local.tm_mon + 1, local.tm_mday,
1926 local.tm_hour, local.tm_min, local.tm_sec,
1927 nsec / 10000000);
1928
1929 if (gmtoff == -100) {
1930 local.tm_min -= gmt.tm_min;
1931 local.tm_hour -= gmt.tm_hour;
1932 local.tm_yday -= gmt.tm_yday;
1933 local.tm_year -= gmt.tm_year;
1934 if (local.tm_year) /* Hit new-year limit */
1935 local.tm_yday = local.tm_year; /* yday = +-1 */
1936
1937 result[16] = (local.tm_min + 60 *
1938 (local.tm_hour + 24 * local.tm_yday)) / 15;
1939 } else {
1940 result[16] = gmtoff;
1941 }
1942 return (0);
1943}
#define sprintf(buf, format,...)
Definition: sprintf.c:55

Referenced by generate_xa_rr_attributes(), and pvd_write().

◆ ldate_error()

LOCAL void ldate_error ( char arg)

Definition at line 691 of file mkisofs.c.

693{
694 comerrno(EX_BAD, _("Ilegal date specification '%s'.\n"), arg);
695}

Referenced by get_ldate(), and parse_date().

◆ list_locales()

LOCAL void list_locales ( )

Definition at line 3612 of file mkisofs.c.

3613{
3614 int n;
3615
3616 n = sic_list(stdout);
3617 if (n <= 0) {
3618 const char *ins_base = sic_base();
3619
3620 if (ins_base == NULL)
3621 ins_base = "$INS_BASE/lib/siconv/";
3622 errmsgno(EX_BAD, _("Installation problem: '%s' %s.\n"),
3623 ins_base, n < 0 ? _("missing"):_("incomplete"));
3624 if (n == 0) {
3626 _("Check '%s' for missing translation tables.\n"),
3627 ins_base);
3628 }
3629 }
3630#ifdef USE_ICONV
3631 if (n > 0) {
3633 _("'iconv -l' lists more available names.\n"));
3634 }
3635#endif
3636}
GLdouble n
Definition: glext.h:7729
#define stdout
Definition: stdio.h:99
EXPORT int sic_list(FILE *f)
Definition: sic_nls.c:233
LOCAL char * ins_base
Definition: sic_nls.c:73
EXPORT const char * sic_base()
Definition: sic_nls.c:186

Referenced by main().

◆ main()

EXPORT int main ( int argc  ,
argv   
)

Definition at line 2010 of file mkisofs.c.

2013{
2014 int cac = argc;
2015 char * const *cav = argv;
2016
2017 struct directory_entry de;
2018
2019#ifdef HAVE_SBRK
2020 unsigned long mem_start;
2021#endif
2022 struct stat statbuf;
2023 struct iso_directory_record *mrootp = NULL;
2024 struct output_fragment *opnt;
2025 struct ga_flags flags[OPTION_COUNT + 1];
2026 int c;
2027 int n;
2028 char *node = NULL;
2029 FILE *pfp = NULL;
2030 char pname[2*PATH_MAX + 1 + 1]; /* may be too short */
2031 char *arg; /* if '\\' present */
2032 char nodename[PATH_MAX + 1];
2033 int no_path_names = 1;
2034 int warn_violate = 0;
2035 int have_cmd_line_pathspec = 0;
2036 int rationalize_all = 0;
2037 int argind = 0;
2038#ifdef APPLE_HYB
2039 int hfs_ct = 0;
2040#endif /* APPLE_HYB */
2041
2042
2043#ifdef __EMX__
2044 /* This gives wildcard expansion with Non-Posix shells with EMX */
2045 _wildcard(&argc, &argv);
2046#endif
2048
2049#if defined(USE_NLS)
2050 setlocale(LC_ALL, "");
2051#if !defined(TEXT_DOMAIN) /* Should be defined by cc -D */
2052#define TEXT_DOMAIN "mkisofs" /* Use this only if it weren't */
2053#endif
2054 arg = searchfileinpath("share/locale", F_OK,
2056 if (arg)
2057 (void) bindtextdomain(TEXT_DOMAIN, arg);
2058 else
2059#ifdef PROTOTYPES
2060 (void) bindtextdomain(TEXT_DOMAIN, INS_BASE "/share/locale");
2061#else
2062 (void) bindtextdomain(TEXT_DOMAIN, "/usr/share/locale");
2063#endif
2064 (void) textdomain(TEXT_DOMAIN);
2065#endif
2066
2067
2068 if (argc < 2) {
2069 errmsgno(EX_BAD, _("Missing pathspec.\n"));
2070 susage(1);
2071 }
2072 /* Get the defaults from the .mkisofsrc file */
2073 read_rcfile(argv[0]);
2074
2075 {
2076 int i;
2077
2078 for (i = 0; i < (int)OPTION_COUNT; i++) {
2079 flags[i] = mki_options[i].opt;
2080 }
2081 flags[i].ga_format = NULL;
2082 gl_flags = flags;
2083 }
2084 time(&begun);
2089
2090 cac--;
2091 cav++;
2092 c = getvargs(&cac, &cav, GA_NO_PROPS, flags);
2093 if (c < 0) {
2094 if (c == BADFLAG && strchr(cav[0], '=')) {
2095 argind = argc - cac;
2096 goto args_ok;
2097 }
2098 error(_("Bad Option '%s' (error %d %s).\n"),
2099 cav[0], c, getargerror(c));
2100 susage(EX_BAD);
2101 }
2102args_ok:
2103 if (argind == 0)
2104 argind = argc - cac;
2105 path_ind = argind;
2106 if (cac > 0)
2107 have_cmd_line_pathspec = 1;
2108 if (help)
2109 usage(0);
2110 if (pversion) {
2111 printf(_("mkisofs %s (%s-%s-%s)\n\n\
2112Copyright (C) 1993-1997 %s\n\
2113Copyright (C) 1997-2017 %s\n"),
2116 _("Eric Youngdale"),
2117 _("Joerg Schilling"));
2118#ifdef APPLE_HYB
2119 printf(_("Copyright (C) 1997-2001 James Pearson\n"));
2120#endif
2121#ifdef UDF
2122 printf(_("Copyright (C) 2006 HELIOS Software GmbH\n"));
2123#endif
2124#ifdef OPTION_SILO_BOOT
2125 printf(_("Warning: this is unofficial (modified) version of mkisofs that incorporates\n"));
2126 printf(_(" support for a non Sparc compliant boot method called SILO.\n"));
2127 printf(_(" The official method to create Sparc boot CDs is to use -sparc-boot\n"));
2128 printf(_(" In case of problems first test with an official version of mkisofs.\n"));
2129#endif
2130 exit(0);
2131 }
2132#ifdef USE_FIND
2133 if (dofind) {
2134 finda_t fa;
2135
2136 cac = find_ac;
2137 cav = find_av;
2138 find_firstprim(&cac, &cav);
2139 find_pac = cac;
2140 find_pav = cav;
2141 argind = argc - find_ac;
2142
2143 if (cac > 0) {
2144 find_argsinit(&fa);
2145 fa.walkflags = walkflags;
2146 fa.Argc = cac;
2147 fa.Argv = (char **)cav;
2148 find_node = find_parse(&fa);
2149 if (fa.primtype == FIND_ERRARG)
2150 comexit(fa.error);
2151 if (fa.primtype != FIND_ENDARGS)
2152 comerrno(EX_BAD, _("Incomplete expression.\n"));
2153 plusp = fa.plusp;
2154 find_patlen = fa.patlen;
2155 walkflags = fa.walkflags;
2156 maxdepth = fa.maxdepth;
2157 mindepth = fa.mindepth;
2158
2159 if (find_node &&
2160 !(check_image || print_size) &&
2161 (outfile == NULL ||
2162 (outfile[0] == '-' && outfile[1] == '\0'))) {
2163 if (find_pname(find_node, "-exec") ||
2164 find_pname(find_node, "-exec+") ||
2165 find_pname(find_node, "-ok"))
2167 _("Cannot -exec with '-o -'.\n"));
2168 }
2169 }
2170
2171 if (find_ac <= 0 || find_ac == find_pac) {
2172 errmsgno(EX_BAD, _("Missing pathspec for -find.\n"));
2173 susage(EX_BAD);
2174 }
2175 }
2176#endif
2177#ifdef DVD_AUD_VID
2178
2179 dvd_aud_vid_flag = (dvd_audio ? DVD_SPEC_AUDIO : 0)
2180 | (dvd_hybrid ? DVD_SPEC_HYBRD : 0)
2181 | (dvd_video ? DVD_SPEC_VIDEO : 0);
2182
2183#endif
2184
2185 if (abstract) {
2186 if (strlen(abstract) > 37) {
2188 _("Abstract filename string too long (cur. %lld max. 37 chars).\n"),
2190 }
2191 }
2192 if (appid) {
2193 if (strlen(appid) > 128) {
2195 _("Application-id string too long (cur. %lld max. 128 chars).\n"),
2196 (Llong)strlen(appid));
2197 }
2198 }
2199 if (biblio) {
2200 if (strlen(biblio) > 37) {
2202 _("Bibliographic filename string too long (cur. %lld max. 37 chars).\n"),
2203 (Llong)strlen(biblio));
2204 }
2205 }
2206#ifdef DUPLICATES_ONCE
2207 /*
2208 * If -duplicates-once was specified, do not implicitly enable
2209 * -cache-inodes.
2210 */
2211 if (cache_inodes < 0 && duplicates_once)
2212 cache_inodes = 0;
2213#endif
2214#if defined(IS_CYGWIN)
2215 /*
2216 * If we have 64 bit inode numbers, Cygwin should be able to work
2217 * correctly on NTFS, otherwise disable caching unless it has
2218 * been enforced via -cache-inodes.
2219 */
2220 if (cache_inodes < 0 && sizeof (ino_t) < 8)
2221 cache_inodes = 0;
2222#endif
2223 if (cache_inodes < 0)
2224 cache_inodes = 1;
2225#ifdef DUPLICATES_ONCE
2226 if (!cache_inodes && !duplicates_once) {
2227#else
2228 if (!cache_inodes) {
2229#endif
2231 if (use_RockRidge) {
2233 _("Warning: Cannot write inode/link information with -no-cache-inodes.\n"));
2234 } else {
2236 _("Warning: Cannot add inode hints with -no-cache-inodes.\n"));
2237 }
2238 }
2239#if defined(__MINGW32__)
2240 if (cache_inodes) {
2241 cache_inodes = 0;
2244 _("Warning: cannot -cache-inodes on this platform - ignoring.\n"));
2245 }
2246#endif
2247 if (!correct_inodes)
2248 rrip112 = FALSE;
2249 if (check_image) {
2250 check_session++;
2253 outfile = DEV_NULL;
2254 /*
2255 * cdrecord_data is handled specially in multi.c
2256 * as we cannot write to all strings.
2257 * If mkisofs is called with -C xx,yy
2258 * our default is overwritten.
2259 */
2260/* cdrecord_data = "0,0";*/
2261 }
2262 if (copyright) {
2263 if (strlen(copyright) > 37) {
2265 _("Copyright filename string too long (cur. %lld max. 37 chars).\n"),
2267 }
2268 }
2269 if (genboot_image)
2270 use_genboot++;
2271 if (boot_catalog)
2272 use_eltorito++;
2273 else
2275 if (omit_period && iso9660_level < 4)
2276 warn_violate++;
2277 if (data_change_warn)
2278 errconfig("WARN|GROW|SHRINK *");
2279 if (dirmode_str) {
2280 char *end = 0;
2281
2282 rationalize++;
2283 use_RockRidge++;
2285
2286 /*
2287 * If -new-dir-mode was specified, new_dir_mode is set
2288 * up later with a value that matches the -new-dir-mode arg.
2289 */
2291 if (!end || *end != 0 ||
2292 dirmode_to_use < 0 || dirmode_to_use > 07777) {
2293 comerrno(EX_BAD, _("Bad mode for -dir-mode\n"));
2294 }
2295 }
2297 RR_relocation_depth = 0xFFFFFFFF;
2298 if (filemode_str) {
2299 char *end = 0;
2300
2301 rationalize++;
2302 use_RockRidge++;
2304
2306 if (!end || *end != 0 ||
2307 filemode_to_use < 0 || filemode_to_use > 07777) {
2308 comerrno(EX_BAD, _("Bad mode for -file-mode\n"));
2309 }
2310 }
2311#ifdef __warn_follow__
2312 if (follow_links) {
2314 _("Warning: -follow-links does not always work correctly; be careful.\n"));
2315 }
2316#endif
2317 if (gid_str) {
2318 char *end = 0;
2319
2320 rationalize++;
2321 use_RockRidge++;
2323
2324 gid_to_use = strtol(gid_str, &end, 0);
2325 if (!end || *end != 0) {
2326 comerrno(EX_BAD, _("Bad value for -gid\n"));
2327 }
2328 }
2329 switch (iso9660_level) {
2330
2331 case 1:
2332 /*
2333 * Only on file section
2334 * 8.3 d or d1 characters for files
2335 * 8 d or d1 characters for directories
2336 */
2337 break;
2338 case 2:
2339 /*
2340 * Only on file section
2341 */
2342 break;
2343 case 3:
2344 /*
2345 * No restrictions
2346 */
2347 do_largefiles++;
2348 break;
2349 case 4:
2350 /*
2351 * This is ISO-9660:1988 (ISO-9660 version 2)
2352 */
2353 do_largefiles++;
2354 iso9660_namelen = MAX_ISONAME_V2; /* allow 207 chars */
2355 full_iso9660_filenames++; /* 31+ chars */
2357 RR_relocation_depth = 0xFFFFFFFF;
2358
2359 /*
2360 * From -U ...
2361 */
2362 omit_period++; /* trailing dot */
2364 relaxed_filenames++; /* all chars */
2365 allow_lowercase++; /* even lowcase */
2366 allow_multidot++; /* > 1 dots */
2367 break;
2368
2369 default:
2370 comerrno(EX_BAD, _("Illegal iso9660 Level %d, use 1..3 or 4.\n"),
2372 }
2373
2374 if (joliet_long) {
2375 use_Joliet++;
2376 jlen = JLONGMAX;
2377 }
2378 if (jcharset) {
2379 use_Joliet++;
2381 }
2382 if (max_filenames && iso9660_level < 4) {
2383 iso9660_namelen = MAX_ISONAME_V1; /* allow 37 chars */
2386 warn_violate++;
2387 }
2389 warn_violate++;
2391 warn_violate++;
2392 if (new_dirmode_str) {
2393 char *end = 0;
2394
2395 rationalize++;
2396
2398 if (!end || *end != 0 ||
2399 new_dir_mode < 0 || new_dir_mode > 07777) {
2400 comerrno(EX_BAD, _("Bad mode for -new-dir-mode\n"));
2401 }
2402 }
2403 if (sectype) {
2404 if (strcmp(sectype, "data") == 0)
2405 osecsize = 2048;
2406 else if (strcmp(sectype, "xa1") == 0)
2407 osecsize = 2056;
2408 else if (strcmp(sectype, "raw") == 0) {
2409 osecsize = 2352;
2411 _("Unsupported sector type '%s'.\n"),
2412 sectype);
2413 }
2414 }
2415 if (preparer) {
2416 if (strlen(preparer) > 128) {
2417 comerrno(EX_BAD, _("Preparer string too long (cur. %lld max. 128 chars).\n"),
2419 }
2420 }
2421 if (publisher) {
2422 if (strlen(publisher) > 128) {
2424 _("Publisher string too long (cur. %lld max. 128 chars).\n"),
2426 }
2427 }
2428 if (rationalize_rr) {
2429 rationalize_all++;
2430 use_RockRidge++;
2431 }
2432 if (stream_filename) {
2435 _("stream-file-name too long (%llu), max is %d.\n"),
2437 if (strchr(stream_filename, '/'))
2438 comerrno(EX_BAD, _("Illegal character '/' in stream-file-name.\n"));
2439 iso9660_level = 4;
2440 } else {
2441 stream_filename = omit_version_number ? "STREAM.IMG" : "STREAM.IMG;1";
2442 }
2443 if (system_id) {
2444 if (strlen(system_id) > 32) {
2446 _("System ID string too long\n"));
2447 }
2448 }
2449 if (trans_tbl)
2451 else
2452 trans_tbl = "TRANS.TBL";
2453 if (ucs_level < 1 || ucs_level > 3)
2454 comerrno(EX_BAD, _("Illegal UCS Level %d, use 1..3.\n"),
2455 ucs_level);
2456#ifdef DVD_AUD_VID
2457 if (dvd_aud_vid_flag) {
2458 if (!use_udf)
2459 rationalize_udf++;
2460 }
2461#endif
2462#ifdef UDF
2463 if (rationalize_udf) {
2464 rationalize_all++;
2465 use_udf++;
2466 }
2467#endif
2468 if (uid_str) {
2469 char *end = 0;
2470
2471 rationalize++;
2472 use_RockRidge++;
2474
2475 uid_to_use = strtol(uid_str, &end, 0);
2476 if (!end || *end != 0) {
2477 comerrno(EX_BAD, _("Bad value for -uid\n"));
2478 }
2479 }
2481 /*
2482 * Minimal (only truncation of 31+ characters)
2483 * translation of filenames.
2484 *
2485 * Forces -l, -d, -N, -allow-leading-dots,
2486 * -relaxed-filenames,
2487 * -allow-lowercase, -allow-multidot
2488 *
2489 * This is for HP-UX, which does not recognize ANY
2490 * extentions (Rock Ridge, Joliet), causing pain when
2491 * loading software. pfs_mount can be used to read the
2492 * extensions, but the untranslated filenames can be
2493 * read by the "native" cdfs mounter. Completely
2494 * violates iso9660.
2495 */
2496 full_iso9660_filenames++; /* 31 chars */
2497 omit_period++; /* trailing dot */
2500 relaxed_filenames++; /* all chars */
2501 allow_lowercase++; /* even lowcase */
2502 allow_multidot++; /* > 1 dots */
2503 warn_violate++;
2504 }
2506 allow_lowercase = 0;
2508 warn_violate++;
2509 if (iso_translate == 0 && iso9660_level < 4)
2510 warn_violate++;
2511 if (allow_lowercase && iso9660_level < 4)
2512 warn_violate++;
2513 if (allow_multidot && iso9660_level < 4)
2514 warn_violate++;
2515 if (volume_id) {
2516 if (strlen(volume_id) > 32) {
2518 _("Volume ID string too long (cur. %lld max. 32 chars).\n"),
2520 }
2521 }
2522 if (volset_id) {
2523 if (strlen(volset_id) > 128) {
2525 _("Volume set ID string too long (cur. %lld max. 128 chars).\n"),
2527 }
2528 }
2529 if (volume_set_size) {
2530 if (volume_set_size <= 0) {
2532 _("Illegal Volume Set Size %d\n"), volume_set_size);
2533 }
2534 if (volume_set_size > 1) {
2536 _("Volume Set Size > 1 not yet supported\n"));
2537 }
2538 }
2542 _("Volume set sequence number too big\n"));
2543 }
2544 }
2545 if (rationalize_xa) {
2546 rationalize_all++;
2547 use_XA++;
2548 }
2550#ifdef VMS
2552 _("Transparent compression not supported with VMS\n"));
2553#endif
2554 }
2555#ifdef APPLE_HYB
2556 if (deftype) {
2557 hfs_ct++;
2558 if (strlen(deftype) != 4) {
2560 _("HFS default TYPE string has illegal length.\n"));
2561 }
2562 } else {
2563 deftype = APPLE_TYPE_DEFAULT;
2564 }
2565 if (defcreator) {
2566 hfs_ct++;
2567 if (strlen(defcreator) != 4) {
2569 _("HFS default CREATOR string has illegal length.\n"));
2570 }
2571 } else {
2572 defcreator = APPLE_CREATOR_DEFAULT;
2573 }
2574 if (afpfile && *afpfile != '\0')
2575 hfs_last = MAP_LAST;
2576 if (magic_file)
2577 hfs_last = MAG_LAST;
2578 if (nomacfiles) {
2580 _("Warning: -no-mac-files no longer used ... ignoring\n"));
2581 }
2582 if (hfs_boot_file)
2583 gen_pt = 1;
2584 if (root_info)
2585 icon_pos = 1;
2586 if (hfs_icharset)
2587 use_mac_name = 1;
2588 if (hfs_parms)
2589 hfs_parms = e_strdup(hfs_parms);
2590
2591 if (apple_hyb && apple_ext) {
2592 comerrno(EX_BAD, _("Can't have both -apple and -hfs options\n"));
2593 }
2594 /*
2595 * if -probe, -macname, any hfs selection and/or mapping file is given,
2596 * but no HFS option, then select apple_hyb
2597 */
2598 if (!apple_hyb && !apple_ext) {
2599 if (*afpfile || probe || use_mac_name || hfs_select ||
2600 hfs_boot_file || magic_file ||
2601 hfs_ishidden() || gen_pt || autoname ||
2602 afe_size || icon_pos || hfs_ct ||
2603 hfs_icharset || hfs_ocharset) {
2604 apple_hyb = 1;
2605#ifdef UDF
2606 if ((DO_XHFS & hfs_select) && use_udf) {
2608 if (!no_apple_hyb) {
2609 error(
2610 _("Warning: no HFS hybrid will be created with -udf and --osx-hfs\n"));
2611 }
2612 }
2613#endif
2614 }
2615 }
2616#ifdef UDF
2617 if (!use_udf && create_udfsymlinks)
2619#if 0
2620 if (use_RockRidge && use_udf && create_udfsymlinks) {
2621 error(_("Warning: cannot create UDF symlinks with activated Rock Ridge\n"));
2623 }
2624#endif
2625#endif
2626 if (no_apple_hyb) {
2628 }
2630 do_largefiles = 0;
2631 maxnonlarge = (off_t)0x7FFFFFFF;
2632 error(_("Warning: cannot support large files with -hfs\n"));
2633 }
2634#ifdef UDF
2635 if (apple_hyb && use_udf && !donotwrite_macpart) {
2636 comerrno(EX_BAD, _("Can't have -hfs with -udf\n"));
2637 }
2638#endif
2639 if (apple_ext && hfs_boot_file) {
2640 comerrno(EX_BAD, _("Can't have -hfs-boot-file with -apple\n"));
2641 }
2642 if (apple_ext && autoname) {
2643 comerrno(EX_BAD, _("Can't have -auto with -apple\n"));
2644 }
2646 comerrno(EX_BAD, _("Can't have -hfs with -sparc-boot/-sunx86-boot\n"));
2647 }
2648 if (apple_hyb && use_genboot) {
2649 comerrno(EX_BAD, _("Can't have -hfs with -generic-boot\n"));
2650 }
2651#ifdef PREP_BOOT
2652 if (apple_ext && use_prep_boot) {
2653 comerrno(EX_BAD, _("Can't have -prep-boot with -apple\n"));
2654 }
2655#endif /* PREP_BOOT */
2656
2657 if (apple_hyb || apple_ext)
2658 apple_both = 1;
2659
2660 if (probe)
2661 /* we need to search for all types of Apple/Unix files */
2662 hfs_select = ~0;
2663
2664 if (apple_both && verbose && !(hfs_select || *afpfile || magic_file)) {
2666 _("Warning: no Apple/Unix files will be decoded/mapped\n"));
2667 }
2668 if (apple_both && verbose && !afe_size &&
2669 (hfs_select & (DO_FEU | DO_FEL))) {
2671 _("Warning: assuming PC Exchange cluster size of 512 bytes\n"));
2672 afe_size = 512;
2673 }
2674 if (apple_both) {
2675 /* set up the TYPE/CREATOR mappings */
2676 hfs_init(afpfile, 0, hfs_select);
2677 }
2678 if (apple_ext && !use_RockRidge) {
2679#ifdef nonono
2680 /* use RockRidge to set the SystemUse field ... */
2681 use_RockRidge++;
2682 rationalize_all++;
2683#else
2684 /* EMPTY */
2685#endif
2686 }
2687 if (apple_ext && !(use_XA || use_RockRidge)) {
2688 comerrno(EX_BAD, _("Need either -XA/-xa or -R/-r for -apple to become active.\n"));
2689 }
2690#endif /* APPLE_HYB */
2691
2692 /*
2693 * if the -hide-joliet option has been given, set the Joliet option
2694 */
2695 if (!use_Joliet && j_ishidden())
2696 use_Joliet++;
2697#ifdef UDF
2698 /*
2699 * if the -hide-udf option has been given, set the UDF option
2700 */
2701 if (!use_udf && u_ishidden())
2702 use_udf++;
2703#endif
2704
2705 if (rationalize_all) {
2706 rationalize++;
2711 }
2712
2713 /*
2714 * XXX This is a hack until we have a decent separate name handling
2715 * XXX for UDF filenames.
2716 */
2717#ifdef DVD_AUD_VID
2719 use_Joliet = 0;
2720 error(_("Warning: Disabling Joliet support for DVD-Video/DVD-Audio.\n"));
2721 }
2722#endif
2723#ifdef UDF
2724 if (use_udf && !use_Joliet)
2725 jlen = 255;
2726#endif
2727
2730
2731 if (warn_violate)
2732 error(_("Warning: creating filesystem that does not conform to ISO-9660.\n"));
2733 if (iso9660_level > 3)
2734 error(_("Warning: Creating ISO-9660:1999 (version 2) filesystem.\n"));
2736 error(_("Warning: ISO-9660 filenames longer than %d may cause buffer overflows in the OS.\n"),
2737 LEN_ISONAME);
2738 if (use_Joliet && !use_RockRidge) {
2739 error(_("Warning: creating filesystem with (nonstandard) Joliet extensions\n"));
2740 error(_(" but without (standard) Rock Ridge extensions.\n"));
2741 error(_(" It is highly recommended to add Rock Ridge\n"));
2742 }
2744 error(_("Warning: using transparent compression. This is a nonstandard Rock Ridge\n"));
2745 error(_(" extension. The resulting filesystem can only be transparently\n"));
2746 error(_(" read on Linux. On other operating systems you need to call\n"));
2747 error(_(" mkzftree by hand to decompress the files.\n"));
2748 }
2750 error(_("Warning: transparent decompression is a Linux Rock Ridge extension, but\n"));
2751 error(_(" creating filesystem without Rock Ridge attributes; files\n"));
2752 error(_(" will not be transparently decompressed.\n"));
2753 }
2754
2755#if defined(USE_NLS) && defined(HAVE_NL_LANGINFO) && defined(CODESET)
2756 /*
2757 * If the locale has not been set up, nl_langinfo() returns the
2758 * name of the default codeset. This should be either "646",
2759 * "ISO-646", "ASCII", or something similar. Unfortunately, the
2760 * POSIX standard does not include a list of valid locale names,
2761 * so ne need to find all values in use.
2762 *
2763 * Observed:
2764 * Solaris "646"
2765 * Linux "ANSI_X3.4-1968" strange value from Linux...
2766 */
2767 if (icharset == NULL) {
2768 char *codeset = nl_langinfo(CODESET);
2769 Uchar *p;
2770
2771 if (codeset != NULL)
2772 codeset = e_strdup(codeset);
2773 if (codeset == NULL) /* Should not happen */
2774 goto setcharset;
2775 if (*codeset == '\0') /* Invalid locale */
2776 goto setcharset;
2777
2778 for (p = (Uchar *)codeset; *p != '\0'; p++) {
2779 if (islower(*p))
2780 *p = toupper(*p);
2781 }
2782 p = (Uchar *)strstr(codeset, "ISO");
2783 if (p != NULL) {
2784 if (*p == '_' || *p == '-')
2785 p++;
2786 codeset = (char *)p;
2787 }
2788 if (strcmp("646", codeset) != 0 &&
2789 strcmp("ASCII", codeset) != 0 &&
2790 strcmp("US-ASCII", codeset) != 0 &&
2791 strcmp("US_ASCII", codeset) != 0 &&
2792 strcmp("USASCII", codeset) != 0 &&
2793 strcmp("ANSI_X3.4-1968", codeset) != 0)
2794 icharset = nl_langinfo(CODESET);
2795
2796 if (codeset != NULL)
2797 free(codeset);
2798
2799 if (verbose > 0 && icharset != NULL) {
2800 error(_("Setting input-charset to '%s' from locale.\n"),
2801 icharset);
2802 }
2803 }
2804setcharset:
2805 /*
2806 * Allow to switch off locale with -input-charset "".
2807 */
2808 if (icharset != NULL && *icharset == '\0')
2809 icharset = NULL;
2810#endif
2811 if (icharset == NULL) {
2812#if (defined(__CYGWIN32__) || defined(__CYGWIN__) || defined(__DJGPP__)) && !defined(IS_CYGWIN_1)
2813 icharset = "cp437";
2814#else
2815 icharset = "default";
2816#endif
2817 }
2819
2820 /*
2821 * set the output charset to the same as the input or the given output
2822 * charset
2823 */
2824 if (ocharset == NULL) {
2826 }
2828
2829 if (in_nls == NULL || out_nls == NULL) { /* Unknown charset specified */
2830 fprintf(stderr, _("Unknown charset '%s'.\nKnown charsets are:\n"),
2831 in_nls == NULL ? icharset : (ocharset ? ocharset : "NULL"));
2832 list_locales();
2833 exit(EX_BAD);
2834 }
2835#ifdef USE_ICONV
2836 /*
2837 * XXX If we ever allow this, we neeed to fix the call to conv_charset()
2838 * XXX in name.c::iso9660_file_length().
2839 */
2840 if ((in_nls->sic_cd2uni != NULL || out_nls->sic_cd2uni != NULL) &&
2843 _("Iconv based locales may change file name length.\n"));
2845 _("Cannot yet have different -input-charset/-output-charset.\n"));
2846 }
2847#endif
2848
2849#ifdef APPLE_HYB
2850 if (hfs_icharset == NULL || strcmp(hfs_icharset, "mac-roman") == 0) {
2851 hfs_icharset = "cp10000";
2852 }
2853 hfs_inls = sic_open(hfs_icharset);
2854
2855 if (hfs_ocharset == NULL) {
2856 hfs_ocharset = hfs_inls ? hfs_inls->sic_name : NULL;
2857 }
2858 if (hfs_ocharset == NULL || strcmp(hfs_ocharset, "mac-roman") == 0) {
2859 hfs_ocharset = "cp10000";
2860 }
2861 hfs_onls = sic_open(hfs_ocharset);
2862
2863 if (use_mac_name)
2864 apple_hyb = 1;
2865 if (apple_hyb && (hfs_inls == NULL || hfs_onls == NULL)) {
2866 fprintf(stderr, _("Unknown HFS charset '%s'.\nKnown charsets are:\n"),
2867 hfs_inls == NULL ? hfs_icharset : (hfs_ocharset ? hfs_ocharset : "NULL"));
2868 list_locales();
2869 exit(EX_BAD);
2870 }
2871#ifdef USE_ICONV
2872 if (apple_hyb &&
2876 _("Iconv based locales may change file name length.\n"));
2878 _("Cannot yet have different -input-hfs-charset/-output-hfs-charset.\n"));
2879 }
2880#endif
2881#endif /* APPLE_HYB */
2882
2883 if (merge_image != NULL) {
2884 if (open_merge_image(merge_image) < 0) {
2885 /* Complain and die. */
2886 comerr(_("Unable to open previous session image '%s'.\n"),
2887 merge_image);
2888 }
2889 }
2890 /* We don't need root privilleges anymore. */
2891#ifdef HAVE_SETREUID
2892 if (setreuid(-1, getuid()) < 0)
2893#else
2894#ifdef HAVE_SETEUID
2895 if (seteuid(getuid()) < 0)
2896#else
2897 if (setuid(getuid()) < 0)
2898#endif
2899#endif
2900 comerr(_("Panic cannot set back effective uid.\n"));
2901
2902
2903#ifdef no_more_needed
2904#ifdef __NetBSD__
2905 {
2906 int resource;
2907 struct rlimit rlp;
2908
2909 if (getrlimit(RLIMIT_DATA, &rlp) == -1)
2910 errmsg(_("Warning: Cannot get rlimit.\n"));
2911 else {
2912 rlp.rlim_cur = 33554432;
2913 if (setrlimit(RLIMIT_DATA, &rlp) == -1)
2914 errmsg(_("Warning: Cannot set rlimit.\n"));
2915 }
2916 }
2917#endif
2918#endif /* no_more_needed */
2919#ifdef HAVE_SBRK
2920 mem_start = (unsigned long) sbrk(0);
2921#endif
2922
2923 if (verbose > 1) {
2924 fprintf(stderr, "%s (%s-%s-%s)\n",
2927 }
2928 if (cdrecord_data == NULL && !check_session && merge_image != NULL) {
2930 _("Multisession usage bug: Must specify -C if -M is used.\n"));
2931 }
2932 if (cdrecord_data != NULL && merge_image == NULL) {
2934 _("Warning: -C specified without -M: old session data will not be merged.\n"));
2935 }
2936#ifdef APPLE_HYB
2937 if (merge_image != NULL && apple_hyb) {
2939 _("Warning: files from previous sessions will not be included in the HFS volume.\n"));
2940 }
2941#endif /* APPLE_HYB */
2942
2943 /*
2944 * see if we have a list of pathnames to process
2945 */
2946 if (pathnames) {
2947 /* "-" means take list from the standard input */
2948 if (strcmp(pathnames, "-") != 0) {
2949 if ((pfp = fopen(pathnames, "r")) == NULL) {
2950 comerr(_("Unable to open pathname list %s.\n"),
2951 pathnames);
2952 }
2953 } else
2954 pfp = stdin;
2955 }
2956
2957 /* The first step is to scan the directory tree, and take some notes */
2958
2959 if ((arg = get_pnames(argc, argv, argind, pname,
2960 sizeof (pname), pfp)) == NULL) {
2961 if (check_session == 0 && !stream_media_size) {
2962 errmsgno(EX_BAD, _("Missing pathspec.\n"));
2963 susage(1);
2964 }
2965 }
2966
2967 /*
2968 * if we don't have a pathspec, then save the pathspec found
2969 * in the pathnames file (stored in pname) - we don't want
2970 * to skip this pathspec when we read the pathnames file again
2971 */
2972 if (!have_cmd_line_pathspec && !stream_media_size) {
2973 save_pname = 1;
2974 }
2975 if (stream_media_size) {
2976#ifdef UDF
2977 if (use_XA || use_RockRidge || use_udf || use_Joliet)
2978#else
2980#endif
2982 _("Cannot use XA, Rock Ridge, UDF or Joliet with -stream-media-size\n"));
2983 if (merge_image)
2985 _("Cannot use multi session with -stream-media-size\n"));
2987#ifdef APPLE_HYB
2988 use_genboot || use_prep_boot || hfs_boot_file)
2989#else
2991#endif
2993 _("Cannot use boot options with -stream-media-size\n"));
2994#ifdef APPLE_HYB
2995 if (apple_hyb)
2997 _("Cannot use Apple hybrid options with -stream-media-size\n"));
2998#endif
2999 }
3000
3001 if (use_RockRidge) {
3002 /* BEGIN CSTYLED */
3003#if 1
3005 "THE ROCK RIDGE INTERCHANGE PROTOCOL PROVIDES SUPPORT FOR POSIX FILE SYSTEM SEMANTICS",
3006 "PLEASE CONTACT DISC PUBLISHER FOR SPECIFICATION SOURCE. SEE PUBLISHER IDENTIFIER IN PRIMARY VOLUME DESCRIPTOR FOR CONTACT INFORMATION.",
3008#else
3010 "THE IEEE P1282 PROTOCOL PROVIDES SUPPORT FOR POSIX FILE SYSTEM SEMANTICS",
3011 "PLEASE CONTACT THE IEEE STANDARDS DEPARTMENT, PISCATAWAY, NJ, USA FOR THE P1282 SPECIFICATION.",
3013#endif
3014 /* END CSTYLED */
3015 }
3017 if (log_file) {
3018 FILE *lfp;
3019 int i;
3020
3021 /* open log file - test that we can open OK */
3022 if ((lfp = fopen(log_file, "w")) == NULL) {
3023 comerr(_("Can't open logfile: '%s'.\n"), log_file);
3024 }
3025 fclose(lfp);
3026
3027 /* redirect all stderr message to log_file */
3028 fprintf(stderr, _("re-directing all messages to %s\n"), log_file);
3029 fflush(stderr);
3030
3031 /* associate stderr with the log file */
3032 if (freopen(log_file, "w", stderr) == NULL) {
3033 comerr(_("Can't open logfile: '%s'.\n"), log_file);
3034 }
3035 if (verbose > 1) {
3036 for (i = 0; i < argc; i++)
3037 fprintf(stderr, "%s ", argv[i]);
3038
3039 fprintf(stderr, "\n%s (%s-%s-%s)\n",
3042 }
3043 }
3044 /* Find name of root directory. */
3045 if (arg != NULL)
3046 node = findgequal(arg);
3047 if (!use_graft_ptrs)
3048 node = NULL;
3049 if (node == NULL) {
3050 if (use_graft_ptrs && arg != NULL)
3051 node = escstrcpy(nodename, sizeof (nodename), arg);
3052 else
3053 node = arg;
3054 } else {
3055 /*
3056 * Remove '\\' escape chars which are located
3057 * before '\\' and '=' chars
3058 */
3059 node = escstrcpy(nodename, sizeof (nodename), ++node);
3060 }
3061
3062 /*
3063 * See if boot catalog file exists in root directory, if not we will
3064 * create it.
3065 */
3066 if (use_eltorito)
3068
3069 /*
3070 * Find the device and inode number of the root directory. Record this
3071 * in the hash table so we don't scan it more than once.
3072 */
3073 stat_filter(node, &statbuf);
3074 add_directory_hash(statbuf.st_dev, STAT_INODE(statbuf));
3075
3076 memset(&de, 0, sizeof (de));
3077
3078 /*
3079 * PO:
3080 * Isn't root NULL at this time anyway?
3081 * I think it is created by the first call to
3082 * find_or_create_directory() below.
3083 */
3084 de.filedir = root; /* We need this to bootstrap */
3085
3086 if (cdrecord_data != NULL && merge_image == NULL) {
3087 /*
3088 * in case we want to add a new session, but don't want to
3089 * merge old one
3090 */
3092 }
3093 if (merge_image != NULL) {
3094 char sector[SECTOR_SIZE];
3095 UInt32_t extent;
3096
3097 errno = 0;
3098 mrootp = merge_isofs(merge_image);
3099 if (mrootp == NULL) {
3100 /* Complain and die. */
3101 if (errno == 0)
3102 errno = -1;
3103 comerr(_("Unable to find previous session PVD '%s'.\n"),
3104 merge_image);
3105 }
3106 memcpy(de.isorec.extent, mrootp->extent, 8);
3107
3108 /*
3109 * Look for RR Attributes in '.' entry of root dir.
3110 * This is the first ISO directory entry in the root dir.
3111 */
3112 extent = get_733(mrootp->extent);
3113 readsecs(extent, sector, 1);
3115 if (c & RR_FLAG_XA)
3116 fprintf(stderr, _("XA signatures found\n"));
3117 if (c & RR_FLAG_AA)
3118 fprintf(stderr, _("AA signatures found\n"));
3119 if (c & ~(RR_FLAG_XA|RR_FLAG_AA)) {
3120 extern int su_version;
3121 extern int rr_version;
3122 extern char er_id[];
3123
3124 if (c & RR_FLAG_SP) {
3125 fprintf(stderr, _("SUSP signatures version %d found\n"), su_version);
3126 if (c & RR_FLAG_ER) {
3127 if (rr_version < 1) {
3129 _("No valid Rock Ridge signature found\n"));
3130 if (!force_rr)
3131 no_rr++;
3132 } else {
3134 _("Rock Ridge signatures version %d found\n"),
3135 rr_version);
3137 _("Rock Ridge id '%s'\n"), er_id);
3138 }
3139 }
3140 } else {
3141 fprintf(stderr, _("Bad Rock Ridge signatures found (SU record missing)\n"));
3142 if (!force_rr)
3143 no_rr++;
3144 }
3145 } else {
3146 fprintf(stderr, _("No SUSP/Rock Ridge present\n"));
3147 if ((c & (RR_FLAG_XA|RR_FLAG_AA)) == 0) {
3148 if (!force_rr)
3149 no_rr++;
3150 }
3151 }
3152 if (no_rr)
3153 fprintf(stderr, _("Disabling Rock Ridge / XA / AA\n"));
3154 }
3155 /*
3156 * Create an empty root directory. If we ever scan it for real,
3157 * we will fill in the contents.
3158 */
3160
3161#ifdef APPLE_HYB
3162 /* may need to set window layout of the volume */
3163 if (root_info)
3164 set_root_info(root_info);
3165#endif /* APPLE_HYB */
3166
3167 /*
3168 * Scan the actual directory (and any we find below it) for files to
3169 * write out to the output image. Note - we take multiple source
3170 * directories and keep merging them onto the image.
3171 */
3172 if (check_session)
3173 goto path_done;
3174
3175#ifdef USE_FIND
3176 if (dofind) {
3177extern int walkfunc __PR((char *nm, struct stat *fs, int type, struct WALK *state));
3178
3179 walkinitstate(&walkstate);
3180 if (find_patlen > 0) {
3181 walkstate.patstate = ___malloc(sizeof (int) * find_patlen,
3182 _("space for pattern state"));
3183 }
3184
3185 find_timeinit(time(0));
3186 walkstate.walkflags = walkflags;
3187 walkstate.maxdepth = maxdepth;
3188 walkstate.mindepth = mindepth;
3189 walkstate.lname = NULL;
3190 walkstate.tree = find_node;
3191 walkstate.err = 0;
3192 walkstate.pflags = 0;
3193
3194 nodesc = TRUE;
3195 for (;
3196 (arg = get_pnames(argc, argv, argind, pname, sizeof (pname),
3197 pfp)) != NULL;
3198 argind++) {
3199 /*
3200 * Make silly GCC happy and double initialize graft_dir.
3201 */
3202 struct directory *graft_dir = NULL;
3203 char graft_point[PATH_MAX + 1];
3204 struct wargs wa;
3205 char *snp;
3206
3207 graft_point[0] = '\0';
3208 snp = NULL;
3209 if (use_graft_ptrs)
3210 graft_dir = get_graft(arg,
3211 graft_point, sizeof (graft_point),
3212 nodename, sizeof (nodename),
3213 &snp, FALSE);
3214 if (graft_point[0] != '\0') {
3215 arg = nodename;
3216 wa.dir = graft_dir;
3217 } else {
3218 wa.dir = root;
3219 }
3220 wa.name = snp;
3221 walkstate.auxp = &wa;
3222 walkstate.auxi = strlen(arg);
3223 treewalk(arg, walkfunc, &walkstate);
3224 no_path_names = 0;
3225 }
3226 find_plusflush(plusp, &walkstate);
3227 } else
3228#endif
3229
3230 while ((arg = get_pnames(argc, argv, argind, pname,
3231 sizeof (pname), pfp)) != NULL) {
3232 char graft_point[PATH_MAX + 1];
3233
3234 get_graft(arg, graft_point, sizeof (graft_point),
3235 nodename, sizeof (nodename), NULL, TRUE);
3236 argind++;
3237 no_path_names = 0;
3238 }
3239
3240path_done:
3241 if (pfp && pfp != stdin)
3242 fclose(pfp);
3243
3244 /*
3245 * exit if we don't have any pathnames to process
3246 * - not going to happen at the moment as we have to have at least one
3247 * path on the command line
3248 */
3249 if (no_path_names && !check_session && !stream_media_size) {
3250 errmsgno(EX_BAD, _("No pathnames found.\n"));
3251 susage(1);
3252 }
3253 /*
3254 * Now merge in any previous sessions. This is driven on the source
3255 * side, since we may need to create some additional directories.
3256 */
3257 if (merge_image != NULL) {
3258 if (merge_previous_session(root, mrootp,
3259 reloc_root, reloc_old_root) < 0) {
3260 comerrno(EX_BAD, _("Cannot merge previous session.\n"));
3261 }
3263
3264 /*
3265 * set up parent_dir and filedir in relocated entries which
3266 * were read from previous session so that
3267 * finish_cl_pl_entries can do its job
3268 */
3270 free(mrootp);
3271 }
3272#ifdef APPLE_HYB
3273 /* free up any HFS filename mapping memory */
3274 if (apple_both)
3275 clean_hfs();
3276#endif /* APPLE_HYB */
3277
3278 /* hide "./rr_moved" if all its contents have been hidden */
3279 if (reloc_dir && i_ishidden())
3281
3282 /* insert the boot catalog if required */
3283 if (use_eltorito)
3285
3286 /*
3287 * Free up any matching memory
3288 */
3289 for (n = 0; n < MAX_MAT; n++)
3291
3292#ifdef SORTING
3293 del_sort();
3294#endif /* SORTING */
3295
3296 /*
3297 * Sort the directories in the required order (by ISO9660). Also,
3298 * choose the names for the 8.3 filesystem if required, and do any
3299 * other post-scan work.
3300 */
3301 goof += sort_tree(root);
3302
3303 if (goof) {
3304 comerrno(EX_BAD, _("ISO9660/Rock Ridge tree sort failed.\n"));
3305 }
3306#ifdef UDF
3307 if (use_Joliet || use_udf) {
3308#else
3309 if (use_Joliet) {
3310#endif
3312 }
3313 if (goof) {
3314 comerrno(EX_BAD, _("Joliet tree sort failed.\n"));
3315 }
3316 /*
3317 * Fix a couple of things in the root directory so that everything is
3318 * self consistent. Fix this up so that the path tables get done right.
3319 */
3320 root->self = root->contents;
3321
3322 /* OK, ready to write the file. Open it up, and generate the thing. */
3323 if (print_size) {
3324 discimage = fopen(DEV_NULL, "wb");
3325 if (!discimage) {
3326 comerr(_("Unable to open /dev/null\n"));
3327 }
3328 } else if (outfile != NULL &&
3329 !(outfile[0] == '-' && outfile[1] == '\0')) {
3330 discimage = fopen(outfile, "wb");
3331 if (!discimage) {
3332 comerr(_("Unable to open disc image file '%s'.\n"), outfile);
3333 }
3334 } else {
3335 discimage = stdout;
3337 }
3338#ifdef HAVE_SETVBUF
3339 setvbuf(discimage, NULL, _IOFBF, 64*1024);
3340#endif
3341
3342 /* Now assign addresses on the disc for the path table. */
3343
3345 if (path_blocks & 1)
3346 path_blocks++;
3347
3349 if (jpath_blocks & 1)
3350 jpath_blocks++;
3351
3352 /*
3353 * Start to set up the linked list that we use to track the contents
3354 * of the disc.
3355 */
3356#ifdef APPLE_HYB
3357#ifdef PREP_BOOT
3358 if ((apple_hyb && !donotwrite_macpart) || use_prep_boot || use_chrp_boot)
3359#else /* PREP_BOOT */
3361#endif /* PREP_BOOT */
3362 outputlist_insert(&hfs_desc);
3363#endif /* APPLE_HYB */
3366 if (use_genboot)
3369
3370 /* PVD for disc. */
3372
3373 /* SVD for El Torito. MUST be immediately after the PVD! */
3374 if (use_eltorito) {
3376 }
3377 /* Enhanced PVD for disc. neded if we write ISO-9660:1999 */
3378 if (iso9660_level > 3)
3380
3381 /* SVD for Joliet. */
3382 if (use_Joliet) {
3384 }
3385 /* Finally the last volume descriptor. */
3387
3388#ifdef UDF
3389 if (use_udf) {
3390 outputlist_insert(&udf_vol_recognition_area_frag);
3391 }
3392#endif
3393
3394 /* Insert the version descriptor. */
3396
3397#ifdef UDF
3398 if (use_udf) {
3399 /*
3400 * Most of the space before sector 256 is wasted when
3401 * UDF is turned on. The waste could be reduced by
3402 * putting the ISO9660/Joliet structures before the
3403 * pad_to_sector_256; the problem is that they might
3404 * overshoot sector 256, so there would have to be some
3405 * ugly logic to detect this case and rearrange things
3406 * appropriately. I don't know if it's worth it.
3407 */
3408 outputlist_insert(&udf_pad_to_sector_32_frag);
3409 outputlist_insert(&udf_main_seq_frag);
3410 outputlist_insert(&udf_main_seq_copy_frag);
3411 outputlist_insert(&udf_integ_seq_frag);
3412 outputlist_insert(&udf_pad_to_sector_256_frag);
3413 outputlist_insert(&udf_anchor_vol_desc_frag);
3414 outputlist_insert(&udf_file_set_desc_frag);
3415 outputlist_insert(&udf_dirtree_frag);
3416 outputlist_insert(&udf_file_entries_frag);
3417 }
3418#endif
3419
3420 /* Now start with path tables and directory tree info. */
3421 if (!stream_media_size)
3423 else
3425
3426 if (use_Joliet) {
3428 }
3429
3430 if (!stream_media_size)
3432
3433 if (use_Joliet) {
3435 }
3437
3438 if (extension_record) {
3440 }
3441
3442 if (!stream_media_size) {
3444 } else {
3447 }
3448
3449 /*
3450 * Allow room for the various headers we will be writing.
3451 * There will always be a primary and an end volume descriptor.
3452 */
3454
3455 /*
3456 * Calculate the size of all of the components of the disc, and assign
3457 * extent numbers.
3458 */
3459 for (opnt = out_list; opnt; opnt = opnt->of_next) {
3461 if (opnt->of_size != NULL) {
3462 if (verbose > 2)
3463 fprintf(stderr, _("Computing size: %-40sStart Block %u\n"),
3464 opnt->of_name, last_extent);
3465 (*opnt->of_size) (last_extent);
3466 }
3467 }
3468
3469 /*
3470 * Generate the contents of any of the sections that we want to
3471 * generate. Not all of the fragments will do anything here
3472 * - most will generate the data on the fly when we get to the write
3473 * pass.
3474 */
3475 for (opnt = out_list; opnt; opnt = opnt->of_next) {
3476 if (opnt->of_generate != NULL) {
3477 if (verbose > 2)
3478 fprintf(stderr, _("Generating content: %-40s\n"),
3479 opnt->of_name);
3480 (*opnt->of_generate) ();
3481 }
3482 }
3483
3484 /*
3485 * Padding just after the ISO-9660 filesystem.
3486 *
3487 * files_desc does not have an of_size function. For this
3488 * reason, we must insert us after the files content has been
3489 * generated.
3490 */
3491#ifdef UDF
3492 if (use_udf) {
3493 /* Single anchor volume descriptor pointer at end */
3494 outputlist_insert(&udf_end_anchor_vol_desc_frag);
3495 if (udf_end_anchor_vol_desc_frag.of_size != NULL) {
3496 (*udf_end_anchor_vol_desc_frag.of_size) (last_extent);
3497 }
3498 if (dopad) {
3499 /*
3500 * Pad with anchor volume descriptor pointer
3501 * blocks instead of zeroes.
3502 */
3503 outputlist_insert(&udf_padend_avdp_frag);
3504 if (udf_padend_avdp_frag.of_size != NULL) {
3505 (*udf_padend_avdp_frag.of_size) (last_extent);
3506 }
3507 }
3508 } else
3509#endif
3510 if (dopad && !(use_sparcboot || use_sunx86boot)) {
3512 if (endpad_desc.of_size != NULL) {
3513 (*endpad_desc.of_size) (last_extent);
3514 }
3515 }
3516 c = 0;
3517 if (use_sparcboot) {
3518 if (dopad) {
3519 /* Padding before the boot partitions. */
3521 if (interpad_desc.of_size != NULL) {
3522 (*interpad_desc.of_size) (last_extent);
3523 }
3524 }
3525 c = make_sun_label();
3526 last_extent += c;
3528 if (dopad) {
3530 if (endpad_desc.of_size != NULL) {
3531 (*endpad_desc.of_size) (last_extent);
3532 }
3533 }
3534 } else if (use_sunx86boot) {
3535 if (dopad) {
3536 /* Padding before the boot partitions. */
3538 if (interpad_desc.of_size != NULL) {
3539 (*interpad_desc.of_size) (last_extent);
3540 }
3541 }
3542 c = make_sunx86_label();
3543 last_extent += c;
3545 if (dopad) {
3547 if (endpad_desc.of_size != NULL) {
3548 (*endpad_desc.of_size) (last_extent);
3549 }
3550 }
3551 }
3552 if (print_size > 0) {
3553 if (verbose > 0)
3555 _("Total extents scheduled to be written = %u\n"),
3557 printf("%u\n", (last_extent - session_start));
3558 exit(0);
3559 }
3560 /*
3561 * Now go through the list of fragments and write the data that
3562 * corresponds to each one.
3563 */
3564 for (opnt = out_list; opnt; opnt = opnt->of_next) {
3565 Uint oext;
3566
3567 oext = last_extent_written;
3568 if (opnt->of_start_extent != 0 &&
3570 /*
3571 * Consistency check.
3572 * XXX Should make sure that all entries have
3573 * XXXX of_start_extent set up correctly.
3574 */
3576 _("Implementation botch: %s should start at %u but starts at %u.\n"),
3578 }
3579 if (opnt->of_write != NULL) {
3580 if (verbose > 1)
3581 fprintf(stderr, _("Writing: %-40sStart Block %u\n"),
3583 (*opnt->of_write) (discimage);
3584 if (verbose > 1)
3585 fprintf(stderr, _("Done with: %-40sBlock(s) %u\n"),
3586 opnt->of_name, last_extent_written-oext);
3587 }
3588 }
3591 _("Implementation botch: FS should end at %u but ends at %u.\n"),
3593 }
3594
3595 if (verbose > 0) {
3596#ifdef HAVE_SBRK
3597 fprintf(stderr, _("Max brk space used %x\n"),
3598 (unsigned int)(((unsigned long) sbrk(0)) - mem_start));
3599#endif
3600 fprintf(stderr, _("%u extents written (%u MB)\n"),
3602 (last_extent-session_start) >> 9);
3603 }
3604#ifdef VMS
3605 return (1);
3606#else
3607 return (0);
3608#endif
3609}
#define islower(c)
Definition: acclib.h:72
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
int toupper(int c)
Definition: utclib.c:881
#define fileno
Definition: acwin.h:102
#define O_BINARY
Definition: acwin.h:109
#define gettimeofday(tv, tz)
Definition: adns_win32.h:159
static int state
Definition: maze.c:121
#define PATH_MAX
Definition: types.h:280
uid_t getuid()
Definition: uid.c:27
#define SECTOR_SIZE
Definition: fs.h:22
EXPORT int errconfig(char *name)
Definition: checkerr.c:67
EXPORT void comexit(int err)
Definition: comerr.c:331
EXPORT int errmsg(char *msg, va_alist)
Definition: comerr.c:192
#define free
Definition: debug_ros.c:5
#define BOOT_CATALOG_DEFAULT
Definition: defaults.h:23
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
#define off_t
Definition: dosfsck.h:5
EXPORT void insert_boot_cat()
Definition: eltorito.c:124
EXPORT void init_boot_catalog(char *path) const
Definition: eltorito.c:67
struct output_fragment torito_desc
Definition: eltorito.c:686
#define printf
Definition: freeldr.h:97
#define GA_NO_PROPS
Definition: getargs.h:105
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLuint GLuint end
Definition: gl.h:1545
const GLubyte * c
Definition: glext.h:8905
GLbitfield flags
Definition: glext.h:7161
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
#define LC_ALL
Definition: locale.h:17
_Check_return_ _CRTIMP FILE *__cdecl freopen(_In_z_ const char *_Filename, _In_z_ const char *_Mode, _Inout_ FILE *_File)
#define stderr
Definition: stdio.h:100
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
_Check_return_opt_ _CRTIMP int __cdecl fflush(_Inout_opt_ FILE *_File)
_Check_return_ _CRTIMP FILE *__cdecl fopen(_In_z_ const char *_Filename, _In_z_ const char *_Mode)
#define stdin
Definition: stdio.h:98
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
#define _IOFBF
Definition: stdio.h:127
_Check_return_opt_ _CRTIMP int __cdecl setvbuf(_Inout_ FILE *_File, _Inout_updates_opt_z_(_Size) char *_Buf, _In_ int _Mode, _In_ size_t _Size)
#define MAX_ISONAME_V1
Definition: iso9660.h:238
#define MAX_ISONAME
Definition: iso9660.h:242
#define LEN_ISONAME
Definition: iso9660.h:237
#define MAX_ISONAME_V2
Definition: iso9660.h:239
#define MAX_ISONAME_V2_RR
Definition: iso9660.h:240
uint32_t sector
Definition: isohybrid.c:61
EXPORT UInt32_t get_733(void *vp)
Definition: isonum.c:219
struct output_fragment jpathtable_desc
Definition: joliet.c:1455
struct output_fragment joliet_desc
Definition: joliet.c:1454
EXPORT int joliet_sort_tree(struct directory *node)
Definition: joliet.c:1317
struct output_fragment jdirtree_desc
Definition: joliet.c:1456
#define c
Definition: ke_i.h:80
#define resource
Definition: kernel32.h:9
__u16 time
Definition: mkdosfs.c:8
EXPORT void gen_del_match(int n)
Definition: match.c:395
#define MAX_MAT
Definition: match.h:32
#define j_ishidden()
Definition: match.h:78
#define u_ishidden()
Definition: match.h:82
#define i_ishidden()
Definition: match.h:74
LOCAL int walkflags
Definition: mkisofs.c:218
char * icharset
Definition: mkisofs.c:157
int jlen
Definition: mkisofs.c:114
int pversion
Definition: mkisofs.c:195
int print_size
Definition: mkisofs.c:155
int osecsize
Definition: mkisofs.c:112
int verbose
Definition: mkisofs.c:128
int use_sunx86boot
Definition: mkisofs.c:108
char * gid_str
Definition: mkisofs.c:183
char *abstract char * volset_id
Definition: mkisofs.c:165
int rationalize_dirmode
Definition: mkisofs.c:147
int ucs_level
Definition: mkisofs.c:171
int allow_multidot
Definition: mkisofs.c:249
int volume_sequence_number
Definition: mkisofs.c:173
char * extension_record
Definition: mkisofs.c:90
int rationalize_xa
Definition: mkisofs.c:196
char * ocharset
Definition: mkisofs.c:158
FILE * discimage
Definition: mkisofs.c:74
char * check_image
Definition: mkisofs.c:176
char * copyright
Definition: mkisofs.c:162
int check_session
Definition: mkisofs.c:99
int cache_inodes
Definition: mkisofs.c:141
int volume_set_size
Definition: mkisofs.c:172
int max_filenames
Definition: mkisofs.c:187
int path_ind
Definition: mkisofs.c:69
BOOL correct_inodes
Definition: mkisofs.c:324
int transparent_compression
Definition: mkisofs.c:235
struct timeval tv_begun
Definition: write.c:306
char * cdrecord_data
Definition: multi.c:1748
uid_t uid_to_use
Definition: mkisofs.c:148
int allow_lowercase
Definition: mkisofs.c:247
char * boot_catalog
Definition: mkisofs.c:168
int iso9660_level
Definition: mkisofs.c:242
int new_dir_mode
Definition: mkisofs.c:152
char * volume_id
Definition: mkisofs.c:166
LOCAL const struct mki_option mki_options[]
Definition: mkisofs.c:1045
off_t maxnonlarge
Definition: mkisofs.c:241
UInt32_t session_start
Definition: mkisofs.c:77
char * new_dirmode_str
Definition: mkisofs.c:189
int no_rr
Definition: mkisofs.c:237
int rationalize
Definition: mkisofs.c:143
LOCAL void list_locales()
Definition: mkisofs.c:3612
char * biblio
Definition: mkisofs.c:163
int goof
Definition: mkisofs.c:1637
ldate modification_date
Definition: mkisofs.c:197
char * sectype
Definition: mkisofs.c:192
char version_string[]
Definition: mkisofs.c:71
int iso_translate
Definition: mkisofs.c:250
int rationalize_rr
Definition: mkisofs.c:191
char * stream_filename
Definition: mkisofs.c:261
char * reloc_old_root
Definition: mkisofs.c:178
unsigned int path_table_size
Definition: mkisofs.c:78
LOCAL void susage(int excode)
Definition: mkisofs.c:1648
int stream_media_size
Definition: mkisofs.c:260
int disable_deep_reloc
Definition: mkisofs.c:180
char * pathnames
Definition: mkisofs.c:190
int use_RockRidge
Definition: mkisofs.c:110
int rationalize_gid
Definition: mkisofs.c:145
unsigned int jpath_table_size
Definition: mkisofs.c:83
int omit_version_number
Definition: mkisofs.c:236
char * merge_image
Definition: mkisofs.c:175
int force_rr
Definition: mkisofs.c:238
char * trans_tbl
Definition: mkisofs.c:259
int joliet_long
Definition: mkisofs.c:185
int filemode_to_use
Definition: mkisofs.c:150
int rationalize_uid
Definition: mkisofs.c:144
LOCAL void checkarch(char *name)
Definition: mkisofs.c:3964
char * appid
Definition: mkisofs.c:161
int untranslated_filenames
Definition: mkisofs.c:194
int relaxed_filenames
Definition: mkisofs.c:246
LOCAL void read_rcfile(char *appname)
Definition: mkisofs.c:1489
int omit_period
Definition: mkisofs.c:234
int rationalize_filemode
Definition: mkisofs.c:146
unsigned int path_blocks
Definition: mkisofs.c:80
unsigned int jpath_blocks
Definition: mkisofs.c:85
char * jcharset
Definition: mkisofs.c:186
int help
Definition: mkisofs.c:184
int extension_record_size
Definition: mkisofs.c:92
struct directory * get_graft(char *arg, char *graft_point, size_t glen, char *nodename, size_t nlen, char **short_namep, BOOL do_insert)
Definition: mkisofs.c:3690
int iso9660_namelen
Definition: mkisofs.c:243
char * log_file
Definition: mkisofs.c:188
char * filemode_str
Definition: mkisofs.c:182
char * preparer
Definition: mkisofs.c:159
int no_allow_lowercase
Definition: mkisofs.c:248
LOCAL char * get_pnames(int argc, char *const *argv, int opt, char *pname, int pnsize, FILE *fp)
Definition: mkisofs.c:1969
char * uid_str
Definition: mkisofs.c:193
siconvt_t * in_nls
Definition: mkisofs.c:332
LOCAL BOOL data_change_warn
Definition: mkisofs.c:224
char * genboot_image
Definition: mkisofs.c:170
char * outfile
Definition: mkisofs.c:73
EXPORT char * e_strdup(char *s) const
Definition: mkisofs.c:3941
siconvt_t * out_nls
Definition: mkisofs.c:333
int generate_tables
Definition: mkisofs.c:153
gid_t gid_to_use
Definition: mkisofs.c:149
char * system_id
Definition: mkisofs.c:167
Uint RR_relocation_depth
Definition: mkisofs.c:239
int use_genboot
Definition: mkisofs.c:109
int full_iso9660_filenames
Definition: mkisofs.c:244
int use_Joliet
Definition: mkisofs.c:113
int use_XA
Definition: mkisofs.c:111
int use_sparcboot
Definition: mkisofs.c:107
time_t begun
Definition: write.c:305
int do_largefiles
Definition: mkisofs.c:240
int dirmode_to_use
Definition: mkisofs.c:151
LOCAL void hide_reloc_dir()
Definition: mkisofs.c:1947
#define OPTION_COUNT
Definition: mkisofs.c:1467
char * dirmode_str
Definition: mkisofs.c:181
int dopad
Definition: mkisofs.c:154
UInt32_t last_extent
Definition: mkisofs.c:76
BOOL nodesc
Definition: mkisofs.c:202
int donotwrite_macpart
Definition: mkisofs.c:298
int check_oldnames
Definition: mkisofs.c:98
BOOL rrip112
Definition: mkisofs.c:325
struct output_fragment end_vol
Definition: write.c:3024
struct output_fragment * out_list
Definition: write.c:75
struct output_fragment strfile_desc
Definition: stream.c:255
struct output_fragment interpad_desc
Definition: write.c:3031
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
struct output_fragment files_desc
Definition: write.c:3030
int create_udfsymlinks
struct output_fragment startpad_desc
Definition: write.c:3021
struct output_fragment voldesc_desc
Definition: write.c:3022
#define JLONGMAX
Definition: mkisofs.h:420
struct output_fragment endpad_desc
Definition: write.c:3032
struct output_fragment extension_desc
Definition: write.c:3029
struct output_fragment strdir_desc
Definition: stream.c:256
struct output_fragment strpath_desc
Definition: stream.c:257
UInt32_t last_extent_written
Definition: write.c:303
siconvt_t * hfs_inls
#define STAT_INODE(X)
Definition: mkisofs.h:785
#define ISO_BLOCKS(X)
Definition: mkisofs.h:743
siconvt_t * hfs_onls
struct output_fragment xvoldesc_desc
Definition: write.c:3023
struct output_fragment pathtable_desc
Definition: write.c:3026
struct output_fragment dirtree_desc
Definition: write.c:3027
char * abstract
struct output_fragment version_desc
Definition: write.c:3025
struct output_fragment dirtree_clean
Definition: write.c:3028
#define F_OK
Definition: util.h:52
int get_session_start(int *file_addr)
Definition: multi.c:1751
struct iso_directory_record * merge_isofs(char *path)
Definition: multi.c:1401
int rr_flags(struct iso_directory_record *idr)
Definition: multi.c:353
int merge_previous_session(struct directory *this_dir, struct iso_directory_record *mrootp, char *reloc_root, char *reloc_old_root)
Definition: multi.c:1811
int open_merge_image(char *path)
Definition: multi.c:1365
char er_id[256]
Definition: multi.c:96
int close_merge_image()
Definition: multi.c:1387
int su_version
Definition: multi.c:93
int rr_version
Definition: multi.c:94
void match_cl_re_entries()
Definition: multi.c:2131
EXPORT int readsecs(UInt32_t startsecno, void *buffer, int sectorcount)
Definition: multi.c:118
#define textdomain(a)
Definition: nlsdefs.h:78
#define bindtextdomain(d, dir)
Definition: nlsdefs.h:80
#define __PR(a)
Definition: prototyp.h:106
#define long
Definition: qsort.c:33
#define HOST_CPU
Definition: xconfig.h:220
#define HOST_VENDOR
Definition: xconfig.h:221
#define HOST_OS
Definition: xconfig.h:222
EXPORT char * generate_rr_extension_record(char *id, char *descriptor, char *source, int *size)
Definition: rock.c:903
#define RR_FLAG_AA
Definition: rock.h:38
#define RR_FLAG_ER
Definition: rock.h:42
#define RR_FLAG_XA
Definition: rock.h:39
#define RR_FLAG_SP
Definition: rock.h:37
EXPORT void save_args(int ac, av)
Definition: saveargs.c:58
#define SIP_ANY_FILE
Definition: schily.h:428
#define SIP_NO_PATH
Definition: schily.h:430
#define ___malloc
Definition: schily.h:630
#define errno
Definition: errno.h:18
#define DEV_NULL
Definition: compat.h:28
#define setmode(f, m)
Definition: io.h:42
f_args fa
Definition: format.c:280
struct output_fragment sunboot_desc
Definition: boot.c:553
struct output_fragment sunlabel_desc
Definition: boot.c:554
EXPORT int make_sun_label()
Definition: boot.c:243
struct output_fragment genboot_desc
Definition: boot.c:555
EXPORT int make_sunx86_label()
Definition: boot.c:287
EXPORT void add_directory_hash(dev_t dev, ino_t inode)
Definition: hash.c:346
EXPORT int sort_tree(struct directory *node)
Definition: tree.c:2842
EXPORT void outputlist_insert(struct output_fragment *frag)
Definition: write.c:1895
#define apple_hyb
#define dvd_aud_vid_flag
EXPORT char * searchfileinpath(char *name, int mode, int file_mode, char *path)
Definition: searchinpath.c:68
EXPORT siconvt_t * sic_open(char *charset)
Definition: sic_nls.c:160
Definition: ffs.h:70
char extent[ISODCL(3, 10)]
Definition: iso9660.h:248
int l_gmtoff
Definition: mkisofs.h:334
time_t l_sec
Definition: mkisofs.h:332
int l_usec
Definition: mkisofs.h:333
unsigned int of_start_extent
Definition: mkisofs.h:196
char * of_name
Definition: mkisofs.h:195
struct output_fragment * of_next
Definition: mkisofs.h:191
iconv_t sic_cd2uni
Definition: siconv.h:42
char * sic_name
Definition: siconv.h:39
Definition: mkisofs.h:79
#define setlocale(n, s)
Definition: locale.h:46
long Llong
Definition: stdint.h:152
unsigned long Ullong
Definition: stdint.h:153
EXPORT char * getargerror(int err)
Definition: getargs.c:1335
EXPORT int getvargs(int *pac, pav, struct ga_props *props, struct ga_flags *vfmt)
Definition: getargs.c:226
EXPORT int setuid(uid_t uid)
Definition: uid.c:47
EXPORT int seteuid(uid_t uid)
Definition: uid.c:58
unsigned int Uint
Definition: utypes.h:43
unsigned char Uchar
Definition: utypes.h:45

◆ mosize()

LOCAL int mosize ( int  y,
int  m 
)

Definition at line 728 of file mkisofs.c.

731{
732
733 if (m == 1 && dysize(y) == 366)
734 return (29);
735 return (dmsize[m]);
736}
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
const GLfloat * m
Definition: glext.h:10848
#define dysize(A)
Definition: mkisofs.c:723
static int dmsize[12]
Definition: mkisofs.c:725

Referenced by parse_date().

◆ optend()

const char * optend ( char fmt) const

Definition at line 1691 of file mkisofs.c.

1693{
1694 int c;
1695 const char *ofmt = fmt;
1696
1697 for (; *fmt != '\0'; fmt++) {
1698 c = *fmt;
1699 if (c == '\\') {
1700 if (*++fmt == '\0')
1701 break;
1702 continue;
1703 }
1704 if (c == ',' || c == '%' || c == '*' || c == '?' ||
1705 c == '#' || c == '&' || c == '~')
1706 break;
1707 if (fmt > ofmt && c == '+')
1708 break;
1709
1710 }
1711 return (fmt);
1712}
const char * ofmt
Definition: format.c:285
Definition: dsound.c:943

Referenced by printopts().

◆ ovstrcpy()

LOCAL void ovstrcpy ( char p2,
char p1 
)

Definition at line 3955 of file mkisofs.c.

3958{
3959 while ((*p2++ = *p1++) != '\0')
3960 ;
3961}

Referenced by get_graft().

◆ parse_date()

LOCAL char * parse_date ( char arg,
struct tm tp 
)

Definition at line 739 of file mkisofs.c.

742{
743 char *oarg = arg;
744 char *p;
745
746 tp->tm_mon = tp->tm_hour = tp->tm_min = tp->tm_sec = 0;
747 tp->tm_mday = 1;
748 tp->tm_isdst = -1;
749
750 p = strchr(arg, '/');
751 if (p == NULL)
752 p = strchr(arg, '-');
753 if (p) {
754 if ((p - arg) != 2 && (p - arg) != 4)
755 ldate_error(oarg);
756 p = strntoi(arg, 4, &tp->tm_year);
757 if ((p - arg) != 2 && (p - arg) != 4)
758 ldate_error(oarg);
759 if ((p - arg) == 2) {
760 if (tp->tm_year < 69)
761 tp->tm_year += 100;
762 } else {
763 tp->tm_year -= 1900;
764 }
765 if (*p == '/' || *p == '-')
766 p++;
767 } else if (strlen(arg) < 4) {
768 ldate_error(oarg);
769 } else {
770 p = strntoi(arg, 4, &tp->tm_year);
771 if ((p - arg) != 4)
772 ldate_error(oarg);
773 tp->tm_year -= 1900;
774 }
775 if (*p == '\0' || strchr(".+-", *p))
776 return (p);
777 arg = p;
778 p = strntoi(arg, 2, &tp->tm_mon);
779 if ((p - arg) != 2)
780 ldate_error(oarg);
781 tp->tm_mon -= 1;
782 if (tp->tm_mon < 0 || tp->tm_mon >= 12)
783 ldate_error(oarg);
784 if (*p == '/' || *p == '-')
785 p++;
786 if (*p == '\0' || strchr(".+-", *p))
787 return (p);
788 arg = p;
789 p = strntoi(arg, 2, &tp->tm_mday);
790 if ((p - arg) != 2)
791 ldate_error(oarg);
792 if (tp->tm_mday < 1 || tp->tm_mday > mosize(tp->tm_year+1900, tp->tm_mon))
793 ldate_error(oarg);
794 if (*p == ' ')
795 p++;
796 if (*p == '\0' || strchr(".+-", *p))
797 return (p);
798 arg = p;
799 p = strntoi(arg, 2, &tp->tm_hour);
800 if ((p - arg) != 2)
801 ldate_error(oarg);
802 if (tp->tm_hour > 23)
803 ldate_error(oarg);
804 if (*p == ':')
805 p++;
806 if (*p == '\0' || strchr(".+-", *p))
807 return (p);
808 arg = p;
809 p = strntoi(arg, 2, &tp->tm_min);
810 if ((p - arg) != 2)
811 ldate_error(oarg);
812 if (tp->tm_min > 59)
813 ldate_error(oarg);
814 if (*p == ':')
815 p++;
816 if (*p == '\0' || strchr(".+-", *p))
817 return (p);
818 arg = p;
819 p = strntoi(arg, 2, &tp->tm_sec);
820 if ((p - arg) != 2)
821 ldate_error(oarg);
822 if (tp->tm_sec > 61)
823 ldate_error(oarg);
824 return (p);
825}
_In_ uint64_t _In_ uint64_t _In_ uint64_t _In_opt_ traverse_ptr * tp
Definition: btrfs.c:2996
LOCAL int mosize(int y, int m)
Definition: mkisofs.c:728

Referenced by get_ldate().

◆ printopts()

int printopts ( FILE f,
const char fmt,
const char arg,
int  twod 
)

Definition at line 1716 of file mkisofs.c.

1721{
1722 const char *p;
1723 int len = 0;
1724 int optlen;
1725 int arglen = 0;
1726
1727 if (arg) {
1728 if (*arg == '-' || *arg == '\\')
1729 arg++;
1730
1731 if (*arg == '\1') {
1732 p = ++arg;
1733 while (*p != '\0' && *p != '\1' && *p != '\2')
1734 p++;
1735 arglen = p - arg;
1736 if (arglen == 0)
1737 arg = NULL;
1738 } else {
1739 arg = NULL;
1740 }
1741 }
1742 for (p = optend(fmt); p > fmt; p = optend(fmt)) {
1743 optlen = p - fmt;
1744 len += fprintf(f, "%s%.*s%s%.*s",
1745 *fmt == '+' ? "" :
1746 (optlen > 1 && twod) ? "--" : "-",
1747 (int)(p - fmt), fmt,
1748 arg != NULL ? " " : "",
1749 arglen, arg != NULL ? arg : "");
1750 fmt = p;
1751 while (*fmt != '\0' && *fmt != ',')
1752 fmt++;
1753 if (*fmt == ',') {
1754 fmt++;
1755 len += fprintf(f, ", ");
1756 }
1757 }
1758 return (len);
1759}
GLfloat f
Definition: glext.h:7540
const char * optend(char *fmt) const
Definition: mkisofs.c:1691

Referenced by usage().

◆ read_rcfile()

LOCAL void read_rcfile ( char appname)

Definition at line 1489 of file mkisofs.c.

1491{
1492 FILE *rcfile = (FILE *)NULL;
1493 struct rcopts *rco;
1494 char *pnt,
1495 *pnt1;
1496 char linebuffer[256];
1497 static char rcfn[] = ".mkisofsrc";
1498 char filename[1000];
1499 int linum;
1500
1501 strlcpy(filename, rcfn, sizeof (filename));
1502 if (access(filename, R_OK) == 0)
1503 rcfile = fopen(filename, "r");
1504 if (!rcfile && errno != ENOENT)
1505 errmsg(_("Cannot open '%s'.\n"), filename);
1506
1507 if (!rcfile) {
1508 pnt = getenv("MKISOFSRC");
1509 if (pnt && strlen(pnt) <= sizeof (filename)) {
1510 strlcpy(filename, pnt, sizeof (filename));
1511 if (access(filename, R_OK) == 0)
1512 rcfile = fopen(filename, "r");
1513 if (!rcfile && errno != ENOENT)
1514 errmsg(_("Cannot open '%s'.\n"), filename);
1515 }
1516 }
1517 if (!rcfile) {
1518 pnt = getenv("HOME");
1519 if (pnt && strlen(pnt) + strlen(rcfn) + 2 <=
1520 sizeof (filename)) {
1521 strlcpy(filename, pnt, sizeof (filename));
1522 if (strlen(rcfn) + 2 <=
1523 (sizeof (filename) - strlen(filename))) {
1524 strcat(filename, "/");
1525 strcat(filename, rcfn);
1526 }
1527 if (access(filename, R_OK) == 0)
1528 rcfile = fopen(filename, "r");
1529 if (!rcfile && errno != ENOENT)
1530 errmsg(_("Cannot open '%s'.\n"), filename);
1531 }
1532 }
1533 if (!rcfile && strlen(appname) + sizeof (rcfn) + 2 <=
1534 sizeof (filename)) {
1535 strlcpy(filename, appname, sizeof (filename));
1536 pnt = strrchr(filename, '/');
1537 if (pnt) {
1538 strlcpy(pnt + 1, rcfn,
1539 sizeof (filename) - (pnt + 1 - filename));
1540 if (access(filename, R_OK) == 0)
1541 rcfile = fopen(filename, "r");
1542 if (!rcfile && errno != ENOENT)
1543 errmsg(_("Cannot open '%s'.\n"), filename);
1544 }
1545 }
1546 if (!rcfile)
1547 return;
1548 if (verbose > 0) {
1549 fprintf(stderr, _("Using \"%s\"\n"), filename);
1550 }
1551 /* OK, we got it. Now read in the lines and parse them */
1552 linum = 0;
1553 while (fgets(linebuffer, sizeof (linebuffer), rcfile)) {
1554 char *name;
1555 char *name_end;
1556
1557 ++linum;
1558 /* skip any leading white space */
1559 pnt = linebuffer;
1560 while (*pnt == ' ' || *pnt == '\t')
1561 ++pnt;
1562 /*
1563 * If we are looking at a # character, this line is a comment.
1564 */
1565 if (*pnt == '#')
1566 continue;
1567 /*
1568 * The name should begin in the left margin. Make sure it is
1569 * in upper case. Stop when we see white space or a comment.
1570 */
1571 name = pnt;
1572 while (*pnt && (isalpha((unsigned char) *pnt) || *pnt == '_')) {
1573 if (islower((unsigned char) *pnt))
1574 *pnt = toupper((unsigned char) *pnt);
1575 pnt++;
1576 }
1577 if (name == pnt) {
1578 fprintf(stderr, _("%s:%d: name required\n"), filename,
1579 linum);
1580 continue;
1581 }
1582 name_end = pnt;
1583 /* Skip past white space after the name */
1584 while (*pnt == ' ' || *pnt == '\t')
1585 pnt++;
1586 /* silently ignore errors in the rc file. */
1587 if (*pnt != '=') {
1588 fprintf(stderr, _("%s:%d: equals sign required after '%.*s'\n"),
1589 filename, linum,
1590 /* XXX Should not be > int */
1591 (int)(name_end-name), name);
1592 continue;
1593 }
1594 /* Skip pas the = sign, and any white space following it */
1595 pnt++; /* Skip past '=' sign */
1596 while (*pnt == ' ' || *pnt == '\t')
1597 pnt++;
1598
1599 /* now it is safe to NUL terminate the name */
1600
1601 *name_end = 0;
1602
1603 /* Now get rid of trailing newline */
1604
1605 pnt1 = pnt;
1606 while (*pnt1) {
1607 if (*pnt1 == '\n') {
1608 *pnt1 = 0;
1609 break;
1610 }
1611 pnt1++;
1612 }
1613 /* OK, now figure out which option we have */
1614 for (rco = rcopt; rco->tag; rco++) {
1615 if (strcmp(rco->tag, name) == 0) {
1616 *rco->variable = e_strdup(pnt);
1617 break;
1618 }
1619 }
1620 if (rco->tag == NULL) {
1621 fprintf(stderr, _("%s:%d: field name \"%s\" unknown\n"),
1622 filename, linum,
1623 name);
1624 }
1625 }
1626 if (ferror(rcfile))
1627 errmsg(_("Read error on '%s'.\n"), filename);
1628 fclose(rcfile);
1629}
#define ENOENT
Definition: acclib.h:79
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
#define isalpha(c)
Definition: acclib.h:74
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
_Check_return_ _CRTIMP int __cdecl ferror(_In_ FILE *_File)
_Check_return_ char *__cdecl getenv(_In_z_ const char *_VarName)
const char * filename
Definition: ioapi.h:137
struct rcopts rcopt[]
Definition: mkisofs.c:344
#define R_OK
Definition: io.h:171
char * tag
Definition: mkisofs.c:340
char ** variable
Definition: mkisofs.c:341

Referenced by main().

◆ strntoi()

LOCAL char * strntoi ( char p,
int  n,
int ip 
)

Definition at line 698 of file mkisofs.c.

702{
703 int i = 0;
704 int digits = 0;
705 int c;
706
707 while (*p) {
708 if (digits >= n)
709 break;
710 c = *p;
711 if (c < '0' || c > '9')
712 break;
713 p++;
714 digits++;
715 i *= 10;
716 i += c - '0';
717 }
718 *ip = i;
719
720 return (p);
721}
static const int digits[]
Definition: decode.c:71
Definition: dhcpd.h:62

Referenced by get_ldate(), and parse_date().

◆ susage()

LOCAL void susage ( int  excode)

Definition at line 1648 of file mkisofs.c.

1650{
1651 const char *program_name = "mkisofs";
1652
1653#ifdef USE_FIND
1654 fprintf(stderr, _("Usage: %s [options] [-find] file... [find expression]\n"), program_name);
1655#else
1656 fprintf(stderr, _("Usage: %s [options] file...\n"), program_name);
1657#endif
1658 fprintf(stderr, _("\nUse %s -help\n"), program_name);
1659 fprintf(stderr, _("to get a list all of valid options.\n"));
1660#ifdef USE_FIND
1661 fprintf(stderr, _("\nUse %s -find -help\n"), program_name);
1662 fprintf(stderr, _("to get a list of all valid -find options.\n"));
1663#endif
1664 error(_("\nMost important Options:\n"));
1665 error(_(" -posix-H Follow sylinks encountered on command line\n"));
1666 error(_(" -posix-L Follow all symlinks\n"));
1667 error(_(" -posix-P Do not follow symlinks (default)\n"));
1668 error(_(" -o FILE, -output FILE Set output file name\n"));
1669 error(_(" -R, -rock Generate Rock Ridge directory information\n"));
1670 error(_(" -r, -rational-rock Generate rationalized Rock Ridge directory info\n"));
1671 error(_(" -J, -joliet Generate Joliet directory information\n"));
1672 error(_(" -print-size Print estimated filesystem size and exit\n"));
1673#ifdef UDF
1674 error(_(" -UDF Generate UDF file system\n"));
1675#endif
1676#ifdef DVD_AUD_VID
1677 error(_(" -dvd-audio Generate DVD-Audio compliant UDF file system\n"));
1678 error(_(" -dvd-video Generate DVD-Video compliant UDF file system\n"));
1679 error(_(" -dvd-hybrid Generate a hybrid (DVD-Audio/DVD-Video) compliant UDF file system\n"));
1680#endif
1681 error(_(" -iso-level LEVEL Set ISO9660 level (1..3) or 4 for ISO9660 v 2\n"));
1682 error(_(" -V ID, -volid ID Set Volume ID\n"));
1683 error(_(" -graft-points Allow to use graft points for filenames\n"));
1684 error(_(" -M FILE, -prev-session FILE Set path to previous session to merge\n"));
1685
1686 exit(excode);
1687}
static char * program_name
Definition: mkdosfs.c:519

Referenced by main().

◆ usage()

LOCAL void usage ( int  excode)

Definition at line 1794 of file mkisofs.c.

1796{
1797 const char *program_name = "mkisofs";
1798
1799 int i;
1800
1801#ifdef USE_FIND
1802 fprintf(stderr, _("Usage: %s [options] [-find] file... [find expression]\n"), program_name);
1803#else
1804 fprintf(stderr, _("Usage: %s [options] file...\n"), program_name);
1805#endif
1806
1807 fprintf(stderr, _("Options:\n"));
1808 for (i = 0; i < (int)OPTION_COUNT; i++) {
1809 if (docstr(mki_options[i].doc, NULL) != NULL) {
1810 int len;
1811 int j;
1812
1813 fprintf(stderr, " ");
1814 len = 2;
1815 j = i;
1816 do {
1817 int twodash;
1818 int no_help;
1819 const char *doc;
1820
1821 doc = mki_options[j].doc;
1822 twodash = (doc != NULL && *doc == '-');
1823 doc = docstr(doc, &no_help);
1824
1825 if (!no_help) {
1826 /*
1827 * If more options for one doc, then
1828 * print a comma as separator.
1829 */
1830 if (j > i)
1831 len += fprintf(stderr, ", ");
1832 len += printopts(stderr,
1833 mki_options[j].opt.ga_format,
1834 mki_options[j].doc,
1835 twodash);
1836 }
1837 ++j;
1838 }
1839 while (j < (int)OPTION_COUNT &&
1840 docstr(mki_options[j].doc, NULL) == NULL);
1841
1842 if (len >= 30) {
1843 fprintf(stderr, "\n");
1844 len = 0;
1845 }
1846 for (; len < 30; len++)
1847 fputc(' ', stderr);
1848
1849 fprintf(stderr, "%s\n",
1850 docstr(mki_options[i].doc, NULL));
1851 }
1852 }
1853 exit(excode);
1854}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
_Check_return_opt_ _CRTIMP int __cdecl fputc(_In_ int _Ch, _Inout_ FILE *_File)
int printopts(FILE *f, const char *fmt, const char *arg, int twod)
Definition: mkisofs.c:1716
const char * docstr(char *str, int *no_help) const
Definition: mkisofs.c:1763

Variable Documentation

◆ all_files

int all_files = 1

Definition at line 132 of file mkisofs.c.

Referenced by AVIBuildFilterW(), NOTEPAD_InitData(), and scan_directory_tree().

◆ allow_leading_dots

int allow_leading_dots = 0

Definition at line 251 of file mkisofs.c.

Referenced by getL(), iso9660_file_length(), and main().

◆ allow_lowercase

int allow_lowercase = 0

Definition at line 247 of file mkisofs.c.

Referenced by iso9660_file_length(), and main().

◆ allow_multidot

int allow_multidot = 0

Definition at line 249 of file mkisofs.c.

Referenced by iso9660_file_length(), and main().

◆ appid

char* appid = APPID_DEFAULT

◆ archive_dev

dev_t archive_dev

Definition at line 94 of file mkisofs.c.

Referenced by checkarch().

◆ archive_ino

ino_t archive_ino

Definition at line 95 of file mkisofs.c.

Referenced by checkarch().

◆ archive_isreg

BOOL archive_isreg

Definition at line 93 of file mkisofs.c.

Referenced by checkarch(), and insert_file_entry().

◆ begun

time_t begun
extern

Definition at line 305 of file write.c.

Referenced by main().

◆ biblio

char* biblio = BIBLIO_DEFAULT

Definition at line 163 of file mkisofs.c.

Referenced by main(), and pvd_write().

◆ boot_catalog

char* boot_catalog

Definition at line 168 of file mkisofs.c.

Referenced by get_torito_desc(), init_boot_catalog(), insert_boot_cat(), and main().

◆ boot_image

char* boot_image = BOOT_IMAGE_DEFAULT

Definition at line 169 of file mkisofs.c.

Referenced by get_boot_image(), and tvd_write().

◆ boot_info_table

int boot_info_table = 0

Definition at line 106 of file mkisofs.c.

Referenced by get_boot_table().

◆ cache_inodes

int cache_inodes = -1

Definition at line 141 of file mkisofs.c.

Referenced by add_directory_hash(), add_hash(), do_inode(), find_directory_hash(), find_hash(), and main().

◆ cdrecord_data

char* cdrecord_data
extern

Definition at line 1748 of file multi.c.

Referenced by get_session_start(), and main().

◆ check_image

char* check_image

Definition at line 176 of file mkisofs.c.

Referenced by main().

◆ check_oldnames

int check_oldnames = 0

Definition at line 98 of file mkisofs.c.

Referenced by main(), and read_merging_directory().

◆ check_session

int check_session = 0

Definition at line 99 of file mkisofs.c.

Referenced by get_session_start(), and main().

◆ copyright

char* copyright = COPYRIGHT_DEFAULT

Definition at line 162 of file mkisofs.c.

Referenced by main().

◆ correct_inodes

BOOL correct_inodes = TRUE

Definition at line 324 of file mkisofs.c.

Referenced by compute_linkcount(), do_inode(), main(), merge_isofs(), and vers_write().

◆ current_boot_entry

◆ data_change_warn

LOCAL BOOL data_change_warn

Definition at line 224 of file mkisofs.c.

Referenced by main().

◆ debug

int debug = 0

Definition at line 129 of file mkisofs.c.

Referenced by escstrcpy(), and get_graft().

◆ dirmode_str

char* dirmode_str

Definition at line 181 of file mkisofs.c.

Referenced by main().

◆ dirmode_to_use

int dirmode_to_use = 0

Definition at line 151 of file mkisofs.c.

Referenced by main(), and stat_fix().

◆ disable_deep_reloc

int disable_deep_reloc

Definition at line 180 of file mkisofs.c.

Referenced by main().

◆ discimage

FILE* discimage

Definition at line 74 of file mkisofs.c.

Referenced by main().

◆ dmsize

int dmsize[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
static

Definition at line 725 of file mkisofs.c.

Referenced by mosize().

◆ do_largefiles

int do_largefiles = 0

Definition at line 240 of file mkisofs.c.

Referenced by insert_file_entry(), and main().

◆ donotwrite_macpart

int donotwrite_macpart = 1

Definition at line 298 of file mkisofs.c.

Referenced by file_gen(), file_write(), main(), and write_files().

◆ dopad

int dopad = 1

Definition at line 154 of file mkisofs.c.

Referenced by main(), and size_str_file().

◆ extension_record

char* extension_record = NULL

Definition at line 90 of file mkisofs.c.

Referenced by exten_write(), and main().

◆ extension_record_extent

UInt32_t extension_record_extent = 0

Definition at line 91 of file mkisofs.c.

Referenced by ext_size().

◆ extension_record_size

int extension_record_size = 0

Definition at line 92 of file mkisofs.c.

Referenced by ext_size(), and main().

◆ filemode_str

char* filemode_str

Definition at line 182 of file mkisofs.c.

Referenced by main().

◆ filemode_to_use

int filemode_to_use = 0

Definition at line 150 of file mkisofs.c.

Referenced by main(), and stat_fix().

◆ first_boot_entry

struct eltorito_boot_entry_info* first_boot_entry = NULL

Definition at line 226 of file mkisofs.c.

Referenced by get_boot_entry(), get_torito_desc(), and init_boot_catalog().

◆ follow_links

BOOL follow_links = FALSE

Definition at line 134 of file mkisofs.c.

Referenced by get_graft(), getH(), getL(), getP(), insert_file_entry(), and main().

◆ force_rr

int force_rr = 0

Definition at line 238 of file mkisofs.c.

Referenced by main().

◆ full_iso9660_filenames

int full_iso9660_filenames = 0

Definition at line 244 of file mkisofs.c.

Referenced by iso9660_file_length(), main(), and sort_n_finish().

◆ genboot_image

char* genboot_image = BOOT_IMAGE_DEFAULT

Definition at line 170 of file mkisofs.c.

Referenced by genboot_write(), main(), and sunlabel_write().

◆ generate_tables

int generate_tables = 0

◆ gid_str

char* gid_str

Definition at line 183 of file mkisofs.c.

Referenced by main().

◆ gid_to_use

gid_t gid_to_use = 0

Definition at line 149 of file mkisofs.c.

Referenced by init_fstatbuf(), main(), and stat_fix().

◆ gl_flags

LOCAL struct ga_flags* gl_flags

Definition at line 999 of file mkisofs.c.

Referenced by dolegacy(), and main().

◆ goof

int goof = 0

Definition at line 1637 of file mkisofs.c.

Referenced by main().

◆ gui

int gui = 0

Definition at line 130 of file mkisofs.c.

Referenced by GetMainThreadFocus(), and write_one_file().

◆ hard_disk_boot

int hard_disk_boot = 0

Definition at line 101 of file mkisofs.c.

Referenced by get_hd_boot().

◆ help

int help ( void  )

Definition at line 184 of file mkisofs.c.

Referenced by main().

◆ Hflag

BOOL Hflag = FALSE

Definition at line 133 of file mkisofs.c.

Referenced by get_graft(), getH(), getL(), and getP().

◆ hide_rr_moved

int hide_rr_moved

Definition at line 233 of file mkisofs.c.

Referenced by generate_reloc_directory().

◆ icharset

char* icharset = NULL

Definition at line 157 of file mkisofs.c.

Referenced by main().

◆ in_nls

◆ iso9660_level

int iso9660_level = 1

Definition at line 242 of file mkisofs.c.

Referenced by iso9660_file_length(), main(), and sort_n_finish().

◆ iso9660_namelen

int iso9660_namelen = LEN_ISONAME

Definition at line 243 of file mkisofs.c.

Referenced by iso9660_file_length(), main(), and sort_n_finish().

◆ iso_translate

int iso_translate = 1

Definition at line 250 of file mkisofs.c.

Referenced by iso9660_file_length(), and main().

◆ jcharset

char* jcharset

Definition at line 186 of file mkisofs.c.

Referenced by main().

◆ jhide_trans_tbl

int jhide_trans_tbl

Definition at line 232 of file mkisofs.c.

Referenced by sort_n_finish().

◆ jlen

◆ joliet_long

int joliet_long

Definition at line 185 of file mkisofs.c.

Referenced by main().

◆ jpath_blocks

unsigned int jpath_blocks = 0

Definition at line 85 of file mkisofs.c.

Referenced by generate_joliet_path_tables(), jpathtab_size(), jpathtab_write(), and main().

◆ jpath_table

unsigned int jpath_table[4] = {0, }

Definition at line 84 of file mkisofs.c.

Referenced by get_joliet_vol_desc(), and jpathtab_size().

◆ jpath_table_l

char* jpath_table_l = NULL

Definition at line 1634 of file mkisofs.c.

Referenced by generate_joliet_path_tables(), and jpathtab_write().

◆ jpath_table_m

char* jpath_table_m = NULL

Definition at line 1635 of file mkisofs.c.

Referenced by generate_joliet_path_tables(), and jpathtab_write().

◆ jpath_table_size

unsigned int jpath_table_size = 0

◆ jroot_record

Definition at line 88 of file mkisofs.c.

Referenced by get_joliet_vol_desc(), and jroot_gen().

◆ last_boot_entry

struct eltorito_boot_entry_info* last_boot_entry = NULL

Definition at line 227 of file mkisofs.c.

Referenced by get_boot_entry().

◆ last_extent

◆ legacy

BOOL legacy = FALSE

Definition at line 131 of file mkisofs.c.

Referenced by dolegacy(), get_runtime_info(), getH(), getL(), getP(), and parse_startup().

◆ load_addr

◆ load_size

int load_size = 0

Definition at line 105 of file mkisofs.c.

Referenced by get_boot_size().

◆ log_file

char* log_file

Definition at line 188 of file mkisofs.c.

Referenced by main().

◆ long_rr_time

BOOL long_rr_time = FALSE

Definition at line 326 of file mkisofs.c.

Referenced by generate_xa_rr_attributes().

◆ match_igncase

int match_igncase

Definition at line 231 of file mkisofs.c.

Referenced by gen_matches().

◆ max_filenames

int max_filenames

Definition at line 187 of file mkisofs.c.

Referenced by main().

◆ maxnonlarge

off_t maxnonlarge = (off_t)0xFFFFFFFF

Definition at line 241 of file mkisofs.c.

Referenced by insert_file_entry(), and main().

◆ merge_image

char* merge_image

Definition at line 175 of file mkisofs.c.

Referenced by main().

◆ mki_options

LOCAL const struct mki_option mki_options[]

Definition at line 1045 of file mkisofs.c.

Referenced by main(), and usage().

◆ modification_date

ldate modification_date

Definition at line 197 of file mkisofs.c.

Referenced by main(), and pvd_write().

◆ new_dir_mode

int new_dir_mode = 0555

Definition a