aboutsummaryrefslogtreecommitdiff
path: root/test/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/main.c')
-rw-r--r--test/main.c35
1 files changed, 35 insertions, 0 deletions
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 <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(0);
+}