ref: b92973e28b8affb30ef3dfe2acf2cc47f95a3e95
parent: e30957d632fbeaf0056233e2d084678cfd39f568
parent: e7afb8cbbda5e7e375a9fec5f61460cec1052c1a
author: Ori Bernstein <[email protected]>
date: Fri Sep 13 10:25:21 EDT 2013
Merge git+ssh://eigenstate.org/home/ori/mc
--- a/libstd/sys-osx.myr
+++ b/libstd/sys-osx.myr
@@ -521,6 +521,16 @@
/* system information */
const uname = {buf;
+ buf.system[0] = 'D' castto(byte)
+ buf.system[1] = 'a' castto(byte)
+ buf.system[2] = 'r' castto(byte)
+ buf.system[3] = 'w' castto(byte)
+ buf.system[4] = 'i' castto(byte)
+ buf.system[5] = 'n' castto(byte)
+ buf.system[6] = 0
+ -> 0
+ /*
+ FIXME: THIS IS BROKEN. Miscompiled? DEBUG IT.
var mib : int[2]
var ret
var sys
@@ -536,6 +546,7 @@
if sysctl(mib[:], &sys, [][:]) < 0
ret = -1
;;
+ std.put("%s\n", sys)
mib[0] = 1 /* CTL_KERN */
mib[1] = 10 /* KERN_HOSTNAME */
@@ -566,6 +577,7 @@
;;
-> ret
+ */
}
const sysctl = {mib, old, new
--- a/libstd/test.myr
+++ b/libstd/test.myr
@@ -1,5 +1,15 @@
use std
+const ntstr = {s
+ var n
+
+ n = 0
+ while s[n] != 0 && n < s.len
+ n++
+ ;;
+ -> s[:n]
+}
+
const main = {args : byte[:][:]
var x : byte#[1024]
var sz
@@ -7,8 +17,15 @@
var ctx
var o
var a
+ var buf
std.put("The time is %l seconds past the epoch\n", std.now()/1000);
+ std.uname(&buf)
+ std.put("And you are running on:\n")
+ std.put("\tsystem:\t\"%s\"\n", ntstr(buf.system[:]))
+ std.put("\tnode:\t\"%s\"\n", ntstr(buf.node[:]))
+ std.put("\trelease:\t\"%s\"\n", ntstr(buf.release[:]))
+ std.put("\tmachine:\t\"%s\"\n", ntstr(buf.machine[:]))
ctx = std.optinit("asdf:g?h", args)
std.put("arglen = %i\n", ctx.args.len)
while !std.optdone(ctx)