From 36da2549891d0d67ed267b3bc5336bf14b2c64de Mon Sep 17 00:00:00 2001 From: epoch Date: Tue, 7 Apr 2020 07:00:06 -0500 Subject: made hackvr_term not bother with background squares for now. added an exec and pipefail to hackvr_data_decode.sh --- share/hackvr/examples/hackvr_term/hackvr_data_decode.sh | 5 +++-- share/hackvr/examples/hackvr_term/hackvr_term.c | 2 +- share/hackvr/examples/hackvr_term/pty.c | 11 ++++++++--- 3 files changed, 12 insertions(+), 6 deletions(-) (limited to 'share') 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 #include #include +#include +#include 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); } -- cgit v1.2.3