Subject: changes to sam

From: "ozan s. yigit" <[email-masked]>
Date: Sat, 3 Aug 1996 02:40:00 -0400

> there are several other bug patches for sam in
> the boddle package available by anonymous
> ftp at plan9.att.com in plan9/update/cmd/sam/829146783.rc.

here is a version that patch understands, so somewhat easier
to extract and apply:

*** cmd.c.orig	Sat Aug  3 02:08:53 1996
--- cmd.c	Sat Aug  3 02:09:23 1996
***************
*** 220,223 ****
--- 220,226 ----
  		    (ocurfile!=curfile || (!loaded && curfile->state!=Unread)))
  			outTs(Hcurrent, curfile->tag);
+ 			/* don't allow type ahead on files that aren't bound */
+ 		if(downloaded && curfile && curfile->rasp == 0)
+ 			terminp = termoutp;
  	}
  }
*** mesg.c.orig	Sat Aug  3 02:08:52 1996
--- mesg.c	Sat Aug  3 02:09:23 1996
***************
*** 257,260 ****
--- 257,261 ----
  
  	case Tstartfile:
+ 		termlocked++;
  		f = whichfile(inshort());
  		if(!f->rasp)	/* this might be a duplicate message */
***************
*** 264,268 ****
  		outTs(Hcurrent, f->tag);
  		journaln(0, f->tag);
- 		termlocked++;
  		if(f->state == Unread)
  			load(f);
--- 265,268 ----
***************
*** 447,454 ****
  		c = 0;
  		i = 0;
! 		rp = malloc((snarfbuf->nrunes)*sizeof(Rune));
  		if(rp){
! 			Bread(snarfbuf, rp, snarfbuf->nrunes, 0);
! 			c = Strtoc(tmprstr(rp, snarfbuf->nrunes));
  			free(rp);
  			i = strlen(c);
--- 447,459 ----
  		c = 0;
  		i = 0;
! 		m = snarfbuf->nrunes;
! 		if(m > 32000) {		/* tmprstr stores len in a short */
! 			m = 32000;
! 			dprint("?warning: snarf buffer truncated\n");
! 		}
! 		rp = malloc(m*sizeof(Rune));
  		if(rp){
! 			Bread(snarfbuf, rp, m, 0);
! 			c = Strtoc(tmprstr(rp, m));
  			free(rp);
  			i = strlen(c);
*** sam.c.orig	Sat Aug  3 02:08:50 1996
--- sam.c	Sat Aug  3 02:09:24 1996
***************
*** 304,309 ****
  		if(f==cmd)	/* cmd gets done in main() */
  			continue;
! 		if(f->deleted)
  			delete(f);
  		if(f->mod==modnum && Fupdate(f, FALSE, downloaded))
  			anymod++;
--- 304,311 ----
  		if(f==cmd)	/* cmd gets done in main() */
  			continue;
! 		if(f->deleted) {
  			delete(f);
+ 			continue;
+ 		}
  		if(f->mod==modnum && Fupdate(f, FALSE, downloaded))
  			anymod++;
*** xec.c.orig	Sat Aug  3 02:08:50 1996
--- xec.c	Sat Aug  3 02:09:24 1996
***************
*** 28,36 ****
  		load(f);
  	if(f==0 && (cp->addr==0 || cp->addr->type!='"') &&
! 	    !utfrune("bBnqUXY!{", cp->cmdc) &&
  	    cp->cmdc!=('c'|0x100) && !(cp->cmdc=='D' && cp->ctext))
  		error(Enofile);
  	i = lookup(cp->cmdc);
! 	if(cmdtab[i].defaddr != aNo){
  		if((ap=cp->addr)==0 && cp->cmdc!='\n'){
  			cp->addr = ap = newaddr();
--- 28,36 ----
  		load(f);
  	if(f==0 && (cp->addr==0 || cp->addr->type!='"') &&
! 	    !utfrune("bBnqUXY!", cp->cmdc) &&
  	    cp->cmdc!=('c'|0x100) && !(cp->cmdc=='D' && cp->ctext))
  		error(Enofile);
  	i = lookup(cp->cmdc);
! 	if(i >= 0 && cmdtab[i].defaddr != aNo){
  		if((ap=cp->addr)==0 && cp->cmdc!='\n'){
  			cp->addr = ap = newaddr();

---

From: [email-masked] (Arnold D. Robbins)
Date: Wed, 7 Aug 1996 06:31:00 -0400

> here is a version that patch understands, so somewhat easier

Bobf has kindly packaged up a fresh distribution. It's at the
usual place, ftp://netlib.bell-labs.com/research/dist/sam.shar.Z
(or something close, that's from memory).

I'm running it now.

Arnold Robbins -- The Basement Computer		| Laundry increases
Internet: [email-masked]		| exponentially in the
UUCP:	emory!skeeve!arnold			| number of children.
Bitnet:	Forget it. Get on a real network.	|    -- Miriam Robbins

---

From: "Alistair G. Crooks" <[email-masked]>
Date: Wed, 7 Aug 1996 12:44:28 -0400

> (or something close, that's from memory).

At the risk of seeming retentive in the bottom department, the URL is
ftp://netlib.bell-labs.com/netlib/research/sam.shar.Z

Looks like there's also a fairly new awk bundle there too.

Alistair

---

From: [email-masked] (Arnold D. Robbins)
Date: Sun, 11 Aug 1996 22:53:00 -0400

> Looks like there's also a fairly new awk bundle there too.

Yes, the awk is bwk's latest. Has a number of minor but useful
gawk extensions in it, many of which I motivated bwk to include. :-)