From c109cd23cc89f2c33033244bbb5e36e1eb717565 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Sat, 2 Dec 2023 11:28:06 -0800 Subject: [PATCH] Improve 2013/misaka/try.alt + Format/typo check --- 2013/misaka/README.md | 35 +++++++++++++++------------------- 2013/misaka/try.sh | 44 ++++++++++++++++++++++++++----------------- thanks-for-fixes.md | 4 +--- 3 files changed, 43 insertions(+), 40 deletions(-) diff --git a/2013/misaka/README.md b/2013/misaka/README.md index 218d2d033..b43e53990 100644 --- a/2013/misaka/README.md +++ b/2013/misaka/README.md @@ -26,21 +26,6 @@ make understanding Also try: -```sh -seq 1 12 | ./horizontal_cat - - - - -./long_cat -./long_faat_cat -./long_fat_cat -./loong_cat -./loooong_cat -./loooooooong_cat - -seq -f '%.0f ' 45 | ./horizontal_cat - misaka.c -``` - -Alternately you can just try: - ```sh ./try.sh ``` @@ -57,6 +42,7 @@ NOTE: Use - for standard input. For example: There is more to cat than [mere cats](http://cheezburger.com/1680494336). Be they tall, fat, long or squat, this source code is sure to amuse. + #### Slight diversion While one of the judges was reviewing this entry on the stern of the @@ -66,7 +52,7 @@ in the middle of the Atlantic Ocean waiting for the the judge was struck by a [flying fish](http://en.wikipedia.org/wiki/Flying_fish). While the result of the impact was that the -[Port](http://en.wikipedia.org/wiki/Port_wine) from Portugal was lost, but the +[Port](http://en.wikipedia.org/wiki/Port_wine) from Portugal was lost, the [Grog](https://web.archive.org/web/20130702003043/http://www.travelforpassion.com/grog-factory-cape-verde-santo-antao-cape-verde-1602-photo) from Cape Verde and the laptop containing this entry was saved. @@ -92,7 +78,8 @@ cc misaka2.c -o vertical_cat ./vertical_cat [files...] > [output] ``` -Where `[files...]` are a list of text file names. Use `-` to read from stdin. +Where `[files...]` is a list of text file names. Use `-` to read from `stdin`. + ### Details @@ -118,7 +105,7 @@ original text alignments are preserved. If `-` is specified as a file name, `horizontal_cat` will read from `stdin`. Unlike `cat`, `horizontal_cat` loads all input to memory first. Thus you -can specify `-` multiple times to get stdin multiplied horizontally. For +can specify `-` multiple times to get `stdin` multiplied horizontally. For example, if you have `seq(1)` in your shell, you can add line numbers to both sides of [misaka.c](misaka.c) like this: @@ -126,6 +113,7 @@ sides of [misaka.c](misaka.c) like this: seq -f ' %.0f ' 45 | ./horizontal_cat - misaka.c - ``` + ### Vertical cat Because `horizontal_cat` must know the maximum width of all files before @@ -151,6 +139,7 @@ gcc misaka2.c -o vertical_cat ./vertical_cat - - ``` + ### Long cat After `horizontal_cat` and `vertical_cat`, I thought, maybe all I really wanted @@ -214,6 +203,7 @@ MISAKA MISAKA MISAKA ``` + ### Return value `horizontal_cat` and `vertical_cat` will exit with zero status on success. @@ -224,6 +214,7 @@ report the offending file name to `stdout`, and exit with nonzero status. If `horizontal_cat` and `vertical_cat` ran out of memory, they will exit with nonzero status without outputting anything. + ### Compatibility `horizontal_cat` makes the following assumptions about input files: @@ -242,6 +233,7 @@ with nonzero status without outputting anything. `Misaka` requires a C99 compiler due to the use of single line comments. `Misaka` does not depend on any other C99 features. + ### Obfuscation Main obfuscation is in having a C program that compiles when tiled @@ -263,21 +255,24 @@ Other features to look for: `gcc -Wall` should provide a hint to where the mode switch happens, it does not output any irrelevant other warnings (verified on 4.6.3). + ### Extra files Extra files included in my submission are informational only, they are not needed for the program to work. -* [bf.pl](bf.pl) - a brainfuck interpreter, in case you don't have one handy. +* [bf.pl](bf.pl) - a perl brainfuck interpreter, in case you don't have one +handy. * [spoiler.html](spoiler.html) - making of this program. + ### About `Misaka` The name, layout, and functionality of `Misaka` is inspired by a particular stackable figure: * [Google images](http://google.co.jp/search?q=%E3%83%9F%E3%82%B5%E3%82%AB%E7%9B%9B%E3%82%8A&tbm=isch) -* [Kotobukiya](http://main.kotobukiya.co.jp/figure/tsubucole_tmi_misakamori/) +* [Kotobukiya](https://web.archive.org/web/20140325175014/http://main.kotobukiya.co.jp/figure/tsubucole_tmi_misakamori/) ## Copyright and CC BY-SA 4.0 License: diff --git a/2013/misaka/try.sh b/2013/misaka/try.sh index 1be7f35be..a01157e3e 100755 --- a/2013/misaka/try.sh +++ b/2013/misaka/try.sh @@ -15,33 +15,43 @@ 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 - - -" +read -r -n 1 -p "Press any key to run: seq 1 12 | ./horizontal_cat - - -: " +echo 1>&2 seq 1 12 | ./horizontal_cat - - - -sleep 1 +echo 1>&2 -echo "$ ./long_cat" +read -r -n 1 -p "Press any key to run: ./long_cat: " +echo 1>&2 ./long_cat -sleep 1 +echo 1>&2 -echo "$ ./long_faat_cat" +read -r -n 1 -p "Press any key to run: ./long_faat_cat: " +echo 1>&2 ./long_faat_cat -sleep 1 +echo 1>&2 -echo "$ ./long_fat_cat" +read -r -n 1 -p "Press any key to run: ./long_fat_cat: " +echo 1>&2 ./long_fat_cat -sleep 1 +echo 1>&2 -echo "$ ./loong_cat" +read -r -n 1 -p "Press any key to run: ./loong_cat: " +echo 1>&2 ./loong_cat -sleep 1 +echo 1>&2 -echo "$ ./loooong_cat" +read -r -n 1 -p "Press any key to run: ./loooong_cat: " +echo 1>&2 ./loooong_cat -sleep 1 +echo 1>&2 -echo "$ ./loooooooong_cat" -./loooooooong_cat -sleep 1 +read -r -n 1 -p "Press any key to run: ./loooooooong_cat (space = next page, q = quit): " +echo 1>&2 +./loooooooong_cat | less -EX +echo 1>&2 -echo "$ seq -f '%.0f ' 45 | ./horizontal_cat - misaka.c" -seq -f '%.0f ' 45 | ./horizontal_cat - misaka.c +echo "Press any key to run: seq -f '%.0f ' 45 | ./horizontal_cat - misaka.c" +read -r -n 1 -p "(space = next page, q = quit): " +echo 1>&2 +seq -f '%.0f ' 45 | ./horizontal_cat - misaka.c | less -EX +echo 1>&2 diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md index ffe9aa23a..47766ee64 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -3617,9 +3617,7 @@ this broke `make` which Cody also fixed. ## [2013/misaka](2013/misaka/misaka.c) ([README.md)[2013/misaka/README.md)) -As there are a lot of commands to try, [Cody](#cody) added the -[try.sh](2013/misaka/try.sh) script to do this, sleeping for approximately 1 -second between commands. +[Cody](#cody) added the [try.sh](2013/misaka/try.sh) script. ## [2013/morgan1](2013/morgan1/morgan1.c) ([README.md](2013/morgan1/README.md))