summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MacOSX/power/include/lib9.h2
-rw-r--r--README.md4
-rw-r--r--appl/charon/mkfile2
-rw-r--r--appl/cmd/gunzip.b2
-rw-r--r--appl/cmd/mkfile1
-rw-r--r--appl/cmd/uniq.b15
-rw-r--r--appl/cmd/whois.b89
-rw-r--r--appl/svc/httpd/httpd.b4
-rw-r--r--appl/svc/httpd/httpd.suff3
-rw-r--r--appl/wm/memory.b6
-rw-r--r--appl/wm/view.b33
-rw-r--r--emu/port/win-x11a.c4
-rw-r--r--lib/units1
-rw-r--r--libdraw/font.c2
-rw-r--r--man/1/uniq5
-rw-r--r--man/1/whois40
-rw-r--r--services/httpd/httpd.suff3
17 files changed, 198 insertions, 18 deletions
diff --git a/MacOSX/power/include/lib9.h b/MacOSX/power/include/lib9.h
index 88ee728f..5d632dfb 100644
--- a/MacOSX/power/include/lib9.h
+++ b/MacOSX/power/include/lib9.h
@@ -533,5 +533,5 @@ extern char *argv0;
extern void setfcr(ulong);
extern void setfsr(ulong);
-extern ulong getfcr(void):
+extern ulong getfcr(void);
extern ulong getfsr(void);
diff --git a/README.md b/README.md
index cf597ccd..72ab2f82 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
Inferno® is a distributed operating system, originally developed at Bell Labs, but now developed and maintained by Vita Nuova® as Free Software. Applications written in Inferno's concurrent programming language, Limbo, are compiled to its portable virtual machine code (Dis), to run anywhere on a network in the portable environment that Inferno provides. Unusually, that environment looks and acts like a complete operating system.
-Inferno represents services and resources in a file-like name hierarchy. Programs access them using only the file operations open, read/write, and close. `Files' are not just stored data, but represent devices, network and protocol interfaces, dynamic data sources, and services. The approach unifies and provides basic naming, structuring, and access control mechanisms for all system resources. A single file-service protocol (the same as Plan 9's 9P) makes all those resources available for import or export throughout the network in a uniform way, independent of location. An application simply attaches the resources it needs to its own per-process name hierarchy ('name space').
+Inferno represents services and resources in a file-like name hierarchy. Programs access them using only the file operations open, read/write, and close. `Files' are not just stored data, but represent devices, network and protocol interfaces, dynamic data sources, and services. The approach unifies and provides basic naming, structuring, and access control mechanisms for all system resources. A single file-service protocol (the same as Plan 9's 9P) makes all those resources available for import or export throughout the network in a uniform way, independent of location. An application simply attaches the resources it needs to its own per-process name hierarchy ('name space').
Inferno can run 'native' on various ARM, PowerPC, SPARC and x86 platforms but also 'hosted', under an existing operating system (including AIX, FreeBSD, IRIX, Linux, MacOS X, Plan 9, and Solaris), again on various processor types.
-This Bitbucket project includes source for the basic applications, Inferno itself (hosted and native), all supporting software, including the native compiler suite, essential executables and supporting files.
+This repository includes source code for the basic applications, Inferno itself (hosted and native), all supporting software, including the native compiler suite, essential executables and supporting files.
diff --git a/appl/charon/mkfile b/appl/charon/mkfile
index 6345f815..05ac5cb6 100644
--- a/appl/charon/mkfile
+++ b/appl/charon/mkfile
@@ -86,7 +86,7 @@ $ROOT/dis/charon.dis: charon.dis
charon.dis: $MODULES $SYS_MODULES
img.dis: img.b $MODULE $SYS_MODULE
- limbo $LIMBOFLAGS -c -gw img.b
+ limbo $LIMBOFLAGS -gw img.b
nuke:V:
rm -f $ROOT/dis/charon.dis
diff --git a/appl/cmd/gunzip.b b/appl/cmd/gunzip.b
index 6cb9eaf8..06ccd4a5 100644
--- a/appl/cmd/gunzip.b
+++ b/appl/cmd/gunzip.b
@@ -34,7 +34,7 @@ init(nil: ref Draw->Context, argv: list of string)
if (bufio == nil)
fatal(sys->sprint("cannot load %s: %r", Bufio->PATH));
str = load String String->PATH;
- if (bufio == nil)
+ if (str == nil)
fatal(sys->sprint("cannot load %s: %r", String->PATH));
inflate = load Filter INFLATEPATH;
if (inflate == nil)
diff --git a/appl/cmd/mkfile b/appl/cmd/mkfile
index a158edaa..a3cc6c09 100644
--- a/appl/cmd/mkfile
+++ b/appl/cmd/mkfile
@@ -170,6 +170,7 @@ TARG=\
wav2iaf.dis\
wc.dis\
webgrab.dis\
+ whois.dis\
wish.dis\
wmexport.dis\
wmimport.dis\
diff --git a/appl/cmd/uniq.b b/appl/cmd/uniq.b
index 4442c22f..9846e69f 100644
--- a/appl/cmd/uniq.b
+++ b/appl/cmd/uniq.b
@@ -13,7 +13,7 @@ Uniq: module
usage()
{
- fail("usage", sys->sprint("usage: uniq [-ud] [file]"));
+ fail("usage", sys->sprint("usage: uniq [-udc] [file]"));
}
init(nil : ref Draw->Context, args : list of string)
@@ -31,6 +31,7 @@ init(nil : ref Draw->Context, args : list of string)
uflag := 0;
dflag := 0;
+ cflag := 0;
arg->init(args);
while ((opt := arg->opt()) != 0) {
case opt {
@@ -38,6 +39,8 @@ init(nil : ref Draw->Context, args : list of string)
uflag = 1;
'd' =>
dflag = 1;
+ 'c' =>
+ cflag = 1;
* =>
usage();
}
@@ -61,14 +64,20 @@ init(nil : ref Draw->Context, args : list of string)
if (s == prev)
n++;
else {
- if ((uflag && n == 1) || (dflag && n > 1))
+ if ((uflag && n == 1) || (dflag && n > 1)) {
+ if(cflag)
+ prev = string n + "\t" + prev;
stdout.puts(prev);
+ }
n = 1;
prev = s;
}
}
- if ((uflag && n == 1) || (dflag && n > 1))
+ if ((uflag && n == 1) || (dflag && n > 1)) {
+ if(cflag)
+ prev = string n + "\t" + prev;
stdout.puts(prev);
+ }
stdout.close();
}
diff --git a/appl/cmd/whois.b b/appl/cmd/whois.b
new file mode 100644
index 00000000..f89fb601
--- /dev/null
+++ b/appl/cmd/whois.b
@@ -0,0 +1,89 @@
+implement Whois;
+
+include "sys.m"; sys: Sys;
+include "draw.m";
+include "dial.m"; dial: Dial;
+include "arg.m";
+
+Whois: module {
+ init: fn(nil: ref Draw->Context, args: list of string);
+};
+
+init(nil: ref Draw->Context, args: list of string) {
+ sys = load Sys Sys->PATH;
+ dial = load Dial Dial->PATH;
+ arg := load Arg Arg->PATH;
+
+ addr := "tcp!whois.iana.org!43";
+ expect_refer := 5;
+
+ arg->init(args);
+ arg->setusage("whois [-a addr] [-n] host");
+ while((opt := arg->opt()) != 0) {
+ case opt {
+ 'a' =>
+ addr = dial->netmkaddr(arg->earg(), "tcp", "43");
+ 'n' =>
+ expect_refer = 0;
+ * =>
+ arg->usage();
+ }
+ }
+
+ args = arg->argv();
+ if(len args != 1)
+ arg->usage();
+
+ host := hd args;
+ fd := whois(addr, host);
+
+ buf := array[512] of byte;
+ stdout := sys->fildes(1);
+ while((i := sys->read(fd, buf, len buf)) > 0) {
+ if(expect_refer) {
+ ls := sys->tokenize(string buf[0:i], "\n").t1;
+ newaddr: string = nil;
+ while(ls != nil) {
+ l := hd ls;
+ (n, rs) := sys->tokenize(l, " \t");
+ if(n == 2 && hd rs == "refer:") {
+ newaddr = dial->netmkaddr(hd tl rs, "tcp", "43");
+ break;
+ } else if(n == 3 && hd rs == "Whois" && hd tl rs == "Server:") {
+ newaddr = dial->netmkaddr(hd tl tl rs, "tcp", "43");
+ break;
+ }
+ ls = tl ls;
+ }
+ if(newaddr != nil) {
+ fd = whois(newaddr, host);
+ expect_refer--;
+ continue;
+ }
+ }
+ sys->write(stdout, buf, i);
+ }
+ if(i < 0) {
+ sys->fprint(sys->fildes(2), "whois: reading info: %r\n");
+ raise "fail:errors";
+ }
+}
+
+whois(addr: string, host: string): ref Sys->FD
+{
+ sys->print("[using server %s]\n", addr);
+ conn := dial->dial(addr, nil);
+ if(conn == nil) {
+ sys->fprint(sys->fildes(2), "whois: dialing %s: %r\n", addr);
+ raise "fail:errors";
+ }
+
+ fd := conn.dfd;
+ i := sys->fprint(fd, "%s\r\n", host);
+ if(i != len host + 2) {
+ sys->fprint(sys->fildes(2), "whois: sending name: %r\n");
+ raise "fail:errors";
+ }
+
+ return fd;
+}
diff --git a/appl/svc/httpd/httpd.b b/appl/svc/httpd/httpd.b
index db570a74..20d48f10 100644
--- a/appl/svc/httpd/httpd.b
+++ b/appl/svc/httpd/httpd.b
@@ -506,8 +506,8 @@ senddir(g: ref Private_info,vers,uri: string, fd: ref FD, mydir: ref Dir)
g.bout.puts("<table>\n");
for(i := 0; i < n; i++){
(typ, enc) := classify(a[i]);
- g.bout.puts(sys->sprint("<tr><td><a href=\"%s%s\">%s</A></td>",
- myname, a[i].name, a[i].name));
+ g.bout.puts(sys->sprint("<tr><td><a href=\"%s\">%s</A></td>",
+ a[i].name, a[i].name));
if(typ != nil){
if(typ.generic!=nil)
g.bout.puts(sys->sprint("<td>%s", typ.generic));
diff --git a/appl/svc/httpd/httpd.suff b/appl/svc/httpd/httpd.suff
index dbc599d2..110e4726 100644
--- a/appl/svc/httpd/httpd.suff
+++ b/appl/svc/httpd/httpd.suff
@@ -15,6 +15,7 @@
.bcpio application x-bcpio - # [Mosaic]
.bib text plain - # BibTex input
.c text plain - # C program
+.css text css - # CSS
.c++ text plain - # C++ program
.cc text plain - # [Mosaic]
.cdf application x-netcdf -
@@ -76,6 +77,7 @@
.rfr text plain - # refer
.rgb image x-rgb - # [Mosaic]
.roff application x-troff - # [Mosaic]
+.rss application rss+xml - # RSS feeds
.rtf application rtf - # [Mosaic]
.rtx text richtext - # MIME richtext [Mosaic]
.sh application x-shar -
@@ -83,6 +85,7 @@
.snd audio basic -
.sv4cpio application x-sv4cpio - # [Mosaic]
.sv4crc application x-sv4crc - # [Mosaic]
+.svg image svg+xml - # SVG images
.t application x-troff - # [Mosaic]
.tar application x-tar - # [Mosaic]
.taz application x-tar x-compress
diff --git a/appl/wm/memory.b b/appl/wm/memory.b
index 6bbfa68b..77221a8f 100644
--- a/appl/wm/memory.b
+++ b/appl/wm/memory.b
@@ -109,9 +109,9 @@ realinit(ctxt: ref Draw->Context)
maxx+x,
a[i].y + 8);
cmd(t, s);
- s = sys->sprint(".c itemconfigure %s -text '%s", a[i].tagsz, string a[i].size);
+ s = sys->sprint(".c itemconfigure %s -text '%s", a[i].tagsz, sizestr(a[i].size));
cmd(t, s);
- s = sys->sprint(".c itemconfigure %s -text '%d", a[i].tagiu, a[i].allocs-a[i].frees);
+ s = sys->sprint(".c itemconfigure %s -text '%s", a[i].tagiu, sizestr(a[i].allocs-a[i].frees));
cmd(t, s);
}
cmd(t, "update");
@@ -163,7 +163,7 @@ initdraw(n: int): int
sizestr(n: int): string
{
- if ((n / 1024) % 1024 == 0)
+ if ((n / 1024) % 1024 == 0 || n > (100 * 1024 * 1024))
return string (n / (1024 * 1024)) + "M";
return string (n / 1024) + "K";
}
diff --git a/appl/wm/view.b b/appl/wm/view.b
index c96ef87d..8e847e55 100644
--- a/appl/wm/view.b
+++ b/appl/wm/view.b
@@ -178,13 +178,42 @@ readimages(file: string, errdiff: int) : (array of ref Image, array of ref Image
# if transparency is enabled, errdiff==1 is probably a mistake,
# but there's no easy solution.
- (ims[i], err2) = imageremap->remap(ai[i], display, errdiff);
+ (ims[i], err2) = remap(ai[i], display, errdiff);
if(ims[i] == nil)
return(nil, nil, err2);
}
return (ims, masks, nil);
}
+remap(raw: ref RImagefile->Rawimage, display: ref Draw->Display, errdiff: int): (ref Draw->Image, string)
+{
+ case raw.chandesc {
+ RImagefile->CRGB =>
+ r := chanstopix(raw.chans, raw.r.dx(), raw.r.dy());
+ im := display.newimage(raw.r, Draw->RGB24, 0, Draw->White);
+ im.writepixels(im.r, r);
+ return (im, "");
+ * =>
+ return imageremap->remap(raw, display, errdiff);
+ }
+}
+
+chanstopix(chans : array of array of byte, width, height: int): array of byte
+{
+ r := chans[0];
+ g := chans[1];
+ b := chans[2];
+
+ rgb := array [3*len r] of byte;
+ bix := 0;
+ for (i := 0; i < len r ; i++) {
+ rgb[bix++] = b[i];
+ rgb[bix++] = g[i];
+ rgb[bix++] = r[i];
+ }
+ return rgb;
+}
+
viewcfg := array[] of {
"panel .p",
"menu .m",
@@ -212,7 +241,7 @@ timer(dt: int, ticks, pidc: chan of int)
view(ctxt: ref Context, ims, masks: array of ref Image, file: string)
{
file = lastcomponent(file);
- (t, titlechan) := tkclient->toplevel(ctxt, "", "view: "+file, Tkclient->Hide);
+ (t, titlechan) := tkclient->toplevel(ctxt, "", "view: "+file, Tkclient->Appl);
cmd := chan of string;
tk->namechan(t, cmd, "cmd");
diff --git a/emu/port/win-x11a.c b/emu/port/win-x11a.c
index bbc65761..0fc38450 100644
--- a/emu/port/win-x11a.c
+++ b/emu/port/win-x11a.c
@@ -969,7 +969,7 @@ xinitscreen(int xsize, int ysize, ulong reqchan, ulong *chan, int *d)
}
clipboard = XInternAtom(xmcon, "CLIPBOARD", False);
- utf8string = XInternAtom(xmcon, "UTF8_STRING", False);
+ utf8string = XInternAtom(xmcon, "UTF8_STRING", True);
targets = XInternAtom(xmcon, "TARGETS", False);
text = XInternAtom(xmcon, "TEXT", False);
compoundtext = XInternAtom(xmcon, "COMPOUND_TEXT", False);
@@ -1523,7 +1523,7 @@ _xgetsnarf(XDisplay *xd)
*/
prop = 1;
XChangeProperty(xd, xdrawable, prop, XA_STRING, 8, PropModeReplace, (uchar*)"", 0);
- XConvertSelection(xd, clipboard, XA_STRING, prop, xdrawable, CurrentTime);
+ XConvertSelection(xd, clipboard, utf8string, prop, xdrawable, CurrentTime);
XFlush(xd);
lastlen = 0;
for(i=0; i<10 || (lastlen!=0 && i<30); i++){
diff --git a/lib/units b/lib/units
index 106fc0f9..4195db90 100644
--- a/lib/units
+++ b/lib/units
@@ -595,3 +595,4 @@ weymass 252 lb
Xunit 1.00202e-13 m
k 1.38047e-16 erg/°K
foal 9223372036854775807
+romanmile 1620 yard
diff --git a/libdraw/font.c b/libdraw/font.c
index f51804d2..849bb289 100644
--- a/libdraw/font.c
+++ b/libdraw/font.c
@@ -355,6 +355,8 @@ fontresize(Font *f, int wid, int ncache, int depth)
d = f->display;
if(depth <= 0)
depth = 1;
+ if(wid == 0)
+ wid = 1;
new = allocimage(d, Rect(0, 0, ncache*wid, f->height), CHAN1(CGrey, depth), 0, 0);
if(new == nil){
diff --git a/man/1/uniq b/man/1/uniq
index 408e9600..41701bca 100644
--- a/man/1/uniq
+++ b/man/1/uniq
@@ -4,7 +4,7 @@ uniq \- report repeated lines in a file
.SH SYNOPSIS
.B uniq
[
-.B -ud
+.B -udc
]
[
.I file
@@ -24,6 +24,9 @@ in order to be found.
.B -u
Print unique lines.
.TP
+.B -c
+Prefix a repetition count and a tab to each output line.
+.TP
.B -d
Print (one copy of) duplicated lines.
.SH SOURCE
diff --git a/man/1/whois b/man/1/whois
new file mode 100644
index 00000000..dfaefe88
--- /dev/null
+++ b/man/1/whois
@@ -0,0 +1,40 @@
+.TH WHOIS 1
+.SH NAME
+whois \- query whois databases
+.SH SYNOPSIS
+.B whois
+[
+.B -a
+.I server
+]
+[
+.B -n
+]
+.I host
+.SH DESCRIPTION
+.I Whois
+queries whois servers to find owner information for domain names and
+network addresses. By default, it looks for referrals to other whois
+database servers and queries the next server in the chain if it finds
+one.
+
+.TP
+.B -a
+Specify a different server to start the query. (Default:
+.I tcp!whois.iana.org!43
+)
+.TP
+.B -n
+Do not attempt to follow referrals.
+.SH EXAMPLE
+To query for the owner of a domain and then an IP address, using a
+specific server while ignoring referrals to other servers:
+.IP
+.EX
+whois inferno-os.org
+whois -a whois.ripe.net -n 148.251.6.120
+.EE
+.SH SOURCE
+.B /appl/cmd/whois.b
+.SH "SEE ALSO"
+.IR RFC3912
diff --git a/services/httpd/httpd.suff b/services/httpd/httpd.suff
index dbc599d2..110e4726 100644
--- a/services/httpd/httpd.suff
+++ b/services/httpd/httpd.suff
@@ -15,6 +15,7 @@
.bcpio application x-bcpio - # [Mosaic]
.bib text plain - # BibTex input
.c text plain - # C program
+.css text css - # CSS
.c++ text plain - # C++ program
.cc text plain - # [Mosaic]
.cdf application x-netcdf -
@@ -76,6 +77,7 @@
.rfr text plain - # refer
.rgb image x-rgb - # [Mosaic]
.roff application x-troff - # [Mosaic]
+.rss application rss+xml - # RSS feeds
.rtf application rtf - # [Mosaic]
.rtx text richtext - # MIME richtext [Mosaic]
.sh application x-shar -
@@ -83,6 +85,7 @@
.snd audio basic -
.sv4cpio application x-sv4cpio - # [Mosaic]
.sv4crc application x-sv4crc - # [Mosaic]
+.svg image svg+xml - # SVG images
.t application x-troff - # [Mosaic]
.tar application x-tar - # [Mosaic]
.taz application x-tar x-compress