diff --git a/libisoburn/trunk/xorriso/text_io.c b/libisoburn/trunk/xorriso/text_io.c index 3951043d..8c69fda4 100644 --- a/libisoburn/trunk/xorriso/text_io.c +++ b/libisoburn/trunk/xorriso/text_io.c @@ -220,13 +220,16 @@ int Xorriso_request_confirmation(struct XorrisO *xorriso, int flag) */ { int ret; - char line[SfileadrL],*cpt,previous_line[SfileadrL]; + char *line= NULL, *cpt, *previous_line= NULL; char *abort_req_text,*abort_really_text; + Xorriso_alloc_meM(line, char, SfileadrL); + Xorriso_alloc_meM(previous_line, char, SfileadrL); + if(!xorriso->dialog) { if(flag&16) - return(6); - return(1); + {ret= 6; goto ex;} + {ret= 1; goto ex;} } if(flag&8) { abort_req_text= "request to end"; @@ -235,7 +238,7 @@ int Xorriso_request_confirmation(struct XorrisO *xorriso, int flag) abort_req_text= "request to abort"; abort_really_text= "abort this command"; } - ret= Xorriso_dialog_input(xorriso,line,sizeof(line),1); + ret= Xorriso_dialog_input(xorriso,line, SfileadrL, 1); xorriso->result_line_counter= 0; xorriso->result_page_counter++; if(ret<=0) @@ -252,9 +255,9 @@ int Xorriso_request_confirmation(struct XorrisO *xorriso, int flag) "... [%s = %s registered. Really %s ? (y/n) ] ...\n", cpt,abort_req_text,abort_really_text); Xorriso_info(xorriso,0); - ret= Xorriso_dialog_input(xorriso,line,sizeof(line),1); + ret= Xorriso_dialog_input(xorriso,line, SfileadrL, 1); if(ret<=0) - return(ret); + goto ex; cpt= line; if(strcmp(cpt,previous_line)==0 || ((*cpt=='Y' || *cpt=='y' || *cpt=='j' || *cpt=='J' || *cpt=='1') && @@ -263,18 +266,18 @@ int Xorriso_request_confirmation(struct XorrisO *xorriso, int flag) sprintf(xorriso->info_text, "------- ( %s confirmed )\n",abort_req_text); Xorriso_info(xorriso,0); - return(2); + {ret= 2; goto ex;} } sprintf(xorriso->info_text, "....... ( %s revoked )\n",abort_req_text); Xorriso_info(xorriso,0); - return(3); + {ret= 3; goto ex;} } xorriso->request_to_abort= 1; sprintf(xorriso->info_text, "----------- [%s = request to abort registered. Operation ends ] ------------\n", cpt); Xorriso_info(xorriso,0); - return(2); + {ret= 2; goto ex;} } else if(*cpt=='@') { if(strcmp(cpt,"@@")==0) { goto klammer_affe; @@ -294,28 +297,28 @@ klammer_affe:; sprintf(xorriso->info_text, "--- Unrecognized input beginning with @. Please enter someting else.\n"); Xorriso_info(xorriso,0); - return(3); + {ret= 3; goto ex;} } if(flag&2) - return(4); + {ret= 4; goto ex;} if(flag&1) - return(3); - return(1); + {ret= 3; goto ex;} + {ret= 1; goto ex;} } else if(flag&4) { if(strcmp(cpt,"i")==0 || strcmp(cpt,"I")==0 || strcmp(cpt,"n")==0 || strcmp(cpt,"N")==0 || *cpt==0) { - return(1); + {ret= 1; goto ex;} } else if(strcmp(cpt,"r")==0 || strcmp(cpt,"R")==0 || strcmp(cpt,"y")==0 || strcmp(cpt,"Y")==0) { - return(6); + {ret= 6; goto ex;} } else { /* >>> unknown input */ sprintf(xorriso->info_text, "--- Please enter one of : empty line, i,n, r,y, q,x, @, @@@\n"); Xorriso_info(xorriso,0); - return(3); + {ret= 3; goto ex;} } } else if(*cpt!=0 && !(flag&1)) { @@ -325,16 +328,20 @@ klammer_affe:; sprintf(xorriso->info_text, "-------------- [ Input of option registered. Operation ends ] ---------------\n"); Xorriso_info(xorriso,0); - return(2); + {ret= 2; goto ex;} } else if(*cpt!=0) { Xorriso_dialog_input(xorriso,cpt,strlen(line)+1,2); /* write to history */ sprintf(xorriso->info_text, "--- Please enter one of : empty line, @, @@@\n"); Xorriso_info(xorriso,0); - return(3); + {ret= 3; goto ex;} } - return(1); + ret= 1; +ex:; + Xorriso_free_meM(line); + Xorriso_free_meM(previous_line); + return(ret); } @@ -348,12 +355,14 @@ klammer_affe:; int Xorriso_read_lines(struct XorrisO *xorriso, FILE *fp, int *linecount, int *argc, char ***argv, int flag) { - char line[5 * SfileadrL + 2], *linept, *fgot; + char *line= NULL, *linept, *fgot; int l, base_length, append_line, ret, mem_linecount, i; Sfile_make_argv("", line, argc, argv, 2); if(flag & 2) - return(1); + {ret= 1; goto ex;} + + Xorriso_alloc_meM(line, char, 5 * SfileadrL + 2); mem_linecount= *linecount; linept= line; @@ -363,13 +372,13 @@ int Xorriso_read_lines(struct XorrisO *xorriso, FILE *fp, int *linecount, !!(flag & (1 | 8))); if(fgot == NULL) { if(ferror(fp)) - return(0); + {ret= 0; goto ex;} if(linept != line) { sprintf(xorriso->info_text,"Open quotation mark at end of input"); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); - return(0); + {ret= 0; goto ex;} } - return(2); + {ret= 2; goto ex;} } l= strlen(line); (*linecount)++; @@ -377,7 +386,7 @@ int Xorriso_read_lines(struct XorrisO *xorriso, FILE *fp, int *linecount, if(flag & 1) { /* check whether the line is incomplete yet */ ret= Sfile_make_argv("", line, argc, argv, 16); if(ret < 0) - return(ret); + goto ex; if(ret == 0 && !append_line) { line[l]= '\n'; line[l + 1]= 0; @@ -392,7 +401,7 @@ int Xorriso_read_lines(struct XorrisO *xorriso, FILE *fp, int *linecount, if(l >= SfileadrL) { sprintf(xorriso->info_text,"Input line too long !"); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); - return(0); + {ret= 0; goto ex;} } if(!append_line) break; @@ -403,7 +412,7 @@ int Xorriso_read_lines(struct XorrisO *xorriso, FILE *fp, int *linecount, ret= Sfile_make_argv("", line, argc, argv, 1 | ((xorriso->bsl_interpretation & 3) << 5)); if(ret < 0) - return(ret); + goto ex; if(flag & 4) for(i= 0; i < *argc; i++) { if((*argv)[i][0] == 0) { @@ -425,13 +434,16 @@ int Xorriso_read_lines(struct XorrisO *xorriso, FILE *fp, int *linecount, } else { (*argv)= Smem_malloC(sizeof(char *)); if(argv == NULL) - return(-1); + {ret= -1; goto ex;} (*argv)[0]= strdup(line); if((*argv)[0] == NULL) - return(-1); + {ret= -1; goto ex;} *argc= 1; } - return(1); + ret= 1; +ex:; + Xorriso_free_meM(line); + return(ret); } @@ -475,14 +487,16 @@ int Xorriso_pager(struct XorrisO *xorriso, char *line, int flag) /* return: <=0 error , 1=go on , 2=abort , 4=see flag bit1*/ { int ret,linecount; - char info_text[10*SfileadrL]; + char *info_text= NULL; if(xorriso->result_page_length<=0 || xorriso->request_not_to_ask || xorriso->dialog == 0) - return(1); + {ret= 1; goto ex;} Xorriso_predict_linecount(xorriso,line,&linecount,0); if(xorriso->result_line_counter+linecount>xorriso->result_page_length) { ask_for_page:; + if(info_text == NULL) + Xorriso_alloc_meM(info_text, char, 10*SfileadrL); strcpy(info_text,xorriso->info_text); sprintf(xorriso->info_text,"\n"); Xorriso_info(xorriso,0); @@ -492,14 +506,17 @@ ask_for_page:; ret= Xorriso_request_confirmation(xorriso,flag&2); strcpy(xorriso->info_text,info_text); if(ret<=0) - return(ret); + goto ex; if(ret==2) - return(2); + {ret= 2; goto ex;} if(ret==3) goto ask_for_page; } xorriso->result_line_counter+= linecount; - return(1); + ret= 1; +ex:; + Xorriso_free_meM(info_text); + return(ret); } @@ -1011,16 +1028,20 @@ int Xorriso_reassure(struct XorrisO *xorriso, char *cmd, char *which_will, int Xorriso_write_session_log(struct XorrisO *xorriso, int flag) { FILE *fp= NULL; - char sfe[5*SfileadrL], timetext[40], *rpt, *wpt; + char *sfe= NULL, timetext[40], *rpt, *wpt; + int ret; if(xorriso->session_logfile[0]==0) - return(2); + {ret= 2; goto ex;} + + Xorriso_alloc_meM(sfe, char, 5 * SfileadrL); + fp= fopen(xorriso->session_logfile, "a"); if(fp==0) { sprintf(xorriso->info_text, "-session_log: Cannot open file %s", Text_shellsafe(xorriso->session_logfile, sfe, 0)); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); - return(0); + {ret= 0; goto ex;} } wpt= sfe; for(rpt= xorriso->volid; *rpt!=0; rpt++) { @@ -1035,7 +1056,10 @@ int Xorriso_write_session_log(struct XorrisO *xorriso, int flag) Ftimetxt(time(0), timetext, 2), xorriso->session_lba, xorriso->session_blocks, sfe); fclose(fp); - return(1); + ret= 1; +ex:; + Xorriso_free_meM(sfe); + return(ret); } @@ -1085,7 +1109,7 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag) int is_default, no_defaults, i, ret, adr_mode, do_single, behavior; int show_indev= 1, show_outdev= 1, show_dev= 0; int part_table_implicit= 0; - char *line, sfe[5 * SfileadrL + 80], mode[80], *form, *treatment; + char *line, *sfe= NULL, mode[80], *form, *treatment; char *in_pt, *out_pt, *nl_charset, *local_charset, *mode_pt; char *dev_filter= NULL, xorriso_id[129]; static char channel_prefixes[4][4]= {".","R","I","M"}; @@ -1093,6 +1117,8 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag) static int max_load_mode= 4; struct Xorriso_lsT *paths, *leafs, *s, *plst, *vlst; + Xorriso_alloc_meM(sfe, char, 5 * SfileadrL + 80); + no_defaults= flag&1; line= xorriso->result_line; @@ -1945,7 +1971,10 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag) } } - return(1); + ret= 1; +ex:; + Xorriso_free_meM(sfe); + return(ret); } diff --git a/libisoburn/trunk/xorriso/xorriso_timestamp.h b/libisoburn/trunk/xorriso/xorriso_timestamp.h index 87c46012..fab53965 100644 --- a/libisoburn/trunk/xorriso/xorriso_timestamp.h +++ b/libisoburn/trunk/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2011.05.07.165758" +#define Xorriso_timestamP "2011.05.07.184625"