New find test -disk_name

This commit is contained in:
2010-06-19 16:56:15 +00:00
parent 9a46cddaac
commit ea5edd0a59
8 changed files with 128 additions and 38 deletions

View File

@ -1860,6 +1860,10 @@ int Xorriso_findi_action(struct XorrisO *xorriso, struct FindjoB *job,
ret= Xorriso_mkisofs_lower_r(xorriso, node, 0);
} else if(action == 38) { /* sort_weight */
iso_node_set_sort_weight(node, type);
} else if(action == 38) { /* hide */
/* >>> iso_node_set_hidden */;
} else { /* includes : 15 in_iso */
sprintf(xorriso->result_line, "%s\n", Text_shellsafe(show_path, sfe, 0));
Xorriso_result(xorriso, 0);
@ -1875,6 +1879,29 @@ int Xorriso_findi_action(struct XorrisO *xorriso, struct FindjoB *job,
}
int Exprtest_match_disk_name(struct XorrisO *xorriso, struct ExprtesT *ftest,
IsoNode *node, int flag)
{
int ret;
char disk_path[SfileadrL], *npt;
regmatch_t name_match;
void *arg2;
ret= Xorriso_retrieve_disk_path(xorriso, node, disk_path, 0);
if(ret <= 0)
return(0);
arg2= ftest->arg2;
npt= strrchr(disk_path, '/');
if(npt != NULL)
npt++;
else
npt= disk_path;
ret= regexec(arg2, npt, 1, &name_match, 0);
return !ret;
}
int Exprtest_match(struct XorrisO *xorriso, struct ExprtesT *ftest,
void *node_pt, char *name, char *path,
struct stat *boss_stbuf, struct stat *stbuf, int flag)
@ -2061,6 +2088,9 @@ return:
ret= Xorriso_get_md5(xorriso, node, path, md5, 1);
value= (ret > 0);
break; case 16: /* -disk_name *arg1 (regex in *arg2) */
value= !! Exprtest_match_disk_name(xorriso, ftest, node, 0);
break; default:
/* >>> complain about unknown test type */;