diff options
author | epoch <epoch@hacking.allowed.org> | 2020-04-07 07:00:06 -0500 |
---|---|---|
committer | epoch <epoch@hacking.allowed.org> | 2020-04-07 07:00:06 -0500 |
commit | 36da2549891d0d67ed267b3bc5336bf14b2c64de (patch) | |
tree | 138437ba5b114b839532cfe3d206c2c89329b170 /share/hackvr | |
parent | 167169abe4df9bd67b5994b6a665abb437947815 (diff) | |
download | hackvr-36da2549891d0d67ed267b3bc5336bf14b2c64de.tar.gz hackvr-36da2549891d0d67ed267b3bc5336bf14b2c64de.zip |
made hackvr_term not bother with background squares for now. added an exec and pipefail to hackvr_data_decode.sh
Diffstat (limited to 'share/hackvr')
-rwxr-xr-x | share/hackvr/examples/hackvr_term/hackvr_data_decode.sh | 5 | ||||
-rw-r--r-- | share/hackvr/examples/hackvr_term/hackvr_term.c | 2 | ||||
-rw-r--r-- | share/hackvr/examples/hackvr_term/pty.c | 11 |
3 files changed, 12 insertions, 6 deletions
diff --git a/share/hackvr/examples/hackvr_term/hackvr_data_decode.sh b/share/hackvr/examples/hackvr_term/hackvr_data_decode.sh index 0ac04f2..85c64af 100755 --- a/share/hackvr/examples/hackvr_term/hackvr_data_decode.sh +++ b/share/hackvr/examples/hackvr_term/hackvr_data_decode.sh @@ -1,2 +1,3 @@ -#!/bin/sh -grep --line-buffered '^[^ ]* data ' | stdbuf -oL tr -s ' ' | stdbuf -oL cut '-d ' -f3- | stdbuf -o0 xxd -r -p +#!/usr/bin/env bash +set -eo pipefail +exec grep --line-buffered '^[^ ]* data ' | stdbuf -oL tr -s ' ' | stdbuf -oL cut '-d ' -f3- | stdbuf -o0 xxd -r -p diff --git a/share/hackvr/examples/hackvr_term/hackvr_term.c b/share/hackvr/examples/hackvr_term/hackvr_term.c index 71f2492..5fcf42c 100644 --- a/share/hackvr/examples/hackvr_term/hackvr_term.c +++ b/share/hackvr/examples/hackvr_term/hackvr_term.c @@ -60,7 +60,7 @@ void preload_glyphs() { void hackvr_draw_character(int c,int r,const TMTCHAR *ch) { char *line; int i,ret=0; - printf("term_%02d_%02d addshape %d 4 -1 -3 0 5 -3 0 5 7 0 -1 7 0\n",c,r,ch->a.bg+15); + //printf("term_%02d_%02d addshape %d 4 -1 -3 0 5 -3 0 5 7 0 -1 7 0\n",c,r,ch->a.bg+15); for(i=0,line=glyphs[ch->c][0];line[0];i++,line=glyphs[ch->c][i]) { ret=1; printf("term_%02d_%02d addshape %d %s",c,r,ch->a.fg == -1 ? 17 : ch->a.fg + 15,line+strlen("XX addshape X")); diff --git a/share/hackvr/examples/hackvr_term/pty.c b/share/hackvr/examples/hackvr_term/pty.c index 1011e38..a3d9951 100644 --- a/share/hackvr/examples/hackvr_term/pty.c +++ b/share/hackvr/examples/hackvr_term/pty.c @@ -1,12 +1,15 @@ #include <stdio.h> #include <fcntl.h> #include <sys/wait.h> +#include <unistd.h> +#include <stdlib.h> int main(int argc,char *argv[]) { char *pts; char in[256];//I dunno. int r; int pid; + int eof1,eof2; int master,slave; master=open("/dev/ptmx",O_RDWR); if(master == -1) return 1; @@ -42,18 +45,20 @@ int main(int argc,char *argv[]) { default: break; } - for(;;) { +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: return 6;//EOF + case 0: eof1=1;//EOF case -1: break;//EAGAIN probably. default: write(master,in,r); } switch(r=read(master,&in,1)) { - case 0: return 7;//EOF + case 0: eof2=1;//EOF case -1: break;//EAGAIN probably default: write(1,in,r); } |