New option -sleep
This commit is contained in:
parent
506fabb364
commit
01240196bf
@ -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;
|
||||
|
@ -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",
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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
|
||||
|