From 3d10d02620a0e587d765f6042ab05f530b201c39 Mon Sep 17 00:00:00 2001 From: Freya Murphy Date: Thu, 14 Dec 2023 19:38:55 -0500 Subject: initial stable --- src/main.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/main.c') 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 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); } -- cgit v1.2.3-freya