From 77c63be39a8fee7116be9a96393b5216e11efa12 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Tue, 14 Nov 2023 04:54:09 -0800 Subject: [PATCH 1/2] Restore cursor visibility in 2013/birken at end Make line ending of 2013/birken the same by redefining exit(3) to do the 'return system("reset");'. --- 2013/birken/birken.alt.c | 3 ++- 2013/birken/birken.c | 3 ++- thanks-for-fixes.md | 6 ++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/2013/birken/birken.alt.c b/2013/birken/birken.alt.c index 2ff1dd4dd..6833faef0 100644 --- a/2013/birken/birken.alt.c +++ b/2013/birken/birken.alt.c @@ -4,6 +4,7 @@ char*_ = "'""/*"; #define m 21 #define o(l, k) for(l=0; l4){ 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? 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); } diff --git a/2013/birken/birken.c b/2013/birken/birken.c index c7d8de63f..c204fdc62 100644 --- a/2013/birken/birken.c +++ b/2013/birken/birken.c @@ -3,6 +3,7 @@ char*_ = "'""/*"; #define m 21 #define o(l, k) for(l=0; l4){ 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? 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); } diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md index 8fc0751f8..b8962fa09 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -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])) 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 -sane and the cursor will be visible. +system("reset");` (via redefining `exit(3)` so that the column ending would be +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 alternate version (that has the above fix) which allows one to control how fast the painting is done, From 3d2fdd8cc66bb252c342be1b0a8b6cbd9b835508 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Tue, 14 Nov 2023 05:01:12 -0800 Subject: [PATCH 2/2] Improve 2013/misaka/try.sh Get CC, defaulting to cc. --- 2013/misaka/try.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/2013/misaka/try.sh b/2013/misaka/try.sh index 1a22107d8..1be7f35be 100755 --- a/2013/misaka/try.sh +++ b/2013/misaka/try.sh @@ -1,7 +1,19 @@ #!/usr/bin/env bash +# +# try.sh - demonstrate IOCCC winner 2013/misaka +# -# make sure code compiled -make all || exit 1 +# make sure CC is set so that when we do make CC="$CC" it isn't empty. Doing it +# this way allows us to have the user specify a different compiler in an easy +# way. +if [[ -z "$CC" ]]; then + CC="cc" +fi + +make CC="$CC" all >/dev/null || exit 1 + +# clear screen after compilation so that only the entry is shown +clear echo "$ seq 1 12 | ./horizontal_cat - - -" seq 1 12 | ./horizontal_cat - - -