Fix bugs in 1990/westley

If no arg is specified it crashed. If arg was not a number > 0 it
entered an infinite loop. Both have been fixed, exiting 1.

These checks were NOT done in the alt code as that's a copy of the
original code.
This commit is contained in:
Cody Boone Ferguson committed 2023-10-30 06:59:39 -07:00
1 parent 92cb3c43db
commit 1df3b50b23
4 files changed
+8 -32

No files matched your search

+2 -19
View File
@@ -15,30 +15,13 @@ 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 [1990 westley in bugs.md](/bugs.md#1990-westley).
## To use:
```sh
./westley number
./westley <number
```
### INABIAF - it's not a bug it's a feature :-)
This entry will very likely crash or do something else without an arg.
This program will enter an infinite loop if input is not a number > 0.
The number should be greater than 0.
## Try:
+1
View File
@@ -11,6 +11,7 @@ char*lie;
dear; (char)lotte--;
if (ly < 2 || atoi(die[1])<1) exit(1);
for(get= !me;; not){
1 - out & out ;lie;{
-13
View File
@@ -634,19 +634,6 @@ will enter an infinite loop, printing 0 over and over again; another condition
where this occurred was fixed but this one should not be fixed. Thank you.
## 1990 westley
### STATUS: known bug - please help us fix
### Source code: [1990/westley/westley.c](1990/westley/westley.c)
### Information: [1990/westley/README.md](1990/westley/README.md)
This entry will very likely crash or do something strange without an arg.
This entry will also enter an infinite loop if input is not a number > 0.
If you want to try and fix this (mis)feature, you are welcome to try.
# 1991
+5
View File
@@ -1015,6 +1015,11 @@ was changed to just `1`. Since it's instructional to see the differences he has
provided an alternate version, [westley.alt.c](1990/westley/westley.alt.c), which
is the original code.
He also fixed the code to not enter an infinite loop if arg is a number not > 0
and to not crash if no arg is specified.
The alt code did NOT have arg checks added as it is actually a copy of the
original code.
## [1991/brnstnd](1991/brnstnd/brnstnd.c) ([README.md](1991/brnstnd/README.md]))