From d629239eef3a93bc25b933e03e3d301c4786dcf1 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Mon, 30 Oct 2023 05:41:15 -0700 Subject: [PATCH] Fix 1994/horton - check args --- 1994/horton/Makefile | 4 ++-- 1994/horton/README.md | 17 ----------------- 1994/horton/horton.c | 2 +- bugs.md | 12 ------------ thanks-for-fixes.md | 6 ++++++ 5 files changed, 9 insertions(+), 32 deletions(-) diff --git a/1994/horton/Makefile b/1994/horton/Makefile index 277c6ef4d..1ec5f9a7b 100644 --- a/1994/horton/Makefile +++ b/1994/horton/Makefile @@ -59,11 +59,11 @@ ARCH= # Defines that are needed to compile # -CDEFINE= +CDEFINE= -DE='exit(1)' -DA=argc # Include files that are needed to compile # -CINCLUDE= +CINCLUDE= -include stdlib.h # Optimization # diff --git a/1994/horton/README.md b/1994/horton/README.md index 9a8b4ef04..d4e7ba0ed 100644 --- a/1994/horton/README.md +++ b/1994/horton/README.md @@ -11,17 +11,6 @@ make all ``` -### Bugs and (Mis)features - -The current status of this entry is: - -``` -STATUS: known bug - please help us fix -``` - -For more detailed information see [1994 horton in bugs.md](/bugs.md#1994-horton). - - ## To use: ```sh @@ -30,12 +19,6 @@ For more detailed information see [1994 horton in bugs.md](/bugs.md#1994-horton) `A`, `B`, `C` and `D` are numeric arguments. -### INABIAF - it's not a bug it's a feature! :-) - -Running this program without enough args will very likely crash or do something -else. - -## Try: ```sh ./horton 3 2 1 0 diff --git a/1994/horton/horton.c b/1994/horton/horton.c index 5e243facc..7ffae0aad 100644 --- a/1994/horton/horton.c +++ b/1994/horton/horton.c @@ -1,6 +1,6 @@ #define S(r, c) f[r][c] = 1; -char f[96][160]; main(argc, argv) char **argv; { double x, y, atof(); int +char f[96][160]; main(argc, argv) char **argv; {if(A<5)E;double x, y; int r , c , bi , diff --git a/bugs.md b/bugs.md index 944c760c9..7df5d6f1e 100644 --- a/bugs.md +++ b/bugs.md @@ -832,18 +832,6 @@ An alternate version, however, does exist. See the README.md file for details. # 1994 -## 1994 horton - -### STATUS: known bug - please help us fix -### Source code: [1994/horton/horton.c](1994/horton/horton.c) -### Information: [1994/horton/README.md](1994/horton/README.md) - -If not enough args are specified this program will likely crash or do something -else. - -If you want to try and fix this (mis)feature, you are welcome to try. - - ## 1994 ldb ### STATUS: INABIAF - please **DO NOT** fix diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md index 8c8300fbe..278636b9f 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -1289,6 +1289,12 @@ arg (as it was 0 at file scope already this is perfectly fine and it means there's no need to cast it to an int in the function call though that would also work). +## [1994/horton](1994/horton/horton.c) ([README.md](1994/horton/README.md)) + +Cody fixed this to check that four args were specified. With the use of the C +pre-processor macro and inclusion of stdlib.h in the Makefile the layout of the +source is exactly the same column width and no additional lines were added. + ## [1994/ldb](1994/ldb/ldb.c) ([README.md](1994/ldb/README.md]))