summaryrefslogtreecommitdiff
path: root/examples/sys.c
diff options
context:
space:
mode:
authorpryazha <pryadeiniv@mail.ru>2025-10-12 15:24:30 +0500
committerpryazha <pryadeiniv@mail.ru>2025-10-12 15:24:30 +0500
commit223b1056273f5d48d1c0bbfee75be7b82374d4eb (patch)
tree2b2003aad9c26af7006c5a5c7e2baf1a63ad89e7 /examples/sys.c
parent7e73843ac5873833c707687cd0ada0a3034e600c (diff)
change identation, maybe will change back, add own gl functions loading, and glx example
Diffstat (limited to 'examples/sys.c')
-rw-r--r--examples/sys.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/examples/sys.c b/examples/sys.c
new file mode 100644
index 0000000..881d2be
--- /dev/null
+++ b/examples/sys.c
@@ -0,0 +1,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;
+}