New option -pacifier, more compatible pacifier with -as mkisofs
This commit is contained in:
parent
13f21630b8
commit
7831dabc82
@ -1775,6 +1775,7 @@ 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.
|
||||
-pacifier gets set to "mkisofs" if files are added to the image.
|
||||
.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
|
||||
@ -1837,6 +1838,22 @@ to the command line arguments. I.e. all arguments will be interpreted cdrecord
|
||||
style until "--" is encountered and an eventual commit happens.
|
||||
From then on, options are interpreted as xorriso options.
|
||||
.TP
|
||||
\fB\-pacifier\fR behavior_code
|
||||
Control behavior of UPDATE pacifiers during write operations.
|
||||
The following behavior codes are defined:
|
||||
.br
|
||||
"xorriso" is the default format:
|
||||
.br
|
||||
Writing: sector XXXXX of YYYYYY [fifo active, nn% fill]
|
||||
.br
|
||||
"cdrecord" looks like:
|
||||
.br
|
||||
X of Y MB written (fifo nn%) [buf mmm%]
|
||||
.br
|
||||
"mkisofs"
|
||||
.br
|
||||
nn% done, estimate finish Tue Jul 15 20:13:28 2008
|
||||
.TP
|
||||
.B Scripting, dialog and program control features:
|
||||
.TP
|
||||
\fB\-no_rc\fR
|
||||
|
@ -1317,7 +1317,10 @@ completed:;
|
||||
|
||||
|
||||
/* @param flag bit0=with year and seconds
|
||||
bit1=timestamp format YYYY.MM.DD.hhmmss
|
||||
bit1-3= form
|
||||
0= ls -l format
|
||||
1= timestamp format YYYY.MM.DD.hhmmss
|
||||
2= Wdy Mon Day hh:mm:ss Year
|
||||
*/
|
||||
char *Ftimetxt(time_t t, char timetext[40], int flag)
|
||||
{
|
||||
@ -1325,16 +1328,23 @@ char *Ftimetxt(time_t t, char timetext[40], int flag)
|
||||
struct tm tms, *tmpt;
|
||||
static char months[12][4]= { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
||||
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
|
||||
static char days[7][4]= {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
|
||||
int form;
|
||||
|
||||
form= (flag>>1)&7;
|
||||
tmpt= localtime_r(&t, &tms);
|
||||
rpt= timetext;
|
||||
rpt[0]= 0;
|
||||
if(tmpt==0)
|
||||
sprintf(rpt+strlen(rpt), "%12.f", (double) t);
|
||||
else if (flag&2)
|
||||
else if (form==1)
|
||||
sprintf(rpt+strlen(rpt), "%4.4d.%2.2d.%2.2d.%2.2d%2.2d%2.2d",
|
||||
1900+tms.tm_year, tms.tm_mon, tms.tm_mday,
|
||||
tms.tm_hour, tms.tm_min, tms.tm_sec);
|
||||
else if (form==2)
|
||||
sprintf(rpt+strlen(rpt), "%s %s %2.2d %2.2d:%2.2d:%2.2d %4.4d",
|
||||
days[tms.tm_wday], months[tms.tm_mon], tms.tm_mday,
|
||||
tms.tm_hour, tms.tm_min, tms.tm_sec, 1900+tms.tm_year);
|
||||
else if (flag&1)
|
||||
sprintf(rpt+strlen(rpt), "%2d %3s %4.4d %2.2d:%2.2d:%2.2d",
|
||||
tms.tm_mday, months[tms.tm_mon], 1900+tms.tm_year,
|
||||
@ -2913,6 +2923,7 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag)
|
||||
m->insert_count= 0;
|
||||
m->insert_bytes= 0;
|
||||
m->error_count= 0;
|
||||
m->pacifier_style= 0;
|
||||
m->pacifier_interval= 1.0;
|
||||
m->pacifier_count= 0;
|
||||
m->pacifier_total= 0;
|
||||
@ -4189,6 +4200,13 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
|
||||
if(!(is_default && no_defaults))
|
||||
Xorriso_status_result(xorriso,filter,fp,flag&2);
|
||||
|
||||
is_default= (xorriso->pacifier_style==0);
|
||||
sprintf(line,"-pacifier '%s'\n",
|
||||
xorriso->pacifier_style==2 ? "mkisofs" :
|
||||
xorriso->pacifier_style==1 ? "cdrecord" : "xorriso");
|
||||
if(!(is_default && no_defaults))
|
||||
Xorriso_status_result(xorriso,filter,fp,flag&2);
|
||||
|
||||
is_default= (strcmp(xorriso->return_with_text,"SORRY")==0 &&
|
||||
xorriso->return_with_value==32);
|
||||
sprintf(line,"-return_with %s %d\n",
|
||||
@ -7835,6 +7853,7 @@ not_enough_args:;
|
||||
if(ret<=0)
|
||||
goto ex;
|
||||
was_path= 1;
|
||||
xorriso->pacifier_style= 2;
|
||||
}
|
||||
}
|
||||
if(do_print_size) {
|
||||
@ -10193,6 +10212,8 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
|
||||
" -as cdrecord [-help|-v|dev=|speed=|blank=|fs=|-eject|-atip|padsize=|path|-]",
|
||||
" Perform some cdrecord gestures, eventually write at most one",
|
||||
" data track to blank or overwriteable media.",
|
||||
" -pacifier \"xorriso\"|\"cdrecord\"|\"mkisofs\"",
|
||||
" Choose format of UPDATE pacifier during write operations.",
|
||||
"",
|
||||
"General options:",
|
||||
" -help Print this text",
|
||||
@ -11238,6 +11259,26 @@ int Xorriso_option_overwrite(struct XorrisO *xorriso, char *mode, int flag)
|
||||
}
|
||||
|
||||
|
||||
/* Option -pacifier */
|
||||
int Xorriso_option_pacifier(struct XorrisO *xorriso, char *style, int flag)
|
||||
{
|
||||
if(strcmp(style, "xorriso")==0 || strcmp(style, "default")==0)
|
||||
xorriso->pacifier_style= 0;
|
||||
else if(strcmp(style, "cdrecord")==0 || strcmp(style, "cdrskin")==0 ||
|
||||
strcmp(style, "wodim")==0 || strcmp(style, "xorrecord")==0)
|
||||
xorriso->pacifier_style= 1;
|
||||
else if(strcmp(style, "mkisofs")==0 || strcmp(style, "genisofs")==0 ||
|
||||
strcmp(style, "genisoimage")==0 || strcmp(style, "xorrisofs")==0)
|
||||
xorriso->pacifier_style= 2;
|
||||
else {
|
||||
sprintf(xorriso->info_text, "-pacifier: unknown behavior code '%s'", style);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
||||
return(0);
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
/* Option -padding */
|
||||
int Xorriso_option_padding(struct XorrisO *xorriso, char *size, int flag)
|
||||
{
|
||||
@ -12625,6 +12666,10 @@ next_command:;
|
||||
(*idx)++;
|
||||
ret= Xorriso_option_overwrite(xorriso,arg1,0);
|
||||
|
||||
} else if(strcmp(cmd,"pacifier")==0) {
|
||||
(*idx)++;
|
||||
ret= Xorriso_option_pacifier(xorriso, arg1, 0);
|
||||
|
||||
} else if(strcmp(cmd,"padding")==0) {
|
||||
(*idx)++;
|
||||
ret= Xorriso_option_padding(xorriso, arg1, 0);
|
||||
|
@ -425,6 +425,9 @@ int Xorriso_option_osirrox(struct XorrisO *xorriso, char *mode, int flag);
|
||||
/* Option -overwrite "on"|"nondir"|"off" */
|
||||
int Xorriso_option_overwrite(struct XorrisO *xorriso, char *mode, int flag);
|
||||
|
||||
/* Option -pacifier */
|
||||
int Xorriso_option_pacifier(struct XorrisO *xorriso, char *style, int flag);
|
||||
|
||||
/* Option -padding */
|
||||
int Xorriso_option_padding(struct XorrisO *xorriso, char *size, int flag);
|
||||
|
||||
|
@ -271,6 +271,7 @@ struct XorrisO { /* the global context of xorriso */
|
||||
double error_count; /* double will not roll over */
|
||||
|
||||
/* pacifiers */
|
||||
int pacifier_style; /* 0= xorriso, 1=cdrecord, 2=mkisofs */
|
||||
double pacifier_interval;
|
||||
double start_time;
|
||||
double last_update_time;
|
||||
@ -496,6 +497,12 @@ int Sort_argv(int argc, char **argv, int flag);
|
||||
/* @param flag bit0= single letters */
|
||||
char *Ftypetxt(mode_t st_mode, int flag);
|
||||
|
||||
/* @param flag bit0=with year and seconds
|
||||
bit1=timestamp format YYYY.MM.DD.hhmmss
|
||||
*/
|
||||
char *Ftimetxt(time_t t, char timetext[40], int flag);
|
||||
|
||||
|
||||
struct DirseQ;
|
||||
|
||||
int Dirseq_new(struct DirseQ **o, char *adr, int flag);
|
||||
|
@ -1 +1 @@
|
||||
#define Xorriso_timestamP "2008.07.15.121754"
|
||||
#define Xorriso_timestamP "2008.07.16.130711"
|
||||
|
@ -1096,7 +1096,8 @@ int Xorriso_check_burn_abort(struct XorrisO *xorriso, int flag)
|
||||
It issues pacifying update messages to the user.
|
||||
@param flag bit0-3 = emulation mode
|
||||
0= xorriso
|
||||
1= cdrskin
|
||||
1= cdrecord
|
||||
2= mkisofs
|
||||
bit4= report speed in CD units
|
||||
*/
|
||||
int Xorriso_pacifier_loop(struct XorrisO *xorriso, struct burn_drive *drive,
|
||||
@ -1104,16 +1105,19 @@ int Xorriso_pacifier_loop(struct XorrisO *xorriso, struct burn_drive *drive,
|
||||
{
|
||||
int ret, size, free_bytes, i, aborting= 0, emul, buffer_fill= 50, last_sector;
|
||||
struct burn_progress progress;
|
||||
char *status_text;
|
||||
char *status_text, date_text[80];
|
||||
enum burn_drive_status drive_status;
|
||||
double start_time, current_time, last_time;
|
||||
double measured_speed, speed_factor= 1385000;
|
||||
double measured_speed, speed_factor= 1385000, quot;
|
||||
time_t time_prediction;
|
||||
|
||||
start_time= Sfile_microtime(0);
|
||||
while(burn_drive_get_status(drive, NULL) == BURN_DRIVE_SPAWNING)
|
||||
usleep(100002);
|
||||
|
||||
emul= flag&15;
|
||||
if(emul==0)
|
||||
emul= xorriso->pacifier_style;
|
||||
if(flag&16)
|
||||
speed_factor= 150.0*1024;
|
||||
progress.sector= 0;
|
||||
@ -1134,14 +1138,15 @@ int Xorriso_pacifier_loop(struct XorrisO *xorriso, struct burn_drive *drive,
|
||||
sprintf(xorriso->info_text, "%4d MB written",
|
||||
progress.sector / 512);
|
||||
|
||||
if(xorriso->pacifier_fifo!=NULL) {
|
||||
if(xorriso->pacifier_fifo!=NULL)
|
||||
ret= burn_fifo_inquire_status(xorriso->pacifier_fifo,
|
||||
&size, &free_bytes, &status_text);
|
||||
else
|
||||
ret= isoburn_get_fifo_status(drive, &size, &free_bytes, &status_text);
|
||||
if(ret>0 )
|
||||
sprintf(xorriso->info_text+strlen(xorriso->info_text),
|
||||
" (fifo %2d%%)",
|
||||
(int) (100.0-100.0*((double) free_bytes)/(double) size));
|
||||
}
|
||||
|
||||
buffer_fill= 50;
|
||||
if(progress.buffer_capacity>0)
|
||||
@ -1158,6 +1163,19 @@ int Xorriso_pacifier_loop(struct XorrisO *xorriso, struct burn_drive *drive,
|
||||
measured_speed/speed_factor);
|
||||
}
|
||||
|
||||
} else if(emul == 2 &&
|
||||
progress.sectors > 0 && progress.sector <= progress.sectors) {
|
||||
/* "37.87% done, estimate finish Tue Jul 15 18:55:07 2008" */
|
||||
|
||||
quot= ((double) progress.sector) / ((double) progress.sectors);
|
||||
sprintf(xorriso->info_text, " %2.2f%% done", quot*100.0);
|
||||
if(current_time - start_time >= 2 && quot >= 0.02) {
|
||||
time_prediction= current_time +
|
||||
(1.0 - quot) / quot * (current_time-start_time) + 1;
|
||||
Ftimetxt(time_prediction, date_text, 4);
|
||||
sprintf(xorriso->info_text+strlen(xorriso->info_text),
|
||||
", estimate finish %s", date_text);
|
||||
}
|
||||
} else {
|
||||
if(progress.sector<=progress.sectors)
|
||||
sprintf(xorriso->info_text, "Writing: sector %d of %d",
|
||||
|
Loading…
Reference in New Issue
Block a user