Checking for unknown xorriso commands already in Xorriso_prescan_args()

This commit is contained in:
Thomas Schmitt 2011-05-16 13:43:16 +00:00
parent a41689663d
commit 0a5fecb5df
3 changed files with 37 additions and 9 deletions

View File

@ -581,6 +581,7 @@ return:
*/
{
int ret, was_dashed, end_ret, num1, num2, cmd_data_size= 2 * SfileadrL;
int mem_idx;
char *cmd, *original_cmd, *cmd_data= NULL, *arg1, *arg2;
Xorriso_alloc_meM(cmd_data, char, cmd_data_size);
@ -1411,9 +1412,10 @@ unknown_option:;
if(xorriso->add_plainly<=0)
goto unknown_option;
add_plain_argument:;
mem_idx= *idx;
(*idx)--;
ret= Xorriso_option_add(xorriso, (*idx)+1, argv, idx, 0);
(*idx)++;
(*idx)= mem_idx;
}
@ -1561,14 +1563,17 @@ int Xorriso_prescan_args(struct XorrisO *xorriso, int argc, char **argv,
*/
{
int i, ret, was_dashed, num2, arg_count;
int advice, mem_add_plainly, error_seen= 0;
int was_report_about= 0, was_abort_on= 0, was_return_with= 0;
int was_signal_handling= 0, was_scsi_log= 0, cmd_data_size= 5 * SfileadrL;
char *cmd, *original_cmd, *cmd_data= NULL, *arg1, *arg2;
char mem_list_delimiter[81];
strcpy(mem_list_delimiter, xorriso->list_delimiter);
mem_add_plainly= xorriso->add_plainly;
Xorriso_alloc_meM(cmd_data, char, cmd_data_size);
strcpy(mem_list_delimiter, xorriso->list_delimiter);
for(i=1+(flag&1);i<argc;i++) {
original_cmd= cmd= argv[i];
was_dashed= 0;
@ -1606,7 +1611,7 @@ int Xorriso_prescan_args(struct XorrisO *xorriso, int argc, char **argv,
} else if(i==1 && strcmp(cmd,"no_rc")==0) {
ret= Xorriso_option_no_rc(xorriso, 0);
if(ret<=0)
goto ex;
error_seen= 1;
} else if(xorriso->argument_emulation >= 1 &&
xorriso->argument_emulation <= 2) {
{ret= 1; goto ex;}
@ -1659,8 +1664,17 @@ protect_stdout:;
i++;
ret= Xorriso_option_list_delimiter(xorriso, arg1, 0);
if(ret <= 0)
goto ex;
error_seen= 1;
} else if(strcmp(cmd, "add_plainly") == 0) {
i++;
ret= Xorriso_option_add_plainly(xorriso, arg1, 0);
if(ret <= 0)
error_seen= 1;
if(xorriso->add_plainly == 3) {
/* All further arguments count as pathspecs */
{ret= 1; goto ex;}
}
} else if(strcmp(cmd, "scsi_log") == 0 && was_dashed == 1) {
i++;
if(!was_scsi_log)
@ -1674,15 +1688,28 @@ protect_stdout:;
was_signal_handling= 1;
} else {
ret= Xorriso_count_args(xorriso, argc-i, argv+i, &arg_count, 1);
if(ret==1)
ret= Xorriso_count_args(xorriso, argc - i, argv + i, &arg_count, 1);
if(ret == 1) {
i+= arg_count;
} else if((was_dashed && xorriso->add_plainly <= 1) ||
xorriso->add_plainly <= 0) {
sprintf(xorriso->info_text, "Not a known option: '%s'\n",
original_cmd);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
error_seen= 1;
}
}
}
ret= 1;
ex:;
strcpy(xorriso->list_delimiter, mem_list_delimiter);
xorriso->add_plainly= mem_add_plainly;
Xorriso_free_meM(cmd_data);
if(error_seen && ret > 0) {
advice= Xorriso_eval_problem_status(xorriso, 0, 0);
if(advice < 0)
ret= -1;
}
return(ret);
}

View File

@ -240,8 +240,9 @@ int Xorriso_destroy(struct XorrisO **xorriso, int flag);
-prog_help , -help , -no_rc
Some get examined for the need to redirect stdout messages
-dev , -outdev , -indev , -as
Command -list_delimiter gets into effect during this call. But the
setting at begin of the call gets restored before the call returns.
Commands -list_delimiter and -add_plainly get into effect during this
call. But their setting at begin of the call gets restored before the
call returns.
@param xorriso The context object in which to perform the commands.
@param argc Number of arguments.
@param argv The arguments. argv[0] contains the program name.

View File

@ -1 +1 @@
#define Xorriso_timestamP "2011.05.16.133231"
#define Xorriso_timestamP "2011.05.16.134341"