shithub: scc

ref: 718fad000a4821aeab5d6050e8a93298a1a67e77
dir: /src/libmach/objread.c/

View raw version
#include <stdio.h>

#include <scc/mach.h>

#include "libmach.h"

static int (*funv[])(Obj *, FILE *) = {
	[COFF32] = coff32read,
};

int
objread(Obj *obj, FILE *fp)
{
	int fmt;

	fmt = FORMAT(obj->type);
	if (fmt >= NFORMATS)
		return -1;

	if ((*funv[fmt])(obj, fp) < 0)
		return -1;
	obj->fp = fp;

	return 0;
}