From d7bb559d490e6a5ece5dd9256a6f7c11f550b13d Mon Sep 17 00:00:00 2001 From: rodri Date: Sun, 12 Apr 2020 23:53:26 +0000 Subject: standalone version release. --- test/main.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 test/main.c (limited to 'test/main.c') diff --git a/test/main.c b/test/main.c new file mode 100644 index 0000000..1a60b42 --- /dev/null +++ b/test/main.c @@ -0,0 +1,35 @@ +#include +#include +#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(0); +} -- cgit v1.2.3