aboutsummaryrefslogtreecommitdiff
path: root/test/main.c
blob: 48610da4dd65b50759953c03c735fb17e69da80a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#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);
}