Unified -status filtering decision

This commit is contained in:
Thomas Schmitt 2009-03-19 17:27:59 +00:00
parent 146cfddf78
commit 359333effa
2 changed files with 37 additions and 9 deletions

View File

@ -5569,12 +5569,26 @@ too_many_hops:;
} }
int Xorriso_status_filter(struct XorrisO *xorriso, char *filter, char *line,
int flag)
{
if(filter!=NULL)
if(filter[0]=='-')
if(strncmp(filter, line, strlen(filter))!=0)
return(0);
return(1);
}
int Xorriso_status_result(struct XorrisO *xorriso, char *filter, FILE *fp, int Xorriso_status_result(struct XorrisO *xorriso, char *filter, FILE *fp,
int flag) int flag)
/* /*
bit1= do only report to fp bit1= do only report to fp
*/ */
{ {
#ifdef NIX
int ret,l; int ret,l;
if(filter!=NULL) if(filter!=NULL)
@ -5583,6 +5597,18 @@ bit1= do only report to fp
if(strncmp(filter,xorriso->result_line,l)!=0) if(strncmp(filter,xorriso->result_line,l)!=0)
return(2); return(2);
} }
#else
int ret;
ret= Xorriso_status_filter(xorriso, filter, xorriso->result_line, 0);
if(ret <= 0)
return(2);
#endif /* NIX */
if(!(flag&2)) if(!(flag&2))
Xorriso_result(xorriso,0); Xorriso_result(xorriso,0);
if(fp!=NULL) { if(fp!=NULL) {
@ -6339,10 +6365,11 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
if(xorriso->out_charset != NULL) if(xorriso->out_charset != NULL)
out_pt= xorriso->out_charset; out_pt= xorriso->out_charset;
do_single= 0; do_single= 0;
if(filter != NULL) ret= Xorriso_status_filter(xorriso, filter, "-in_charset", 0);
if(strncmp(filter, "-in_charset", 11) == 0 || if(ret <= 0)
strncmp(filter, "-out_charset", 12) == 0) ret= Xorriso_status_filter(xorriso, filter, "-out_charset", 0);
do_single= 1; if(ret > 0)
do_single= 1;
if(strcmp(in_pt, out_pt) == 0 && !do_single) { if(strcmp(in_pt, out_pt) == 0 && !do_single) {
sprintf(line, "-charset %s\n", Text_shellsafe(in_pt, sfe, 0)); sprintf(line, "-charset %s\n", Text_shellsafe(in_pt, sfe, 0));
if(!(is_default && no_defaults)) if(!(is_default && no_defaults))
@ -6410,10 +6437,11 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
} }
do_single= 0; do_single= 0;
if(filter != NULL) ret= Xorriso_status_filter(xorriso, filter, "-indev", 0);
if(strncmp(filter, "-indev", 6) == 0 || if(ret <= 0)
strncmp(filter, "-outdev", 7) == 0) ret= Xorriso_status_filter(xorriso, filter, "-outdev", 0);
do_single= 1; if(ret > 0)
do_single= 1;
if(strcmp(xorriso->indev, xorriso->outdev) == 0 && !do_single) { if(strcmp(xorriso->indev, xorriso->outdev) == 0 && !do_single) {
sprintf(line,"-dev %s\n", Text_shellsafe(xorriso->indev,sfe,0)); sprintf(line,"-dev %s\n", Text_shellsafe(xorriso->indev,sfe,0));
Xorriso_status_result(xorriso,filter,fp,flag&2); Xorriso_status_result(xorriso,filter,fp,flag&2);

View File

@ -1 +1 @@
#define Xorriso_timestamP "2009.03.18.104037" #define Xorriso_timestamP "2009.03.19.172806"