New option -sleep

This commit is contained in:
Thomas Schmitt 2011-10-14 09:43:30 +00:00
parent 506fabb364
commit 01240196bf
9 changed files with 104 additions and 44 deletions

View File

@ -243,6 +243,7 @@ Xorriso_option_setfattri;
Xorriso_option_setfattr_listi;
Xorriso_option_set_filter;
Xorriso_option_signal_handling;
Xorriso_option_sleep;
Xorriso_option_speed;
Xorriso_option_split_size;
Xorriso_option_status;

View File

@ -1991,6 +1991,8 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
" Print a text to mark channel.",
" -prompt text",
" Wait for Enter key resp. for a line of input at stdin.",
" -sleep number",
" Do nothing during the given number of seconds.",
" -errfile_log mode path|channel",
" Log disk paths of files involved in problem events.",
" -session_log path",

View File

@ -691,7 +691,6 @@ int Xorriso_option_session_log(struct XorrisO *xorriso, char *path, int flag)
}
/* Option -setfacl_list alias -setfacl_listi */
int Xorriso_option_setfacl_listi(struct XorrisO *xorriso, char *path, int flag)
{
@ -1217,6 +1216,38 @@ int Xorriso_option_signal_handling(struct XorrisO *xorriso, char *mode,
}
/* Option -sleep */
int Xorriso_option_sleep(struct XorrisO *xorriso, char *duration, int flag)
{
double dur= 0.0, start_time, end_time, todo, granularity= 0.01;
unsigned long usleep_time;
sscanf(duration, "%lf", &dur);
start_time= Sfile_microtime(0);
end_time= start_time + dur;
Ftimetxt(time(NULL), xorriso->info_text, 6);
sprintf(xorriso->info_text + strlen(xorriso->info_text),
" : Will sleep for %f seconds", dur);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "UPDATE", 0);
while(1) {
todo= end_time - Sfile_microtime(0);
if(todo <= 0)
usleep_time= 0;
else if(todo > granularity)
usleep_time= granularity * 1.0e6;
else
usleep_time= todo * 1.0e6;
if(usleep_time == 0)
break;
usleep(usleep_time);
}
sprintf(xorriso->info_text, "Slept for %f seconds",
Sfile_microtime(0) - start_time);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0);
return(1);
}
/* Option -speed */
int Xorriso_option_speed(struct XorrisO *xorriso, char *speed, int flag)
{

View File

@ -473,7 +473,7 @@ int Xorriso_count_args(struct XorrisO *xorriso, int argc, char **argv,
"preparer_id","print","print_info","print_mark","prompt",
"prog","prog_help","publisher","quoted_not_list","quoted_path_list",
"reassure","report_about","rom_toc_scan","scsi_log",
"session_log","signal_handling",
"session_log","signal_handling","sleep",
"speed","split_size","status","status_history_max",
"stdio_sync","stream_recording","system_id","temp_mem_limit",
"uid","unregister_filter","use_readline","volid","volset_id",
@ -1339,6 +1339,10 @@ next_command:;
(*idx)++;
ret= Xorriso_option_signal_handling(xorriso, arg1, 0);
} else if(strcmp(cmd,"sleep")==0) {
(*idx)++;
ret= Xorriso_option_sleep(xorriso, arg1, 0);
} else if(strcmp(cmd,"speed")==0) {
(*idx)++;
ret= Xorriso_option_speed(xorriso, arg1, 0);

View File

@ -9,7 +9,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 "Version 1.1.7, Sep 27, 2011"
.TH XORRISO 1 "Version 1.1.7, Oct 13, 2011"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
@ -4068,6 +4068,11 @@ Show text at beginning of output line and
wait for the user to hit the Enter key
resp. to send a line via stdin.
.TP
\fB\-sleep\fR seconds
Wait for the given number of seconds before perfoming the next command.
The sleep time is given by a decimal number. E.g. "15" or "0.5".
Expect coarse granularity in the range of about 1/100 seconds.
.TP
\fB\-errfile_log\fR mode path|channel
.br
If problem events are related to input files from the filesystem, then their

View File

@ -1176,6 +1176,9 @@ int Xorriso_option_set_filter(struct XorrisO *xorriso, char *name,
int Xorriso_option_signal_handling(struct XorrisO *xorriso, char *mode,
int flag);
/* Option -sleep */
int Xorriso_option_sleep(struct XorrisO *xorriso, char *duration, int flag);
/* Option -speed */
int Xorriso_option_speed(struct XorrisO *xorriso, char *speed, int flag);

View File

@ -3563,6 +3563,12 @@ File: xorriso.info, Node: Scripting, Next: Frontend, Prev: Emulation, Up: Op
Show text at beginning of output line and wait for the user to hit
the Enter key resp. to send a line via stdin.
-sleep seconds
Wait for the given number of seconds before perfoming the next
command. The sleep time is given by a decimal number. E.g. "15"
or "0.5". Expect coarse granularity in the range of about 1/100
seconds.
-errfile_log mode path|channel
If problem events are related to input files from the filesystem,
then their disk_paths can be logged to a file or to output
@ -4243,7 +4249,7 @@ File: xorriso.info, Node: CommandIdx, Next: ConceptIdx, Prev: Legal, Up: Top
[index]
* Menu:
* # starts a comment line: Scripting. (line 158)
* # starts a comment line: Scripting. (line 164)
* -abort_on controls abort on error: Exception. (line 27)
* -abstract_file sets abstract file name: SetWrite. (line 160)
* -acl controls handling of ACLs: Loading. (line 142)
@ -4310,8 +4316,8 @@ File: xorriso.info, Node: CommandIdx, Next: ConceptIdx, Prev: Legal, Up: Top
* -dvd_obs set write block size: SetWrite. (line 238)
* -early_stdio_test classifies stdio drives: Loading. (line 251)
* -eject ejects drive tray: Writing. (line 36)
* -end writes pending session and ends program: Scripting. (line 152)
* -errfile_log logs problematic disk files: Scripting. (line 114)
* -end writes pending session and ends program: Scripting. (line 158)
* -errfile_log logs problematic disk files: Scripting. (line 120)
* -error_behavior controls error workarounds: Exception. (line 96)
* -external_filter registers data filter: Filter. (line 20)
* -external_filter unregisters data filter: Filter. (line 48)
@ -4408,11 +4414,11 @@ File: xorriso.info, Node: CommandIdx, Next: ConceptIdx, Prev: Legal, Up: Top
* -rm_r deletes trees from ISO image: Manip. (line 28)
* -rmdir deletes ISO directory: Manip. (line 32)
* -rollback discards pending changes: Writing. (line 9)
* -rollback_end ends program without writing: Scripting. (line 155)
* -rollback_end ends program without writing: Scripting. (line 161)
* -rom_toc_scan searches for sessions: Loading. (line 210)
* -scdbackup_tag enables scdbackup checksum tag: Emulation. (line 168)
* -scsi_log reports SCSI commands: Scripting. (line 143)
* -session_log logs written sessions: Scripting. (line 134)
* -scsi_log reports SCSI commands: Scripting. (line 149)
* -session_log logs written sessions: Scripting. (line 140)
* -session_string composes session info line: Inquiry. (line 66)
* -set_filter applies filter to file: Filter. (line 60)
* -set_filter_r applies filter to file tree: Filter. (line 85)
@ -4426,6 +4432,7 @@ File: xorriso.info, Node: CommandIdx, Next: ConceptIdx, Prev: Legal, Up: Top
* -show_stream_r shows data source and filters: Navigate. (line 183)
* -signal_handling controls handling of system signals: Exception.
(line 69)
* -sleep waits for a given time span: Scripting. (line 114)
* -speed set write speed: SetWrite. (line 211)
* -split_size enables large file splitting: SetInsert. (line 140)
* -status shows current settings: Scripting. (line 47)
@ -4482,7 +4489,7 @@ File: xorriso.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top
* Character set, learn from image, -auto_charset: Loading. (line 97)
* Character Set, of terminal, -local_charset: Charset. (line 47)
* Closed media, _definition: Media. (line 43)
* Comment, #: Scripting. (line 158)
* Comment, #: Scripting. (line 164)
* Control, signal handling, -signal_handling: Exception. (line 69)
* Create, new ISO image, _definiton: Methods. (line 6)
* Cylinder alignment, _definiton: Bootable. (line 167)
@ -4513,7 +4520,7 @@ File: xorriso.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top
* Drive, get drive list, -devices: Inquiry. (line 7)
* Drive, list supported media, -list_profiles: Writing. (line 150)
* Drive, reduce activity, -calm_drive: Loading. (line 235)
* Drive, report SCSI commands, -scsi_log: Scripting. (line 143)
* Drive, report SCSI commands, -scsi_log: Scripting. (line 149)
* Drive, write and eject, -commit_eject: Writing. (line 40)
* EA, _definiton: Extras. (line 54)
* El Torito, _definiton: Extras. (line 19)
@ -4626,16 +4633,16 @@ File: xorriso.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top
* Process, control exit value, -return_with: Exception. (line 39)
* Process, control verbosity, -report_about: Exception. (line 55)
* Process, disable startup files, -no_rc: Scripting. (line 7)
* Process, end program and write, -end: Scripting. (line 152)
* Process, end program, no writing, -rollback_end: Scripting. (line 155)
* Process, end program and write, -end: Scripting. (line 158)
* Process, end program, no writing, -rollback_end: Scripting. (line 161)
* Process, error workarounds, -error_behavior: Exception. (line 96)
* Process, log output channels to file, -logfile: Frontend. (line 20)
* Process, read command file, -options_from_file: Scripting. (line 12)
* Process, set synchronizing message, -mark: Frontend. (line 25)
* Program, backslash conversion, -backslash_codes: Scripting. (line 67)
* Program, curb memory, -temp_mem_limit: Scripting. (line 92)
* Program, end and write, -end: Scripting. (line 152)
* Program, end without writing, -rollback_end: Scripting. (line 155)
* Program, end and write, -end: Scripting. (line 158)
* Program, end without writing, -rollback_end: Scripting. (line 161)
* Program, list extra features, -list_extras: Scripting. (line 26)
* Program, print help text, -help: Scripting. (line 20)
* Program, print help text, -prog_help: Frontend. (line 33)
@ -4649,6 +4656,7 @@ File: xorriso.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top
* Program, set name, -prog: Frontend. (line 30)
* Program, show current settings, -status: Scripting. (line 47)
* Program, status history, -status_history_max: Scripting. (line 56)
* Program, wait a time span, -sleep: Scripting. (line 114)
* Quoted input, _definiton: Processing. (line 42)
* Recovery, retrieve blocks, -check_media: Verify. (line 21)
* Rename, in ISO image, -mv: Manip. (line 35)
@ -4666,7 +4674,7 @@ File: xorriso.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top
* Session, altered start address, -displacement: Loading. (line 35)
* Session, info string, -session_string: Inquiry. (line 66)
* Session, issue mount command, -mount: Restore. (line 126)
* Session, log when written, -session_log: Scripting. (line 134)
* Session, log when written, -session_log: Scripting. (line 140)
* Session, mount command line, -mount_cmd: Inquiry. (line 41)
* Session, mount parameters, -mount_opts: Inquiry. (line 57)
* Session, select as input, -load: Loading. (line 11)
@ -4695,8 +4703,8 @@ File: xorriso.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top
* Write, enable Joliet, -joliet: SetWrite. (line 10)
* Write, fifo size, -fs: SetWrite. (line 255)
* Write, free space, -tell_media_space: Inquiry. (line 88)
* Write, log problematic disk files, -errfile_log: Scripting. (line 114)
* Write, log written sessions, -session_log: Scripting. (line 134)
* Write, log problematic disk files, -errfile_log: Scripting. (line 120)
* Write, log written sessions, -session_log: Scripting. (line 140)
* Write, padding image, -padding: SetWrite. (line 268)
* Write, pending ISO image, -commit: Writing. (line 13)
* Write, predict image size, -print_size: Inquiry. (line 79)
@ -4743,29 +4751,29 @@ Node: Verify149945
Node: Restore158610
Node: Emulation165515
Node: Scripting175318
Node: Frontend182328
Node: Examples183627
Node: ExDevices184798
Node: ExCreate185457
Node: ExDialog186731
Node: ExGrowing187993
Node: ExModifying188795
Node: ExBootable189296
Node: ExCharset189845
Node: ExPseudo190665
Node: ExCdrecord191563
Node: ExMkisofs191878
Node: ExGrowisofs193216
Node: ExException194351
Node: ExTime194805
Node: ExIncBackup195264
Node: ExRestore199188
Node: ExRecovery200146
Node: Files200714
Node: Seealso202012
Node: Bugreport202676
Node: Legal203257
Node: CommandIdx204187
Node: ConceptIdx219210
Node: Frontend182566
Node: Examples183865
Node: ExDevices185036
Node: ExCreate185695
Node: ExDialog186969
Node: ExGrowing188231
Node: ExModifying189033
Node: ExBootable189534
Node: ExCharset190083
Node: ExPseudo190903
Node: ExCdrecord191801
Node: ExMkisofs192116
Node: ExGrowisofs193454
Node: ExException194589
Node: ExTime195043
Node: ExIncBackup195502
Node: ExRestore199426
Node: ExRecovery200384
Node: Files200952
Node: Seealso202250
Node: Bugreport202914
Node: Legal203495
Node: CommandIdx204425
Node: ConceptIdx219521

End Tag Table

View File

@ -50,7 +50,7 @@
@c man .\" First parameter, NAME, should be all caps
@c man .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
@c man .\" other parameters are allowed: see man(7), man(1)
@c man .TH XORRISO 1 "Version 1.1.7, Sep 27, 2011"
@c man .TH XORRISO 1 "Version 1.1.7, Oct 13, 2011"
@c man .\" Please adjust this date whenever revising the manpage.
@c man .\"
@c man .\" Some roff macros, for reference:
@ -4788,6 +4788,12 @@ Show text at beginning of output line and
wait for the user to hit the Enter key
resp. to send a line via stdin.
@c man .TP
@item -sleep seconds
@kindex -sleep waits for a given time span
@cindex Program, wait a time span, -sleep
Wait for the given number of seconds before perfoming the next command.
Expect coarse granularity no better than 1/100 seconds.
@c man .TP
@item -errfile_log mode path|channel
@kindex -errfile_log logs problematic disk files
@cindex Write, log problematic disk files, -errfile_log

View File

@ -1 +1 @@
#define Xorriso_timestamP "2011.10.13.105921"
#define Xorriso_timestamP "2011.10.14.094257"