Prepended a "-" to any input line if missing
This commit is contained in:
parent
8b7fc3e911
commit
7d41363050
@ -570,9 +570,10 @@ int Sfile_make_argv(char *progname, char *line, int *argc, char ***argv,
|
|||||||
bit0= read progname as first argument from line
|
bit0= read progname as first argument from line
|
||||||
bit1= just release argument list argv and return
|
bit1= just release argument list argv and return
|
||||||
bit2= abort with return(0) if incomplete quotes are found
|
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 *cpt,*start;
|
||||||
char buf[SfileadrL];
|
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++) {
|
for(pass=0;pass<2;pass++) {
|
||||||
cpt= line-1;
|
cpt= line-1;
|
||||||
if(!(flag&1)){
|
if(!(flag&1)){
|
||||||
argzaehl= 1;
|
argzaehl= line_start_argc= 1;
|
||||||
if(pass==0)
|
if(pass==0)
|
||||||
maxl= strlen(progname);
|
maxl= strlen(progname);
|
||||||
else
|
else
|
||||||
strcpy((*argv)[0],progname);
|
strcpy((*argv)[0],progname);
|
||||||
} else {
|
} else {
|
||||||
argzaehl= 0;
|
argzaehl= line_start_argc= 0;
|
||||||
if(pass==0) maxl= 0;
|
if(pass==0) maxl= 0;
|
||||||
}
|
}
|
||||||
while(*(++cpt)!=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;}
|
if(l>0) {strncat(buf,start,l);buf[bufl+l]= 0;}
|
||||||
l= strlen(buf);
|
l= strlen(buf);
|
||||||
if(pass==0){
|
if(pass==0){
|
||||||
|
if(argzaehl==line_start_argc && (flag&8))
|
||||||
|
if(buf[0]!='-' && buf[0]!=0)
|
||||||
|
l++;
|
||||||
if(l>maxl) maxl= l;
|
if(l>maxl) maxl= l;
|
||||||
}else{
|
}else{
|
||||||
strcpy((*argv)[argzaehl],buf);
|
strcpy((*argv)[argzaehl],buf);
|
||||||
|
if(argzaehl==line_start_argc && (flag&8))
|
||||||
|
if(buf[0]!='-' && buf[0]!=0)
|
||||||
|
sprintf((*argv)[argzaehl],"-%s", buf);
|
||||||
}
|
}
|
||||||
argzaehl++;
|
argzaehl++;
|
||||||
if(*cpt==0) break;
|
if(*cpt==0) break;
|
||||||
@ -3983,7 +3990,7 @@ return:
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(flag&1) {
|
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)
|
if(ret<=0)
|
||||||
goto ex;
|
goto ex;
|
||||||
ret= Xorriso_prescan_args(xorriso,argc,argv,1);
|
ret= Xorriso_prescan_args(xorriso,argc,argv,1);
|
||||||
@ -4642,7 +4649,7 @@ next_command:;
|
|||||||
} else if(strcmp(cmd,"-tell_media_space")==0) {
|
} else if(strcmp(cmd,"-tell_media_space")==0) {
|
||||||
Xorriso_option_tell_media_space(xorriso, 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;
|
char line[4096],**hargv= NULL;
|
||||||
int hargc, i;
|
int hargc, i;
|
||||||
|
|
||||||
@ -4650,7 +4657,7 @@ next_command:;
|
|||||||
ret= Xorriso_dialog_input(xorriso,line,sizeof(line),4);
|
ret= Xorriso_dialog_input(xorriso,line,sizeof(line),4);
|
||||||
if(ret<=0)
|
if(ret<=0)
|
||||||
goto ex;
|
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) {
|
if(ret<=0) {
|
||||||
fprintf(stderr, "--- Malformed quotation marking encountered\n");
|
fprintf(stderr, "--- Malformed quotation marking encountered\n");
|
||||||
goto ex;
|
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);
|
tdiff= tv.tv_sec+(1.e-6*(double) tv.tv_usec);
|
||||||
|
|
||||||
/* parse line into args */
|
/* 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)
|
if(ret<=0)
|
||||||
goto ex;
|
goto ex;
|
||||||
if(argc<2)
|
if(argc<2)
|
||||||
|
@ -1 +1 @@
|
|||||||
#define Xorriso_timestamP "2007.10.17.150142"
|
#define Xorriso_timestamP "2007.10.17.165352"
|
||||||
|
Loading…
Reference in New Issue
Block a user