diff --git a/2001/westley/README.md b/2001/westley/README.md index 6a60bdc81..c422b9952 100644 --- a/2001/westley/README.md +++ b/2001/westley/README.md @@ -17,6 +17,7 @@ The current status of this entry is: ``` STATUS: uses gets() - change to fgets() if possible 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). diff --git a/2001/westley/try.sh b/2001/westley/try.sh index 664af080b..0f214ace4 100755 --- a/2001/westley/try.sh +++ b/2001/westley/try.sh @@ -15,15 +15,14 @@ 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 | tee westley2.c" 1>&2 -read -r -n 1 -p "Press any key to continue (space = next page, q = quit): " +read -r -n 1 -p "Press any key to run: ./westley < westley.c (space = next page, q = quit): " 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 make CC="$CC" westley2 2>/dev/null 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: " echo 1>&2 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 # SC2094 (info): Make sure not to read and write the same file in the same pipeline. # 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 "$ ./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): " 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 "$ ./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): " 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 "$ ./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): " 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 -# SC2028 (info): echo may not expand escape sequences. Use printf. -# shellcheck disable=SC2028 -read -r -n 1 -p "Press any key to run: printf \"1\n\4\n5\" | ./westley 2>/dev/null: " +read -r -n 1 -p "Press any key to run: printf \"1\n\4\n5\" | ./westley: " echo 1>&2 printf "1\n4\n5" | ./westley 2>/dev/null echo 1>&2 echo 1>&2 -# SC2028 (info): echo may not expand escape sequences. Use printf. -# shellcheck disable=SC2028 -read -r -n 1 -p "Press any key to run: printf \"1\n4\n5\" | ./westley 2>/dev/null: " +read -r -n 1 -p "Press any key to run: printf \"1\n4\n5\" | ./westley: " echo 1>&2 printf "1\n4\n5" | ./westley 2>/dev/null 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 'Hello, world!' | ./westley.punch 2>/dev/null diff --git a/bugs.md b/bugs.md index d95d767a3..c86625053 100644 --- a/bugs.md +++ b/bugs.md @@ -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. +## 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 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 -### STATUS: missing files - please provide them ### STATUS: uses gets() - change to fgets() if possible ### Source code: [2001/westley/westley.c](2001/westley/westley.c) ### 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 -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. + +### 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 The author referred to a file `card.gif` but this file is missing. Do you have diff --git a/tmp/things-todo.md b/tmp/things-todo.md index 356da3255..f1faaac2f 100644 --- a/tmp/things-todo.md +++ b/tmp/things-todo.md @@ -1,5 +1,5 @@ # 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 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) 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 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