9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] sam hacking - a couple of fixes that may apply to plan9 version...
@ 2003-07-03 15:47 Derek Fawcus
  2003-07-03 16:08 ` boyd, rounin
  0 siblings, 1 reply; 5+ messages in thread
From: Derek Fawcus @ 2003-07-03 15:47 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 1681 bytes --]

Because of the RTT to some of the machines I have to edit code on,
I decided to dig out the copy of sam I downloaded a few years ago,
and get it going again. [1]

As part of this I did a few hacks,  the main one being ripping out the
code in sam that plumbs together the io between samterm and sam,  moving
it into a seperate stub starter - just 'cause I want to play some games
with the startup sequence when using SSH - anyone interested in these?

The other hack (for the moment) is removing the '\n' appended to the
use of the 'Send' menu choice.  I find it more useful without the
newline - does anyone actually find it useful with the newline?

I also noticed what appears to be a couple of bugs in the use of tmpcstr()
and freetmpstr().  I've had a glance at my copy of the 3rd ed. plan 9
sources,  and these still appear to be there (one incorrectly fixed),
but since I've not looked at the 4th ed. source yet,  I don't know if
they still applies.

So I have diffs against the old netlib version,  which probably aren't of
much interest and the following (hand hacked) diffs which may well
apply to the plan 9 version.  If someone want's to patch the unix
netlib version,  then it may be of help to some other people...

One of these days,  I really should get a copy of plan 9 running on a
machine to try it out...

DF

[1] I also grabbed the latest 1998 copy from netlib to compare,  and
    apart from changing a bunch of copyright lines (advancing 6 years)
    from AT&T -> Lucent,  not much seems to have been altered.

    Mind - as a red rag to the licencing wags - the licence for the
    netlib verison of sam is very liberal...

[-- Attachment #2: sam-freetmpstr.diff --]
[-- Type: text/plain, Size: 974 bytes --]

diff -ru5p sam/error.c sam-host/error.c
--- sam/error.c	Fri Jun 27 23:03:54 2003
+++ sam-host/error.c	Wed Jul  2 01:02:07 2003
@@ -125,8 +120,9 @@ termwrite(char *s)
 		if(cmd)
 			loginsert(cmd, cmdpt, p->s, p->n);
 		else
 			Strinsert(&cmdstr, p, cmdstr.n);
 		cmdptadv += p->n;
-		free(p);
+		freetmpstr(p);
 	}else
 		Write(2, s, strlen(s));
 }
diff -ru5p sam/mesg.c sam-host/mesg.c
--- sam/mesg.c	Thu Jul  3 12:00:08 2003
+++ sam-host/mesg.c	Thu Jul  3 14:11:27 2003
@@ -392,12 +400,15 @@ inmesg(Tmesg type)
 		journaln(0, p0);
 		journaln(0, p1);
 		setgenstr(f, p0, p1);
 		for(l = 0; l<genstr.n; l++){
 			i = genstr.s[l];
-			if(utfrune(".*+?(|)\\[]^$", i))
-				Strinsert(&genstr, tmpcstr("\\"), l++);
+			if(utfrune(".*+?(|)\\[]^$", i)) {
+				str = tmpcstr("\\");
+				Strinsert(&genstr, str, l++);
+				freetmpstr(str);
+			}
 		}
 		Straddc(&genstr, '\0');
 		nextmatch(f, &genstr, p1, 1);
 		moveto(f, sel.p[0]);
 		break;

[-- Attachment #3: sam-send.diff --]
[-- Type: text/plain, Size: 578 bytes --]

diff -ru5p sam/mesg.c sam-host/mesg.c
--- sam/mesg.c	Thu Jul  3 12:00:08 2003
+++ sam-host/mesg.c	Thu Jul  3 14:11:27 2003
@@ -419,12 +430,14 @@ inmesg(Tmesg type)
 		p1 = inlong();
 		setgenstr(cmd, p0, p1);
 		Bdelete(snarfbuf, (Posn)0, snarfbuf->nrunes);
 		Binsert(snarfbuf, &genstr, (Posn)0);
 		outTl(Hsnarflen, genstr.n);
+#if 0
 		if(genstr.s[genstr.n-1] != '\n')
 			Straddc(&genstr, '\n');
+#endif
 		Finsert(cmd, &genstr, cmd->nrunes);
 		Fupdate(cmd, FALSE, TRUE);
 		cmd->dot.r.p1 = cmd->dot.r.p2 = cmd->nrunes;
 		telldot(cmd);
 		termcommand();

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-07-04  8:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-03 15:47 [9fans] sam hacking - a couple of fixes that may apply to plan9 version Derek Fawcus
2003-07-03 16:08 ` boyd, rounin
2003-07-03 16:43   ` rob pike, esq.
2003-07-03 19:36     ` Tad Hunt
2003-07-04  8:59       ` [9fans] sam hacking - a couple of fixes that may apply to plan9 Douglas A. Gwyn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).