Richard Miller | 31 May 11:02 2016

9pi image

At long last the SDcard image in /n/sources/contrib/miller/9pi.img.gz
is up to date.  Besides having support for Raspberry Pi 3 and Zero, it
is now much more robust running on multiple cores, and includes new
interfaces for GPIO, SPI and I2C devices thanks to Brian Stuart and
Vita Nuova.

As well as the bcm-specific kernel changes (which can also be found in
/n/sources/contrib/miller/9/bcm), I've applied a few essential fixes
from /n/sources/patch:

armv7-atomic
libsec-x509-sha256rsa
maybe/usb-short-desc
pread-offset
proc-smp-fixes
ramfs-fixes
segment-overlap
usbether-rpi
usbserial-ftdi-writelen

kokamoto | 31 May 10:53 2016
Picon

etheryuk.c for Marvell 88E8036?

I'm now facing a serious problem to use 88E8036 rev 16 chip (11ab/4351)
on Sony VAIO F-type notebook.

Adding the device ID above, I can read data without problem.
However, to transmit a larger (say 2500 bytes) data, it hangs up.

For an example, cat <larger than say, 2500byte file) >test in the
network booted terminal without local disk.

The chips shows pci data as:
11ab/4351 5 0:fc200004 16384 2:00005001 256

The chip c->type is Yukfe, and c->rev=1, c->feat=0.

When I look the linux source, it says the chip is SKY2_HW_RSS_BROKEN,
and intentionally gave up to solve this in the kernel layer...

Have you any suggestion, eric?

Kenji

trebol55555 | 31 May 03:34 2016
Picon

Chords, ^, _, ^B and scroll with mouse wheel in p9p sam

I posted wrong code for Plan 9 by error.

The E script:
-----------------
#!/bin/rc

files=()
dest=()

if(~ $#* 0){
	echo usage: E file ... >[1=2]
	exit usage
}

for(i)
	switch($i){
	case /*
		files = ( $files $i )
	case *
		files = ( $files `{cleanname `{pwd}^/$i} )
	}

if(test -f /mnt/term/srv/sam.$user) dest = /mnt/term/srv/sam.$user
if not if(test -f /srv/sam.$user) dest = /srv/sam.$user
if not {
	switch($files){
	case *:*
		for(i in $files){
			fi = `{echo $i | sed 's/(.*):[^:]*/\1/'}
			ad = `{echo $i | sed 's/.*:([^:]*)/\1/'}
(Continue reading)

Brian L. Stuart | 29 May 21:24 2016
Picon

Re: More about /dev/draw

I'll try to answer several questions here together.

> I see an image at bell labs for the raspberry pi. 
> http://plan9.bell-labs.com/sources/contrib/miller/9pi.img.gz
>
> I see that there are Raspberry Pi 2 Model Bs and Raspberry Pi 3 Model Bs 
> for sale. Will either one work with that image?

I might be mistaken, but I don't thnk that image has the few little
changes necessary for the Pi3.  The kernel file contrib/miller/9pi2
might have the update, but the sources in contrib/miller/9/bcm
are the most current.

> Do you suppose Pi 3 may have fixed the 'sub driver' bugs? What's a 'sub 
> driver'? not 'usb driver', or is it? The audio out is broken, but it's 
> your fault? How is that?

Feel free to correct me, Steve, if I get anything wrong here.  I think it
was a typo referring to USB.  I'm not sure if it's the same one that's
causing problems with serial adapters, but I've run into one that I
keep intending to track down when I've tried to use USB 802.11
adapters.  As for the audio, I'm pretty sure it's the same position many
of us are in.  We intend to do some work on supporting it, but in the
words of the late Prince, this thing we call life gets in the way.

> Actually, looking at the back of the monitor, it has an analog vga 
> plug-in and a similar sized digital plug-in, but no HDMI. Can I still 
> use it with Raspberry Pi Plan 9?

As trebol said, if it's a DVI interface, then a simple adapter from HDMI
(Continue reading)

jfmxl | 29 May 08:32 2016

rio on plan 9 from user space

On another tack ... I have installed plan 9 from user space on my debian 
machine, and sam and acme seem to open and work ok. But when I type rio, 
I get ...

$ rio
rio: it looks like there's already a window manager running;  rio not 
started

So, rio under plan 9 from user space (p9port?) wants the the whole 
display?

I cannot run xfce and have rio in a window?

I am trying to communicate with a plan 9 cpu, but drawterm seems slow 
and awkward.

Are there any plan 9 installations open to people like myself to 'try 
out'?

Roswell Grey | 28 May 22:18 2016
Picon

Plan 9 article in hacker magazine!

2600 is a hacker's quarterly magazine that specializes in sharing subtle tips and tricks related to computer hacking. Volume 33, issue 1, however, featured something that was pleasent to read: an article on Plan 9. It describes what it is, how it came to be, how it differs from other OS's, and how to get it. It's a basic introduction to 9 that most of us already know about, but nonetheless I wanted to share it with you all to show that there's still a very strong interest in the OS. And with this article, perhaps it'll gain a little more! Thanks for reading. Definitely pick up a copy of 2600 if you have the chance!

Dave MacFarlane | 28 May 19:23 2016
Picon

More about /dev/draw

Either I'm going insane, the default Plan 9 /dev/draw in-memory implementation
doesn't implement draw(3), or possibly both.

When I do the following, it works as expected under both drawterm and a locally mounted instance:
1. Allocate a screen with an 'A' message
2. Allocate an image on the screen of the same size as /dev/wctl  with a 'b' message
3. Draw the image over the window with a 'd' message
4. Flush the buffer with 'v'

When I do the following, it works under drawterm, but not with a local /dev/draw implementation:
Steps 1-2 above
3. Allocate another image of some arbitrary fill colour with 'b' (with or without the repl bit)
4a. (Optional, doesn't seem to make a difference) set the compositing operator with 'O'
4b. Draw the new image over a portion of the window image from step 2 with 'd'
5. Go to step 3-4 from the first variation.

(I don't have a 9front instance to test on.)

On the other hand, replacing a portion of the image from step 2 with 'y' works under either. (I haven't gotten around to using 'Y' when appropriate yet.)


to work under drawterm.

The end result is that under a local Plan 9 instance the basic sample shiny test looks like this:


Instead of this:


Does anyone have any pointers? I don't have much access to a physical Plan 9 machine, so I'm having trouble debugging this since it works under drawterm (or perhaps is buggy under drawterm in a way that makes it seem like it's working..)

It would also potentially be helpful if someone who uses Go under 9front could let me know how x/exp/shiny/examples/basic looks with the shiny driver in that branch, but I'm not sure that it matters since it'll most likely be the same as one of the above..

- Dave
trebol55555 | 27 May 19:11 2016
Picon

Chords, ^, _, ^B and scroll with mouse wheel in p9p sam

flselect() must be changed in samterm/flayer.c to get the double click
selection working ok.

Anyone has hacked sam to use both the plumber and the pipe?

trebol.

diff -rpuN src/cmd/sam/cmd.c sam/cmd.c
--- src/cmd/sam/cmd.c	2016-04-18 19:07:22.000000000 +0100
+++ sam/cmd.c	2016-05-25 23:56:34.040909362 +0100
 <at>  <at>  -35,6 +35,8  <at>  <at>  struct cmdtab cmdtab[]={
 	'>',	0,	0,	0,	0,	aDot,	0,	linex,	plan9_cmd,
 	'<',	0,	0,	0,	0,	aDot,	0,	linex,	plan9_cmd,
 	'|',	0,	0,	0,	0,	aDot,	0,	linex,	plan9_cmd,
+	'^',	0,	0,	0,	0,	aDot,	0,	linex,	plan9_cmd,
+	'_',	0,	0,	0,	0,	aDot,	0,	linex,	plan9_cmd,
 	'=',	0,	0,	0,	0,	aDot,	0,	linex,	eq_cmd,
 	'c'|0x100,0,	0,	0,	0,	aNo,	0,	wordx,	cd_cmd,
 	0,	0,	0,	0,	0,	0,	0,	0
 <at>  <at>  -76,7 +78,13  <at>  <at>  inputc(void)

     Again:
 	nbuf = 0;
-	if(downloaded){
+	if(cmdbufpos > cmdbuf.nc && cmdbuf.nc > 0){
+		cmdbufpos = 0;
+		bufreset(&cmdbuf);
+	}
+	if(cmdbufpos < cmdbuf.nc && cmdbuf.nc > 0)
+		bufread(&cmdbuf, cmdbufpos++, &r, 1);
+	else if(downloaded){
 		while(termoutp == terminp){
 			cmdupdate();
 			if(patset)
diff -rpuN src/cmd/sam/sam.h sam/sam.h
--- src/cmd/sam/sam.h	2016-04-18 19:07:22.000000000 +0100
+++ sam/sam.h	2016-05-25 23:45:05.652931784 +0100
 <at>  <at>  -369,6 +369,8  <at>  <at>  extern int	quitok;
 extern Address	addr;
 extern Buffer	snarfbuf;
 extern Buffer	plan9buf;
+extern Buffer	cmdbuf;
+extern int	cmdbufpos;
 extern List	file;
 extern List	tempfile;
 extern File	*cmd;
diff -rpuN src/cmd/sam/shell.c sam/shell.c
--- src/cmd/sam/shell.c	2016-04-18 19:07:22.000000000 +0100
+++ sam/shell.c	2016-05-25 23:46:25.262692361 +0100
 <at>  <at>  -6,6 +6,8  <at>  <at>  extern	jmp_buf	mainloop;
 char	errfile[64];
 String	plan9cmd;	/* null terminated */
 Buffer	plan9buf;
+Buffer	cmdbuf;
+int	cmdbufpos;
 void	checkerrs(void);

 void
 <at>  <at>  -40,7 +42,7  <at>  <at>  plan9(File *f, int type, String *s, int
 	}
 	if(type!='!' && pipe(pipe1)==-1)
 		error(Epipe);
-	if(type=='|')
+	if(type=='|' || type=='_')
 		snarf(f, addr.r.p1, addr.r.p2, &plan9buf, 1);
 	if((pid=fork()) == 0){
 		setname(f);
 <at>  <at>  -61,14 +63,14  <at>  <at>  plan9(File *f, int type, String *s, int
 			}
 		}
 		if(type != '!') {
-			if(type=='<' || type=='|')
-				dup(pipe1[1], 1);
-			else if(type == '>')
+			if(type == '>')
 				dup(pipe1[0], 0);
+			else
+				dup(pipe1[1], 1);
 			close(pipe1[0]);
 			close(pipe1[1]);
 		}
-		if(type == '|'){
+		if(type == '|' || type == '_'){
 			if(pipe(pipe2) == -1)
 				exits("pipe");
 			if((pid = fork())==0){
 <at>  <at>  -100,7 +102,7  <at>  <at>  plan9(File *f, int type, String *s, int
 			close(pipe2[0]);
 			close(pipe2[1]);
 		}
-		if(type=='<'){
+		if(type=='<' || type=='^'){
 			close(0);	/* so it won't read from terminal */
 			open("/dev/null", 0);
 		}
 <at>  <at>  -128,9 +130,14  <at>  <at>  plan9(File *f, int type, String *s, int
 		writeio(f);
 		bpipeok = 0;
 		closeio((Posn)-1);
+	}else if(type == '^' || type == '_'){
+		int nulls;
+		close(pipe1[1]);
+		bufload(&cmdbuf, cmdbufpos, pipe1[0], &nulls);
+		close(pipe1[0]);
 	}
 	retcode = waitfor(pid);
-	if(type=='|' || type=='<')
+	if(type=='|' || type=='<' || type=='_' || type=='^')
 		if(retcode!=0)
 			warn(Wbadstatus);
 	if(downloaded)
diff -rpuN src/cmd/samterm/main.c samterm/main.c
--- src/cmd/samterm/main.c	2016-04-18 19:07:22.000000000 +0100
+++ samterm/main.c	2016-05-26 16:12:12.452556184 +0100
 <at>  <at>  -23,11 +23,8  <at>  <at>  long	modified = 0;		/* strange lookahead
 char	hostlock = 1;
 char	hasunlocked = 0;
 int	maxtab = 8;
-int	chord;
 int	autoindent;

-#define chording 0	/* code here for reference but it causes deadlocks */
-
 void
 notifyf(void *a, char *msg)
 {
 <at>  <at>  -39,7 +36,7  <at>  <at>  notifyf(void *a, char *msg)
 void
 threadmain(int argc, char *argv[])
 {
-	int i, got, scr, w;
+	int i, got, scr, chord, w;
 	Text *t;
 	Rectangle r;
 	Flayer *nwhich;
 <at>  <at>  -85,6 +82,7  <at>  <at>  threadmain(int argc, char *argv[])

 	got = 0;
 	if(protodebug) print("loop\n");
+	chord = 0;
 	for(;;got = waitforio()){
 		if(hasunlocked && RESIZED())
 			resize();
 <at>  <at>  -108,19 +106,32  <at>  <at>  threadmain(int argc, char *argv[])
 				continue;
 			}
 			nwhich = flwhich(mousep->xy);
-			scr = which && ptinrect(mousep->xy, which->scroll);
+			scr = which && (ptinrect(mousep->xy, which->scroll) ||
+				mousep->buttons&(8|16));
 			if(mousep->buttons)
 				flushtyping(1);
-			if(chording && chord==1 && !mousep->buttons)
+			if((mousep->buttons&1)==0)
 				chord = 0;
-			if(chording && chord)
+			if(chord && which && which==nwhich){
 				chord |= mousep->buttons;
-			else if(mousep->buttons&1){
+				t = (Text *)which->user1;
+				if(!t->lock){
+					w = which-t-≥l;
+					if(chord&2){
+						cut(t, w, 1, 1);
+						chord &= ~2;
+					}
+					if(chord&4){
+						paste(t, w);
+						chord &= ~4;
+					}
+				}
+			}else if(mousep->buttons&(1|8)){
 				if(nwhich){
 					if(nwhich!=which)
 						current(nwhich);
 					else if(scr)
-						scroll(which, 1);
+						scroll(which, (mousep->buttons&8) ? 4 : 1);
 					else{
 						t=(Text *)which->user1;
 						if(flselect(which)){
 <at>  <at>  -137,27 +148,14  <at>  <at>  threadmain(int argc, char *argv[])
 					scroll(which, 2);
 				else
 					menu2hit();
-			}else if((mousep->buttons&4)){
+			}else if(mousep->buttons&(4|16)){
 				if(scr)
-					scroll(which, 3);
+					scroll(which, (mousep->buttons&16) ? 5 : 3);
 				else
 					menu3hit();
 			}
 			mouseunblock();
 		}
-		if(chording && chord){
-			t = (Text*)which->user1;
-			if(!t->lock && !hostlock){
-				w = which-t-≥l;
-				if(chord&2){
-					cut(t, w, 1, 1);
-					chord &= ~2;
-				}else if(chord&4){
-					paste(t, w);
-					chord &= ~4;
-				}
-			}
-		}
 	}
 }

 <at>  <at>  -497,6 +495,7  <at>  <at>  flushtyping(int clearesc)
 #define	CUT	(Kcmd+'x')
 #define	COPY	(Kcmd+'c')
 #define	PASTE	(Kcmd+'v')
+#define	Kstx	0x02

 int
 nontypingkey(int c)
 <at>  <at>  -512,6 +511,7  <at>  <at>  nontypingkey(int c)
 	case PAGEUP:
 	case RIGHTARROW:
 	case SCROLLKEY:
+	case Kstx:
 		return 1;
 	}
 	if(c >= Kcmd)
 <at>  <at>  -669,6 +669,15  <at>  <at>  type(Flayer *l, int res)	/* what a blood
 				}
 			}
 		}
+	}else if(c == Kstx){
+		t = &cmd;
+		for(l=t->l; l->textfn==0; l++)
+			;
+		current(l);
+		flushtyping(0);
+		a = t->rasp.nrunes;
+		flsetselect(l, a, a);
+		center(l, a);
 	}else{
 		if(c==ESC && typeesc>=0){
 			l->p0 = typeesc;
diff -rpuN src/cmd/samterm/scroll.c samterm/scroll.c
--- src/cmd/samterm/scroll.c	2016-04-18 19:07:22.000000000 +0100
+++ samterm/scroll.c	2016-05-26 02:07:31.922977720 +0100
 <at>  <at>  -115,7 +115,7  <at>  <at>  scroll(Flayer *l, int but)
 	draw(scrback, Rect(0,0,Dx(l->scroll), Dy(l->scroll)), l->f.b, nil, l->scroll.min);
 	do{
 		oin = in;
-		in = abs(x-mousep-≥xy.x)<=FLSCROLLWID(l)/2;
+		in = (but > 3) || (but == 2) || abs(x-mousep-≥xy.x)<=FLSCROLLWID(l)/2;
 		if(oin && !in)
 			scrunmark(l, r);
 		if(in){
 <at>  <at>  -126,9 +126,7  <at>  <at>  scroll(Flayer *l, int but)
 				my = s.min.y;
 			if(my >= s.max.y)
 				my = s.max.y;
-			if(!eqpt(mousep->xy, Pt(x, my)))
-				moveto(mousectl, Pt(x, my));
-			if(but == 1){
+			if(but == 1 || but == 4){
 				p0 = l->origin-frcharofpt(&l->f, Pt(s.max.x, my));
 				rt = scrpos(l->scroll, p0, p0+l->f.nchars, tot);
 				y = rt.min.y;
 <at>  <at>  -136,7 +134,7  <at>  <at>  scroll(Flayer *l, int but)
 				y = my;
 				if(y > s.max.y-2)
 					y = s.max.y-2;
-			}else if(but == 3){
+			}else if(but == 3 || but == 5){
 				p0 = l->origin+frcharofpt(&l->f, Pt(s.max.x, my));
 				rt = scrpos(l->scroll, p0, p0+l->f.nchars, tot);
 				y = rt.min.y;
 <at>  <at>  -147,19 +145,21  <at>  <at>  scroll(Flayer *l, int but)
 				scrmark(l, r);
 			}
 		}
-	}while(button(but));
+	}while(but <= 3 && button(but));
 	if(in){
 		h = s.max.y-s.min.y;
 		scrunmark(l, r);
 		p0 = 0;
-		if(but == 1)
+		if(but == 1 || but == 4){
+			but = 1;
 			p0 = (long)(my-s.min.y)/l->f.font->height+1;
-		else if(but == 2){
+		}else if(but == 2){
 			if(tot > 1024L*1024L)
 				p0 = ((tot>>10)*(y-s.min.y)/h)<<10;
 			else
 				p0 = tot*(y-s.min.y)/h;
-		}else if(but == 3){
+		}else if(but == 3 || but == 5){
+			but = 3;
 			p0 = l->origin+frcharofpt(&l->f, Pt(s.max.x, my));
 			if(p0 > tot)
 				p0 = tot;
diff -rpuN src/cmd/samterm/flayer.c samterm/flayer.c
--- src/cmd/samterm/flayer.c	2016-05-27 17:46:30.431425669 +0100
+++ samterm/flayer.c	2016-04-18 19:07:22.000000000 +0100
 <at>  <at>  -254,21 +254,18  <at>  <at>  fldelete(Flayer *l, long p0, long p1)
 int
 flselect(Flayer *l)
 {
-	int ret;
 	if(l->visible!=All)
 		flupfront(l);
-	frselect(&l->f, mousectl);
-	ret = 0;
-	if(l->f.p0==l->f.p1){
-		if(mousep->msec-l-≥click<Clicktime && l->f.p0+l->origin==l->p0){
-			ret = 1;
+	if(l->f.p0==l->f.p1)
+		if(mousep->msec-l-≥click<Clicktime && l->f.p0+l->origin==l->p0 && 
+			l->f.p0==frcharofpt(&l->f, mousep->xy)){
 			l->click = 0;
-		}else
-			l->click = mousep->msec;
-	}else
-		l->click = 0;
+			return 1;
+		}
+	l->click = mousep->msec;
+	frselect(&l->f, mousectl);
 	l->p0 = l->f.p0+l->origin, l->p1 = l->f.p1+l->origin;
-	return ret;
+	return 0;
 }

 void

trebol55555 | 27 May 00:03 2016
Picon

Chords, ^, _, ^B and scroll with mouse wheel in p9p sam

The 9front sam in 

	https://bitbucket.org/kremlin_/front9port
	https://bitbucket.org/iru/sam9f-unix
	
doesn't exchange the snarf buffer with X, and the pipe in /srv doesn't
work.

This diff will makes the minimal changes to have those features of 9front
sam in the last p9p. The code fell off from the front.

trebol.

diff -rpuN src/cmd/sam/cmd.c sam/cmd.c
--- src/cmd/sam/cmd.c	2016-04-18 19:07:22.000000000 +0100
+++ sam/cmd.c	2016-05-25 23:56:34.040909362 +0100
 <at>  <at>  -35,6 +35,8  <at>  <at>  struct cmdtab cmdtab[]={
 	'>',	0,	0,	0,	0,	aDot,	0,	linex,	plan9_cmd,
 	'<',	0,	0,	0,	0,	aDot,	0,	linex,	plan9_cmd,
 	'|',	0,	0,	0,	0,	aDot,	0,	linex,	plan9_cmd,
+	'^',	0,	0,	0,	0,	aDot,	0,	linex,	plan9_cmd,
+	'_',	0,	0,	0,	0,	aDot,	0,	linex,	plan9_cmd,
 	'=',	0,	0,	0,	0,	aDot,	0,	linex,	eq_cmd,
 	'c'|0x100,0,	0,	0,	0,	aNo,	0,	wordx,	cd_cmd,
 	0,	0,	0,	0,	0,	0,	0,	0
 <at>  <at>  -76,7 +78,13  <at>  <at>  inputc(void)

     Again:
 	nbuf = 0;
-	if(downloaded){
+	if(cmdbufpos > cmdbuf.nc && cmdbuf.nc > 0){
+		cmdbufpos = 0;
+		bufreset(&cmdbuf);
+	}
+	if(cmdbufpos < cmdbuf.nc && cmdbuf.nc > 0)
+		bufread(&cmdbuf, cmdbufpos++, &r, 1);
+	else if(downloaded){
 		while(termoutp == terminp){
 			cmdupdate();
 			if(patset)
diff -rpuN src/cmd/sam/sam.h sam/sam.h
--- src/cmd/sam/sam.h	2016-04-18 19:07:22.000000000 +0100
+++ sam/sam.h	2016-05-25 23:45:05.652931784 +0100
 <at>  <at>  -369,6 +369,8  <at>  <at>  extern int	quitok;
 extern Address	addr;
 extern Buffer	snarfbuf;
 extern Buffer	plan9buf;
+extern Buffer	cmdbuf;
+extern int	cmdbufpos;
 extern List	file;
 extern List	tempfile;
 extern File	*cmd;
diff -rpuN src/cmd/sam/shell.c sam/shell.c
--- src/cmd/sam/shell.c	2016-04-18 19:07:22.000000000 +0100
+++ sam/shell.c	2016-05-25 23:46:25.262692361 +0100
 <at>  <at>  -6,6 +6,8  <at>  <at>  extern	jmp_buf	mainloop;
 char	errfile[64];
 String	plan9cmd;	/* null terminated */
 Buffer	plan9buf;
+Buffer	cmdbuf;
+int	cmdbufpos;
 void	checkerrs(void);

 void
 <at>  <at>  -40,7 +42,7  <at>  <at>  plan9(File *f, int type, String *s, int
 	}
 	if(type!='!' && pipe(pipe1)==-1)
 		error(Epipe);
-	if(type=='|')
+	if(type=='|' || type=='_')
 		snarf(f, addr.r.p1, addr.r.p2, &plan9buf, 1);
 	if((pid=fork()) == 0){
 		setname(f);
 <at>  <at>  -61,14 +63,14  <at>  <at>  plan9(File *f, int type, String *s, int
 			}
 		}
 		if(type != '!') {
-			if(type=='<' || type=='|')
-				dup(pipe1[1], 1);
-			else if(type == '>')
+			if(type == '>')
 				dup(pipe1[0], 0);
+			else
+				dup(pipe1[1], 1);
 			close(pipe1[0]);
 			close(pipe1[1]);
 		}
-		if(type == '|'){
+		if(type == '|' || type == '_'){
 			if(pipe(pipe2) == -1)
 				exits("pipe");
 			if((pid = fork())==0){
 <at>  <at>  -100,7 +102,7  <at>  <at>  plan9(File *f, int type, String *s, int
 			close(pipe2[0]);
 			close(pipe2[1]);
 		}
-		if(type=='<'){
+		if(type=='<' || type=='^'){
 			close(0);	/* so it won't read from terminal */
 			open("/dev/null", 0);
 		}
 <at>  <at>  -128,9 +130,14  <at>  <at>  plan9(File *f, int type, String *s, int
 		writeio(f);
 		bpipeok = 0;
 		closeio((Posn)-1);
+	}else if(type == '^' || type == '_'){
+		int nulls;
+		close(pipe1[1]);
+		bufload(&cmdbuf, cmdbufpos, pipe1[0], &nulls);
+		close(pipe1[0]);
 	}
 	retcode = waitfor(pid);
-	if(type=='|' || type=='<')
+	if(type=='|' || type=='<' || type=='_' || type=='^')
 		if(retcode!=0)
 			warn(Wbadstatus);
 	if(downloaded)
diff -rpuN src/cmd/samterm/main.c samterm/main.c
--- src/cmd/samterm/main.c	2016-04-18 19:07:22.000000000 +0100
+++ samterm/main.c	2016-05-26 16:12:12.452556184 +0100
 <at>  <at>  -23,11 +23,8  <at>  <at>  long	modified = 0;		/* strange lookahead
 char	hostlock = 1;
 char	hasunlocked = 0;
 int	maxtab = 8;
-int	chord;
 int	autoindent;

-#define chording 0	/* code here for reference but it causes deadlocks */
-
 void
 notifyf(void *a, char *msg)
 {
 <at>  <at>  -39,7 +36,7  <at>  <at>  notifyf(void *a, char *msg)
 void
 threadmain(int argc, char *argv[])
 {
-	int i, got, scr, w;
+	int i, got, scr, chord, w;
 	Text *t;
 	Rectangle r;
 	Flayer *nwhich;
 <at>  <at>  -85,6 +82,7  <at>  <at>  threadmain(int argc, char *argv[])

 	got = 0;
 	if(protodebug) print("loop\n");
+	chord = 0;
 	for(;;got = waitforio()){
 		if(hasunlocked && RESIZED())
 			resize();
 <at>  <at>  -108,19 +106,32  <at>  <at>  threadmain(int argc, char *argv[])
 				continue;
 			}
 			nwhich = flwhich(mousep->xy);
-			scr = which && ptinrect(mousep->xy, which->scroll);
+			scr = which && (ptinrect(mousep->xy, which->scroll) ||
+				mousep->buttons&(8|16));
 			if(mousep->buttons)
 				flushtyping(1);
-			if(chording && chord==1 && !mousep->buttons)
+			if((mousep->buttons&1)==0)
 				chord = 0;
-			if(chording && chord)
+			if(chord && which && which==nwhich){
 				chord |= mousep->buttons;
-			else if(mousep->buttons&1){
+				t = (Text *)which->user1;
+				if(!t->lock){
+					w = which-t-≥l;
+					if(chord&2){
+						cut(t, w, 1, 1);
+						chord &= ~2;
+					}
+					if(chord&4){
+						paste(t, w);
+						chord &= ~4;
+					}
+				}
+			}else if(mousep->buttons&(1|8)){
 				if(nwhich){
 					if(nwhich!=which)
 						current(nwhich);
 					else if(scr)
-						scroll(which, 1);
+						scroll(which, (mousep->buttons&8) ? 4 : 1);
 					else{
 						t=(Text *)which->user1;
 						if(flselect(which)){
 <at>  <at>  -137,27 +148,14  <at>  <at>  threadmain(int argc, char *argv[])
 					scroll(which, 2);
 				else
 					menu2hit();
-			}else if((mousep->buttons&4)){
+			}else if(mousep->buttons&(4|16)){
 				if(scr)
-					scroll(which, 3);
+					scroll(which, (mousep->buttons&16) ? 5 : 3);
 				else
 					menu3hit();
 			}
 			mouseunblock();
 		}
-		if(chording && chord){
-			t = (Text*)which->user1;
-			if(!t->lock && !hostlock){
-				w = which-t-≥l;
-				if(chord&2){
-					cut(t, w, 1, 1);
-					chord &= ~2;
-				}else if(chord&4){
-					paste(t, w);
-					chord &= ~4;
-				}
-			}
-		}
 	}
 }

 <at>  <at>  -497,6 +495,7  <at>  <at>  flushtyping(int clearesc)
 #define	CUT	(Kcmd+'x')
 #define	COPY	(Kcmd+'c')
 #define	PASTE	(Kcmd+'v')
+#define	Kstx	0x02

 int
 nontypingkey(int c)
 <at>  <at>  -512,6 +511,7  <at>  <at>  nontypingkey(int c)
 	case PAGEUP:
 	case RIGHTARROW:
 	case SCROLLKEY:
+	case Kstx:
 		return 1;
 	}
 	if(c >= Kcmd)
 <at>  <at>  -669,6 +669,15  <at>  <at>  type(Flayer *l, int res)	/* what a blood
 				}
 			}
 		}
+	}else if(c == Kstx){
+		t = &cmd;
+		for(l=t->l; l->textfn==0; l++)
+			;
+		current(l);
+		flushtyping(0);
+		a = t->rasp.nrunes;
+		flsetselect(l, a, a);
+		center(l, a);
 	}else{
 		if(c==ESC && typeesc>=0){
 			l->p0 = typeesc;
diff -rpuN src/cmd/samterm/scroll.c samterm/scroll.c
--- src/cmd/samterm/scroll.c	2016-04-18 19:07:22.000000000 +0100
+++ samterm/scroll.c	2016-05-26 02:07:31.922977720 +0100
 <at>  <at>  -115,7 +115,7  <at>  <at>  scroll(Flayer *l, int but)
 	draw(scrback, Rect(0,0,Dx(l->scroll), Dy(l->scroll)), l->f.b, nil, l->scroll.min);
 	do{
 		oin = in;
-		in = abs(x-mousep-≥xy.x)<=FLSCROLLWID(l)/2;
+		in = (but > 3) || (but == 2) || abs(x-mousep-≥xy.x)<=FLSCROLLWID(l)/2;
 		if(oin && !in)
 			scrunmark(l, r);
 		if(in){
 <at>  <at>  -126,9 +126,7  <at>  <at>  scroll(Flayer *l, int but)
 				my = s.min.y;
 			if(my >= s.max.y)
 				my = s.max.y;
-			if(!eqpt(mousep->xy, Pt(x, my)))
-				moveto(mousectl, Pt(x, my));
-			if(but == 1){
+			if(but == 1 || but == 4){
 				p0 = l->origin-frcharofpt(&l->f, Pt(s.max.x, my));
 				rt = scrpos(l->scroll, p0, p0+l->f.nchars, tot);
 				y = rt.min.y;
 <at>  <at>  -136,7 +134,7  <at>  <at>  scroll(Flayer *l, int but)
 				y = my;
 				if(y > s.max.y-2)
 					y = s.max.y-2;
-			}else if(but == 3){
+			}else if(but == 3 || but == 5){
 				p0 = l->origin+frcharofpt(&l->f, Pt(s.max.x, my));
 				rt = scrpos(l->scroll, p0, p0+l->f.nchars, tot);
 				y = rt.min.y;
 <at>  <at>  -147,19 +145,21  <at>  <at>  scroll(Flayer *l, int but)
 				scrmark(l, r);
 			}
 		}
-	}while(button(but));
+	}while(but <= 3 && button(but));
 	if(in){
 		h = s.max.y-s.min.y;
 		scrunmark(l, r);
 		p0 = 0;
-		if(but == 1)
+		if(but == 1 || but == 4){
+			but = 1;
 			p0 = (long)(my-s.min.y)/l->f.font->height+1;
-		else if(but == 2){
+		}else if(but == 2){
 			if(tot > 1024L*1024L)
 				p0 = ((tot>>10)*(y-s.min.y)/h)<<10;
 			else
 				p0 = tot*(y-s.min.y)/h;
-		}else if(but == 3){
+		}else if(but == 3 || but == 5){
+			but = 3;
 			p0 = l->origin+frcharofpt(&l->f, Pt(s.max.x, my));
 			if(p0 > tot)
 				p0 = tot;

Giacomo Tesio | 24 May 23:25 2016
Picon
Gravatar

create/create race

I'm pretty curious about the create(2)/create(5) race described in a comment in namec (see https://github.com/brho/plan9/blob/master/sys/src/9/port/chan.c#L1564-L1603)

Does anyone know or remember the reasoning behind this design?

What was wrong about using the create(5) semantics for the create(2) syscall?


Giacomo
trebol55555 | 24 May 21:57 2016
Picon

kremlin front9port

It's a great idea.

Maybe you can write the state of the programs ported? page is the p9p
version, factotum does not compile, mailfs does not have tls support...


Gmane