summaryrefslogtreecommitdiff
path: root/example/sys.c
blob: 881d2beadc427d43967db1543f3deb99908073b0 (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
25
26
27
28
29
30
#include "prb.h"
#include <libgen.h>
#include <stdio.h>

i32 main(int c, char **v)
{
	info("os:");
	switch (os) {
	case os_linux:
		info("linux");
		break;
	case os_windows:
		info("windows");
		break;
	default:
		info("unsupported");
		return 1;
	}
	char *dir = dirname(*v);
	info("bin directory \"%s\"", dir);
	const char *filename = "build.sh";
	char path[1024] = {0};
	snprintf(path, 1024, "%s/%s", dir, filename);
	struct arena arena = alloc_arena(megabytes(32));
	char *content = 0;
	if (!(content = read_entire_file(&arena, 0, path)))
		die("failed to read %s", path);
	info("%s content:\n%s", path, content);
	return 0;
}