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

master
Thomas Schmitt 12 years ago
parent 55d6788bb6
commit f28da0c7ce
  1. 20
      xorriso/parse_exec.c
  2. 2
      xorriso/xorriso.h
  3. 10
      xorriso/xorriso_main.c
  4. 2
      xorriso/xorriso_timestamp.h

@ -1624,15 +1624,17 @@ 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);
sprintf(xorriso->info_text,
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);
sprintf(xorriso->info_text,
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0);
sprintf(xorriso->info_text,
"Redirecting nearly all text message output to stderr.");
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);
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);

@ -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

@ -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.

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

Loading…
Cancel
Save