summaryrefslogtreecommitdiff
path: root/source/base/base_io.h
diff options
context:
space:
mode:
authornasr <nsrddyn@gmail.com>2026-03-14 21:40:32 +0000
committernasr <nsrddyn@gmail.com>2026-03-14 21:40:32 +0000
commit53cd9c4c3408b5f2e54e891baf471c0d774ea2cd (patch)
tree7fcdfdd25b7e163b40fe3d2961a605b3a2720ba4 /source/base/base_io.h
parente51d57e2da70ea2688a72602aeb5f7c4040e72b7 (diff)
feature(base): ascii colors, error framework ( ai help ). testing idea meta program. refactor
Diffstat (limited to 'source/base/base_io.h')
-rw-r--r--source/base/base_io.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/source/base/base_io.h b/source/base/base_io.h
index a90b41e..ac55737 100644
--- a/source/base/base_io.h
+++ b/source/base/base_io.h
@@ -32,4 +32,29 @@ print(const char *str)
32 32
33} 33}
34 34
35internal void
36write_int(s32 num)
37{
38
39 if (num < 0)
40 {
41 write(STDERR_FILENO, "-", 1);
42 num = -num;
43 }
44 if (num >= 10)
45 write_int(num / 10);
46 char digit = '0' + (num % 10);
47
48 write(STDERR_FILENO, &digit, 1);
49}
50
51internal void
52write_string(s32 fd, const char *str)
53{
54 s32 len = 0;
55 while (str[len]) len++;
56 os_write(fd, str, len);
57}
58
59
35#endif /* BASE_IO_H */ 60#endif /* BASE_IO_H */