home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / sources / misc / 3922 < prev    next >
Encoding:
Text File  |  1992-09-10  |  54.3 KB  |  2,249 lines

  1. Newsgroups: comp.sources.misc
  2. Path: sparky!kent
  3. From: chongo@toad.com (Landon Curt Noll)
  4. Subject:  v32i031:  ioccc.1992 - 1992 International Obfuscated C Code Contest winners, Part04/05
  5. Message-ID: <1992Sep10.154532.27264@sparky.imd.sterling.com>
  6. Followup-To: comp.sources.d
  7. X-Md4-Signature: 0f6c6ff777027ecc308c543afe753f73
  8. Sender: kent@sparky.imd.sterling.com (Kent Landfield)
  9. Reply-To: chongo@hoptoad.UUCP (Landon C. Noll)
  10. Organization: Nebula Consultants in San Francisco
  11. References: <csm-v32i028=ioccc.1992.103926@sparky.IMD.Sterling.COM>
  12. Date: Thu, 10 Sep 1992 15:45:32 GMT
  13. Approved: kent@sparky.imd.sterling.com
  14. Lines: 2233
  15.  
  16. Submitted-by: chongo@toad.com (Landon Curt Noll)
  17. Posting-number: Volume 32, Issue 31
  18. Archive-name: ioccc.1992/part04
  19. Environment: C
  20.  
  21. #! /bin/sh
  22. # This is a shell archive.  Remove anything before this line, then feed it
  23. # into a shell via "sh file" or similar.  To overwrite existing files,
  24. # type "sh file -c".
  25. # Contents:  1992/adrian.c 1992/albert.c 1992/albert.hint 1992/ant.c
  26. #   1992/ant.test.mk 1992/buzzard.1.c 1992/buzzard.2.orig.c
  27. #   1992/help.th 1992/imc.c 1992/imc.orig.c 1992/kivinen.c
  28. #   1992/kivinen.hint 1992/kivinen.orig.c 1992/lush.c 1992/lush.hint
  29. #   1992/lush.orig.c 1992/marangon.c 1992/marangon.hint
  30. #   1992/marangon.orig.c 1992/nathan.c 1992/vern.c
  31. # Wrapped by kent@sparky on Thu Sep 10 10:21:21 1992
  32. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
  33. echo If this archive is complete, you will see the following message:
  34. echo '          "shar: End of archive 4 (of 5)."'
  35. if test -f '1992/adrian.c' -a "${1}" != "-c" ; then 
  36.   echo shar: Will not clobber existing file \"'1992/adrian.c'\"
  37. else
  38.   echo shar: Extracting \"'1992/adrian.c'\" \(2583 characters\)
  39.   sed "s/^X//" >'1992/adrian.c' <<'END_OF_FILE'
  40. X/* . wc . */
  41. X#include<stdio.h>/* Wht majr flwchrt? */
  42. X#include<string.h>/* That mjr flwchrt! */
  43. X#define P 257
  44. X#define G 17
  45. X#define z 8
  46. X#define v(jr) jr
  47. Xint W ,head;
  48. X#define S(W,b,f) strncpy(W,b,f),W[f]=0\
  49. X
  50. X  
  51. Xchar *wcs=" \t\n";
  52. Xstruct{ char X[z+1]; 
  53. X        char f ;
  54. X        int e ; 
  55. X        struct{ char g[z+1];
  56. X                int b ;
  57. X              } w[ G];
  58. X      } o[ P];
  59. Xint L=0,j= -28;
  60. X
  61. X
  62. Xvoid E(int i, int m,char*c)
  63. X{   
  64. X for(; i<43; i+=3) 
  65. X   putc("}|uutsrq`_^bji`[Zkediml[PO]a_M__]ISOYIRGTNR"[i]+i-9,stderr);
  66. X fprintf(stderr,"(%d): %s\n" ,m,c);
  67. X exit(1);
  68. X}
  69. X
  70. X
  71. X
  72. Xint N(int m, char *t)
  73. X{ 
  74. X  int i ;
  75. X  if (strlen ( 
  76. X              t)>z) t[z ]=0;
  77. X  for(i= 0; i< L ; i++) if(
  78. X                           !strcmp (o[ i] . X
  79. X                                             , t))return i;
  80. X  if( L== P)
  81. X             E(0, m, t);
  82. X  S (o[ L] . X , t
  83. X                  ,z);
  84. X  head; W = .1* head;
  85. X  o[L ].f = !( strchr( t,']' )== 0 );
  86. X  o[L ++ ] . e = 0;
  87. X  return L -1 ; }
  88. X
  89. X#define v(x )
  90. X
  91. Xint A(char *R)
  92. X{
  93. X  int c=0, i;
  94. X  while(* R) {
  95. X    i = -1;
  96. X    while(j){
  97. X      if( ++ i==o[ c].e ) return 0;
  98. X      if(o[ 
  99. X           c] .w[i ] .g[0 ] 
  100. X                            =='.' ||strchr (o[ c].w[i] .g ,* R)){
  101. X      c=
  102. X        o[ c ] .w[i].b; break;/*
  103. Xmain(int sl,char *j[]){
  104. X      sleep (~~~~~~~~atoi(j[1])) ;/* . sl
  105. X      sl s l . sl
  106. X      l l ]
  107. X      sl */ }
  108. X    }
  109. X    R++;
  110. X  }
  111. X  return o[ c].f;
  112. X}
  113. X
  114. X
  115. X main(int wc,char *V[]){char Y[999],*s;FILE*W;int m=0,echo,jr,q,wcl=0,wcw=0,wcc=0;
  116. X v(s = V[1]; if (*V=strrchr(s,'/'))s=*V+1;  if(( !strncmp( s + (jr=strlen(s)) -
  117. X  (q=strlen(V[2]) ),V[2],q))&&jr!=q) s[jr-q] = 0;  puts(s); )
  118. X int e,p,C=0,Q ,basename;
  119. X W= fopen(wc>= 2 ? V[1] : "adgrep.c","rt");
  120. Xecho| m^ e| 5| (int) .8| echo|
  121. Xwc |C ==o[o[C] .e] . 
  122. Xe| e==+p,p; s[o[C] .e ] 
  123. X;
  124. Xwhile( fgets(Y,998,W)) { wcc += strlen(Y); m++;
  125. X     if( s = strtok(Y,wcs)) wcw++;
  126. X     else continue ;
  127. X     C=
  128. X       basename= j +j+*"* . basename" 
  129. X                +j+*"* r ] " + N(m,s) ;
  130. Xwhile( s = strtok(0,wcs)) {
  131. X       if( o[ C ] . e == 
  132. X                         G) E(1 ,m,o[C] .X) ;
  133. X       S(o[C
  134. X             ] .w[o[C ] .e].g,s, z);
  135. X       Q= C ;
  136. X       if(! ( s =strtok ( 0 ,wcs )))wcw --
  137. X       ,E( 2 , m, o[C]
  138. X                   . w[ o[ Q ] .e] . g );
  139. X       e
  140. X         = o[C ] .w[o[C ] .e++ ] .b= N(m,s)
  141. X       ; wcw += 2; }  
  142. X     0&& 
  143. X        W && wcl++
  144. X                  < 10 && printf((W,Y)); }
  145. X   if(j+28) { {
  146. X                ; } printf("%7u%7u%7u\n", wcl , wcw , wcc); }
  147. X   while( gets(Y) ) if(A(Y)) puts(Y);
  148. X   W, jr; }
  149. X
  150. XO(int wc,char**V) {
  151. X--wc && (printf("%s ",*++V), main(wc,V), 1) || printf("\n"); }
  152. X
  153. END_OF_FILE
  154.   if test 2583 -ne `wc -c <'1992/adrian.c'`; then
  155.     echo shar: \"'1992/adrian.c'\" unpacked with wrong size!
  156.   fi
  157.   # end of '1992/adrian.c'
  158. fi
  159. if test -f '1992/albert.c' -a "${1}" != "-c" ; then 
  160.   echo shar: Will not clobber existing file \"'1992/albert.c'\"
  161. else
  162.   echo shar: Extracting \"'1992/albert.c'\" \(3164 characters\)
  163.   sed "s/^X//" >'1992/albert.c' <<'END_OF_FILE'
  164. X#include <stdio.h>
  165. X#include <malloc.h>
  166. X#include <setjmp.h>
  167. X#include <ctype.h>
  168. X#define new(PP) (PP *) malloc(sizeof(PP)) 
  169. Xtypedef struct q {
  170. X    jmp_buf ppp;
  171. X    long qq;
  172. X    struct q *P;
  173. X    struct q *p;
  174. X} 
  175. XPP;
  176. X
  177. XPP *P;
  178. Xint aaaaaa=2;
  179. Xint aaaaaaa=1;
  180. X
  181. Xlong qqq;
  182. X
  183. X
  184. XaaAaaa(aa,aaa)
  185. Xchar *aa;
  186. Xchar *aaa;
  187. X{
  188. X    char aaaa = 0;
  189. X    if ((((( aaa )))))
  190. X    {
  191. X        aaaa = *aa;
  192. X        *aa=0;
  193. X        aa+=strlen(aa+1);
  194. X        P =new(PP);
  195. X        P->P=P;
  196. X        P->p=P;
  197. X    }
  198. X
  199. X    if ((((( !setjmp(P->ppp) ))))) 
  200. X        {
  201. X        if ((((( !isdigit(*aa) )))))
  202. X            longjmp(P->ppp,aaaaaaa);
  203. X        else {
  204. X            P->p->P = new(PP);
  205. X            P->p->P->P = P;
  206. X            P->p->P->p = P->p;
  207. X            P->p = P->p->P;
  208. X
  209. X            P->qq = *aa--;
  210. X            P = P->p;
  211. X            aaAaaa(aa,0);
  212. X        }
  213. X    } else {
  214. X        if ( !aaaa&&!*aa ) 
  215. X           longjmp(P->p->ppp,aaaaaaa);
  216. X
  217. X        if ((((( (P->qq=aaaa)<10     &&!
  218. X                 (isdigit(aaaa))     ||!
  219. X                 (isdigit(*aa)       ||!
  220. X                 *aa                        )))))) 
  221. X        {
  222. X            fprintf(stderr,"Usage %c%s <number>\n",
  223. X            (aaa[0]?7:aaaa),aaa+!aaa[0]);
  224. X            exit(1);
  225. X        }
  226. X    }
  227. X}
  228. X
  229. X
  230. XppPppp(pp,ppp)
  231. XPP **pp, *ppp;
  232. X{
  233. X    int aa;
  234. X    if ((((( !(aa=setjmp(ppp->ppp))||aa==aaaaaa )))))
  235. X    {
  236. X        if ((((( *pp==ppp )))))
  237. X        {
  238. X            ppp = (*pp)->p;
  239. X
  240. X            if ( qqq<47 ) return;
  241. X            if ( ppp->qq!=48 ) return;
  242. X
  243. X            while ( ppp->qq==48 ) 
  244. X            {
  245. X                printf("%ld\n",qqq-45);
  246. X                *pp = ppp;
  247. X                ppp = ppp->p;
  248. X            }
  249. X            qqq -= 1;
  250. X            longjmp(ppp->ppp,aaaaaaa);
  251. X        } else {
  252. X            PP *p;
  253. X
  254. X            ppPppp(pp,ppp->p);
  255. X            for (p=ppp;p!=*pp;p=p->p)
  256. X            {
  257. X                int qq=4;
  258. X                if ((((( qqq<47                            &&
  259. X                         (qq=0,p->qq+=p->p->qq-96)>=48-qqq ||
  260. X                         qqq>46                            &&
  261. X                         (p->qq-=p->p->qq)<0                   ))))) 
  262. X                {
  263. X                    p->qq += qqq+qq;
  264. X                    if ( p->p==P && qqq<=46 )
  265. X                    {
  266. X                        P->p->P = new(PP);
  267. X                        P->p->P->P = P;
  268. X                        P->p->P->p = P->p;
  269. X                        *pp = P = P->p = P->p->P;
  270. X                        P->qq = 48;
  271. X                    }
  272. X
  273. X                    p->p->qq+=qq==0;
  274. X                    p->p->qq-=qq!=0;
  275. X                }
  276. X                else
  277. X                {
  278. X                    p->qq += 48;
  279. X                }
  280. X            }
  281. X            if ( ppp->P==P ) longjmp(ppp->ppp,aaaaaaa);
  282. X        }
  283. X    }
  284. X    else
  285. X    {
  286. X        qqq += 1; 
  287. X
  288. X        while (48==P->qq )
  289. X        {
  290. X            P->P->p = P->p;
  291. X            P = P->p->P = P->P;
  292. X
  293. X        }
  294. X
  295. X        if ( ppp!=ppp->p->p || qqq<47 )
  296. X            longjmp(ppp->ppp,aaaaaa);
  297. X        else
  298. X        {
  299. X            printf("At most one remains\n");
  300. X            exit(0);
  301. X        }
  302. X    }
  303. X}
  304. X
  305. X
  306. Xmain(aaa,aaaa)
  307. Xint aaa;
  308. Xchar **aaaa;
  309. X{
  310. X    aaAaaa(aaa==aaaaaaa?aaaa[0]:aaaa[1],aaaa[0]);
  311. X    qqq = 39;
  312. X    ppPppp(&P,P->p);
  313. X}
  314. X
  315. X
  316. END_OF_FILE
  317.   if test 3164 -ne `wc -c <'1992/albert.c'`; then
  318.     echo shar: \"'1992/albert.c'\" unpacked with wrong size!
  319.   fi
  320.   # end of '1992/albert.c'
  321. fi
  322. if test -f '1992/albert.hint' -a "${1}" != "-c" ; then 
  323.   echo shar: Will not clobber existing file \"'1992/albert.hint'\"
  324. else
  325.   echo shar: Extracting \"'1992/albert.hint'\" \(3193 characters\)
  326.   sed "s/^X//" >'1992/albert.hint' <<'END_OF_FILE'
  327. XMost Useful Program: <albert%bsovax@sun4nl.nluug.nl> Albert van der Horst
  328. X
  329. X    Albert van der Horst
  330. X    S P&A R&C
  331. X    Oranjestraat 8
  332. X    3511 RA   UTRECHT
  333. X    The Netherlands
  334. X
  335. X
  336. XJudges' comments:
  337. X
  338. X    For a canned example:
  339. X    make albert
  340. X    albert 1234567890123456789
  341. X    
  342. X    We were impressed with the speed at which it was able to factor
  343. X    arbitrarily large numbers consisting of factors that fit into
  344. X    a long.
  345. X
  346. X
  347. XSelected notes from the author:
  348. X
  349. X    The Obfuscated version of the Horst algorithm.
  350. X
  351. X    This program will factor unlimited length numbers and print the 
  352. X    factors in ascending order. Numbers of one digit (e.g. 8) 
  353. X    are rejected without notice.
  354. X    It quits as soon as there is at most one
  355. X    factor left, but that factor will not be shown. 
  356. X    It accomplishes this efficiently, without resorting to division
  357. X    or multiplication, until the candidate factor no longer fits in 
  358. X    a signed long. 
  359. X
  360. X    The nicest way is to rename the program into e.g. 4294967297
  361. X    if you want to factor Fermat's 4th number. Then just run it.
  362. X    Or you may type "prog <some-number>"
  363. X    A nice one is also (30 ones)
  364. X    albert 111111111111111111111111111111
  365. X
  366. X    Apart from the foregoing there are no special execution instructions.
  367. X
  368. X    To customize the program into a factorizer of a fixed number, use
  369. X    cc albert.c -o 4294967297
  370. X    or some such.
  371. X
  372. X    There are no data files used, and it is not possible to feed input
  373. X    via stdin.
  374. X
  375. X    I think this program is a nice example of algorithmic obfuscation.
  376. X    Several times two similar algorithms are merged into one. Then you 
  377. X    need quite some tricks to get it running, such as long jumps 
  378. X    through recursive subroutines. I felt like a sword smith, 
  379. X    welding the sword very long, folding it again to the proper 
  380. X    length, keep on hammering till it is tight, then fold again.
  381. X    Always keeping it at the proper red hot temperature, but not too
  382. X    hot lest the hardness fades.
  383. X    The strict naming conventions for subroutines did not make things 
  384. X    much clearer after all, but it was not supposed to.
  385. X
  386. X    I would like to draw attention to the robustness of the program
  387. X    with respect to error handling and the nice stopping criterion.
  388. X    The esthetic appeal of some lines is at the expense of clearness, 
  389. X    I apologize.
  390. X    Running the program through the c-beautifier reveals nothing,
  391. X    it will only destroy some of the lay out.
  392. X    Running the program through lint shows the usual remarks for a
  393. X    K&R program. Defeating this through casts does not make a program 
  394. X    cleaner in my opinion.
  395. X
  396. X    Here are some hints, but they may not be too helpful.
  397. X    1. The Horst algorithm is described in the Hobby Computer Club 
  398. X    Newsletter, year 82, part 4, a real Dutch treat.
  399. X       Assembler, c and Forth version have been around for some years.
  400. X    2. Does fractal programming exist after all?
  401. X    3. You remember the ToomCook algorithm in Knuth?
  402. X       It uses iteration instead of recursion and is quite jumpy.
  403. X       This program shares these disadvantages in a modified form.
  404. X    4. The Conversion is to be found in Knuth, not so the Observation.
  405. X       The Observation: "if it ends in a zero, it is divisible by ten"
  406. END_OF_FILE
  407.   if test 3193 -ne `wc -c <'1992/albert.hint'`; then
  408.     echo shar: \"'1992/albert.hint'\" unpacked with wrong size!
  409.   fi
  410.   # end of '1992/albert.hint'
  411. fi
  412. if test -f '1992/ant.c' -a "${1}" != "-c" ; then 
  413.   echo shar: Will not clobber existing file \"'1992/ant.c'\"
  414. else
  415.   echo shar: Extracting \"'1992/ant.c'\" \(2547 characters\)
  416.   sed "s/^X//" >'1992/ant.c' <<'END_OF_FILE'
  417. X#define W while
  418. X#define S strspn 
  419. X#define R return 
  420. X#define F fprintf(stderr,
  421. X#define C continue;
  422. X
  423. X#include <stdlib.h>
  424. X#include <stdio.h>
  425. X#include <string.h>
  426. X#include <sys/stat.h>
  427. X
  428. X#ifndef RULES
  429. X#define RULES    500
  430. X#endif
  431. X
  432. X#define N(p, i)    (p += i, p += S(p, w), i = strcspn(p, w))
  433. X
  434. Xchar *b, l[BUFSIZ], *t[RULES], *d[RULES], *c[RULES], w[] = "\n\t ";
  435. X
  436. Xtime_t M();
  437. Xint T();
  438. Xvoid U();
  439. X
  440. X
  441. Xtime_t
  442. XM(f)
  443. Xchar *f;
  444. X{
  445. X    int j, x;
  446. X    size_t i = 0;
  447. X    struct stat s;
  448. X    N(f, i);
  449. X    x = f[i];
  450. X    f[i] = 0; 
  451. X    j = stat(f, &s);
  452. X    f[i] = x;
  453. X    R j < 0 ? 0 : s.st_mtime;
  454. X}
  455. X
  456. Xint
  457. XT(f)
  458. Xchar *f;
  459. X{
  460. X    char *q;
  461. X    size_t i = 0, j, k = 1;
  462. X    N(f, i);
  463. X    W ((q = t[k])) {
  464. X        j = 0;
  465. X        W (N(q, j)) {
  466. X            if (i == j && !strncmp(f, q, i))
  467. X                R k;
  468. X        }
  469. X        ++k;
  470. X    }
  471. X    R 0;
  472. X}
  473. X
  474. Xvoid
  475. XU(f)
  476. Xchar *f;
  477. X{
  478. X    time_t t = M(f);
  479. X    size_t i = 0, j = !t, k = T(f);
  480. X    char *p = d[k], *q = c[k];
  481. X    if (!N(p, i) && q && *q != '\t' && j) {
  482. X        F "am: Don't know how to make '%s'.\n", f);
  483. X        exit(1);
  484. X    }
  485. X    W (0 < i) {
  486. X        U(p);
  487. X        if (t < M(p))
  488. X            j = 1;
  489. X        N(p, i);
  490. X    }
  491. X    if (j && q && *q == '\t') {
  492. X        sleep(1);
  493. X        W (*q++ == '\t') {
  494. X            i = j = 1;
  495. X            W (0 < S(q, "-+@")) {
  496. X                if (*q == '@')
  497. X                    
  498. X                    i = 0;
  499. X                if (*q++ == '-')
  500. X                    
  501. X                    j = 0;
  502. X            }
  503. X            if (i)
  504. X                puts(q);
  505. X            if (system(q) && j) {
  506. X                F "am: Error making '%s'\n", f);
  507. X                exit(1);
  508. X            }
  509. X            q += strlen(q) + 1;
  510. X        }
  511. X        c[k] = 0;
  512. X    }
  513. X}
  514. X
  515. Xint
  516. Xmain(u, v)
  517. Xint u;
  518. Xchar **v;
  519. X{
  520. X    FILE *f;
  521. X    struct stat s;
  522. X    size_t i, j, k;
  523. X    char *m, *n, *p, *q, *r;
  524. X    if (u < 2) {
  525. X        F "usage: am <makefile> [target]\n");
  526. X        R 2;
  527. X    }
  528. X    if (stat(*++v, &s) || !(f = fopen(*v, "r")))
  529. X        R 3;
  530. X    q = b = malloc(2*s.st_size);
  531. X    if (!b)
  532. X        R 4;
  533. X    i = 1;
  534. X    k = 0;
  535. X    m = 0;
  536. X    *t = *d = *c = "";
  537. X    W ((r = fgets(l, BUFSIZ, f))) {
  538. X        if (RULES <= i) {
  539. X            F "am: Number of target-rules exceeds %d.\n", RULES);
  540. X            R 1;
  541. X        }
  542. X        if (k) {
  543. X            *q++ = ' ';
  544. X            r += S(r, w);
  545. X        } else {
  546. X            if (t[i])
  547. X                c[i++] = q;
  548. X            if (m && putenv(m))
  549. X                F "am: No more environment space.\n");
  550. X            m = 0;
  551. X            if (*l == '#' || *l == '\n')
  552. X                C
  553. X            p = q;
  554. X        }
  555. X        W (!(k = *r == '\\' && r[1] == '\n') && *r) {
  556. X            if (*r == '$') {
  557. X                if (r[1] == '(') {
  558. X                    n = r+2;
  559. X                    r += strcspn(r, ")");
  560. X                    *r++ = 0;
  561. X                    n = getenv(n);
  562. X                    if (n) 
  563. X                        q = strcpy(q, n) + strlen(n);
  564. X                    C
  565. X                }
  566. X                if (*r == r[1])
  567. X                    ++r;
  568. X            } 
  569. X            if (*r == '=' && *l != '\t' && !m) {
  570. X                *q = 0;
  571. X                m = p;
  572. X                j = 0;
  573. X                q = N(m, j) + m;
  574. X                *q++ = *r;
  575. X                j = 1;
  576. X                if (!N(r, j))
  577. X                    *q++ = 0;
  578. X                C
  579. X            }
  580. X            if (*r == ':') {
  581. X                t[i] = p;
  582. X                *r = 0;
  583. X                d[i] = q+1;
  584. X            }
  585. X            if (*r == '\n')
  586. X                *r = 0;
  587. X            *q++ = *r++;
  588. X        }
  589. X    }
  590. X    fclose(f);
  591. X    U(2 < u ? *++v : t[1]);
  592. X    R 0;
  593. X}
  594. X
  595. END_OF_FILE
  596.   if test 2547 -ne `wc -c <'1992/ant.c'`; then
  597.     echo shar: \"'1992/ant.c'\" unpacked with wrong size!
  598.   fi
  599.   # end of '1992/ant.c'
  600. fi
  601. if test -f '1992/ant.test.mk' -a "${1}" != "-c" ; then 
  602.   echo shar: Will not clobber existing file \"'1992/ant.test.mk'\"
  603. else
  604.   echo shar: Extracting \"'1992/ant.test.mk'\" \(3164 characters\)
  605.   sed "s/^X//" >'1992/ant.test.mk' <<'END_OF_FILE'
  606. X#
  607. X#    Test makefile for AM
  608. X#
  609. X
  610. X#
  611. X#  Allow for empty macros.
  612. X#
  613. XEMPTY=
  614. X
  615. X#
  616. X#  Allow for white space in macro assignment.
  617. X#
  618. XTEXT_1=no white space
  619. XTEXT_2 =left hand side
  620. XTEXT_3= right hand side
  621. XTEXT_4 = both sides
  622. XTEXT_5    =    tabs boths sides
  623. X
  624. X#
  625. X#  Test psuedo targets.
  626. X#
  627. Xall : print_macros repeat redefine many flags multiple split errors done
  628. X
  629. Xprint_macros : empty t1 t2 t3 t4 t5 t.all
  630. X
  631. X#
  632. X#  Targets with no dependencies.
  633. X#
  634. Xempty :
  635. X    echo EMPTY='$(EMPTY)'
  636. X
  637. Xt1 :
  638. X    echo TEXT_1='$(TEXT_1)'
  639. X
  640. Xt2 :
  641. X    echo TEXT_2='$(TEXT_2)'
  642. X
  643. Xt3 :
  644. X    echo TEXT_3='$(TEXT_3)'
  645. X
  646. Xt4 :
  647. X    echo TEXT_4='$(TEXT_4)'
  648. X
  649. Xt5 :
  650. X    echo TEXT_5='$(TEXT_5)'
  651. X
  652. Xt.all :
  653. X    echo $(TEXT_1) $(TEXT_2) $(TEXT_3) $(TEXT_4) $(TEXT_5)
  654. X
  655. X#
  656. X#  Test redefinition of macros.  AM allows redefinition and 
  657. X#  evaluates macros immediately.
  658. X#
  659. XTEXT_1    =text number 1
  660. XTEXT_2    = test macro split \
  661. X    across lines \
  662. X    three lines
  663. XTEXT_3    = test dollar macro '$$'
  664. XTEXT_4    = test dollar again "$$(TEXT_1)"
  665. XTEXT_5    =    imbeded macro '$(TEXT_1)'
  666. X
  667. Xredefine : r1 r2 r3 r4 r5 
  668. X
  669. Xr1 :
  670. X    echo TEXT_1='$(TEXT_1)'
  671. X
  672. Xr2 :
  673. X    echo TEXT_2='$(TEXT_2)'
  674. X
  675. Xr3 :
  676. X    echo TEXT_3='$(TEXT_3)'
  677. X
  678. Xr4 :
  679. X    echo TEXT_4='$(TEXT_4)'
  680. X
  681. Xr5 :
  682. X    echo TEXT_5='$(TEXT_5)'
  683. X
  684. X#
  685. X#  Try to update a prerequisite more than once.  Subsequent occurences
  686. X#  should be ignored once a prerequisite has been updated.
  687. X#
  688. Xrepeat: t1 repeat.a t3
  689. Xrepeat.a : t2 t1
  690. X
  691. X
  692. X#
  693. X#  Target with multi-line receipe.
  694. X#
  695. Xmany : leaf.1 leaf.2
  696. X    echo Execute receipe with multiple commands.
  697. X    ls -1 leaf.*
  698. X    echo Last line of receipe for target 'many'.
  699. X
  700. Xleaf.1 :
  701. X    touch leaf.1
  702. X
  703. Xleaf.2 : 
  704. X    touch leaf.2
  705. X
  706. X
  707. X#
  708. X#  Test receipe line flags.
  709. X#
  710. Xflags : silence ignore always combination
  711. X
  712. X#  Command not displayed before execution.
  713. Xsilence :
  714. X    echo You should not see the 'ls' command printed. 
  715. X    @ls leaf.*
  716. X
  717. X#  Ignore errors from command.
  718. Xignore :
  719. X    echo The 'ls' command should fail but not terminate AM.
  720. X    -ls unknown
  721. X
  722. X#  This flag is ignored by AM since we don't support a silence option (-n).
  723. Xalways :
  724. X    +echo The '+' flag is accepted and ignored.
  725. X
  726. Xcombination:
  727. X    -@echo The next displayed line should not be 'ls unknown'
  728. X    @-ls unknown
  729. X    @+-echo Combined flags test completed.
  730. X
  731. X
  732. X#
  733. X#  Multiple targets.
  734. X#
  735. Xmultiple : node.2 node.5
  736. X
  737. Xnode.1 node.2 node.3 : leaf.1 leaf.2
  738. X    touch node.1 node.2 node.3
  739. X
  740. Xnode.4 node.5 : node.2 leaf.3 
  741. X    touch node.4 node.5
  742. X
  743. Xleaf.3 :
  744. X    touch leaf.3
  745. X
  746. X
  747. X#
  748. X#  Test split lines.
  749. X#
  750. Xsplit : node.6 leaf.4 split.cmd
  751. X    echo Completed split line tests.
  752. X
  753. X#  Target dependencies split across lines.
  754. Xnode.6 : leaf.1 \
  755. X    leaf.2 \
  756. X    leaf.3
  757. X    echo Test dependency list split across lines.
  758. X    touch node.6
  759. X
  760. X#  Target list split across lines.
  761. Xsplit.tar \
  762. Xleaf.4 \
  763. Xleaf.5 :
  764. X    echo Test target list split across lines
  765. X    touch leaf.4 leaf.5 
  766. X
  767. X#  Command lines split across lines.
  768. Xsplit.cmd:
  769. X    echo Try spliting command \
  770. X        lines across more \
  771. X    than one line.
  772. X
  773. X
  774. X#
  775. X#  Test AM error reports and exit statuses.
  776. X#
  777. Xerrors:
  778. X    -am test.mk error.1
  779. X    -am test.mk error.2
  780. X    -am test.mk error.3
  781. X    
  782. X#  Target that does not exist, has no dependencies, and no commands.
  783. Xerror.1:
  784. X
  785. X#  Target where dependency does not exist.
  786. Xerror.2: unknown
  787. X
  788. X#  Receipe command causes error.
  789. Xerror.3: t1 fail t2
  790. Xfail:
  791. X    ls -l unknown
  792. X
  793. X
  794. X#
  795. X#
  796. X#
  797. Xdone:
  798. X    echo AM Test Complete
  799. X
  800. Xclean:
  801. X    rm leaf.* node.*
  802. END_OF_FILE
  803.   if test 3164 -ne `wc -c <'1992/ant.test.mk'`; then
  804.     echo shar: \"'1992/ant.test.mk'\" unpacked with wrong size!
  805.   fi
  806.   # end of '1992/ant.test.mk'
  807. fi
  808. if test -f '1992/buzzard.1.c' -a "${1}" != "-c" ; then 
  809.   echo shar: Will not clobber existing file \"'1992/buzzard.1.c'\"
  810. else
  811.   echo shar: Extracting \"'1992/buzzard.1.c'\" \(2236 characters\)
  812.   sed "s/^X//" >'1992/buzzard.1.c' <<'END_OF_FILE'
  813. X#define A(c,a,b) t=b;t+=a;_(c)
  814. X#define    B(b,a) P(u,a)t=0;t-=a;R t+=u;t+=1;t/=2;_(b)
  815. X#define b(x) x(g)
  816. X#define C ;main(argc,argv)char**argv;{for(;!w;){q=0;l
  817. X#define c(y) x
  818. X#define D(c,a,b) t=a;t/=b;_(c)
  819. X#define d(x) S(x,x,1)
  820. X#define E(a,d) t=d;t-=p;t*=r;t*=a;p+=t;t=1;t-=a;r*=t;
  821. X#define e(x) y
  822. X#define f(x) x(e)
  823. X#define G(x,y) Q(x,atoi(argv[y]))
  824. X#define g(x) x(b)
  825. X#define H Q(w,1)Q(p,0)r=0;
  826. X#define h(x) x(c)
  827. X#define i(c,a,b) a(b,b,c)
  828. X#define J(x) Q(p,x)r=0;
  829. X#define j(x) Q(f(g),x)
  830. X#define K(x) Q(x,argc)
  831. X#define k(x) S(a,y,x)
  832. X#define L(x) u=p;u-=x;t=u;t*=u;R r+=2;r-=t;r/=2;
  833. X#define l L(q) q+=1;
  834. X#define M(c,a,b) t=a;t*=b;_(c)
  835. X#define m(x) x(a,a)
  836. X#define n(x) x(a,y)
  837. X#define O(c,a,b) t=b;t+=1;t+=a;t/=2;Q(c,t)
  838. X#define o(x,y) M(x,x,y)
  839. X#define P(b,a) t=a;R _(b)
  840. X#define R t+=2047;t/=2048;t+=8191;t/=8192;
  841. X#define Q(a,b) t=b;_(a)
  842. X#define S(c,a,b) t=a;t-=b;_(c)
  843. X#define T }
  844. X#define U(c,a,b) u=b;t=b;t-=1;t*=r;t+=1;b=t;t=a;t/=b;b=u;_(c)
  845. X#define V int t,u,q,p=0,r,w=0,
  846. X#define X(y) printf("%x\n",y);
  847. X#define Z(a,d) t=p;t-=d;t*=a;t+=d;_(p)r*=a;
  848. X#define _(a) t-=a;t*=r;a+=t;
  849. X
  850. XV a,x,y,s C
  851. X
  852. X        G(f(g),q)G(          g(h),2)n(B)Z(a,4)n(
  853. X    P)E(a,1)j(2989)H l k     (1)m(B)Z(a,6)l k(h(b))
  854. X      B(s,a             )m(P)        Z(s             ,8)E
  855. X    (a,q                   )Q(       s,h               (g)
  856. X   )Q(                               f(c                ),f
  857. X  (g)                                )j(                s)l
  858. X  i(b                                (h)                ,S,
  859. X f(b                                 ))n               (B)
  860. X E(a                                 ,2)             J(8)
  861. Xl j(                                x)Q(x,1)l n(P)Z(a,8
  862. X)o(x                                ,g(f))d(f(e))J(5)l j
  863. X(x)l                                 d(x              )S(a
  864. X ,x,                                 1)m                (B)
  865. X  Z(a                                ,10                 )U(
  866. X  a,y                                ,x)                 o(a
  867. X   ,x)                               k(a                 )m(
  868. X    P)E(                   a,7)      l j                (0)
  869. X      Q(s,1            )l D(a        ,x,              q)o(
  870. X    a,q)S(a,h(g),a)i(s,       M,a)i(a,A,g(f))i(q,D,x
  871. X        )o(s,16)B(a          ,x)E(a,9)H l j(2766)H
  872. X
  873. XT  X(b(f))  T
  874. END_OF_FILE
  875.   if test 2236 -ne `wc -c <'1992/buzzard.1.c'`; then
  876.     echo shar: \"'1992/buzzard.1.c'\" unpacked with wrong size!
  877.   fi
  878.   # end of '1992/buzzard.1.c'
  879. fi
  880. if test -f '1992/buzzard.2.orig.c' -a "${1}" != "-c" ; then 
  881.   echo shar: Will not clobber existing file \"'1992/buzzard.2.orig.c'\"
  882. else
  883.   echo shar: Extracting \"'1992/buzzard.2.orig.c'\" \(794 characters\)
  884.   sed "s/^X//" >'1992/buzzard.2.orig.c' <<'END_OF_FILE'
  885. X#define c 0 [m] ++ [m] =
  886. X#define z;break;case
  887. X
  888. Xchar s[5000];
  889. Xint m[20000]={32},L=1,I,T[500],*S=T,t=64,w,f;
  890. X
  891. Xa(x)
  892. X{
  893. X   c L;
  894. X   L= *m-1;
  895. X   c t;
  896. X   c x;
  897. X   scanf("%s",s+t);
  898. X   t+=strlen(s+t)+1;
  899. X}
  900. X
  901. Xr(x)
  902. X{
  903. X   switch(x++[m]){
  904. X    z 5:    for(w=scanf("%s",s)<1?exit(0):L;strcmp(s,&w[&m[1]][s]);w=m[w]);
  905. X        w-1 ? r(w+2) : (c 2,c atoi(s))
  906. X    z 12:    I=1[m]--[m]
  907. X    z 15:    f=S[-f]
  908. X    z 1:    c x 
  909. X    z 9:    f *=* S--
  910. X    z 7:    m[f]= *S--;
  911. X        f= *S--
  912. X    z 0:    *++S=f;
  913. X        f=I++[m]
  914. X    z 8:    f= *S --- f
  915. X    z 2:    m[++1[m]]=I;
  916. X        I=x
  917. X    z 11:    f=0>f
  918. X    z 4:    *m-=2;c 2
  919. X    z 6:    f=f[m]
  920. X    z 10:    f= *S--/f
  921. X    z 3:    a(1);
  922. X        c 2
  923. X    z 13:    putchar(f);
  924. X        f= *S--
  925. X    z 14:    *++S=f;
  926. X        f=getchar();
  927. X   }
  928. X}
  929. X
  930. Xmain()
  931. X{
  932. X   a(3);
  933. X   a(4);
  934. X   a(1);
  935. X   w= *m;
  936. X   c 5;
  937. X   c 2;
  938. X   I= *m;
  939. X   c w;
  940. X   c I-1;
  941. X   for(w=6;w<16;)
  942. X      a(1),c w++;
  943. X   m[1]= *m;
  944. X   for(*m+=512;;r(m[I++]));
  945. X}
  946. END_OF_FILE
  947.   if test 794 -ne `wc -c <'1992/buzzard.2.orig.c'`; then
  948.     echo shar: \"'1992/buzzard.2.orig.c'\" unpacked with wrong size!
  949.   fi
  950.   # end of '1992/buzzard.2.orig.c'
  951. fi
  952. if test -f '1992/help.th' -a "${1}" != "-c" ; then 
  953.   echo shar: Will not clobber existing file \"'1992/help.th'\"
  954. else
  955.   echo shar: Extracting \"'1992/help.th'\" \(1774 characters\)
  956.   sed "s/^X//" >'1992/help.th' <<'END_OF_FILE'
  957. X: help key  ( flush the carriage return form the input buffer )
  958. X
  959. X" The following are the standard known words; words marked with (*) are
  960. Ximmediate words, which cannot be used from command mode, but only in
  961. Xword definitions.  Words marked by (**) declare new words, so are always
  962. Xfollowed by the new word.
  963. X
  964. X    ! @        fetch, store
  965. X    + - * / mod    standard arithmetic operations
  966. X    = < > <= >=    standard comparison operations
  967. X
  968. X    not        boolean not of top of stack
  969. X    logical        turn top of stack into 0 or 1
  970. X
  971. X    dup over    duplicate the top of stack or second of stack
  972. X    swap drop    reverse top two elements or drop topmost
  973. X
  974. X    inc dec        increment/decrement the value at address from stack
  975. X    add        add a value from 2nd of stack into address from top
  976. X
  977. X    echo key    output character from, or input to, top of stack
  978. X    . #        print out number on top of stack without/with cr
  979. X    cr        print a carriage return
  980. X
  981. X[more]" key
  982. X" (**)    var        declare variable with initial value taken from stack
  983. X(**)    constant    declare constant with initial value taken from stack
  984. X(**)    array        declare an array with size taken from stack
  985. X
  986. X(*)    if...else...then    FORTH branching construct
  987. X(*)    do...loop        FORTH looping construct
  988. X    i j            loop values (not variables)
  989. X
  990. X    print        print the string pointed to on screen
  991. X
  992. X(*)(**) :        declare a new THIRD word
  993. X(*)    <build does>    declare a data types compile-time and run-time
  994. X(*)    ;        terminate a word definition
  995. X
  996. X[more]" key
  997. X" Advanced words:
  998. X    here        current location in dictionary
  999. X    h        pointer into dictionary
  1000. X    r        pointer to return stack
  1001. X    fromr tor    pop a value from or to the return stack
  1002. X
  1003. X    ,        write the top of stack to dictionary
  1004. X    '        store the address of the following word on the stack
  1005. X    allot        leave space on the dictionary
  1006. X
  1007. X    ::        compile a ':' header
  1008. X    [        switch into command mode
  1009. X    ]        continue doing : definitions
  1010. X" ;
  1011. END_OF_FILE
  1012.   if test 1774 -ne `wc -c <'1992/help.th'`; then
  1013.     echo shar: \"'1992/help.th'\" unpacked with wrong size!
  1014.   fi
  1015.   # end of '1992/help.th'
  1016. fi
  1017. if test -f '1992/imc.c' -a "${1}" != "-c" ; then 
  1018.   echo shar: Will not clobber existing file \"'1992/imc.c'\"
  1019. else
  1020.   echo shar: Extracting \"'1992/imc.c'\" \(1965 characters\)
  1021.   sed "s/^X//" >'1992/imc.c' <<'END_OF_FILE'
  1022. X#include             <stdio.h> 
  1023. X#include             <malloc.h> 
  1024. X#define              ext(a) (exit(a),0)
  1025. X#define I          " .:\';+<?F7RQ&%#*"
  1026. X#define a            "%s?\n"
  1027. X#define n            "0?\n"
  1028. X#define C            double    
  1029. X#define o             char
  1030. X#define l             long
  1031. X#define L            sscanf
  1032. X#define i            stderr
  1033. X#define e            stdout
  1034. X#define r               ext   (1)
  1035. X#define s(O,B)       L(++J,O,&B)!=1&&c>++q&&L(v[q],O,&B)!=1&&--q
  1036. X#define F(U,S,C,A) t=0,*++J&&(t=L(J,U,&C,&A)),(!t&&c>++q&&!(t=L(v[q],U,\
  1037. X           &C,&A)))?--q:(t<2&&c>++q&&!(t=L(v[q],S,&A))&&--q
  1038. X#define T(E)        (s("%d",E),E||(fputs(n,i),r))
  1039. X#define d(C,c)          (F("%lg,%lg","%lg",C,c)))
  1040. X#define O       (F("%d,%d","%d",N,U),(N&&U)||(fputs(n,i),r)))
  1041. X#define D              (s("%lg",f))
  1042. X#define E              putc
  1043. X                           C
  1044. X                        G=0,
  1045. X                        R
  1046. X                         =0,Q,H
  1047. X                        ,M,P,z,S
  1048. X                         =0,x=0
  1049. X                 ,        f=0;l b,j=0,          k
  1050. X                  =128,K=1,V,B=0,Y,m=128,p=0,N
  1051. X                 =768,U=768,h[]={0x59A66A95,256
  1052. X                 ,192,1,6912,1,0,0},t,A=0,W=0,Z=63,X=23
  1053. X                ;o*J,_;main(c,v)l c;o**v;{l q=1;for(;;q<
  1054. X          c       ?(((J=v[q])[0]&&J[0]<48&&J++,((_= *J)<99||
  1055. X        _/2==       '2'||(_-1)/3=='\"'||_==107||_/05*2==','||_
  1056. X          >0x074)?(   fprintf(i,a,v[q]),r):_>0152?(_/4>27?(_&1?(
  1057. X         O,Z=N,X=U):  (W++,N=Z,U=X)):_&1?T(K):T(k)):_>103?(d(G,
  1058. X    R    ),j=1):_&1? d(S,x):D,q++),q--,main(c-q,v+q)):A==0?(A=
  1059. X  1,f||(f=N/4.),b=(((N-1)&017)<8),q=(((N+7)>>3)+b)*U,(J=malloc(q)
  1060. X  )||(perror("malloc"),r),S-=(N/2)/f,x+=(U/2)/f):A==1?(B<U?(A=2,V
  1061. X    =    0,Q=x-B/f,j ||(R=Q),W&&E('\n',e),E(46,i)):(W&&E('\n',
  1062. X         e),E('\n',i  ),h[1]=N,h[2]=U,h[4]=q,W||(fwrite(h,1,32,
  1063. X          e),fwrite   (J,1,q,e)),free(J),ext(0))):A==2?(V<N?(j?
  1064. X        (H=V/f       +S,M=Q):(G=V/f+S,H=M=0),Y=0,A=03):((m&0x80
  1065. X           )       ||(m=0x80,p++),b&&(J[p++]=0),A=1,B++)):((Y
  1066. X                <k&&(P=H*H)+(z=M*M)<4.)?(M=2*H*M+R,H=P-z
  1067. X                 +G,Y++):(W&&E(I[0x0f*(Y&K)/K],e),Y&K?J
  1068. X                     [p]&=~m:(J[p]|=m),(m>>=1)||/*/
  1069. X                  (m=128,u--),A==6?ext(1):B<u
  1070. X                 .      e=3,l=2*c*/(       m
  1071. X                         =0x80,
  1072. X                        p++),V++
  1073. X                         ,A=0x2
  1074. X                        )
  1075. X                        ));
  1076. X                           }
  1077. END_OF_FILE
  1078.   if test 1965 -ne `wc -c <'1992/imc.c'`; then
  1079.     echo shar: \"'1992/imc.c'\" unpacked with wrong size!
  1080.   fi
  1081.   # end of '1992/imc.c'
  1082. fi
  1083. if test -f '1992/imc.orig.c' -a "${1}" != "-c" ; then 
  1084.   echo shar: Will not clobber existing file \"'1992/imc.orig.c'\"
  1085. else
  1086.   echo shar: Extracting \"'1992/imc.orig.c'\" \(1937 characters\)
  1087.   sed "s/^X//" >'1992/imc.orig.c' <<'END_OF_FILE'
  1088. X#include             <stdio.h> 
  1089. X#include             <malloc.h> 
  1090. X#define I          " .:\';+<?F7RQ&%#*"
  1091. X#define a            "%s?\n"
  1092. X#define n            "0?\n"
  1093. X#define C            double    
  1094. X#define o             char
  1095. X#define l             long
  1096. X#define L            sscanf
  1097. X#define i            stderr
  1098. X#define e            stdout
  1099. X#define r              exit   (1)
  1100. X#define s(O,B)       L(++J,O,&B)!=1&&c>++q&&L(v[q],O,&B)!=1&&--q
  1101. X#define F(U,S,C,A) t=0,*++J&&(t=L(J,U,&C,&A)),(!t&&c>++q&&!(t=L(v[q],U,\
  1102. X           &C,&A)))?--q:(t<2&&c>++q&&!(t=L(v[q],S,&A))&&--q
  1103. X#define T(E)        (s("%d",E),E||(fputs(n,i),r))
  1104. X#define d(C,c)          (F("%lg,%lg","%lg",C,c)))
  1105. X#define O       (F("%d,%d","%d",N,U),(N&&U)||(fputs(n,i),r)))
  1106. X#define D              (s("%lg",f))
  1107. X#define E              putc
  1108. X                           C
  1109. X                        G=0,
  1110. X                        R
  1111. X                         =0,Q,H
  1112. X                        ,M,P,z,S
  1113. X                         =0,x=0
  1114. X                 ,        f=0;l b,j=0,          k
  1115. X                  =128,K=1,V,B=0,Y,m=128,p=0,N
  1116. X                 =768,U=768,h[]={0x59A66A95,256
  1117. X                 ,192,1,6912,1,0,0},t,A=0,W=0,Z=63,X=23
  1118. X                ;o*J,_;main(c,v)l c;o**v;{l q=1;for(;;q<
  1119. X          c       ?(((J=v[q])[0]&&J[0]<48&&J++,((_= *J)<99||
  1120. X        _/2==       '2'||(_-1)/3=='\"'||_==107||_/05*2==','||_
  1121. X          >0x074)?(   fprintf(i,a,v[q]),r):_>0152?(_/4>27?(_&1?(
  1122. X         O,Z=N,X=U):  (W++,N=Z,U=X)):_&1?T(K):T(k)):_>103?(d(G,
  1123. X    R    ),j=1):_&1? d(S,x):D,q++),q--,main(c-q,v+q)):A==0?(A=
  1124. X  1,f||(f=N/4.),b=(((N-1)&017)<8),q=(((N+7)>>3)+b)*U,(J=malloc(q)
  1125. X  )||(perror("malloc"),r),S-=(N/2)/f,x+=(U/2)/f):A==1?(B<U?(A=2,V
  1126. X    =    0,Q=x-B/f,j ||(R=Q),W&&E('\n',e),E(46,i)):(W&&E('\n',
  1127. X         e),E('\n',i  ),h[1]=N,h[2]=U,h[4]=q,W||(fwrite(h,1,32,
  1128. X          e),fwrite   (J,1,q,e)),free(J),exit(0))):A==2?(V<N?(j?
  1129. X        (H=V/f       +S,M=Q):(G=V/f+S,H=M=0),Y=0,A=03):((m&0x80
  1130. X           )       ||(m=0x80,p++),b&&(J[p++]=0),A=1,B++)):((Y
  1131. X                <k&&(P=H*H)+(z=M*M)<4.)?(M=2*H*M+R,H=P-z
  1132. X                 +G,Y++):(W&&E(I[0x0f*(Y&K)/K],e),Y&K?J
  1133. X                     [p]&=~m:(J[p]|=m),(m>>=1)||/*/
  1134. X                  (m=128,u--),A==6?exit(1):B<u
  1135. X                 .      e=3,l=2*c*/(        m
  1136. X                         =0x80,
  1137. X                        p++),V++
  1138. X                         ,A=0x2
  1139. X                        )
  1140. X                        ));
  1141. X                           }
  1142. END_OF_FILE
  1143.   if test 1937 -ne `wc -c <'1992/imc.orig.c'`; then
  1144.     echo shar: \"'1992/imc.orig.c'\" unpacked with wrong size!
  1145.   fi
  1146.   # end of '1992/imc.orig.c'
  1147. fi
  1148. if test -f '1992/kivinen.c' -a "${1}" != "-c" ; then 
  1149.   echo shar: Will not clobber existing file \"'1992/kivinen.c'\"
  1150. else
  1151.   echo shar: Extracting \"'1992/kivinen.c'\" \(2119 characters\)
  1152.   sed "s/^X//" >'1992/kivinen.c' <<'END_OF_FILE'
  1153. X#include                               <X11/Xlib.h>
  1154. X#define                             ext(a) (exit(a),0)
  1155. X# define             X(        x,v,y) XMoveWindow(d,s[x],(v)*z,(y)*z)
  1156. X#  define             _        ButtonPressMask|ButtonReleaseMask
  1157. X#   define             I(             x,y) XSelectInput(d,s[x],y)
  1158. X#    define             N(              v) (XMapWindow(d,s[v]),v)
  1159. X#     define             V              VisibilityChangeMask
  1160. X#      define             A              XCreateSimpleWindow
  1161. X#    define             D                DefaultScreen(d)
  1162. X#     define             E               r.xbutton.button
  1163. X#      define         R                BlackPixel(d,D)
  1164. X#       define         S                r.xvisibility
  1165. X
  1166. X          int main(a)int a;{Window s[53];int w,u,i,c,y,l=0
  1167. X      ,q,e=32,t,k,j=~0,z=(a+1)/2,x=a&1,v=z&1;XEvent r;Display*
  1168. X    d=XOpenDisplay("");s[0]=A(d,DefaultRootWindow(d),200,200,(x&
  1169. X       v?330:120)*z,215*z,2,R,R);I(N(c=0),_);for(;c<(x?32:52);c++){s[
  1170. X       c+1]=A(d,s[0],x          ?c*20*z:(c-1)%10          *12*z,x?-20*z:(
  1171. X      c-1)/10*12*z,x        ?z*(c^31?10:        2):z*10*(c?1:2
  1172. X      ), x& v?z*10:     (c     &&!x?10:1+     x)     *z,k =q=1, R,
  1173. X      WhitePixel(d     ,D));I      (N(c+1),     V);}X(      N(1),y=(x&v)
  1174. X      *115+50,x*70+     60     ); X(N(c--     )+     1,x?-10:(i=y)
  1175. X      ,u=!x*130-20);        while(c &&e<        160){if(x){if(
  1176. X      v){l=!(e &32)*9;          for(w=30; w--;){          if(s[w+2]){ k=w%
  1177. X      10;l=e&32?k>l?k:l:k<l?k:l;X(w+2,10+k *20+q,(w/10)*20+e);}}l*=20;
  1178. X      e&31?e++:e&32?(q++,(q+l>300?e++:0)):(q--,q+l<10?e++:0); } u>140?
  1179. X      ext(c):u>-20?X(32,i,u-=(v?5:-1 )) :(!v?(u =5,srandom(time(0)),i=
  1180. X      random()%88+6):0); } else{k>0?i+=(i>105?k= -k:k):(i+=(i<1?k= -k:
  1181. X      k)); j>0?u     +=(u>140?ext(++c):j):(u+=(u        <1?j= -j:j
  1182. X      )); X(            52,i,u);}XSync(d,0);        while(
  1183. X      XCheckMaskEvent(d          ,_|V,&r))if(!(r.         type==ButtonPress
  1184. X      ?(E&1||!x||!v?t=E*4-8             :u<0?i=y+4,u=122:1):r
  1185. X      .type==ButtonRelease&&E?t=0,1:r.type^VisibilityNotify|S.state^1)
  1186. X      )for(x&v?(u=         -15),w++:(w=0);++w          <52-x*20;)if
  1187. X      (s[w]              ==S.window)x&&v||             w ^1?
  1188. X      XUnmapWindow           (d,s[w])          ,s[w]=0,c--:
  1189. X      0,l=1; if(!x&&l)j=                -j,l=0; if(l&x&&!v
  1190. X      )u=~19,c--,l=0;t=(!x||!v)             &&(y<5&&t<0||y>95&&t>0)?0
  1191. X      :t;s[1]?X(1,y+=x&v?t:t/(x+1),130):ext(++c);};return(c);}
  1192. END_OF_FILE
  1193.   if test 2119 -ne `wc -c <'1992/kivinen.c'`; then
  1194.     echo shar: \"'1992/kivinen.c'\" unpacked with wrong size!
  1195.   fi
  1196.   # end of '1992/kivinen.c'
  1197. fi
  1198. if test -f '1992/kivinen.hint' -a "${1}" != "-c" ; then 
  1199.   echo shar: Will not clobber existing file \"'1992/kivinen.hint'\"
  1200. else
  1201.   echo shar: Extracting \"'1992/kivinen.hint'\" \(2547 characters\)
  1202.   sed "s/^X//" >'1992/kivinen.hint' <<'END_OF_FILE'
  1203. XBest X Program: <kivinen@hut.fi> Tero Kivinen
  1204. X
  1205. X    Tero Kivinen
  1206. X    Helsinki University of Technology
  1207. X    Klovinrinne 6b
  1208. X    02180 Espoo
  1209. X    Finland
  1210. X
  1211. X
  1212. XJudges' comments:
  1213. X
  1214. X    If your machine support the X Window System, Version 11:
  1215. X    make kivinen
  1216. X
  1217. X    The type of entertainment depends on number of arguments
  1218. X    you have with the program.  :-)
  1219. X
  1220. X    NOTE: Some systems do not need (or have) -lsocket -lresolv -lnsl.
  1221. X      Such systems should compile using -lX11.
  1222. X
  1223. X    NOTE: The original winning source kivinen.orig.c assumed that
  1224. X      exit returned a value which cause problems for some
  1225. X      systems where exit returned a void.  The file kivinen.c
  1226. X      avoids this problem.
  1227. X    
  1228. X
  1229. XSelected notes from the author:
  1230. X
  1231. X    X Entertainment Kit
  1232. X
  1233. X    This kit includes three games from the early of video games for
  1234. X    The X Window System Version 11 Release 5. It should work with
  1235. X    earlier releases, though.
  1236. X
  1237. X
  1238. X    Space Invaders
  1239. X
  1240. X    The classic game of shooting aliens from outer space, trying to
  1241. X    exterminate all life on earth. The game ends when the first line
  1242. X    of aliens touches the ground, or destroy you. To win the game you
  1243. X    must destroy all the aliens. If you evade out from the screen you
  1244. X    lose.
  1245. X
  1246. X        Controls:
  1247. X                Button 1 = Move left
  1248. X                Button 2 = Fire missile
  1249. X                Button 3 = Move right
  1250. X
  1251. X
  1252. X    Breakout
  1253. X
  1254. X    Break all the bricks with the ball, using your paddle. If you miss
  1255. X    the ball the game ends.
  1256. X
  1257. X        Controls:
  1258. X                Button 1 = Move left
  1259. X                Button 3 = Move right
  1260. X
  1261. X
  1262. X    Dropout
  1263. X
  1264. X    Catch all the falling pieces, before they reach the ground. If you
  1265. X    miss it, game ends. To win you must catch all 30 pieces.
  1266. X
  1267. X        Controls:
  1268. X                Button 1 = Move left
  1269. X                Button 3 = Move right
  1270. X
  1271. X
  1272. X
  1273. X    Starting the game
  1274. X
  1275. X    The type of the game is determined by the number of arguments
  1276. X    given to the program.
  1277. X
  1278. X        no arguments = Space Invaders
  1279. X        1 argument   = Breakout
  1280. X        2 arguments  = Dropout
  1281. X        3 arguments  = double sized Breakout
  1282. X        4 arguments  = triple sized Space Invaders
  1283. X        5 arguments  = triple sized Breakout
  1284. X        6 arguments  = double sized Dropout
  1285. X        7 arguments  = quadruple sized Breakout
  1286. X        and so on...
  1287. X
  1288. X
  1289. X    Scores
  1290. X
  1291. X    The exit value of the game is your score. The smaller the score
  1292. X    the better it is. The exit value of zero means you have won.
  1293. X
  1294. X
  1295. X    Features
  1296. X
  1297. X    The game has a cheat system, which can be found after examining the
  1298. X    event loop at the end of program. It is not a bug, it's a feature!
  1299. X
  1300. END_OF_FILE
  1301.   if test 2547 -ne `wc -c <'1992/kivinen.hint'`; then
  1302.     echo shar: \"'1992/kivinen.hint'\" unpacked with wrong size!
  1303.   fi
  1304.   # end of '1992/kivinen.hint'
  1305. fi
  1306. if test -f '1992/kivinen.orig.c' -a "${1}" != "-c" ; then 
  1307.   echo shar: Will not clobber existing file \"'1992/kivinen.orig.c'\"
  1308. else
  1309.   echo shar: Extracting \"'1992/kivinen.orig.c'\" \(2084 characters\)
  1310.   sed "s/^X//" >'1992/kivinen.orig.c' <<'END_OF_FILE'
  1311. X#include                               <X11/Xlib.h>
  1312. X# define             X(        x,v,y) XMoveWindow(d,s[x],(v)*z,(y)*z)
  1313. X#  define             _        ButtonPressMask|ButtonReleaseMask
  1314. X#   define             I(             x,y) XSelectInput(d,s[x],y)
  1315. X#    define             N(              v) (XMapWindow(d,s[v]),v)
  1316. X#     define             V              VisibilityChangeMask
  1317. X#      define             A              XCreateSimpleWindow
  1318. X#    define             D                DefaultScreen(d)
  1319. X#     define             E               r.xbutton.button
  1320. X#      define         R                BlackPixel(d,D)
  1321. X#       define         S                r.xvisibility
  1322. X
  1323. X          int main(a)int a;{Window s[53];int w,u,i,c,y,l=0
  1324. X      ,q,e=32,t,k,j=~0,z=(a+1)/2,x=a&1,v=z&1;XEvent r;Display*
  1325. X    d=XOpenDisplay("");s[0]=A(d,DefaultRootWindow(d),200,200,(x&
  1326. X       v?330:120)*z,215*z,2,R,R);I(N(c=0),_);for(;c<(x?32:52);c++){s[
  1327. X       c+1]=A(d,s[0],x          ?c*20*z:(c-1)%10          *12*z,x?-20*z:(
  1328. X      c-1)/10*12*z,x        ?z*(c^31?10:        2):z*10*(c?1:2
  1329. X      ), x& v?z*10:     (c     &&!x?10:1+     x)     *z,k =q=1, R,
  1330. X      WhitePixel(d     ,D));I      (N(c+1),     V);}X(      N(1),y=(x&v)
  1331. X      *115+50,x*70+     60     ); X(N(c--     )+     1,x?-10:(i=y)
  1332. X      ,u=!x*130-20);        while(c &&e<        160){if(x){if(
  1333. X      v){l=!(e &32)*9;          for(w=30; w--;){          if(s[w+2]){ k=w%
  1334. X      10;l=e&32?k>l?k:l:k<l?k:l;X(w+2,10+k *20+q,(w/10)*20+e);}}l*=20;
  1335. X      e&31?e++:e&32?(q++,(q+l>300?e++:0)):(q--,q+l<10?e++:0); } u>140?
  1336. X      exit(c):u>-20?X(32,i,u-=(v?5:-1)):(!v?(u =5,srandom(time(0)),i=
  1337. X      random()%88+6):0); } else{k>0?i+=(i>105?k= -k:k):(i+=(i<1?k= -k:
  1338. X      k)); j>0?u    +=(u>140?exit(++c):j):(u+=(u        <1?j= -j:j
  1339. X      )); X(            52,i,u);}XSync(d,0);        while(
  1340. X      XCheckMaskEvent(d          ,_|V,&r))if(!(r.         type==ButtonPress
  1341. X      ?(E&1||!x||!v?t=E*4-8             :u<0?i=y+4,u=122:1):r
  1342. X      .type==ButtonRelease&&E?t=0,1:r.type^VisibilityNotify|S.state^1)
  1343. X      )for(x&v?(u=         -15),w++:(w=0);++w          <52-x*20;)if
  1344. X      (s[w]              ==S.window)x&&v||             w ^1?
  1345. X      XUnmapWindow           (d,s[w])          ,s[w]=0,c--:
  1346. X      0,l=1; if(!x&&l)j=                -j,l=0; if(l&x&&!v
  1347. X      )u=~19,c--,l=0;t=(!x||!v)             &&(y<5&&t<0||y>95&&t>0)?0
  1348. X     :t;s[1]?X(1,y+=x&v?t:t/(x+1),130):exit(++c);};return(c);}
  1349. END_OF_FILE
  1350.   if test 2084 -ne `wc -c <'1992/kivinen.orig.c'`; then
  1351.     echo shar: \"'1992/kivinen.orig.c'\" unpacked with wrong size!
  1352.   fi
  1353.   # end of '1992/kivinen.orig.c'
  1354. fi
  1355. if test -f '1992/lush.c' -a "${1}" != "-c" ; then 
  1356.   echo shar: Will not clobber existing file \"'1992/lush.c'\"
  1357. else
  1358.   echo shar: Extracting \"'1992/lush.c'\" \(1885 characters\)
  1359.   sed "s/^X//" >'1992/lush.c' <<'END_OF_FILE'
  1360. X#define f 000:
  1361. X          char
  1362. X      *s,*
  1363. X      t,v;
  1364. X      char 
  1365. X      _  [
  1366. X      999]
  1367. X      ,x [
  1368. X      999]
  1369. X      ,*p=
  1370. X      x  ;
  1371. X      char
  1372. X      *av[
  1373. X      ]= {
  1374. X      "W",
  1375. X      "H",
  1376. X      "o",
  1377. X      "l",
  1378. X      "N",
  1379. X      "e",
  1380. X      " ",
  1381. X      "r",
  1382. X      "d",
  1383. X      ".",
  1384. X      "m",
  1385. X          "s",
  1386. X          "g",
  1387. X          "!",
  1388. X          "*",
  1389. X          "\n"
  1390. X      }  ;
  1391. X       int 
  1392. X      n= 0
  1393. X      ;int 
  1394. X      __ =
  1395. X      0,i=
  1396. X      000;
  1397. X      main
  1398. X      () {
  1399. X#define f 001:
  1400. X#define F 042:
  1401. X#define f 100:
  1402. X         _[i--
  1403. X#define f 126:
  1404. X#define f 132:
  1405. X#define f 103:
  1406. X#define f 202:
  1407. X#define f 666:
  1408. X#define f 77::
  1409. X#define f 101:
  1410. X       ]=0
  1411. X#define f 232:
  1412. X#define f 151:
  1413. X      ;if(
  1414. X#define f 256:
  1415. X          !i){
  1416. X          puts
  1417. X          ("I"
  1418. X          "BM"
  1419. X          " S"
  1420. X          "UX"
  1421. X          );;;
  1422. X          ;;;}
  1423. X      ;for
  1424. X      (  ;
  1425. X      gets
  1426. X      (_);
  1427. X      )  {
  1428. X      for(
  1429. X#define f 301:
  1430. X      t=_,
  1431. X#define f 700:
  1432. X#define f 999:
  1433. X      s=t,
  1434. X#define f 77 :
  1435. X#define f 300:
  1436. X      s=t;
  1437. X#define f s=t;
  1438. X#define f 123:
  1439. X#define f 127:
  1440. X      *t&&
  1441. X      !(!(
  1442. X      *t <
  1443. X      '0'
  1444. X      ||*t
  1445. X      >'9'
  1446. X      )&&!
  1447. X          ((t[
  1448. X          1] ^
  1449. X          ':')
  1450. X          &&(t
  1451. X          [1]^
  1452. X          '.')
  1453. X      )) ; 
  1454. X      t++)
  1455. X#define f 137:
  1456. X#define f 133:
  1457. X      ;if(
  1458. X#define f 111:
  1459. X#define f 220:
  1460. X          v^*t
  1461. X          &&*t
  1462. X      ){v=
  1463. X          *t;;
  1464. X          n=n*
  1465. X      2+(1
  1466. X      &*t)
  1467. X      ;__=
  1468. X      (__+
  1469. X      1)&3
  1470. X      ; __
  1471. X      ||((
  1472. X      n<15
  1473. X      &&(*
  1474. X      p= *
  1475. X      av[n
  1476. X      ] ),
  1477. X#define f 2+2:
  1478. X      p++)
  1479. X      ,n=0
  1480. X      );}}
  1481. X#define f ==4:
  1482. X      ;*p=
  1483. X      '\0'
  1484. X      ;;;;
  1485. X#define f puts
  1486. X      puts
  1487. X      (x);
  1488. X      s=t;
  1489. X#define f s=5;
  1490. X      s=t;
  1491. X#define f s=5:
  1492. X      s=t;
  1493. X#define f 445:
  1494. X#define f 113:
  1495. X#define f 900:
  1496. X      s=t;
  1497. X#define f n22:
  1498. X#define f n40:
  1499. X      s=t;
  1500. X#define f nn6:
  1501. X      s=t;
  1502. X#define f nn1:
  1503. X#define f 0:--
  1504. X      s=t;
  1505. X#define f 19:-
  1506. X#define f x2:x
  1507. X      s=t;
  1508. X#define f x1:x
  1509. X      s=t;
  1510. X#define f y2:x
  1511. X#define f y7:y
  1512. X      s=t;
  1513. X#define f 1:::
  1514. X      s=t;
  1515. X#define f @3:@
  1516. X#define f 10:0
  1517. X#define f x+1:
  1518. X      s=t;
  1519. X#define f 2:::
  1520. X#define f 3:::
  1521. X#define x 7:::
  1522. X#define y 3:::
  1523. X#define z 990:
  1524. X#define Z 47::
  1525. X      ;;;}
  1526. X
  1527. END_OF_FILE
  1528.   if test 1885 -ne `wc -c <'1992/lush.c'`; then
  1529.     echo shar: \"'1992/lush.c'\" unpacked with wrong size!
  1530.   fi
  1531.   # end of '1992/lush.c'
  1532. fi
  1533. if test -f '1992/lush.hint' -a "${1}" != "-c" ; then 
  1534.   echo shar: Will not clobber existing file \"'1992/lush.hint'\"
  1535. else
  1536.   echo shar: Extracting \"'1992/lush.hint'\" \(695 characters\)
  1537.   sed "s/^X//" >'1992/lush.hint' <<'END_OF_FILE'
  1538. XWorst Abuse of the C Preprocessor: <lush@erc.msstate.edu> Ed Luke
  1539. X
  1540. X    Ed Luke
  1541. X    Mississippi State University
  1542. X    P.O. Box 6176
  1543. X    Mississippi State, MS 39762, USA
  1544. X
  1545. X
  1546. XJudges' comments:
  1547. X
  1548. X    To setup:
  1549. X    make lush
  1550. X    
  1551. X    Try:
  1552. X    make lush.again 2>&1 | lush        (sh or ksh users)
  1553. X    or:
  1554. X    make lush.again |& lush            (csh users)
  1555. X
  1556. X    The program uses error messages issued by the C Proproessor to
  1557. X    generate its message to the world.  One program's error is another 
  1558. X    program's data!
  1559. X
  1560. X
  1561. XSelected notes from the author:
  1562. X
  1563. X    This program is yet another "Hello World." program with a twist.  The
  1564. X    string Hello World has been encoded in the error messages the compiler
  1565. X    generates when compiling the source.
  1566. END_OF_FILE
  1567.   if test 695 -ne `wc -c <'1992/lush.hint'`; then
  1568.     echo shar: \"'1992/lush.hint'\" unpacked with wrong size!
  1569.   fi
  1570.   # end of '1992/lush.hint'
  1571. fi
  1572. if test -f '1992/lush.orig.c' -a "${1}" != "-c" ; then 
  1573.   echo shar: Will not clobber existing file \"'1992/lush.orig.c'\"
  1574. else
  1575.   echo shar: Extracting \"'1992/lush.orig.c'\" \(1885 characters\)
  1576.   sed "s/^X//" >'1992/lush.orig.c' <<'END_OF_FILE'
  1577. X#define f 000:
  1578. X          char
  1579. X      *s,*
  1580. X      t,v;
  1581. X      char 
  1582. X      _  [
  1583. X      999]
  1584. X      ,x [
  1585. X      999]
  1586. X      ,*p=
  1587. X      x  ;
  1588. X      char
  1589. X      *av[
  1590. X      ]= {
  1591. X      "W",
  1592. X      "H",
  1593. X      "o",
  1594. X      "l",
  1595. X      "N",
  1596. X      "e",
  1597. X      " ",
  1598. X      "r",
  1599. X      "d",
  1600. X      ".",
  1601. X      "m",
  1602. X          "s",
  1603. X          "g",
  1604. X          "!",
  1605. X          "*",
  1606. X          "\n"
  1607. X      }  ;
  1608. X       int 
  1609. X      n= 0
  1610. X      ;int 
  1611. X      __ =
  1612. X      0,i=
  1613. X      000;
  1614. X      main
  1615. X      () {
  1616. X#define f 001:
  1617. X#define F 042:
  1618. X#define f 100:
  1619. X          i--[
  1620. X#define f 126:
  1621. X#define f 132:
  1622. X#define f 103:
  1623. X#define f 202:
  1624. X#define f 666:
  1625. X#define f 77::
  1626. X#define f 101:
  1627. X      _]=0
  1628. X#define f 232:
  1629. X#define f 151:
  1630. X      ;if(
  1631. X#define f 256:
  1632. X          !i){
  1633. X          puts
  1634. X          ("I"
  1635. X          "BM"
  1636. X          " S"
  1637. X          "UX"
  1638. X          );;;
  1639. X          ;;;}
  1640. X      ;for
  1641. X      (  ;
  1642. X      gets
  1643. X      (_);
  1644. X      )  {
  1645. X      for(
  1646. X#define f 301:
  1647. X      t=_,
  1648. X#define f 700:
  1649. X#define f 999:
  1650. X      s=t,
  1651. X#define f 77 :
  1652. X#define f 300:
  1653. X      s=t;
  1654. X#define f s=t;
  1655. X#define f 123:
  1656. X#define f 127:
  1657. X      *t&&
  1658. X      !(!(
  1659. X      *t <
  1660. X      '0'
  1661. X      ||*t
  1662. X      >'9'
  1663. X      )&&!
  1664. X          ((t[
  1665. X          1] ^
  1666. X          ':')
  1667. X          &&(t
  1668. X          [1]^
  1669. X          '.')
  1670. X      )) ; 
  1671. X      t++)
  1672. X#define f 137:
  1673. X#define f 133:
  1674. X      ;if(
  1675. X#define f 111:
  1676. X#define f 220:
  1677. X          v^*t
  1678. X          &&*t
  1679. X      ){v=
  1680. X          *t;;
  1681. X          n=n*
  1682. X      2+(1
  1683. X      &*t)
  1684. X      ;__=
  1685. X      (__+
  1686. X      1)&3
  1687. X      ; __
  1688. X      ||((
  1689. X      n<15
  1690. X      &&(*
  1691. X      p= *
  1692. X      av[n
  1693. X      ] ),
  1694. X#define f 2+2:
  1695. X      p++)
  1696. X      ,n=0
  1697. X      );}}
  1698. X#define f ==4:
  1699. X      ;*p=
  1700. X      '\0'
  1701. X      ;;;;
  1702. X#define f puts
  1703. X      puts
  1704. X      (x);
  1705. X      s=t;
  1706. X#define f s=5;
  1707. X      s=t;
  1708. X#define f s=5:
  1709. X      s=t;
  1710. X#define f 445:
  1711. X#define f 113:
  1712. X#define f 900:
  1713. X      s=t;
  1714. X#define f n22:
  1715. X#define f n40:
  1716. X      s=t;
  1717. X#define f nn6:
  1718. X      s=t;
  1719. X#define f nn1:
  1720. X#define f 0:--
  1721. X      s=t;
  1722. X#define f 19:-
  1723. X#define f x2:x
  1724. X      s=t;
  1725. X#define f x1:x
  1726. X      s=t;
  1727. X#define f y2:x
  1728. X#define f y7:y
  1729. X      s=t;
  1730. X#define f 1:::
  1731. X      s=t;
  1732. X#define f @3:@
  1733. X#define f 10:0
  1734. X#define f x+1:
  1735. X      s=t;
  1736. X#define f 2:::
  1737. X#define f 3:::
  1738. X#define x 7:::
  1739. X#define y 3:::
  1740. X#define z 990:
  1741. X#define Z 47::
  1742. X      ;;;}
  1743. X
  1744. END_OF_FILE
  1745.   if test 1885 -ne `wc -c <'1992/lush.orig.c'`; then
  1746.     echo shar: \"'1992/lush.orig.c'\" unpacked with wrong size!
  1747.   fi
  1748.   # end of '1992/lush.orig.c'
  1749. fi
  1750. if test -f '1992/marangon.c' -a "${1}" != "-c" ; then 
  1751.   echo shar: Will not clobber existing file \"'1992/marangon.c'\"
  1752. else
  1753.   echo shar: Extracting \"'1992/marangon.c'\" \(1766 characters\)
  1754.   sed "s/^X//" >'1992/marangon.c' <<'END_OF_FILE'
  1755. X#include <stdio.h>
  1756. X#include <curses.h>
  1757. X
  1758. X#define ST strchr
  1759. X#define SRD srand48
  1760. X#define RD lrand48
  1761. X#define ext(a) (exit(a),0)
  1762. X
  1763. X#define Q return
  1764. X#define W wrefresh(r)
  1765. Xtypedef int i;
  1766. X
  1767. X#define Z(d,a) (RD()%((a)-(d)+1)+(d))
  1768. Xi f[3][3] = {15,52,36,20,-39,48,60,0,-25};
  1769. X
  1770. Xchar z[6][6];
  1771. X#define Y(x) (4*(x)+3)
  1772. X#define X(x) (2*(x)+1)
  1773. X#define I for
  1774. XWINDOW *r=NULL;
  1775. X#define K endwin()
  1776. X
  1777. Xchar *g ="\
  1778. XUse l-h-k-j for move.\nUse + for increment. Use - for decrement.\nUse Q to quit.";
  1779. X
  1780. Xi (*d())();
  1781. Xnt()
  1782. X{
  1783. Xlong time();
  1784. XSRD(time((i *)0));
  1785. Xmemset(z,5,36);
  1786. Xinitscr();
  1787. Xcbreak();
  1788. Xnoecho();
  1789. Xnonl();
  1790. Xif (COLS<80||LINES<24)
  1791. XK,ext(1);
  1792. Xif (!(r=newwin(X(6),Y(6),
  1793. X(LINES-X(6))/2,(COLS-Y(6))/2)))
  1794. XK,ext(1);
  1795. Xmvaddstr(LINES-5,0,g);
  1796. Xrefresh();
  1797. X}
  1798. Xi ci()
  1799. X{
  1800. Xi x,y=0;
  1801. XI (;y<6;++y)
  1802. XI(x=0;x<6;++x)
  1803. Xmvwaddch(r,X(y),Y(x),z[x][y]+'0'); Q(0);
  1804. X}
  1805. Xvoid main()
  1806. X{
  1807. Xchar *ST();
  1808. Xi a=0,b=0,c,q,t,s,x,sc=0;
  1809. Xi(*(*p)())()=(nt(),d);
  1810. XI(x=0 ; x++<20; )d(Z(0,5),Z(0,5),Z(1,2));
  1811. XI(t=Z(0,2),q=s=0; q<3; s+=f[q][t]*f[q++][t]);
  1812. XI(box(r,'|','-'),ci(),wmove(r,X(a),Y(b)),
  1813. XW; (ST ("+-Qlkjh",(char)(c=wgetch(r))))&&
  1814. X((i)((i)(q^=s%=Y(q),s/=2)!=(i)(s^=q)&&c&64&&(!(c&7|0)&&--b<0&&
  1815. X(b=q^s)&0|| c&4&&++b==6&&c&4<(~b&23?q^=s,b^=b
  1816. X:b&12?b=3:b|2)||c&2&&~c&1&&++a==++q/2+1&&c&16>(
  1817. X!a|12?a=7,a&=~a:a|4?a=2:a&2)||~c&4&&c&
  1818. X1&&--a<0&&(a+=6)&0)||~c&64&&(**p(b,a,~c))()||
  1819. Xc&16)?K,ext(0):1)||c; sc==36?ci(),W,K,ext(0):wmove(r,X(a),Y(b)),
  1820. XW)
  1821. XI(t=Z(0,2),q=s=0; q<3; s+=f[q][t]*f[q++][t])
  1822. XI(sc=0; sc<36&&*((char *)z+sc++)==5; );
  1823. X}
  1824. Xi (*d(a,b,c))()i a,b,c;
  1825. X{
  1826. Xi x,y;
  1827. XI(x=a>0?a-1:0; x<=(a<5?a+1:5); ++x)
  1828. XI(y=b>0?b-1:0; y<=(b<5?b+1:5); ++y)
  1829. Xif(x==a&&y==b&&z[x][y]==(c&2?1:9)||z[x][y]==(c&2?9:1)&&(x!=a||y!=b))Q(ci);
  1830. XI(x=a>0?a-1:0; x<=(a<5?a+1:5); x++)
  1831. XI(y=b>0?b-1:0; y<=(b<5?b+1:5)&&(x==a&&y==b&&(z[x][y]+=(c&2?-1:1))||(z[x][y]+=(c&2?1:-1))); y++); Q(ci);
  1832. X}
  1833. END_OF_FILE
  1834.   if test 1766 -ne `wc -c <'1992/marangon.c'`; then
  1835.     echo shar: \"'1992/marangon.c'\" unpacked with wrong size!
  1836.   fi
  1837.   # end of '1992/marangon.c'
  1838. fi
  1839. if test -f '1992/marangon.hint' -a "${1}" != "-c" ; then 
  1840.   echo shar: Will not clobber existing file \"'1992/marangon.hint'\"
  1841. else
  1842.   echo shar: Extracting \"'1992/marangon.hint'\" \(1062 characters\)
  1843.   sed "s/^X//" >'1992/marangon.hint' <<'END_OF_FILE'
  1844. XBest Game: <marangon@ghost.dsi.unimi.it> Marangoni Andrea
  1845. X
  1846. X    Marangoni Andrea
  1847. X    Department of Computer Science at Milano
  1848. X    Via Pausula, 72
  1849. X    62014 Corridonia (MC)
  1850. X    Italy
  1851. X
  1852. X
  1853. XJudges' comments:
  1854. X
  1855. X    Make and run.
  1856. X
  1857. X    The object is to refill the table with 5's, by incrementing
  1858. X    or decrementing numbers as needed.  It is the side effects
  1859. X    that get you into trouble.  If you are not careful, you may
  1860. X    find things "at 6's and 7's".  :-)
  1861. X
  1862. X    NOTE: Some compilers have had trouble optimizing this entry.
  1863. X
  1864. X    NOTE: Some systems need to compile with -ltermcap as well as -lcurses.
  1865. X
  1866. X    NOTE: The original winning source marangon.orig.c assumed that
  1867. X      exit returned a value which cause problems for some
  1868. X      systems where exit returned a void.  The file marangon.c
  1869. X      avoids this problem.
  1870. X
  1871. X
  1872. XSelected notes from the author:
  1873. X
  1874. X    It starts off by creating a table with number 5 in all places.  The
  1875. X    CPU melts the numbers and you must return them in original state.
  1876. X    When you increase a number, all the other eight numbers next to it
  1877. X    decrease and vice-versa.
  1878. END_OF_FILE
  1879.   if test 1062 -ne `wc -c <'1992/marangon.hint'`; then
  1880.     echo shar: \"'1992/marangon.hint'\" unpacked with wrong size!
  1881.   fi
  1882.   # end of '1992/marangon.hint'
  1883. fi
  1884. if test -f '1992/marangon.orig.c' -a "${1}" != "-c" ; then 
  1885.   echo shar: Will not clobber existing file \"'1992/marangon.orig.c'\"
  1886. else
  1887.   echo shar: Extracting \"'1992/marangon.orig.c'\" \(1743 characters\)
  1888.   sed "s/^X//" >'1992/marangon.orig.c' <<'END_OF_FILE'
  1889. X#include <stdio.h>
  1890. X#include <curses.h>
  1891. X
  1892. X#define ST strchr
  1893. X#define SRD srand48
  1894. X#define RD lrand48
  1895. X
  1896. X#define Q return
  1897. X#define W wrefresh(r)
  1898. Xtypedef int i;
  1899. X
  1900. X#define Z(d,a) (RD()%((a)-(d)+1)+(d))
  1901. Xi f[3][3] = {15,52,36,20,-39,48,60,0,-25};
  1902. X
  1903. Xchar z[6][6];
  1904. X#define Y(x) (4*(x)+3)
  1905. X#define X(x) (2*(x)+1)
  1906. X#define I for
  1907. XWINDOW *r=NULL;
  1908. X#define K endwin()
  1909. X
  1910. Xchar *g ="\
  1911. XUse l-h-k-j for move.\nUse + for increment. Use - for decrement.\nUse Q to quit.";
  1912. X
  1913. Xi (*d())();
  1914. Xnt()
  1915. X{
  1916. Xlong time();
  1917. XSRD(time((i *)0));
  1918. Xmemset(z,5,36);
  1919. Xinitscr();
  1920. Xcbreak();
  1921. Xnoecho();
  1922. Xnonl();
  1923. Xif (COLS<80||LINES<24)
  1924. XK,exit(1);
  1925. Xif (!(r=newwin(X(6),Y(6),
  1926. X(LINES-X(6))/2,(COLS-Y(6))/2)))
  1927. XK,exit(1);
  1928. Xmvaddstr(LINES-5,0,g);
  1929. Xrefresh();
  1930. X}
  1931. Xi ci()
  1932. X{
  1933. Xi x,y=0;
  1934. XI (;y<6;++y)
  1935. XI(x=0;x<6;++x)
  1936. Xmvwaddch(r,X(y),Y(x),z[x][y]+'0'); Q(0);
  1937. X}
  1938. Xvoid main()
  1939. X{
  1940. Xchar *ST();
  1941. Xi a=0,b=0,c,q,t,s,x,sc=0;
  1942. Xi(*(*p)())()=(nt(),d);
  1943. XI(x=0 ; x++<20; )d(Z(0,5),Z(0,5),Z(1,2));
  1944. XI(t=Z(0,2),q=s=0; q<3; s+=f[q][t]*f[q++][t]);
  1945. XI(box(r,'|','-'),ci(),wmove(r,X(a),Y(b)),
  1946. XW; (ST ("+-Qlkjh",(char)(c=wgetch(r))))&&
  1947. X((i)((i)(q^=s%=Y(q),s/=2)!=(i)(s^=q)&&c&64&&(!(c&7|0)&&--b<0&&
  1948. X(b=q^s)&0|| c&4&&++b==6&&c&4<(~b&23?q^=s,b^=b
  1949. X:b&12?b=3:b|2)||c&2&&~c&1&&++a==++q/2+1&&c&16>(
  1950. X!a|12?a=7,a&=~a:a|4?a=2:a&2)||~c&4&&c&
  1951. X1&&--a<0&&(a+=6)&0)||~c&64&&(**p(b,a,~c))()||
  1952. Xc&16)?K,exit(0):1)||c; sc==36?ci(),W,K,exit(0):wmove(r,X(a),Y(b)),
  1953. XW)
  1954. XI(t=Z(0,2),q=s=0; q<3; s+=f[q][t]*f[q++][t])
  1955. XI(sc=0; sc<36&&*((char *)z+sc++)==5; );
  1956. X}
  1957. Xi (*d(a,b,c))()i a,b,c;
  1958. X{
  1959. Xi x,y;
  1960. XI(x=a>0?a-1:0; x<=(a<5?a+1:5); ++x)
  1961. XI(y=b>0?b-1:0; y<=(b<5?b+1:5); ++y)
  1962. Xif(x==a&&y==b&&z[x][y]==(c&2?1:9)||z[x][y]==(c&2?9:1)&&(x!=a||y!=b))Q(ci);
  1963. XI(x=a>0?a-1:0; x<=(a<5?a+1:5); x++)
  1964. XI(y=b>0?b-1:0; y<=(b<5?b+1:5)&&(x==a&&y==b&&(z[x][y]+=(c&2?-1:1))||(z[x][y]+=(c&2?1:-1))); y++); Q(ci);
  1965. X}
  1966. END_OF_FILE
  1967.   if test 1743 -ne `wc -c <'1992/marangon.orig.c'`; then
  1968.     echo shar: \"'1992/marangon.orig.c'\" unpacked with wrong size!
  1969.   fi
  1970.   # end of '1992/marangon.orig.c'
  1971. fi
  1972. if test -f '1992/nathan.c' -a "${1}" != "-c" ; then 
  1973.   echo shar: Will not clobber existing file \"'1992/nathan.c'\"
  1974. else
  1975.   echo shar: Extracting \"'1992/nathan.c'\" \(878 characters\)
  1976.   sed "s/^X//" >'1992/nathan.c' <<'END_OF_FILE'
  1977. X#include <stdio.h>
  1978. Xstatic char *text[] =
  1979. X{
  1980. X  "Export of this program from the USA is governed by the US",
  1981. X  "Munitions List from the ITAR (International Traffic in Arms",
  1982. X  "Regulations). This list gives the specific categories of",
  1983. X  "restricted exports and includes cryptographic exports. Traffic",
  1984. X  "entirely external to, entirely internal to, or into the USA is",
  1985. X  "not restricted.",
  1986. X  "To obtain a copy of the program, email to nathan@inmos.co.uk",
  1987. X  "with a subject \"IOCCC request\". If you know that your 'From'",
  1988. X  "line is incorrect, add a single line",
  1989. X  "\"replyto you@your.correct.address\" to the body of the message.",
  1990. X  "A deamon will autoreply.",
  1991. X  "WARNING: You must not re-export this out of the USA, or else",
  1992. X  "the men in black might get you.",
  1993. X  NULL
  1994. X};
  1995. Xint main()
  1996. X{
  1997. X  char **ptr;
  1998. X
  1999. X  for(ptr = text; *ptr; ptr++)
  2000. X    printf("%s\n", *ptr);
  2001. X  return 0;
  2002. X}
  2003. END_OF_FILE
  2004.   if test 878 -ne `wc -c <'1992/nathan.c'`; then
  2005.     echo shar: \"'1992/nathan.c'\" unpacked with wrong size!
  2006.   fi
  2007.   # end of '1992/nathan.c'
  2008. fi
  2009. if test -f '1992/vern.c' -a "${1}" != "-c" ; then 
  2010.   echo shar: Will not clobber existing file \"'1992/vern.c'\"
  2011. else
  2012.   echo shar: Extracting \"'1992/vern.c'\" \(3203 characters\)
  2013.   sed "s/^X//" >'1992/vern.c' <<'END_OF_FILE'
  2014. X#include <stdio.h>
  2015. X;    m(x)(x<0?-1:!!x)
  2016. X;    g tj()-J
  2017. X;    a(x)(x<0?-x:x)
  2018. X;    h(x)((x)<=K?x:N-(x))
  2019. X;    f 9999
  2020. X;    A return
  2021. X;    H printf{ 
  2022. X;    R double
  2023. X;    U int
  2024. X;    V for
  2025. X;    b else
  2026. X;    u while
  2027. X;    B if
  2028. XU v,w,Y}     -1,W,J,p,F,o}    f,M,N,K,X,YY,_,P[f],s{ } ;
  2029. Xtypedef U{ *L} { } ;
  2030. XL q[f];
  2031. Xtj{ } {
  2032. XU S}    m{ v} +{ m{ w} <<K} ; 
  2033. XB{ !S} A J; 
  2034. XV{ v}    W+S; v!}    J&&!q[v]; v+}    S} ;
  2035. XA v; 
  2036. X}
  2037. Xk{ } {
  2038. X_}    K; 
  2039. XA v?a{ v} >1||w-Y||!q[J]:{ w-Y&&{ w-Y*2||q[W+Y*{ N+1} ]||
  2040. X    { J>>K} -K+{ Y-1} / 2} } ||q[J]; 
  2041. X}
  2042. Xz{ } {
  2043. X_}    5; 
  2044. XA v*w||g; 
  2045. X}
  2046. Xe{ } {
  2047. X_}     -2; 
  2048. XA{ v*v*v-v||w*w*w-w} &&{ J-W-2||{ W&N} -4||{ W>>K!}    { Y-1?N:0} } ||
  2049. X    q[W+1]||q[W+2]||q[W+K]!}    z||P[W+K]*Y<0} ; 
  2050. X}
  2051. XR VR{ } {
  2052. Xint PZ}    0x7fff; 
  2053. XA{ R} { rand{ } &PZ} /{ R} PZ; 
  2054. X}
  2055. Xl{ } {
  2056. X_}    K+1; 
  2057. XA{ v*w&&a{ v} -a{ w} } ||g; 
  2058. X}
  2059. XR UC{ } {
  2060. XR {    }    0,d; 
  2061. Xu{ { {    +}    d}    VR{ } } <1.0} ; 
  2062. XA d; 
  2063. X}
  2064. Xc{ } {
  2065. X_}     -11; 
  2066. XA a{ v} -a{ w} ||g; 
  2067. X}
  2068. XI{ ur,n,x} {
  2069. XW}    ur; 
  2070. XJ}    n; 
  2071. XB{ P[W]!}    Y||P[J]}    }    Y} A J+1;
  2072. Xv}    { J&N} -{ W&N} ; 
  2073. Xw}    { J>>K} -{ W>>K} ; 
  2074. XA q[W]{ } ||{ x&&QL{ W,J,s} } ; 
  2075. X}
  2076. XTT{ W} {
  2077. Xv}    w}    0; 
  2078. XA q[W]{ } +K; 
  2079. X}
  2080. Xs{ } {
  2081. XU j}     -1,{    ; 
  2082. XY}     -Y; 
  2083. XV{ {    }    0; {    <M; ++{    } {
  2084. XB{ j<0&&P[{    ]}    }     -Y&&TT{ {    } &&_}    }     -2} 
  2085. X{
  2086. Xj}    {    ; 
  2087. X{    }     -1; 
  2088. X}
  2089. Xb B{ j>}    0&&!I{ {    ,j,0} } A Y}     -Y; 
  2090. X}
  2091. XA!{ Y}     -Y} ; 
  2092. X}
  2093. Xbb{ } {
  2094. X_}    1; 
  2095. XA a{ v*w} -2; 
  2096. X}
  2097. Xuv{ } {
  2098. XV{ v}    0; v<f; ++v} {
  2099. XB{ h{ v>>K} }    }    0} {
  2100. XU S}    h{ v&N} ;
  2101. Xq[v]}    !S?z:{ S}    }    1?bb:{ S}    }    2?c:{ v&N>K?l:e} } } ; 
  2102. X}
  2103. Xb B{ h{ v>>K} }    }    1} q[v]}    k; 
  2104. Xb q[v]}    0;
  2105. XP[v]}    !!q[v]*{ 28-v} ; 
  2106. X}
  2107. X}
  2108. Xy{ } {
  2109. XU G}    Y,{    ; 
  2110. XJ}    0; 
  2111. XV{ {    }    0; {    <M; ++{    } {
  2112. X{    %8||H"\n%4o ",{    } ;
  2113. XB{ { Y}    P[{    ]}    m{ P[{    ]} } &&
  2114. XTT{ {    } } H"%c ",_+93+Y*16} ; 
  2115. Xb H"- "} ; 
  2116. X}
  2117. XH"\n    "} ; 
  2118. Xdo 
  2119. XH"%2d",{    ++&N} ; 
  2120. Xu{ {    &N} ; 
  2121. XY}    G; 
  2122. XH"\n"} ; 
  2123. X}
  2124. XO{ W,J} {
  2125. XB{ { q[J]}    q[W]} }    }    k&&h{ J>>K} }    }    0} q[J]}    l; 
  2126. XB{ q[W]}    }    e} B{ J-W}    }    2} O{ J+1,J-1} ;
  2127. Xb B{ W-J}    }    2} O{ W-1,W+1} ; 
  2128. XP[J]}    P[W]; 
  2129. Xq[W]}    0;
  2130. XP[W]}    0; 
  2131. X}
  2132. XQL{ W,J,D} L D; 
  2133. X{
  2134. XU HQ}    P[J],YX; 
  2135. XL AJ}    q[J],XY}    q[W]; 
  2136. XO{ W,J} ; 
  2137. XYX}    D{ } ;
  2138. XO{ J,W} ; 
  2139. Xq[J]}    AJ; 
  2140. Xq[W]}    XY; 
  2141. XP[J]}    HQ; 
  2142. XA YX; 
  2143. X}
  2144. XC{ } {
  2145. XU {    ,j,BZ}    0; 
  2146. XV{ {    }    0; {    <M; ++{    } {
  2147. XL Z}    q[{    ]; 
  2148. XB{ Z} {
  2149. XU r}    h{ {    >>K} +h{ {    &N} ,G}    Y,
  2150. X    S}    Z}    }    z?88:{ Z}    }    k?11
  2151. X+r+{ P[{    ]<0?N-{ {    >>K} :{ {    >>K} } :
  2152. X{ Z}    }    l?124-{ { YY<8&&{ { {    &N} !}    K||
  2153. X    { {    >>K} !}    { P[{    ]>0?0:N} } } ?M:0} :
  2154. X{ Z}    }    c?41+r:{ Z}    }    e?f-r-r:36+r+r} } } } ; 
  2155. XY}    P[{    ];
  2156. XV{ j}    0; j<M; ++j} B{ !I{ {    ,j,0} } S+}    { P[j]?5:1} ; 
  2157. XBZ+}    G}    }    Y?S:-S;
  2158. XY}    G; 
  2159. X}
  2160. X}
  2161. XB{ !{ ++X&M-1} } write{ 1,".",1} ; 
  2162. XA BZ; 
  2163. X}
  2164. XPX{ } {
  2165. XU {    ,Q}    0,XP}    0,JZ}    M*M,E}     -f,t,S}    o; 
  2166. XB{ !F--} A++F+C{ } ;
  2167. XV{ {    }    0; {    <JZ; ++{    } B{ !I{ {    >>K+K,{    &M-1,1} } {
  2168. XY}     -Y; 
  2169. Xo}     -E;
  2170. Xt}     -QL{ {    >>K+K,{    &M-1,PX} ; 
  2171. XY}     -Y; 
  2172. XB{ t>E} {
  2173. X++XP; 
  2174. XQ}    {    ; 
  2175. XE}    t; 
  2176. XB{ E>}    S} 
  2177. XA++F,E; 
  2178. X}
  2179. X}
  2180. XB{ !XP} E}    s{ } ?-f+1:0; 
  2181. Xp}    Q; 
  2182. XA++F,E; 
  2183. X}
  2184. XRZ{ } {
  2185. XU {    ,j,T}    0; 
  2186. XV{ ; ; } {
  2187. Xy{ } ; 
  2188. Xo}    f; 
  2189. Xdo{
  2190. XH"\n%d %d %d %s ",X,T,C{ } ,s{ } ?"!":">"} ;
  2191. Xfflush{ stdout} ; 
  2192. X}
  2193. Xu{ scanf{ "%o%o",&{    ,&j} !}    2||I{ {    ,j,1} } ;
  2194. XO{ {    ,j} ; 
  2195. Xy{ } ; 
  2196. XX}    0; 
  2197. X++YY;
  2198. XY}     -Y; 
  2199. XT}    PX{ } ; 
  2200. X{    }    p>>{ K<<1} ; 
  2201. Xj}    p&{ M-1} ; 
  2202. XB{ I{ {    ,j,1} } {
  2203. XH"Rats!\n"} ; 
  2204. XA; 
  2205. X}
  2206. XO{ {    ,j} ; 
  2207. XY}     -Y; 
  2208. XB{ T>M*M} H"\nHar har.\n"} ; 
  2209. X}
  2210. X}
  2211. Xmain{ ac,av} char**av; 
  2212. X{
  2213. Xlong time{ } ,j}    time{ &j} ; 
  2214. XR {    }    0; 
  2215. Xsrand{ { U} j} ;
  2216. XV{ M}    0; M<}    f; ++M} {    +}    UC{ } ; 
  2217. XM}    {    /100;
  2218. XB{ M&3} ++M; 
  2219. XB{ M&1} --M; 
  2220. XV{ N}    1; N*N<M; ++N} ;
  2221. XK}     --N/2; 
  2222. XF}    ac>1?atoi{ av[1]} :2; 
  2223. Xuv{ } ;
  2224. XRZ{ } ; 
  2225. X}
  2226. END_OF_FILE
  2227.   if test 3203 -ne `wc -c <'1992/vern.c'`; then
  2228.     echo shar: \"'1992/vern.c'\" unpacked with wrong size!
  2229.   fi
  2230.   # end of '1992/vern.c'
  2231. fi
  2232. echo shar: End of archive 4 \(of 5\).
  2233. cp /dev/null ark4isdone
  2234. MISSING=""
  2235. for I in 1 2 3 4 5 ; do
  2236.     if test ! -f ark${I}isdone ; then
  2237.     MISSING="${MISSING} ${I}"
  2238.     fi
  2239. done
  2240. if test "${MISSING}" = "" ; then
  2241.     echo You have unpacked all 5 archives.
  2242.     rm -f ark[1-9]isdone
  2243. else
  2244.     echo You still must unpack the following archives:
  2245.     echo "        " ${MISSING}
  2246. fi
  2247. exit 0
  2248. exit 0 # Just in case...
  2249.