ref: 4ec2650a824871f32c1b2d0f7846ee41f62fc711
parent: 35de3ed9972eb79e61a2516627f3797ad35317d1
author: Ori Bernstein <ori@eigenstate.org>
date: Mon Dec 29 18:41:00 EST 2014
Use "getsysinfo()" instead of uname()
--- a/opts.myr
+++ b/opts.myr
@@ -1,5 +1,4 @@
use std
-use sys
use "config.use"
@@ -53,12 +52,10 @@
var sysstr = ""
const initopts = {
- var un
+ var si
- if sys.uname(&un) < 0
- std.fatal(1, "unable to determine host information (uname)\n")
- ;;
- match cstr2myr(un.system[:])
+ std.getsysinfo(&si)
+ match si.system
| "Linux": opt_sys = "linux"
| "Darwin": opt_sys = "osx"
| "FreeBSD": opt_sys = "freebsd"
@@ -65,8 +62,9 @@
| unknown: std.fatal(1, "unknown system \"%s\"\n", unknown)
;;
- match cstr2myr(un.machine[:])
+ match si.arch
| "x86_64": opt_arch = "x64"
+ | "amd64": opt_arch = "x64"
| unknown: std.fatal(1, "unknown architecture \"%s\"\n", unknown)
;;
@@ -86,13 +84,3 @@
opt_runtime = std.pathcat(config.Instroot, "/lib/myr/_myrrt.o")
}
-const cstr2myr = {cstr
- var i
-
- for i = 0; i < cstr.len; i++
- if cstr[i] == 0
- break
- ;;
- ;;
- -> cstr[:i]
-}
--- a/util.myr
+++ b/util.myr
@@ -21,7 +21,7 @@
std.fatal(1, "could not fork command\n")
elif pid == 0
if dir.len > 0
- if std.chdir(dir) < 0
+ if std.chdir(dir)
std.fatal(1, "unable to enter directory %s\n", dir)
;;
;;