shithub: libobj

ref: b4d8077f0ce99505f7b65a67fc92aa20dc96ed78
dir: /test/main.c/

View raw version
#include <u.h>
#include <libc.h>
#include "../obj.h"

static char fd0[] = "/fd/0";

void
usage(void)
{
	fprint(2, "usage: %s [file]\n", argv0);
	exits("usage");
}

void
main(int argc, char *argv[])
{
	OBJ *obj;
	char *f;

	f = fd0;
	OBJfmtinstall();
	ARGBEGIN{
	default: usage();
	}ARGEND;
	if(argc > 1)
		usage();
	if(argc == 1)
		f = argv[0];

	obj = objparse(f);
	if(obj == nil)
		sysfatal("objparse: %r");

	print("%O\n", obj);
	objfree(obj);
	exits(nil);
}