⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mkisofs.c

📁 一款功能很强的光盘镜象制作工具
💻 C
📖 第 1 页 / 共 5 页
字号:
/* @(#)mkisofs.c	1.120 02/11/22 joerg */#ifndef lintstatic	char sccsid[] =	"@(#)mkisofs.c	1.120 02/11/22 joerg";#endif/* * Program mkisofs.c - generate iso9660 filesystem  based upon directory * tree on hard disk.   Written by Eric Youngdale (1993).   Copyright 1993 Yggdrasil Computing, Incorporated   Copyright (c) 1999,2000,2001 J. Schilling   This program is free software; you can redistribute it and/or modify   it under the terms of the GNU General Public License as published by   the Free Software Foundation; either version 2, or (at your option)   any later version.   This program is distributed in the hope that it will be useful,   but WITHOUT ANY WARRANTY; without even the implied warranty of   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the   GNU General Public License for more details.   You should have received a copy of the GNU General Public License   along with this program; if not, write to the Free Software   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  *//* APPLE_HYB James Pearson j.pearson@ge.ucl.ac.uk 22/2/2000 */#include <mconfig.h>#include "mkisofs.h"#include <errno.h>#include <timedefs.h>#include <fctldefs.h>#include <ctype.h>#include "match.h"#include "foolhash.h"#include "exclude.h"#include <unls.h>	/* For UNICODE translation */#include <schily.h>#ifdef UDF#include "udf.h"#endif#include "getopt.h"	/* Always include local (nonstandard) getopt.h */#ifdef VMS#include "vms.h"#endif#ifdef	no_more_needed#ifdef __NetBSD__#include <sys/resource.h>#endif#endif	/* no_more_needed */struct directory *root = NULL;int		path_ind;char	version_string[] = "GNU Released by Joerg Schilling, Modified by Wwashington.\nThanks to dfbb, COMMAN at smth.edu.cn for the great help.\nmkisofs 1.15a40 +gbk +md5";char		*outfile;FILE		*discimage;unsigned int	next_extent	= 0;unsigned int	last_extent	= 0;unsigned int	session_start	= 0;unsigned int	path_table_size	= 0;unsigned int	path_table[4]	= {0,};unsigned int	path_blocks	= 0;unsigned int	jpath_table_size = 0;unsigned int	jpath_table[4]	= {0,};unsigned int	jpath_blocks	= 0;struct iso_directory_record root_record;struct iso_directory_record jroot_record;char	*extension_record = NULL;int	extension_record_extent = 0;int	extension_record_size = 0;/* These variables are associated with command line options */int	check_oldnames = 0;int	check_session = 0;int	use_eltorito = 0;int	hard_disk_boot = 0;int	not_bootable = 0;int	no_emul_boot = 0;int	load_addr = 0;int	load_size = 0;int	boot_info_table = 0;int	use_sparcboot = 0;int	use_genboot = 0;int	use_RockRidge = 0;int	use_Joliet = 0;int	use_Md5Opt = 0;int	is_rrmoved = 0;int	jlen = JMAX;	/* maximum Joliet file name length */int	verbose = 1;int	debug = 0;int	gui = 0;int	all_files = 1;	/* New default is to include all files */int     treecount = 0;int	follow_links = 0;#ifdef	IS_CYGWINint	cache_inodes = 0;/* Do not cache inodes on Cygwin by default */#elseint	cache_inodes = 1;/* Cache inodes if OS has unique inodes */#endifint	rationalize = 0;int	rationalize_uid = 0;int	rationalize_gid = 0;int	rationalize_filemode = 0;int	rationalize_dirmode = 0;uid_t	uid_to_use = 0;		/* when rationalizing uid */gid_t	gid_to_use = 0;		/* when rationalizing gid */int	filemode_to_use = 0;	/* if non-zero, when rationalizing file mode */int	dirmode_to_use = 0;	/* if non-zero, when rationalizing dir mode */int	new_dir_mode = 0555;int	generate_tables = 0;int	dopad = 1;	/* Now default to do padding */int	print_size = 0;int	split_output = 0;char	*icharset = NULL;	/* input charset to convert to UNICODE */char	*ocharset = NULL;	/* output charset to convert from UNICODE */char	*preparer = PREPARER_DEFAULT;char	*publisher = PUBLISHER_DEFAULT;char	*appid = APPID_DEFAULT;char	*copyright = COPYRIGHT_DEFAULT;char	*biblio = BIBLIO_DEFAULT;char	*abstract = ABSTRACT_DEFAULT;char	*volset_id = VOLSET_ID_DEFAULT;char	*volume_id = VOLUME_ID_DEFAULT;char	*system_id = SYSTEM_ID_DEFAULT;char	*boot_catalog = BOOT_CATALOG_DEFAULT;char	*boot_image = BOOT_IMAGE_DEFAULT;char	*genboot_image = BOOT_IMAGE_DEFAULT;int	ucs_level = 3;		/* We now have Unicode tables so use level 3 */int	volume_set_size = 1;int	volume_sequence_number = 1;struct eltorito_boot_entry_info *first_boot_entry = NULL;struct eltorito_boot_entry_info *last_boot_entry = NULL;struct eltorito_boot_entry_info *current_boot_entry = NULL;int	use_graft_ptrs;		/* Use graft points */int	jhide_trans_tbl;	/* Hide TRANS.TBL from Joliet tree */int	hide_rr_moved;		/* Name RR_MOVED .rr_moved in Rock Ridge tree */int	omit_period = 0;	/* Violates iso9660, but these are a pain */int	transparent_compression = 0; /* So far only works with linux */int	omit_version_number = 0;/* May violate iso9660, but noone uses vers */int	no_rr = 0;		/* Do not use RR attributes from old session */int	force_rr = 0;		/* Force to use RR attributes from old session */Uint	RR_relocation_depth = 6;/* Violates iso9660, but most systems work */int	iso9660_level = 1;int	iso9660_namelen = LEN_ISONAME; /* 31 characters, may be set to 37 */int	full_iso9660_filenames = 0; /* Full 31 character iso9660 filenames */int	relaxed_filenames = 0;	/* For Amiga.  Disc will not work with DOS */int	gbk4dos_filenames = 0;	/* For GbChs.  Disc possible work with DOS */int	gbk4win_filenames = 0;	/* For GbChs.  Disc possible work with WIN */int	allow_lowercase = 0;	/* Allow lower case letters */int	allow_multidot = 0;	/* Allow more than on dot in filename */int	iso_translate = 1;	/* 1 == enables '#', '-' and '~' removal */int	allow_leading_dots = 0;	/* DOS cannot read names with leading dots */#ifdef	VMSint	use_fileversion = 1;	/* Use file version # from filesystem */#elseint	use_fileversion = 0;	/* Use file version # from filesystem */#endifint	split_SL_component = 1;	/* circumvent a bug in the SunOS driver */int	split_SL_field = 1;	/* circumvent a bug in the SunOS */char	*trans_tbl = "TRANS.TBL"; /* default name for translation table */#ifdef APPLE_HYBint	apple_hyb = 0;		/* create HFS hybrid flag */int	apple_ext = 0;		/* create HFS extensions flag */int	apple_both = 0;		/* common flag (for above) */int	hfs_extra = 0;		/* extra HFS blocks added to end of ISO vol */int	use_mac_name = 0;	/* use Mac name for ISO/Joliet/RR flag */hce_mem	*hce;			/* libhfs/mkisofs extras */char	*hfs_boot_file = 0;	/* name of HFS boot file */int	gen_pt = 0;		/* generate HFS partition table */char	*autoname = 0;		/* AutoStart filename */char	*magic_file = 0;	/* name of magic file */int	probe = 0;		/* search files for HFS/Unix type */int	nomacfiles = 0;		/* don't look for Mac/Unix files */int	hfs_select = 0;		/* Mac/Unix types to select */int	create_dt = 1;		/* create the Desktp files */int	afe_size = 0;		/* Apple File Exchange block size */int	hfs_last = MAG_LAST;	/* process magic file after map file */char	*deftype = APPLE_TYPE_DEFAULT;	/* default Apple TYPE */char	*defcreator = APPLE_CREATOR_DEFAULT;	/* default Apple CREATOR */char	*hfs_volume_id = NULL;	/* HFS volume ID */int	icon_pos = 0;		/* Keep icon position */char	*hfs_icharset = NULL;	/* input HFS charset name */char    *hfs_ocharset = NULL;	/* output HFS charset name */int	hfs_lock = 1;		/* lock HFS volume (read-only) */char	*hfs_bless = NULL;	/* name of folder to 'bless' (System Folder) */char	*hfs_parms = NULL;	/* low level HFS parameters */#ifdef PREP_BOOTchar	*prep_boot_image[4];int	use_prep_boot = 0;#endif	/* PREP_BOOT */#endif	/* APPLE_HYB */#ifdef UDFint	use_udf = 0;#endif#ifdef DVD_VIDEOint	dvd_video = 0;#endif#ifdef SORTINGint	do_sort = 0;		/* sort file data */#endif /* SORTING */struct nls_table *in_nls = NULL;  /* input UNICODE conversion table */struct nls_table *out_nls = NULL; /* output UNICODE conversion table */#ifdef APPLE_HYBstruct nls_table *hfs_inls = NULL; /* input HFS UNICODE conversion table */struct nls_table *hfs_onls = NULL; /* output HFS UNICODE conversion table */#endif /* APPLE_HYB */struct hash_table *md5_hash=NULL;struct rcopts {	char		*tag;	char		**variable;};struct rcopts rcopt[] = {	{"PREP", &preparer},	{"PUBL", &publisher},	{"APPI", &appid},	{"COPY", &copyright},	{"BIBL", &biblio},	{"ABST", &abstract},	{"VOLS", &volset_id},	{"VOLI", &volume_id},	{"SYSI", &system_id},#ifdef APPLE_HYB	{"HFS_TYPE", &deftype},	{"HFS_CREATOR", &defcreator},#endif	/* APPLE_HYB */	{NULL, NULL}};/* * In case it isn't obvious, the option handling code was ripped off * from GNU-ld. */struct ld_option {	/* The long option information.  */	struct option	opt;	/* The short option with the same meaning ('\0' if none).  */	char		shortopt;	/* The name of the argument (NULL if none).  */	const char	*arg;	/*	 * The documentation string.  If this is NULL, this is a synonym for	 * the previous option.	 */	const char	*doc;	enum {		/* Use one dash before long option name.  */		ONE_DASH,		/* Use two dashes before long option name.  */		TWO_DASHES,		/* Don't mention this option in --help output.  */		NO_HELP	} control;};/* * Codes used for the long options with no short synonyms. Note that all these * values must not be ASCII or EBCDIC. */#define OPTION_HELP			1000#define OPTION_QUIET			1001#define OPTION_NOSPLIT_SL_COMPONENT	1002#define OPTION_NOSPLIT_SL_FIELD		1003#define OPTION_PRINT_SIZE		1004#define OPTION_SPLIT_OUTPUT		1005#define OPTION_ABSTRACT			1006#define OPTION_BIBLIO			1007#define OPTION_COPYRIGHT		1008#define OPTION_SYSID			1009#define OPTION_VOLSET			1010#define OPTION_VOLSET_SIZE		1011#define OPTION_VOLSET_SEQ_NUM		1012#define OPTION_I_HIDE			1013#define OPTION_J_HIDE			1014#define OPTION_LOG_FILE			1015#define OPTION_PVERSION			1016#define OPTION_NOBAK			1017#define OPTION_SPARCLABEL		1018#define OPTION_HARD_DISK_BOOT		1019#define OPTION_NO_EMUL_BOOT		1020#define OPTION_NO_BOOT			1021#define OPTION_BOOT_LOAD_ADDR		1022#define OPTION_BOOT_LOAD_SIZE		1023#define OPTION_BOOT_INFO_TABLE		1024#define OPTION_HIDE_TRANS_TBL		1025#define OPTION_HIDE_RR_MOVED		1026#define OPTION_GUI			1027#define OPTION_TRANS_TBL		1028#define OPTION_P_LIST			1029#define OPTION_I_LIST			1030#define OPTION_J_LIST			1031#define OPTION_X_LIST			1032#define OPTION_NO_RR			1033#define OPTION_JCHARSET			1034#define OPTION_PAD			1035#define OPTION_H_HIDE			1036#define OPTION_H_LIST			1037#define OPTION_CHECK_OLDNAMES		1038#ifdef SORTING#define OPTION_SORT			1039#endif /* SORTING */#define OPTION_UCS_LEVEL		1040#define OPTION_ISO_TRANSLATE		1041#define OPTION_ISO_LEVEL		1042#define OPTION_RELAXED_FILENAMES	1043#define OPTION_GBK4DOS_FILENAMES	1098#define OPTION_GBK4WIN_FILENAMES	1099#define OPTION_ALLOW_LOWERCASE		1044#define OPTION_ALLOW_MULTIDOT		1045#define OPTION_USE_FILEVERSION		1046#define OPTION_MAX_FILENAMES		1047#define OPTION_ALT_BOOT			1048#define OPTION_USE_GRAFT		1049#define OPTION_INPUT_CHARSET		1050#define OPTION_OUTPUT_CHARSET		1051#define OPTION_NOPAD			1052#define OPTION_UID			1053#define OPTION_GID			1054#define OPTION_FILEMODE			1055#define OPTION_DIRMODE			1056#define OPTION_NEW_DIR_MODE		1057#define OPTION_CACHE_INODES		1058#define OPTION_NOCACHE_INODES		1059#define OPTION_CHECK_SESSION		1060#define OPTION_FORCE_RR			1061#define OPTION_DEBUG			1062#define OPTION_JLONG			1063#ifdef UDF#define OPTION_UDF			1500#endif#ifdef DVD_VIDEO#define OPTION_DVD			1501#endif#ifdef APPLE_HYB#define OPTION_CAP			2000#define OPTION_NETA			2001#define OPTION_DBL			2002#define OPTION_ESH			2003#define OPTION_FE			2004#define OPTION_SGI			2005#define OPTION_MBIN			2006#define OPTION_SGL			2007/* aliases */#define OPTION_USH			2008#define OPTION_XIN			2009#define OPTION_DAVE			2010#define OPTION_SFM			2011#define OPTION_XDBL			2012#define OPTION_XHFS			2013#define OPTION_PROBE			2020#define OPTION_MACNAME			2021#define OPTION_NOMACFILES		2022#define OPTION_BOOT_HFS_FILE		2023#define OPTION_MAGIC_FILE		2024#define OPTION_HFS_LIST			2025#define OPTION_GEN_PT			2026#define OPTION_CREATE_DT		2027#define OPTION_HFS_HIDE			2028#define OPTION_AUTOSTART		2029#define OPTION_BSIZE			2030#define OPTION_HFS_VOLID		2031#define OPTION_PREP_BOOT		2032#define OPTION_ICON_POS			2033#define OPTION_HFS_TYPE			2034#define OPTION_HFS_CREATOR		2035#define OPTION_ROOT_INFO		2036#define OPTION_HFS_INPUT_CHARSET	2037#define OPTION_HFS_OUTPUT_CHARSET	2038#define OPTION_HFS_UNLOCK		2039#define OPTION_HFS_BLESS		2040#define OPTION_HFS_PARMS		2041#endif	/* APPLE_HYB */static int	save_pname = 0;static const struct ld_option ld_options[] ={	{{"nobak", no_argument, NULL, OPTION_NOBAK},	'\0', NULL, "Do not include backup files", ONE_DASH},	{{"no-bak", no_argument, NULL, OPTION_NOBAK},	'\0', NULL, "Do not include backup files", ONE_DASH},	{{"abstract", required_argument, NULL, OPTION_ABSTRACT},	'\0', "FILE", "Set Abstract filename", ONE_DASH},	{{"appid", required_argument, NULL, 'A'},	'A', "ID", "Set Application ID", ONE_DASH},	{{"biblio", required_argument, NULL, OPTION_BIBLIO},	'\0', "FILE", "Set Bibliographic filename", ONE_DASH},	{{"cache-inodes", no_argument, NULL, OPTION_CACHE_INODES},	'\0', NULL, "Cache inodes (needed to detect hard links)", ONE_DASH},	{{"no-cache-inodes", no_argument, NULL, OPTION_NOCACHE_INODES},	'\0', NULL, "Do not cache inodes (if filesystem has no unique unides)", ONE_DASH},	{{"check-oldnames", no_argument, NULL, OPTION_CHECK_OLDNAMES},	'\0', NULL, "Check all imported ISO9660 names from old session", ONE_DASH},	{{"check-session", required_argument, NULL, OPTION_CHECK_SESSION},	'\0', "FILE", "Check all ISO9660 names from previous session", ONE_DASH},	{{"copyright", required_argument, NULL, OPTION_COPYRIGHT},	'\0', "FILE", "Set Copyright filename", ONE_DASH},	{{"debug", no_argument, NULL, OPTION_DEBUG},	'\0', NULL, "Set debug flag", ONE_DASH},	{{"eltorito-boot", required_argument, NULL, 'b'},	'b', "FILE", "Set El Torito boot image name", ONE_DASH},	{{"eltorito-alt-boot", no_argument, NULL, OPTION_ALT_BOOT},	'\0', NULL, "Start specifying alternative El Torito boot parameters", ONE_DASH},	{{"sparc-boot", required_argument, NULL, 'B'},	'B', "FILES", "Set sparc boot image names", ONE_DASH},	{{"generic-boot", required_argument, NULL, 'G'},	'G', "FILE", "Set generic boot image name", ONE_DASH},	{{"sparc-label", required_argument, NULL, OPTION_SPARCLABEL},	'\0', "label text", "Set sparc boot disk label", ONE_DASH},	{{"eltorito-catalog", required_argument, NULL, 'c'},	'c', "FILE", "Set El Torito boot catalog name", ONE_DASH},	{{"cdrecord-params", required_argument, NULL, 'C'},	'C', "PARAMS", "Magic paramters from cdrecord", ONE_DASH},	{{"omit-period", no_argument, NULL, 'd'},	'd', NULL, "Omit trailing periods from filenames (violates ISO9660)", ONE_DASH},	{{"dir-mode", required_argument, NULL, OPTION_DIRMODE},	 '\0', "mode", "Make the mode of all directories this mode.", ONE_DASH},	{{"disable-deep-relocation", no_argument, NULL, 'D'},	'D', NULL, "Disable deep directory relocation (violates ISO9660)", ONE_DASH},	{{"file-mode", required_argument, NULL, OPTION_FILEMODE},	 '\0', "mode", "Make the mode of all plain files this mode.", ONE_DASH},	{{"follow-links", no_argument, NULL, 'f'},	'f', NULL, "Follow symbolic links", ONE_DASH},	{{"gid", required_argument, NULL, OPTION_GID},	 '\0', "gid", "Make the group owner of all files this gid.",	 ONE_DASH},	{{"graft-points", no_argument, NULL, OPTION_USE_GRAFT},	'\0', NULL, "Allow to use graft points for filenames", ONE_DASH},	{{"help", no_argument, NULL, OPTION_HELP},	'\0', NULL, "Print option help", ONE_DASH},

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -