Corrected interpretation of flag in Xorriso_parse_line()

This commit is contained in:
Thomas Schmitt 2012-09-29 17:36:53 +00:00
parent d083214971
commit d7b1bd988f
2 changed files with 38 additions and 33 deletions

View File

@ -1725,6 +1725,7 @@ next_command:;
/* install temporary test code here */;
/* Test setup for for Xorriso_push_outlists() et.al. */
/* Test setup for Xorriso_parse_line */
{
int stack_handle = -1, line_count= 0;
struct Xorriso_lsT *result_list, *info_list;
@ -1732,6 +1733,8 @@ next_command:;
struct Xorriso_lsT *result_list,
struct Xorriso_lsT *info_list,
int *line_count, int flag);
int pargc, pflag, max_words;
char **pargv= NULL, *pline, *prefix, *separators;
(*idx)++;
if(strcmp(arg1, "push") == 0) {
@ -1774,21 +1777,15 @@ next_command:;
} else if(strcmp(arg1, "stop") == 0) {
ret= Xorriso_stop_msg_watcher(xorriso, 0);
fprintf(stderr, "xorriso -test: Xorriso_stop_msg_watcher() = %d\n", ret);
} else {
fprintf(stderr, "xorriso -test: unknwon mode: %s\n", arg1);
}
ret= 0;
}
/* Test setup for Xorriso_parse_line */
if(0){
int pargc, pflag, max_words;
char **pargv= NULL, *pline, *prefix, *separators;
} else if(strcmp(arg1, "parse") == 0) {
(*idx)+= 5;
pline= arg1;
prefix= arg2;
pline= "";
if(*idx - 5 < argc)
pline= argv[*idx - 5];
prefix= "";
if(*idx - 4 < argc)
prefix= argv[*idx - 4];
separators= "";
if(*idx - 3 < argc)
separators= argv[*idx - 3];
@ -1807,6 +1804,10 @@ if(0){
for(i= 0; i < pargc; i++)
fprintf(stderr, "xorriso_test: argv[%d]= '%s'\n", i, pargv[i]);
Xorriso__dispose_words(&pargc, &pargv);
} else {
fprintf(stderr, "xorriso -test: unknwon mode: %s\n", arg1);
}
ret= 0;
}
} else if(strcmp(cmd,"toc")==0) {
@ -1907,13 +1908,17 @@ int Xorriso_parse_line(struct XorrisO *xorriso, char *line,
char *prefix, char *separators, int max_words,
int *argc, char ***argv, int flag)
{
int ret;
int ret, bsl_mode;
char *to_parse;
*argc= 0;
*argv= NULL;
to_parse= line;
if(flag & 1)
bsl_mode= (flag >> 1) & 3;
else
bsl_mode= xorriso->bsl_interpretation & 3;
if(prefix[0]) {
if(strncmp(line, prefix, strlen(prefix)) == 0) {
to_parse= line + strlen(prefix);
@ -1924,7 +1929,7 @@ int Xorriso_parse_line(struct XorrisO *xorriso, char *line,
ret= Sfile_sep_make_argv(xorriso->progname, to_parse, separators,
max_words, argc, argv,
(!(flag & 32)) | 4 | ((xorriso->bsl_interpretation & 3) << 5));
(!(flag & 32)) | 4 | (bsl_mode << 5));
if(ret < 0) {
Xorriso_msgs_submit(xorriso, 0,
"Severe lack of resources during command line parsing", 0, "FATAL", 0);

View File

@ -1 +1 @@
#define Xorriso_timestamP "2012.09.21.120245"
#define Xorriso_timestamP "2012.09.29.173546"