summaryrefslogtreecommitdiff
path: root/src/main.c
blob: fec6d063889783bdbcbbf72cb41cea7a92d0b7cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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;
	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\n");

	tag_print(&tag);

	stream_close(&stream);
}