New options -print_info and -print_mark
This commit is contained in:
parent
1764745ff3
commit
0280efe997
@ -1927,6 +1927,10 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
|
||||
" prevents reading and interpretation of startup files.",
|
||||
" -print text",
|
||||
" Print a text to result channel.",
|
||||
" -print_info text",
|
||||
" Print a text to info channel.",
|
||||
" -print_mark text",
|
||||
" Print a text to mark channel.",
|
||||
" -prompt text",
|
||||
" Wait for Enter key resp. for a line of input at stdin.",
|
||||
" -errfile_log mode path|channel",
|
||||
|
@ -246,11 +246,38 @@ int Xorriso_option_preparer_id(struct XorrisO *xorriso, char *name, int flag)
|
||||
}
|
||||
|
||||
|
||||
/* Option -print */
|
||||
/* Options -print , -print_info , -print_mark */
|
||||
/* @param flag bit0-1= channel: 0=result, 1=info, 2=mark */
|
||||
int Xorriso_option_print(struct XorrisO *xorriso, char *text, int flag)
|
||||
{
|
||||
int maxl, l, mode;
|
||||
|
||||
l= strlen(text);
|
||||
mode= flag & 3;
|
||||
if(mode == 1)
|
||||
maxl= sizeof(xorriso->info_text);
|
||||
else if(mode == 2)
|
||||
maxl= sizeof(xorriso->mark_text);
|
||||
else
|
||||
maxl= sizeof(xorriso->result_line);
|
||||
if(l >= maxl) {
|
||||
sprintf(xorriso->info_text, "Output text too long for -print%s(%d > %d)",
|
||||
mode == 1 ? "_info" : mode == 2 ? "_mark" : "", l, maxl);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0);
|
||||
return(0);
|
||||
}
|
||||
if(mode == 1) {
|
||||
sprintf(xorriso->info_text,"%s\n", text);
|
||||
Xorriso_info(xorriso,0);
|
||||
} else if(mode == 2) {
|
||||
strcpy(xorriso->info_text, xorriso->mark_text);
|
||||
strcpy(xorriso->mark_text, text);
|
||||
Xorriso_mark(xorriso,0);
|
||||
strcpy(xorriso->mark_text, xorriso->info_text);
|
||||
} else {
|
||||
sprintf(xorriso->result_line,"%s\n",text);
|
||||
Xorriso_result(xorriso,1);
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
@ -468,7 +468,7 @@ int Xorriso_count_args(struct XorrisO *xorriso, int argc, char **argv,
|
||||
"mark","md5","mount_opts","not_leaf","not_list","not_mgt",
|
||||
"options_from_file","osirrox","outdev","out_charset","overwrite",
|
||||
"pacifier","padding","path_list","pathspecs","pkt_output",
|
||||
"preparer_id","print","prompt",
|
||||
"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","speed","split_size","status","status_history_max",
|
||||
@ -1157,6 +1157,14 @@ next_command:;
|
||||
(*idx)++;
|
||||
ret= Xorriso_option_print(xorriso, arg1, 0);
|
||||
|
||||
} else if(strcmp(cmd,"print_info")==0) {
|
||||
(*idx)++;
|
||||
ret= Xorriso_option_print(xorriso, arg1, 1);
|
||||
|
||||
} else if(strcmp(cmd,"print_mark")==0) {
|
||||
(*idx)++;
|
||||
ret= Xorriso_option_print(xorriso, arg1, 2);
|
||||
|
||||
} else if(strcmp(cmd,"print_size")==0) {
|
||||
Xorriso_option_print_size(xorriso, 0);
|
||||
|
||||
|
@ -3884,7 +3884,14 @@ restoring of hard links.
|
||||
Default is 16m = 16 MiB, minimum 64k = 64 kiB, maximum 1024m = 1 GiB.
|
||||
.TP
|
||||
\fB\-print\fR text
|
||||
Print a text to result channel.
|
||||
Print a text line to the result channel which is by default stdout.
|
||||
.TP
|
||||
\fB\-print_info\fR text
|
||||
Print a text line to the info channel which is by default stderr.
|
||||
.TP
|
||||
\fB\-print_mark\fR text
|
||||
Print a text line to the mark channel which is by default directed to both,
|
||||
result and info channel. An empty text will cause no output at all.
|
||||
.TP
|
||||
\fB\-prompt\fR text
|
||||
Show text at beginning of output line and
|
||||
|
@ -1048,7 +1048,12 @@ int Xorriso_option_pkt_output(struct XorrisO *xorriso, char *mode, int flag);
|
||||
/* @since 0.6.2 */
|
||||
int Xorriso_option_preparer_id(struct XorrisO *xorriso, char *name, int flag);
|
||||
|
||||
/* Option -print */
|
||||
/* Options -print, -print_info , -print_mark */
|
||||
/* @param flag bit0-1= output channel:
|
||||
0= result channel
|
||||
1= info channel @since 1.0.6
|
||||
2= mark channel @since 1.0.6
|
||||
*/
|
||||
int Xorriso_option_print(struct XorrisO *xorriso, char *text, int flag);
|
||||
|
||||
/* Option -print_size
|
||||
|
@ -3431,7 +3431,15 @@ File: xorriso.info, Node: Scripting, Next: Frontend, Prev: Emulation, Up: Op
|
||||
GiB.
|
||||
|
||||
-print text
|
||||
Print a text to result channel.
|
||||
Print a text line to the result channel which is by default stdout.
|
||||
|
||||
-print_info text
|
||||
Print a text line to the info channel which is by default stderr.
|
||||
|
||||
-print_mark text
|
||||
Print a text line to the mark channel which is by default directed
|
||||
to both, result and info channel. An empty text will cause no
|
||||
output at all.
|
||||
|
||||
-prompt text
|
||||
Show text at beginning of output line and wait for the user to hit
|
||||
@ -4098,7 +4106,7 @@ File: xorriso.info, Node: CommandIdx, Next: ConceptIdx, Prev: Legal, Up: Top
|
||||
|