Restore cursor visibility in 2013/birken at end

If the program (alt and original) runs to completion the program will
use (via redefined exit(3)):

    return system("reset");

so that the terminal becomes sane. One could use tput cvvis as well but
this was not done as it's longer.
This commit is contained in:
Cody Boone Ferguson committed 2023-11-14 04:54:09 -08:00
1 parent f954d8d4a5
commit c7c1030494
3 files changed
+8 -4

No files matched your search

+2 -1
View File
@@ -4,6 +4,7 @@ char*_ = "'""/*";
#define m 21 #define m 21
#define o(l, k) for(l=0; l<k; l++) #define o(l, k) for(l=0; l<k; l++)
#define n(k) o(T, k) #define n(k) o(T, k)
#define exit(x) return system("reset")
int E,L,O,R,G[42][m],h[2][42][m],g[3][8],c int E,L,O,R,G[42][m],h[2][42][m],g[3][8],c
@@ -47,4 +48,4 @@ g[2][g[i][T]]=T; n(R+i)o(e,m )if(G[T][e]+i) G[T][e]=g[2][G[T][e]];
; else if(G[R][T]+i) s++; if(s) { if(V>4){ V=9-V; D++; } V+=29; n(20) q(c[V][T][0],c ; else if(G[R][T]+i) s++; if(s) { if(V>4){ V=9-V; D++; } V+=29; n(20) q(c[V][T][0],c
[V][T][i],D); } } n(19) if((L=G[R][T])+i) { O=T-L; e=O>9; t=e?18-O :O; o(K,((t&3)-3? [V][T][i],D); } } n(19) if((L=G[R][T])+i) { O=T-L; e=O>9; t=e?18-O :O; o(K,((t&3)-3?
16:37)){ if(K){ L=c[t+19][K-i][0]; O=c[t+19][K-i][i] ; } q(L,O,K && e); } } if(s) q( 16:37)){ if(K){ L=c[t+19][K-i][0]; O=c[t+19][K-i][i] ; } q(L,O,K && e); } } if(s) q(
c[V][20][0], c[V][20][i], D); R--; } printf("\33[47;1f\33[?25h\33[40m"); return system("reset"); } c[V][20][0], c[V][20][i], D); R--; } printf("\33[47;1f\33[?25h\33[40m"); exit(0); }
+2 -1
View File
@@ -3,6 +3,7 @@ char*_ = "'""/*";
#define m 21 #define m 21
#define o(l, k) for(l=0; l<k; l++) #define o(l, k) for(l=0; l<k; l++)
#define n(k) o(T, k) #define n(k) o(T, k)
#define exit(x) return system("reset")
int E,L,O,R,G[42][m],h[2][42][m],g[3][8],c int E,L,O,R,G[42][m],h[2][42][m],g[3][8],c
@@ -46,4 +47,4 @@ g[2][g[i][T]]=T; n(R+i)o(e,m )if(G[T][e]+i) G[T][e]=g[2][G[T][e]];
; else if(G[R][T]+i) s++; if(s) { if(V>4){ V=9-V; D++; } V+=29; n(20) q(c[V][T][0],c ; else if(G[R][T]+i) s++; if(s) { if(V>4){ V=9-V; D++; } V+=29; n(20) q(c[V][T][0],c
[V][T][i],D); } } n(19) if((L=G[R][T])+i) { O=T-L; e=O>9; t=e?18-O :O; o(K,((t&3)-3? [V][T][i],D); } } n(19) if((L=G[R][T])+i) { O=T-L; e=O>9; t=e?18-O :O; o(K,((t&3)-3?
16:37)){ if(K){ L=c[t+19][K-i][0]; O=c[t+19][K-i][i] ; } q(L,O,K && e); } } if(s) q( 16:37)){ if(K){ L=c[t+19][K-i][0]; O=c[t+19][K-i][i] ; } q(L,O,K && e); } } if(s) q(
c[V][20][0], c[V][20][i], D); R--; } printf("\33[47;1f\33[?25h\33[40m"); return system("reset");} c[V][20][0], c[V][20][i], D); R--; } printf("\33[47;1f\33[?25h\33[40m"); exit(0); }
+4 -2
View File
@@ -3041,8 +3041,10 @@ sure if he wants to be thanked either :-) but we appreciate it nonetheless.
## [2013/birken](2013/birken/birken.c) ([README.md](2013/birken/README.md])) ## [2013/birken](2013/birken/birken.c) ([README.md](2013/birken/README.md]))
Cody changed the `return 0;` at the end of the program to be `return Cody changed the `return 0;` at the end of the program to be `return
system("reset");` so that as long as it runs to completion the terminal will be system("reset");` (via redefining `exit(3)` so that the column ending would be
sane and the cursor will be visible. the same) so that as long as it runs to completion the terminal will be sane and
the cursor will be visible. Using `atexit(3)` will not work if the program is
killed and signals are ugly so this was not done.
Cody also added the [try.sh](2013/birken/try.sh) script and the Cody also added the [try.sh](2013/birken/try.sh) script and the
alternate version (that has the above fix) which allows one to control how fast the painting is done, alternate version (that has the above fix) which allows one to control how fast the painting is done,