diff options
author | Freya Murphy <freya@freyacat.org> | 2023-12-14 19:38:55 -0500 |
---|---|---|
committer | Freya Murphy <freya@freyacat.org> | 2023-12-14 19:38:55 -0500 |
commit | 3d10d02620a0e587d765f6042ab05f530b201c39 (patch) | |
tree | b28191352881a99286adfd798080b4325e259b55 /src/main.c | |
parent | testing (diff) | |
download | nbtvis-3d10d02620a0e587d765f6042ab05f530b201c39.tar.gz nbtvis-3d10d02620a0e587d765f6042ab05f530b201c39.tar.bz2 nbtvis-3d10d02620a0e587d765f6042ab05f530b201c39.zip |
initial stable
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -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); } |