New flag bit1 of API call Xorriso_prescan_args() reports unknown commands

This commit is contained in:
Thomas Schmitt 2011-05-17 15:16:56 +00:00
parent 439670d2c3
commit e8c1b507fd
4 changed files with 22 additions and 12 deletions

View File

@ -1624,7 +1624,8 @@ int Xorriso_prescan_args(struct XorrisO *xorriso, int argc, char **argv,
"stdio:/dev/fd/1" is interpreted as drive address.
*/
protect_stdout:;
Xorriso_protect_stdout(xorriso, 0);
ret= Xorriso_protect_stdout(xorriso, 0);
if(ret == 1) {
sprintf(xorriso->info_text,
"Encountered - or stdio:/dev/fd/1 as possible write target.");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0);
@ -1633,6 +1634,7 @@ protect_stdout:;
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0);
sprintf(xorriso->info_text, "Disabling use of libreadline.");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0);
}
} else if(strcmp(cmd,"abort_on")==0 && was_dashed == 1) {
i++;
@ -1691,8 +1693,8 @@ protect_stdout:;
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) {
} else if((flag & 2) && ((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);

View File

@ -252,6 +252,8 @@ int Xorriso_destroy(struct XorrisO **xorriso, int flag);
*idx will iterate over commands and parameters until this
function aborts or until argc is reached.
@param flag bit0= do not interpret argv[1]
bit1= produce FAILURE events on unknown commands
@since 1.1.0
@return <0 error
0 end program
1 ok, go on

View File

@ -226,14 +226,20 @@ int main(int argc, char **argv)
/* The prescan of arguments performs actions which have to happen before
the normal processing of startup files and arguments.
Among them are -help and -prog_help which end the program without
yelling its name and version.
*/
ret= Xorriso_prescan_args(xorriso,argc,argv,0);
if(ret == 0)
goto end_successfully;
/* Put out program name and version to stderr only if not done already now */
yell_xorriso();
if(ret < 0)
exit(5);
/* After having yelled xorriso, prescan again for unknown arguments */
ret= Xorriso_prescan_args(xorriso, argc, argv, 2);
if(ret < 0)
exit(5);
yell_xorriso();
/* The following command interpreters are allowed only after this
initialization.

View File

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