diff --git a/xorriso/opts_d_h.c b/xorriso/opts_d_h.c index 563f5975..7870ddda 100644 --- a/xorriso/opts_d_h.c +++ b/xorriso/opts_d_h.c @@ -2263,7 +2263,7 @@ ex:; /* Option -history */ int Xorriso_option_history(struct XorrisO *xorriso, char *line, int flag) { - Xorriso_dialog_input(xorriso,line,strlen(line)+1,2); + Xorriso_dialog_input(xorriso, line, strlen(line) + 1, 2 | 32); return(1); } diff --git a/xorriso/text_io.c b/xorriso/text_io.c index 243c84d5..ae4b51e5 100644 --- a/xorriso/text_io.c +++ b/xorriso/text_io.c @@ -68,10 +68,11 @@ int Xorriso_dialog_input(struct XorrisO *xorriso, char line[], int linesize, bit2= do not write to history line which begin with "-history:" or "-history " bit3= enforce single line dialog mode bit4= do not read from xorriso->buffered_dialog + bit5= write to history in any case (if it is enabled at compile time) */ { char *cpt= NULL, **argv= NULL, *linept, *why_append= ""; - int ret, argc= 0, base_length= 0, l, append_line; + int ret, argc= 0, base_length= 0, l, append_line, no_history= 0; #ifdef Xorriso_with_readlinE static char last_input[SfileadrL]= {""}; #endif /* ! Xorriso_with_readlinE */ @@ -85,6 +86,7 @@ int Xorriso_dialog_input(struct XorrisO *xorriso, char line[], int linesize, fflush(stdout); linept= line; + no_history= (flag & 1) || xorriso->use_stdin; get_single:; @@ -101,8 +103,11 @@ get_single:; if(xorriso->use_stdin || xorriso->dev_fd_1>=0 || xorriso->tolerate_stdin_eof) { - if(flag&2) + if(flag&2) { + if(flag & 32) + goto put_into_history; {ret= 1; goto ex;} + } if(Sfile_fgets_n(linept,linesize - base_length - 1, stdin, (xorriso->dialog == 2)) == NULL) { if(xorriso->tolerate_stdin_eof) @@ -202,13 +207,15 @@ new_empty:; #ifdef Xorriso_with_readlinE - if(line[0]!=0 && strcmp(last_input,line)!=0 && !(flag&1)) +put_into_history:; + if((flag & 32) || (line[0]!=0 && strcmp(last_input,line)!=0 && !no_history)) { if(!((flag&4) && (strncmp(line,"-history:",9)==0 || strncmp(line,"-history ",9)==0))) { add_history(line); strncpy(last_input,line,sizeof(last_input)-1); last_input[sizeof(last_input)-1]= 0; } + } #endif /* ! Xorriso_with_readlinE */ @@ -3656,7 +3663,7 @@ int Xorriso_msg_op_parse(struct XorrisO *xorriso, char *line, pline[0]= 0; for(i= 0; i < input_lines; i++) { l= strlen(pline); - ret= Xorriso_dialog_input(xorriso, pline + l, SfileadrL - l - 1, 8); + ret= Xorriso_dialog_input(xorriso, pline + l, SfileadrL - l - 1, 8 | 1); if(ret <= 0) goto ex; if(i < input_lines - 1) @@ -3735,7 +3742,7 @@ int Xorriso_msg_op_parse_bulk(struct XorrisO *xorriso, Xorriso_alloc_meM(pline, char, SfileadrL); for(i= 0; i < bulk_lines; i++) { - ret= Xorriso_dialog_input(xorriso, line, sizeof(line), 8); + ret= Xorriso_dialog_input(xorriso, line, sizeof(line), 8 | 1); if(ret <= 0) goto ex; input_lines= -1; @@ -3743,7 +3750,7 @@ int Xorriso_msg_op_parse_bulk(struct XorrisO *xorriso, pline[0]= 0; for(j= 0; j < input_lines; j++) { l= strlen(pline); - ret= Xorriso_dialog_input(xorriso, pline + l, SfileadrL - l - 1, 8); + ret= Xorriso_dialog_input(xorriso, pline + l, SfileadrL - l - 1, 8 | 1); if(ret <= 0) goto ex; if(j < input_lines - 1) @@ -3884,6 +3891,7 @@ no_pipe_open: if (cpid != 0) { /* Parent becomes the xorriso slave */ + xorriso->use_stdin= 1; if(cmd_pipe_adr[0] && reply_pipe_adr[0]) { command_pipe[0]= open(cmd_pipe_adr, O_RDONLY); if(command_pipe[0] == -1) { diff --git a/xorriso/xorriso_timestamp.h b/xorriso/xorriso_timestamp.h index e00db100..14057cdd 100644 --- a/xorriso/xorriso_timestamp.h +++ b/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2013.07.05.164001" +#define Xorriso_timestamP "2013.07.06.110101"