History

plan9: support plumbing to inject files

Sigrid Haflínudóttir committed 6 years ago

Commit 324ef5b1 parent 370b8832 files · +32 −0Browse files

Unified · Split

2 files
  1. orca.man +12 −0
  2. plan9.c +20 −0
orca.man+12−0
@@ -276,5 +276,17 @@ Then start the following in a separate "command" window: · 275 unmodified lines
276276 telnet tcp!127.0.0.1!49160
277277 .EE
278278 .PP
279+.SH PLUMBING
280+Orca supports injecting files at the current cursor position by
281+plumbing. Add this to your plumbing rules to get it working:
282+.EX
283+type is text
284+data matches '[a-zA-Z¡-￿0-9_\-.,/]+'
285+data matches '([a-zA-Z¡-￿0-9_\-.,/]+)\.orca'
286+arg isfile $0
287+plumb to orca
288+plumb start window games/orca $file
289+.EE
290+.PP
279291 .SH SOURCE
280292 https://github.com/hundredrabbits/Orca
plan9.c+20−0
@@ -7,6 +7,7 @@ · 6 unmodified lines
77 #include <mouse.h>
88 #include <keyboard.h>
99 #include <thread.h>
10+#include <plumb.h>
1011
1112 #define MIN(x,y) ((x)<=(y)?(x):(y))
1213 #define MAX(x,y) ((x)>=(y)?(x):(y))
@@ -1116,6 +1117,23 @@ stdinproc(void *) · 1103 unmodified lines
11161117 threadexits(nil);
11171118 }
11181119
1120+static void
1121+plumbthread(void *)
1122+{
1123+ int f;
1124+ Plumbmsg *m;
1125+
1126+ threadsetname("plumb");
1127+ if ((f = plumbopen("orca", OREAD)) >= 0) {
1128+ while ((m = plumbrecv(f)) != nil) {
1129+ inject(m->data);
1130+ plumbfree(m);
1131+ }
1132+ }
1133+
1134+ threadexits(nil);
1135+}
1136+
11191137 static void
11201138 kbdproc(void *cchan)
11211139 {
@@ -1368,6 +1386,8 @@ threadmain(int argc, char **argv) · 246 unmodified lines
13681386
13691387 snaps = calloc(maxsnaps, sizeof(Snap));
13701388
1389+ proccreate(plumbthread, nil, mainstacksize);
1390+
13711391 for (;;) {
13721392 redraw(complete);
13731393 complete = false;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t