You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2824 lines
103 KiB

/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images.
Copyright 2007-2020 Thomas Schmitt, <scdbackup@gmx.net>
Provided under GPL version 2 or later.
This file contains the implementation of emulators for mkisofs and cdrecord.
*/
#ifdef HAVE_CONFIG_H
#include "../config.h"
#endif
#include <ctype.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <time.h>
#include <fcntl.h>
#include <errno.h>
#include "xorriso.h"
#include "xorriso_private.h"
#include "xorrisoburn.h"
int Xorriso_cdrskin_uses_stdout(struct XorrisO *xorriso, int argc, char **argv,
int flag)
{
int i;
for(i= 0; i < argc; i++) {
if(strcmp(argv[i], "dev=-") == 0 ||
strcmp(argv[i], "dev=stdio:/dev/fd/1") == 0 ||
strcmp(argv[i], "-dev=-") == 0 ||
strcmp(argv[i], "-dev=stdio:/dev/fd/1") == 0)
return(1);
}
return(0);
}
int Xorriso_cdrskin_help(struct XorrisO *xorriso, int flag)
{
static char helptext[][80]= {
"Usage: xorriso -as cdrecord [options|source_addresses]",
"Note: This is not cdrecord. See xorriso -help, xorriso -version, man xorrecord",
"Options:",
"\t-version\tprint version information and exit emulation",
"\t--devices\tprint list of available MMC drives and exit emulation",
"\tdev=target\tpseudo-SCSI target to use as CD-Recorder",
"\tdrive_scsi_dev_family=sr|scd|sg\t\tselect Linux device type",
"\t--drive_not_exclusive\tdo not try to prevent use of busy drive",
"\t-v\t\tincrement verbose level by one",
"\t-V\t\tincrement SCSI command transport verbose level by one",
"\t-checkdrive\tcheck if a driver for the drive is present",
"\t-inq\t\tdo an inquiry for the drive",
"\tspeed=#\t\tset speed of drive",
"\tblank=type\tblank a CD-RW disc (see blank=help)",
"\tfs=#\t\tSet fifo size to # (0 to disable, default is 4 MB)",
"\t-eject\t\teject the disk after doing the work",
"\t-dummy\t\tdo everything with laser turned off",
"\t-msinfo\t\tretrieve multi-session info for mkisofs >= 1.10",
"\t-toc\t\tretrieve and print TOC/PMA data",
"\t-atip\t\tretrieve media state, print \"Is *erasable\"",
"\t-multi\t\tgenerate a TOC that allows multi session",
"\t--multi_if_possible\tapply -multi if the medium supports it",
"\t-waiti\t\twait until input is available before opening SCSI",
"\t-tao\t\tWrite disk in TAO mode.",
"\t-dao\t\tWrite disk in SAO mode.",
"\t-sao\t\tWrite disk in SAO mode.",
"\ttsize=#\t\tannounces exact size of source data",
"\tpadsize=#\tAmount of padding",
"\t-data\t\tSubsequent tracks are CD-ROM data mode 1 (default)",
"\t-isosize\tUse iso9660 file system size for next data track",
"\t-pad\t\tpadsize=30k",
"\t-nopad\t\tDo not pad",
"\tminbuf=\t\tKeep drive buffer hungry",
"\tmodesty_on_drive=\tLike minbuf=, but with more parameters",
"\t-immed\t\tEquivalent to minbuf=75",
"\t--grow_overwriteable_iso\temulate multi-session on DVD+RW, BD-RE",
"\twrite_start_address=#\t\twrite to byte address on DVD+RW, BD-RE",
"\tstream_recording=on|number\ttry to get full speed on DVD-RAM, BD",
"\tuse_immed_bit=on|off|default\tcontrol use of Immed bit",
"\tdvd_obs=default|32k|64k\t\tbytes per DVD/BD write operation",
"\tstdio_sync=on|off|end|number\twhether to fsync output to \"stdio:\"",
"\t--no_rc\t\tDo not execute xorriso startup files",
"\t-help\t\tprint this text to stderr and exit emulation",
"Actually this is the integrated ISO RockRidge filesystem manipulator xorriso",
"lending its libburn capabilities to a very limited cdrecord emulation. Only",
"a single data track can be burnt to blank, appendable or overwritable media.",
"A much more elaborate cdrecord emulator is cdrskin from the libburn package.",
"",
#ifdef Xorriso_GNU_xorrisO
"Report bugs to: bug-xorriso@gnu.org , or in private to: scdbackup@gmx.net .",
"xorriso home page: <https://www.gnu.org/software/xorriso/>",
"General help using GNU software: <https://www.gnu.org/gethelp/>",
#else
"Report any bugs to bug-xorriso@gnu.org or in private to scdbackup@gmx.net .",
#endif
"@End_of_helptexT@"
};
int i;
for(i= 0; strcmp(helptext[i], "@End_of_helptexT@")!=0; i++) {
sprintf(xorriso->info_text, "%s\n", helptext[i]);
Xorriso_info(xorriso,0);
}
return(1);
}
/* micro version of cdrskin */
int Xorriso_cdrskin(struct XorrisO *xorriso, char *whom, int argc, char **argv,
int flag)
{
int ret, i, k, mem_do_close, aq_ret, eject_ret, msc1, msc2, hflag;
int do_atip= 0, do_checkdrive= 0, do_eject= 0, do_scanbus= 0;
int do_toc= 0, do_verbous= 0, do_version= 0, do_help= 0, do_waiti= 0;
int do_multi= 0, do_msinfo= 0, do_grow= 0, do_isosize= 0, do_xa1= 0;
int do_auto_close= 0;
double write_start_address= -1.0, tsize= -1.0, mem_auto_close;
char *track_source= NULL, *dev_adr= NULL, *cpt;
char mem_report_about_text[80], *report_about= "SORRY", blank_mode[80];
char speed[80], *argpt;
/* cdrecord 2.01 options which are not scheduled for implementation, yet */
static char ignored_partial_options[][41]= {
"timeout=", "debug=", "kdebug=", "kd=", "driver=", "ts=",
"pregap=", "defpregap=", "mcn=", "isrc=", "index=", "textfile=",
"pktsize=", "cuefile=",
"gracetime=",
"assert_write_lba=", "fifo_start_at=", "dev_translation=",
"fallback_program=",
"tao_to_sao_tsize=",
"direct_write_amount=", "msifile=",
""
};
static char ignored_full_options[][41]= {
"-d", "-silent", "-s", "-setdropts", "-prcap",
"-reset", "-abort", "-overburn", "-ignsize", "-useinfo",
"-fix", "-nofix",
"-raw", "-raw96p", "-raw16",
"-clone", "-text",
"-cdi", "-preemp", "-nopreemp", "-copy", "-nocopy",
"-scms", "-shorttrack", "-noshorttrack", "-packet", "-noclose",
"-media-info", "-minfo",
"-load", "-lock", "-raw96r", "-swab",
"-force", "-format",
"--adjust_speed_to_drive", "--allow_emulated_drives", "--allow_setuid",
"--allow_untested_media", "--any_track", "--demand_a_drive",
"--fifo_disable", "--fifo_start_empty", "--fill_up_media",
"--list_ignored_options", "--no_rc", "--no_convert_fs_adr",
"--prodvd_cli_compatible", "--single_track",
"--tell_media_space",
""
};
static char blank_help[][80]= {
"Blanking options:",
"\tall\t\tblank the entire disk",
"\tdisc\t\tblank the entire disk",
"\tdisk\t\tblank the entire disk",
"\tfast\t\tminimally blank the entire disk",
"\tminimal\t\tminimally blank the entire disk",
"\tas_needed\tblank or format medium to make it ready for (re-)use",
"\tdeformat\t\tblank a formatted DVD-RW",
"\tdeformat_quickest\tminimally blank a formatted DVD-RW to DAO only",
"\tformat_overwrite\tformat a DVD-RW to \"Restricted Overwrite\"",
"@End_of_helptexT@"
};
mem_do_close= xorriso->do_close;
mem_auto_close= xorriso->auto_close;
Xorriso_alloc_meM(track_source, char, SfileadrL);
Xorriso_alloc_meM(dev_adr, char, SfileadrL);
strcpy(mem_report_about_text, xorriso->report_about_text);
track_source[0]= 0;
dev_adr[0]= 0;
blank_mode[0]= 0;
speed[0]= 0;
if(xorriso->in_drive_handle != NULL) {
ret= Xorriso_option_dev(xorriso, "", 1|32); /* give up indev */
if(ret!=1)
goto ex;
}
/* Assess plan, make settings */
for(i= 0; i<argc; i++) {
sprintf(xorriso->info_text, "-as %s: ", whom);
Text_shellsafe(argv[i], xorriso->info_text, 1);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0);
argpt= argv[i];
if (strncmp(argpt, "--", 2) == 0 && strlen(argpt) > 3)
argpt++;
for(k=0;ignored_partial_options[k][0]!=0;k++) {
if(argpt[0]=='-')
if(strncmp(argpt+1,ignored_partial_options[k],
strlen(ignored_partial_options[k]))==0) {
argpt++;
goto no_volunteer;
}
if(strncmp(argpt,ignored_partial_options[k],
strlen(ignored_partial_options[k]))==0)
goto no_volunteer;
}
for(k=0;ignored_full_options[k][0]!=0;k++)
if(strcmp(argpt,ignored_full_options[k])==0)
goto no_volunteer;
if(0) {
no_volunteer:;
sprintf(xorriso->info_text, "-as %s: Ignored option ", whom);
Text_shellsafe(argpt, xorriso->info_text, 1);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
continue;
}
if(strcmp(argpt, "-atip")==0) {
do_atip= 1;
} else if(strcmp(argpt, "-audio")==0) {
sprintf(xorriso->info_text, "-as %s: Option -audio not supported.", whom);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
ret= 0; goto ex;
} else if(strncmp(argpt, "-blank=", 7)==0 ||
strncmp(argpt, "blank=", 6)==0) {
cpt= strchr(argpt, '=')+1;
if(strcmp(cpt,"all")==0 || strcmp(cpt,"disc")==0
|| strcmp(cpt,"disk")==0) {
strcpy(blank_mode, "all");
} else if(strcmp(cpt,"fast")==0 || strcmp(cpt,"minimal")==0) {
strcpy(blank_mode, "fast");
} else if(strcmp(cpt,"help")==0) {
strcpy(blank_mode, "help");
} else if(strcmp(cpt,"deformat")==0 ||
strcmp(cpt,"deformat_sequential")==0 ||
strcmp(cpt,"deformat_quickest")==0 ||
strcmp(cpt,"deformat_sequential_quickest")==0) {
strcpy(blank_mode, cpt);
} else if(strcmp(cpt,"format_overwrite")==0) {
strcpy(blank_mode, "format_overwrite");
} else if(strcmp(cpt,"as_needed")==0) {
strcpy(blank_mode, "as_needed");
} else {
sprintf(xorriso->info_text, "-as %s: blank=", whom);
Text_shellsafe(cpt, xorriso->info_text, 1);
strcat(xorriso->info_text, " not supported. See blank=help .");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
ret= 0; goto ex;
}
} else if(strcmp(argpt, "-checkdrive")==0) {
do_checkdrive= 1;
} else if(strcmp(argpt, "-dao")==0) {
xorriso->do_tao= -1;
} else if(strcmp(argpt, "-data")==0) {
/* ok */;
} else if(strncmp(argpt, "-dev=", 5)==0 ||
strncmp(argpt, "dev=", 4)==0) {
cpt= strchr(argpt, '=')+1;
strcpy(dev_adr, cpt);
} else if(strcmp(argv[i], "--devices")==0) { /* intentional: argv[i] */
do_scanbus= 2;
} else if(strcmp(argv[i], "--drive_not_exclusive") == 0) { /* intentional */
Xorriso_option_drive_access(xorriso, "shared:unrestricted", 0);
} else if(strncmp(argpt,"driveropts=", 11)==0 ||
strncmp(argpt,"-driveropts=", 12)==0) {
if(strcmp(argpt+11, "help")==0) {
fprintf(stderr,"Driver options:\n");
fprintf(stderr,
"burnfree\tPrepare writer to use BURN-Free technology\n");
}
} else if(strcmp(argpt, "-dummy")==0) {
xorriso->do_dummy= 1;
} else if(strncmp(argpt, "-dvd_obs=", 9)==0 ||
strncmp(argpt, "dvd_obs=", 8)==0) {
cpt= strchr(argpt, '=') + 1;
Xorriso_option_dvd_obs(xorriso, cpt, 0);
} else if(strcmp(argpt, "-eject")==0) {
do_eject= 1;
} else if(strncmp(argpt, "-fs=", 4)==0 || strncmp(argpt, "fs=", 3)==0) {
cpt= strchr(argpt, '=')+1;
ret= Xorriso_option_fs(xorriso, cpt, 0);
if(ret<=0)
goto ex;
} else if(strcmp(argv[i], "--grow_overwriteable_iso")==0 ||
strcmp(argv[i], "--grow_overwritable_iso")==0 ||
strcmp(argv[i], "--grow_overriteable_iso")==0
) { /* (A history of typos) */
/* intentional: argv[i] */
do_grow= 1;
} else if(strcmp(argpt, "-help")==0) {
do_help= 1;
} else if(strcmp(argpt, "-isosize")==0) {
do_isosize= 1;
} else if(strcmp(argpt, "-inq")==0) {
do_checkdrive= 2;
} else if(strcmp(argpt, "-mode2")==0) {
Xorriso_msgs_submit(xorriso, 0,
"Defaulting option -mode2 to option -data", 0, "NOTE", 0);
} else if(strcmp(argpt, "-msinfo")==0) {
do_msinfo= 1;
} else if(strcmp(argpt, "-multi")==0) {
do_multi= 1;
do_auto_close= 0;
} else if(strcmp(argv[i], "--multi_if_possible") == 0) {
do_multi= 1;
do_auto_close= 1;
} else if(strcmp(argpt, "-nopad")==0) {
xorriso->padding= 0;
} else if(strcmp(argv[i], "--no_rc")==0) { /* intentional: argv[i] */
/* already performed in Xorriso_prescan_args */;
} else if(strcmp(argpt, "-pad")==0) {
xorriso->padding= 15*2048;
} else if(strncmp(argpt, "-padsize=", 9)==0 ||
strncmp(argpt, "padsize=", 8)==0) {
cpt= strchr(argpt, '=')+1;
ret= Xorriso_option_padding(xorriso, cpt, 0);
if(ret<=0)
goto ex;
} else if(strcmp(argpt, "-sao")==0) {
xorriso->do_tao= -1;
} else if(strcmp(argpt, "-scanbus")==0) {
sprintf(xorriso->info_text, "-as %s: Option -scanbus not supported.",
whom);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
ret= 0; goto ex;
} else if(strncmp(argpt, "-speed=", 7)==0 ||
strncmp(argpt, "speed=", 6)==0) {
cpt= strchr(argpt, '=')+1;
strncpy(speed, cpt, 79);
speed[79]= 0;
} else if(strncmp(argpt, "-stream_recording=", 18)==0 ||
strncmp(argpt, "stream_recording=", 17)==0) {
cpt= strchr(argpt, '=')+1;
Xorriso_option_stream_recording(xorriso, cpt, 0);
} else if(strncmp(argpt, "-use_immed_bit=", 15) == 0 ||
strncmp(argpt, "use_immed_bit=", 14) == 0) {
cpt= strchr(argpt, '=') + 1;
Xorriso_option_use_immed_bit(xorriso, cpt, 0);
} else if(strcmp(argpt, "-immed") == 0) {
Xorriso_option_modesty_on_drive(xorriso, "75", 0);
} else if(strncmp(argpt, "-minbuf=", 8) == 0 ||
strncmp(argpt, "minbuf=", 7) == 0 ||
strncmp(argpt, "-modesty_on_drive=", 18) == 0 ||
strncmp(argpt, "modesty_on_drive=", 17) == 0) {
cpt= strchr(argpt, '=') + 1;
Xorriso_option_modesty_on_drive(xorriso, cpt, 0);
} else if(strncmp(argpt, "-drive_scsi_dev_family=", 23) == 0 ||
strncmp(argpt, "drive_scsi_dev_family=", 22) == 0) {
cpt= strchr(argpt, '=') + 1;
Xorriso_option_scsi_dev_family(xorriso, cpt, 0);
} else if(strncmp(argpt, "-stdio_sync=", 12)==0 ||
strncmp(argpt, "stdio_sync=", 11)==0) {
cpt= strchr(argpt, '=') + 1;
Xorriso_option_stdio_sync(xorriso, cpt, 0);
} else if(strcmp(argpt, "-tao")==0) {
xorriso->do_tao= 1;
} else if(strcmp(argpt, "-toc")==0 || strcmp(argv[i], "--long_toc")==0) {
/* intentional: argpt , argv[i] */
do_toc= 1;
} else if(strncmp(argpt, "-tsize=", 7)==0 ||
strncmp(argpt, "tsize=", 6)==0) {
cpt= strchr(argpt, '=')+1;
tsize= Scanf_io_size(cpt, 1);
if(tsize > 1024.0*1024.0*1024.0*1024.0*1024.0) {
sprintf(xorriso->info_text, "-as %s: much too large: %s",whom, argpt);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
ret= 0; goto ex;
}
} else if(strcmp(argv[i], "-V")==0 || strcmp(argpt,"-Verbose")==0) {
Xorriso_option_scsi_log(xorriso, "on", 0);
} else if(strcmp(argv[i], "-v")==0 || strcmp(argpt,"-verbose")==0) {
do_verbous++;
} else if(strcmp(argv[i], "-vv")==0) { /* intentional: argv[i] */
do_verbous+= 2;
} else if(strcmp(argv[i], "-vvv")==0) { /* intentional: argv[i] */
do_verbous+= 3;
} else if(strcmp(argpt, "-version")==0) {
do_version= 1;
} else if(strcmp(argpt, "-waiti")==0) {
do_waiti= 1;
} else if(strncmp(argv[i], "write_start_address=", 20)==0) {
/* intentional: argv[i] */
write_start_address= Scanf_io_size(argv[i]+20,0);
} else if(strcmp(argpt, "-xa")==0) {
Xorriso_msgs_submit(xorriso, 0,
"Defaulting option -xa to option -data", 0, "NOTE", 0);
} else if(strcmp(argpt, "-xa1")==0) {
if(do_xa1 == 0)
do_xa1= 1;
} else if(strcmp(argv[i], "--xa1-ignore")==0) { /* intentional: argv[i] */
do_xa1= -1;
} else if(strcmp(argpt, "-xa2")==0) {
Xorriso_msgs_submit(xorriso, 0,
"Defaulting option -xa2 to option -data", 0, "NOTE", 0);
} else if(strcmp(argpt, "-xamix")==0) {
Xorriso_msgs_submit(xorriso, 0,
"Option -xamix not implemented and data not yet convertible to other modes",
0, "FATAL", 0);
ret= 0; goto ex;
} else if(argpt[0]=='-' && argpt[1]!=0) {
sprintf(xorriso->info_text, "-as %s: Unknown option ", whom);
Text_shellsafe(argv[i], xorriso->info_text, 1);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
ret= 0; goto ex;
} else {
if(track_source[0]) {
sprintf(xorriso->info_text, "-as %s: Surplus track source ", whom);
Text_shellsafe(argv[i], xorriso->info_text, 1);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
sprintf(xorriso->info_text, "First and only track source is ");
Text_shellsafe(track_source, xorriso->info_text, 1);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
ret= 0; goto ex;
}
if(Sfile_str(track_source, argv[i], 0)<=0)
{ret= -1; goto ex;}
}
}
/* Perform actions */
Xorriso_option_report_about(xorriso, "NOTE", 0);
if(do_version) {
sprintf(xorriso->result_line, "Cdrecord 2.01-Emulation Copyright (C) 2019 see libburnia-project.org xorriso\n");
Xorriso_result(xorriso, 1);
Xorriso_option_version(xorriso, 0);
}
if(do_help) {
Xorriso_cdrskin_help(xorriso, 0);
}
if(strcmp(blank_mode, "help")==0) {
for(i= 0; strcmp(blank_help[i], "@End_of_helptexT@")!=0; i++) {
sprintf(xorriso->info_text, "%s\n", blank_help[i]);
Xorriso_info(xorriso,0);
}
}
if(do_help || strcmp(blank_mode, "help") == 0 || do_version) {
ret= 1; goto ex;
}
if(do_verbous<=0)
report_about= "NOTE";
else if(do_verbous<=2)
report_about= "UPDATE";
else if(do_verbous==3)
report_about= "DEBUG";
else
report_about= "ALL";
Xorriso_option_report_about(xorriso, report_about, 0);
if(do_scanbus) {
if(do_scanbus==1)
/* >>> would need -scanbus compatible output and input format */;
else
Xorriso_option_devices(xorriso, 0);
ret= 1; goto ex;
}
if(!(do_checkdrive || do_atip || do_toc || blank_mode[0] || track_source[0] ||
do_eject || do_msinfo)) {
sprintf(xorriso->info_text,
"-as cdrskin: No option specified, which would cause an action.");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
ret= 1; goto ex;
}
if(do_waiti) {
sprintf(xorriso->info_text,
"xorriso: Option -waiti pauses program until input appears at stdin\n");
Xorriso_info(xorriso,0);
sprintf(xorriso->result_line, "Waiting for data on stdin...\n");
Xorriso_result(xorriso, 1);
for(ret= 0; ret==0; )
ret= Wait_for_input(0,1000000,0);
if(ret<0 || feof(stdin)) {
Xorriso_msgs_submit(xorriso, 0,
"stdin produces exception rather than data", 0, "NOTE", 0);
}
sprintf(xorriso->info_text, "xorriso: Option -waiti pausing is done.\n");
}
if(dev_adr[0]) {
hflag= 2 | 64; /* ts B11201 no more: | 32 */
if(!do_grow)
hflag|= 8; /* consider overwritables as blank */
ret= Xorriso_option_dev(xorriso, dev_adr, hflag);
if(ret<=0)
goto ex;
}
if(xorriso->out_drive_handle==NULL) {
sprintf(xorriso->info_text, "-as %s: No output drive selected", whom);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
ret= 0; goto ex;
}
if(do_msinfo) {
ret= Xorriso_msinfo(xorriso, &msc1, &msc2, 2 | !!do_grow);
if(ret<=0)
goto ex;
sprintf(xorriso->result_line, "%d,%d\n", msc1, msc2);
Xorriso_result(xorriso, 1);
}
if(speed[0]) {
ret= Xorriso_option_speed(xorriso, speed, 0);
if(ret<=0)
goto ex;
}
if(do_checkdrive) {
ret= Xorriso_atip(xorriso, 2-(do_checkdrive==2));
if(ret<=0)
goto ex;
}
if(do_atip) {
ret= Xorriso_atip(xorriso, 0);
if(ret<=0)
goto ex;
}
if(do_toc) {
ret= Xorriso_option_toc(xorriso, 0);
if(ret<=0)
goto ex;
}
if(strcmp(blank_mode, "format_overwrite")==0) {
ret= Xorriso_option_blank(xorriso, "fast", 1);
if(ret<=0)
goto ex;
} else if(blank_mode[0]) {
ret= Xorriso_option_blank(xorriso, blank_mode, 0);
if(ret<=0)
goto ex;
}
if(track_source[0]) {
xorriso->do_close= !do_multi;
xorriso->auto_close= do_auto_close;
ret= Xorriso_burn_track(xorriso, (off_t) write_start_address,
track_source, (off_t) tsize,
(!!do_grow) | ((!!do_isosize) << 1) | ((do_xa1 == 1) << 2));
if(ret == 2) {
ret= Xorriso_retry_burn_track(xorriso, (off_t) write_start_address,
track_source, (off_t) tsize,
(!!do_grow) | ((!!do_isosize) << 1) | ((do_xa1 == 1) << 2));
}
aq_ret= Xorriso_reaquire_outdev(xorriso, 2*(ret>0));
if(ret<=0 && ret<aq_ret)
goto ex;
if(aq_ret<=0)
{ret= aq_ret; goto ex;}
}
ret= 1;
ex:;
if(do_eject && ret>=0) {
eject_ret= Xorriso_option_eject(xorriso, "out", 0);
if(eject_ret<ret)
ret= eject_ret;
}
if(ret<=0) {
sprintf(xorriso->info_text, "-as %s: Job could not be performed properly.",
whom);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
}
Xorriso_option_report_about(xorriso, mem_report_about_text, 0);
xorriso->do_close= mem_do_close;
xorriso->auto_close= mem_auto_close;
Xorriso_free_meM(dev_adr);
Xorriso_free_meM(track_source);
return(ret);
}
/* This function shall know all options of mkisofs, genisoimage, xorrisofs, ...
and the number of arguments which they expect and consume.
*/
int Xorriso_genisofs_count_args(struct XorrisO *xorriso, int argc, char **argv,
int *count, int flag)
{
int i;
char *cmd;
static char partial_options[][41]= {
"errctl=",
"isolinux_mbr=", "--modification-date=",
""
};
static char arg0_options[][41]= {
"-allow-leading-dots", "-ldots", "-allow-lowercase", "-allow-multidot",
"-cache-inodes", "-no-cache-inodes", "-eltorito-alt-boot",
"-hard-disk-boot", "-no-emul-boot", "-no-boot", "-boot-info-table",
"-check-oldnames", "-d", "-D", "-dvd-video", "-f", "-gui", "-graft-points",
"-hide-joliet-trans-tbl", "-hide-rr-moved", "-J", "-joliet-long", "-l",
"-L", "-max-iso9660-filenames", "-N", "-nobak", "-no-bak",
"-no-limit-pathtables", "-force-rr", "-no-rr",
"-no-split-symlink-components", "-no-split-symlink-fields", "-pad",
"-no-pad", "-posix-H", "-posix-L", "-posix-P", "-print-size",
"-quiet", "-R", "-r", "-relaxed-filenames", "-rrip110", "-rrip112",
"-split-output", "-T", "-UDF", "-udf", "-udf-symlinks", "-no-udf-symlinks",
"-U", "-no-iso-translate", "-v", "-XA", "-xa", "-z",
"-hfs", "-no-hfs", "-apple", "-probe", "-no-desktop", "-mac-name",
"-part", "-icon-position", "-chrp-t", "-hfs-unlock", "--cap", "--netatalk",
"--double", "--ethershare", "--ushare", "--exchange", "--sgi", "--xinet",
"--macbin", "--single", "--dave", "--sfm", "--osx-double", "--osx-hfs",
"-debug", "-omit-period", "-disable-deep-relocation", "-joliet",
"-full-iso9660-filenames", "-follow-links", "-help",
"-transparent-compression",
"-omit-version-number", "-rational-rock", "-rock", "-translation-table",
"-untranslated-filenames", "-verbose", "-version", "-g", "-h",
"-no-mac-files", "-chrp-boot",
"--hardlinks", "--acl", "--xattr", "--xattr-any", "--md5", "--for_backup",
"--protective-msdos-label", "--boot-catalog-hide", "--no-emul-toc",
"--emul-toc", "-disallow_dir_id_ext", "--old-empty",
"--old-root-no-md5", "--old-root-devno", "--old-root-no-ino",
"--no_rc", "--norock", "-hfsplus", "-fat", "-chrp-boot-part",
"-isohybrid-gpt-basdat", "-isohybrid-gpt-hfsplus",
"-isohybrid-apm-hfsplus", "--grub2-boot-info", "-joliet-utf16",
"-appended_part_as_gpt", "-appended_part_as_apm", "--mbr-force-bootable",
"-part_like_isohybrid", "--zisofs-version-2", "--zisofs-susp-z2",
""
};
static char arg1_options[][41]= {
"-abstract", "-A", "-appid", "--application_use",
"-biblio", "-b", "-B", "-boot-load-seg",
"-boot-load-size", "-C", "-c", "-check-session", "-copyright",
"-dir-mode", "-eltorito-id", "-eltorito-selcrit",
"-file-mode", "-G", "-gid", "-hide", "-hide-list",
"-hidden", "-hidden-list", "-hide-joliet", "-hide-joliet-list",
"-hide-hfsplus", "-hide-hfsplus-list",
"-hide-udf", "-hide-udf-list", "-input-charset", "-output-charset",
"-iso-level", "-jcharset", "-log-file", "-m", "-exclude-list", "-M",
"-dev", "-new-dir-mode", "-o", "-p", "-preparer",
"-path-list", "-publisher", "-root",
"-old-root", "-s", "-sectype", "-sort", "-sparc-boot", "-sparc-label",
"-stream-media-size", "-stream-file-name", "-sunx86-boot", "-sunx86-label",
"-sysid", "-table-name", "-ucs-level", "-uid", "-V", "-volset",
"-volset-size", "-volset-seqno", "-x", "-P",
"-map", "-magic", "-hfs-creator", "-hfs-type", "-boot-hfs-file", "-auto",
"-cluster-size", "-hide-hfs", "-hide-hfs-list", "-hfs-volid",
"-root-info", "-prep-boot", "-input-hfs-charset", "-output-hfs-charset",
"-hfs-bless", "-hfs-parms",
"-eltorito-boot", "-generic-boot", "-eltorito-catalog", "-cdrecord-params",
"-errctl", "-exclude", "-prev-session", "-output", "-use-fileversion",
"-volid", "-old-exclude",
"-alpha-boot", "-hppa-cmdline", "-hppa-kernel-32", "-hppa-kernel-64",
"-hppa-bootloader", "-hppa-ramdisk", "-mips-boot", "-mipsel-boot",
"-jigdo-jigdo", "-jigdo-template", "-jigdo-min-file-size",
"-jigdo-force-md5", "-jigdo-force-checksum",
"-md5-list", "-checksum-list",
"-jigdo-exclude", "-jigdo-map",
"-jigdo-template-compress", "-jigdo-checksum-algorithm",
"-checksum_algorithm_iso", "-checksum_algorithm_template",
"--stdio_sync", "--quoted_path_list", "--efi-boot", "--embedded-boot",
"-isohybrid-mbr", "-e", "-partition_offset", "-partition_hd_cyl",
"-partition_sec_hd", "-partition_cyl_align", "-untranslated_name_len",
"-rr_reloc_dir", "-hfsplus-serial-no", "-prep-boot-part", "-efi-boot-part",
"-hfsplus-block-size", "-apm-block-size", "--grub2-mbr",
"--grub2-sparc-core", "--sort-weight-list", "--sort-weight-patterns",
"-hppa-hdrversion", "-file_name_limit", "--set_all_file_dates",
"--gpt_disk_guid", "-iso_mbr_part_type", "-eltorito-platform",
""
};
static char arg2_options[][41]= {
"-hfs-bless-by", "--scdbackup_tag", "--sort-weight",
""
};
static char arg3_options[][41]= {
"-append_partition", "-hfsplus-file-creator-type",
""
};
static char final_options[][41]= {
"-find",
""
};
cmd= argv[0];
*count= 0;
for(i=0; partial_options[i][0]!=0; i++)
if(strncmp(partial_options[i], cmd, strlen(partial_options[i]))==0)
return(1);
for(i=0; arg0_options[i][0]!=0; i++)
if(strcmp(arg0_options[i], cmd)==0)
return(1);
*count= 1;
for(i=0; arg1_options[i][0]!=0; i++)
if(strcmp(arg1_options[i], cmd)==0)
return(1);
*count= 2;
for(i=0; arg2_options[i][0]!=0; i++)
if(strcmp(arg2_options[i], cmd)==0)
return(1);
*count= 3;
for(i=0; arg3_options[i][0]!=0; i++)
if(strcmp(arg3_options[i], cmd)==0)
return(1);
*count= argc - 1;
for(i=0; final_options[i][0]!=0; i++)
if(strcmp(final_options[i], cmd)==0)
return(1);
*count= 0;
return(0);
}
/* @param flag bit0= do not report eventual ignore decision
*/
int Xorriso_genisofs_ignore(struct XorrisO *xorriso, char *whom,
char *argpt, int *i, int flag)
{
/* mkisofs 2.01 options which are not scheduled for implementation, yet */
static char ignored_arg0_options[][41]= {
"-allow-leading-dots", "-ldots", "-allow-multidot",
"-cache-inodes", "-check-oldnames",
"-L", "-no-bak", "-no-cache-inodes",
"-no-split-symlink-components", "-no-split-symlink-fields", "-nobak",
"-force-rr", "-T",
"-no-iso-translate",
""
};
static char ignored_arg1_options[][41]= {
"-check-session", "-hide-hfs", "-hide-hfs-list",
"-table-name", "-volset-seqno", "-volset-size", "-sort",
""
};
int k;
for(k=0;ignored_arg0_options[k][0]!=0;k++)
if(strcmp(argpt,ignored_arg0_options[k])==0)
goto no_volunteer;
for(k=0;ignored_arg1_options[k][0]!=0;k++)
if(strcmp(argpt,ignored_arg1_options[k])==0) {
(*i)++;
goto no_volunteer;
}
return(0);
no_volunteer:;