summaryrefslogtreecommitdiff
path: root/libstd/cstrconv.myr
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2014-12-29 23:12:58 -0800
committerOri Bernstein <ori@eigenstate.org>2014-12-29 23:16:52 -0800
commit02f19e5b2e6a94199d6eb9a97417e1feb3b2d0aa (patch)
treea7b0da1cc7bbf83f6fb43354a06858f7ae0e8988 /libstd/cstrconv.myr
parent1e4082af4e87a13f5babd52d0df55b7fdc8372c6 (diff)
downloadmc-02f19e5b2e6a94199d6eb9a97417e1feb3b2d0aa.tar.gz
Add a C string conversion utility, and use it for sysinfo
Diffstat (limited to 'libstd/cstrconv.myr')
-rw-r--r--libstd/cstrconv.myr12
1 files changed, 12 insertions, 0 deletions
diff --git a/libstd/cstrconv.myr b/libstd/cstrconv.myr
new file mode 100644
index 0000000..1d288f3
--- /dev/null
+++ b/libstd/cstrconv.myr
@@ -0,0 +1,12 @@
+pkg std =
+ const cstrconv : (buf : byte[:] -> byte[:])
+;;
+
+const cstrconv = {buf
+ for i = 0; i < buf.len; i++
+ if buf[i] == 0
+ break
+ ;;
+ ;;
+ -> buf[:i]
+}