summaryrefslogtreecommitdiff
path: root/libobj/test/main.c
diff options
context:
space:
mode:
authorrgl <devnull@localhost>2020-02-03 22:42:28 +0100
committerrgl <devnull@localhost>2020-02-03 22:42:28 +0100
commit0373255087377122eeb10e006ffb8aa1b57e611c (patch)
tree33a4fafa4996fc2efa205b2973622c3fbd27f368 /libobj/test/main.c
download3dee-0373255087377122eeb10e006ffb8aa1b57e611c.tar.gz
3dee-0373255087377122eeb10e006ffb8aa1b57e611c.tar.bz2
3dee-0373255087377122eeb10e006ffb8aa1b57e611c.zip
after a year or so of work, i dare create a proper repo.
Diffstat (limited to 'libobj/test/main.c')
-rw-r--r--libobj/test/main.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/libobj/test/main.c b/libobj/test/main.c
new file mode 100644
index 0000000..1a60b42
--- /dev/null
+++ b/libobj/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);
+}