diff options
Diffstat (limited to 'share')
-rw-r--r-- | share/hackvr/examples/calendar/Makefile | 3 | ||||
-rwxr-xr-x | share/hackvr/examples/calendar/hackvr_coproc | 2 | ||||
-rw-r--r-- | share/hackvr/examples/hackvr_term/hackvr_term.c | 2 | ||||
-rw-r--r-- | share/hackvr/examples/hackvr_term/pty.c | 25 | ||||
-rwxr-xr-x | share/hackvr/examples/hackvr_term/read_line.sh | 5 | ||||
-rw-r--r-- | share/hackvr/examples/uristart.conf | 2 |
6 files changed, 23 insertions, 16 deletions
diff --git a/share/hackvr/examples/calendar/Makefile b/share/hackvr/examples/calendar/Makefile index 2027b18..1646279 100644 --- a/share/hackvr/examples/calendar/Makefile +++ b/share/hackvr/examples/calendar/Makefile @@ -1,8 +1,7 @@ PREFIX:=/usr/local -all: calvr hackvr_coproc +all: calvr @echo using PREFIX: $(PREFIX) install: install -t $(PREFIX)/bin calvr - install -t $(PREFIX)/bin hackvr_coproc diff --git a/share/hackvr/examples/calendar/hackvr_coproc b/share/hackvr/examples/calendar/hackvr_coproc deleted file mode 100755 index 8d2e127..0000000 --- a/share/hackvr/examples/calendar/hackvr_coproc +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exec socat exec:hackvr "exec:$*" diff --git a/share/hackvr/examples/hackvr_term/hackvr_term.c b/share/hackvr/examples/hackvr_term/hackvr_term.c index 5fcf42c..b044498 100644 --- a/share/hackvr/examples/hackvr_term/hackvr_term.c +++ b/share/hackvr/examples/hackvr_term/hackvr_term.c @@ -151,7 +151,7 @@ void callback(tmt_msg_t m,TMT *vt, const void *a,void *vt_old) { int main(int argc,char *argv[]) { char in[16]; - if(argc < 3) return fprintf(stderr,"usage: ./hackvr_term rows cols\n"),1; + if(argc < 3) return fprintf(stderr,"usage: ./hackvr_term cols rows\n"),1; int r=atoi(argv[2]); int ret=0; int c=atoi(argv[1]); diff --git a/share/hackvr/examples/hackvr_term/pty.c b/share/hackvr/examples/hackvr_term/pty.c index a3d9951..6903bc3 100644 --- a/share/hackvr/examples/hackvr_term/pty.c +++ b/share/hackvr/examples/hackvr_term/pty.c @@ -1,12 +1,15 @@ +#define _XOPEN_SOURCE 500 //ptsname +#define _XOPEN_SOURCE_EXTENDED #include <stdio.h> #include <fcntl.h> #include <sys/wait.h> -#include <unistd.h> #include <stdlib.h> +#include <unistd.h> +#include <errno.h> int main(int argc,char *argv[]) { char *pts; - char in[256];//I dunno. + char in;//I dunno. int r; int pid; int eof1,eof2; @@ -45,22 +48,22 @@ int main(int argc,char *argv[]) { default: break; } -eof1=0; -eof2=0; - for(;!eof1 && !eof2;) { + eof1=0; + eof2=0; + for(;!(eof1 || eof2);) { if(waitpid(-1,0,WNOHANG) > 0) { return 0;//fuck if I know. //we got a dead child. let's bail. } switch(r=read(0,&in,1)) { - case 0: eof1=1;//EOF - case -1: break;//EAGAIN probably. - default: write(master,in,r); + case 0: eof1=1;;//EOF + case -1: if(errno != EAGAIN) eof1=1; break;//EAGAIN probably. + default: write(master,&in,r); } switch(r=read(master,&in,1)) { - case 0: eof2=1;//EOF - case -1: break;//EAGAIN probably - default: write(1,in,r); + case 0: eof2=1;;//EOF + case -1: if(errno != EAGAIN) eof2=1; break;//EAGAIN probably + default: write(1,&in,r); } usleep(100);//kek } diff --git a/share/hackvr/examples/hackvr_term/read_line.sh b/share/hackvr/examples/hackvr_term/read_line.sh new file mode 100755 index 0000000..c26ebf3 --- /dev/null +++ b/share/hackvr/examples/hackvr_term/read_line.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +./hackvr_data_decode.sh \ + | ./pty `which bash` "-c" 'read -p "type> " line;xmessage $line' \ + | ./hackvr_term 60 2 \ + | sed -u 's/addshape 15 4/addshape 12 4/g' diff --git a/share/hackvr/examples/uristart.conf b/share/hackvr/examples/uristart.conf new file mode 100644 index 0000000..d48e8d1 --- /dev/null +++ b/share/hackvr/examples/uristart.conf @@ -0,0 +1,2 @@ +hackvr: if [ "%u" ];then USER="%u";fi;ncat '%d' '%P' -c "echo $USER action %p;hackvr_uri" +hackvr+ssh: if [ '%u' ];then u='%u@';fi ; if [ "%P" ];then P='-p %P';fi; hackvr_coproc ssh "$u"'%d' $P "/var/hackvr/hackvr-subsystem" '%p' |