Sorry, didn't mean to come off as insisting you had to do it
my way (I am guilty of hacking all kinds of things into my
own samterm); just wanted to point out there are other ways
besides adding a new command to sam.

> The next step is add an option (or better an environment variable)
> to use the rio snarf buffer directly.

There is a patch for this floating around somewhere: perhaps
whoever wrote it can chime in.

Below is a quick illustration of the other thought I had,
having label reflect the most recently topped buffer, in
case you are or anyone else is interested.

umbraticus

diff -u /sys/src/cmd/samterm/main.c ./main.c
--- /sys/src/cmd/samterm/main.c Thu Apr 30 10:24:09 2020
+++ ./main.c    Mon Jul 19 23:36:12 2021
@@ -150,6 +150,7 @@
 current(Flayer *nw)
 {
        Text *t;
+       int fd;
 
        if(which)
                flborder(which, 0);
@@ -160,8 +161,13 @@
                buttons(Up);
                t = (Text *)nw->user1;
                t->front = nw-&t->l[0];
-               if(t != &cmd)
+               if(t != &cmd){
                        work = nw;
+                       if((fd = open("/dev/label", OWRITE)) >= 0){
+                               fprint(fd, "sam %s", 
(char*)name[whichmenu(t->tag)] + 1);
+                               close(fd);
+                       }
+               }
        }
        which = nw;
 }
@@ -170,11 +176,15 @@
 closeup(Flayer *l)
 {
        Text *t=(Text *)l->user1;
-       int m;
+       int m, fd;
 
        m = whichmenu(t->tag);
        if(m < 0)
                return;
+       if((fd = open("/dev/label", OWRITE)) >= 0){
+               write(fd, "sam", 4);
+               close(fd);
+       }
        flclose(l);
        if(l == which){
                which = 0;

------------------------------------------
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/Tf1e211daf823c0e0-M2dfbf5d65c86fcf89c315484
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

Reply via email to