commit - 7bd7fd2f4f6fb39400f6f64feb7ec9cba89cf3a3
commit + 17157e4aa85baea6c1503e2c95d98ed66a1596f1
blob - 4af3a242a851fe4dc363875bbb5a7843f1e953b9
blob + 996e6a2b24eae83d7d36294c7330331d4a7a92c5
--- LICENSE
+++ LICENSE
directories. There are other exceptions, also marked with LICENSE files
in their directories.
-The bitmap fonts in the font/lucida directory are copyright B&H Inc. and Y&Y Inc.
-and distributed under the following exception to the Lucent license:
+The bitmap fonts in the font/luc, font/lucm, font/lucsans, and font/pelm
+directory are copyright B&H Inc. and distributed under more restricted
+terms under agreement with B&H. See the NOTICE file in those directories.
- No right is granted to create derivative works of or
- to redistribute (other than with the Plan 9 Operating System)
- the screen imprinter fonts identified in subdirectory
- font/lucida. This directory contains material copyrights by
- B&H Inc. and Y&Y Inc.
-
-(Of course, X11 already distributes non-Unicode versions of these fonts.)
-
===================================================================
Lucent Public License Version 1.02
blob - a19c7378cabdb4d6246ccf0daef210d9c285aa70
blob + f15dffb1e0124e6834511e19b4e257f55788cb8b
--- bin/9c
+++ bin/9c
-Wno-sign-compare \
-Wno-unknown-pragmas \
-fno-omit-frame-pointer \
+ -fno-inline-functions-called-once \
"
# want to put -fno-optimize-sibling-calls here but
# that option only works with gcc3+ it seems
blob - a3db08a9fdbde6157d0d1a1b8c0ae5376e5c9ff3
blob + a7f5ae58abb20c583cc1cba0091a98f618088fdc
--- dist/deb.html
+++ dist/deb.html
<table border=0 cellspacing=0 cellpadding=0 width=100%><tr height=20><td></table>
Here are packages built for the Debian distribution of Linux.
+ <br>
+ Newer packages can be had by adding
+ <pre>
+ deb http://swtch.com/debian/ testing main</pre> to your
+ <tt>/etc/apt/sources.list</tt>.
<table border=0 cellspacing=0 cellpadding=0 width=100%><tr height=10><td></table>
<table border=0 cellspacing=0 cellpadding=0 width=100%>
blob - cd6425277c80c630ec3b23840a9065f63fda7fa2
blob + 4061e1cf352f859bcbf873e719d285494dcf003d
--- dist/mkfilelist
+++ dist/mkfilelist
/^font\/(big5|gb|jis|naga10|shinonome)/ { cat("font-asian") }
/^font\/LICENSE/ { cat("font-bh") }
- /^font\/(lucida|lucidasans|lucm|pelm)\// { cat("font-bh") }
+ /^font\/(luc|lucsans|lucm|pelm)\// { cat("font-bh") }
/^font\/(MAP|fixed|misc|sample|smiley)/ { cat("font-core") }
/^font\/(palatino|times|special)/ { cat("font-proof") }
/^font\// { cat("font-core") }
blob - ce45b0d6284fb2246a5bab5f761e7c55d771316e
blob + ac147dad274ed37429fc73a8ea91cd965ffba3ae
--- man/fonts
+++ man/fonts
-# mkfile rules to get fonts in Lucida Sans.
+# mkfile rules to set fonts
# if you want to use Times, change these next lines to
# MAN=mantimes
# FONTS=''
blob - 01caa3c49dfec81dce6aff77b6613a1b919beaaf
blob + 1e9619206a7eabee2cfa60ec145e3d2be0f0de6e
--- src/cmd/draw/img.c
+++ src/cmd/draw/img.c
if((image=readimage(display, fd, 0)) == nil)
sysfatal("readimage: %r");
+ sleep(1000);
drawresizewindow(Rect(0,0,Dx(image->r),Dy(image->r)));
case Ekeyboard:
if(e.kbdc == 'q' || e.kbdc == 0x7F)
exits(nil);
+ eresized(0);
break;
case Emouse:
break;
blob - 07c3df2b2896e18085f0310041e230559f16d74f
blob + 319cfb68f62fdea12f42676ebe57bd7a5d1beafd
--- src/cmd/page/filter.c
+++ src/cmd/page/filter.c
#include <u.h>
#include <libc.h>
#include <draw.h>
+#include <cursor.h>
#include <event.h>
#include <bio.h>
#include "page.h"
blob - 72254de8b81f7a274af17b6b17e4742517a8d0a8
blob + 6a947039031b9f114d12a1869b4b86c4c5b34e87
--- src/cmd/page/gfx.c
+++ src/cmd/page/gfx.c
#include <u.h>
#include <libc.h>
#include <draw.h>
+#include <cursor.h>
#include <event.h>
#include <bio.h>
#include "page.h"
static Image* gfxdrawpage(Document *d, int page);
static char* gfxpagename(Document*, int);
static int spawnrc(char*, uchar*, int);
+static void waitrc(void);
+static int spawnpost(int);
static int addpage(Document*, char*);
static int rmpage(Document*, int);
static int genaddpage(Document*, char*, uchar*, int);
int i;
USED(b);
+
doc = emalloc(sizeof(*doc));
gfx = emalloc(sizeof(*gfx));
gfx->g = nil;
blob - 524701e39f051f56b846beff4f568852eafe0876
blob + 2093af56f3166c6d20c40fa26280a9a25ed06d24
--- src/cmd/page/gs.c
+++ src/cmd/page/gs.c
#include <u.h>
#include <libc.h>
#include <draw.h>
+#include <cursor.h>
#include <event.h>
#include <bio.h>
#include "page.h"
}
int
-spawngs(GSInfo *g)
+spawngs(GSInfo *g, char *safer)
{
char *args[16];
char tb[32], gb[32];
nargs = 0;
args[nargs++] = "gs";
args[nargs++] = "-dNOPAUSE";
- args[nargs++] = "-dSAFER";
+ args[nargs++] = safer;
args[nargs++] = "-sDEVICE=plan9";
args[nargs++] = "-sOutputFile=/fd/3";
args[nargs++] = "-dQUIET";
if(!Dx(bbox))
bbox = Rect(0, 0, 612, 792); /* 8½×11 */
- switch(landscape){
- case 0:
+ if(landscape)
+ pbox = Rect(bbox.min.y, bbox.min.x, bbox.max.y, bbox.max.x);
+ else
pbox = bbox;
- break;
- case 1:
- pbox = Rect(bbox.min.y, bbox.min.x, bbox.max.y, bbox.max.x);
- break;
- }
+
gscmd(gs, "/PageSize [%d %d]\n", Dx(pbox), Dy(pbox));
gscmd(gs, "/Margins [%d %d]\n", -pbox.min.x, -pbox.min.y);
gscmd(gs, "currentdevice putdeviceprops pop\n");
blob - e8dbf52a59fa1ceaacdbbc06523b2405a6529590
blob + 0c4163ad001791e7c0c595976ad14d494efba6ee
--- src/cmd/page/mkfile
+++ src/cmd/page/mkfile
util.$O\
view.$O\
-<$PLAN9/src//mkone
+<$PLAN9/src/mkone
pdfprolog.c: pdfprolog.ps
cat pdfprolog.ps | sed 's/.*/"&\\n"/g' >pdfprolog.c
blob - 2225ec3f105d5b7cfb4024dc08bfd0abd2c8fcea
blob + 65fe33aba638186f0d01dcb5399672f1ed6fe0c4
--- src/cmd/page/nrotate.c
+++ src/cmd/page/nrotate.c
#include <libc.h>
#include <bio.h>
#include <draw.h>
+#include <cursor.h>
#include <event.h>
#include "page.h"
blob - 3669ebfba608bbbaad21c2793d1a9b5620e635f6
blob + 4c76e03316c0139b1aba8da82a50ec685504238b
--- src/cmd/page/page.c
+++ src/cmd/page/page.c
#include <u.h>
#include <libc.h>
#include <draw.h>
+#include <cursor.h>
#include <event.h>
#include <bio.h>
#include "page.h"
int stdinfd;
int truecolor;
int imagemode;
-int notewatcher;
-int notegp;
-int
-watcher(void *v, char *x)
-{
- USED(v);
-
- if(strcmp(x, "die") != 0)
- postnote(PNGROUP, notegp, x);
- _exits(0);
- return 0;
-}
-
-int
-bell(void *u, char *x)
-{
- if(x && strcmp(x, "hangup") == 0)
- _exits(0);
-
- if(x && strstr(x, "die") == nil)
- fprint(2, "postnote %d: %s\n", getpid(), x);
-
- /* alarms come from the gs monitor */
- if(x && strstr(x, "alarm")){
- postnote(PNGROUP, getpid(), "die (gs error)");
- postnote(PNPROC, notewatcher, "die (gs error)");
- }
-
- /* function mentions u so that it's in the stack trace */
- if((u == nil || u != x) && doabort)
- abort();
-
-/* fprint(2, "exiting %d\n", getpid()); */
- wexits("note");
- return 0;
-}
-
static int
afmt(Fmt *fmt)
{
usage();
}ARGEND;
- notegp = getpid();
-
- switch(notewatcher = fork()){
- case -1:
- sysfatal("fork\n");
- exits(0);
- default:
- break;
- case 0:
- atnotify(watcher, 1);
- for(;;)
- sleep(1000);
- _exits(0);
- }
-
rfork(RFNOTEG);
- atnotify(bell, 1);
readstdin = 0;
if(imagemode == 0 && argc == 0){
fmtinstall('R', Rfmt);
fmtinstall('P', Pfmt);
+ if(mknewwindow)
+ newwin();
if(readstdin){
b = nil;
void
wexits(char *s)
{
- if(s && *s && strcmp(s, "note") != 0 && mknewwindow)
- sleep(10*1000);
- postnote(PNPROC, notewatcher, "die");
exits(s);
}
blob - aa19ff712971d104b8518d533e19a8f7423c5f7e
blob + be54e3867f9c0d88b66cd3e01472f903ec3ae5e0
--- src/cmd/page/page.h
+++ src/cmd/page/page.h
-#include <cursor.h>
-
typedef struct Document Document;
struct Document {
void rot180(Image*);
Image *rot90(Image*);
+Image *rot270(Image*);
Image *resample(Image*, Image*);
/* ghostscript interface shared by ps, pdf */
};
void waitgs(GSInfo*);
int gscmd(GSInfo*, char*, ...);
-int spawngs(GSInfo*);
+int spawngs(GSInfo*, char*);
void setdim(GSInfo*, Rectangle, int, int);
int spawnwriter(GSInfo*, Biobuf*);
Rectangle screenrect(void);
blob - 44615a21bd86e3e12e769e6c41e801419659c166
blob + d723ad8c56800289a78fa0fd45ec93eb39beb98b
--- src/cmd/page/pdf.c
+++ src/cmd/page/pdf.c
#include <u.h>
#include <libc.h>
#include <draw.h>
+#include <cursor.h>
#include <event.h>
#include <bio.h>
#include "page.h"
d->pagename = pdfpagename;
d->fwdonly = 0;
- if(spawngs(&pdf->gs) < 0)
+ if(spawngs(&pdf->gs, "-dDELAYSAFER") < 0)
return nil;
gscmd(&pdf->gs, "%s", pdfprolog);
waitgs(&pdf->gs);
setdim(&pdf->gs, Rect(0,0,0,0), ppi, 0);
- gscmd(&pdf->gs, "(%s) (r) file pdfopen begin\n", fn);
+ gscmd(&pdf->gs, "(%s) (r) file { DELAYSAFER { .setsafe } if } stopped pop pdfopen begin\n", fn);
gscmd(&pdf->gs, "pdfpagecount PAGE==\n");
p = Brdline(&pdf->gs.gsrd, '\n');
npage = atoi(p);
pdf->pagebbox = emalloc(sizeof(Rectangle)*npage);
for(i=0; i<npage; i++) {
gscmd(&pdf->gs, "%d pdfgetpage\n", i+1);
- pdf->pagebbox[i] = pdfbbox(&pdf->gs);
+ pdf->pagebbox[i] = pdfbbox(pdf);
if(Dx(pdf->pagebbox[i]) <= 0)
pdf->pagebbox[i] = bbox;
}
-
return d;
}
pdfpagename(Document *d, int page)
{
static char str[15];
+
USED(d);
sprint(str, "p %d", page+1);
return str;
blob - 46ad5cdb01df0d3e8050d1ee6e15115cd6abf138
blob + cc6f3c513f9c5054cfafafa7c621685bdeec54d6
--- src/cmd/page/ps.c
+++ src/cmd/page/ps.c
#include <u.h>
#include <libc.h>
#include <draw.h>
+#include <cursor.h>
#include <event.h>
#include <bio.h>
#include <ctype.h>
d->fwdonly = ps->clueless = dumb;
d->docname = argv[0];
- if(spawngs(&ps->gs) < 0)
+ if(spawngs(&ps->gs, "-dSAFER") < 0)
return nil;
if(!cantranslate)
blob - b2952637d1ea72d628f8c8f6318787c5163d927a
blob + 9e1c20dbfc88577c7f509ef7d98cc4d00e991000
--- src/cmd/page/rotate.c
+++ src/cmd/page/rotate.c
#include <libc.h>
#include <bio.h>
#include <draw.h>
+#include <cursor.h>
#include <event.h>
#include "page.h"
drawop(tmp, tmp->r, im, nil, im->r.min, S);
switch(axis){
+ default:
case Xaxis:
range = Rect(a, im->r.min.y, c, im->r.max.y);
dr0 = range;
r0 = im->r;
r1 = im->r;
switch(axis) {
+ default:
case Xaxis:
r0.max.x = n;
r1.min.x = n;
return(tmp);
}
+/* rotates an image 270 degrees clockwise */
+Image *
+rot270(Image *im)
+{
+ Image *tmp;
+ int i, j, dx, dy;
+
+ dx = Dx(im->r);
+ dy = Dy(im->r);
+ tmp = xallocimage(display, Rect(0, 0, dy, dx), im->chan, 0, DCyan);
+ if(tmp == nil) {
+ fprint(2, "out of memory during rot270: %r\n");
+ wexits("memory");
+ }
+
+ for(i = 0; i < dy; i++) {
+ for(j = 0; j < dx; j++) {
+ drawop(tmp, Rect(i, j, i+1, j+1), im, nil, Pt(dx-(j+1), i), S);
+ }
+ }
+ freeimage(im);
+
+ return(tmp);
+}
+
/* from resample.c -- resize from → to using interpolation */
return i0(alpha*sqrt(1-(x*x/(tau*tau))))/i0(alpha);
}
+
void
resamplex(uchar *in, int off, int d, int inx, uchar *out, int outx)
{
blob - 22832baadb6450e74fd8a73fb2b2d8fc55920b3f
blob + 2669df84689bd26ec905b8a622fe639be18af716
--- src/cmd/page/util.c
+++ src/cmd/page/util.c
#include <u.h>
#include <libc.h>
#include <draw.h>
+#include <cursor.h>
#include <event.h>
#include <bio.h>
#include "page.h"
blob - 92aedeb968c424b71711fff054d037360644e98a
blob + 4321f829cc7c84f163a1d3bcfe4f6a4bac51545e
--- src/cmd/page/view.c
+++ src/cmd/page/view.c
#include <libc.h>
#include <draw.h>
#include <cursor.h>
+#include <cursor.h>
#include <event.h>
#include <bio.h>
#include <plumb.h>
Document *doc;
Image *im;
int page;
-int upside = 0;
+int angle = 0;
int showbottom = 0; /* on the next showpage, move the image so the bottom is visible. */
Rectangle ulrange; /* the upper left corner of the image must be in this rectangle */
im = tmp;
}
- if(upside)
+ switch(angle){
+ case 90:
+ im = rot90(im);
+ break;
+ case 180:
rot180(im);
+ break;
+ case 270:
+ im = rot270(im);
+ break;
+ }
esetcursor(nil);
if(showbottom){
esetcursor(&reading);
rot180(im);
esetcursor(nil);
- upside = !upside;
+ angle = (angle+180) % 360;
redraw(screen);
flushimage(display, 1);
break;
esetcursor(&reading);
im = rot90(im);
esetcursor(nil);
+ angle = (angle+90) % 360;
redraw(screen);
flushimage(display, 1);
break;
esetcursor(&reading);
rot180(im);
esetcursor(nil);
- upside = !upside;
+ angle = (angle+180) % 360;
redraw(screen);
flushimage(display, 1);
break;
v[size] = 0;
close(fd);
return v;
+}
+
+void
+newwin(void)
+{
+ char *srv, *mntsrv;
+ char spec[100];
+ int srvfd, cons, pid;
+
+ switch(rfork(RFFDG|RFPROC|RFNAMEG|RFENVG|RFNOTEG|RFNOWAIT)){
+ case -1:
+ fprint(2, "page: can't fork: %r\n");
+ wexits("no fork");
+ case 0:
+ break;
+ default:
+ wexits(0);
+ }
+
+ srv = rdenv("/env/wsys");
+ if(srv == 0){
+ mntsrv = rdenv("/mnt/term/env/wsys");
+ if(mntsrv == 0){
+ fprint(2, "page: can't find $wsys\n");
+ wexits("srv");
+ }
+ srv = malloc(strlen(mntsrv)+10);
+ sprint(srv, "/mnt/term%s", mntsrv);
+ free(mntsrv);
+ pid = 0; /* can't send notes to remote processes! */
+ }else
+ pid = getpid();
+ srvfd = open(srv, ORDWR);
+ free(srv);
+ if(srvfd == -1){
+ fprint(2, "page: can't open %s: %r\n", srv);
+ wexits("no srv");
+ }
+ sprint(spec, "new -pid %d", pid);
+ if(mount(srvfd, -1, "/mnt/wsys", 0, spec) == -1){
+ fprint(2, "page: can't mount /mnt/wsys: %r (spec=%s)\n", spec);
+ wexits("no mount");
+ }
+ close(srvfd);
+ unmount("/mnt/acme", "/dev");
+ bind("/mnt/wsys", "/dev", MBEFORE);
+ cons = open("/dev/cons", OREAD);
+ if(cons==-1){
+ NoCons:
+ fprint(2, "page: can't open /dev/cons: %r");
+ wexits("no cons");
+ }
+ dup(cons, 0);
+ close(cons);
+ cons = open("/dev/cons", OWRITE);
+ if(cons==-1)
+ goto NoCons;
+ dup(cons, 1);
+ dup(cons, 2);
+ close(cons);
+// wctlfd = open("/dev/wctl", OWRITE);
}
Rectangle
case 0:
dup(pfd[1], 0);
close(pfd[0]);
- execl("/bin/page", "page", "-w", 0);
+ execl("/bin/page", "page", "-w", nil);
wexits("cannot exec in zerox: %r\n");
default:
close(pfd[1]);
blob - 798ffe87db9372dc6661d11110dc5c075137b39c
blob + b0e27eb353845942776c7e132927c3db81d2a0c4
--- src/cmd/rc/lex.c
+++ src/cmd/rc/lex.c
}
char *addtok(char *p, int val){
if(p==0) return 0;
- if(p==&tok[NTOK]){
+ if(p==&tok[NTOK-1]){
*p=0;
yyerror("token buffer too short");
return 0;
blob - 95c2e0ce577b97120ccb62ef206d76f6fa868ea1
blob + 8b6f281f2a87c31e376ccde1fe612d608d6e726d
--- src/cmd/sam/io.c
+++ src/cmd/sam/io.c
// count args
for(av = argv; *av; av++)
;
- av = malloc(sizeof(char*)*((av-argv) + 5));
+ av = malloc(sizeof(char*)*((av-argv) + 10));
if(av == nil){
dprint("out of memory\n");
exits("fork/exec");
ac = 0;
av[ac++] = RX;
av[ac++] = machine;
+ if(rxopt)
+ av[ac++] = rxopt;
av[ac++] = rsamname;
av[ac++] = "-R";
while(*argv)
blob - 0ade9c21040aa670a707a0f6121d62cae1b55eef
blob + 01893cbb0b5ce2d66f81e2c0fb8815af4c3aa216
--- src/cmd/sam/sam.c
+++ src/cmd/sam/sam.c
long seq;
char *winsize;
+char *rxopt;
Rune baddir[] = { '<', 'b', 'a', 'd', 'd', 'i', 'r', '>', '\n'};
break;
case 'R':
Rflag++;
+ break;
+ case 'O':
+ rxopt = EARGF(usage());
break;
case 't':
samterm = EARGF(usage());
void
usage(void)
{
- dprint("usage: sam [-d] [-t samterm] [-s sam name] -r machine\n");
+ dprint("usage: sam [-d] [-t samterm] [-s sam name] [-r machine] [file ...]\n");
exits("usage");
}
blob - eefb4b344fb583ff97c301b51a681f13fa1701f1
blob + bb88c33d3983f27d94e29a29b2c25ec229d1d75a
--- src/cmd/sam/sam.h
+++ src/cmd/sam/sam.h
extern char SHPATH[];
extern char RX[];
extern char RXPATH[];
+extern char *rxopt;
/*
* acme globals
blob - 0661f4c6544368c9760152ed7590b4fd4c73a0d2
blob + d3297dfa4f5030b296feb6217fd33427596357b7
--- src/cmd/upas/smtp/smtp.c
+++ src/cmd/upas/smtp/smtp.c
reply = s_reset(reply);
for(;;){
line = getcrnl(reply);
+ if(debug)
+ Bflush(&berr);
if(line == 0)
return -1;
if(!isdigit(line[0]) || !isdigit(line[1]) || !isdigit(line[2]))
if(line[3] != '-')
break;
}
- if(debug)
- Bflush(&berr);
rv = atoi(line)/100;
return rv;
}
case '\r':
c = Bgetc(&bin);
if(c == '\n'){
+ case '\n':
s_putc(s, c);
if(debug)
Bputc(&berr, c);
blob - a6720110ec97077c47c6e8b0d28bf3d5be83884c
blob + 8c1f74548a3cd95768c9225ffd899ad98828b64e
--- src/mkfile
+++ src/mkfile
mkmk.sh:VD:
(
+ echo '# AUTOMATICALLY GENERATED - DO NOT EDIT'
echo cd lib9
echo 'echo cd `pwd`'
(cd lib9; mk -n -a install)