Update 2001/westley/try.sh + bugs.md

The try script was improved slightly.

The bugs.md file now refers to a new status type for this entry.

Updated the todo file removing this item.
This commit is contained in:
Cody Boone Ferguson committed 2024-02-04 09:30:37 -08:00
1 parent 2115b4b58f
commit 106ae0c8e1
4 files changed
+41 -21

No files matched your search

+1
View File
@@ -17,6 +17,7 @@ The current status of this entry is:
``` ```
STATUS: uses gets() - change to fgets() if possible STATUS: uses gets() - change to fgets() if possible
STATUS: missing files - please provide them STATUS: missing files - please provide them
STATUS: main() has only one arg - try and make it have 2 or 3
``` ```
For more detailed information see [2001 westley in bugs.md](/bugs.md#2001-westley). For more detailed information see [2001 westley in bugs.md](/bugs.md#2001-westley).
+10 -15
View File
@@ -15,15 +15,14 @@ make CC="$CC" all >/dev/null || exit 1
# clear screen after compilation so that only the entry is shown # clear screen after compilation so that only the entry is shown
clear clear
echo "$ ./westley < westley.c 2>/dev/null | tee westley2.c" 1>&2 read -r -n 1 -p "Press any key to run: ./westley < westley.c (space = next page, q = quit): "
read -r -n 1 -p "Press any key to continue (space = next page, q = quit): "
echo 1>&2 echo 1>&2
./westley < westley.c 2>/dev/null | tee westley2.c | less -rEXF ./westley < westley.c 2>/dev/null | tee westley2.c | less -rEXFK
echo "Compiling westley2.c..." 1>&2 echo "Compiling westley2.c..." 1>&2
make CC="$CC" westley2 2>/dev/null 1>&2 make CC="$CC" westley2 2>/dev/null 1>&2
echo 1>&2 echo 1>&2
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"
read -r -n 1 -p "Press any key to continue: " read -r -n 1 -p "Press any key to continue: "
echo 1>&2 echo 1>&2
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
@@ -39,43 +38,39 @@ read -r -n 1 -p "Press any key to continue (space = next page, q = quit): "
echo 1>&2 echo 1>&2
# 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.
# shellcheck disable=SC2094 # shellcheck disable=SC2094
./westley.sort < westley.c 2>/dev/null | diff -s - westley.c | less -rEXF ./westley.sort < westley.c 2>/dev/null | diff -s - westley.c | less -rEXFK
echo 1>&2 echo 1>&2
echo "$ ./westley.sort < westley.c 2>/dev/null | diff - westley2.c" echo "$ ./westley.sort < westley.c 2>/dev/null | diff - westley2.c"
read -r -n 1 -p "Press any key to continue (space = next page, q = quit): " read -r -n 1 -p "Press any key to continue (space = next page, q = quit): "
echo 1>&2 echo 1>&2
./westley.sort < westley.c 2>/dev/null | diff -s - westley2.c | less -rEXF ./westley.sort < westley.c 2>/dev/null | diff -s - westley2.c | less -rEXFK
echo 1>&2 echo 1>&2
echo "$ ./westley.sort < westley.c 2>/dev/null | diff - westley.sort.c" echo "$ ./westley.sort < westley.c 2>/dev/null | diff - westley.sort.c"
read -r -n 1 -p "Press any key to continue (space = next page, q = quit): " read -r -n 1 -p "Press any key to continue (space = next page, q = quit): "
echo 1>&2 echo 1>&2
./westley.sort < westley.c 2>/dev/null | diff - westley.sort.c | less -rEXF ./westley.sort < westley.c 2>/dev/null | diff - westley.sort.c | less -rEXFK
echo 1>&2 echo 1>&2
echo "$ ./westley.sort < westley.c 2>/dev/null | diff - westley.punch.c" echo "$ ./westley.sort < westley.c 2>/dev/null | diff - westley.punch.c"
read -r -n 1 -p "Press any key to continue (space = next page, q = quit): " read -r -n 1 -p "Press any key to continue (space = next page, q = quit): "
echo 1>&2 echo 1>&2
./westley.sort < westley.c 2>/dev/null | diff - westley.punch.c | less -rEXF ./westley.sort < westley.c 2>/dev/null | diff - westley.punch.c | less -rEXFK
echo 1>&2 echo 1>&2
# SC2028 (info): echo may not expand escape sequences. Use printf. read -r -n 1 -p "Press any key to run: printf \"1\n\4\n5\" | ./westley: "
# shellcheck disable=SC2028
read -r -n 1 -p "Press any key to run: printf \"1\n\4\n5\" | ./westley 2>/dev/null: "
echo 1>&2 echo 1>&2
printf "1\n4\n5" | ./westley 2>/dev/null printf "1\n4\n5" | ./westley 2>/dev/null
echo 1>&2 echo 1>&2
echo 1>&2 echo 1>&2
# SC2028 (info): echo may not expand escape sequences. Use printf. read -r -n 1 -p "Press any key to run: printf \"1\n4\n5\" | ./westley: "
# shellcheck disable=SC2028
read -r -n 1 -p "Press any key to run: printf \"1\n4\n5\" | ./westley 2>/dev/null: "
echo 1>&2 echo 1>&2
printf "1\n4\n5" | ./westley 2>/dev/null printf "1\n4\n5" | ./westley 2>/dev/null
echo 1>&2 echo 1>&2
echo 1>&2 echo 1>&2
read -r -n 1 -p "Press any key to run: echo 'Hello, world!' | ./westley.punch 2>/dev/null: " read -r -n 1 -p "Press any key to run: echo 'Hello, world!' | ./westley.punch: "
echo 1>&2 echo 1>&2
echo 'Hello, world!' | ./westley.punch 2>/dev/null echo 'Hello, world!' | ./westley.punch 2>/dev/null
+29 -2
View File
@@ -291,6 +291,18 @@ techniques to get them to compile. In some cases this introduced a problem but
typically if not always that problem exists with compilers that are less strict. typically if not always that problem exists with compilers that are less strict.
## STATUS: main() has only one arg - try and make it have 2 or 3
Because some versions of clang complain about the number of args of `main()` and
in particular say (when it has four, for instance) that it's only allowed to
have 0, 2 or 3 args, numerous entries had a second arg added to `main()` (if
they only had one). This is in case clang adds further restrictions which is not
impossible especially as it already claims having only one arg is not allowed.
At this time (04 Feb 2024) there is one entry known (it is possible that not all
were checked) that has this problem but it's not as simple as the others to fix
without breaking it.
## STATUS: compiled executable crashes - please help us fix ## STATUS: compiled executable crashes - please help us fix
NOTE: we're still locating entries and working on fixes with this status so we're not yet NOTE: we're still locating entries and working on fixes with this status so we're not yet
@@ -2121,15 +2133,30 @@ There's also no way to escape meta characters.
## 2001 westley ## 2001 westley
### STATUS: missing files - please provide them
### STATUS: uses gets() - change to fgets() if possible ### STATUS: uses gets() - change to fgets() if possible
### Source code: [2001/westley/westley.c](2001/westley/westley.c) ### Source code: [2001/westley/westley.c](2001/westley/westley.c)
### Information: [2001/westley/README.md](2001/westley/README.md) ### Information: [2001/westley/README.md](2001/westley/README.md)
This function uses `gets(3)` but it would be ideal if it used `fgets(3)`. This This function uses `gets(3)` but it would be ideal if it used `fgets(3)`. This
one is rather complicated and will be looked at later but you are welcome to try one is rather complicated and will be looked at later (some progress was made by
Cody but it is less important than other work) but you are welcome to try
and fix this if you wish. and fix this if you wish.
### STATUS: main() has only one arg - try and make it have 2 or 3
This program only has one arg to `main()`. However changing it to have 2 is not
as simple as it might seem. Doing this breaks things. If memory serves changing
it to two will, for instance, break the punch card code output. It might be that
that is for `fgets(3)`, however, but the point remains: in order to test any
fixes you must determine if the extra files generated (some from `sort(1)`) -
see the README.md file - generate correct output as well as that the main entry
does too. You might try running the `try.sh` script and redirect it to a file
first so that you can compare the output. Make sure to recreate the extra files
as described by the author if you do fix this. This might be looked at later if
nobody else takes up the challenge.
### STATUS: missing files - please provide them ### STATUS: missing files - please provide them
The author referred to a file `card.gif` but this file is missing. Do you have The author referred to a file `card.gif` but this file is missing. Do you have
+1 -4
View File
@@ -1,5 +1,5 @@
# A todo list of known things to check and/or do # A todo list of known things to check and/or do
*Last updated: Sun 04 Feb 2024 17:11:22 UTC* *Last updated: Sun 04 Feb 2024 17:30:08 UTC*
This document is for [Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) as This document is for [Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) as
he (that is I :-) ) wanted a way to keep track of things in a way that did not he (that is I :-) ) wanted a way to keep track of things in a way that did not
@@ -28,9 +28,6 @@ completed.
1615962832](https://github.com/ioccc-src/temp-test-ioccc/issues/3#issuecomment-1615962832) 1615962832](https://github.com/ioccc-src/temp-test-ioccc/issues/3#issuecomment-1615962832)
for links about the todo items wrt the [FAQ](/faq.md). for links about the todo items wrt the [FAQ](/faq.md).
- Check 2001/westley for making `main()` have two args. Easy to make it have two
args but harder to make it function right.
- Check for video links in README.md files and see if the videos can be - Check for video links in README.md files and see if the videos can be
embedded into the README.md files themselves. An entry that the video file is embedded into the README.md files themselves. An entry that the video file is
downloaded already is 2006/sykes1. There are others that I need to look at once downloaded already is 2006/sykes1. There are others that I need to look at once