New option -as mkisofs emulates a narrow set of mkisofs gestures

This commit is contained in:
Thomas Schmitt 2008-02-20 23:48:08 +00:00
parent c30b023a6b
commit 28fdfc96bd
6 changed files with 402 additions and 58 deletions

View File

@ -214,6 +214,7 @@ int isoburn_libburn_req(int *major, int *minor, int *micro)
/** Examine the media and sets appropriate emulation if needed. /** Examine the media and sets appropriate emulation if needed.
@param flag bit0= pretent blank on overwriteable media
*/ */
static int isoburn_welcome_media(struct isoburn **o, struct burn_drive *d, static int isoburn_welcome_media(struct isoburn **o, struct burn_drive *d,
int flag) int flag)
@ -237,10 +238,16 @@ static int isoburn_welcome_media(struct isoburn **o, struct burn_drive *d,
if(caps->start_adr) { /* set emulation to overwriteable */ if(caps->start_adr) { /* set emulation to overwriteable */
(*o)->emulation_mode= 1; (*o)->emulation_mode= 1;
ret= isoburn_start_emulation(*o, 0);
if(ret<=0) { if(flag&1) {
(*o)->emulation_mode= -1; (*o)->nwa= 0;
goto ex; (*o)->fabricated_disc_status= BURN_DISC_BLANK;
} else {
ret= isoburn_start_emulation(*o, 0);
if(ret<=0) {
(*o)->emulation_mode= -1;
goto ex;
}
} }
} else { } else {
@ -263,8 +270,12 @@ ex:
} }
int isoburn_drive_scan_and_grab(struct burn_drive_info *drive_infos[], /**
char *adr, int load) @param flag bit0= load
bit1= regard overwriteable media as blank
*/
int isoburn_drive_aquire(struct burn_drive_info *drive_infos[],
char *adr, int flag)
{ {
int ret, conv_ret, drive_grabbed= 0; int ret, conv_ret, drive_grabbed= 0;
char libburn_drive_adr[BURN_DRIVE_ADR_LEN]; char libburn_drive_adr[BURN_DRIVE_ADR_LEN];
@ -279,11 +290,11 @@ int isoburn_drive_scan_and_grab(struct burn_drive_info *drive_infos[],
ret= 0; goto ex; ret= 0; goto ex;
} }
ret= burn_drive_scan_and_grab(drive_infos, libburn_drive_adr, load); ret= burn_drive_scan_and_grab(drive_infos, libburn_drive_adr, flag&1);
if(ret<=0) if(ret<=0)
goto ex; goto ex;
drive_grabbed= 1; drive_grabbed= 1;
ret= isoburn_welcome_media(&o, (*drive_infos)[0].drive, 0); ret= isoburn_welcome_media(&o, (*drive_infos)[0].drive, !!(flag&2));
if(ret<=0) if(ret<=0)
goto ex; goto ex;
@ -298,6 +309,16 @@ ex:
} }
int isoburn_drive_scan_and_grab(struct burn_drive_info *drive_infos[],
char *adr, int load)
{
int ret;
ret= isoburn_drive_aquire(drive_infos, adr, !!load);
return(ret);
}
int isoburn_drive_grab(struct burn_drive *drive, int load) int isoburn_drive_grab(struct burn_drive *drive, int load)
{ {
int ret; int ret;

View File

@ -315,6 +315,26 @@ int isoburn_drive_scan_and_grab(struct burn_drive_info *drive_infos[],
char* adr, int load); char* adr, int load);
/** Aquire a target drive by its filesystem path resp. libburn persistent
address. This is a modern successor of isoburn_drive_scan_and_grab().
Wrapper for: burn_drive_scan_and_grab()
@since 0.1.2
@param drive_infos On success returns a one element array with the drive
(cdrom/burner). Thus use with driveno 0 only. On failure
the array has no valid elements at all.
The returned array should be freed via burn_drive_info_free()
when the drive is no longer needed.
@param adr The persistent address of the desired drive.
@param flag bit0= attempt to load the disc tray.
Else: failure if not loaded.
bit1= regard overwriteable media as blank
@return 1 = success , 0 = drive not found , <0 = other error
*/
int isoburn_drive_aquire(struct burn_drive_info *drive_infos[],
char* adr, int flag);
/** Aquire a drive from the burn_drive_info[] array which was obtained by /** Aquire a drive from the burn_drive_info[] array which was obtained by
a previous call of burn_drive_scan(). a previous call of burn_drive_scan().
Wrapper for: burn_drive_grab() Wrapper for: burn_drive_grab()

View File

@ -2,7 +2,7 @@
.\" First parameter, NAME, should be all caps .\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1) .\" other parameters are allowed: see man(7), man(1)
.TH XORRISO 1 "February 19, 2008" .TH XORRISO 1 "February 20, 2008"
.\" Please adjust this date whenever revising the manpage. .\" Please adjust this date whenever revising the manpage.
.\" .\"
.\" Some roff macros, for reference: .\" Some roff macros, for reference:
@ -1251,17 +1251,55 @@ always perform action "echo".
.TP .TP
.B Command compatibility emulations: .B Command compatibility emulations:
.PP .PP
ISO 9660 multi-session on CD is traditionally done by program mkisofs Writing of ISO 9660 on CD is traditionally done by program mkisofs
as ISO 9660 image producer and cdrecord as burn program. as ISO 9660 image producer and cdrecord as burn program.
xorriso does not strive to emulate any of them. Nevertheless it is ready to xorriso does not strive for their comprehensive emulation.
perform some of its core tasks under control of commands which trigger Nevertheless it is ready to perform some of its core tasks under control
comparable actions in said programs. of commands which in said programs trigger comparable actions.
The scope is for now only a single first data track to be written to blank or
overwriteable media. If possible the media will get closed afterwards.
Multi-session is yet only possible via xorriso's own commands.
.TP .TP
\fB\-as\fR personality option [options] -- \fB\-as\fR personality option [options] --
.br .br
Performs its variable length option list as sparse emulation of the program Performs its variable length option list as sparse emulation of the program
depicted by the personality word. depicted by the personality word. This is only allowed if no image changes
are pending. The input drive is given up.
.br .br
Personality "\fBmkisofs\fR" accepts the options listed with:
.br
-as mkisofs -help --
.br
Among them: -R (always on), -J, -graft-points, -o, -path-list, -print-size, -V,
-v, -version, pathspecs as with xorriso -add. A lot of options are not
supported and lead to failure of the mkisofs emulation. Some are ignored,
but better do not rely on this tolerance.
.br
-graft-points is equivalent to -pathspecs on. Note that pathspecs without "="
are interpreted differently than with xorriso option -add. Directories get
merged with the root directory of the ISO image, other filetypes get mapped
into that root directory.
.br
Other than with the "cdrecord" personality there is no automatic -commit at
the end of a "mkisofs" option list. Verbosity settings -v (= "UPDATE") and
-quiet (= "SORRY") persist. The output file, eventually chosen with -o,
persists until things happen like -commit, -rollback, -dev, or end of xorriso.
.br
If no output file was chosen before or during a "mkisofs" option list, then
standard output (-outdev "-") will get into effect before pathspecs get
added. If -o points to a regular file, then it will be truncated to 0 bytes
before "mkisofs" options are processed. Directories and symbolic links
are no valid -o targets.
.br
Writing to stdout is possible only if -as "mkisofs" was among the start
arguments or if other start arguments pointed the output drive to
standard output.
.br
Personalites "\fBgenisoimage\fR" and "\fBgenisofs\fR"
are aliases for "mkisofs".
.br
Personality "\fBcdrecord\fR" accepts the options listed with: Personality "\fBcdrecord\fR" accepts the options listed with:
.br .br
-as cdrecord -help -- -as cdrecord -help --
@ -1273,11 +1311,12 @@ It ignores most other options of cdrecord and cdrskin but refuses on
-audio, -scanbus, -multi, -msinfo, --grow_overwriteable_iso, -audio, -scanbus, -multi, -msinfo, --grow_overwriteable_iso,
and on blanking modes unknown to xorriso. and on blanking modes unknown to xorriso.
.br .br
The scope is for now a single data track to be written to blank or
overwriteable media. If possible the media will get closed afterwards.
dev= must be given as xorriso device address. Adresses like 0,0,0 or ATA:1,1,0 dev= must be given as xorriso device address. Adresses like 0,0,0 or ATA:1,1,0
are not supported. are not supported.
.br .br
If a track source is given, then an automatic -commit happens at the end of
the "cdrecord" option list.
.br
A much more elaborate libburn based cdrecord emulator is the program cdrskin. A much more elaborate libburn based cdrecord emulator is the program cdrskin.
.br .br
Personalites "\fBwodim\fR" and "\fBcdrskin\fR" are aliases for "cdrecord". Personalites "\fBwodim\fR" and "\fBcdrskin\fR" are aliases for "cdrecord".
@ -1542,6 +1581,15 @@ do not abort prematurely but forcibly go on until the end of commands.
.br .br
... ...
.SS .SS
.B Perform a single session run as of cdrtools traditions
This shall illustrate how xorriso can act in either role.
Between both processes there can be performed arbitrary transportation
or filtering.
.br
\fB$\fR xorriso -as mkisofs -J -R /home/prepared_for_iso/tree | \\
.br
xorriso -as cdrecord -v dev=/dev/sr0 blank=fast -eject -
.SS
.B Examples of input timestrings .B Examples of input timestrings
.br .br
As printed by program date: As printed by program date:

View File

@ -6081,12 +6081,11 @@ int Xorriso_reaquire_outdev(struct XorrisO *xorriso, int flag)
} }
/* >>> micro version of cdrskin */ /* micro version of cdrskin */
/* @return <=0 error, 1 ok go on */
int Xorriso_cdrskin(struct XorrisO *xorriso, char *whom, int argc, char **argv, int Xorriso_cdrskin(struct XorrisO *xorriso, char *whom, int argc, char **argv,
int flag) int flag)
{ {
int ret, i, k, mem_report_about_severity, mem_do_close, aq_ret, eject_ret; int ret, i, k, mem_do_close, aq_ret, eject_ret;
int do_atip= 0, do_checkdrive= 0, do_eject= 0, do_scanbus= 0; 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; int do_toc= 0, do_verbous= 0, do_version= 0, do_help= 0;
char track_source[SfileadrL], sfe[5*SfileadrL], dev_adr[SfileadrL], *cpt; char track_source[SfileadrL], sfe[5*SfileadrL], dev_adr[SfileadrL], *cpt;
@ -6134,7 +6133,7 @@ int Xorriso_cdrskin(struct XorrisO *xorriso, char *whom, int argc, char **argv,
}; };
static char helptext[][80]= { static char helptext[][80]= {
"Usage: xorriso -as cdrskin [options|source_addresses]", "Usage: xorriso -as cdrecord [options|source_addresses]",
"Note: This is not cdrecord. See xorriso -help, xorriso -version, man xorriso", "Note: This is not cdrecord. See xorriso -help, xorriso -version, man xorriso",
"Options:", "Options:",
"\t-version\tprint version information and exit emulation", "\t-version\tprint version information and exit emulation",
@ -6154,7 +6153,6 @@ int Xorriso_cdrskin(struct XorrisO *xorriso, char *whom, int argc, char **argv,
"\t-pad\t\tpadsize=30k", "\t-pad\t\tpadsize=30k",
"\t-nopad\t\tDo not pad", "\t-nopad\t\tDo not pad",
"\t-help\t\tprint this text to stderr and exit emulation", "\t-help\t\tprint this text to stderr and exit emulation",
"\t--help\t\tprint xorriso help and exit emulation",
"Actually this is the integrated ISO RockRidge filesystem manipulator xorriso", "Actually this is the integrated ISO RockRidge filesystem manipulator xorriso",
"lending its libburn capabilities to a very limited cdrecord emulation.", "lending its libburn capabilities to a very limited cdrecord emulation.",
"Only a single data track can be burnt to blank or overwriteable media which", "Only a single data track can be burnt to blank or overwriteable media which",
@ -6176,6 +6174,9 @@ static char blank_help[][80]= {
"@End_of_helptexT@" "@End_of_helptexT@"
}; };
strcpy(mem_report_about_text, xorriso->report_about_text);
mem_do_close= xorriso->do_close;
track_source[0]= 0; track_source[0]= 0;
dev_adr[0]= 0; dev_adr[0]= 0;
blank_mode[0]= 0; blank_mode[0]= 0;
@ -6183,13 +6184,10 @@ static char blank_help[][80]= {
if(xorriso->in_drive_handle != NULL) { if(xorriso->in_drive_handle != NULL) {
ret= Xorriso_option_dev(xorriso, "", 1); /* give up indev */ ret= Xorriso_option_dev(xorriso, "", 1); /* give up indev */
if(ret<=0) if(ret!=1)
return(ret); return(ret);
} }
mem_report_about_severity= xorriso->report_about_severity;
strcpy(mem_report_about_text, xorriso->report_about_text);
mem_do_close= xorriso->do_close;
/* Assess plan, make settings */ /* Assess plan, make settings */
for(i= 0; i<argc; i++) { for(i= 0; i<argc; i++) {
@ -6252,7 +6250,7 @@ no_volunteer:;
} else if(strncmp(argv[i], "-dev=", 5)==0 || } else if(strncmp(argv[i], "-dev=", 5)==0 ||
strncmp(argv[i], "dev=", 4)==0) { strncmp(argv[i], "dev=", 4)==0) {
cpt= strchr(argv[i], '=')+1; cpt= strchr(argv[i], '=')+1;
ret= Xorriso_option_dev(xorriso, cpt, 2); ret= Xorriso_option_dev(xorriso, cpt, 2|8); /* overwriteables as blank */
if(ret<=0) if(ret<=0)
goto ex; goto ex;
} else if(strcmp(argv[i], "-dummy")==0) { } else if(strcmp(argv[i], "-dummy")==0) {
@ -6316,8 +6314,6 @@ no_volunteer:;
do_version= 1; do_version= 1;
} else if(strcmp(argv[i], "-help")==0) { } else if(strcmp(argv[i], "-help")==0) {
do_help= 1; do_help= 1;
} else if(strcmp(argv[i], "--help")==0) {
do_help= 2;
} else if(argv[i][0]=='-' && argv[i][1]!=0) { } else if(argv[i][0]=='-' && argv[i][1]!=0) {
sprintf(xorriso->info_text, "-as %s: Unknown option %s", sprintf(xorriso->info_text, "-as %s: Unknown option %s",
whom, Text_shellsafe(argv[i], sfe, 0)); whom, Text_shellsafe(argv[i], sfe, 0));
@ -6347,13 +6343,9 @@ no_volunteer:;
ret= 1; goto ex; ret= 1; goto ex;
} }
if(do_help) { if(do_help) {
if(do_help==2) { for(i= 0; strcmp(helptext[i], "@End_of_helptexT@")!=0; i++) {
Xorriso_option_help(xorriso, 0); sprintf(xorriso->info_text, "%s\n", helptext[i]);
} else { Xorriso_info(xorriso,0);
for(i= 0; strcmp(helptext[i], "@End_of_helptexT@")!=0; i++) {
sprintf(xorriso->info_text, "%s\n", helptext[i]);
Xorriso_info(xorriso,0);
}
} }
ret= 1; goto ex; ret= 1; goto ex;
} }
@ -6435,12 +6427,256 @@ ex:;
whom); whom);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
} }
xorriso->report_about_severity= mem_report_about_severity; Xorriso_option_report_about(xorriso, mem_report_about_text, 0);
strcpy(xorriso->report_about_text, mem_report_about_text);
xorriso->do_close= mem_do_close; xorriso->do_close= mem_do_close;
return(ret); return(ret);
} }
/* micro emulation of mkisofs */
int Xorriso_genisofs(struct XorrisO *xorriso, char *whom,
int argc, char **argv, int flag)
{
int ret, i, k, was_path= 0, was_other_option= 0, mem_graft_points;
int do_print_size= 0;
char sfe[5*SfileadrL], adr[SfileadrL+8], ra_text[80], pathspec[2*SfileadrL];
char *ept, *add_pt, eff_path[SfileadrL];
/* mkisofs 2.01 options which are not scheduled for implementation, yet */
static char ignored_arg0_options[][41]= {
"-allow-leading-dots", "-ldots", "-allow-lowercase", "-allow-multidot",
"-cache-inodes", "-no-cache-inodes", "-check-oldnames", "-d", "-D",
"-joliet-long", "-l", "-L", "-max-iso9660-filenames", "-N", "-nobak",
"-no-bak", "-force-rr", "-r", "-relaxed-filenames", "-T", "-U",
"-no-iso-translate",
""
};
static char ignored_arg1_options[][41]= {
"-A", "-biblio", "-check-session", "-P", "-publisher", "-p", "-root",
"-old-root", "-sysid", "-table-name",
""
};
static char helptext[][80]= {
"Usage: xorriso -as mkisofs [options] file...",
"Note: This is not mkisofs. See xorriso -help, xorriso -version, man xorriso",
"Options:",
" -f, -follow-links Follow symbolic links",
" -graft-points Allow to use graft points for filenames",
" -help Print option help",
" -J, -joliet Generate Joliet directory information",
" -no-pad Do not pad output",
" -o FILE, -output FILE Set output file name",
" -pad Pad output by 300k (default)",
" -path-list FILE File with list of pathnames to process",
" -print-size Print estimated filesystem size and exit",
" -quiet Run quietly",
" -R, -rock Generate Rock Ridge directory information",
" -V ID, -volid ID Set Volume ID",
" -v, -verbose Verbose",
" -version Print the current version",
"@End_of_helptexT@"
};
strcpy(ra_text, xorriso->report_about_text);
if(xorriso->in_drive_handle != NULL) {
ret= Xorriso_option_dev(xorriso, "", 1); /* give up indev */
if(ret!=1)
return(ret);
}
adr[0]= 0;
for(i= 0; i<argc; i++) {
if(strcmp(argv[i], "-o")==0 || strcmp(argv[i], "-output")==0) {
if(i+1>=argc)
goto not_enough_args;
i++;
adr[0]= 0;
if(strcmp(argv[i],"-")!=0)
strcpy(adr, "stdio:");
if(Sfile_str(adr+strlen(adr), argv[i], 0)<=0)
{ret= -1; goto ex;}
} else if(strcmp(argv[i], "-help")==0) {
Xorriso_option_report_about(xorriso, "NOTE", 0);
for(i= 0; strcmp(helptext[i], "@End_of_helptexT@")!=0; i++) {
sprintf(xorriso->info_text, "%s\n", helptext[i]);
Xorriso_info(xorriso,0);
}
Xorriso_option_report_about(xorriso, ra_text, 0);
} else if(strcmp(argv[i], "-v")==0 || strcmp(argv[i], "-verbose")==0) {
strcpy(ra_text, "UPDATE");
} else if(strcmp(argv[i], "-quiet")==0) {
strcpy(ra_text, "SORRY");
} else if(strcmp(argv[i], "-f")==0 || strcmp(argv[i], "-follow-links")==0) {
ret= Xorriso_option_follow(xorriso, "on", 0);
if(ret<=0)
goto ex;
} else
was_other_option= 1;
}
Xorriso_option_report_about(xorriso, ra_text, 0);
if(adr[0]) {
if(strncmp(adr, "stdio:", 6)==0 && strncmp(adr, "stdio:/dev/fd/", 14)!=0) {
ret= Sfile_type(adr+6, 1);
if(ret==-1)
/* ok */;
else if(ret==1) {
/* >>> would prefer to do this later ... or leave it to libburn */;
ret= truncate(adr+6, (off_t) 0);
if(ret==-1) {
sprintf(xorriso->info_text, "-as %s: Cannot truncate existing -o %s",
whom, Text_shellsafe(adr+6, sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE",
0);
}
sprintf(xorriso->info_text, "-as %s: Truncated existing -o %s",
whom, Text_shellsafe(adr+6, sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
} else if(ret==2 || ret==3) {
sprintf(xorriso->info_text,
"-as %s: Cannot accept %s as target: -o %s",
whom, (ret==3 ? "symbolic link" : "directory"),
Text_shellsafe(adr+6, sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
}
}
ret= Xorriso_option_dev(xorriso, adr, 2|8); /* overwriteable as blank */
if(ret<=0)
goto ex;
}
if(!was_other_option)
{ret= 1; goto ex;}
if(xorriso->out_drive_handle==NULL) {
ret= Xorriso_option_dev(xorriso, "-", 2|4); /* set outdev to stdout */
if(ret<=0)
return(ret);
}
xorriso->padding= 300*1024;
for(i= 0; i<argc; i++) {
sprintf(xorriso->info_text, "-as %s: %s",
whom, Text_shellsafe(argv[i], sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0);
for(k=0;ignored_arg0_options[k][0]!=0;k++)
if(strcmp(argv[i],ignored_arg0_options[k])==0)
goto no_volunteer;
for(k=0;ignored_arg1_options[k][0]!=0;k++)
if(strcmp(argv[i],ignored_arg0_options[k])==0) {
i++;
goto no_volunteer;
}
if(0) {
no_volunteer:;
sprintf(xorriso->info_text, "-as %s: Ignored option %s",
whom, Text_shellsafe(argv[i], sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
continue;
}
if(strcmp(argv[i], "-version")==0) {
sprintf(xorriso->result_line, "mkisofs 2.01-Emulation Copyright (C) 2008 see libburnia-project.org xorriso\n");
Xorriso_result(xorriso, 1);
Xorriso_option_version(xorriso, 0);
} else if(strcmp(argv[i], "-R")==0 || strcmp(argv[i], "-rock")==0) {
/* ok */;
} else if(strcmp(argv[i], "-J")==0 || strcmp(argv[i], "-joliet")==0) {
xorriso->do_joliet= 1;
} else if(strcmp(argv[i], "-graft-points")==0) {
xorriso->allow_graft_points= 1;
} else if(strcmp(argv[i], "-path-list")==0) {
if(i+1>=argc) {
not_enough_args:;
sprintf(xorriso->info_text, "-as %s: Not enough arguments to option %s",
whom, argv[i]);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
ret= 0; goto ex;
}
i++;
ret= Xorriso_option_path_list(xorriso, argv[i], 0);
if(ret<=0)
goto ex;
} else if(strcmp(argv[i], "-f")==0 || strcmp(argv[i], "-follow-links")==0) {
/* was already handled in first argument scan */;
} else if(strcmp(argv[i], "-pad")==0) {
xorriso->padding= 300*1024;
} else if(strcmp(argv[i], "-nopad")==0) {
xorriso->padding= 0;
} else if(strcmp(argv[i], "-print-size")==0) {
do_print_size= 1;
} else if(strcmp(argv[i], "-o")==0) {
i++;
/* was already handled in first argument scan */;
} else if(strcmp(argv[i], "-help")==0) {
/* was already handled in first argument scan */;
} else if(strcmp(argv[i], "-V")==0 || strcmp(argv[i], "-volid")==0) {
if(i+1>=argc)
goto not_enough_args;
i++;
ret= Xorriso_option_volid(xorriso, argv[i], 0);
if(ret<=0)
goto ex;
} else if(strcmp(argv[i], "-v")==0 || strcmp(argv[i], "-quiet")==0) {
/* was already handled in first argument scan */;
} else if(argv[i][0]=='-' && argv[i][1]!=0) {
sprintf(xorriso->info_text, "-as %s: Unknown option %s",
whom, Text_shellsafe(argv[i], sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
} else {
int zero= 0;
/* implementing mkisofs tendency to map single-path pathspecs to / */
if((!xorriso->allow_graft_points) ||
Fileliste__target_source_limit(argv[i], '=', &ept, 0)<=0) {
ret= Xorriso_normalize_img_path(xorriso, xorriso->wdx, argv[i],
eff_path, 2|4);
if(ret<=0)
goto ex;
ret= Sfile_type(eff_path,
1|((xorriso->do_follow_param||xorriso->do_follow_links)<<2));
if(ret==2) {
strcpy(pathspec, "/=");
} else {
pathspec[0]= '/';
pathspec[1]= 0;
ret= Sfile_leafname(eff_path, pathspec+1, 0);
if(ret>0)
strcat(pathspec, "=");
else
pathspec[0]= 0;
}
strcat(pathspec, eff_path);
add_pt= pathspec;
} else
add_pt= argv[i];
mem_graft_points= xorriso->allow_graft_points;
xorriso->allow_graft_points= 1;
ret= Xorriso_option_add(xorriso, 1, &add_pt, &zero, was_path<<1);
xorriso->allow_graft_points= mem_graft_points;
if(ret<=0)
goto ex;
was_path= 1;
}
}
if(do_print_size) {
ret= Xorriso_option_print_size(xorriso, 0);
if(ret<=0)
goto ex;
}
ret= 1;
ex:;
if(was_path && !do_print_size)
Xorriso_pacifier_callback(xorriso, "files added", xorriso->pacifier_count,
xorriso->pacifier_total, "", 1);
if(do_print_size && xorriso->volset_change_pending)
Xorriso_option_rollback(xorriso, 0);
return(ret);
}
/* ---------------------------- Options API ------------------------ */ /* ---------------------------- Options API ------------------------ */
@ -6667,6 +6903,13 @@ int Xorriso_option_as(struct XorrisO *xorriso, int argc, char **argv,
0); 0);
if(ret<=0) if(ret<=0)
goto ex; goto ex;
} else if(strcmp(argv[*idx], "mkisofs")==0 ||
strcmp(argv[*idx], "genisoimage")==0 ||
strcmp(argv[*idx], "genisofs")==0) {
ret= Xorriso_genisofs(xorriso, argv[*idx], end_idx-(*idx)-1, argv+(*idx)+1,
0);
if(ret<=0)
goto ex;
} else { } else {
sprintf(xorriso->info_text, sprintf(xorriso->info_text,
"-as : Not a known emulation personality: '%s'", argv[*idx]); "-as : Not a known emulation personality: '%s'", argv[*idx]);
@ -7246,6 +7489,7 @@ int Xorriso_option_cut_out(struct XorrisO *xorriso, char *disk_path,
/** @param flag bit0=use as indev /** @param flag bit0=use as indev
bit1= use as outdev bit1= use as outdev
bit2= do not -reassure bit2= do not -reassure
bit3= regard overwriteable media as blank
@return <=0 error , 1 success, 2 revoked by -reassure @return <=0 error , 1 success, 2 revoked by -reassure
*/ */
int Xorriso_option_dev(struct XorrisO *xorriso, char *in_adr, int flag) int Xorriso_option_dev(struct XorrisO *xorriso, char *in_adr, int flag)
@ -7305,8 +7549,8 @@ int Xorriso_option_dev(struct XorrisO *xorriso, char *in_adr, int flag)
} }
ret= Xorriso_give_up_drive(xorriso, flag&3); ret= Xorriso_give_up_drive(xorriso, flag&3);
} else } else
ret= Xorriso_aquire_drive(xorriso, adr, flag&3); ret= Xorriso_aquire_drive(xorriso, adr, (flag&3)|((flag&8)>>1));
if(ret<0) if(ret<=0)
return(ret); return(ret);
return(1); return(1);
} }
@ -9752,6 +9996,7 @@ int Xorriso_prescan_args(struct XorrisO *xorriso, int argc, char **argv,
Keep dev_fd_1 connected to external stdout. dev_fd_1 is to be used when Keep dev_fd_1 connected to external stdout. dev_fd_1 is to be used when
"stdio:/dev/fd/1" is interpreted as drive address. "stdio:/dev/fd/1" is interpreted as drive address.
*/ */
protect_stdout:;
Xorriso_protect_stdout(xorriso, 0); Xorriso_protect_stdout(xorriso, 0);
sprintf(xorriso->info_text, sprintf(xorriso->info_text,
"Encountered - or stdio:/dev/fd/1 as possible write target."); "Encountered - or stdio:/dev/fd/1 as possible write target.");
@ -9782,6 +10027,11 @@ int Xorriso_prescan_args(struct XorrisO *xorriso, int argc, char **argv,
Xorriso_option_return_with(xorriso, arg1, num2, 0); Xorriso_option_return_with(xorriso, arg1, num2, 0);
was_return_with= 1; was_return_with= 1;
} else if(strcmp(cmd,"as")==0 && was_dashed) {
if(strcmp(arg1, "mkisofs")==0 || strcmp(arg1, "genisoimage")==0 ||
strcmp(arg1, "genisofs")==0)
goto protect_stdout;
} }
} }
return(1); return(1);

View File

@ -1 +1 @@
#define Xorriso_timestamP "2008.02.19.212322" #define Xorriso_timestamP "2008.02.20.234726"

View File

@ -419,6 +419,7 @@ int Xorriso_create_empty_iso(struct XorrisO *xorriso, int flag)
/* @param flag bit0=aquire as isoburn input drive /* @param flag bit0=aquire as isoburn input drive
bit1=aquire as libburn output drive (as isoburn drive if bit0) bit1=aquire as libburn output drive (as isoburn drive if bit0)
bit2=regard overwriteable media as blank
@return <=0 failure , 1= ok @return <=0 failure , 1= ok
2=success, but not writeable with bit1 2=success, but not writeable with bit1
3=success, but not blank and not ISO with bit0 3=success, but not blank and not ISO with bit0
@ -438,7 +439,7 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag)
sprintf(xorriso->info_text, sprintf(xorriso->info_text,
"XORRISOBURN program error : Xorriso_aquire_drive bit0+bit1 not set"); "XORRISOBURN program error : Xorriso_aquire_drive bit0+bit1 not set");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0);
return(0); return(-1);
} }
ret= Xorriso_give_up_drive(xorriso, (flag&3)|8); ret= Xorriso_give_up_drive(xorriso, (flag&3)|8);
if(ret<=0) if(ret<=0)
@ -448,7 +449,7 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag)
if(strcmp(adr,"stdio:/dev/fd/1")==0) { if(strcmp(adr,"stdio:/dev/fd/1")==0) {
if(xorriso->dev_fd_1<0) { if(xorriso->dev_fd_1<0) {
sprintf(xorriso->info_text, sprintf(xorriso->info_text,
"\"stdio:/dev/fd/1\" was not a start argument. stdout possibly already tainted."); "-*dev \"stdio:/dev/fd/1\" was not a start argument. Cannot use it now.");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
{ret= 0; goto ex;} {ret= 0; goto ex;}
} else { } else {
@ -476,12 +477,12 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag)
} }
if(dinfo==NULL) { if(dinfo==NULL) {
ret= isoburn_drive_scan_and_grab(&dinfo, libburn_adr, 1); ret= isoburn_drive_aquire(&dinfo, libburn_adr, 1|((flag&4)>>1));
Xorriso_process_msg_queues(xorriso,0); Xorriso_process_msg_queues(xorriso,0);
if(ret<=0) { if(ret<=0) {
sprintf(xorriso->info_text,"Cannot aquire drive '%s'", adr); sprintf(xorriso->info_text,"Cannot aquire drive '%s'", adr);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(0); ret= 0; goto ex;
} }
} }
drive= dinfo[0].drive; drive= dinfo[0].drive;
@ -497,7 +498,7 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag)
if(flag&2) { if(flag&2) {
xorriso->out_drive_handle= dinfo; xorriso->out_drive_handle= dinfo;
if(Sfile_str(xorriso->outdev, adr, 0)<=0) if(Sfile_str(xorriso->outdev, adr, 0)<=0)
return(-1); {ret= -1; goto ex;}
if(state != BURN_DISC_BLANK && state != BURN_DISC_APPENDABLE) { if(state != BURN_DISC_BLANK && state != BURN_DISC_APPENDABLE) {
sprintf(xorriso->info_text, "Disc status unsuitable for writing"); sprintf(xorriso->info_text, "Disc status unsuitable for writing");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0);
@ -507,13 +508,13 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag)
if(flag&1) { if(flag&1) {
xorriso->in_drive_handle= dinfo; xorriso->in_drive_handle= dinfo;
if(Sfile_str(xorriso->indev, adr, 0)<=0) if(Sfile_str(xorriso->indev, adr, 0)<=0)
return(-1); {ret= -1; goto ex;}
} else if(flag&2) { } else if(flag&2) {
if(xorriso->in_volset_handle==NULL) { if(xorriso->in_volset_handle==NULL) {
/* No volume loaded: create empty one */ /* No volume loaded: create empty one */
ret= Xorriso_create_empty_iso(xorriso, 0); ret= Xorriso_create_empty_iso(xorriso, 0);
if(ret<=0) if(ret<=0)
return(ret); goto ex;
} else { } else {
iso_image_ref((IsoImage *) xorriso->in_volset_handle); iso_image_ref((IsoImage *) xorriso->in_volset_handle);
ret= isoburn_attach_image(drive, (IsoImage *) xorriso->in_volset_handle); ret= isoburn_attach_image(drive, (IsoImage *) xorriso->in_volset_handle);
@ -521,11 +522,11 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag)
sprintf(xorriso->info_text, sprintf(xorriso->info_text,
"Failed to attach ISO image object to outdev"); "Failed to attach ISO image object to outdev");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0);
return(-1); {ret= -1; goto ex;}
} }
} }
Xorriso_toc(xorriso, 1|2); Xorriso_toc(xorriso, 1|2);
return(1+not_writeable); {ret= 1+not_writeable; goto ex;}
} }
if(xorriso->in_volset_handle!=NULL) if(xorriso->in_volset_handle!=NULL)
@ -538,12 +539,12 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag)
sprintf(xorriso->info_text, sprintf(xorriso->info_text,
"Disc status not blank and unsuitable for reading"); "Disc status not blank and unsuitable for reading");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
return(0); {ret= 0; goto ex;}
} }
/* fill read opts */ /* fill read opts */
ret= isoburn_ropt_new(&ropts, 0); ret= isoburn_ropt_new(&ropts, 0);
if(ret<=0) if(ret<=0)
return(ret); goto ex;
isoburn_ropt_set_extensions(ropts, isoburn_ropt_noiso1999); isoburn_ropt_set_extensions(ropts, isoburn_ropt_noiso1999);
isoburn_ropt_set_default_perms(ropts, (uid_t) 0, (gid_t) 0, (mode_t) 0555); isoburn_ropt_set_default_perms(ropts, (uid_t) 0, (gid_t) 0, (mode_t) 0555);
isoburn_ropt_set_input_charset(ropts, NULL); isoburn_ropt_set_input_charset(ropts, NULL);
@ -606,7 +607,8 @@ ex:
if(hret<ret) if(hret<ret)
ret= hret; ret= hret;
} }
isoburn_ropt_destroy(&ropts, 0); if(ropts!=NULL)
isoburn_ropt_destroy(&ropts, 0);
return(ret); return(ret);
} }
@ -799,14 +801,17 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag)
if(ret<=0) if(ret<=0)
return(0); return(0);
if(xorriso->out_drive_handle == xorriso->in_drive_handle || if(xorriso->out_drive_handle == xorriso->in_drive_handle) {
xorriso->in_drive_handle == NULL) {
source_drive= drive; source_drive= drive;
} else { } else {
ret= Xorriso_get_drive_handles(xorriso, &source_dinfo, &source_drive, if(xorriso->in_drive_handle == NULL) {
"on attempt to get source for write", 0); source_drive= drive;
if(ret<=0) } else {
goto ex; ret= Xorriso_get_drive_handles(xorriso, &source_dinfo, &source_drive,
"on attempt to get source for write", 0);
if(ret<=0)
goto ex;
}
s= isoburn_disc_get_status(drive); s= isoburn_disc_get_status(drive);
if(s!=BURN_DISC_BLANK) { if(s!=BURN_DISC_BLANK) {
s= burn_disc_get_status(drive); s= burn_disc_get_status(drive);