Add 2000/dhyang/try.sh, make void main int main

The try.sh script is as usual: replaces what the judges recommended one
try.

It was suggested to me a while back that when I encounter a void main
that I change it to int to be more portable so I have done that.

README.md file typo/format checked.

This should complete the review of 2000/dhyang.
This commit is contained in:
Cody Boone Ferguson committed 2023-11-15 06:07:16 -08:00
1 parent c0a2eedb56
commit 1fc8a46cca
4 files changed
+62 -18

No files matched your search

+4 -17
View File
@@ -15,20 +15,7 @@ make
### Try:
```sh
make saitou
./saitou > aku.c
cat aku.c
make soku
./soku > soku.c
cat soku.c
make zan
./zan > zan.c
cat zan.c
make aku
./aku | diff - aku.c
./try.sh
```
@@ -53,9 +40,9 @@ them with cool layout!
For your enjoyment:
1. Compile [dhyang.c](dhyang.c).
2. Run `./dhyang` and pipe output to another .c file
3. Compile that file
4. Repeat steps 2 and 3 until eventually the output cycles
2. Run `./dhyang` and pipe output to another `.c` file.
3. Compile that file.
4. Repeat steps 2 and 3 until eventually the output cycles.
To interpret the output: the [dhyang.c](dhyang.c.c) is an image of Saitou
Hajime, which eventually generates three sources files that are images of "aku
+1 -1
View File
@@ -47,7 +47,7 @@
x^(p?6:0):(p = 34 X X X )
;}s(){for(x= n (); ( x^ ( p
?6:0))==32;x= n () ) ;return x ; }
void/**/main X () { r = p
int/**/main X () { r = p
=0;w=sprintf (X X X X X X o
,"char*d="); for ( f=1;f < * d
+143;)if(33-( b=d [ f++ X ] )
+50
View File
@@ -0,0 +1,50 @@
#!/usr/bin/env bash
#
# try.sh - demonstrate IOCCC winner 2000/dhyang
#
# 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 "$ make saitou >/dev/null" 1>&2
make saitou >/dev/null
echo "$ ./saitou > aku.c" 1>&2
./saitou > aku.c
echo "$ cat aku.c"
cat aku.c
echo "$ make soku >/dev/null" 1>&2
make soku >/dev/null
echo "$ ./soku > soku.c" 1>&2
./soku > soku.c
echo "$ cat soku.c" 1>&2
cat soku.c
echo "$ make zan >/dev/null" 1>&2
make zan >/dev/null
echo "$ ./zan > zan.c" 1>&2
./zan > zan.c
echo "$ cat zan.c" 1>&2
cat zan.c
echo "$ make aku >/dev/null" 1>&2
make aku >/dev/null
echo "$ ./aku | diff - aku.c" 1>&2
./aku | diff - aku.c
+7
View File
@@ -2265,6 +2265,13 @@ Cody fixed this to compile in systems that require one to explicitly link in
`libm`.
## [2000/dhyang](2000/dhyang/dhyang.c) ([README.md](2000/dhyang/README.md]))
Cody made this more portable by changing the `void main` to `int main`.
He also added the [try.sh](2000/dhyang/try.sh) script.
## [2000/dlowe](2000/dlowe/dlowe.c) ([README.md](2000/dlowe/README.md]))
Cody fixed this to compile with more recent perl versions; the symbol that's now