Fix both original and alt code for 1992/westley

For both check args.

For alt move main()'s code to new function as some versions of clang do
not allow four args. Instead main() has two args now, the traditional
argc and argv, and the other two are passed 0.
This commit is contained in:
Cody Boone Ferguson committed 2023-10-30 05:55:07 -07:00
1 parent 641ddafe2a
commit e2a8f813dc
4 files changed
+14 -23

No files matched your search

+2 -1
View File
@@ -1,4 +1,5 @@
main(l,a,n,d)char**a,**n,**d;{int N=n,D=d;for(D=atoi(a[1])/2*80-atoi(a[2])-2043;
pain(l,a,n,d)char**a,**n,**d;{int N=n,D=d;for(D=atoi(a[1])/2*80-atoi(a[2])-2043;
N="bnaBCOCXdBBHGYdAP[A M E R I C A].AqandkmavX|ELC}BOCd"
[l++-3];)for(;N-->64;)putchar(!D+++33^l&1);}
main(l,a)char**a;{pain(l,a,0,0);}
+3 -3
View File
@@ -1,7 +1,7 @@
main(l
,a)char**a;{int n;int
d;for(d=atoi(a[1])/10*80-
atoi(a[2])/5-596;n="@NKA\
,a)char**a;{int n;int d;
if (l>2)for(d=atoi(a[1])/10
*80-atoi(a[2])/5-596;n="@NKA\
CLCCGZAAQBEAADAFaISADJABBA^\
SNLGAQABDAXIMBAACTBATAHDBAN\
ZcEMMCCCCAAhEIJFAEAAABAfHJE\
-13
View File
@@ -788,19 +788,6 @@ As you might see the part under the `warning:` line is different.
Can you help us?
## 1992 westley
### STATUS: INABIAF - please **DO NOT** fix
### Source code: [1992/westley/westley.c](1992/westley/westley.c)
### Information: [1992/westley/README.md](1992/westley/README.md)
This program and the alternate version will very likely crash or
[nuke](https://en.wikipedia.org/wiki/Nuclear_weapon) the [entire
world](https://en.wikipedia.org/wiki/Earth) or just the
[USA](https://en.wikipedia.org/wiki/United_States), respectively, without enough
args. And not that we need any help with this or anything :-) but we do
encourage you to test it. This should not be fixed.
# 1993
+9 -6
View File
@@ -1209,15 +1209,18 @@ Cody fixed this to work for clang by changing the third and fourth arg of
**` and some versions do not even allow a fourth arg.
He also added the alternate version that the author gave in the remarks that is
specifically for the USA rather than the world.
specifically for the USA rather than the world. This had to be fixed for clang
as well to make the args of `main()` be the correct type and by moving the body
of main() to another function, `pain()`, which does the work since not all
versions of clang support four args to `main()`.
NOTE: as noted in the README.md file and the [bugs.md](/bugs.md), this program and the
[alternate version](1992/westley/westley.alt.c) will very likely crash or
[nuke](https://en.wikipedia.org/wiki/Nuclear_weapon) the [entire
Cody also added an arg check because the program and the
[alternate version](1992/westley/westley.alt.c) might have crashed or
[nuked](https://en.wikipedia.org/wiki/Nuclear_weapon) the [entire
world](https://en.wikipedia.org/wiki/Earth) or just the
[USA](https://en.wikipedia.org/wiki/United_States), respectively, without enough
args (2). And not that we need the help or anything for this :-) but we do
encourage you to test this :-) This should NOT be fixed.
args (2). And not that we need the help or anything for this :-) but we
encourage you to try the original :-)
## [1993/jonth](1993/jonth/jonth.c) ([README.md](1993/jonth/README.md]))