JOE@FHCRCVAX.BITNET (Joe Meadows) (09/14/87)
Here's part 4 of INDEX. I mailed part 1 on friday, part 2 on saturday,
part 3 on sunday, and will mail part 5 on tuesday. I have not seen part
2 come back through info-vax, and several people have written to me about
it, so, unless I discover differently, I will assume part 2 got lost and
will resend it on wednesday.
Cheers,
Joe Meadows Jr.
VAX/VMS System Manager / guru in training
Fred Hutchinson Cancer Research Center
1124 Columbia St.
Seattle Wa. 98104
bitnet - JOE@FHCRCVAX
arpa - JOE%FHCRCVAX.BITNET@WISCVM.WISC.EDU
voice - (206) 467-4970
$ create/log SEARCH.C
$DECK
/* Modification History
--------------------
Sep. 8, 1987 JEM - Conversion from BETA to Release
*/
#include climsgdef
#include "fh2def.h"
#include "fi2def.h"
#include "fm2def.h"
#include "fileinfo.h"
#include "acedef.h"
#include "searchdef.h" /* includes descrip */
#include "cld.h"
char *get_header();
long int init_search(search)
struct search_info *search;
{
static struct dsc$descriptor minstr={0,DSC$K_DTYPE_T,DSC$K_CLASS_D,0};
static struct dsc$descriptor maxstr={0,DSC$K_DTYPE_T,DSC$K_CLASS_D,0};
static long int word = 2;
static long int byte = 1;
long int i,j,status,value;
char *c;
search->si_l_srchbits0 = 0;
search->si_l_srchbits1 = 0;
if (cli_present("MATCH.AND") & 1)
search->si_v_and_match = 1;
if (cli_present(t_credate) & 1) {
cli_get_value(t_credate,&minstr);
status = sys$bintim(&minstr,&(*search).si_q_credat_min);
if (!(status & 1)) return(status);
cli_get_value(t_credate,&maxstr);
status = sys$bintim(&maxstr,&(*search).si_q_credat_max);
if (!(status & 1)) return(status);
search->si_v_credat = 1;
};
if (cli_present(t_revdate) & 1) {
cli_get_value(t_revdate,&minstr);
status = sys$bintim(&minstr,&(*search).si_q_revdat_min);
if (!(status & 1)) return(status);
cli_get_value(t_revdate,&maxstr);
status = sys$bintim(&maxstr,&(*search).si_q_revdat_max);
if (!(status & 1)) return(status);
search->si_v_revdat = 1;
};
if (cli_present(t_expdate) & 1) {
cli_get_value(t_expdate,&minstr);
status = sys$bintim(&minstr,&(*search).si_q_expdat_min);
if (!(status & 1)) return(status);
cli_get_value(t_expdate,&maxstr);
status = sys$bintim(&maxstr,&(*search).si_q_expdat_max);
if (!(status & 1)) return(status);
search->si_v_expdat = 1;
};
if (cli_present(t_bakdate) & 1) {
cli_get_value(t_bakdate,&minstr);
status = sys$bintim(&minstr,&(*search).si_q_bakdat_min);
if (!(status & 1)) return(status);
cli_get_value(t_bakdate,&maxstr);
status = sys$bintim(&maxstr,&(*search).si_q_bakdat_max);
if (!(status & 1)) return(status);
search->si_v_bakdat = 1;
};
if (cli_present(t_revisions) & 1) {
cli_get_value(t_revisions,&minstr);
status = ots$cvt_ti_l(&minstr,&(*search).si_l_revision_min);
cli_get_value(t_revisions,&maxstr);
status = ots$cvt_ti_l(&maxstr,&(*search).si_l_revision_max);
search->si_v_revision = 1;
};
if (cli_present(t_extents) & 1) {
cli_get_value(t_extents,&minstr);
status = ots$cvt_ti_l(&minstr,&(*search).si_l_extents_min);
cli_get_value(t_extents,&maxstr);
status = ots$cvt_ti_l(&maxstr,&(*search).si_l_extents_max);
search->si_v_extents = 1;
};
if (cli_present(t_header) & 1) {
cli_get_value(t_header,&minstr);
status = ots$cvt_ti_l(&minstr,&(*search).si_l_headers_min);
cli_get_value(t_header,&maxstr);
status = ots$cvt_ti_l(&maxstr,&(*search).si_l_headers_max);
search->si_v_headers = 1;
};
if (cli_present(t_lbn) & 1) {
i = -1;
while ((cli_get_value(t_lbn,&minstr) & 1) && ((++i)<SI_K_LBN_LIST_SIZE))
status = ots$cvt_ti_l(&minstr,&(*search).si_l_lbn_list[i]);
search->si_l_lbn_list[++i] = -1;
search->si_v_lbn = 1;
};
if (cli_present(t_highwater) & 1) {
cli_get_value(t_highwater,&minstr);
status = ots$cvt_ti_l(&minstr,&(*search).si_l_highwater_min);
if (search->si_l_highwater_min > 0)
++search->si_l_highwater_min;
cli_get_value(t_highwater,&maxstr);
status = ots$cvt_ti_l(&maxstr,&(*search).si_l_highwater_max);
if (search->si_l_highwater_max > 0)
++search->si_l_highwater_max;
search->si_v_highwater = 1;
};
if (cli_present(t_ru_active) & 1) {
cli_get_value(t_ru_active,&minstr);
status = ots$cvt_ti_l(&minstr,&value);
search->si_b_ru_active_min = value;
cli_get_value(t_ru_active,&maxstr);
status = ots$cvt_ti_l(&maxstr,&value);
search->si_b_ru_active_max = value;
search->si_v_ru_active = 1;
};
if (cli_present(t_rsize) & 1) {
cli_get_value(t_rsize,&minstr);
status = ots$cvt_ti_l(&minstr,&value);
search->si_w_rsize_min = value;
cli_get_value(t_rsize,&maxstr);
status = ots$cvt_ti_l(&maxstr,&value);
search->si_w_rsize_max = value;
search->si_v_rsize = 1;
};
if (cli_present(t_hiblk) & 1) {
cli_get_value(t_hiblk,&minstr);
status = ots$cvt_ti_l(&minstr,&(*search).si_l_alloc_min);
cli_get_value(t_hiblk,&maxstr);
status = ots$cvt_ti_l(&maxstr,&(*search).si_l_alloc_max);
search->si_v_alloc = 1;
};
if (cli_present(t_efblk) & 1) {
cli_get_value(t_efblk,&minstr);
status = ots$cvt_ti_l(&minstr,&(*search).si_l_used_min);
cli_get_value(t_efblk,&maxstr);
status = ots$cvt_ti_l(&maxstr,&(*search).si_l_used_max);
search->si_v_used = 1;
};
if (cli_present(t_wasted) & 1) {
cli_get_value(t_wasted,&minstr);
status = ots$cvt_ti_l(&minstr,&(*search).si_l_wasted_min);
cli_get_value(t_wasted,&maxstr);
status = ots$cvt_ti_l(&maxstr,&(*search).si_l_wasted_max);
search->si_v_wasted = 1;
};
if (cli_present(t_bktsize) & 1) {
cli_get_value(t_bktsize,&minstr);
status = ots$cvt_ti_l(&minstr,&value);
search->si_b_bktsize_min = value;
cli_get_value(t_bktsize,&maxstr);
status = ots$cvt_ti_l(&maxstr,&value);
search->si_b_bktsize_max = value;
search->si_v_bktsize = 1;
};
if (cli_present(t_vfcsize) & 1) {
cli_get_value(t_vfcsize,&minstr);
status = ots$cvt_ti_l(&minstr,&value);
search->si_b_vfcsize_min = value;
cli_get_value(t_vfcsize,&maxstr);
status = ots$cvt_ti_l(&maxstr,&value);
search->si_b_vfcsize_max = value;
search->si_v_vfcsize = 1;
};
if (cli_present(t_maxrec) & 1) {
cli_get_value(t_maxrec,&minstr);
status = ots$cvt_ti_l(&minstr,&value);
search->si_w_maxrec_min = value;
cli_get_value(t_maxrec,&maxstr);
status = ots$cvt_ti_l(&maxstr,&value);
search->si_w_maxrec_max = value;
search->si_v_maxrec = 1;
};
if (cli_present(t_defext) & 1) {
cli_get_value(t_defext,&minstr);
status = ots$cvt_ti_l(&minstr,&value);
search->si_w_defext_min = value;
cli_get_value(t_defext,&maxstr);
status = ots$cvt_ti_l(&maxstr,&value);
search->si_w_defext_max = value;
search->si_v_defext = 1;
};
if (cli_present(t_gbc) & 1) {
cli_get_value(t_gbc,&minstr);
status = ots$cvt_ti_l(&minstr,&value);
search->si_w_gbc_min = value;
cli_get_value(t_gbc,&maxstr);
status = ots$cvt_ti_l(&maxstr,&value);
search->si_w_gbc_max = value;
search->si_v_gbc = 1;
};
if (cli_present(t_ffbyte) & 1) {
cli_get_value(t_ffbyte,&minstr);
status = ots$cvt_ti_l(&minstr,&value);
search->si_w_ffbyte_min = value;
cli_get_value(t_ffbyte,&maxstr);
status = ots$cvt_ti_l(&maxstr,&value);
search->si_w_ffbyte_max = value;
search->si_v_ffbyte = 1;
};
if (cli_present(t_versions) & 1) {
cli_get_value(t_versions,&minstr);
status = ots$cvt_ti_l(&minstr,&value);
search->si_w_version_limit_min = value;
cli_get_value(t_versions,&maxstr);
status = ots$cvt_ti_l(&maxstr,&value);
search->si_w_version_limit_max = value;
search->si_v_version_limit = 1;
};
if (cli_present(t_backlink) & 1) {
i = -1;
while ((cli_get_value(t_backlink,&minstr)&1)
&& ((++i)<SI_K_BACKLINK_LIST_SIZE)) {
status = ots$cvt_ti_l(&minstr,&value);
search->si_w_backlink[i] = value;
};
search->si_w_backlink[++i]=0;
search->si_v_backlink = 1;
};
if (cli_present(t_owner) & 1) {
i = -1;
while ((cli_get_value(t_owner,&minstr) & 1)
&& ((++i)<SI_K_OWNER_LIST_SIZE)) {
status = parse_uic(&minstr,&value);
if (status & 1)
search->si_l_owner_list[i] = value;
else {
printf("UIC %.*s is not valid\n",
minstr.dsc$w_length,minstr.dsc$a_pointer);
--i;
};
};
search->si_l_owner_list[++i]=0;
search->si_v_owner = 1;
};
if (cli_present(t_prot) & 1) {
search->si_v_prot = 1;
if (cli_present(t_protset) & 1) {
for (i=0;i<4;i++) {
search->si_w_protection = 0; /* init to none have to be set */
append_with_point(t_protset,ta_prot[i],&minstr);
if (cli$present(&minstr) & 1) {
cli$get_value(&minstr,&maxstr);
/* loop through checking for R, W, E, D */
c = maxstr.dsc$a_pointer;
for (j=0;j<maxstr.dsc$w_length;j++) {
switch (*c) {
case 'R' :
search->si_v_protection.read = 1;
break;
case 'W' :
search->si_v_protection.write = 1;
break;
case 'E' :
search->si_v_protection.execute = 1;
break;
case 'D' :
search->si_v_protection.delete = 1;
break;
default:
printf("Illegal protection specified '%c'\n",*c);
break;
};
++c;
};
};
search->si_w_protset = search->si_w_protset
| (search->si_w_protection << (i*4));
};
};
if (cli_present(t_protclr) & 1) {
for (i=0;i<4;i++) {
search->si_w_protection = 0; /* init to none have to be clear */
append_with_point(t_protclr,ta_prot[i],&minstr);
if (cli$present(&minstr) & 1) {
cli$get_value(&minstr,&maxstr);
/* loop through checking for R, W, E, D */
c = maxstr.dsc$a_pointer;
for (j=0;j<maxstr.dsc$w_length;j++) {
switch (*c) {
case 'R' :
search->si_v_protection.read = 1;
break;
case 'W' :
search->si_v_protection.write = 1;
break;
case 'E' :
search->si_v_protection.execute = 1;
break;
case 'D' :
search->si_v_protection.delete = 1;
break;
default:
printf("Illegal protection specified '%c'\n",*c);
break;
};
++c;
};
};
search->si_w_protclr = search->si_w_protclr
| (search->si_w_protection << (i*4));
};
};
};
if (cli_present(t_fileorg) & 1) {
search->si_v_fileorg = 1;
search->si_b_fileorgset = 0;
search->si_b_fileorgclr = 0;
for (i=0;i<4;i++) {
append_with_point(t_fileorg,ta_fileorg[i],&minstr);
switch (present(&minstr)) {
case 1:
search->si_b_fileorgset |= (1<<i);
break;
case -1:
search->si_b_fileorgclr |= (1<<i);
break;
};
};
if (search->si_b_fileorgset == 0)
search->si_b_fileorgset = 255;
};
if (cli_present(t_rtype) & 1) {
search->si_v_rectype = 1;
search->si_b_rectypeset = 0;
search->si_b_rectypeclr = 0;
for (i=0;i<7;i++) {
append_with_point(t_rtype,ta_rtype[i],&minstr);
switch (present(&minstr)) {
case 1:
search->si_b_rectypeset |= (1<<i);
break;
case -1:
search->si_b_rectypeclr |= (1<<i);
break;
};
};
if (search->si_b_rectypeset == 0)
search->si_b_rectypeset = 255;
};
if (cli_present(t_access) & 1) {
search->si_v_access = 1;
search->si_b_access_set = 0;
search->si_b_access_clr = 0;
for (i=0;i<4;i++) {
append_with_point(t_access,ta_access[i],&minstr);
switch (present(&minstr)) {
case 1:
search->si_b_access_set |= (1<<i);
break;
case -1:
search->si_b_access_clr |= (1<<i);
break;
};
};
if (search->si_b_access_set == 0)
search->si_b_access_set = 255;
};
if (cli_present(t_char) & 1) {
search->si_v_char = 1;
search->si_l_charset = 0;
search->si_l_charclr = 0;
append_with_point(t_char,t_badacl,&minstr);
switch (present(&minstr)) {
case 1:
search->si_charset.v_badacl |= 1;
break;
case -1:
search->si_charclr.v_badacl |= 1;
break;
};
append_with_point(t_char,t_nobackup,&minstr);
switch (present(&minstr)) {
case 1:
search->si_charclr.v_nobackup |= 1;
break;
case -1:
search->si_charset.v_nobackup |= 1;
break;
};
append_with_point(t_char,t_contigb,&minstr);
switch (present(&minstr)) {
case 1:
search->si_charset.v_contigb |= 1;
break;
case -1:
search->si_charclr.v_contigb |= 1;
break;
};
append_with_point(t_char,t_nocharge,&minstr);
switch (present(&minstr)) {
case 1:
search->si_charclr.v_nocharge |= 1;
break;
case -1:
search->si_charset.v_nocharge |= 1;
break;
};
append_with_point(t_char,t_contig,&minstr);
switch (present(&minstr)) {
case 1:
search->si_charset.v_contig |= 1;
break;
case -1:
search->si_charclr.v_contig |= 1;
break;
};
append_with_point(t_char,t_directory,&minstr);
switch (present(&minstr)) {
case 1:
search->si_charset.v_directory |= 1;
break;
case -1:
search->si_charclr.v_directory |= 1;
break;
};
append_with_point(t_char,t_erase,&minstr);
switch (present(&minstr)) {
case 1:
search->si_charset.v_erase |= 1;
break;
case -1:
search->si_charclr.v_erase |= 1;
break;
};
append_with_point(t_char,t_badblock,&minstr);
switch (present(&minstr)) {
case 1:
search->si_charset.v_badblock |= 1;
break;
case -1:
search->si_charclr.v_badblock |= 1;
break;
};
append_with_point(t_char,t_locked,&minstr);
switch (present(&minstr)) {
case 1:
search->si_charset.v_locked |= 1;
break;
case -1:
search->si_charclr.v_locked |= 1;
break;
};
append_with_point(t_char,t_markdel,&minstr);
switch (present(&minstr)) {
case 1:
search->si_charset.v_markdel |= 1;
break;
case -1:
search->si_charclr.v_markdel |= 1;
break;
};
append_with_point(t_char,t_spool,&minstr);
switch (present(&minstr)) {
case 1:
search->si_charset.v_spool |= 1;
break;
case -1:
search->si_charclr.v_spool |= 1;
break;
};
append_with_point(t_char,t_readcheck,&minstr);
switch (present(&minstr)) {
case 1:
search->si_charset.v_readcheck |= 1;
break;
case -1:
search->si_charclr.v_readcheck |= 1;
break;
};
append_with_point(t_char,t_writeback,&minstr);
switch (present(&minstr)) {
case 1:
search->si_charset.v_writeback |= 1;
break;
case -1:
search->si_charclr.v_writeback |= 1;
break;
};
append_with_point(t_char,t_writcheck,&minstr);
switch (present(&minstr)) {
case 1:
search->si_charset.v_writcheck |= 1;
break;
case -1:
search->si_charclr.v_writcheck |= 1;
break;
};
};
if (cli_present(t_attr) & 1) {
search->si_v_attrib = 1;
search->si_b_attrib_set = 0;
search->si_b_attrib_clr = 0;
append_with_point(t_attr,t_fortrancc,&minstr);
switch (present(&minstr)) {
case 1:
search->si_attribset.v_fortrancc |= 1;
break;
case -1:
search->si_attribclr.v_fortrancc |= 1;
break;
};
append_with_point(t_attr,t_impliedcc,&minstr);
switch (present(&minstr)) {
case 1:
search->si_attribset.v_impliedcc |= 1;
break;
case -1:
search->si_attribclr.v_impliedcc |= 1;
break;
};
append_with_point(t_attr,t_printcc,&minstr);
switch (present(&minstr)) {
case 1:
search->si_attribset.v_printcc |= 1;
break;
case -1:
search->si_attribclr.v_printcc |= 1;
break;
};
append_with_point(t_attr,t_nospan,&minstr);
switch (present(&minstr)) {
case 1:
search->si_attribclr.v_nospan |= 1;
break;
case -1:
search->si_attribset.v_nospan |= 1;
break;
};
};
if (cli_present(t_journal) & 1) {
search->si_v_journal = 1;
search->si_b_journalset = 0;
search->si_b_journalclr = 0;
append_with_point(t_journal,t_only_ru,&minstr);
switch (present(&minstr)) {
case 1:
search->si_journalset.v_only_ru |= 1;
break;
case -1:
search->si_journalclr.v_only_ru |= 1;
break;
};
append_with_point(t_journal,t_never_ru,&minstr);
switch (present(&minstr)) {
case 1:
search->si_journalset.v_never_ru |= 1;
break;
case -1:
search->si_journalclr.v_never_ru |= 1;
break;
};
append_with_point(t_journal,t_journal_file,&minstr);
switch (present(&minstr)) {
case 1:
search->si_journalset.v_journal_file |= 1;
break;
case -1:
search->si_journalclr.v_journal_file |= 1;
break;
};
append_with_point(t_journal,t_aijnl,&minstr);
switch (present(&minstr)) {
case 1:
search->si_journalset.v_aijnl |= 1;
break;
case -1:
search->si_journalclr.v_aijnl |= 1;
break;
};
append_with_point(t_journal,t_atjnl,&minstr);
switch (present(&minstr)) {
case 1:
search->si_journalset.v_atjnl |= 1;
break;
case -1:
search->si_journalclr.v_atjnl |= 1;
break;
};
append_with_point(t_journal,t_bijnl,&minstr);
switch (present(&minstr)) {
case 1:
search->si_journalset.v_bijnl |= 1;
break;
case -1:
search->si_journalclr.v_bijnl |= 1;
break;
};
append_with_point(t_journal,t_rujnl,&minstr);
switch (present(&minstr)) {
case 1:
search->si_journalset.v_rujnl |= 1;
break;
case -1:
search->si_journalclr.v_rujnl |= 1;
break;
};
};
if (cli_present(t_placement) & 1) {
search->si_v_placement = 1;
search->si_w_place_set = 0;
search->si_w_place_clr = 0;
append_with_point(t_placement,t_place_exact,&minstr);
switch (present(&minstr)) {
case 1:
search->si_placeset.v_exact |= 1;
break;
case -1:
search->si_placeclr.v_exact |= 1;
break;
};
append_with_point(t_placement,t_place_oncyl,&minstr);
switch (present(&minstr)) {
case 1:
search->si_placeset.v_oncyl |= 1;
break;
case -1:
search->si_placeclr.v_oncyl |= 1;
break;
};
append_with_point(t_placement,t_place_lbn,&minstr);
switch (present(&minstr)) {
case 1:
search->si_placeset.v_lbn |= 1;
break;
case -1:
search->si_placeclr.v_lbn |= 1;
break;
};
append_with_point(t_placement,t_place_rvn,&minstr);
switch (present(&minstr)) {
case 1:
search->si_placeset.v_rvn |= 1;
break;
case -1:
search->si_placeclr.v_rvn |= 1;
break;
};
};
if (cli_present(t_filename) & 1) {
search->si_v_filename = 1;
search->si_t_filename.dsc$b_class = DSC$K_CLASS_D;
search->si_t_filename.dsc$b_dtype = DSC$K_DTYPE_T;
cli_get_value(t_filename,&(*search).si_t_filename);
};
if (cli_present(t_aclexists) & 1)
search->si_v_aclexists = 1;
if (cli_present(t_aclcontains) & 1) {
i = -1;
while ((cli_get_value(t_aclcontains,&minstr) & 1)
&& ((++i)<SI_K_ACL_ID_LIST_SIZE)) {
status = parse_uic(&minstr,&(*search).si_l_acl_id_list[i]);
if (!(status & 1))
printf("Invalid Identifer/UIC %.*s\n",
minstr.dsc$w_length,minstr.dsc$a_pointer);
};
search->si_l_acl_id_list[++i] = 0;
search->si_v_aclcontains = 1;
};
return(1);
}
long int search_header(search,fh2,context,cached,chan)
struct search_info *search;
struct fh2def *fh2;
struct FileInfo *context;
int cached;
short int chan;
{
static char namebuff[FI2$S_FILENAME+FI2$S_FILENAMEXT];
static struct dsc$descriptor name =
{0,DSC$K_DTYPE_T,DSC$K_CLASS_S,namebuff};
struct fh2def *exthdr;
struct fi2def *fi2;
struct fm2def *fm2,*fm2adr;
short int nxtfid[3];
long int fm2offset=0,lbn=0,count=0,totextents=0,tothdrs=0;
long int block;
long int i,j,k,min,max;
long status;
static short int and_match = 0;
short int lbn_found,placement_found,acl_found;
struct acedef *acaddr;
long int *idaddr;
/* skip extention headers */
if (fh2->fh2$w_seg_num != 0) return(0);
/* if they have no search criterion, then return */
if ((search->si_l_srchbits0 == 0)
&& (search->si_l_srchbits1 == 0))
return(1);
if (search->si_v_and_match)
and_match = 1;
/* compute where in the file header the file ident info is */
fi2 = (long int)fh2 + fh2->fh2$b_idoffset * 2;
if (search->si_v_filename) {
j = 0;
for (i=0;(i < FI2$S_FILENAME) &&
((*fi2).fi2$t_filename[i] != ' ');i++)
namebuff[j++] = fi2->fi2$t_filename[i];
if ((fh2->fh2$b_mpoffset - fh2->fh2$b_idoffset) >= 60)
for (i=0;(i < FI2$S_FILENAMEXT) &&
((*fi2).fi2$t_filenamext[i] != ' ');i++)
namebuff[j++] = fi2->fi2$t_filenamext[i];
name.dsc$w_length = j;
if (str$match_wild(&name,&(*search).si_t_filename) & 1)
{
if (! and_match)
return(1);
}
else
if (and_match)
return(0);
};
if (search->si_v_credat) {
min=cmp_time(&(*search).si_q_credat_min, &(*fi2).fi2$q_credate);
max=cmp_time(&(*search).si_q_credat_max, &(*fi2).fi2$q_credate);
if ((min <= 0) && (max >= 0))
{
if (! and_match)
return(1);
}
else
if (and_match)
return(0);
};
if (search->si_v_revdat) {
min=cmp_time(&(*search).si_q_revdat_min, &(*fi2).fi2$q_revdate);
max=cmp_time(&(*search).si_q_revdat_max, &(*fi2).fi2$q_revdate);
if ((min <= 0) && (max >= 0))
{
if (! and_match)
return(1);
}
else
if (and_match)
return(0);
};
if (search->si_v_expdat) {
min=cmp_time(&(*search).si_q_expdat_min, &(*fi2).fi2$q_expdate);
max=cmp_time(&(*search).si_q_expdat_max, &(*fi2).fi2$q_expdate);
if ((min <= 0) && (max >= 0))
{
if (! and_match)
return(1);
}
else
if (and_match)
return(0);
};
if (search->si_v_bakdat) {
min=cmp_time(&(*search).si_q_bakdat_min, &(*fi2).fi2$q_bakdate);
max=cmp_time(&(*search).si_q_bakdat_max, &(*fi2).fi2$q_bakdate);
if ((min <= 0) && (max >= 0))
{
if (! and_match)
return(1);
}
else
if (and_match)
return(0);
};
if (search->si_v_revision) {
if ((search->si_l_revision_min <= fi2->fi2$w_revision)
&& ((fi2->fi2$w_revision <= search->si_l_revision_max)
|| (search->si_l_revision_max == 0)))
{
if (! and_match)
return(1);
}
else
if (and_match)
return(0);
};
if (search->si_v_aclexists) {
if (fh2->fh2$b_acoffset < fh2->fh2$b_rsoffset)
{
if (! and_match)
return(1);
}
else
if (and_match)
return(0);
};
if (search->si_v_highwater) {
if ((search->si_l_highwater_min <= fh2->fh2$l_highwater)
&& ((fh2->fh2$l_highwater <= search->si_l_highwater_max)
|| (search->si_l_highwater_max == 0)))
{
if (! and_match)
return(1);
}
else
if (and_match)
return(0);
};
if (search->si_v_ru_active) {
if ((search->si_b_ru_active_min <= fh2->fh2$b_ru_active)
&& ((fh2->fh2$b_ru_active <= search->si_b_ru_active_max)
|| (search->si_b_ru_active_max == 0)))
{
if (! and_match)
return(1);
}
else
if (and_match)
return(0);
};
if (search->si_v_rsize) {
if ((search->si_w_rsize_min <= fh2->fat.fat$w_rsize)
&& ((fh2->fat.fat$w_rsize <= search->si_w_rsize_max)
|| (search->si_w_rsize_max == 0)))
{
if (! and_match)
return(1);
}
else
if (and_match)
return(0);
};
if (search->si_v_alloc) {
block = (fh2->fat.fat$w_hiblkh<<16)|fh2->fat.fat$w_hiblkl;
if ((search->si_l_alloc_min <= block)
&& ((block <= search->si_l_alloc_max)
|| (search->si_l_alloc_max == 0)))
{
if (! and_match)
return(1);
}
else
if (and_match)
return(0);
};
if (search->si_v_used) {
block = (fh2->fat.fat$w_efblkh<<16)|fh2->fat.fat$w_efblkl;
if (fh2->fat.fat$w_ffbyte == 0) --block;
if ((search->si_l_used_min <= block)
&& ((block <= search->si_l_used_max)
|| (search->si_l_used_max == 0)))
{
if (! and_match)
return(1);
}
else
if (and_match)
return(0);
};
if (search->si_v_wasted) {
block = (fh2->fat.fat$w_efblkh<<16)|fh2->fat.fat$w_efblkl;
if (fh2->fat.fat$w_ffbyte == 0)
--block;
block = ((fh2->fat.fat$w_hiblkh<<16)|fh2->fat.fat$w_hiblkl) - block;
if ((search->si_l_wasted_min <= block)
&& ((block <= search->si_l_wasted_max)
|| (search->si_l_wasted_max == 0)))
{
if (! and_match)
return(1);
}
else
if (and_match)
return(0);
};
if (search->si_v_bktsize) {
if ((search->si_b_bktsize_min <= fh2->fat.fat$b_bktsize)
&& ((fh2->fat.fat$b_bktsize <= search->si_b_bktsize_max)
|| (search->si_b_bktsize_max == 0)))
{
if (! and_match)
return(1);
}
else
if (and_match)
return(0);
};
if (search->si_v_vfcsize) {
if ((search->si_b_vfcsize_min <= fh2->fat.fat$b_vfcsize)
&& ((fh2->fat.fat$b_vfcsize <= search->si_b_vfcsize_max)
|| (search->si_b_vfcsize_max == 0)))
{
if (! and_match)
return(1);
}
else
if (and_match)
return(0);
};
if (search->si_v_maxrec) {
if ((search->si_w_maxrec_min <= fh2->fat.fat$w_maxrec)
&& ((fh2->fat.fat$w_maxrec <= search->si_w_maxrec_max)
|| (search->si_w_maxrec_max == 0)))
{
if (! and_match)
return(1);
}
else
if (and_match)
return(0);
};
if (search->si_v_defext) {
if ((search->si_w_defext_min <= fh2->fat.fat$w_defext)
&& ((fh2->fat.fat$w_defext <= search->si_w_defext_max)
|| (search->si_w_defext_max == 0)))
{
if (! and_match)
return(1);
}
else
if (and_match)
return(0);
};
if (search->si_v_gbc) {
if ((search->si_w_gbc_min <= fh2->fat.fat$w_gbc)
&& ((fh2->fat.fat$w_gbc <= search->si_w_gbc_max)
|| (search->si_w_gbc_max == 0)))
{
if (! and_match)
return(1);
}
else
if (and_match)
return(0);
};
if (search->si_v_ffbyte) {
if ((search->si_w_ffbyte_min <= fh2->fat.fat$w_ffbyte)
&& ((fh2->fat.fat$w_ffbyte <= search->si_w_ffbyte_max)
|| (search->si_w_ffbyte_max == 0)))
{
if (! and_match)
return(1);
}
else
if (and_match)
return(0);
};
if (search->si_v_version_limit) {
if ((search->si_w_version_limit_min <= fh2->fat.fat$w_versions)
&& ((fh2->fat.fat$w_versions <= search->si_w_version_limit_max)
|| (search->si_w_version_limit_max == 0)))
{
if (! and_match)
return(1);
}
else
if (and_match)
return(0);
};
if (search->si_v_backlink) {
j = 0;
k = -1;
while (search->si_w_backlink[++k])
if (fh2->fh2$w_backlink[0] == search->si_w_backlink[k])
{
if (! and_match)
return(1);
j = 1;
};
if (and_match && (j==0))
return(0);
};
if (search->si_v_owner) {
j = 0;
k = -1;
while (search->si_l_owner_list[++k])
if (fh2->fh2$l_fileowner == search->si_l_owner_list[k])
{
if (! and_match)
return(1);
j = 1;
};
if (and_match && (j==0))
return(0);
};
if (search->si_v_extents || search->si_v_headers
|| search->si_v_lbn || search->si_v_placement) {
/* okay, loop through all the header blocks, starting with this one */
lbn_found = 0;
placement_found = 0;
exthdr = fh2;
while (exthdr && (exthdr->fh2$b_mpoffset < exthdr->fh2$b_acoffset)) {
fm2offset = 0;
fm2adr = (char *)exthdr + exthdr->fh2$b_mpoffset * 2;
i = exthdr->fh2$b_map_inuse * 2;
while (fm2offset < i) {
fm2 = (char *)fm2adr + fm2offset;
j=0;
switch (fm2->fm2$v_format) {
case FM2$C_PLACEMENT:
lbn = 0;
count = 0;
if (search->si_v_placement)
if ((search->si_w_place_set & fm2->fm2$w_word0)
&& !(search->si_w_place_clr & fm2->fm2$w_word0))
{
if (! and_match)
return(1);
placement_found = 1;
};
fm2offset += FM2$C_LENGTH0;
break;
case FM2$C_FORMAT1:
++j;
++totextents;
lbn = (fm2->fm2$v_highlbn <<16) + fm2->fm2$w_lowlbn;
count = fm2->fm2$b_count1;
fm2offset += FM2$C_LENGTH1;
break;
case FM2$C_FORMAT2:
++j;
++totextents;
lbn = fm2->fm2$l_lbn2;
count = fm2->fm2$v_count2;
fm2offset += FM2$C_LENGTH2;
break;
case FM2$C_FORMAT3:
++j;
++totextents;
lbn = fm2->fm2$l_lbn3;
count = (fm2->fm2$v_count2 << 16) + fm2->fm2$w_lowcount;
fm2offset += FM2$C_LENGTH3;
break;
};
if (search->si_v_lbn && j) {
/* see if any of the LBNs are in this section */
k = -1;
while (search->si_l_lbn_list[++k] != -1)
if ((lbn <= search->si_l_lbn_list[k])
&& (search->si_l_lbn_list[k] <= (lbn+count)))
{
if (! and_match)
return(1);
lbn_found = 1;
};
};
};
if (exthdr->fh2$w_ext_fid[0])
exthdr = get_header(exthdr->fh2$w_ext_fid,exthdr->fh2$w_fid,
context,cached,chan);
else
exthdr=0;
if (exthdr)
++tothdrs;
};
if (search->si_v_lbn && and_match && (! lbn_found))
return(0);
if (search->si_v_placement && and_match && (! placement_found))
return(0);
if (search->si_v_extents) {
if ((search->si_l_extents_min <= totextents)
&& ((totextents <= search->si_l_extents_max)
|| (search->si_l_extents_max == 0)))
{
if (! and_match)
return(1);
}
else
if (and_match)
return(0);
};
if (search->si_v_headers) {
if ((search->si_l_headers_min <= tothdrs)
&& ((tothdrs <= search->si_l_headers_max)
|| (search->si_l_headers_max == 0)))
{
if (! and_match)
return(1);
}
else
if (and_match)
return(0);
};
};
if (search->si_v_aclcontains) {
acl_found = 0;
exthdr = fh2;
while (exthdr && (exthdr->fh2$b_acoffset < exthdr->fh2$b_rsoffset)) {
acaddr = (char *)exthdr + exthdr->fh2$b_acoffset * 2;
while ((acaddr < ((char *)exthdr + (exthdr->fh2$b_rsoffset*2)))
&& (acaddr->ace$b_size != 0)) {
/* search through the ace */
if (acaddr->ace$b_type == ACE$C_KEYID) {
i = -1;
/* figure out how many id's are in this ace */
j = acaddr->ace$b_size - (4 * acaddr->ace$v_reserved);
/* position to first id */
idaddr = (char *)acaddr + 8 + (4 * acaddr->ace$v_reserved);
while ((search->si_l_acl_id_list[++i] != 0) && !acl_found)
for (k=0;k<j;k++) {
if (*idaddr == search->si_l_acl_id_list[i])
acl_found = 1;
++idaddr; /* increment to point to next longword */
};
};
/* move forward to next ace */
acaddr = (char *)acaddr + acaddr->ace$b_size;
};
exthdr = get_header(exthdr->fh2$w_ext_fid,exthdr->fh2$w_fid,
context,cached,chan);
};
if (acl_found && ! and_match)
return(1);
if (and_match && ! acl_found)
return(0);
};
if (search->si_v_prot) {
if (((search->si_w_protset & ~fh2->fh2$w_fileprot)
== search->si_w_protset)
&& ((search->si_w_protclr & fh2->fh2$w_fileprot)
== search->si_w_protclr))
{
if (! and_match)
return(1);
}
else
if (and_match)
return(0);
};
if (search->si_v_fileorg) {
if ((search->si_b_fileorgset & (1<<fh2->fat.fat$v_fileorg))
&& !(search->si_b_fileorgclr & (1<<fh2->fat.fat$v_fileorg)))
{
if (! and_match)
return(1);
}
else
if (and_match)
return(0);
};
if (search->si_v_rectype) {
if ((search->si_b_rectypeset & (1<<fh2->fat.fat$v_rtype))
&& !(search->si_b_rectypeclr & (1<<fh2->fat.fat$v_rtype)))
{
if (! and_match)
return(1);
}
else
if (and_match)
return(0);
};
if (search->si_v_access) {
if ((search->si_b_access_set & (1<<fh2->fh2$b_acc_mode))
&& !(search->si_b_access_clr & (1<<fh2->fh2$b_acc_mode)))
{
if (! and_match)
return(1);
}
else
if (and_match)
return(0);
};
if (search->si_v_char) {
if (((search->si_l_charset & fh2->fh2$l_filechar) == search->si_l_charset)
&& ((search->si_l_charclr & fh2->fh2$l_filechar) == search->si_l_charclr))
{
if (! and_match)
return(1);
}
else
if (and_match)
return(0);
};
if (search->si_v_attrib) {
if ((search->si_b_attrib_set & fh2->fat.fat$b_rattrib)
&& !(search->si_b_attrib_clr & fh2->fat.fat$b_rattrib))
{
if (! and_match)
return(1);
}
else
if (and_match)
return(0);
};
if (search->si_v_journal) {
if ((search->si_b_journalset & fh2->fh2$b_journal)
&& !(search->si_b_journalclr & fh2->fh2$b_journal))
{
if (! and_match)
return(1);
}
else
if (and_match)
return(0);
};
if (and_match)
return(1);
else
return(0);
}
int cmp_time(a,b)
struct {unsigned long int low;long int high;} *a,*b;
{
if ((a->high == 0) && (a->low == 0)) return(0);
if (a->high > b->high) return(1);
if (a->high < b->high) return(-1);
if (a->low > b->low) return(1);
if (a->low < b->low) return(-1);
return(0);
}
int present(s)
struct dsc$descriptor *s;
{
int status;
status = cli$present(s);
if (status & 1) return(1);
if (status == CLI$_NEGATED) return(-1);
return(0);
}
$coma