getindex.c (681B)
1 #include <errno.h> 2 #include <stdio.h> 3 4 #include <scc/mach.h> 5 6 #include "libmach.h" 7 8 #include "elf/fun.h" 9 #include "coff32/fun.h" 10 11 static int (*ops[NFORMATS])(int, long *, char ***, long **, FILE *); 12 13 static int 14 getidx(int type, long *nsyms, char ***namep, long **offsp, FILE *fp) 15 { 16 return getidx32(BIG_ENDIAN, nsyms, namep, offsp, fp); 17 } 18 19 int 20 getindex(int type, long *nsyms, char ***names, long **offs, FILE *fp) 21 { 22 int fmt; 23 24 fmt = FORMAT(type); 25 if (fmt >= NFORMATS) { 26 errno = ERANGE; 27 return -1; 28 } 29 30 return (*ops[fmt])(type, nsyms, names, offs, fp); 31 } 32 33 static int (*ops[NFORMATS])(int, long *, char ***, long **, FILE *) = { 34 [COFF32] = getidx, 35 [ELF] = getidx, 36 }; 37