4 * (C) Copyright 1989-1995
11 * With contributions for the
12 * object libraries from
14 * kenh@cmf.nrl.navy.mil
19 * Extensions: P. Felber
33 long pos = ftell (libfp);
37 if (((c = getc (libfp)) == 'X' || c == 'D' || c == 'Q') && ((c = getc (libfp)) == 'H' || c == 'L'))
42 if (getc (libfp) == '\n')
54 if (fread (buf, 1, sizeof (buf), libfp) == sizeof (buf) && memcmp (buf, "!FILE ", 6) == 0)
57 fseek (libfp, pos, SEEK_SET);
61 /* Load a standalone or embedded .rel */
63 load_rel (FILE * libfp, long size)
70 end = (size >= 0) ? ftell (libfp) + size : -1;
72 while ((end < 0 || ftell (libfp) < end) && getline (str, sizeof (str), libfp) != NULL)
74 if (0 == strcmp (str, "</REL>"))
88 enum_symbols (FILE * fp, long size, int (*func) (const char *symvoid, void *param), void *param)
91 long end = (size >= 0) ? ftell (fp) + size : -1;
93 assert (func != NULL);
96 * Read in the object file. Look for lines that
97 * begin with "S" and end with "D". These are
98 * symbol table definitions. If we find one, see
99 * if it is our symbol. Make sure we only read in
100 * our object file and don't go into the next one.
103 while ((end <= 0 || ftell (fp) < end) && getline (buf, sizeof (buf), fp) != NULL)
105 char symname[NINPUT];
109 * When a 'T line' is found terminate file scan.
110 * All 'S line's preceed 'T line's in .REL files.
116 * Skip everything that's not a symbol record.
121 sscanf (buf, "S %s %c", symname, &c);
123 /* If it's an actual symbol, record it */
126 if ((*func) (symname, param))