9 char *rdl_errors
[3] = {
10 "no error","could not open file", "invalid file structure",
13 int rdl_searchlib (struct librarynode
* lib
,
14 const char * label
, rdffile
* f
)
26 lib
->fp
= fopen(lib
->name
,"rb");
36 while (! feof(lib
->fp
) )
39 while (fread(buf
+ i
,1,1,lib
->fp
) == 1 && buf
[i
] && i
< 257)
43 if (feof(lib
->fp
)) break;
45 if ( rdfopenhere(f
,lib
->fp
,&lib
->referenced
,buf
) ) {
50 hdr
= malloc(f
->header_len
);
51 rdfloadseg(f
,RDOFF_HEADER
,hdr
);
53 while ((r
= rdfgetheaderrec(f
)))
55 if (r
->type
!= 3) /* not an export */
58 if (! strcmp(r
->e
.label
, label
) ) /* match! */
60 free(hdr
); /* reset to 'just open' */
61 f
->header_loc
= NULL
; /* state... */
67 /* find start of next module... */
68 i
= f
->data_ofs
+ f
->data_len
;
70 fseek(lib
->fp
,i
,SEEK_SET
);
74 if (! lib
->referenced
)
82 void rdl_perror(const char *apname
, const char *filename
)
84 fprintf(stderr
,"%s:%s:%s\n",apname
,filename
,rdl_errors
[rdl_error
]);