diff options
| author | forsyth <forsyth@vitanuova.com> | 2013-05-29 11:09:40 +0100 |
|---|---|---|
| committer | forsyth <forsyth@vitanuova.com> | 2013-05-29 11:09:40 +0100 |
| commit | cd8e99851af33e52bcdf8faf34f9d4e62fa0cbaf (patch) | |
| tree | d191e8c57dc2881be1d76c5fb3b644a92ba0831a | |
| parent | 21f20d98efdc821b62e968612a30928d97079519 (diff) | |
20130529-1109
| -rw-r--r-- | CHANGES | 2 | ||||
| -rw-r--r-- | appl/cmd/cpu.b | 37 | ||||
| -rw-r--r-- | dis/cpu.dis | bin | 2856 -> 2588 bytes | |||
| -rw-r--r-- | include/version.h | 2 |
4 files changed, 13 insertions, 28 deletions
@@ -1,3 +1,5 @@ +20130529 + appl/cmd/cpu.b: use Dial, and neither test /dev/draw/new nor bind #d (which is wrong anyway, it's #i for drawing now) 20130423 mkfiles/mkfile-MacOSX-386: set 32-bit mode, and macosx-version-min to 10.6 [via http://debu.gs/entries/interlude-inferno-at-work] 20121210 diff --git a/appl/cmd/cpu.b b/appl/cmd/cpu.b index 75728e57..ed538c75 100644 --- a/appl/cmd/cpu.b +++ b/appl/cmd/cpu.b @@ -4,18 +4,18 @@ include "sys.m"; sys: Sys; stderr: ref Sys->FD; include "draw.m"; - Context: import Draw; include "string.m"; str: String; include "arg.m"; include "keyring.m"; include "security.m"; +include "dial.m"; DEFCMD: con "/dis/sh"; CPU: module { - init: fn(ctxt: ref Context, argv: list of string); + init: fn(ctxt: ref Draw->Context, argv: list of string); }; badmodule(p: string) @@ -33,7 +33,7 @@ usage() # The default level of security is NOSSL, unless # the keyring directory doesn't exist, in which case # it's disallowed. -init(nil: ref Context, argv: list of string) +init(nil: ref Draw->Context, argv: list of string) { sys = load Sys Sys->PATH; stderr = sys->fildes(2); @@ -50,6 +50,8 @@ init(nil: ref Context, argv: list of string) kr := load Keyring Keyring->PATH; if (kr == nil) badmodule(Keyring->PATH); + dial := load Dial Dial->PATH; + arg->init(argv); alg := ""; while ((opt := arg->opt()) != 0) { @@ -79,7 +81,7 @@ init(nil: ref Context, argv: list of string) user := getuser(); kd := "/usr/" + user + "/keyring/"; - cert := kd + netmkaddr(mach, "tcp", ""); + cert := kd + dial->netmkaddr(mach, "tcp", ""); if (!exists(cert)) { cert = kd + "default"; if (!exists(cert)) { @@ -88,14 +90,10 @@ init(nil: ref Context, argv: list of string) } } - # To make visible remotely - if(!exists("/dev/draw/new")) - sys->bind("#d", "/dev", Sys->MBEFORE); - - (ok, c) := sys->dial(netmkaddr(mach, "net", "rstyx"), nil); - if(ok < 0){ - sys->fprint(stderr, "Error: cpu: dial: %r\n"); - return; + c := dial->dial(dial->netmkaddr(mach, "net", "rstyx"), nil); + if(c == nil){ + sys->fprint(stderr, "cpu: can't dial %s: %r\n", mach); + raise "fail:dial"; } ai := kr->readauthinfo(cert); @@ -151,18 +149,3 @@ getuser(): string return string buf[0:n]; } - -netmkaddr(addr, net, svc: string): string -{ - if(net == nil) - net = "net"; - (n, nil) := sys->tokenize(addr, "!"); - if(n <= 1){ - if(svc== nil) - return sys->sprint("%s!%s", net, addr); - return sys->sprint("%s!%s!%s", net, addr, svc); - } - if(svc == nil || n > 2) - return addr; - return sys->sprint("%s!%s", addr, svc); -} diff --git a/dis/cpu.dis b/dis/cpu.dis Binary files differindex edec37ab..abfc21f3 100644 --- a/dis/cpu.dis +++ b/dis/cpu.dis diff --git a/include/version.h b/include/version.h index 1726f48f..891c383b 100644 --- a/include/version.h +++ b/include/version.h @@ -1 +1 @@ -#define VERSION "Fourth Edition (20130423)" +#define VERSION "Fourth Edition (20130529)" |
