summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2023-12-14 19:38:55 -0500
committerFreya Murphy <freya@freyacat.org>2023-12-14 19:38:55 -0500
commit3d10d02620a0e587d765f6042ab05f530b201c39 (patch)
treeb28191352881a99286adfd798080b4325e259b55 /src/main.c
parenttesting (diff)
downloadnbtvis-3d10d02620a0e587d765f6042ab05f530b201c39.tar.gz
nbtvis-3d10d02620a0e587d765f6042ab05f530b201c39.tar.bz2
nbtvis-3d10d02620a0e587d765f6042ab05f530b201c39.zip
initial stable
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c
index 077085c..fec6d06 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,15 +1,24 @@
#include "tag.h"
#include "lib.h"
+#include <stdio.h>
int main (int argc, char** argv) {
+ if (argc != 2) {
+ printf("usage: nbtvis file.nbt\n");
+ return 0;
+ }
+
stream_t stream = stream_open(argv[1], "rb");
tag_t tag;
- tag_read(&tag, &stream, true);
+ if (tag_read(&tag, &stream, true) == false)
+ error_and_die("failed to read tag\n");
if (tag.type != TAG_COMPOUND)
- error_and_die("root tag is not of type compound");
+ error_and_die("root tag is not of type compound\n");
+
+ tag_print(&tag);
stream_close(&stream);
}