Fix segfault in 1984/laman without an arg
This commit is contained in:
1 parent
0e2a09de93
commit
860cffbdad
3 files changed
+6
-7
No files matched your search
@@ -159,8 +159,6 @@ 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 likely dump core without an arg and it will not work without"
|
|
||||||
@echo "a positive number."
|
|
||||||
${CC} ${CFLAGS} $< -o $@ ${LIBS}
|
${CC} ${CFLAGS} $< -o $@ ${LIBS}
|
||||||
|
|
||||||
# alternative executable
|
# alternative executable
|
||||||
|
|||||||
@@ -10,9 +10,13 @@ Mike Laman
|
|||||||
|
|
||||||
./laman <positive number>
|
./laman <positive number>
|
||||||
|
|
||||||
|
[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed this entry to not
|
||||||
|
segfault if no arg is specified. Instead it'll print nothing. Thank you Cody for
|
||||||
|
your assistance!
|
||||||
|
|
||||||
## Try:
|
## Try:
|
||||||
|
|
||||||
The program accepts ONE positive argument. Seeing is believing, so try things
|
The program accepts ONE POSITIVE argument. Seeing is believing, so try things
|
||||||
like:
|
like:
|
||||||
|
|
||||||
./laman 4
|
./laman 4
|
||||||
@@ -21,9 +25,6 @@ like:
|
|||||||
|
|
||||||
This code should run you in circles.
|
This code should run you in circles.
|
||||||
|
|
||||||
NOTE: this program will likely segfault if you do not provide an argument and it
|
|
||||||
will not print anything if the number is not positive or not a number.
|
|
||||||
|
|
||||||
## Judges' comments:
|
## Judges' comments:
|
||||||
|
|
||||||
Some new compilers dislike lines 6 and 10 of the source, so we changed
|
Some new compilers dislike lines 6 and 10 of the source, so we changed
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
a[900]; b;c;d=1 ;e=1;f; g;h;O; main(k,
|
a[900]; b;c;d=1 ;e=1;f; g;h;O; main(k,
|
||||||
l)char* *l;{g= atoi(* ++l); for(k=
|
l)char* *l;{g= l[1]? atoi(*++l) :0;for(k=
|
||||||
0;k*k< g;b=k ++>>1) ;for(h= 0;h*h<=
|
0;k*k< g;b=k ++>>1) ;for(h= 0;h*h<=
|
||||||
g;++h); --h;c=( (h+=g>h *(h+1)) -1)>>1;
|
g;++h); --h;c=( (h+=g>h *(h+1)) -1)>>1;
|
||||||
while(d <=g){ ++O;for (f=0;f< O&&d<=g
|
while(d <=g){ ++O;for (f=0;f< O&&d<=g
|
||||||
|
|||||||
Reference in new issue
Block a user