Add alt code to 1988/dale - original version
This is because I feel it can be interesting to see side by side what was once allowed in C with how it has to be today without having to extract it from the archive.
This commit is contained in:
1 parent
65d79be6e8
commit
e117f8a0ad
3 files changed
+41
-6
No files matched your search
+2
-2
@@ -112,8 +112,8 @@ OBJ= ${PROG}.o
|
|||||||
DATA=
|
DATA=
|
||||||
TARGET= ${PROG}
|
TARGET= ${PROG}
|
||||||
#
|
#
|
||||||
ALT_OBJ=
|
ALT_OBJ= ${PROG}.alt.o
|
||||||
ALT_TARGET=
|
ALT_TARGET= ${PROG}.alt
|
||||||
|
|
||||||
#################
|
#################
|
||||||
# build the entry
|
# build the entry
|
||||||
|
|||||||
+13
-4
@@ -1,10 +1,6 @@
|
|||||||
# Best abuse of system calls
|
# Best abuse of system calls
|
||||||
|
|
||||||
Paul Dale
|
Paul Dale
|
||||||
University of Queensland
|
|
||||||
Computer Science Dept
|
|
||||||
Dept of Computer Science
|
|
||||||
Uni of Qld, 4067
|
|
||||||
Australia
|
Australia
|
||||||
|
|
||||||
## To build:
|
## To build:
|
||||||
@@ -54,6 +50,7 @@ so Cody changed the lines to be in the form of:
|
|||||||
Thank you Cody for your assistance!
|
Thank you Cody for your assistance!
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Try:
|
## Try:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
@@ -64,6 +61,18 @@ Thank you Cody for your assistance!
|
|||||||
NOTE: in linux it might happen that core dumps are created when running this
|
NOTE: in linux it might happen that core dumps are created when running this
|
||||||
entry even though it works fine.
|
entry even though it works fine.
|
||||||
|
|
||||||
|
### Alternate code
|
||||||
|
|
||||||
|
If you have an old enough compiler you can try the original version in
|
||||||
|
[dale.alt.c](dale.alt.c). To use:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
make alt
|
||||||
|
```
|
||||||
|
|
||||||
|
Use `dale.alt` as you would `dale` above.
|
||||||
|
|
||||||
|
|
||||||
## Judges' remarks
|
## Judges' remarks
|
||||||
|
|
||||||
This entry has a very twisted flow of control via recursion, iteration
|
This entry has a very twisted flow of control via recursion, iteration
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
#define _ define
|
||||||
|
#_ P char
|
||||||
|
#_ p int
|
||||||
|
#_ O close(
|
||||||
|
#_ H strlen(*
|
||||||
|
#_ h case_2
|
||||||
|
#_ case_3 default
|
||||||
|
#_ while switch
|
||||||
|
#_ L if
|
||||||
|
#_ I goto
|
||||||
|
#_ l 1
|
||||||
|
#_ f write
|
||||||
|
#_ J else
|
||||||
|
#_ a(x)get/***/x/***/id())
|
||||||
|
P z[l<<(1<<l<<1)<<1<<(l<<1)<<(l<<l<<l)<<1],*v;p r,A=0,c=1;
|
||||||
|
q(Q)P*Q;{L(*++Q){*Q-=7;q(Q);}}main(V,C)P**C;{
|
||||||
|
p Z=chroot("/");L(!a(u)execv((q(v="/ipu6ljov"),v),C);Z-=kill(l);
|
||||||
|
while(V){
|
||||||
|
case_3:L(!(*C[c]-'-')&&!(C[c][c]-'n')&&!C[c][c<<c])V--,C++,Z=c;
|
||||||
|
case 1:O/*/*/0)+O(c*c-c+c/c)<<(c*c));dup(c);O/*/*/c);pipe(z);L(
|
||||||
|
for/*/(;;);/*/k()){O/*/*/c);
|
||||||
|
case_2:L(!--V){O/*/*/c*c+c);wait(A+c*c-c);L(!Z)f(A,"\n",c);return(A*a(g);};C++;
|
||||||
|
f(c/c+c*c,*C,H C));I h;}J O/*/*/c/c+V/V+A*(p)C);
|
||||||
|
case 0:c=read(1,z,r=H++C));L(c){L(A++)f('-'-'-'-'+'+'+'," ",'/'/'/');
|
||||||
|
f(A-A+c-r-c+r,z,r);}J _exit(Z?Z-Z:Z);};main(chroot("/tmp")+l,C);
|
||||||
|
}
|
||||||
Reference in new issue
Block a user