diff --git a/xorriso/xorriso.1 b/xorriso/xorriso.1 index ad1bc282..d55daf0f 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 14, 2008" +.TH XORRISO 1 "February 19, 2008" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: @@ -1249,6 +1249,36 @@ This is subject to the settings of -follow. -findx accepts the -exec actions as does -find. But it will always perform action "echo". .TP +.B Command compatibility emulations: +.PP +ISO 9660 multi-session 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. +.TP +\fB\-as\fR personality option [options] -- +.br +Performs its variable length option list as sparse emulation of the program +depicted by personality. +.br +Personality "\fBcdrecord\fR" accepts the options listed with: +.br + -as cdrecord -help -- +.br +Among them: dev=, speed=, blank=, fs=, -eject, -atip, padsize=, +one track source file path or "-" for standard input as track source. +.br +It ignores most other options of cdrecord and cdrskin but refuses on +-audio, -scanbus and on blank 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. +.br +Personality "\fBcdrskin\fR" is an alias for "cdrecord". +.br +Personality "\fBwodim\fR" is an alias for "cdrecord". +.TP .B Scripting, dialog and program control features: .TP \fB\-no_rc\fR diff --git a/xorriso/xorriso.c b/xorriso/xorriso.c index 28b16f3f..69834574 100644 --- a/xorriso/xorriso.c +++ b/xorriso/xorriso.c @@ -820,7 +820,6 @@ decode:; return(1); } - #endif /* Xorriso_sfile_externaL */ @@ -4104,6 +4103,214 @@ much_too_long:; } +/* @param flag bit0= compare atime + bit1= compare ctime + bit31= do not issue result messages + @return 1=files match properly , 0=difference detected , -1=error +*/ +int Xorriso_compare_2_files(struct XorrisO *xorriso, char *adr1, char *adr2, + char *adr_common_tail, int flag) +{ + struct stat s1, s2; + int ret, differs= 0, r1, r2, fd1= -1, fd2= -1, i, done; + char *respt; + char buf1[SfileadrL], buf2[SfileadrL], a[5*SfileadrL], sfe[5*SfileadrL]; + off_t r1count= 0, r2count= 0, diffcount= 0, first_diff= -1; + + respt= xorriso->result_line; + ret= lstat(adr1, &s1); + if(ret==-1) { + sprintf(respt , "? %s : cannot lstat() : %s", + Text_shellsafe(adr1, sfe, 0), strerror(errno)); + if(!(flag&(1<<31))) + Xorriso_result(xorriso,0); + return(0); + } + if(S_ISDIR(s1.st_mode)) + strcpy(a, "d"); + else if(S_ISREG(s1.st_mode)) + strcpy(a, "-"); + else if(S_ISLNK(s1.st_mode)) + strcpy(a, "l"); + else if(S_ISBLK(s1.st_mode)) + strcpy(a, "b"); + else if(S_ISCHR(s1.st_mode)) + strcpy(a, "c"); + else if(S_ISFIFO(s1.st_mode)) + strcpy(a, "p"); + else if(S_ISSOCK(s1.st_mode)) + strcpy(a, "s"); + else + strcpy(a, "?"); + strcat(a, " "); + if(adr_common_tail[0]) + sprintf(a, Text_shellsafe(adr_common_tail, sfe, 0)); + else + strcat(a, "'.'"); + + ret= Xorriso_iso_lstat(xorriso, adr2, &s2, 0); + if(ret==-1) { + sprintf(respt, "? %s : cannot lstat() : %s\n", + Text_shellsafe(adr2, sfe, 0), strerror(errno)); + if(!(flag&(1<<31))) + Xorriso_result(xorriso,0); + return(0); + } + + /* Attributes */ + if(s1.st_mode != s2.st_mode) { + sprintf(respt, "%s : st_mode : %7.7o <> %7.7o\n", + a, s1.st_mode, s2.st_mode); + if(!(flag&(1<<31))) + Xorriso_result(xorriso,0); + differs= 1; + } + if(s1.st_uid != s2.st_uid) { + sprintf(respt, "%s : st_uid : %d <> %d\n", a, s1.st_uid, s2.st_uid); + if(!(flag&(1<<31))) + Xorriso_result(xorriso,0); + differs= 1; + } + if(s1.st_gid != s2.st_gid) { + sprintf(respt, "%s : st_gid : %d <> %d\n", a, s1.st_gid, s2.st_gid); + if(!(flag&(1<<31))) + Xorriso_result(xorriso,0); + differs= 1; + } + if((S_ISCHR(s1.st_mode) && S_ISCHR(s2.st_mode)) || + (S_ISBLK(s1.st_mode) && S_ISBLK(s2.st_mode))) { + if(s1.st_rdev != s2.st_rdev) { + sprintf(respt, "%s : %s st_rdev : %lu <> %lu\n", a, + (S_ISCHR(s1.st_mode) ? "S_IFCHR" : "S_IFBLK"), + (unsigned long) s1.st_rdev, (unsigned long) s1.st_rdev); + if(!(flag&(1<<31))) + Xorriso_result(xorriso,0); + differs= 1; + } + } + if(S_ISREG(s2.st_mode) && s1.st_size != s2.st_size) { + sprintf(respt, "%s : st_size : %.f <> %.f\n", + a, (double) s1.st_size, (double) s2.st_size); + if(!(flag&(1<<31))) + Xorriso_result(xorriso,0); + differs= 1; + } + if(s1.st_mtime != s2.st_mtime) { + sprintf(respt, "%s : st_mtime : %u <> %u\n", + a, (unsigned int) s1.st_mtime, (unsigned int) s2.st_mtime); + if(!(flag&(1<<31))) + Xorriso_result(xorriso,0); + differs= 1; + } + if(flag&1) { + if(s1.st_atime != s2.st_atime) { + sprintf(respt, "%s : st_atime : %u <> %u\n", + a, (unsigned int) s1.st_atime, (unsigned int) s2.st_atime); + if(!(flag&(1<<31))) + Xorriso_result(xorriso,0); + differs= 1; + } + } + if(flag&2) { + if(s1.st_ctime != s2.st_ctime) { + sprintf(respt, "%s : st_ctime : %u <> %u\n", + a, (unsigned int) s1.st_ctime, (unsigned int) s2.st_ctime); + if(!(flag&(1<<31))) + Xorriso_result(xorriso,0); + differs= 1; + } + } + if(S_ISREG(s1.st_mode)) { + fd1= open(adr1, O_RDONLY); + if(fd1==-1) { + sprintf(respt, "- %s : cannot open() : %s\n", adr1, strerror(errno)); + if(!(flag&(1<<31))) + Xorriso_result(xorriso,0); + return(0); + } + +/* >>> */ + + fd2= open(adr2, O_RDONLY); + if(fd2==-1) { + sprintf(respt, "- %s : cannot open() : %s\n", adr2, strerror(errno)); + if(!(flag&(1<<31))) + Xorriso_result(xorriso,0); + close(fd1); + return(0); + } + + /* Content */ + done= 0; + while(!done) { + r1= read(fd1, buf1, sizeof(buf1)); + r2= read(fd2, buf2, sizeof(buf2)); + if((r1==EOF && r2==EOF) || (r1==0 && r2==0)) + break; + if(r1==EOF || r1==0) { + if(r1==EOF) + r1= 0; + if(s1.st_size > r1count + r1) { + sprintf(respt, "- %s : early EOF after %.f bytes\n", + adr1, (double) r1count); + if(!(flag&(1<<31))) + Xorriso_result(xorriso,0); + } + differs= 1; + } + r1count+= r1; + if(r2==EOF || r2 r2count + r2) { + sprintf(respt, "- %s : early EOF after %.f bytes\n", + adr2, (double) r2count); + if(!(flag&(1<<31))) + Xorriso_result(xorriso,0); + } + differs= 1; + done= 1; + } + if(r2>r1) { + if(s1.st_size > r1count + r1) { + sprintf(respt, "- %s : early EOF after %.f bytes\n", + adr1, (double) r1count); + if(!(flag&(1<<31))) + Xorriso_result(xorriso,0); + } + differs= 1; + done= 1; + } + r2count+= r2; + if(r1>r2) + r1= r2; + for(i= 0; i0 || r1count!=r2count) { + if(first_diff<0) + first_diff= (r1count>r2count ? r2count : r1count); + sprintf(respt, "%s : %s : differs by at least %.f bytes. First at %.f\n", + a, (s1.st_mtime==s2.st_mtime ? "CONTENT": "content"), + (double) (diffcount + abs(r1count-r2count)), (double) first_diff); + if(!(flag&(1<<31))) + Xorriso_result(xorriso,0); + differs= 1; + } + } + if(fd1!=-1) + close(fd1); + if(fd2!=-1) + close(fd2); + return(!differs); +} + + /* @param flag bit0= count result rather than storing it bit1= unexpected change of number is a FATAL event */ @@ -5841,6 +6048,382 @@ int Xorriso_reassure(struct XorrisO *xorriso, char *cmd, char *which_will, return(0); } + +/* @param flag bit0+1= what to aquire after giving up outdev + 0=none, 1=indev, 2=outdev, 3=both +*/ +int Xorriso_reaquire_outdev(struct XorrisO *xorriso, int flag) +{ + int ret, aq_flag; + char drive_name[SfileadrL], sfe[5*SfileadrL]; + + aq_flag= flag&3; + strcpy(drive_name, xorriso->outdev); + Xorriso_give_up_drive(xorriso, aq_flag); + if(aq_flag==0) { + sprintf(xorriso->info_text,"Gave up -outdev %s", + Text_shellsafe(xorriso->outdev, sfe, 0)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + return(1); + } + sprintf(xorriso->info_text,"Re-aquiring -outdev %s", + Text_shellsafe(drive_name, sfe, 0)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + ret= Xorriso_aquire_drive(xorriso, drive_name, aq_flag); + if(ret<=0) { + sprintf(xorriso->info_text,"Could not re-aquire -outdev %s", + Text_shellsafe(xorriso->outdev, sfe, 0)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(ret); + } + return(1); +} + + +/* >>> micro version of cdrskin */ +/* @return <=0 error, 1 ok go on */ +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 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; + char mem_report_about_text[80], *report_about= "SORRY", blank_mode[80]; + char speed[80]; + + /* 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=", + "driveropts=", "gracetime=", "minbuf=", + + "assert_write_lba=", "fifo_start_at=", "dev_translation=", + "drive_scsi_dev_family=", "fallback_program=", "modesty_on_drive=", + "tao_to_sao_tsize=", + + "direct_write_amount=", "write_start_address=", "msifile=", "tsize=", + + "" + }; + static char ignored_full_options[][41]= { + "-d", "-Verbose", "-V", "-silent", "-s", "-setdropts", "-prcap", + "-reset", "-abort", "-overburn", "-ignsize", "-useinfo", + "-fix", "-nofix", + "-raw", "-raw96p", "-raw16", + "-clone", "-text", "-mode2", "-xa", "-xa1", "-xa2", "-xamix", + "-cdi", "-preemp", "-nopreemp", "-copy", "-nocopy", + "-scms", "-shorttrack", "-noshorttrack", "-packet", "-noclose", + "-media-info", "-minfo", + "-isosize", "-load", "-lock", "-raw96r", "-sao", "-dao", "-swab", + "-tao", "-waiti", "-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", + + "--grow_overwriteable_iso", "--help", "--tell_media_space", + + "" + }; + + static char helptext[][80]= { +"Usage: xorriso -as cdrskin [options|source_addresses]", +"Note: This is not cdrecord. See xorriso -help, xorriso -version, man xorriso", +"Options:", +"\t-version\tprint version information and exit emulation", +"\tdev=target\tpseudo-SCSI target to use as CD-Recorder", +"\t-v\t\tincrement verbose level by one", +"\t-checkdrive\tcheck if a driver for the drive is present", +"\t-inq\t\tdo an inquiry for the drive and exit emulation", +"\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-toc\t\tretrieve and print TOC/PMA data", +"\t-atip\t\tretrieve media state, print \"Is *erasable\"", +"\tpadsize=#\tAmount of padding", +"\t-data\t\tSubsequent tracks are CD-ROM data mode 1 (default)", +"\t-pad\t\tpadsize=30k", +"\t-nopad\t\tDo not pad", +"\t-help\t\tprint this text to stderr and exit", +"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", +"will be finalized afterwards if possible.", +"A much more elaborate cdrecord emulator is cdrskin from the same project.", +"@End_of_helptexT@" +}; +/* "\t-scanbus\tscan the SCSI bus and exit emulation", */ + +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", +"\tdeformat\t\tblank a formatted DVD-RW", +"\tdeformat_quickest\t\tminimally blank a formatted DVD-RW to DAO only", +"@End_of_helptexT@" +}; + + 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); /* give up indev */ + if(ret<=0) + 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: %s", + whom, Text_shellsafe(argv[i], sfe, 0)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); + + for(k=0;ignored_partial_options[k][0]!=0;k++) { + if(argv[i][0]=='-') + if(strncmp(argv[i]+1,ignored_partial_options[k], + strlen(ignored_partial_options[k]))==0) + goto no_volunteer; + if(strncmp(argv[i],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(argv[i],ignored_full_options[k])==0) + 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], "-atip")==0) { + do_atip= 1; + } else if(strcmp(argv[i], "-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(argv[i], "-blank=", 7)==0 || + strncmp(argv[i], "blank=", 6)==0) { + cpt= strchr(argv[i], '=')+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 { + sprintf(xorriso->info_text, + "-as %s: blank=%s not supported. See blank=help .", + whom, Text_shellsafe(argv[i], sfe, 0)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + } else if(strcmp(argv[i], "-checkdrive")==0) { + do_checkdrive= 1; + } else if(strcmp(argv[i], "-data")==0) { + /* ok */; + } else if(strncmp(argv[i], "-dev=", 5)==0 || + strncmp(argv[i], "dev=", 4)==0) { + cpt= strchr(argv[i], '=')+1; + ret= Xorriso_option_dev(xorriso, cpt, 2); + if(ret<=0) + goto ex; + } else if(strcmp(argv[i], "-dummy")==0) { + xorriso->do_dummy= 1; + } else if(strcmp(argv[i], "-eject")==0) { + do_eject= 1; + } else if(strncmp(argv[i], "-fs=", 4)==0 || strncmp(argv[i], "fs=", 3)==0) { + cpt= strchr(argv[i], '=')+1; + ret= Xorriso_option_fs(xorriso, cpt, 0); + if(ret<=0) + goto ex; + } else if(strcmp(argv[i], "-inq")==0) { + do_checkdrive= 2; + } else if(strcmp(argv[i], "-nopad")==0) { + xorriso->padding= 0; + } else if(strcmp(argv[i], "-pad")==0) { + xorriso->padding= 15*2048; + } else if(strncmp(argv[i], "-padsize=", 9)==0 || + strncmp(argv[i], "padsize=", 8)==0) { + cpt= strchr(argv[i], '=')+1; + ret= Xorriso_option_padding(xorriso, cpt, 0); + if(ret<=0) + goto ex; + } else if(strncmp(argv[i], "-speed=", 7)==0 || + strncmp(argv[i], "speed=", 6)==0) { + cpt= strchr(argv[i], '=')+1; + strncpy(speed, cpt, 79); + speed[79]= 0; + } else if(strcmp(argv[i], "-multi")==0) { + sprintf(xorriso->info_text, "-as %s: Option -multi not supported.", whom); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } else if(strcmp(argv[i], "-msinfo")==0) { + sprintf(xorriso->info_text, "-as %s: Option -msinfo not supported.",whom); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } else if(strcmp(argv[i], "--devices")==0) { + do_scanbus= 2; + } else if(strcmp(argv[i], "-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; + +/* do_scanbus= 1; */ + } else if(strcmp(argv[i], "-toc")==0) { + do_toc= 1; + } else if(strcmp(argv[i], "-v")==0 || strcmp(argv[i],"-verbose")==0) { + do_verbous++; + } else if(strcmp(argv[i], "-vv")==0) { + do_verbous+= 2; + } else if(strcmp(argv[i], "-vvv")==0) { + do_verbous+= 3; + } else if(strcmp(argv[i], "-version")==0) { + do_version= 1; + } else if(strcmp(argv[i], "-help")==0) { + do_help= 1; + } 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); + ret= 0; goto ex; + } else { + if(track_source[0]) { + sprintf(xorriso->info_text, "-as %s: Surplus track source %s", + whom, Text_shellsafe(argv[i], sfe, 0)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + sprintf(xorriso->info_text, "First and only track source is %s", + Text_shellsafe(track_source, sfe, 0)); + 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) 2008 see libburnia-project.org xorriso\n"); + Xorriso_result(xorriso, 1); + Xorriso_option_version(xorriso, 0); + ret= 1; goto ex; + } + if(do_help) { + 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; + } + 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(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); + } + ret= 1; 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(speed[0]) { + ret= Xorriso_option_speed(xorriso, speed, 0); + if(ret<=0) + goto ex; + } + + if(do_verbous<=0) + report_about= "SORRY"; + 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_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(blank_mode[0]) { + ret= Xorriso_option_blank(xorriso, blank_mode, 0); + if(ret<=0) + goto ex; + } + if(track_source[0]) { + xorriso->do_close= 1; + ret= Xorriso_burn_track(xorriso, track_source, 0); + aq_ret= Xorriso_reaquire_outdev(xorriso, 2*(ret>0)); + if(ret<=0 && ret=0) { + eject_ret= Xorriso_option_eject(xorriso, "out", 0); + if(eject_retinfo_text, "-as %s: Job could not be performed properly.", + 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->do_close= mem_do_close; + return(ret); +} + /* ---------------------------- Options API ------------------------ */ @@ -6039,6 +6622,49 @@ ex:; } +/* Option -as */ +/* @param flag bit0=do not report the added item + bit1=do not reset pacifier, no final pacifier message +*/ +int Xorriso_option_as(struct XorrisO *xorriso, int argc, char **argv, + int *idx, int flag) +{ + int end_idx, ret, idx_count; + + end_idx= Xorriso_end_idx(xorriso, argc, argv, *idx, 1); + idx_count= end_idx-(*idx); + if(end_idx<=0) { + if(idx_count<1) + sprintf(xorriso->info_text, + "-as : Not enough arguments given. Needed: whom do_what"); + else + sprintf(xorriso->info_text, + "-as %s : Not enough arguments given. Needed: do_what", + argv[*idx]); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + if(strcmp(argv[*idx], "cdrecord")==0 || strcmp(argv[*idx], "wodim")==0 || + strcmp(argv[*idx], "cdrskin")==0) { + ret= Xorriso_cdrskin(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]); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + + ret= 1; +ex:; + (*idx)= end_idx; + return(ret); +} + + + /* Option -ban_stdio_write */ int Xorriso_option_ban_stdio_write(struct XorrisO *xorriso, int flag) { @@ -6053,7 +6679,12 @@ int Xorriso_option_ban_stdio_write(struct XorrisO *xorriso, int flag) */ int Xorriso_option_blank(struct XorrisO *xorriso, char *mode, int flag) { - char drive_name[SfileadrL], *cmd= "-blank", sfe[5*SfileadrL]; + char drive_name[SfileadrL], *cmd= "-blank"; +#ifndef NIX + int aq_ret; +#else + sfe[5*SfileadrL]; +#endif int ret, aq_flag= 2, mode_flag; if(flag&1) @@ -6102,6 +6733,19 @@ int Xorriso_option_blank(struct XorrisO *xorriso, char *mode, int flag) return(ret); strcpy(drive_name, xorriso->outdev); if(ret!=2) { + +#ifndef NIX + + if(ret<=0) + aq_flag= 0; + aq_ret= Xorriso_reaquire_outdev(xorriso, aq_flag); + if(ret<=0 && retinfo_text,"Gave up -outdev %s", @@ -6119,6 +6763,9 @@ int Xorriso_option_blank(struct XorrisO *xorriso, char *mode, int flag) Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); return(ret); } + +#endif /* NIX */ + } return(1); } @@ -6673,12 +7320,12 @@ int Xorriso_option_devices(struct XorrisO *xorriso, int flag) Text_shellsafe(xorriso->indev, sfe, 0)); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); }else { - if(xorriso->in_drive_handle) { + if(xorriso->in_drive_handle!=NULL) { sprintf(xorriso->info_text, "Gave up -indev %s", Text_shellsafe(xorriso->indev, sfe, 0)); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); } - if(xorriso->out_drive_handle) { + if(xorriso->out_drive_handle!=NULL) { sprintf(xorriso->info_text, "Gave up -outdev %s", Text_shellsafe(xorriso->outdev, sfe, 0)); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); @@ -8208,11 +8855,11 @@ int Xorriso_option_rollback(struct XorrisO *xorriso, int flag) /* Option -speed */ int Xorriso_option_speed(struct XorrisO *xorriso, char *speed, int flag) { - int is_cd= 1, unit_found= 0; + int is_cd= 1, unit_found= 0, ret, profile_number; double num; - char *cpt; + char *cpt, profile_name[80]; - if(speed[0]==0) { + if(speed[0]==0 || strcmp(speed, "any")==0) { xorriso->speed= 0; /* full speed */ return(1); } @@ -8239,9 +8886,8 @@ cd_speed:; dvd_speed:; num*= 1385; } else if (!unit_found) { - - /* >>> try to determine target media */; - + ret= Xorriso_get_profile(xorriso, &profile_number, profile_name, 2); + is_cd= (ret==2); if(is_cd) goto cd_speed; else @@ -8520,6 +9166,9 @@ next_command:; ret= Xorriso_option_alter_date(xorriso, arg1, arg2, argc, argv, idx, strlen(cmd)>10); + } else if(strcmp(cmd,"as")==0) { + ret= Xorriso_option_as(xorriso, argc, argv, idx, 0); + } else if(strcmp(cmd,"ban_stdio_write")==0) { ret= Xorriso_option_ban_stdio_write(xorriso, 0); diff --git a/xorriso/xorriso_timestamp.h b/xorriso/xorriso_timestamp.h index 2c5ec6f1..0ab5e2d7 100644 --- a/xorriso/xorriso_timestamp.h +++ b/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2008.02.18.210343" +#define Xorriso_timestamP "2008.02.19.184432" diff --git a/xorriso/xorrisoburn.c b/xorriso/xorrisoburn.c index b6645a97..704ba3c7 100644 --- a/xorriso/xorrisoburn.c +++ b/xorriso/xorrisoburn.c @@ -18,6 +18,7 @@ #include #include #include +#include /* ------------------------------------------------------------------------ */ @@ -547,19 +548,6 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag) isoburn_ropt_set_default_perms(ropts, (uid_t) 0, (gid_t) 0, (mode_t) 0555); isoburn_ropt_set_input_charset(ropts, NULL); -#ifdef NIX - memset(&ropts, sizeof(ropts), 0); - ropts.norock= 0; - ropts.nojoliet= 0; - ropts.noiso1999= 1; - ropts.preferjoliet= 0; - ropts.uid= 0; - ropts.gid= 0; - ropts.mode= 0555; - ropts.input_charset= NULL; - ropts.pretend_blank= 0; -#endif /* NIX */ - Xorriso_set_image_severities(xorriso, 1); /* No DEBUG messages */ Xorriso_pacifier_reset(xorriso, 0); isoburn_set_read_pacifier(drive, Xorriso__read_pacifier, (void *) xorriso); @@ -716,13 +704,78 @@ int Xorriso_make_write_options( } +/* @param flag bit0= do not write but only prepare and return size in sectors + bit1= do not use isoburn wrappers +*/ +int Xorriso_sanitize_image_size(struct XorrisO *xorriso, + struct burn_drive *drive, struct burn_disc *disc, + struct burn_write_opts *burn_options, int flag) +{ + int ret, img_sectors, num_sessions= 0, num_tracks= 0, padding= 0, profile; + int media_space; + char profile_name[80]; + struct burn_session **sessions; + struct burn_track **tracks; + + ret= img_sectors= burn_disc_get_sectors(disc); + if(flag&1) + goto ex; + + sessions= burn_disc_get_sessions(disc, &num_sessions); + if(sessions==NULL || num_sessions < 1) { +no_track:; + Xorriso_process_msg_queues(xorriso,0); + sprintf(xorriso->info_text,"Program error : no track in prepared disc"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); + {ret= -1; goto ex;} + } + tracks= burn_session_get_tracks(sessions[0], &num_tracks); + if(tracks==NULL || num_tracks < 1) + goto no_track; + + padding= 0; + ret= burn_disc_get_profile(drive, &profile, profile_name); + padding= xorriso->padding / 2048; + if(xorriso->padding > padding * 2048) + padding++; + if(img_sectors>0 && (profile==0x09 || profile==0x0a)) { /* CD-R , CD-RW */ + if(img_sectors + padding < Xorriso_cd_min_track_sizE) { + padding= Xorriso_cd_min_track_sizE - img_sectors; + sprintf(xorriso->info_text, + "Expanded track to minimum size of %d sectors", + Xorriso_cd_min_track_sizE); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + } + } + burn_track_define_data(tracks[0], 0, padding * 2048, 0, BURN_MODE1); + Xorriso_process_msg_queues(xorriso,0); + + if(flag&2) + media_space= burn_disc_available_space(drive, burn_options) / + (off_t) 2048; + else + media_space= isoburn_disc_available_space(drive, burn_options) / + (off_t) 2048; + if(media_space < img_sectors + padding) { + Xorriso_process_msg_queues(xorriso,0); + sprintf(xorriso->info_text,"Image size %ds exceeds free space on media %ds", + img_sectors + padding, media_space); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + ret= 1; +ex:; + return(ret); +} + + /* @param flag bit0= do not write but only prepare and return size in sectors */ int Xorriso_write_session(struct XorrisO *xorriso, int flag) { - int ret, media_space, img_sectors, padding= 0, profile= 0, relax= 0, i; + int ret, relax= 0, i; int major, minor, micro; - char profile_name[80], xorriso_id[256], *img_id; + char xorriso_id[256], *img_id; struct isoburn_imgen_opts *sopts= NULL; struct burn_drive_info *dinfo, *source_dinfo; struct burn_drive *drive, *source_drive; @@ -736,6 +789,11 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag) IsoImage *image = NULL; ElToritoBootImage *bootimg; +#ifdef NIX + char profile_name[80]; + int padding= 0, img_sectors, media_space, profile; +#endif + ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive, "on attempt to write", 2); if(ret<=0) @@ -794,7 +852,6 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag) Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); } } - isoburn_igopt_set_level(sopts, 2); isoburn_igopt_set_extensions(sopts, 1|((!!xorriso->do_joliet)<<1)); isoburn_igopt_set_relaxed(sopts, isoburn_igopt_allow_deep_paths); @@ -804,33 +861,6 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag) isoburn_igopt_set_out_charset(sopts, NULL); isoburn_igopt_set_fifo_size(sopts, xorriso->fs * 2048); -#ifdef NIX - memset(&sopts, 0, sizeof(sopts)); - sopts.level= 2; - sopts.rockridge= 1; - sopts.joliet= !!xorriso->do_joliet; - sopts.iso1999= 0; - sopts.omit_version_numbers= 0; - sopts.allow_deep_paths= 1; - sopts.allow_longer_paths= 0; - sopts.max_37_char_filenames= 0; - sopts.no_force_dots= 0; - sopts.allow_lowercase= 0; - sopts.allow_full_ascii= 0; - sopts.joliet_longer_paths= 0; - sopts.sort_files= 1; - sopts.replace_dir_mode= 2*!!xorriso->do_global_mode; - sopts.dir_mode= xorriso->global_dir_mode; - sopts.replace_file_mode= 2*!!xorriso->do_global_mode; - sopts.file_mode= xorriso->global_file_mode; - sopts.replace_uid= 2*!!xorriso->do_global_uid; - sopts.uid= xorriso->global_uid; - sopts.replace_gid= 2*!!xorriso->do_global_gid; - sopts.gid= xorriso->global_gid; - sopts.output_charset= NULL; - sopts.fifo_size= xorriso->fs * 2048; -#endif /* NIX */ - if(image!=NULL && strlen(Xorriso_program_versioN)+strlen(Xorriso_timestamP)<80) { sprintf(xorriso_id, "XORRISO-%s %s", @@ -882,6 +912,18 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag) if(ret<=0) goto ex; +#ifndef NIX + + ret= Xorriso_sanitize_image_size(xorriso, drive, disc, burn_options, flag&1); + if(ret<=0) { + isoburn_cancel_prepared_write(source_drive, drive, 0); + goto ex; + } + if(flag&1) + goto ex; + +#else + ret= img_sectors= burn_disc_get_sectors(disc); if(flag&1) goto ex; @@ -926,6 +968,8 @@ no_track:; {ret= 0; goto ex;} } +#endif /* NIX */ + xorriso->run_state= 1; /* Indicate that burning has started */ isoburn_disc_write(burn_options, disc); burn_write_opts_free(burn_options); @@ -1041,8 +1085,11 @@ int Xorriso_pacifier_loop(struct XorrisO *xorriso, struct burn_drive *drive, break; current_time= Sfile_microtime(0); if(drive_status == BURN_DRIVE_WRITING && progress.sectors > 0) { - sprintf(xorriso->info_text, "Writing: sector %d of %d", - progress.sector, progress.sectors); + if(progress.sector<=progress.sectors) + sprintf(xorriso->info_text, "Writing: sector %d of %d", + progress.sector, progress.sectors); + else + sprintf(xorriso->info_text, "Writing: sector %d", progress.sector); ret= isoburn_get_fifo_status(drive, &size, &free_bytes, &status_text); if(ret>0 ) sprintf(xorriso->info_text+strlen(xorriso->info_text), @@ -1823,17 +1870,6 @@ int Xorriso_process_msg_queues(struct XorrisO *xorriso, int flag) error_code==0x3feb9 || error_code==0x3feb2) strcpy(severity, "MISHAP"); -#ifdef NIX - /* ??? throw this out already yet and rely on above libburn workaround ?*/ - /* <<< SORRY messages during burn run get mapped to MISHAP - should not be necessary with libisofs-0.6.4 */ - if(pass+tunneled==0 && xorriso->run_state==1 && - strcmp(severity, "SORRY")==0) { - fprintf(stderr, "xorriso_DEBUG: %s %X\n", severity, error_code); - strcpy(severity, "MISHAP"); /* image generation severity */ - } -#endif - Xorriso_msgs_submit(xorriso, error_code, xorriso->info_text, os_errno, severity, ((pass+tunneled)+1)<<2); count++; @@ -3797,3 +3833,271 @@ int Xorriso_report_lib_versions(struct XorrisO *xorriso, int flag) return(1); } + +/* @param flag bit0= -inq + bit1= -checkdrive +*/ +int Xorriso_atip(struct XorrisO *xorriso, int flag) +{ + int ret, profile_number= 0; + char *respt, profile_name[80]; + double x_speed_max, x_speed_min= -1.0; + struct burn_drive_info *dinfo; + struct burn_drive *drive; + enum burn_disc_status s; + + ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive, + "on attempt to print drive and media info", 2); + if(ret<=0) + return(0); + respt= xorriso->result_line; + sprintf(respt, "Device type :"); + ret= burn_drive_get_drive_role(drive); + if(ret==0) + sprintf(respt+strlen(respt), "%s\n", "Emulated (null-drive)"); + else if(ret==2) + sprintf(respt+strlen(respt), "%s\n", + "Emulated (stdio-drive, 2k random read-write)"); + else if(ret==3) + sprintf(respt+strlen(respt), "%s\n", + "Emulated (stdio-drive, sequential write-only)"); + else if(ret!=1) + sprintf(respt+strlen(respt), "%s\n","Emulated (stdio-drive)"); + else + sprintf(respt+strlen(respt), "%s\n","Removable CD-ROM"); + sprintf(respt+strlen(respt), "Vendor_info : '%s'\n",dinfo->vendor); + sprintf(respt+strlen(respt), "Identifikation : '%s'\n",dinfo->product); + sprintf(respt+strlen(respt), "Revision : '%s'\n",dinfo->revision); + Xorriso_result(xorriso,1); + if(flag&1) + return(1); + sprintf(respt, "Driver flags : BURNFREE\n"); + sprintf(respt+strlen(respt), "Supported modes: SAO TAO\n"); + Xorriso_result(xorriso,1); + if(flag&2) + return(1); + + s= burn_disc_get_status(drive); + ret= burn_disc_get_profile(drive,&profile_number,profile_name); + if(ret<=0) { + profile_number= 0; + strcpy(profile_name, "-unidentified-"); + } + if(s != BURN_DISC_UNSUITABLE) { + ret= burn_disc_read_atip(drive); + if(ret>0) { + ret= burn_drive_get_min_write_speed(drive); + x_speed_min= ((double) ret)/176.4; + } + } + if(s==BURN_DISC_EMPTY) { + sprintf(respt, "Current: none\n"); + Xorriso_result(xorriso,1); + return(1); + } else + sprintf(respt, "Current: %s\n",profile_name); + Xorriso_result(xorriso,1); + if(strstr(profile_name,"DVD")==profile_name) { + sprintf(respt, "book type: %s (emulated booktype)\n", profile_name); + Xorriso_result(xorriso,1); + sprintf(respt, "xorriso: message for sdvdbackup: \"(growisofs mode Restricted Overwrite)\"\n"); + Xorriso_result(xorriso,1); + } else { + sprintf(respt, "ATIP info from disk:\n"); + Xorriso_result(xorriso,1); + if(burn_disc_erasable(drive)) + sprintf(respt, " Is erasable\n"); + else + sprintf(respt, " Is not erasable\n"); + Xorriso_result(xorriso,1); + { int start_lba,end_lba,min,sec,fr; + ret= burn_drive_get_start_end_lba(drive,&start_lba,&end_lba,0); + if(ret>0) { + burn_lba_to_msf(start_lba,&min,&sec,&fr); + sprintf(respt, " ATIP start of lead in: %d (%-2.2d:%-2.2d/%-2.2d)\n", + start_lba,min,sec,fr); + Xorriso_result(xorriso,1); + burn_lba_to_msf(end_lba,&min,&sec,&fr); + sprintf(respt, " ATIP start of lead out: %d (%-2.2d:%-2.2d/%-2.2d)\n", + end_lba,min,sec,fr); + Xorriso_result(xorriso,1); + } + } + ret= burn_drive_get_write_speed(drive); + x_speed_max= ((double) ret)/176.4; + if(x_speed_min<0) + x_speed_min= x_speed_max; + sprintf(respt, + " 1T speed low: %.f 1T speed high: %.f\n",x_speed_min,x_speed_max); + Xorriso_result(xorriso,1); + } + return(1); +} + + +int Xorriso_burn_track(struct XorrisO *xorriso, char *track_source, int flag) +{ + int ret, fd, unpredicted_size; + struct burn_drive_info *dinfo; + struct burn_drive *drive; + struct burn_write_opts *burn_options; + struct burn_disc *disc= NULL; + struct burn_session *session; + struct burn_track *track; + struct stat stbuf; + off_t fixed_size= 0; + struct burn_source *data_src, *fifo_src; + enum burn_disc_status disc_state; + char reasons[BURN_REASONS_LEN], sfe[5*SfileadrL]; + + + ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive, + "on attempt to burn track", 2); + if(ret<=0) + return(0); + ret= Xorriso_make_write_options(xorriso, drive, &burn_options, 0); + if(ret<=0) + goto ex; + + disc= burn_disc_create(); + session= burn_session_create(); + ret= burn_disc_add_session(disc,session,BURN_POS_END); + if(ret==0) { + /* >>> */; + goto ex; + } + track= burn_track_create(); + if(track_source[0] == '-' && track_source[1] == 0) { + fd= 0; + } else { + fd= open(track_source, O_RDONLY); + if(fd>=0) + if(fstat(fd,&stbuf)!=-1) + if((stbuf.st_mode&S_IFMT)==S_IFREG) + fixed_size= stbuf.st_size; + } + if(fixed_size==0) + unpredicted_size= 1; + + data_src= NULL; + if(fd>=0) + data_src= burn_fd_source_new(fd, -1, fixed_size); + if(data_src==NULL) { + sprintf(xorriso->info_text, "Could not open data source %s", + Text_shellsafe(track_source,sfe,0)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE", 0); + ret= 0; goto ex; + } + fifo_src= burn_fifo_source_new(data_src, 2048, xorriso->fs, 0); + if(fifo_src == NULL) { + sprintf(xorriso->info_text, "Could not create fifo object of 4 MB"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); + ret= 0; goto ex; + } + if(burn_track_set_source(track, fifo_src)!=BURN_SOURCE_OK) { + sprintf(xorriso->info_text, + "Cannot attach source object to track object"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); + ret= 0; goto ex; + } + burn_session_add_track(session, track, BURN_POS_END); + burn_source_free(data_src); + + disc_state = burn_disc_get_status(drive); + if(disc_state == BURN_DISC_BLANK) { + /* ok */; + } else if(disc_state == BURN_DISC_APPENDABLE) { + if(!isoburn_needs_emulation(drive)) { + sprintf(xorriso->info_text, + "Appendable media with data detected. Need blank media."); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + } else { + if(disc_state == BURN_DISC_FULL) { + sprintf(xorriso->info_text, + "Closed media with data detected. Need blank media."); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + if(burn_disc_erasable(drive)) { + sprintf(xorriso->info_text, "Try --blank_fast\n"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "HINT", 0); + } + } else if(disc_state == BURN_DISC_EMPTY) { + sprintf(xorriso->info_text, "No media detected in drive"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + } else { + sprintf(xorriso->info_text, + "Cannot recognize state of drive and media"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + } + ret= 0; goto ex; + } + if(burn_write_opts_auto_write_type(burn_options, disc, reasons, 0) == + BURN_WRITE_NONE) { + sprintf(xorriso->info_text, + "Failed to find a suitable write mode with this media.\n"); + sprintf(xorriso->info_text+strlen(xorriso->info_text), + "Reasons given:\n%s", reasons); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + + if(isoburn_needs_emulation(drive)) + burn_write_opts_set_start_byte(burn_options, (off_t) 0); + ret= Xorriso_sanitize_image_size(xorriso, drive, disc, burn_options, 2); + if(ret<=0) + goto ex; + + xorriso->run_state= 1; /* Indicate that burning has started */ + burn_disc_write(burn_options, disc); + + ret= Xorriso_pacifier_loop(xorriso, drive, 0); + if(ret<=0) + goto ex; + if(!burn_drive_wrote_well(drive)) { + Xorriso_process_msg_queues(xorriso,0); + sprintf(xorriso->info_text, + "libburn indicates failure with writing."); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + + sprintf(xorriso->info_text, "Writing completed sucessfully.\n\n"); + Xorriso_info(xorriso, 0); + ret= 1; +ex:; + Xorriso_process_msg_queues(xorriso,0); + if(disc!=NULL) + burn_disc_free(disc); + xorriso->run_state= 0; /* Indicate that burning has ended */ + return(ret); +} + + + +/* @param flag bit1= outdev rather than indev + @return <0 error, 0 = no profile to see , 1= ok , 2= ok, is CD profile +*/ +int Xorriso_get_profile(struct XorrisO *xorriso, int *profile_number, + char profile_name[80], int flag) +{ + int ret; + struct burn_drive_info *dinfo; + struct burn_drive *drive; + + *profile_number= 0; + profile_name[0]= 0; + if(xorriso->out_drive_handle==NULL) + return(0); + ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive, + "on attempt to determine media type", flag&2); + if(ret<=0) + return(0); + ret=burn_disc_get_profile(drive, profile_number, profile_name); + if(ret<=0) + return(ret); + if(*profile_number==0x08 || *profile_number==0x09 || *profile_number==0x0a) + return(2); + return(0); + +} diff --git a/xorriso/xorrisoburn.h b/xorriso/xorrisoburn.h index 5fb0707b..fb4b2631 100644 --- a/xorriso/xorrisoburn.h +++ b/xorriso/xorrisoburn.h @@ -149,5 +149,18 @@ int Xorriso_report_lib_versions(struct XorrisO *xorriso, int flag); int Xorriso_iso_lstat(struct XorrisO *xorriso, char *path, struct stat *stbuf, int flag); +/* @param flag bit0= -inq + bit1= -checkdrive +*/ +int Xorriso_atip(struct XorrisO *xorriso, int flag); + +int Xorriso_burn_track(struct XorrisO *xorriso, char *track_source, int flag); + +/* @param flag bit1= outdev rather than indev + @return <=0 = failure , 1= ok , 2= ok, is CD profile +*/ +int Xorriso_get_profile(struct XorrisO *xorriso, int *profile_number, + char profile_name[80], int flag); + #endif /* Xorrisoburn_includeD */