New -find test -disk_path
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
|
||||
/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images.
|
||||
|
||||
Copyright 2007-2011 Thomas Schmitt, <scdbackup@gmx.net>
|
||||
Copyright 2007-2012 Thomas Schmitt, <scdbackup@gmx.net>
|
||||
|
||||
Provided under GPL version 2 or later.
|
||||
|
||||
@ -2422,6 +2422,7 @@ int Xorriso_findi_action(struct XorrisO *xorriso, struct FindjoB *job,
|
||||
&mode_and, &mode_or, &type, &date, &subjob, 0);
|
||||
if(action<0)
|
||||
action= 0;
|
||||
job->match_count++;
|
||||
|
||||
hflag= 16*!(flag&2);
|
||||
ret= 1;
|
||||
@ -2654,6 +2655,8 @@ int Xorriso_findi_action(struct XorrisO *xorriso, struct FindjoB *job,
|
||||
}
|
||||
|
||||
|
||||
/* flag bit0= perform -disk_path rather than -disk_name
|
||||
*/
|
||||
int Exprtest_match_disk_name(struct XorrisO *xorriso, struct ExprtesT *ftest,
|
||||
IsoNode *node, int flag)
|
||||
|
||||
@ -2668,16 +2671,21 @@ int Exprtest_match_disk_name(struct XorrisO *xorriso, struct ExprtesT *ftest,
|
||||
ret= Xorriso_retrieve_disk_path(xorriso, node, disk_path, 0);
|
||||
if(ret <= 0)
|
||||
{ret= 0; goto ex;}
|
||||
if(flag & 1) {
|
||||
if(strcmp(disk_path, ftest->arg1) == 0)
|
||||
{ret= 1; goto ex;}
|
||||
{ret= 0; goto ex;}
|
||||
}
|
||||
arg2= ftest->arg2;
|
||||
npt= strrchr(disk_path, '/');
|
||||
if(npt != NULL)
|
||||
npt++;
|
||||
else
|
||||
npt= disk_path;
|
||||
ret= regexec(arg2, npt, 1, &name_match, 0);
|
||||
ret= ! regexec(arg2, npt, 1, &name_match, 0);
|
||||
ex:;
|
||||
Xorriso_free_meM(disk_path);
|
||||
return(!ret);
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
||||
@ -2908,6 +2916,9 @@ return:
|
||||
value= 1;
|
||||
}
|
||||
|
||||
break; case 20: /* -disk_path */
|
||||
value= !! Exprtest_match_disk_name(xorriso, ftest, node, 1);
|
||||
|
||||
break; default:
|
||||
|
||||
/* >>> complain about unknown test type */;
|
||||
|
Reference in New Issue
Block a user