Changed the parameter rules for new command -launch_frontend

This commit is contained in:
Thomas Schmitt 2012-12-25 17:56:24 +00:00
parent 7aba2e615c
commit df54691f2f
10 changed files with 82 additions and 141 deletions

View File

@ -2082,11 +2082,10 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
" \"parse\"|\"parse_bulk\"|\"compare_sev\"|\"list_sev\" param_text",
" Enable, use, or disable message sieve. Or parse lines into",
" words. Or compare or list severity names.",
" -launch_frontend program_with_args command_pipe reply_pipe",
" -launch_frontend program [args ...] --",
" Start a program, connect its stdin to xorriso stdout and",
" stderr, connect its stdout to xorriso stdin.",
" If command_pipe and reply_pipe are nonempty, use them as",
" named pipes. The started program is supposed to use them too.",
" Use any given parameters as arguments for the started program.",
" -logfile channel fileaddress Copy output of a channel to the given file.",
" channel may be 'R','I','M' as with -pkt_output or '.'",
" for the consolidated -pkt_output stream.",

View File

@ -75,23 +75,29 @@ int Xorriso_option_joliet(struct XorrisO *xorriso, char *mode, int flag)
/* Command -launch_frontend */
int Xorriso_option_launch_frontend(struct XorrisO *xorriso, char *cmd,
char *cmd_pipe_adr, char *reply_pipe_adr, int flag)
int Xorriso_option_launch_frontend(struct XorrisO *xorriso,
int argc, char **argv, int *idx, int flag)
{
int ret;
int ret, end_idx;
xorriso->dialog= 2;
end_idx= Xorriso_end_idx(xorriso, argc, argv, *idx, 1);
if(xorriso->launch_frontend_banned) {
sprintf(xorriso->info_text,
"-launch_frontend was already executed in this xorriso run");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
return(0);
ret= 0; goto ex;
}
xorriso->launch_frontend_banned= 1;
if(cmd[0] == 0 && (cmd_pipe_adr[0] == 0 || reply_pipe_adr[0] == 0))
return(1);
ret= Xorriso_launch_frontend(xorriso, cmd, cmd_pipe_adr, reply_pipe_adr, 0);
if(end_idx <= *idx)
{ret= 1; goto ex;}
if(argv[*idx][0] == 0)
{ret= 1; goto ex;}
xorriso->dialog= 2;
ret= Xorriso_launch_frontend(xorriso, end_idx - *idx, argv + *idx,
"", "", 0);
ex:;
(*idx)= end_idx;
return(ret);
}

View File

@ -534,7 +534,7 @@ int Xorriso_count_args(struct XorrisO *xorriso, int argc, char **argv,
""
};
static char arg3_commands[][40]= {
"append_partition", "launch_frontend",
"append_partition",
""
};
static char arg4_commands[][40]= {
@ -551,7 +551,7 @@ int Xorriso_count_args(struct XorrisO *xorriso, int argc, char **argv,
"file_size_limit","find","findi","finds","findx",
"getfacl","getfacli","getfacl_r","getfacl_ri",
"getfattr","getfattri","getfattr_r","getfattr_ri","hide",
"ls","lsi","lsl","lsli","lsd","lsdi","lsdl","lsdli",
"launch_frontend","ls","lsi","lsl","lsli","lsd","lsdi","lsdl","lsdli",
"lsx","lslx","lsdx","lsdlx","map_l","mv","mvi","mkdir","mkdiri",
"not_paths","rm","rmi","rm_r","rm_ri","rmdir","rmdiri","update_l",
"setfacl","setfacli","setfacl_list","setfacl_listi",
@ -1357,8 +1357,7 @@ next_command:;
ret= Xorriso_option_joliet(xorriso, arg1, 0);
} else if(strcmp(cmd, "launch_frontend") == 0) {
(*idx)+= 3;
ret= Xorriso_option_launch_frontend(xorriso, arg1, arg2, arg3, 0);
ret= Xorriso_option_launch_frontend(xorriso, argc, argv, idx, 0);
} else if(strcmp(cmd, "list_arg_sorting") == 0) {
ret= Xorriso_option_list_arg_sorting(xorriso, 0);

View File

@ -3675,15 +3675,11 @@ ex:;
}
/* >>> make configurable by configure.ac # define Xorriso_allow_launch_frontenD 1 */
/* # define Xorriso_allow_launch_frontend_suiD 1 */
int Xorriso_launch_frontend(struct XorrisO *xorriso, char *cmd,
int Xorriso_launch_frontend(struct XorrisO *xorriso, int argc, char **argv,
char *cmd_pipe_adr, char *reply_pipe_adr, int flag)
{
int command_pipe[2], reply_pipe[2], ret, i, argc= 0, cpid, is_banned= 0;
char **argv= NULL, **exec_argv= NULL, *sfe= NULL, *adrpt;
int command_pipe[2], reply_pipe[2], ret, i, cpid, is_banned= 0;
char **exec_argv= NULL, *sfe= NULL, *adrpt;
struct stat stbuf;
Xorriso_alloc_meM(sfe, char, 5 * SfileadrL);
@ -3721,9 +3717,6 @@ int Xorriso_launch_frontend(struct XorrisO *xorriso, char *cmd,
if(is_banned)
{ret= 0; goto ex;}
ret= Xorriso_parse_line(xorriso, cmd, "", "", 0, &argc, &argv, 1 | 64);
if(ret <= 0)
goto ex;
if(argc > 0) {
if(strchr(argv[0], '/') == NULL) {
sprintf(xorriso->info_text,
@ -3880,7 +3873,6 @@ no_dup:;
exit(1);
ex:;
Xorriso__dispose_words(&argc, &argv);
Xorriso_free_meM(exec_argv);
Xorriso_free_meM(sfe);
return(ret);

View File

@ -96,7 +96,7 @@ int Xorriso_msg_op_parse_bulk(struct XorrisO *xorriso,
int max_words, int pflag, int bulk_lines,
int flag);
int Xorriso_launch_frontend(struct XorrisO *xorriso, char *cmd,
int Xorriso_launch_frontend(struct XorrisO *xorriso, int argc, char **argv,
char *cmd_pipe_adr, char *reply_pipe_adr, int flag);
#endif /* ! Xorriso_pvt_textio_includeD */

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.2.5, Dec 20, 2012"
.TH XORRISO 1 "Version 1.2.5, Dec 25, 2012"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
@ -4588,11 +4588,9 @@ Print to the result channel a blank separated list of all severity names.
Sorted from low to high severity.
.br
.TP
\fB\-launch_frontend\fR program_with_args command_pipe reply_pipe
.br
Start the program that is given as first word in parameter
program_with_args. Submit the other words from that parameter as
program arguments. Enable xorriso dialog mode.
\fB\-launch_frontend\fR program [arguments ...] --
Start the program that is given as first parameter. Submit the other
parameters as program arguments. Enable xorriso dialog mode.
.br
xorriso will abort when the started program ends or if it cannot
be started at all. In both cases it will return a non\-zero exit value.
@ -4604,22 +4602,17 @@ by default if xorriso runs under setuid permissions.
.br
The program name will not be searched in the $PATH directories.
To make this clear, it must contain at least one /\-character.
Best is an absolute path. Like: /usr/bin/wish
.br
If one of command_pipe and reply_pipe is empty, then two nameless pipe
objects are created. xorriso standard input gets connected to the
standard output of the started program. xorriso standard output and
standard error get connected to the standard input of that program.
Best is an absolute path.
.br
The frontend program should first send via its standard output:
.br
\-mark 0 \-pkt_output on \-msg_op start_sieve \-
\-mark 0 \-pkt_output on \-msg_op start_sieve \- \-reassure off
.br
It should be ready to decode \-pkt_output and to react on \-mark messages.
Best is to increment the \-mark number after each sent command sequence
and then to wait for the new number to show up in a mark message:
.br
some ... commands \-mark <incremented_number>
...some...commands... \-mark <incremented_number>
.br
Further are advised:
.br
@ -4630,23 +4623,10 @@ Further are advised:
A check of the xorriso version should be done, in order to make sure
that all desired features are present.
.br
If command_pipe and reply_pipe are not empty, then
create named pipes with these names and use them for the connection to
the standard input and standard output of the started program.
It is not an error if the named pipes already exist.
.br
With named pipes it is important that the frontend program opens the
command_pipe first. This is because xorriso will block at this pipe
until the frontend opens it. If the frontend would try to open reply_pipe
first, then it would block there and create a deadlock situation.
.br
Command \-launch_frontend will only work once per xorriso run.
If all three command parameters are submitted as empty texts, then
no program will be started but nevertheless \-launch_frontend will
If no command parameters are submitted or if program is an empty text,
then no program will be started but nevertheless \-launch_frontend will
be irrevocably disabled.
If parameter program_with_args is submitted as empty text and both
pipe parameters are non\-empty, then no program will be started but
the standard i/o channels of xorriso will get connected to named pipes.
.TP
\fB\-prog\fR text
Use text as name of this program in subsequent messages

View File

@ -1528,8 +1528,8 @@ int Xorriso_option_joliet(struct XorrisO *xorriso, char *mode, int flag);
/* Command -launch_frontend */
/* @since 1.2.6 */
int Xorriso_option_launch_frontend(struct XorrisO *xorriso, char *cmd,
char *cmd_pipe_adr, char *reply_pipe_adr, int flag);
int Xorriso_option_launch_frontend(struct XorrisO *xorriso,
int argc, char **argv, int *idx, int flag);
/* Command -list_arg_sorting */
/* @since 1.2.2 */

View File

@ -4014,10 +4014,9 @@ File: xorriso.info, Node: Frontend, Next: ExDevices, Prev: Scripting, Up: Co
*list_sev*
Print to the result channel a blank separated list of all severity
names. Sorted from low to high severity.
-launch_frontend program_with_args command_pipe reply_pipe
Start the program that is given as first word in parameter
program_with_args. Submit the other words from that parameter as
program arguments. Enable xorriso dialog mode.
-launch_frontend program [arguments ...] --
Start the program that is given as first parameter. Submit the
other parameters as program arguments. Enable xorriso dialog mode.
xorriso will abort when the started program ends or if it cannot
be started at all. In both cases it will return a non-zero exit
value. The exit value will be zero if the frontend sends -end or
@ -4026,40 +4025,23 @@ File: xorriso.info, Node: Frontend, Next: ExDevices, Prev: Scripting, Up: Co
default if xorriso runs under setuid permissions.
The program name will not be searched in the $PATH directories.
To make this clear, it must contain at least one /-character.
Best is an absolute path. Like: /usr/bin/wish
If one of command_pipe and reply_pipe is empty, then two nameless
pipe objects are created. xorriso standard input gets connected to
the standard output of the started program. xorriso standard
output and standard error get connected to the standard input of
that program.
Best is an absolute path.
The frontend program should first send via its standard output:
-mark 0 -pkt_output on -msg_op start_sieve -
-mark 0 -pkt_output on -msg_op start_sieve - -reassure off
It should be ready to decode -pkt_output and to react on -mark
messages. Best is to increment the -mark number after each sent
command sequence and then to wait for the new number to show up in
a mark message:
some ... commands -mark <incremented_number>
...some...commands... -mark <incremented_number>
Further are advised:
-report_about UPDATE -abort_on NEVER
-iso_rr_pattern off -disk_pattern off
A check of the xorriso version should be done, in order to make
sure that all desired features are present.
If command_pipe and reply_pipe are not empty, then create named
pipes with these names and use them for the connection to the
standard input and standard output of the started program. It is
not an error if the named pipes already exist.
With named pipes it is important that the frontend program opens
the command_pipe first. This is because xorriso will block at this
pipe until the frontend opens it. If the frontend would try to
open reply_pipe first, then it would block there and create a
deadlock situation.
Command -launch_frontend will only work once per xorriso run. If
all three command parameters are submitted as empty texts, then no
program will be started but nevertheless -launch_frontend will be
irrevocably disabled. If parameter program_with_args is submitted
as empty text and both pipe parameters are non-empty, then no
program will be started but the standard i/o channels of xorriso
will get connected to named pipes.
no command parameters are submitted or if program is an empty text,
then no program will be started but nevertheless -launch_frontend
will be irrevocably disabled.
-prog text
Use text as name of this program in subsequent messages
@ -4825,8 +4807,8 @@ File: xorriso.info, Node: CommandIdx, Next: ConceptIdx, Prev: Legal, Up: Top
* -print_info prints message text line: Scripting. (line 102)
* -print_mark prints synchronizing text line: Scripting. (line 105)
* -print_size predicts image size: Inquiry. (line 91)
* -prog sets program name: Frontend. (line 160)
* -prog_help prints help text: Frontend. (line 163)
* -prog sets program name: Frontend. (line 142)
* -prog_help prints help text: Frontend. (line 145)
* -prompt prompts for enter key: Scripting. (line 110)
* -publisher sets publisher id: SetWrite. (line 186)
* -pvd_info shows image id strings: Inquiry. (line 104)
@ -4983,6 +4965,8 @@ File: xorriso.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top
* Filter, show chains of tree, -show_stream_r: Navigate. (line 183)
* Filter, unregister, -unregister_filter: Filter. (line 48)
* Filter, zisofs parameters, -zisofs: SetWrite. (line 272)
* Frontend program, start at pipes, -launch_frontend: Frontend.
(line 113)
* GPT, _definition: Extras. (line 38)
* Group, global in ISO image, -gid: SetWrite. (line 268)
* Group, in ISO image, -chgrp: Manip. (line 50)
@ -5096,7 +5080,7 @@ File: xorriso.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top
* Program, end without writing, -rollback_end: Scripting. (line 159)
* 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 163)
* Program, print help text, -prog_help: Frontend. (line 145)
* Program, print message text line, -print_info: Scripting. (line 102)
* Program, print result text line, -print: Scripting. (line 99)
* Program, print synchronizing text line, -print_mark: Scripting.
@ -5104,7 +5088,7 @@ File: xorriso.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top
* Program, print version, -version: Scripting. (line 23)
* Program, prompt for enter key, -prompt: Scripting. (line 110)
* Program, replace --, -list_delimiter: Scripting. (line 60)
* Program, set name, -prog: Frontend. (line 160)
* Program, set name, -prog: Frontend. (line 142)
* 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)
@ -5210,28 +5194,28 @@ Node: Restore174782
Node: Emulation181692
Node: Scripting191504
Node: Frontend198665
Node: Examples207358
Node: ExDevices208536
Node: ExCreate209195
Node: ExDialog210480
Node: ExGrowing211745
Node: ExModifying212550
Node: ExBootable213054
Node: ExCharset213606
Node: ExPseudo214427
Node: ExCdrecord215325
Node: ExMkisofs215642
Node: ExGrowisofs216982
Node: ExException218117
Node: ExTime218571
Node: ExIncBackup219030
Node: ExRestore223022
Node: ExRecovery223982
Node: Files224552
Node: Seealso225851
Node: Bugreport226574
Node: Legal227155
Node: CommandIdx228166
Node: ConceptIdx244395
Node: Examples206223
Node: ExDevices207401
Node: ExCreate208060
Node: ExDialog209345
Node: ExGrowing210610
Node: ExModifying211415
Node: ExBootable211919
Node: ExCharset212471
Node: ExPseudo213292
Node: ExCdrecord214190
Node: ExMkisofs214507
Node: ExGrowisofs215847
Node: ExException216982
Node: ExTime217436
Node: ExIncBackup217895
Node: ExRestore221887
Node: ExRecovery222847
Node: Files223417
Node: Seealso224716
Node: Bugreport225439
Node: Legal226020
Node: CommandIdx227031
Node: ConceptIdx243260

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.2.5, Dec 20, 2012"
@c man .TH XORRISO 1 "Version 1.2.5, Dec 25, 2012"
@c man .\" Please adjust this date whenever revising the manpage.
@c man .\"
@c man .\" Some roff macros, for reference:
@ -5374,12 +5374,11 @@ Print to the result channel a blank separated list of all severity names.
Sorted from low to high severity.
@*
@c man .TP
@item -launch_frontend program_with_args command_pipe reply_pipe
@item -launch_frontend program [arguments ...] @minus{}@minus{}
@kindex -launch_frontend starts frontend program at pipes
@cindex Frontend program, start at pipes, -launch_frontend
Start the program that is given as first word in parameter
program_with_args. Submit the other words from that parameter as
program arguments. Enable xorriso dialog mode.
Start the program that is given as first parameter. Submit the other
parameters as program arguments. Enable xorriso dialog mode.
@*
xorriso will abort when the started program ends or if it cannot
be started at all. In both cases it will return a non-zero exit value.
@ -5391,22 +5390,17 @@ by default if xorriso runs under setuid permissions.
@*
The program name will not be searched in the $PATH directories.
To make this clear, it must contain at least one /-character.
Best is an absolute path. Like: /usr/bin/wish
@*
If one of command_pipe and reply_pipe is empty, then two nameless pipe
objects are created. xorriso standard input gets connected to the
standard output of the started program. xorriso standard output and
standard error get connected to the standard input of that program.
Best is an absolute path.
@*
The frontend program should first send via its standard output:
@*
-mark 0 -pkt_output on -msg_op start_sieve -
-mark 0 -pkt_output on -msg_op start_sieve - -reassure off
@*
It should be ready to decode -pkt_output and to react on -mark messages.
Best is to increment the -mark number after each sent command sequence
and then to wait for the new number to show up in a mark message:
@*
some ... commands -mark <incremented_number>
...some...commands... -mark <incremented_number>
@*
Further are advised:
@*
@ -5417,23 +5411,10 @@ Further are advised:
A check of the xorriso version should be done, in order to make sure
that all desired features are present.
@*
If command_pipe and reply_pipe are not empty, then
create named pipes with these names and use them for the connection to
the standard input and standard output of the started program.
It is not an error if the named pipes already exist.
@*
With named pipes it is important that the frontend program opens the
command_pipe first. This is because xorriso will block at this pipe
until the frontend opens it. If the frontend would try to open reply_pipe
first, then it would block there and create a deadlock situation.
@*
Command -launch_frontend will only work once per xorriso run.
If all three command parameters are submitted as empty texts, then
no program will be started but nevertheless -launch_frontend will
If no command parameters are submitted or if program is an empty text,
then no program will be started but nevertheless -launch_frontend will
be irrevocably disabled.
If parameter program_with_args is submitted as empty text and both
pipe parameters are non-empty, then no program will be started but
the standard i/o channels of xorriso will get connected to named pipes.
@c man .TP
@item -prog text
@kindex -prog sets program name

View File

@ -1 +1 @@
#define Xorriso_timestamP "2012.12.20.202145"
#define Xorriso_timestamP "2012.12.25.175536"