Undo no arg check in 1990/theorem

As part of the redefinition of INABIAF one of the segfault fixes has
been undone. The others were necessary as part of making the entry work
in modern systems but this one should not have been done. Instead the
Makefile and README.md warn about it.

I did however discover another bug with this entry that makes one of the
generated programs not work. I documented that in bugs.md and I'll look
at it another time.
This commit is contained in:
Cody Boone Ferguson committed 2023-04-07 10:36:44 -07:00
1 parent 2ed80eb224
commit cdc2cffdd0
3 files changed
+15 -15

No files matched your search

+1
View File
@@ -133,6 +133,7 @@ all: data ${TARGET}
supernova deep_magic magic charon pluto supernova deep_magic magic charon pluto
${PROG}: ${PROG}.c ${PROG}: ${PROG}.c
@echo "NOTE: this entry will segfault on no arg specified."
${CC} ${CFLAGS} $< -o $@ ${LIBS} ${CC} ${CFLAGS} $< -o $@ ${LIBS}
sorter.c: ${PROG} ${PROG}.c sorter.c: ${PROG} ${PROG}.c
+14 -14
View File
@@ -1,10 +1,10 @@
# Best of Show # Best of Show
Adrian Mariano Adrian Mariano
University of Washington University of Washington
2729 72nd Ave SE 2729 72nd Ave SE
Mercer Island, WA 98040 Mercer Island, WA 98040
USA USA
## To build: ## To build:
@@ -12,13 +12,12 @@
make all make all
[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed some segfaults [Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed some segfaults
under modern (and in some cases earlier) systems with this entry. He also fixed under modern (and in some cases earlier) systems with this entry. Originally we
a segfault if not enough args are used. Originally we noted that the 4 trailing noted that the 4 trailing args '0 0 0 0' were required on systems that dump core
args '0 0 0 0' were required on systems that dump core when NULL is dereferenced when NULL is dereferenced but this problem showed itself in modern systems even
but this problem showed itself in modern systems even with the 4 '0 0 0 0'. To with the 4 '0 0 0 0'. Finally he changed this program to use `fgets()` not
make this easier for users Cody also kindly fixed this problem. Finally he `gets()` to make it safer and to prevent a warning about `gets()` at linking or
changed this program to use `fgets()` not `gets()` to make it safer. Thank you runtime. Thank you Cody for your assistance!
Cody for your assistance!
[Yusuke Endoh](/winners.html#Yusuke_Endoh) pointed out that `atof` nowadays [Yusuke Endoh](/winners.html#Yusuke_Endoh) pointed out that `atof` nowadays
needs `#include <stdlib.h>` which was used in order to get this to work needs `#include <stdlib.h>` which was used in order to get this to work
@@ -37,6 +36,7 @@ where:
h - step size h - step size
y1 - initial value (y(x1) == y1) y1 - initial value (y(x1) == y1)
NOTE: this entry will segfault on no arg specified.
## Try: ## Try:
@@ -76,7 +76,7 @@ reversing filter! Try:
Still not impressed? The author throws in for free, a Still not impressed? The author throws in for free, a
sort program! Try: sort program! Try:
cc sorter.c -o sorter make sorter
ls | ./sorter ls | ./sorter
This program is safe for home use as well. The author has This program is safe for home use as well. The author has
@@ -89,7 +89,7 @@ And finally, as a special offer to users of this entry,
the author provides a Fibonacci sequence generator! Try: the author provides a Fibonacci sequence generator! Try:
./sorter 0 0 0 0 < theorem.c > fibonacci.c ./sorter 0 0 0 0 < theorem.c > fibonacci.c
cc fibonacci.c -o fibonacci make fibonacci
./fibonacci 1 1 ./fibonacci 1 1
./fibonacci 2 1 ./fibonacci 2 1
-1
View File
@@ -24,7 +24,6 @@ w(g,R,u)float*g,u;char R;
/**/{int b,f;A=atoi(++a);b=atoi(++a);while((f=A+b)<15000){printf("%d\n",f);A=b;b=f;}} /**/{int b,f;A=atoi(++a);b=atoi(++a);while((f=A+b)<15000){printf("%d\n",f);A=b;b=f;}}
main(A,a)int A;char*a[]; main(A,a)int A;char*a[];
o o o o
if (a[1]==NULL||a[2]==NULL||a[3]==NULL||a[4]==NULL||a[5]==NULL) return 1;
if(!strcmp(*++a,"-r"))S(); if(!strcmp(*++a,"-r"))S();
D=atof(*++a); D=atof(*++a);
T=atof(*++a); T=atof(*++a);