From 7d413630501df2e803226c93a6774bbf321370d7 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Wed, 17 Oct 2007 16:54:16 +0000 Subject: [PATCH] Prepended a "-" to any input line if missing --- libisoburn/trunk/test/xorriso.c | 21 ++++++++++++++------- libisoburn/trunk/test/xorriso_timestamp.h | 2 +- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/libisoburn/trunk/test/xorriso.c b/libisoburn/trunk/test/xorriso.c index 136ea6c8..6b0880c7 100644 --- a/libisoburn/trunk/test/xorriso.c +++ b/libisoburn/trunk/test/xorriso.c @@ -570,9 +570,10 @@ int Sfile_make_argv(char *progname, char *line, int *argc, char ***argv, bit0= read progname as first argument from line bit1= just release argument list argv and return bit2= abort with return(0) if incomplete quotes are found + bit3= eventually prepend missing '-' to first argument read from line */ { - int i,pass,maxl=0,l,argzaehl=0,bufl; + int i,pass,maxl=0,l,argzaehl=0,bufl,line_start_argc; char *cpt,*start; char buf[SfileadrL]; @@ -582,13 +583,13 @@ int Sfile_make_argv(char *progname, char *line, int *argc, char ***argv, for(pass=0;pass<2;pass++) { cpt= line-1; if(!(flag&1)){ - argzaehl= 1; + argzaehl= line_start_argc= 1; if(pass==0) maxl= strlen(progname); else strcpy((*argv)[0],progname); } else { - argzaehl= 0; + argzaehl= line_start_argc= 0; if(pass==0) maxl= 0; } while(*(++cpt)!=0){ @@ -628,9 +629,15 @@ int Sfile_make_argv(char *progname, char *line, int *argc, char ***argv, if(l>0) {strncat(buf,start,l);buf[bufl+l]= 0;} l= strlen(buf); if(pass==0){ + if(argzaehl==line_start_argc && (flag&8)) + if(buf[0]!='-' && buf[0]!=0) + l++; if(l>maxl) maxl= l; }else{ strcpy((*argv)[argzaehl],buf); + if(argzaehl==line_start_argc && (flag&8)) + if(buf[0]!='-' && buf[0]!=0) + sprintf((*argv)[argzaehl],"-%s", buf); } argzaehl++; if(*cpt==0) break; @@ -3983,7 +3990,7 @@ return: continue; if(flag&1) { - ret= Sfile_make_argv(xorriso->progname, line, &argc, &argv, 4); + ret= Sfile_make_argv(xorriso->progname, line, &argc, &argv, 4|8); if(ret<=0) goto ex; ret= Xorriso_prescan_args(xorriso,argc,argv,1); @@ -4642,7 +4649,7 @@ next_command:; } else if(strcmp(cmd,"-tell_media_space")==0) { Xorriso_option_tell_media_space(xorriso, 0); - } else if(strcmp(cmd,"-test")==0) { + } else if(strcmp(cmd,"-test")==0) { /* This option does not exist. */ char line[4096],**hargv= NULL; int hargc, i; @@ -4650,7 +4657,7 @@ next_command:; ret= Xorriso_dialog_input(xorriso,line,sizeof(line),4); if(ret<=0) goto ex; - ret= Sfile_make_argv(xorriso->progname, line, &hargc, &hargv, 4); + ret= Sfile_make_argv(xorriso->progname, line, &hargc, &hargv, 4|8); if(ret<=0) { fprintf(stderr, "--- Malformed quotation marking encountered\n"); goto ex; @@ -4735,7 +4742,7 @@ int Xorriso_execute_option(struct XorrisO *xorriso, char *line, int flag) tdiff= tv.tv_sec+(1.e-6*(double) tv.tv_usec); /* parse line into args */ - ret= Sfile_make_argv(xorriso->progname, line, &argc, &argv, 4); + ret= Sfile_make_argv(xorriso->progname, line, &argc, &argv, 4|8); if(ret<=0) goto ex; if(argc<2) diff --git a/libisoburn/trunk/test/xorriso_timestamp.h b/libisoburn/trunk/test/xorriso_timestamp.h index 1fff9331..cb307a37 100644 --- a/libisoburn/trunk/test/xorriso_timestamp.h +++ b/libisoburn/trunk/test/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2007.10.17.150142" +#define Xorriso_timestamP "2007.10.17.165352"