Format/typo check 2011/akari + improve try.sh

This commit is contained in:
Cody Boone Ferguson committed 2023-11-27 08:45:30 -08:00
1 parent 1d744abe58
commit 047c97379f
4 files changed
+43 -33

No files matched your search

+2
View File
@@ -9,3 +9,5 @@ even_output.ppm
odd_output.ppm
akari.orig
prog.orig
rot13.c
expanded_and_rot13_output.txt
+7 -30
View File
@@ -14,30 +14,6 @@ make
### Try:
```sh
./akari < example.ppm > odd_output.ppm
./akari - - even < example.ppm > even_output.ppm
./akari example.ppm odd_output.ppm
make akari2
cat akari2.c
./akari2 < akari2.c
./akari2 rot13 < akari2.c
make akari3
cat akari3.c
./akari3
make akari4
cat akari4.c
./akari4
```
You can automate the above by running:
```sh
./try.sh
```
@@ -58,7 +34,7 @@ properly**_.
`PPM` files with the header `P6 <width> <height> 255` are accepted.
* [ASCII art](https://en.wikipedia.org/wiki/ASCII_art) (with [end of
lines](https://en.wikipedia.org/wiki/Newline) in LF bytes only, _**not** CRLF_!)
lines](https://en.wikipedia.org/wiki/Newline) in LF bytes only, _**not** CR-LF_!)
Anything that is not parsable as `PGM` or `PPM` will be downsampled as ASCII art.
@@ -68,15 +44,16 @@ Anything that is not parsable as `PGM` or `PPM` will be downsampled as ASCII art
`Akari` is an image downsampling utility. She accepts up to 3 arguments:
The first argument is the input image. If it's `-` or unspecified, `Akari`
will read from stdin.
will read from `stdin`.
The second argument is the output image. If it's `-` or unspecified,
`Akari` will write to stdout.
`Akari` will write to `stdout`.
The third argument, if specified, causes `Akari` to keep even pixels on even
[scanlines](https://en.wikipedia.org/wiki/Scan_line). By default `Akari` will
keep odd pixels on odd [scanlines](https://en.wikipedia.org/wiki/Scan_line).
### Examples:
```sh
@@ -110,8 +87,8 @@ natural to try:
```
`akari2.c` is also a valid C program, and accepts up to 1 argument.
By default, this second program reads text from stdin and writes
expanded output to stdout. If the extra argument is specified, the
By default, this second program reads text from `stdin` and writes
expanded output to `stdout`. If the extra argument is specified, the
output text will also pass through a rot13 filter.
```sh
@@ -142,7 +119,7 @@ We must go deeper:
`akari3.c` and `akari4.c` are still (mostly valid) C programs.
`gcc -Wall` will output a few warnings, but still produce output
executables. The output executables each print a message to stdout.
executables. The output executables each print a message to `stdout`.
It takes quite a bit of skill and obfuscation to interleave a
C program 4 levels deep, it's much easier to interleave something like
+29 -3
View File
@@ -24,18 +24,44 @@ clear
./akari - - even < example.ppm > even_output.ppm
./akari example.ppm odd_output.ppm
make akari2 || exit 1
make akari2 >/dev/null|| exit 1
read -r -n 1 -p "Press any key to cat akari2.c: "
cat akari2.c
echo 1>&2
read -r -n 1 -p "Press any key to run: ./akari2 < akari2.c: "
./akari2 < akari2.c
echo 1>&2
read -r -n 1 -p "Press any key to run: ./akari2 rot13 < akari2.c: "
./akari2 rot13 < akari2.c
make akari3 || exit 1
make akari3 >/dev/null|| exit 1
read -r -n 1 -p "Press any key to cat akari3.c: "
cat akari3.c
echo 1>&2
read -r -n 1 -p "Press any key to run: ./akari3: "
./akari3
echo 1>&2
make akari4 || exit 1
make akari4 >/dev/null|| exit 1
read -r -n 1 -p "Press any key to cat akari4.c: "
cat akari4.c
read -r -n 1 -p "Press any key to run: ./akari4: "
./akari4
echo 1>&2
read -r -n 1 -p "Press any key to run: ./akari2 rot13 < akari.c | ./akari > rot13.c; cat rot13.c: "
./akari2 rot13 < akari.c | ./akari > rot13.c; cat rot13.c
read -r -n 1 -p "Press any key to run: ./akari2 < akari.c > expanded_output.txt: "
./akari2 < akari.c > expanded_output.txt
read -r -n 1 -p "Press any key to run: ./akari2 rot13 < akari.c > expanded_and_rot13_output.txt: "
./akari2 rot13 < akari.c > expanded_and_rot13_output.txt
read -r -n 1 -p "Press any key to cat expanded_and_rot13_output.txt: "
cat expanded_and_rot13_output.txt
+5
View File
@@ -3206,6 +3206,11 @@ We're not able to test this.
# <a name="2011"></a>2011
## [2011/akari](2011/akari/akari.c) ([README.md](2011/akari/README.md]))
Cody added the [try.sh](2011/akari/try.sh) script.
## [2011/borsanyi](2011/borsanyi/borsanyi.c) ([README.md](2011/borsanyi/README.md]))
Cody, out of an abundance of caution, added a second arg to `main()` as some