Merge pull request #139 from xexyl/1998/schnitzi
Fix segfault in 1998/schnitzi
This commit is contained in:
5 files changed
+45
-7
No files matched your search
@@ -1,2 +1,4 @@
|
|||||||
data
|
data
|
||||||
schnitzi
|
schnitzi
|
||||||
|
sort
|
||||||
|
sort.c
|
||||||
@@ -97,7 +97,7 @@ CDEFINE=
|
|||||||
|
|
||||||
# Include files that are needed to compile
|
# Include files that are needed to compile
|
||||||
#
|
#
|
||||||
CINCLUDE=
|
CINCLUDE= -include stdlib.h
|
||||||
#CINCLUDE= -include stdlib.h
|
#CINCLUDE= -include stdlib.h
|
||||||
#CINCLUDE= -include stdio.h
|
#CINCLUDE= -include stdio.h
|
||||||
#CINCLUDE= -include stdlib.h -include stdio.h
|
#CINCLUDE= -include stdlib.h -include stdio.h
|
||||||
|
|||||||
+17
-2
@@ -16,6 +16,11 @@
|
|||||||
|
|
||||||
./schnitzi 5 > sort.c
|
./schnitzi 5 > sort.c
|
||||||
make sort
|
make sort
|
||||||
|
|
||||||
|
## Try:
|
||||||
|
|
||||||
|
./schnitzi 3 > sort.c
|
||||||
|
make sort
|
||||||
echo 123 > data
|
echo 123 > data
|
||||||
echo 234 >> data
|
echo 234 >> data
|
||||||
echo 413 >> data
|
echo 413 >> data
|
||||||
@@ -23,6 +28,10 @@
|
|||||||
echo 324 >> data
|
echo 324 >> data
|
||||||
./sort < data
|
./sort < data
|
||||||
|
|
||||||
|
[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed a segfault in
|
||||||
|
this entry. The problem was invalid data types. Thank you Cody for your
|
||||||
|
assistance!
|
||||||
|
|
||||||
## Judges' comments
|
## Judges' comments
|
||||||
|
|
||||||
This is a beautiful program. How can a program with no conditional
|
This is a beautiful program. How can a program with no conditional
|
||||||
@@ -31,6 +40,12 @@
|
|||||||
For hints on deciphering this, see below past the Author's Comments;
|
For hints on deciphering this, see below past the Author's Comments;
|
||||||
they're a nice summary, but they leave the mystery intact.
|
they're a nice summary, but they leave the mystery intact.
|
||||||
|
|
||||||
|
BTW: the author notes an incredible lipogram story called
|
||||||
|
[Gadsby](https://www.gutenberg.org/cache/epub/47342/pg47342.txt) which has no
|
||||||
|
letter E in the story. He did not note this but it has over 50000 (50 thousand)
|
||||||
|
(!!) words without the letter E which is one of the most common letters!
|
||||||
|
|
||||||
|
|
||||||
## Author's comments
|
## Author's comments
|
||||||
|
|
||||||
In literary circles, there is a poetic form called a "lipogram",
|
In literary circles, there is a poetic form called a "lipogram",
|
||||||
@@ -66,7 +81,7 @@
|
|||||||
So what does it do? Give it an integer (1 < n < 27) on the command
|
So what does it do? Give it an integer (1 < n < 27) on the command
|
||||||
line, such as
|
line, such as
|
||||||
|
|
||||||
schnitzi 5
|
./schnitzi 5
|
||||||
|
|
||||||
The output will itself be a lipographic program, one which inputs
|
The output will itself be a lipographic program, one which inputs
|
||||||
(in this case) five numbers and prints them out sorted. It sorts
|
(in this case) five numbers and prints them out sorted. It sorts
|
||||||
@@ -78,7 +93,7 @@
|
|||||||
|
|
||||||
and then compile it.
|
and then compile it.
|
||||||
|
|
||||||
Spoilers And Hints:
|
### Spoilers And Hints:
|
||||||
|
|
||||||
The big key to this program is figuring out what the names of the
|
The big key to this program is figuring out what the names of the
|
||||||
functions ought to be; a bit of research may allow you to guess at
|
functions ought to be; a bit of research may allow you to guess at
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
typedef void e();
|
typedef void e();
|
||||||
|
|
||||||
e *w,*l,*u,*_o,*j,*t,*O,exit,b,c_,b_,a_,c,a,z_,x_,d,y_,_m;
|
e *w,*l,*u,*_o,*j,*t,*O,b,c_,b_,a_,c,a,z_,x_,d,y_,_m,n,*h;
|
||||||
int q,m,_d,z,k,h,f[99];
|
int q,m,z,k,f[99];
|
||||||
char y[26],_p[40][26],_q,r[2],*_,**s,*i,
|
char y[26],_p[40][26],_q,r[2],*_,**s,*i,*_d,
|
||||||
|
|
||||||
*x[]= { "\n", ")", "if (", "}\n", ");\n\n", " ", ",&", "\"",
|
*x[]= { "\n", ")", "if (", "}\n", ");\n\n", " ", ",&", "\"",
|
||||||
",", " %%d", ";\n\n scanf(\"%%d", "%%d ", "else ", ",", "<",
|
",", " %%d", ";\n\n scanf(\"%%d", "%%d ", "else ", ",", "<",
|
||||||
@@ -52,5 +52,5 @@ void x_(){ O=g; *r=y[k-2]; _=r; j=o_; }
|
|||||||
void d (){ O=g; *r=y[k]; _=r; k=k+1; m=k<z; w=_t; l=p_; j=p; }
|
void d (){ O=g; *r=y[k]; _=r; k=k+1; m=k<z; w=_t; l=p_; j=p; }
|
||||||
void y_(){ O=g; *r=x[17][1]+k; _=r; j=q_; }
|
void y_(){ O=g; *r=x[17][1]+k; _=r; j=q_; }
|
||||||
void r_(){ O=_b; _=x[17]; s=(char**)_d; s=s+1; i=*s; q=0; }
|
void r_(){ O=_b; _=x[17]; s=(char**)_d; s=s+1; i=*s; q=0; }
|
||||||
main(int v,char **c){ O=r_; _d=c;
|
main(int v,char **V){ O=r_; _d=V;
|
||||||
x: (O)(); goto x; }
|
x: (O)(); goto x; }
|
||||||
@@ -315,6 +315,27 @@ type).
|
|||||||
|
|
||||||
# 1998
|
# 1998
|
||||||
|
|
||||||
|
## [1998/schnitzi](1998/schnitzi/schnitzi.c) ([README.md](1998/schnitzi/README.md))
|
||||||
|
|
||||||
|
### Status: INABIAF - please do not fix
|
||||||
|
|
||||||
|
If you get the compiler warning:
|
||||||
|
|
||||||
|
warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
|
||||||
|
11 | void g(){ O=j; printf(_); }
|
||||||
|
| ^~~~~~
|
||||||
|
|
||||||
|
|
||||||
|
please do NOT change it! Doing so will break the generated output.
|
||||||
|
|
||||||
|
Another warning to ignore is:
|
||||||
|
|
||||||
|
|
||||||
|
warning: assignment to 'char *' from incompatible pointer type 'char **' [-Wincompatible-pointer-types]
|
||||||
|
55 | main(int v,char **c){ O=r_; _d=c;
|
||||||
|
| ^
|
||||||
|
|
||||||
|
Please do not change this either.
|
||||||
|
|
||||||
# 2000
|
# 2000
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user