Merge pull request #1441 from xexyl/westley2001-try

This commit is contained in:
Landon Curt Noll authored and GitHub committed 2023-11-16 07:30:48 -07:00
commit 7de5d2197b
3 files changed
+28 -7

No files matched your search

+7 -2
View File
@@ -9,13 +9,18 @@ make
```sh ```sh
./westley ./westley
# enter some input, terminate with EOF
echo foo | ./westley
./westley < westley.c
``` ```
### Try: ### Try:
```sh ```sh
./westley.sh ./try.sh
``` ```
@@ -43,7 +48,7 @@ Use `westley.sort` as you would `westley` above.
The author also stated that if you just sort the code you'll get the with The author also stated that if you just sort the code you'll get the with
`sort`) version that just prints out the punch card. The `sort`) version that just prints out the punch card. The
[westley.punch.c](westley.punch.c) code specifically so that Westley can punch [westley.punch.c](westley.punch.c) code is specifically so that Westley can punch
everyone in the face! :-) This is also compiled by default. everyone in the face! :-) This is also compiled by default.
To use, try: To use, try:
@@ -1,14 +1,30 @@
#!/usr/bin/env bash #!/usr/bin/env bash
#
# try.sh - demonstrate IOCCC winner 2001/westley
#
echo "./westley < westley.c 2>/dev/null > westley2.c" # 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 "./westley < westley.c 2>/dev/null > westley2.c" 1>&2
./westley < westley.c 2>/dev/null > westley2.c ./westley < westley.c 2>/dev/null > westley2.c
make westley2 2>/dev/null 1>&2 echo "Compiling westley2.c..." 1>&2
make CC="$CC" westley2 2>/dev/null 1>&2
echo echo
echo "echo 'Bozos, please deflate shoes before entering the bus!'| ./westley2 2>/dev/null" echo "$ echo 'Bozos, please deflate shoes before entering the bus!'| ./westley2 2>/dev/null"
echo 'Bozos, please deflate shoes before entering the bus!'| ./westley2 2>/dev/null echo 'Bozos, please deflate shoes before entering the bus!'| ./westley2 2>/dev/null
echo echo
make westley.sort 2>/dev/null 1>&2 make CC="$CC" westley.sort 2>/dev/null 1>&2
echo echo
echo "./westley.sort < westley.c 2>/dev/null | diff - westley.c" echo "./westley.sort < westley.c 2>/dev/null | diff - westley.c"
# SC2094 (info): Make sure not to read and write the same file in the same pipeline. # SC2094 (info): Make sure not to read and write the same file in the same pipeline.
+1 -1
View File
@@ -2638,7 +2638,7 @@ README.md for details.
## [2001/westley](2001/westley/westley.c) ([README.md](2001/westley/README.md])) ## [2001/westley](2001/westley/westley.c) ([README.md](2001/westley/README.md]))
Cody added the script [westley.sh](westley.sh) to automate a heap of commands Cody added the script [try.sh](try.sh) to automate a heap of commands
that we, the IOCCC judges, suggested, as well as some additional ones that he that we, the IOCCC judges, suggested, as well as some additional ones that he
thought would be fun. He also provided the sort and punch card versions, thought would be fun. He also provided the sort and punch card versions,
described in the README.md, based on the author's remarks. described in the README.md, based on the author's remarks.