From 06f4db94c2c83e5883d46d313b8d9c43f2462bfb Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Thu, 19 Mar 2009 17:27:59 +0000 Subject: [PATCH] Unified -status filtering decision --- libisoburn/trunk/xorriso/xorriso.c | 44 ++++++++++++++++---- libisoburn/trunk/xorriso/xorriso_timestamp.h | 2 +- 2 files changed, 37 insertions(+), 9 deletions(-) diff --git a/libisoburn/trunk/xorriso/xorriso.c b/libisoburn/trunk/xorriso/xorriso.c index b15873a3..6c416efb 100644 --- a/libisoburn/trunk/xorriso/xorriso.c +++ b/libisoburn/trunk/xorriso/xorriso.c @@ -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 flag) /* bit1= do only report to fp */ { + +#ifdef NIX + int ret,l; if(filter!=NULL) @@ -5583,6 +5597,18 @@ bit1= do only report to fp if(strncmp(filter,xorriso->result_line,l)!=0) 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)) Xorriso_result(xorriso,0); if(fp!=NULL) { @@ -6339,10 +6365,11 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag) if(xorriso->out_charset != NULL) out_pt= xorriso->out_charset; do_single= 0; - if(filter != NULL) - if(strncmp(filter, "-in_charset", 11) == 0 || - strncmp(filter, "-out_charset", 12) == 0) - do_single= 1; + ret= Xorriso_status_filter(xorriso, filter, "-in_charset", 0); + if(ret <= 0) + ret= Xorriso_status_filter(xorriso, filter, "-out_charset", 0); + if(ret > 0) + do_single= 1; if(strcmp(in_pt, out_pt) == 0 && !do_single) { sprintf(line, "-charset %s\n", Text_shellsafe(in_pt, sfe, 0)); if(!(is_default && no_defaults)) @@ -6410,10 +6437,11 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag) } do_single= 0; - if(filter != NULL) - if(strncmp(filter, "-indev", 6) == 0 || - strncmp(filter, "-outdev", 7) == 0) - do_single= 1; + ret= Xorriso_status_filter(xorriso, filter, "-indev", 0); + if(ret <= 0) + ret= Xorriso_status_filter(xorriso, filter, "-outdev", 0); + if(ret > 0) + do_single= 1; if(strcmp(xorriso->indev, xorriso->outdev) == 0 && !do_single) { sprintf(line,"-dev %s\n", Text_shellsafe(xorriso->indev,sfe,0)); Xorriso_status_result(xorriso,filter,fp,flag&2); diff --git a/libisoburn/trunk/xorriso/xorriso_timestamp.h b/libisoburn/trunk/xorriso/xorriso_timestamp.h index 927839fa..729d6258 100644 --- a/libisoburn/trunk/xorriso/xorriso_timestamp.h +++ b/libisoburn/trunk/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2009.03.18.104037" +#define Xorriso_timestamP "2009.03.19.172806"