diff --git a/libisoburn/burn_wrap.c b/libisoburn/burn_wrap.c index cad68e1f..33031c7a 100644 --- a/libisoburn/burn_wrap.c +++ b/libisoburn/burn_wrap.c @@ -214,6 +214,7 @@ int isoburn_libburn_req(int *major, int *minor, int *micro) /** 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, 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 */ (*o)->emulation_mode= 1; - ret= isoburn_start_emulation(*o, 0); - if(ret<=0) { - (*o)->emulation_mode= -1; - goto ex; + + if(flag&1) { + (*o)->nwa= 0; + (*o)->fabricated_disc_status= BURN_DISC_BLANK; + } else { + ret= isoburn_start_emulation(*o, 0); + if(ret<=0) { + (*o)->emulation_mode= -1; + goto ex; + } } } 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; 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= 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) goto ex; 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) 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 ret; diff --git a/libisoburn/libisoburn.h b/libisoburn/libisoburn.h index 10ba2a15..6f51cd75 100644 --- a/libisoburn/libisoburn.h +++ b/libisoburn/libisoburn.h @@ -315,6 +315,26 @@ int isoburn_drive_scan_and_grab(struct burn_drive_info *drive_infos[], 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 a previous call of burn_drive_scan(). Wrapper for: burn_drive_grab() diff --git a/xorriso/xorriso.1 b/xorriso/xorriso.1 index c302188f..caa31f4a 100644 --- a/xorriso/xorriso.1 +++ b/xorriso/xorriso.1 @@ -2,7 +2,7 @@ .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" 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. .\" .\" Some roff macros, for reference: @@ -1251,17 +1251,55 @@ always perform action "echo". .TP .B Command compatibility emulations: .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. -xorriso does not strive to emulate any of them. Nevertheless it is ready to -perform some of its core tasks under control of commands which trigger -comparable actions in said programs. +xorriso does not strive for their comprehensive emulation. +Nevertheless it is ready to perform some of its core tasks under control +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 \fB\-as\fR personality option [options] -- .br 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 + +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: .br -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, and on blanking modes unknown to xorriso. .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 are not supported. .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. .br 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 ... .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 .br As printed by program date: diff --git a/xorriso/xorriso.c b/xorriso/xorriso.c index a71ce486..500567e0 100644 --- a/xorriso/xorriso.c +++ b/xorriso/xorriso.c @@ -6081,12 +6081,11 @@ int Xorriso_reaquire_outdev(struct XorrisO *xorriso, int flag) } -/* >>> micro version of cdrskin */ -/* @return <=0 error, 1 ok go on */ +/* micro version of cdrskin */ int Xorriso_cdrskin(struct XorrisO *xorriso, char *whom, int argc, char **argv, 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_toc= 0, do_verbous= 0, do_version= 0, do_help= 0; 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]= { -"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", "Options:", "\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-nopad\t\tDo not pad", "\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", "lending its libburn capabilities to a very limited cdrecord emulation.", "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@" }; + strcpy(mem_report_about_text, xorriso->report_about_text); + mem_do_close= xorriso->do_close; + track_source[0]= 0; dev_adr[0]= 0; blank_mode[0]= 0; @@ -6183,13 +6184,10 @@ static char blank_help[][80]= { if(xorriso->in_drive_handle != NULL) { ret= Xorriso_option_dev(xorriso, "", 1); /* give up indev */ - if(ret<=0) + if(ret!=1) 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 */ for(i= 0; iinfo_text, "-as %s: Unknown option %s", whom, Text_shellsafe(argv[i], sfe, 0)); @@ -6347,13 +6343,9 @@ no_volunteer:; ret= 1; goto ex; } if(do_help) { - if(do_help==2) { - Xorriso_option_help(xorriso, 0); - } else { - for(i= 0; strcmp(helptext[i], "@End_of_helptexT@")!=0; i++) { - sprintf(xorriso->info_text, "%s\n", helptext[i]); - 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; } @@ -6435,12 +6427,256 @@ ex:; whom); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); } - xorriso->report_about_severity= mem_report_about_severity; - strcpy(xorriso->report_about_text, mem_report_about_text); + Xorriso_option_report_about(xorriso, mem_report_about_text, 0); xorriso->do_close= mem_do_close; 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) + 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; iinfo_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 ------------------------ */ @@ -6667,6 +6903,13 @@ int Xorriso_option_as(struct XorrisO *xorriso, int argc, char **argv, 0); if(ret<=0) 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 { sprintf(xorriso->info_text, "-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 bit1= use as outdev bit2= do not -reassure + bit3= regard overwriteable media as blank @return <=0 error , 1 success, 2 revoked by -reassure */ 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); } else - ret= Xorriso_aquire_drive(xorriso, adr, flag&3); - if(ret<0) + ret= Xorriso_aquire_drive(xorriso, adr, (flag&3)|((flag&8)>>1)); + if(ret<=0) return(ret); 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 "stdio:/dev/fd/1" is interpreted as drive address. */ +protect_stdout:; Xorriso_protect_stdout(xorriso, 0); sprintf(xorriso->info_text, "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); 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); diff --git a/xorriso/xorriso_timestamp.h b/xorriso/xorriso_timestamp.h index aad3e3f5..16fbe317 100644 --- a/xorriso/xorriso_timestamp.h +++ b/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2008.02.19.212322" +#define Xorriso_timestamP "2008.02.20.234726" diff --git a/xorriso/xorrisoburn.c b/xorriso/xorrisoburn.c index 6f6dd03f..f7eb9e0b 100644 --- a/xorriso/xorrisoburn.c +++ b/xorriso/xorrisoburn.c @@ -419,6 +419,7 @@ int Xorriso_create_empty_iso(struct XorrisO *xorriso, int flag) /* @param flag bit0=aquire as isoburn input drive bit1=aquire as libburn output drive (as isoburn drive if bit0) + bit2=regard overwriteable media as blank @return <=0 failure , 1= ok 2=success, but not writeable with bit1 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, "XORRISOBURN program error : Xorriso_aquire_drive bit0+bit1 not set"); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); - return(0); + return(-1); } ret= Xorriso_give_up_drive(xorriso, (flag&3)|8); 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(xorriso->dev_fd_1<0) { 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); {ret= 0; goto ex;} } else { @@ -476,12 +477,12 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag) } 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); if(ret<=0) { sprintf(xorriso->info_text,"Cannot aquire drive '%s'", adr); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); - return(0); + ret= 0; goto ex; } } drive= dinfo[0].drive; @@ -497,7 +498,7 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag) if(flag&2) { xorriso->out_drive_handle= dinfo; if(Sfile_str(xorriso->outdev, adr, 0)<=0) - return(-1); + {ret= -1; goto ex;} if(state != BURN_DISC_BLANK && state != BURN_DISC_APPENDABLE) { sprintf(xorriso->info_text, "Disc status unsuitable for writing"); 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) { xorriso->in_drive_handle= dinfo; if(Sfile_str(xorriso->indev, adr, 0)<=0) - return(-1); + {ret= -1; goto ex;} } else if(flag&2) { if(xorriso->in_volset_handle==NULL) { /* No volume loaded: create empty one */ ret= Xorriso_create_empty_iso(xorriso, 0); if(ret<=0) - return(ret); + goto ex; } else { iso_image_ref((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, "Failed to attach ISO image object to outdev"); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); - return(-1); + {ret= -1; goto ex;} } } Xorriso_toc(xorriso, 1|2); - return(1+not_writeable); + {ret= 1+not_writeable; goto ex;} } 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, "Disc status not blank and unsuitable for reading"); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); - return(0); + {ret= 0; goto ex;} } /* fill read opts */ ret= isoburn_ropt_new(&ropts, 0); if(ret<=0) - return(ret); + goto ex; 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_input_charset(ropts, NULL); @@ -606,7 +607,8 @@ ex: if(hretout_drive_handle == xorriso->in_drive_handle || - xorriso->in_drive_handle == NULL) { + if(xorriso->out_drive_handle == xorriso->in_drive_handle) { source_drive= drive; } else { - ret= Xorriso_get_drive_handles(xorriso, &source_dinfo, &source_drive, - "on attempt to get source for write", 0); - if(ret<=0) - goto ex; + if(xorriso->in_drive_handle == NULL) { + source_drive= drive; + } else { + 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); if(s!=BURN_DISC_BLANK) { s= burn_disc_get_status(drive);