Plan 9 from Bell Labs’s /usr/web/sources/extra/changes/2005/1027

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


New kernels.
 [jmk] --rwxrwxr-x M 320859 glenda sys 1855287 Oct 26 23:39 386/9pc
 [jmk] --rwxrwxr-x M 320859 glenda sys 1519614 Oct 26 23:39 386/9pccpu
 [jmk] --rwxrwxr-x M 320859 glenda sys 2046566 Oct 26 23:39 386/9pcdisk
 [jmk] --rwxrwxr-x M 320859 presotto sys 2389262 Oct 26 23:39 386/9pcf
 [jmk] --rwxrwxr-x M 320859 glenda sys 101198 Oct 26 23:39 386/init

Speak the truth.
 [jmk] --rw-rw-r-- M 320859 glenda sys 4302 Oct 27 00:26 sys/man/2/segattach
	/n/sourcesdump/2005/1027/plan9/sys/man/2/segattach:87,93 - 
	/n/sourcesdump/2005/1028/plan9/sys/man/2/segattach:87,93
	  .I Addr
	  may be any address within the bounds of the segment.
	  .PP
	- The system will not permit the text and stack segments to be detached
	+ The system will not permit the initial stack segment to be detached
	  from the address space.
	  .PP
	  .I Segfree

Check stack segment correctly.
 [jmk] --rw-rw-r-- M 320859 glenda sys 15144 Oct 27 00:24 sys/src/9/port/sysproc.c
	/n/sourcesdump/2005/1027/plan9/sys/src/9/port/sysproc.c:754,761 - 
	/n/sourcesdump/2005/1028/plan9/sys/src/9/port/sysproc.c:754,763
	  	error(Ebadarg);
	  
	  found:
	- 	/* Check we are not detaching the current stack segment */
	- 	if((ulong)arg >= s->base && (ulong)arg < s->top) {
	+ 	/*
	+ 	 * Check we are not detaching the initial stack segment.
	+ 	 */
	+ 	if(s == up->seg[SSEG]){
	  		qunlock(&s->lk);
	  		error(Ebadarg);
	  	}

Handle unparseable URLs sent via plumber.
 [rsc] --rw-rw-r-- M 320859 glenda sys 6818 Oct 27 10:18 sys/src/cmd/webfs/client.c
	/n/sourcesdump/2005/1027/plan9/sys/src/cmd/webfs/client.c:139,151 - 
	/n/sourcesdump/2005/1028/plan9/sys/src/cmd/webfs/client.c:139,162
	  {
	  	int i;
	  	Client *c;
	+ 	Url *ubase, *uurl;
	  
	+ 	ubase = nil;
	+ 	if(base){
	+ 		ubase = parseurl(base, nil);
	+ 		if(ubase == nil)
	+ 			return;
	+ 	}
	+ 	uurl = parseurl(url, ubase);
	+ 	if(uurl == nil){
	+ 		freeurl(ubase);
	+ 		return;
	+ 	}
	  	i = newclient(1);
	  	c = client[i];
	  	c->ref++;
	- 	if(base != nil)
	- 		c->baseurl = parseurl(base, nil);
	- 	c->url = parseurl(url, c->baseurl);
	+ 	c->baseurl = ubase;
	+ 	c->url = uurl;
	  	sendp(c->creq, nil);
	  }
	  
	/n/sourcesdump/2005/1027/plan9/sys/src/cmd/webfs/client.c:177,182 - 
	/n/sourcesdump/2005/1028/plan9/sys/src/cmd/webfs/client.c:188,197
	  	c = a;
	  	if(c->plumbed) {
	  		recvp(c->creq);
	+ 		if(c->url == nil){
	+ 			fprint(2, "bad url got plumbed\n");
	+ 			return;
	+ 		}
	  		clientbodyopen(c, nil);
	  		replumb(c);
	  	}

-
 [rsc] --rw-rw-r-- M 320859 glenda sys 256609 Oct 27 10:37 sys/games/lib/fortunes
	/n/sourcesdump/2005/1027/plan9/sys/games/lib/fortunes:4090,4092 - 
	/n/sourcesdump/2005/1028/plan9/sys/games/lib/fortunes:4090,4094
	  By tradition, the return value of functions report what they did, not what they considered doing.  - rob
	  If the restaurant serves poor beer, don't switch to wine. - sape
	  There is nothing quite like looking up and seeing YOUR star.  Order now for FREE SHIPPING.
	+ gcc is the holy cow of compilers, not the holy grail.  - forsyth
	+ NOTE 3: Each bit has the value either ZERO or ONE.  - ECMA-035 spec

Add sparc64, amd64.
 [rsc] --rw-rw-r-- M 320859 glenda sys 2698 Oct 27 10:52 sys/src/ape/lib/ap/syscall/mkfile
	/n/sourcesdump/2005/1027/plan9/sys/src/ape/lib/ap/syscall/mkfile:63,69 - 
	/n/sourcesdump/2005/1028/plan9/sys/src/ape/lib/ap/syscall/mkfile:63,78
	  				MOVL AX,4(CX)'
	  			}
	  			echo RET
	- 		case sparc
	+ 		case amd64
	+ 			if(~ $i _SEEK)
	+ 				echo TEXT __SEEK'(SB)', 1, '$0'
	+ 			if not
	+ 				echo TEXT $i'(SB)', 1, '$0'
	+ 			echo MOVQ RARG, 'a0+0(FP)'
	+ 			echo MOVQ '$'$n, RARG
	+ 			echo SYSCALL
	+ 			echo RET
	+ 		case sparc sparc64
	  			echo TEXT $i'(SB)', 1, '$0'
	  			echo MOVW R7, '0(FP)'
	  			echo MOVW '$'$n, R7

Call a pointer a pointer.
 [rsc] --rw-rw-r-- M 320859 glenda sys 1127 Oct 27 10:38 sys/src/cmd/tbl/tm.c
	/n/sourcesdump/2005/1027/plan9/sys/src/cmd/tbl/tm.c:5,12 - 
	/n/sourcesdump/2005/1028/plan9/sys/src/cmd/tbl/tm.c:5,12
	  maknew(char *str)
	  {
	  				/* make two numerical fields */
	- 	int	dpoint, c;
	- 	char	*p, *q, *ba;
	+ 	int	c;
	+ 	char	*p, *q, *ba, *dpoint;
	  
	  	p = str;
	  	for (ba = 0; c = *str; str++)
	/n/sourcesdump/2005/1027/plan9/sys/src/cmd/tbl/tm.c:18,24 - 
	/n/sourcesdump/2005/1028/plan9/sys/src/cmd/tbl/tm.c:18,24
	  			if (*str == '.' && !ineqn(str, p) && 
	  			    (str > p && digit(*(str - 1)) || 
	  			    digit(*(str + 1))))
	- 				dpoint = (int)str;
	+ 				dpoint = str;
	  		}
	  		if (dpoint == 0)
	  			for (; str > p; str--) {
	/n/sourcesdump/2005/1027/plan9/sys/src/cmd/tbl/tm.c:28,34 - 
	/n/sourcesdump/2005/1028/plan9/sys/src/cmd/tbl/tm.c:28,34
	  		if (!dpoint && p == str) /* not numerical, don't split */
	  			return(0);
	  		if (dpoint) 
	- 			str = (char *)dpoint;
	+ 			str = dpoint;
	  	} else
	  		str = ba;
	  	p = str;

Add bayes to list.
 [rsc] --rw-rw-r-- M 320859 glenda sys 1916 Oct 27 10:36 sys/src/cmd/upas/mkfile
	/n/sourcesdump/2005/1027/plan9/sys/src/cmd/upas/mkfile:1,7 - 
	/n/sourcesdump/2005/1028/plan9/sys/src/cmd/upas/mkfile:1,7
	  </$objtype/mkfile
	  
	  LIBS=common
	- PROGS=smtp alias fs ned misc q send scanmail pop3 ml marshal vf filterkit unesc
	+ PROGS=smtp alias fs ned misc q send scanmail pop3 ml marshal vf filterkit unesc bayes
	  #libs must be made first
	  DIRS=$LIBS $PROGS
	  

Internal shuffling for debugging.
 [rsc] --rw-rw-r-- M 320859 glenda sys 10758 Oct 27 10:36 sys/src/cmd/sam/cmd.c
	/n/sourcesdump/2005/1027/plan9/sys/src/cmd/sam/cmd.c:3,9 - 
	/n/sourcesdump/2005/1028/plan9/sys/src/cmd/sam/cmd.c:3,9
	  
	  static char	linex[]="\n";
	  static char	wordx[]=" \t\n";
	- struct cmdtab cmdtab[]={
	+ Cmdtab cmdtab[]={
	  /*	cmdc	text	regexp	addr	defcmd	defaddr	count	token	 fn	*/
	  	'\n',	0,	0,	0,	0,	aDot,	0,	0,	nl_cmd,
	  	'a',	1,	0,	0,	0,	aDot,	0,	0,	a_cmd,
	/n/sourcesdump/2005/1027/plan9/sys/src/cmd/sam/cmd.c:108,122 - 
	/n/sourcesdump/2005/1028/plan9/sys/src/cmd/sam/cmd.c:108,133
	  int
	  inputline(void)
	  {
	- 	int i, c;
	+ 	int i, c, start;
	  
	- 	linep = line;
	- 	i = 0;
	+ 	/*
	+ 	 * Could set linep = line and i = 0 here and just
	+ 	 * error(Etoolong) below, but this way we keep
	+ 	 * old input buffer history around for a while.
	+ 	 * This is useful only for debugging.
	+ 	 */
	+ 	i = linep - line;
	  	do{
	  		if((c = inputc())<=0)
	  			return -1;
	- 		if(i == (sizeof line)/RUNESIZE-1)
	- 			error(Etoolong);
	+ 		if(i == nelem(line)-1){
	+ 			if(linep == line)
	+ 				error(Etoolong);
	+ 			start = linep - line;
	+ 			runemove(line, linep, i-start);
	+ 			i -= start;
	+ 			linep = line;
	+ 		}
	  	}while((line[i++]=c) != '\n');
	  	line[i] = 0;
	  	return 1;
	/n/sourcesdump/2005/1027/plan9/sys/src/cmd/sam/cmd.c:186,192 - 
	/n/sourcesdump/2005/1028/plan9/sys/src/cmd/sam/cmd.c:197,203
	  	Posn p;
	  
	  	for(p=cmdpt; p<cmd->nc; p++){
	- 		if(terminp >= &termline[BLOCKSIZE]){
	+ 		if(terminp >= termline+nelem(termline)){
	  			cmdpt = cmd->nc;
	  			error(Etoolong);
	  		}
	/n/sourcesdump/2005/1027/plan9/sys/src/cmd/sam/cmd.c:389,395 - 
	/n/sourcesdump/2005/1028/plan9/sys/src/cmd/sam/cmd.c:400,406
	  parsecmd(int nest)
	  {
	  	int i, c;
	- 	struct cmdtab *ct;
	+ 	Cmdtab *ct;
	  	Cmd *cp, *ncp;
	  	Cmd cmd;
	  
 [rsc] --rw-rw-r-- M 320859 glenda sys 1934 Oct 27 10:36 sys/src/cmd/sam/parse.h
	/n/sourcesdump/2005/1027/plan9/sys/src/cmd/sam/parse.h:33,39 - 
	/n/sourcesdump/2005/1028/plan9/sys/src/cmd/sam/parse.h:33,41
	  #define	ctext	g.text
	  #define	caddr	g.addr
	  
	- extern struct cmdtab{
	+ typedef struct Cmdtab Cmdtab;
	+ struct Cmdtab
	+ {
	  	ushort	cmdc;		/* command character */
	  	uchar	text;		/* takes a textual argument? */
	  	uchar	regexp;		/* takes a regular expression? */

64-bit safety, minor cleanups.
 [rsc] --rw-rw-r-- M 320859 glenda sys 439 Oct 27 10:52 sys/src/libc/9sys/sbrk.c
	/n/sourcesdump/2005/1027/plan9/sys/src/libc/9sys/sbrk.c:13,21 - 
	/n/sourcesdump/2005/1028/plan9/sys/src/libc/9sys/sbrk.c:13,21
	  int
	  brk(void *p)
	  {
	- 	ulong bl;
	+ 	uintptr bl;
	  
	- 	bl = ((ulong)p + Round) & ~Round;
	+ 	bl = ((uintptr)p + Round) & ~Round;
	  	if(brk_((void*)bl) < 0)
	  		return -1;
	  	bloc = (char*)bl;
	/n/sourcesdump/2005/1027/plan9/sys/src/libc/9sys/sbrk.c:25,33 - 
	/n/sourcesdump/2005/1028/plan9/sys/src/libc/9sys/sbrk.c:25,33
	  void*
	  sbrk(ulong n)
	  {
	- 	ulong bl;
	+ 	uintptr bl;
	  
	- 	bl = ((ulong)bloc + Round) & ~Round;
	+ 	bl = ((uintptr)bloc + Round) & ~Round;
	  	if(brk_((void*)(bl+n)) < 0)
	  		return (void*)-1;
	  	bloc = (char*)bl + n;
 [rsc] --rw-rw-r-- M 320859 glenda sys 2625 Oct 27 10:52 sys/src/libc/9syscall/mkfile
	/n/sourcesdump/2005/1027/plan9/sys/src/libc/9syscall/mkfile:59,65 - 
	/n/sourcesdump/2005/1028/plan9/sys/src/libc/9syscall/mkfile:59,74
	  				MOVL AX,4(CX)'
	  			}
	  			echo RET
	- 		case sparc
	+ 		case amd64
	+ 			if(~ $i seek)
	+ 				echo TEXT _seek'(SB)', 1, '$0'
	+ 			if not
	+ 				echo TEXT $i'(SB)', 1, '$0'
	+ 			echo MOVQ RARG, 'a0+0(FP)'
	+ 			echo MOVQ '$'$n, RARG
	+ 			echo SYSCALL
	+ 			echo RET
	+ 		case sparc sparc64
	  			echo TEXT $i'(SB)', 1, '$0'
	  			echo MOVW R7, '0(FP)'
	  			echo MOVW '$'$n, R7
 [rsc] --rw-rw-r-- M 320859 glenda sys 180 Oct 27 10:51 sys/src/libc/alpha/_seek.c
	/n/sourcesdump/2005/1027/plan9/sys/src/libc/alpha/_seek.c:1,7 - 
	/n/sourcesdump/2005/1028/plan9/sys/src/libc/alpha/_seek.c:1,7
	  #include <u.h>
	  #include <libc.h>
	  
	- extern	long	_seek(vlong*, int, vlong, int);
	+ extern	int	_seek(vlong*, int, vlong, int);
	  
	  vlong
	  seek(int fd, vlong o, int p)
	/n/sourcesdump/2005/1027/plan9/sys/src/libc/alpha/_seek.c:9,14 - 
	/n/sourcesdump/2005/1028/plan9/sys/src/libc/alpha/_seek.c:9,14
	  	vlong l;
	  
	  	if(_seek(&l, fd, o, p) < 0)
	- 		l = -1;
	+ 		l = -1LL;
	  	return l;
	  }
 [rsc] --rw-rw-r-- M 320859 glenda sys 772 Oct 27 10:52 sys/src/libc/port/atexit.c
	/n/sourcesdump/2005/1027/plan9/sys/src/libc/port/atexit.c:3,14 - 
	/n/sourcesdump/2005/1028/plan9/sys/src/libc/port/atexit.c:3,16
	  
	  #define	NEXIT	33
	  
	- static Lock onexlock;
	- static struct
	- {
	+ typedef struct Onex Onex;
	+ struct Onex{
	  	void	(*f)(void);
	  	int	pid;
	- }onex[NEXIT];
	+ };
	+ 
	+ static Lock onexlock;
	+ Onex onex[NEXIT];
	  
	  atexit(void (*f)(void))
	  {
 [rsc] --rw-rw-r-- M 320859 glenda sys 30938 Oct 27 10:52 sys/src/libc/port/pool.c
	/n/sourcesdump/2005/1027/plan9/sys/src/libc/port/pool.c:435,440 - 
	/n/sourcesdump/2005/1028/plan9/sys/src/libc/port/pool.c:435,442
	  	sz += sizeof(Bhdr)+sizeof(Btail);
	  	if(sz < p->minblock)
	  		sz = p->minblock;
	+ 	if(sz < MINBLOCKSIZE)
	+ 		sz = MINBLOCKSIZE;
	  	sz = (sz+p->quantum-1)&~(p->quantum-1);
	  	return sz;
	  }
	/n/sourcesdump/2005/1027/plan9/sys/src/libc/port/pool.c:524,530 - 
	/n/sourcesdump/2005/1028/plan9/sys/src/libc/port/pool.c:526,532
	  	if(eq > q+4)
	  		eq = q+4;
	  	for(; q<eq; q++)
	- 		*q = datamagic[((ulong)q)%nelem(datamagic)];
	+ 		*q = datamagic[((ulong)(uintptr)q)%nelem(datamagic)];
	  
	  	return b;
	  }
	/n/sourcesdump/2005/1027/plan9/sys/src/libc/port/pool.c:834,840 - 
	/n/sourcesdump/2005/1028/plan9/sys/src/libc/port/pool.c:836,842
	  		if(eq > bq+4)
	  			eq = bq+4;
	  		for(q=bq; q<eq; q++){
	- 			if(*q != datamagic[((ulong)q)%nelem(datamagic)]){
	+ 			if(*q != datamagic[((uintptr)q)%nelem(datamagic)]){
	  				if(q == bq && *q == 0 && (p->flags & POOL_TOLERANCE)){
	  					printblock(p, b, "mem user overflow");
	  					continue;
	/n/sourcesdump/2005/1027/plan9/sys/src/libc/port/pool.c:962,969 - 
	/n/sourcesdump/2005/1028/plan9/sys/src/libc/port/pool.c:964,971
	  	Alloc *a;
	  	ulong *u;
	  
	- 	if((ulong)v&(sizeof(ulong)-1))
	- 		v = (char*)v - ((ulong)v&(sizeof(ulong)-1));
	+ 	if((uintptr)v&(sizeof(ulong)-1))
	+ 		v = (char*)v - ((uintptr)v&(sizeof(ulong)-1));
	  	u = v;
	  	while(u[-1] == ALIGN_MAGIC)
	  		u--;
	/n/sourcesdump/2005/1027/plan9/sys/src/libc/port/pool.c:1088,1094 - 
	/n/sourcesdump/2005/1028/plan9/sys/src/libc/port/pool.c:1090,1096
	  
	  	c = v;
	  	if(align){
	- 		off = (ulong)c%align;
	+ 		off = (uintptr)c%align;
	  		if(off != offset){
	  			c += offset - off;
	  			if(off > offset)
	/n/sourcesdump/2005/1027/plan9/sys/src/libc/port/pool.c:1133,1139 - 
	/n/sourcesdump/2005/1028/plan9/sys/src/libc/port/pool.c:1135,1141
	  	v = poolallocl(p, asize);
	  	if(v == nil)
	  		return nil;
	- 	if(span && (ulong)v/span != ((ulong)v+asize)/span){
	+ 	if(span && (uintptr)v/span != ((uintptr)v+asize)/span){
	  		/* try again */
	  		poolfreel(p, v);
	  		v = poolallocl(p, 2*asize);
	/n/sourcesdump/2005/1027/plan9/sys/src/libc/port/pool.c:1145,1154 - 
	/n/sourcesdump/2005/1028/plan9/sys/src/libc/port/pool.c:1147,1156
	  	 * figure out what pointer we want to return
	  	 */
	  	c = alignptr(v, align, offset);
	- 	if(span && (ulong)c/span != (ulong)(c+dsize-1)/span){
	- 		c += span - (ulong)c%span;
	+ 	if(span && (uintptr)c/span != (uintptr)(c+dsize-1)/span){
	+ 		c += span - (uintptr)c%span;
	  		c = alignptr(c, align, offset);
	- 		if((ulong)c/span != (ulong)(c+dsize-1)/span){
	+ 		if((uintptr)c/span != (uintptr)(c+dsize-1)/span){
	  			poolfreel(p, v);
	  			werrstr("cannot satisfy dsize %lud span %lud with align %lud+%ld", dsize, span, align, offset);
	  			return nil;
	/n/sourcesdump/2005/1027/plan9/sys/src/libc/port/pool.c:1455,1461 - 
	/n/sourcesdump/2005/1028/plan9/sys/src/libc/port/pool.c:1457,1463
	  	lp = v;
	  	elp = lp+size/4;
	  	while(lp < elp)
	- 		*lp++ = (sig<<24) ^ (long)v;
	+ 		*lp++ = (sig<<24) ^ (ulong)(uintptr)v;
	  	p = (uchar*)lp;
	  	ep = (uchar*)v+size;
	  	while(p<ep)

64-bit safety.
 [rsc] --rw-rw-r-- M 320859 glenda sys 9509 Oct 27 10:40 sys/src/cmd/9nfs/nfs.c
	/n/sourcesdump/2005/1027/plan9/sys/src/cmd/9nfs/nfs.c:138,144 - 
	/n/sourcesdump/2005/1028/plan9/sys/src/cmd/9nfs/nfs.c:138,144
	  		dp->uid = xf->uid;
	  		dp->gid = xf->uid;
	  		dp->muid = xf->uid;
	- 		dp->qid.path = (ulong)xf->uid;
	+ 		dp->qid.path = (uvlong)xf->uid;
	  		dp->qid.type = QTFILE;
	  		dp->qid.vers = 0;
	  		dp->mode = 0666;

64-bit safety.
 [rsc] --rw-rw-r-- M 320859 glenda sys 20275 Oct 27 10:39 sys/src/cmd/aux/apm.c
	/n/sourcesdump/2005/1027/plan9/sys/src/cmd/aux/apm.c:621,627 - 
	/n/sourcesdump/2005/1028/plan9/sys/src/cmd/aux/apm.c:621,627
	  };
	  
	  static int
	- fillstat(ulong path, Dir *d, int doalloc)
	+ fillstat(uvlong path, Dir *d, int doalloc)
	  {
	  	int i;
	  
	/n/sourcesdump/2005/1027/plan9/sys/src/cmd/aux/apm.c:713,719 - 
	/n/sourcesdump/2005/1028/plan9/sys/src/cmd/aux/apm.c:713,720
	  static void
	  rootread(Req *r)
	  {
	- 	int n, offset;
	+ 	int n;
	+ 	uvlong offset;
	  	char *p, *ep;
	  	Dir d;
	  
	/n/sourcesdump/2005/1027/plan9/sys/src/cmd/aux/apm.c:720,726 - 
	/n/sourcesdump/2005/1028/plan9/sys/src/cmd/aux/apm.c:721,727
	  	if(r->ifcall.offset == 0)
	  		offset = 0;
	  	else
	- 		offset = (int)r->fid->aux;
	+ 		offset = (uvlong)r->fid->aux;
	  
	  	p = r->ofcall.data;
	  	ep = r->ofcall.data+r->ifcall.count;

64-bit safety.
 [rsc] --rw-rw-r-- M 320859 glenda sys 25786 Oct 27 10:39 sys/src/cmd/aux/depend.c
	/n/sourcesdump/2005/1027/plan9/sys/src/cmd/aux/depend.c:616,622 - 
	/n/sourcesdump/2005/1028/plan9/sys/src/cmd/aux/depend.c:616,622
	  				err = Eexist;
	  				break;
	  			}
	- 			qid[nqid].path = (uint)dp;
	+ 			qid[nqid].path = (uvlong)dp;
	  			qid[nqid].vers = 0;
	  		}
	  		if(nqid == 0 && err == nil)
	/n/sourcesdump/2005/1027/plan9/sys/src/cmd/aux/depend.c:856,862 - 
	/n/sourcesdump/2005/1028/plan9/sys/src/cmd/aux/depend.c:856,862
	  					d.gid = "none";
	  					d.muid = "none";
	  					d.qid.type = QTFILE;
	- 					d.qid.path = (uint)dp;
	+ 					d.qid.path = (uvlong)dp;
	  					d.qid.vers = 0;
	  					d.length = f->df->file[dp->fno].tarlen;
	  					d.mode = 0444;
	/n/sourcesdump/2005/1027/plan9/sys/src/cmd/aux/depend.c:932,938 - 
	/n/sourcesdump/2005/1028/plan9/sys/src/cmd/aux/depend.c:932,938
	  		d.gid = "none";
	  		d.muid = "none";
	  		d.qid.type = QTFILE;
	- 		d.qid.path = (uint)dp;
	+ 		d.qid.path = (uvlong)dp;
	  		d.qid.vers = 0;
	  		d.length = f->df->file[dp->fno].tarlen;
	  		d.mode = 0444;

64-bit safety.
 [rsc] --rw-rw-r-- M 320859 glenda sys 19576 Oct 27 10:40 sys/src/cmd/eqn/eqn.c
	/n/sourcesdump/2005/1027/plan9/sys/src/cmd/eqn/eqn.c:268,274 - 
	/n/sourcesdump/2005/1028/plan9/sys/src/cmd/eqn/eqn.c:268,274
	  char*
	  yytokname(int yyc)
	  {
	- 	static char x[10];
	+ 	static char x[16];
	  
	  	if(yyc > 0 && yyc <= sizeof(yytoknames)/sizeof(yytoknames[0]))
	  	if(yytoknames[yyc-1])
	/n/sourcesdump/2005/1027/plan9/sys/src/cmd/eqn/eqn.c:280,286 - 
	/n/sourcesdump/2005/1028/plan9/sys/src/cmd/eqn/eqn.c:280,286
	  char*
	  yystatname(int yys)
	  {
	- 	static char x[10];
	+ 	static char x[16];
	  
	  	if(yys >= 0 && yys < sizeof(yystates)/sizeof(yystates[0]))
	  	if(yystates[yys])

Send credentials on post.
 [rsc] --rw-rw-r-- M 320859 glenda sys 25846 Oct 27 10:37 sys/src/cmd/hget.c
	/n/sourcesdump/2005/1027/plan9/sys/src/cmd/hget.c:389,394 - 
	/n/sourcesdump/2005/1028/plan9/sys/src/cmd/hget.c:389,396
	  					"Content-length: %d\r\n"
	  					"User-agent: Plan9/hget\r\n",
	  					u->page, u->host, strlen(u->postbody));
	+ 			if(u->cred)
	+ 				dfprint(fd, "Authorization: Basic %s\r\n", u->cred);
	  		}
	  		if(r->start != 0){
	  			dfprint(fd, "Range: bytes=%d-\n", r->start);

Handle lack of date.
 [rsc] --rw-rw-r-- M 320859 glenda sys 31401 Oct 27 10:38 sys/src/cmd/ip/imap4d/msg.c
	/n/sourcesdump/2005/1027/plan9/sys/src/cmd/ip/imap4d/msg.c:747,752 - 
	/n/sourcesdump/2005/1028/plan9/sys/src/cmd/ip/imap4d/msg.c:747,756
	  	s = (char*)headStr;
	  	if(date2tm(&tm, s) == nil)
	  		s = m->info[IUnixDate];
	+ 	if(s == nil){
	+ 		free(ss);
	+ 		goto bogus;
	+ 	}
	  	m->unixDate = estrdup(s);
	  	free(ss);
	  	return 1;

64-bit safety.
 [rsc] --rw-rw-r-- M 320859 glenda sys 2494 Oct 27 10:38 sys/src/cmd/tapefs/cpiofs.c
	/n/sourcesdump/2005/1027/plan9/sys/src/cmd/tapefs/cpiofs.c:112,118 - 
	/n/sourcesdump/2005/1028/plan9/sys/src/cmd/tapefs/cpiofs.c:112,118
	  doread(Ram *r, long off, long cnt)
	  {
	  
	- 	seek(tapefile, (long)r->data+off, 0);
	+ 	seek(tapefile, (vlong)r->data+off, 0);
	  	if (cnt>sizeof(dblock.tbuf))
	  		error("read too big");
	  	read(tapefile, dblock.tbuf, cnt);
 [rsc] --rw-rw-r-- M 320859 glenda sys 1940 Oct 27 10:38 sys/src/cmd/tapefs/tapfs.c
	/n/sourcesdump/2005/1027/plan9/sys/src/cmd/tapefs/tapfs.c:96,102 - 
	/n/sourcesdump/2005/1028/plan9/sys/src/cmd/tapefs/tapfs.c:96,102
	  {
	  	if (cnt>sizeof(buffer))
	  		print("count too big\n");
	- 	seek(tapefile, 512*(int)r->data+off, 0);
	+ 	seek(tapefile, 512*(vlong)r->data+off, 0);
	  	read(tapefile, buffer, cnt);
	  	return buffer;
	  }
 [rsc] --rw-rw-r-- M 320859 glenda sys 2014 Oct 27 10:38 sys/src/cmd/tapefs/tpfs.c
	/n/sourcesdump/2005/1027/plan9/sys/src/cmd/tapefs/tpfs.c:89,95 - 
	/n/sourcesdump/2005/1028/plan9/sys/src/cmd/tapefs/tpfs.c:89,95
	  {
	  	if (cnt>sizeof(buffer))
	  		print("count too big\n");
	- 	seek(tapefile, 512*(int)r->data+off, 0);
	+ 	seek(tapefile, 512*(vlong)r->data+off, 0);
	  	read(tapefile, buffer, cnt);
	  	return buffer;
	  }

Add -scroll, -noscroll.
 [rsc] --rwxrwxr-x M 320859 glenda sys 1839 Oct 27 11:08 rc/bin/window
	/n/sourcesdump/2005/1027/plan9/rc/bin/window:81,86 - 
	/n/sourcesdump/2005/1028/plan9/rc/bin/window:81,90
	  					shift 2
	  				case -r
	  					shift 5
	+ 				case -scroll
	+ 					shift
	+ 				case -noscroll
	+ 					shift
	  				case -hide
	  					shift
	  				}
 [rsc] --rw-rw-r-- M 320859 glenda sys 14707 Oct 27 11:08 sys/man/1/rio
	/n/sourcesdump/2005/1027/plan9/sys/man/1/rio:50,55 - 
	/n/sourcesdump/2005/1028/plan9/sys/man/1/rio:50,59
	  ] [
	  .B -hide
	  ] [
	+ .B -scroll
	+ ] [
	+ .B -noscroll
	+ ] [
	  .I cmd
	  .I arg ...
	  ]
	/n/sourcesdump/2005/1027/plan9/sys/man/1/rio:120,132 - 
	/n/sourcesdump/2005/1028/plan9/sys/man/1/rio:124,145
	  .RB ( minx ,
	  .BR miny ,
	  .BR maxx ,
	- .BR maxy ;
	- .BR hide
	- causes the window to be created off-screen); and working directory
	- .RB ( cd ).
	+ .BR maxy );
	  the units are pixels with the
	  upper left corner of the screen at (0, 0).
	- The optional command and arguments define which program to run in the window.
	+ The
	+ .B hide
	+ option causes the window to be created off-screen.
	+ The
	+ .B scroll
	+ and
	+ .B noscroll
	+ options set the scroll mode.
	+ The
	+ .B cd
	+ option sets the working directory.
	+ The optional command and arguments 
	+ define which program to run in the window.
	  .PP
	  By default,
	  .I window

Add pop-up menu in lens.
 [rsc] --rw-rw-r-- M 320859 glenda sys 1272 Oct 27 11:11 sys/man/1/lens
	/n/sourcesdump/2005/1027/plan9/sys/man/1/lens:37,42 - 
	/n/sourcesdump/2005/1028/plan9/sys/man/1/lens:37,44
	  To make counting pixels easier, typing a
	  .B g
	  toggles whether a checkerboard grid is imposed on the magnified area.
	+ .PP
	+ Button 3 brings up a menu of actions.
	  .SH SOURCE
	  .B /sys/src/cmd/lens.c
	  .SH BUGS
 [rsc] --rw-rw-r-- M 320859 glenda sys 5109 Oct 27 11:10 sys/src/cmd/lens.c
	/n/sourcesdump/2005/1027/plan9/sys/src/cmd/lens.c:8,13 - 
	/n/sourcesdump/2005/1028/plan9/sys/src/cmd/lens.c:8,36
	  	Maxmag = 16
	  };
	  
	+ enum {
	+ 	Mzoom,
	+ 	Munzoom,
	+ 	Mgrid,
	+ 	Mredraw,
	+ 	Mexit
	+ };
	+ 
	+ char *menustr[] = {
	+ 	"zoom",
	+ 	"unzoom",
	+ 	"grid",
	+ 	"redraw",
	+ 	"exit",
	+ 	nil
	+ };
	+ 
	+ Menu menu = {
	+ 	menustr,
	+ 	nil,
	+ 	-1
	+ };
	+ 
	  Point lastp;
	  Image *red;
	  Image *tmp;
	/n/sourcesdump/2005/1027/plan9/sys/src/cmd/lens.c:86,95 - 
	/n/sourcesdump/2005/1028/plan9/sys/src/cmd/lens.c:109,121
	  		case Ekeyboard:
	  			switch(e.kbdc){
	  			case 'q':
	+ 			case 0x7f:
	  			case '\04':
	+ 			caseexit:
	  				exits(nil);
	  			case '=':
	  			case '+':
	+ 			casezoom:
	  				if(mag < Maxmag){
	  					mag++;
	  					makegrid();
	/n/sourcesdump/2005/1027/plan9/sys/src/cmd/lens.c:97,102 - 
	/n/sourcesdump/2005/1028/plan9/sys/src/cmd/lens.c:123,129
	  				}
	  				break;
	  			case 'g':
	+ 			casegrid:
	  				showgrid = !showgrid;
	  				makegrid();
	  				drawit();
	/n/sourcesdump/2005/1027/plan9/sys/src/cmd/lens.c:103,108 - 
	/n/sourcesdump/2005/1028/plan9/sys/src/cmd/lens.c:130,136
	  				break;
	  			case '-':
	  			case '_':
	+ 			caseunzoom:
	  				if(mag > 1){
	  					mag--;
	  					makegrid();
	/n/sourcesdump/2005/1027/plan9/sys/src/cmd/lens.c:111,116 - 
	/n/sourcesdump/2005/1028/plan9/sys/src/cmd/lens.c:139,145
	  				break;
	  			case '.':
	  			case ' ':
	+ 			caseredraw:
	  				drawit();
	  				break;
	  			case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case'0':
	/n/sourcesdump/2005/1027/plan9/sys/src/cmd/lens.c:121,134 - 
	/n/sourcesdump/2005/1028/plan9/sys/src/cmd/lens.c:150,174
	  				drawit();
	  				break;
	  			}
	- 			if(e.kbdc == 'q' || e.kbdc == '\04')
	- 				exits(nil);
	  			break;
	  		case Emouse:
	- 			if(e.mouse.buttons){
	+ 			if(e.mouse.buttons & 1){
	  				lastp = e.mouse.xy;
	  				drawit();
	  			}
	+ 			if(e.mouse.buttons & 4)
	+ 				switch(emenuhit(3, &e.mouse, &menu)){
	+ 				case Mzoom:
	+ 					goto casezoom;
	+ 				case Munzoom:
	+ 					goto caseunzoom;
	+ 				case Mgrid:
	+ 					goto casegrid;
	+ 				case Mredraw:
	+ 					goto caseredraw;
	+ 				case Mexit:
	+ 					goto caseexit;
	+ 				}
	  			break;
	  		}
	  }

Don't take over the screen if there's no window manager.
 [rsc] --rw-rw-r-- M 320859 glenda sys 15984 Oct 27 11:09 sys/src/cmd/auth/factotum/fgui.c
	/n/sourcesdump/2005/1027/plan9/sys/src/cmd/auth/factotum/fgui.c:76,82 - 
	/n/sourcesdump/2005/1028/plan9/sys/src/cmd/auth/factotum/fgui.c:76,83
	  	ARGBEGIN{
	  	}ARGEND;
	  
	- 	newwindow("-hide");
	+ 	if(newwindow("-hide") < 0)
	+ 		sysfatal("newwindow: %r");
	  
	  	fmtinstall('A', _attrfmt);
	  


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].