summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles.Forsyth <devnull@localhost>2007-06-08 11:35:27 +0000
committerCharles.Forsyth <devnull@localhost>2007-06-08 11:35:27 +0000
commit9f620229775d41f76096d9039c46ff368fd44d47 (patch)
tree7ef2d6be0ef54b41724916cc89d80951e0815ba0
parent1f44c82a26ff60e012a2ff697cb036a25c0c7f97 (diff)
20070608-1234
-rw-r--r--CHANGES1
-rw-r--r--appl/cmd/mc.b29
-rw-r--r--dis/mc.disbin2458 -> 2414 bytes
3 files changed, 20 insertions, 10 deletions
diff --git a/CHANGES b/CHANGES
index 0695a858..682edfa5 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,6 @@
20070608
update /lib9 functions to use silly va_copy (and then va_end) instead of just assigning, to account for silly C implementations
+ change /appl/cmd/mc.b not to require Draw or Env (so lc works on smaller systems)
20070607
/appl/wm/man.b /appl/lib/man.b to allow 10.1 etc as section references
20070605
diff --git a/appl/cmd/mc.b b/appl/cmd/mc.b
index 631c4cc1..5d8f216e 100644
--- a/appl/cmd/mc.b
+++ b/appl/cmd/mc.b
@@ -10,8 +10,6 @@ include "draw.m";
include "bufio.m";
bufio: Bufio;
Iobuf: import bufio;
-include "env.m";
- env: Env;
include "arg.m";
font: ref Font;
@@ -28,10 +26,7 @@ init(ctxt: ref Draw->Context, argv: list of string)
sys = load Sys Sys->PATH;
if((bufio = load Bufio Bufio->PATH) == nil)
fatal("can't load " + Bufio->PATH);
- if((env = load Env Env->PATH) == nil)
- fatal("can't load " + Env->PATH);
- if((draw = load Draw Draw->PATH) == nil)
- fatal("can't load " + Draw->PATH);
+ draw = load Draw Draw->PATH;
if((arg := load Arg Arg->PATH) == nil)
fatal("can't load " + Arg->PATH);
@@ -120,18 +115,20 @@ nexttab(col: int): int
getwidth(ctxt: ref Draw->Context)
{
- if((wid:=env->getenv("acmewin")) == nil)
+ if(ctxt == nil || draw == nil)
return;
- if((fd:=open("/chan/" + wid + "/ctl", ORDWR)) == nil)
+ if((wid := rf("/env/acmewin")) == nil)
+ return;
+ if((fd := open("/chan/" + wid + "/ctl", ORDWR)) == nil)
return;
buf := array[256] of byte;
- if((n:=read(fd, buf, len buf)) <= 0)
+ if((n := read(fd, buf, len buf)) <= 0)
return;
(nf, f) := tokenize(string buf[:n], " ");
if(nf != 8)
return;
f0 := tl tl tl tl tl f;
- if((font=Font.open(ctxt.display, hd tl f0)) == nil)
+ if((font = Font.open(ctxt.display, hd tl f0)) == nil)
return;
tabwid = int hd tl tl f0;
mintab = font.width("0");
@@ -143,3 +140,15 @@ fatal(s: string)
fprint(fildes(2), "mc: %s: %r\n", s);
raise "fail:"+s;
}
+
+rf(f: string): string
+{
+ fd := sys->open(f, Sys->OREAD);
+ if(fd == nil)
+ return nil;
+ b := array[Sys->NAMEMAX] of byte;
+ n := sys->read(fd, b, len b);
+ if(n < 0)
+ return nil;
+ return string b[0:n];
+}
diff --git a/dis/mc.dis b/dis/mc.dis
index 37b567d2..9b8e6af1 100644
--- a/dis/mc.dis
+++ b/dis/mc.dis
Binary files differ