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
276telnet tcp!127.0.0.1!49160276telnet tcp!127.0.0.1!49160
277.EE277.EE
278.PP278.PP
279.SH PLUMBING
280Orca supports injecting files at the current cursor position by
281plumbing. Add this to your plumbing rules to get it working:
282.EX
283type is text
284data matches '[a-zA-Z¡-￿0-9_\-.,/]+'
285data matches '([a-zA-Z¡-￿0-9_\-.,/]+)\.orca'
286arg isfile $0
287plumb to orca
288plumb start window games/orca $file
289.EE
290.PP
279.SH SOURCE291.SH SOURCE
280https://github.com/hundredrabbits/Orca292https://github.com/hundredrabbits/Orca
plan9.c+20−0
@@ -7,6 +7,7 @@ · 6 unmodified lines
7#include <mouse.h>7#include <mouse.h>
8#include <keyboard.h>8#include <keyboard.h>
9#include <thread.h>9#include <thread.h>
10#include <plumb.h>
10 11
11#define MIN(x,y) ((x)<=(y)?(x):(y))12#define MIN(x,y) ((x)<=(y)?(x):(y))
12#define MAX(x,y) ((x)>=(y)?(x):(y))13#define MAX(x,y) ((x)>=(y)?(x):(y))
@@ -1116,6 +1117,23 @@ stdinproc(void *) · 1103 unmodified lines
1116 threadexits(nil);1117 threadexits(nil);
1117}1118}
1118 1119
1120static void
1121plumbthread(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
1119static void1137static void
1120kbdproc(void *cchan)1138kbdproc(void *cchan)
1121{1139{
@@ -1368,6 +1386,8 @@ threadmain(int argc, char **argv) · 246 unmodified lines
1368 1386
1369 snaps = calloc(maxsnaps, sizeof(Snap));1387 snaps = calloc(maxsnaps, sizeof(Snap));
1370 1388
1389 proccreate(plumbthread, nil, mainstacksize);
1390
1371 for (;;) {1391 for (;;) {
1372 redraw(complete);1392 redraw(complete);
1373 complete = false;1393 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