home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 1 / 1573 < prev    next >
Encoding:
Internet Message Format  |  1990-12-28  |  66.3 KB

  1. From: chongo@hoptoad.uucp (Landon C. Noll)
  2. Newsgroups: comp.lang.c,comp.unix.wizards,alt.sources,comp.sources.d,misc.misc
  3. Subject: 1990 International Obfuscated C Code Contest Winners
  4. Message-ID: <11555@hoptoad.uucp>
  5. Date: 12 Jul 90 11:01:45 GMT
  6.  
  7. The shar file below contains the 1st public release of the winners of the
  8. 1990 International Obfuscated C Code Contest.
  9.  
  10. Prior to submitting these winners to UUNET source archives, we would
  11. like to collect porting comments,  If you run encounter problems 
  12. compiling/running these programs and YOU HAVE A FIX, please send
  13. a PATCH FILE (diff -c) via Email to:
  14.  
  15.     ...!{sun,pacbell,uunet,pyramid,amdahl}!hoptoad!judges
  16.     judges@toad.com
  17.  
  18. We expect that a number of problems will be encountered on some systems,
  19. so we would like to include a number of PATCH fixes along with the
  20. 2nd public release.
  21.  
  22. Comments on the included text (in the form of a PATCH) are welcome too.
  23.  
  24. The 1991 international Obfuscated C Code Contest will start when the 
  25. 1991 rules are posted to this newsgroup.  This will happen around
  26. the beginning of March 1991.  Please wait until the new 1991 rules 
  27. are posted before sending in new contest entries.  If you think you
  28. have missed the 1991 rules posting and it is after March 15, 1991,
  29. send us a note (to the address above) requesting a copy and we will
  30. attempt to Email them to you.
  31.  
  32. chongo <Happy Hacking, Share & Enjoy> /\cc/\
  33.  
  34. # This is a shell archive.  Remove anything before this line, then
  35. # unpack it by saving it in a file and typing "sh file".  (Files
  36. # unpacked will be owned by you and have default permissions.)
  37. #
  38. # This archive contains:
  39. # README Makefile ansi.mk common.mk baruch.c cmills.c dds.c dg.c jaw.c pjr.c 
  40. # scjones.c stig.c tbr.c theorem.c westley.c baruch.hint cmills.hint dds.hint
  41. # dg.hint jaw.hint pjr.hint scjones.hint stig.hint tbr.hint theorem.hint 
  42. # westley.hint LANDER.BAS stig.ksh shark.sh rules
  43.  
  44. : =-=-=-=-=-=-= first line of shar 1 of 1 =-=-=-=-=-=-=-=-=-
  45. echo mkdir ./1990
  46. mkdir ./1990
  47. echo cd ./1990
  48. cd ./1990
  49. echo x - README
  50. sed -e 's/^X//' > "README" << '//E*O*F README//'
  51. X1990 marked the "The Seventh International Obfuscated C Code Contest"
  52. X
  53. XInstructions for use: Run make to compile entries (it is possible that
  54. Xon System V or non-unix systems the makefile needs to be changed). The
  55. Xansi.mk may need to be changed if your ANSI C compiler is not gcc.
  56. X
  57. XLook at the source and try to figure out what the programs do, and run
  58. Xthem with various inputs.  If you want to, look at the hints files for
  59. X(minor) spoilers.
  60. X
  61. XThis year, the Grand Prize won a standing ovation at USENIX.
  62. X
  63. XThe "Strangest abuse of the rules" award was given this year to stress
  64. Xthe fact that starting in 1991, entries should be shell-specific.
  65. X
  66. XThis year was the first year that we accepted ANSI C entries.  It was
  67. Xinteresting to note that the ANSI C entries were as a whole less
  68. Xportable than the K&R C entries.  We hope that in future contests
  69. Xpeople will enter more obfuscated and challenging ANSI C programs.
  70. X
  71. XWe would like to thank Barbara Frezza (loving wife of Larry Bassel) for
  72. Xher role as official chef of the contest.  Her opinions regarding
  73. Xsome of the contest entries were appreciated.
  74. X
  75. XRules and results were posted to comp.lang.c, comp.sources.unix, and
  76. Xalt.sources.  They have been made available on a wide number of Usenet
  77. Xarchive sites such as uunet.
  78. //E*O*F README//
  79.  
  80. echo x - rules
  81. sed -e 's/^X//' > "rules" << '//E*O*F rules//'
  82. X7th International Obfuscated C Code Contest Rules
  83. X
  84. X    Obfuscate:  tr.v.  -cated, -cating, -cates.  1. a.  To render obscure.
  85. X        b.  To darken.  2. To confuse:  his emotions obfuscated his
  86. X        judgment.  [LLat. obfuscare, to darken : ob(intensive) +
  87. X        Lat. fuscare, to darken < fuscus, dark.] -obfuscation n.
  88. X        obfuscatory adj.
  89. X
  90. XGOALS OF THE CONTEST:
  91. X
  92. X    * To write the most Obscure/Obfuscated C program under the rules below.
  93. X    * To show what should NOT be done in C programs.
  94. X    * To provide a safe forum for poor C code.  :-)
  95. X
  96. XDEDICATION:
  97. X
  98. X    The 1990 International Obfuscated C Code Contest is dedicated to ANSI C.
  99. X
  100. XRULES:
  101. X
  102. X    To help us handle the vast volume of entries, we ask that you
  103. X    follow the rules below.  Sorry for the length, but we need all
  104. X    the help we can get!
  105. X
  106. X    1) Your source MUST be 1536 bytes or less, and it must be a complete
  107. X       program, not just a subroutine.
  108. X
  109. X    2) To help us process your entries, we ask that you submit entries
  110. X       in the following format.  Please be sure to include ALL --- lines,
  111. X       otherwise our extraction program may skip your entry!
  112. X
  113. X---header items---
  114. Xname:        Your name, of course!
  115. Xorg:        School/Company/Organization
  116. Xemail address:    Email address from a well known site, or in a registered domain
  117. Xpostal address:    Postal address
  118. X        include your country as well
  119. Xenvironment:    Indicate the Hardware 
  120. X        and OS under which your program was tested
  121. Xentry:        5    <number of entries sent so far including this one>
  122. Xremarks:    Remarks may be continued with leading whitespace until the
  123. X        line ---how to compile-- is encountered.  (see #3 below)
  124. X---how to ANSI compile---
  125. XX Give the command(s) needed to compile your program using an ANSI C
  126. XX compiler.  If you program should not be compiled under an ANSI C compiler, 
  127. XX leave this section blank.  Follow the format rules for the program 
  128. XX section below, except that command size must be 160 characters or less.
  129. X---how to common compile---
  130. XX Give the command(s) needed to compile your program using an K&R/traditional
  131. XX C compiler.  If you program should not be compiled under a K&R style C, 
  132. XX leave this section blank.  Follow the format rules for the program section
  133. XX below, except that command size must be 160 characters or less.
  134. X---program---
  135. XX Place obfuscated source of 1536 characters or less in this section.
  136. XX Add a leading X to each line to avoid problems with mailers.
  137. XX Some mailers don't like files with very long lines.  If your entry contains E
  138. XC    lines longer 80 chars we ask you to form continuation line sets.  To form E
  139. XC    a continuation line set, place an 'E' character at the point of a split E
  140. XC    and place a C (instead of an X) at the beginning of the next line. E
  141. XC    Finally, end the continuation line set as normal.
  142. XX The E\nC's and leading X's will be removed prior to extraction and thus E
  143. XC    they don't contribute toward the source character count.  All other E
  144. XC    characters are considered to be source.  Whitespace after 'X' or 'C' E
  145. XC    and before the 'E' is significant, we added it here for readability.
  146. XX Newlines and tabs each count as 1 character.  Assume 8 character tab stops.
  147. XX If your entry does not end in a newline, leave a final 'E' on the end. E
  148. X---end---
  149. X
  150. X    3) Regarding the header items:
  151. X
  152. X    * Any text outside of the above format will be kept confidential.
  153. X
  154. X    * All header lines are required, but you may use 'anonymous'
  155. X      for any header line other than 'remarks' or 'entry'.
  156. X
  157. X    * In the 'remarks' please include:
  158. X        - what this program does
  159. X        - why you think the program is obfuscated
  160. X        - any other remarks (humorous or otherwise)
  161. X    
  162. X    4) Your entry should be written in common C (K&R + common extensions)
  163. X       or ANSI C.  If your program will NOT compile under an ANSI C or 
  164. X       K&R C compiler, leave the particular 'how to' section blank.
  165. X
  166. X       You do not have to fill in both 'how to' sections, though you must
  167. X       fill in at least one 'how to' section.
  168. X
  169. X       If you leave a 'how to' section blank, include the '---' line, but
  170. X       but having no command lines after it.
  171. X
  172. X    5) The program must be of original work.  All programs must be
  173. X       in the public domain.  All copyrighted programs will be rejected.
  174. X
  175. X    6) Entries must be received between 16-Mar-90 0:00 GMT and 
  176. X       26-May-90 0:00 GMT.  Email your entries to:
  177. X       
  178. X        ...!{sun,pacbell,uunet,utzoo,pyramid,amdahl}!hoptoad!obfuscate
  179. X
  180. X       We will attempt to Email a confirmation of receipt of contest
  181. X       entries, however since Email is not reliable you may not receive it.
  182. X       We regret that we can no longer accept entries via postal mail.
  183. X
  184. X    7) Each person may submit up to 8 entries.  Multiple entries must
  185. X       be sent in separate Email letters.
  186. X    
  187. X    8) Entries that can not be built automatically in a portable makefile 
  188. X       are not allowed.  (e.g., don't use #include "/dev/tty")
  189. X
  190. X    9) Starting this year, compiling entries must result an regular file
  191. X       which can be executed. (No -o /dev/tty or similar compile lines)
  192. X
  193. X
  194. XANNOUNCEMENT OF WINNERS:
  195. X
  196. X    * First announcement will likely be at the Summer 90 Usenix BOF.
  197. X
  198. X    * Winning entries will be posted in mid June 1990 to 
  199. X      comp.sources.unix as well as news groups where these rules 
  200. X      were posted.  (depending on the judges work load)
  201. X    
  202. X    * Winning entries will be deposited into the uunet archives.
  203. X
  204. X    * An article containing the winning entries will be published
  205. X      in a future issue of the "Micro/Systems Journal".
  206. X
  207. X    * Winners receive international fame and flames!  :-)
  208. X
  209. X
  210. XJUDGING:
  211. X
  212. X    Awards will be given to the best entry in a number of categories.
  213. X    The actual category list will vary depending on the types of entries
  214. X    we receive.  As a guide, consider using the following:
  215. X
  216. X    * The best small one line program
  217. X    * The strangest source layout
  218. X    * The most useful obfuscated program
  219. X    * The most creatively obfuscated program
  220. X    * Best obfuscated entry smaller than 256 bytes
  221. X    * Best obfuscated entry smaller than 1024 bytes
  222. X    * Best abuse of ANSI
  223. X    * Worse abuse of the rules (no abuse of entry format please!)
  224. X    * <anything else so strange that it deserves an award>
  225. X
  226. XPOINTS TO PONDER:
  227. X
  228. X    People are encouraged to examine winners of the previous
  229. X    contests.  A copy of these entries was posted to
  230. X    comp.sources.unix.  Contact the comp.sources.unix moderator, or
  231. X    some archive site (such as uunet).  Keep in mind that rules
  232. X    change from year to year, so some winning entries may not be
  233. X    valid entries this year.  What was unique and novel one year
  234. X    might be 'old' the next year.  In short, use your best judgment.
  235. X
  236. X    We examine each entry on several levels of confusion.  For example
  237. X    each entry is judged when we:
  238. X
  239. X    * look at the original source
  240. X    * run it through:  sed -e ',^#[     ]*define,d' | /lib/cpp
  241. X    * run it through:  sed -e ',^#[     ]*include,d' | /lib/cpp
  242. X    * run it through a C beautifier
  243. X    * examine the algorithm
  244. X    * compile and lint it
  245. X    * execute it
  246. X    
  247. X    One line programs are best when they are short, obscure and concise.
  248. X
  249. X    We tend to dislike programs that:
  250. X
  251. X    * are very hardware specific
  252. X    * are very OS or Un*x version specific
  253. X         (index/strchr differences are ok, but socket/streams specific 
  254. X          code is likely not to be)
  255. X    * dump core or have compiler warnings
  256. X         (it is ok only if you warn us in the 'remark' header item)
  257. X    * won't compile under both BSD or SYS V Un*x
  258. X    * use an excessively long compile line to get around the size limit
  259. X    * are longer than they need to be
  260. X    * are similar to previous winners
  261. X    * are similar to previous losers  :-)
  262. X
  263. X    Simply abusing #defines or -Dfoo=bar won't go as far as a program
  264. X    that is more well rounded in confusion.
  265. X
  266. X    Unless you are cramped for space, or unless you are entering the 
  267. X    'best one liner' category, we suggest that you format your program 
  268. X    in a more creative way than simply forming excessively long lines.
  269. X
  270. X    We like programs that:
  271. X
  272. X    * are as concise and small as they need to be
  273. X    * do something quasi-interesting
  274. X    * pass lint without complaint (particularly strict ANSI ones)
  275. X    * are portable
  276. X    * are unique or novel in their obfuscation style
  277. X    * MAKE USE OF A NUMBER OF DIFFERENT TYPES OF OBFUSCATION
  278. X    * make us laugh and/or throw up  :-)
  279. X
  280. X    Some types of programs can't excel in some areas.  Of course, your 
  281. X    program doesn't have to excel in all areas, but doing well in several 
  282. X    areas really does help.
  283. X
  284. X    Be creative!
  285. X
  286. X    The Judging will be done by Landon Noll and Larry Bassel.  If you have
  287. X    any QUESTIONS or COMMENTS, please feel free to send them to:
  288. X
  289. X    ...!{sun,pacbell,uunet,pyramid,amdahl}!hoptoad!judges
  290. X    judges@toad.com
  291. X
  292. X    however contest entries should be sent to: 
  293. X    
  294. X    ...!{sun,pacbell,uunet,pyramid,amdahl}!hoptoad!obfuscate
  295. X    obfuscate@toad.com
  296. X
  297. X
  298. Xchongo <Landon Curt Noll> /\cc/\      hoptoad!chongo
  299. XLarry Bassel                  {amdahl,ucbvax,cbosgd}|sun!lab
  300. //E*O*F rules//
  301.  
  302. echo x - Makefile
  303. sed -e 's/^X//' > "Makefile" << '//E*O*F Makefile//'
  304. X# %W% %G% %U%
  305. X#
  306. X# 1990 makefile
  307. X
  308. XSHELL=/bin/sh
  309. XMAKE=make
  310. XMAKEFLAGS=e
  311. X
  312. X# uncomment the line to select the preferred type of compile
  313. X#
  314. X# You should also check the ansi.mk or common.mk for the
  315. X# proper compiler name and flags.
  316. X#
  317. X# NOTE ==> USE=ansi     compile with an ANSI compiler by default
  318. X#USE=ansi
  319. X# NOTE ==> USE=common   compile with a common K&R compiler by default
  320. XUSE=common
  321. X
  322. XWINNERS=cmills pjr westley stig tbr db dds theorem baruch jaw scjones
  323. X
  324. Xall:
  325. X    -@if [ ${USE} = common ]; then \
  326. X        ${MAKE} -f common.mk all; \
  327. X    elif [ ${USE} = ansi ]; then \
  328. X        ${MAKE} -f ansi.mk all; \
  329. X    else \
  330. X        echo "set USE= in Makefile to be ansi or common as desired"; \
  331. X        echo "or type: make -f ansi.mk for ansi makes"; \
  332. X        echo "or type: make -f common.mk for common K&R makes"; \
  333. X        exit 1; \
  334. X    fi
  335. X
  336. Xansi:
  337. X    ${MAKE} -f ansi.mk all
  338. X
  339. Xcommon:
  340. X    ${MAKE} -f common.mk all
  341. X
  342. X${WINNERS}:
  343. X    -@if [ ${USE} = common ]; then \
  344. X        ${MAKE} -f common.mk $@; \
  345. X    elif [ ${USE} = common ]; then \
  346. X        ${MAKE} -f ansi.mk $@; \
  347. X    else \
  348. X        echo "USE not correctly set in makefile"; \
  349. X        exit 1;\
  350. X    fi
  351. X
  352. Xclean:
  353. X    ${MAKE} -f ansi.mk clean
  354. X    ${MAKE} -f common.mk clean
  355. Xclobber:
  356. X    ${MAKE} -f ansi.mk clobber
  357. X    ${MAKE} -f common.mk clobber
  358. Xnuke: clobber
  359. X    ${MAKE} -f ansi.mk nuke
  360. X    ${MAKE} -f common.mk nuke
  361. Xinstall:
  362. X    ${MAKE} -f ansi.mk install
  363. X    ${MAKE} -f common.mk install
  364. //E*O*F Makefile//
  365.  
  366. echo x - ansi.mk
  367. sed -e 's/^X//' > "ansi.mk" << '//E*O*F ansi.mk//'
  368. X# %W% %G% %U%
  369. X#
  370. X# 1990 makefile
  371. X
  372. XSHELL=/bin/sh
  373. X
  374. X# flags for ANSI compiles
  375. X#
  376. X# These flags are setup for gcc, change as/if needed
  377. X#
  378. XPEDANTIC=-pedantic
  379. XCFLAGS=-O -ansi 
  380. XCHMOD=chmod
  381. XCC=gcc
  382. XCP=cp
  383. XRM=rm
  384. XLN=ln
  385. X
  386. X# winners that may be ok to compile with ANSI
  387. X#
  388. XWINNERS=cmills pjr westley stig tbr dg baruch jaw scjones
  389. X
  390. Xall: ${WINNERS}
  391. X
  392. Xansi: all
  393. X
  394. Xcommon:
  395. X    @echo "wrong makefile, use common.mk"
  396. X    exit 1
  397. X
  398. Xcmills: cmills.c
  399. X    ${CC} ${CFLAGS} -DM=500 -DN=52 -DX="srand((int)time(0L))" -DV=void \
  400. X        -o cmills cmills.c
  401. X
  402. Xpjr: pjr.c
  403. X    ${CC} ${CFLAGS} pjr.c -o pjr
  404. X
  405. Xwestley: westley.c
  406. X    ${CC} ${CFLAGS} westley.c -o westley
  407. X
  408. Xstig: stig.c stig.ksh
  409. X    @echo "run the Korn shell, and source stig.ksh"
  410. X    @echo "or read stig.hint and create your own aliases"
  411. X
  412. Xscjones: scjones.c
  413. X    ${CC} ${CFLAGS} scjones.c -o scjones
  414. X
  415. Xtbr: tbr.c
  416. X    ${CC} ${CFLAGS} tbr.c -o tbr
  417. X
  418. Xdg: dg.c
  419. X    ${CC} ${CFLAGS} dg.c -o dg
  420. X    # compile with the following if you don't have index()
  421. X    #${CC} ${CFLAGS} dg.c -Dindex=strchr -o dg
  422. X
  423. Xdds: dds.c LANDER.BAS
  424. X    ${CC} ${CFLAGS} dds.c -o dds
  425. X
  426. Xtheorem: theorem.c
  427. X    ${CC} ${CFLAGS} theorem.c -o theorem
  428. X    ${RM} -f sorter.c
  429. X    -./theorem -r 0 0 0 0 < theorem.c > sorter.c
  430. X    ${CC} ${CFLAGS} sorter.c -o sorter
  431. X    ${RM} -f fibonacci.c
  432. X    -./sorter 0 0 0 0 < theorem.c > fibonacci.c
  433. X    ${CC} ${CFLAGS} fibonacci.c -o fibonacci
  434. X
  435. Xbaruch: baruch.c
  436. X    ${CC} ${CFLAGS} baruch.c -o baruch
  437. X
  438. Xjaw: jaw.c shark.sh
  439. X    ${RM} -f ./zcat ./atob ./jaw
  440. X    ${CC} ${CFLAGS} ${PEDANTIC} jaw.c -o zcat
  441. X    ${LN} zcat atob
  442. X    echo 'PATH=;export PATH;atob|zcat' > jaw
  443. X    ${CHMOD} 0555 ./jaw
  444. X
  445. Xclean:
  446. X    ${RM} -f *.o a.out core
  447. Xclobber: clean
  448. X    ${RM} -f ${WINNERS} sorter.c sorter
  449. X    ${RM} -f fibonacci.c fibonacci atob zcat
  450. Xnuke: clobber
  451. X    @true
  452. Xinstall: all
  453. X    cat ${WINNERS} > /dev/null
  454. //E*O*F ansi.mk//
  455.  
  456. echo x - common.mk
  457. sed -e 's/^X//' > "common.mk" << '//E*O*F common.mk//'
  458. X# %W% %G% %U%
  459. X#
  460. X# 1990 makefile
  461. X
  462. XSHELL=/bin/sh
  463. XCHMOD=chmod
  464. XCC=gcc
  465. XCP=cp
  466. XRM=rm
  467. XSED=sed
  468. XLN=ln
  469. X
  470. X# flags for common K&R compiles
  471. X#
  472. XCFLAGS=-O
  473. XCC=cc
  474. X
  475. X# winners that may be ok to compile with common K&R
  476. X#
  477. XWINNERS=cmills pjr westley tbr dg dds theorem baruch jaw scjones
  478. X
  479. Xall: ${WINNERS}
  480. X
  481. Xansi:
  482. X    @echo "wrong makefile, use ansi.mk"
  483. X    exit 1
  484. X
  485. Xcommon: all
  486. X
  487. Xcmills: cmills.c
  488. X    ${CC} ${CFLAGS} -DM=500 -DN=52 -DX="srand((int)time(0L))" -DV=int \
  489. X        -o cmills cmills.c
  490. X
  491. Xpjr: pjr.c
  492. X    ${CC} ${CFLAGS} pjr.c -o pjr
  493. X
  494. Xwestley: westley.alt.c
  495. X    ${CC} ${CFLAGS} westley.alt.c -o westley
  496. X
  497. Xwestley.alt.c: westley.c
  498. X    ${RM} -f westley.alt.c
  499. X    -${SED} -e 's/signed//' -e 's/1s/1/g' -e 's/^    #/#/' \
  500. X        westley.c > westley.alt.c
  501. X
  502. Xstig: stig.c stig.ksh
  503. X    @echo "run the Korn shell, and source stig.ksh"
  504. X    @echo "or read stig.hint and create your own aliases"
  505. X
  506. Xtbr: tbr.c
  507. X    ${CC} ${CFLAGS} tbr.c -o tbr
  508. X
  509. Xdg: dg.c
  510. X    ${CC} ${CFLAGS} dg.c -o dg
  511. X    # compile with the following if you don't have index()
  512. X    #${CC} ${CFLAGS} dg.c -Dindex=strchr -o dg
  513. X
  514. Xdds: dds.c LANDER.BAS
  515. X    ${CC} ${CFLAGS} dds.c -o dds
  516. X
  517. Xtheorem: theorem.c
  518. X    ${CC} ${CFLAGS} theorem.c -o theorem
  519. X    ${RM} -f sorter.c
  520. X    -./theorem -r 0 0 0 0 < theorem.c > sorter.c
  521. X    ${CC} ${CFLAGS} sorter.c -o sorter
  522. X    ${RM} -f fibonacci.c
  523. X    -./sorter 0 0 0 0 < theorem.c > fibonacci.c
  524. X    ${CC} ${CFLAGS} fibonacci.c -o fibonacci
  525. X
  526. Xbaruch: baruch.c
  527. X    ${CC} ${CFLAGS} baruch.c -o baruch
  528. X
  529. Xjaw: jaw.c
  530. X    ${RM} -f ./zcat ./atob ./jaw
  531. X    ${CC} ${CFLAGS} jaw.c -o zcat
  532. X    ${LN} zcat atob
  533. X    echo 'PATH=;export PATH;atob|zcat' > jaw
  534. X    ${CHMOD} 0555 ./jaw
  535. X
  536. Xscjones: scjones.alt.c stdlib.h
  537. X    ${CC} ${CFLAGS} -I. scjones.alt.c -o scjones
  538. X
  539. X# NOTE: scjones.alt.c is just a de-ANSI-fied scjones.c for example only
  540. X#
  541. Xscjones.alt.c: scjones.c
  542. X    ${RM} -f scjones.alt.c
  543. X    -${SED} -e 's#??/#\\#g' -e 's/??=/#/g' -e 's/??(/[/g' -e 's/??)/]/g' \
  544. X        -e "s/??'/^/g" -e 's/??</{/g' -e 's/??!/|/g' -e 's/??>/}/g' \
  545. X        -e 's/??-/~/g' scjones.c > scjones.alt.c
  546. X
  547. Xstdlib.h:
  548. X    ${RM} -f stdlib.h
  549. X    echo "#define EXIT_SUCCESS 0" >stdlib.h
  550. X    echo "#define EXIT_FAILURE 1" >>stdlib.h
  551. X    echo "void exit(); /* may need to be int on some systems */" >>stdlib.h
  552. X
  553. Xclean:
  554. X    rm -f *.o a.out core
  555. Xclobber: clean
  556. X    ${RM} -f ${WINNERS} sorter.c sorter westley.alt.c stdlib.h
  557. X    ${RM} -f fibonacci.c fibonacci atob zcat scjonds.alt.c
  558. Xnuke: clobber
  559. X    @true
  560. Xinstall: all
  561. X    cat ${WINNERS} > /dev/null
  562. //E*O*F common.mk//
  563.  
  564. echo x - baruch.c
  565. sed -e 's/^X//' > "baruch.c" << '//E*O*F baruch.c//'
  566. Xv,i,j,k,l,s,a[99];
  567. Xmain()
  568. X{
  569. X    for(scanf("%d",&s);*a-s;v=a[j*=v]-a[i],k=i<s,j+=(v=j<s&&(!k&&!!printf(2
  570. X+"\n\n%c"-(!l<<!j)," #Q"[l^v?(l^j)&1:2])&&++l||a[i]<s&&v&&v-i+j&&v+i-j))&&!(l%=
  571. Xs),v||(i==j?a[i+=k]=0:++a[i])>=s*k&&++a[--i])
  572. X        ;
  573. X}
  574. //E*O*F baruch.c//
  575.  
  576. echo x - cmills.c
  577. sed -e 's/^X//' > "cmills.c" << '//E*O*F cmills.c//'
  578. X#include<stdio.h>
  579. X#include<time.h>
  580. X#define S(q)B(*e=0),q,p);
  581. X#define W(w)if((w)<22)v= -v;else v-=10;else
  582. X#define F for(r=d;r<d+N;
  583. X#define H(v,g)v=h(v,*g++= *r++),*g=0;
  584. X#define B(n)b(l,n),(V)printf(l
  585. XV
  586. Xexit();char*g,c[M],d[N],q[N],p[N],*e,*r=d+N,l[M],*t="??",*k,*m="DEATHISDSev2oin
  587. Xpohae3ttsluuln4a?uibfe 5l\0rtlfrb6 ?a?el:e7$!n\0?e t8%ccp\0.%s9deelc.s T.@?-t.\
  588. Xt<J /\0=a\nP=Q Sex \0l KW Sin a$\0ane-lay% ge#-slediefuk ar  r$via-:o ?+}:r? n \
  589. X0:) ee%lone 1-esy666!-~v\n.!^`'~@#\0\np~===:=q";b(o,n)char*o;{for(k=n+m;*o++=*k;k+=9);}int
  590. Xy=M*2,v,x,s,f,j,o;u(s){B(s));if(!gets(l))exit(0);return(o=
  591. X*l)=='y'||o=='Y'||o!='n'&&o!='N'&&u(s);}h(v,m){for(k=c;*k!='J';)if(m==*k++)break;m=k-c;if(v<0)W(v=m-v)
  592. Xif(m==1)W(v+=11)
  593. Xv+=m;return
  594. Xv;}main(w,z)char**z;{b(c,2)*X;for(--w&&(y=atoi(1[z]));y>1;){if(r-d>N*3/4){B(8));F++r)*r=c[(r-d)%13];F)w=
  595. X*(g=d+rand()%N),*g=
  596. X*r,*r++=w;r=d;}for(;;){B(3),y);if(!gets(l)||(w=atoi(l))<1)exit(0);if(w&1||w>M||w>y)B(1),y<M?y:M);else
  597. Xbreak;}y-=w,s=f=j=x=v=0,g=q,e=p;H(x,g)H(x,g)H(v,e)H(v,e)*t=
  598. X*q;S(t)*q=='A'&&y>=w/2&&u(5)&&(y+=(3*(h(0,1[q])==10)-1)*w/2);if(x==-21)goto
  599. X_;if(v==-21){y+=w/2;goto
  600. X_;}while(x>-17&&x<17)H(x,g)while((v==20||*p==-1[e])&&y>=w&&u(6)){y-=w;++s;for(g=e++;2[g]=
  601. X*g,g!=p;)--g;*g++=
  602. X*e;*g=' ';i:v=h(h(0,*p),*e++=
  603. X*r++);S(t)if(*p=='A'&&-1[e]!=
  604. X*p)goto
  605. X_;}if(f=y>=w&&u(7))y-=w,H(v,e)while(!f&&v<22&&u(4)){H(v,e)if(v<22)S(t)}_:x<0&&(x=
  606. X-x);v<0&&(v=
  607. X-v);if(v<22)if(v==x)j+=w*++f;else
  608. Xif(x>21||v>x)j+=w*2*++f;if(s--){*e++=' ';*e++=
  609. X*p;*e=0;for(e=p;*e=2[e];)e++;goto
  610. Xi;}y+=j;S(q)};}
  611. //E*O*F cmills.c//
  612.  
  613. echo x - dds.c
  614. sed -e 's/^X//' > "dds.c" << '//E*O*F dds.c//'
  615. X#define O(b,f,u,s,c,a)b(){int o=f();switch(*p++){X u:_ o s b();X c:_ o a b();default:p--;_ o;}}
  616. X#define t(e,d,_,C)X e:f=fopen(B+d,_);C;fclose(f)
  617. X#define U(y,z)while(p=Q(s,y))*p++=z,*p=' '
  618. X#define N for(i=0;i<11*R;i++)m[i]&&
  619. X#define I "%d %s\n",i,m[i]
  620. X#define X ;break;case
  621. X#define _ return
  622. X#define R 999
  623. Xtypedef char*A;int*C,E[R],L[R],M[R],P[R],l,i,j;char B[R],F[2];A m[12*R],malloc
  624. X(),p,q,x,y,z,s,d,f,fopen();A Q(s,o)A s,o;{for(x=s;*x;x++){for(y=x,z=o;*z&&*y==
  625. X*z;y++)z++;if(z>o&&!*z)_ x;}_    0;}main(){m[11*R]="E";while(puts("Ok"),gets(B)
  626. X)switch(*B){X'R':C=E;l=1;for(i=0;i<R;P[i++]=0);while(l){while(!(s=m[l]))l++;if
  627. X(!Q(s,"\"")){U("<>",'#');U("<=",'$');U(">=",'!');}d=B;while(*F=*s){*s=='"'&&j
  628. X++;if(j&1||!Q(" \t",F))*d++=*s;s++;}*d--=j=0;if(B[1]!='=')switch(*B){X'E':l=-1
  629. XX'R':B[2]!='M'&&(l=*--C)X'I':B[1]=='N'?gets(p=B),P[*d]=S():(*(q=Q(B,"TH"))=0,p
  630. X=B+2,S()&&(p=q+4,l=S()-1))X'P':B[5]=='"'?*d=0,puts(B+6):(p=B+5,printf("%d\n",S
  631. X()))X'G':p=B+4,B[2]=='S'&&(*C++=l,p++),l=S()-1 X'F':*(q=Q(B,"TO"))=0;p=B+5;P[i
  632. X=B[3]]=S();p=q+2;M[i]=S();L[i]=l X'N':++P[*d]<=M[*d]&&(l=L[*d]);}else p=B+2,P[
  633. X*B]=S();l++;}X'L':N printf(I)X'N':N free(m[i]),m[i]=0    X'B':_ 0 t('S',5,"w",N
  634. Xfprintf(f,I))t('O',4,"r",while(fgets(B,R,f))(*Q(B,"\n")=0,G()))X 0:default:G()
  635. X;}_ 0;}G(){l=atoi(B);m[l]&&free(m[l]);(p=Q(B," "))?strcpy(m[l]=malloc(strlen(p
  636. X)),p+1):(m[l]=0,0);}O(S,J,'=',==,'#',!=)O(J,K,'<',<,'>',>)O(K,V,'$',<=,'!',>=)
  637. XO(V,W,'+',+,'-',-)O(W,Y,'*',*,'/',/)Y(){int o;_*p=='-'?p++,-Y():*p>='0'&&*p<=
  638. X'9'?strtol(p,&p,0):*p=='('?p++,o=S(),p++,o:P[*p++];}
  639. //E*O*F dds.c//
  640.  
  641. echo x - dg.c
  642. sed -e 's/^X//' > "dg.c" << '//E*O*F dg.c//'
  643. X#include <stdio.h>
  644. X
  645. X#define d define
  646. X
  647. X#d b12(x) 12 x
  648. X#d a13(x) x 13
  649. X#d a16(x) x 16
  650. X#d a32(x) x 32
  651. X#d acb(x) x]
  652. X#d acc(x) x}
  653. X#d aco(x) x:
  654. X#d bco(x) :x
  655. X#d acp(x) x)
  656. X#d bef(x) EOF x
  657. X#d aeq(x) x=
  658. X#d afo(x) x for
  659. X#d age(x) x fgetc
  660. X#d asi(x) x stdin
  661. X#d aso(x) x stdout
  662. X#d bgt(x) >x
  663. X#d ai(x) x i
  664. X#d aj(x) x j
  665. X#d al(x) x l
  666. X#d ami(x) x-
  667. X#d bne(x) !=x
  668. X#d aob(x) x[
  669. X#d aop(x) x(
  670. X#d apl(x) x+
  671. X#d bpu(x) fputc x
  672. X#d bqm(x) ?x
  673. X#d aqm(x) x?
  674. X#d aqu(x) x'
  675. X#d ase(x) x;
  676. X#d awh(x) x while
  677. X#d axo(x) x^
  678. X#d a0(x) x 0
  679. X#d b13(x) 13 x
  680. X#d b16(x) 16 x
  681. X#d b19(x) 19 x
  682. X#d b48(x) 48 x
  683. X#d a64(x) x 64
  684. X#d b66(x) 66 x
  685. X#d bcb(x) ]x
  686. X#d bch(x) char x
  687. X#d bcm(x) ,x
  688. X#d acm(x) x,
  689. X#d bcp(x) )x
  690. X#d beq(x) =x
  691. X#d bex(x) extern x
  692. X#d bi(x) i x
  693. X#d bin(x) int x
  694. X#d bix(x) index x
  695. X#d bj(x) j x
  696. X#d bl(x) l x
  697. X#d alt(x) x<
  698. X#d bma(x) main x
  699. X#d bob(x) [x
  700. X#d boc(x) {x
  701. X#d bop(x) (x
  702. X#d bpl(x) +x
  703. X#d app(x) x++
  704. X#d bqu(x) 'x
  705. X#d bse(x) ;x
  706. X#d bst(x) *x
  707. Xbma(acp(bop(app(bcp(ai(boc(ase(bch(a16(bl(alt(bob(ai(b66(ase(bcb(a0(bcm(aeq(bst
  708. X(acb(bj(a64(bse(aob(bin(al(bi(aeq(bse(ai(bex(aop(bch(afo(bst(ase(bix(()))))))))
  709. X)))))))))))))))))))))))))))))))
  710. Xbl(ai(bob(aob(bi(al(bcb(aop(beq(apl(b13(a13(bpl(aeq(bop(acb(bl(bob(a32(bi(bpl(a
  711. Xpl(b16(bcb(ai(beq(b19(aob(bpl(bop(l))))))))))))))))))))))))))))))
  712. Xbpl(acp(b48(acp(asi(bcb(aop(beq(age(bop(aeq(bi(ai(bgt(aop(b12(aop(bqm(awh(b12(a
  713. Xse(bco(acp(bi(acp(bcp(acp(bpl(aqu(bqu(A))))))))))))))))))))))))))))))
  714. Xbne(acc(bef(ase(bcp(acp(aso(bpu(acm(ai(bop(aco(bop(acb(bj(al(beq(ami(bix(aj(axo
  715. X(bop(a16(aob(bl(al(aqm(bcm(acp(acp(i))))))))))))))))))))))))))))))
  716. //E*O*F dg.c//
  717.  
  718. echo x - jaw.c
  719. sed -e 's/^X//' > "jaw.c" << '//E*O*F jaw.c//'
  720. X#define C char
  721. X#define F X,perror("oops"),1
  722. X#define G getchar()
  723. X#define I ;if(
  724. X#define P putchar
  725. X#define Q 256
  726. X#define W ;while(
  727. X#define X return 0
  728. X#include<stdio.h>
  729. Xlong M,N,c,f,m,o,r,s,w;y(l){o^=l;m+=l+1;f=f*2+l+(f>>31&1);}int
  730. XO,S,e,i,k,n,q,t[69001];b(g){k=4 W g<k)y(P((C)(w>>--k*8)&255));w=0;}C D[Q*Q],h
  731. X[Q*Q];main(g,V)C**V;{I**V-97)X,a()W G-10)W(g=G)+1&&g-'x')if(g-10){I
  732. X4<k)b(0)I g>32&g<'v')w=w*85+g-33,++k;else{I
  733. Xg-'z'|k)F;w=0;k=5;}}W G-78)I scanf("%ld%lx E%lx S%lx R%lx ",&M,&N,&c,&s,&r)-5)F
  734. XI M){b(g=3-(M-1&3))W g--)y(0);}I(M-N|c-o|s-m|r-f)&4294967295)F;X;}long
  735. Xg(){C*p I m<f&n<k&&(m=(1L<<++n)-1)||O>=S){O=0;S=fread(D,1,n,stdin)*8 I
  736. XS<8)X-1;S-=n-1;}p=D+O/8;q=O&7;O+=n;X,(1<<8-q)-1&*p>>q|m&((15<n+q)*p[2]*Q|p[1]&
  737. X255)<<8-q;}a(){C*p=D+Q;G;G;k=G;e=k>>7&1;k&=31 I k>16)F;w=Q
  738. XW w--)t[w]=0,h[w]=w;n=8;f=Q+e;i=o=w=g()I o<0)X,1;P(i)W(w=g())+1){I
  739. Xw==Q&e){W w--)t[w]=0;m=n=8;f=Q I(w=g())<0)X;}c=w
  740. XI w>=f)*p++=i,w=o W w>=Q)*p++=h[w],w=t[w];P(i=h[w])W
  741. Xp>D+Q)P(*--p)I(w=f)<1L<<k)t[w]=o,h[f++]=i;o=c;}X;}
  742. //E*O*F jaw.c//
  743.  
  744. echo x - pjr.c
  745. sed -e 's/^X//' > "pjr.c" << '//E*O*F pjr.c//'
  746. X#include <stdio.h>
  747. X#define A(a) G a();
  748. X#define B(a) G (*a)();
  749. X#define C(a,b) G a() { printf(b); return X; }
  750. Xtypedef struct F G;A(a)A(b)A(c)A(d)A(e)A(f)A(g)A(h)A(i)A(j)A(k)A(l)A(m)A(n)A(
  751. Xo)A(p)A(q)A(r)A(s)A(t)A(u)A(v)A(w)A(x)A(y)A(z)A(S)A(N)void Q();struct F{B(a)B
  752. X(b)B(c)B(d)B(e)B(f)B(g)B(h)B(i)B(j)B(k)B(l)B(m)B(n)B(o)B(p)B(q)B(r)B(s)B(t)B(
  753. Xu)B(v)B(w)B(x)B(y)B(z)B(S)B(N)void(*Q)();}X={a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,
  754. Xq,r,s,t,u,v,w,x,y,z,S,N,Q};C(a,"z")C(b,"y")C(c,"x")C(d,"w")C(e,"v")C(f,"u")C(
  755. Xg,"t")C(h,"s")C(i,"r")C(j,"q")C(k,"p")C(l,"o")C(m,"n")C(n,"m")C(o,"l")C(p,"k"
  756. X)C(q,"j")C(r,"i")C(s,"h")C(t,"g")C(u,"f")C(v,"e")C(w,"d")C(x,"c")C(y,"b")C(z,
  757. X"a")C(S," ")C(N,"\n") void Q(){}main(){X=g().s().v().S().j().f().r().x().p().
  758. XS().y().i().l().d().m().S().u().l().c().S().q().f().n().k().v().w().S().l().e
  759. X().v().i().S().g().s().v().S().o().z().a().b().S().w().l().t().N();}
  760. //E*O*F pjr.c//
  761.  
  762. echo x - scjones.c
  763. sed -e 's/^X//' > "scjones.c" << '//E*O*F scjones.c//'
  764. Xchar*a??(??)=??<
  765. X"??=include<stdio.h>",
  766. X"??=include<stdlib.h>",
  767. X"??=define o stdout",
  768. X"??=define b break;case",
  769. X"??=define s(p)fputs(p,o);",
  770. X"??=define c(p)fputc(p,o);",
  771. X"void t(p,f)char*p;??<f&&c('??/"')",
  772. X"for(;;p++)??<switch(*p)??<case 0:f&&",
  773. X"s(??/"??/??/??/",??/")c('??/??/n')return;case",
  774. X"'??=':s(??/"???/??/?=??/")b'??<':s(??/"???/??/?<??/")",
  775. X"b'??>':s(??/"???/??/?>??/")b'??(':s(??/"???/??/?(??/")b'??)'",
  776. X":s(??/"???/??/?)??/")b'??/??/??/??/':f&&s(??/"???/??/?/??/")",
  777. X"s(??/"???/??/?/??/")b'??/??/n':if(f)s(??/"???/??/?/n??/")",
  778. X"else case'??/"':if(f)s(??/"???/??/?/??/??/??/"??/")",
  779. X"else default:c(*p)??>??>??>main()??<char**p",
  780. X";t(??/"char*a??(??)=??<??/",0);for(p=a;*p",
  781. X";p++)t(*p,1);t(??/"0??>;??/",0);for(p=a",
  782. X";*p;p++)t(*p,0);exit(!ferror(o)&&",
  783. X"!fclose(o)?EXIT_SUCCESS",
  784. X":EXIT_FAILURE);",
  785. X"/*NOTREACHED*/",
  786. X"??>",
  787. X0??>;
  788. X??=include<stdio.h>
  789. X??=include<stdlib.h>
  790. X??=define o stdout
  791. X??=define b break;case
  792. X??=define s(p)fputs(p,o);
  793. X??=define c(p)fputc(p,o);
  794. Xvoid t(p,f)char*p;??<f&&c('"')
  795. Xfor(;;p++)??<switch(*p)??<case 0:f&&
  796. Xs("??/",")c('??/n')return;case
  797. X'??=':s("???/?=")b'??<':s("???/?<")
  798. Xb'??>':s("???/?>")b'??(':s("???/?(")b'??)'
  799. X:s("???/?)")b'??/??/':f&&s("???/?/")
  800. Xs("???/?/")b'??/n':if(f)s("???/?/n")
  801. Xelse case'"':if(f)s("???/?/??/"")
  802. Xelse default:c(*p)??>??>??>main()??<char**p
  803. X;t("char*a??(??)=??<",0);for(p=a;*p
  804. X;p++)t(*p,1);t("0??>;",0);for(p=a
  805. X;*p;p++)t(*p,0);exit(!ferror(o)&&
  806. X!fclose(o)?EXIT_SUCCESS
  807. X:EXIT_FAILURE);
  808. X/*NOTREACHED*/
  809. X??>
  810. //E*O*F scjones.c//
  811.  
  812. echo x - stig.c
  813. sed -e 's/^X//' > "stig.c" << '//E*O*F stig.c//'
  814. Xc
  815. //E*O*F stig.c//
  816.  
  817. echo x - tbr.c
  818. sed -e 's/^X//' > "tbr.c" << '//E*O*F tbr.c//'
  819. X
  820. X#define D ,close(
  821. X
  822. Xchar              *c,q              [512              ],m[              256
  823. X],*v[           99], **u,        *i[3];int         f[2],p;main       (){for
  824. X (m[m        [60]=   m[62      ]=32   ]=m[*      m=124   [m]=       9]=6;
  825. X  e(-8)     ,gets      (1+(    c=q)     )||      exit      (0);     r(0,0)
  826. X   )for(    ;*++        c;);  }r(t,      o){    *i=i        [2]=    0;for
  827. X     (u=v  +98           ;m[*--c]         ^9;m [*c]          &32  ?i[*c
  828. X       &2]=                *u,u-             v^98              &&++u:
  829. X
  830. X    3    )if(!m[*c]){for(*++c=0;!m[*--c];);
  831. X    *    --u= ++c;}u-v^98?strcmp(*u,"cd")?*c?pipe(f),o=f[
  832. X    1    ]:
  833. X    4    ,(p=fork())?e(p),o?r(o,0)D o)D*f):
  834. X    1    ,wait(0):(o?dup2(*f,0)D*f)D o):*i?
  835. X    5    D 0),e(open(*i,0)):
  836. X    9    ,t?dup2(t,1)D t):i[
  837. X    2    ]?
  838. X    6    D 1),e(creat(i[2],438)):
  839. X    5    ,e(execvp(*u,u))):e(chdir(u[1])*2):
  840. X    3    ;}e(x){x<0?write(2,"?\n$ "-x/4,2),x+1||exit(1):
  841. X    5    ;}
  842. //E*O*F tbr.c//
  843.  
  844. echo x - theorem.c
  845. sed -e 's/^X//' > "theorem.c" << '//E*O*F theorem.c//'
  846. X#include <stdio.h>
  847. X#include <math.h>
  848. X#define X
  849. X#define Y {}
  850. X#define C  }
  851. X#define o {
  852. X#undef main
  853. Xchar m[500][99],v[99],R;
  854. Xint*a,b,n,i,j,W,A;
  855. Xfloat Q,G,D,M,T,B,O,U,V,N,y,e();
  856. XP(g,R,u)float*g,R,u;{int c;for(*g=1,c=u;c--;*g*=R);}
  857. XX
  858. XK(g,R,u)float*g,u;char R;
  859. Xo
  860. Xif(R=='+')*g+=u;
  861. Xif(R=='-')*g-=u;
  862. Xif(R=='*')*g*=u;
  863. Xif(R=='/')*g/=u;
  864. Xif(R=='^')P(g,*g,u);
  865. XC
  866. Xw(g,R,u)float*g,u;char R;
  867. X/**/{int b,f;A=atoi(*++a);b=atoi(*++a);while((f=A+b)<15000){printf("%d\n",f);A=b;b=f;}}
  868. Xmain(A,a)int A;char*a[];
  869. Xo o
  870. Xif(!strcmp(*++a,"-r"))S();
  871. XD=atof(*++a);
  872. XT=atof(*++a);
  873. XB=atof(*++a);
  874. XM=atof(*(4+(a-=3)));
  875. XC
  876. Xwhile(D<T)
  877. Xo
  878. XU=e((G=B/2,*a),D,M,a);
  879. XV=e(*a,Q=D+G,M+G*U,a);
  880. X/*/
  881. Xz;/*/
  882. XN=2*e(*a,Q,M+G*V,a);
  883. XM+=B*V/3+B*N/6+B*e(*a,D+=B,M+G*N,a)/6+G*U/3;
  884. Xprintf("%f %f\n",D,M);
  885. XC
  886. Xwhile(T=0)
  887. X;
  888. XW=D=1;
  889. X;
  890. Xwhile(W!=1)
  891. Xo o
  892. Xstrcpy(j+m,v);
  893. Xo 
  894. Xif((j-=W)<=W)break;
  895. Xstrcpy(j+m,m+j-W);
  896. XC
  897. Xwhile(strcmp(m+j-W,v)>0)
  898. Xj=i;
  899. Xstrcpy(v,i+m);
  900. XC
  901. Xfor(i=(W/=3)-1;++i<n;)
  902. X;
  903. XC
  904. Xdo
  905. X;
  906. Xwhile(0);
  907. Xfor(W=1;(W=W*3+1)<n;);
  908. XC
  909. Xfloat e(f,D,M,a)char*f,*a[];float D,M;
  910. Xo
  911. X#define main L
  912. XO=0;
  913. XR='+';
  914. Xfor(;*f;f++)
  915. Xif(*f=='y')K(&O,R,M);
  916. Xelse if((*f>='0')&&(*f<='9'))K(&O,R,(float)*f-'0');
  917. Xelse if(*f=='x')K(&O,R,D);
  918. Xelse if(1)R=*f;
  919. Xif(1);
  920. Xreturn O;
  921. Xfor(j=0;j<n;puts(j++[m]));
  922. Xe("",O,&O,a);
  923. Xn=j-(O=1);
  924. Xwhile(gets(j++[m]));
  925. Xif(!strcmp(*++a,"-r"))S();
  926. XC
  927. X/**/main(A,a)int A;char*a[];
  928. XY
  929. XS(){while(gets(b++[m]));for(b--;b--;puts(b[m]));}
  930. Xchar*f,m[500][99],R,v[99];
  931. Xint b,W,n,i,j,z;
  932. Xfloat Q,G,D,M,T,O,B,U,V,N,e();
  933. X#define Y
  934. X#define X {}
  935. X#define o }
  936. X#define C {
  937. X#include <stdio.h>
  938. X#include <math.h>
  939. //E*O*F theorem.c//
  940.  
  941. echo x - westley.c
  942. sed -e 's/^X//' > "westley.c" << '//E*O*F westley.c//'
  943. Xchar*lie;
  944. X
  945. X    double time, me= !0XFACE,
  946. X
  947. X    not; int rested,   get, out;
  948. X
  949. X    main(ly, die) char ly, **die ;{
  950. X
  951. X        signed char lotte,
  952. X
  953. X
  954. Xdear; (char)lotte--;
  955. X
  956. X    for(get= !me;; not){
  957. X
  958. X    1 -  out & out ;lie;{
  959. X
  960. X    char lotte, my= dear,
  961. X
  962. X    **let= !!me *!not+ ++die;
  963. X
  964. X        (char*)(lie=
  965. X
  966. X
  967. X"The gloves are OFF this time, I detest you, snot\n\0sed GEEK!");
  968. X
  969. X    do {not= *lie++ & 0xF00L* !me;
  970. X
  971. X    #define love (char*)lie -
  972. X
  973. X    love 1s *!(not= atoi(let
  974. X
  975. X    [get -me?
  976. X
  977. X        (char)lotte-
  978. X
  979. X
  980. X(char)lotte: my- *love -
  981. X    
  982. X    'I'  -  *love -  'U' -
  983. X
  984. X    'I'  -  (long)  - 4 - 'U' ])- !!
  985. X    
  986. X    (time  =out=  'a'));} while( my - dear
  987. X
  988. X    && 'I'-1l  -get-  'a'); break;}}
  989. X
  990. X        (char)*lie++;
  991. X
  992. X
  993. X(char)*lie++, (char)*lie++; hell:0, (char)*lie;
  994. X
  995. X    get *out* (short)ly   -0-'R'-  get- 'a'^rested;
  996. X
  997. X    do {auto*eroticism,
  998. X
  999. X    that; puts(*( out
  1000. X
  1001. X        - 'c'
  1002. X    
  1003. X-('P'-'S') +die+ -2 ));}while(!"you're at it");
  1004. X
  1005. X
  1006. Xfor (*((char*)&lotte)^=
  1007. X
  1008. X    (char)lotte; (love ly) [(char)++lotte+
  1009. X
  1010. X    !!0xBABE];){ if ('I' -lie[ 2 +(char)lotte]){ 'I'-1l ***die; }
  1011. X
  1012. X    else{ if ('I' * get *out* ('I'-1l **die[ 2 ])) *((char*)&lotte) -=
  1013. X
  1014. X    '4' - ('I'-1l); not; for(get=!
  1015. X
  1016. X
  1017. Xget; !out; (char)*lie  &  0xD0- !not) return!!
  1018. X
  1019. X    (char)lotte;}
  1020. X
  1021. X
  1022. X(char)lotte;
  1023. X
  1024. X    do{ not* putchar(lie [out
  1025. X
  1026. X    *!not* !!me +(char)lotte]);
  1027. X
  1028. X    not; for(;!'a';);}while(
  1029. X
  1030. X        love (char*)lie);{
  1031. X
  1032. X
  1033. Xregister this; switch( (char)lie
  1034. X
  1035. X    [(char)lotte] -1s *!out) {
  1036. X
  1037. X    char*les, get= 0xFF, my; case' ':
  1038. X
  1039. X    *((char*)&lotte) += 15; !not +(char)*lie*'s';
  1040. X
  1041. X    this +1s+ not; default: 0xF +(char*)lie;}}}
  1042. X
  1043. X    get - !out;
  1044. X
  1045. X    if (not--)
  1046. X
  1047. X    goto hell;
  1048. X
  1049. X        exit( (char)lotte);}
  1050. //E*O*F westley.c//
  1051.  
  1052. echo x - baruch.hint
  1053. sed -e 's/^X//' > "baruch.hint" << '//E*O*F baruch.hint//'
  1054. XBest Small Program: <baruch@genius.tau.ac.il> Osovlanski & Nissenbaum
  1055. X
  1056. X    Doron Osovlanski
  1057. X    CADTECH - CAD/CAM Systems Ltd
  1058. X        24 Ben-Yosef st.
  1059. X        Givat-Shmuel   51905
  1060. X    Israel
  1061. X
  1062. X    Baruch Nissenbaum                  BARUCH@TAUNIVM.TAU.AC.IL
  1063. X    Tel-Aviv University
  1064. X    The Faculty of Engineering
  1065. X    Tel-Aviv
  1066. X    Israel
  1067. X
  1068. X
  1069. XJudges' comments:
  1070. X
  1071. X    Compile.  Try:
  1072. X
  1073. X    echo 4 | baruch
  1074. X    echo 7 | baruch
  1075. X
  1076. X    This program reads an integer between 4 and 99 from the stdin.
  1077. X
  1078. X    NOTE: The original program did not have a newline at the end of
  1079. X      the file.  We added a final newline to the file to make
  1080. X      unpacking easy.
  1081. X
  1082. X
  1083. XSelected notes from the author:
  1084. X
  1085. X    The goal of this work was to write a program that solves the
  1086. X    classic n-queen problem, with a board size of up to 99x99, while
  1087. X    keeping the program as short as possible.
  1088. X
  1089. X    The program finds all possibilities to place N chess queens on
  1090. X    a NxN chess board so that no queen is in range of any other queen
  1091. X    (not in the same column row or diagonal).  For each solution the
  1092. X    chess board and the place of the queens is printed to stdout.
  1093. X
  1094. X
  1095. X    This program is about as simple and as readable as possible.
  1096. X    To make things even more simple we used a very limited subset of C:
  1097. X
  1098. X         No pre-processor statements
  1099. X         Only one, harmless, 'for' statement
  1100. X         No ifs
  1101. X         No breaks
  1102. X         No cases
  1103. X         No functions
  1104. X         No gotos
  1105. X         No structures
  1106. X
  1107. X    In short, it contains no C language that might confuse the
  1108. X    innocent reader.  :-)
  1109. X
  1110. X
  1111. X    This program demonstrates the claim that in C, any program
  1112. X    can be written using a single 'for' statement, as long as it is
  1113. X    long enough..
  1114. X
  1115. XThe authors further note:
  1116. X
  1117. X    For PC users:
  1118. X    In order to compile the program under Turbo-C or MSC, 'int '
  1119. X    should be inserted at the beginning of the program.
  1120. X    For better looking results it is recommended to replace the " #Q"
  1121. X    string with " \261\2".
  1122. //E*O*F baruch.hint//
  1123.  
  1124. echo x - cmills.hint
  1125. sed -e 's/^X//' > "cmills.hint" << '//E*O*F cmills.hint//'
  1126. XBest Game: <cmills@wyse.com> Chris Mills
  1127. X
  1128. X    Chris Mills
  1129. X    Wyse Technology
  1130. X    3471 N. 1st St.
  1131. X    San Jose CA 95134
  1132. X    USA
  1133. X
  1134. X
  1135. XJudges notes:
  1136. X
  1137. X    Compile notes:
  1138. X
  1139. X       cc -DM=500 -DN=52 -DX="srand((int)time(0L))" -DV=void -o cmills cmills.c
  1140. X
  1141. X    -DM=<max bet allowed>
  1142. X    -DN=<52 * number of decks used>
  1143. X    -DX=<how to seed the rand() generator>
  1144. X    -DV=<void ot int>
  1145. X
  1146. X    Usage: cmills [starting_cash]
  1147. X
  1148. X
  1149. XSelected notes from the author:
  1150. X
  1151. X    This is a blackjack program.  It does splits, doubling down,
  1152. X    insurance, etc.  
  1153. X
  1154. X    As best I can figure, it should be ANSI-compliant, as well as
  1155. X    portable to BSD & sysV (as well as the irritating compiler I
  1156. X    was using which assumes x=*p++ means x*=p++!).  It is
  1157. X    reasonably robust in its error handling---it won't let you
  1158. X    split, double, etc. unless you actually have the cash, etc.  To
  1159. X    terminate the program, hit EOF or type 0 or a negative number
  1160. X    for you wager.
  1161. X
  1162. X    The way it deals with splits is particularly cool (IMHO).  You
  1163. X    can split many times, and it will show all hands as they are
  1164. X    played.
  1165. //E*O*F cmills.hint//
  1166.  
  1167. echo x - dds.hint
  1168. sed -e 's/^X//' > "dds.hint" << '//E*O*F dds.hint//'
  1169. XBest Language Tool: <dds@cc.ic.ac.uk> Diomidis Spinellis
  1170. X
  1171. X    Diomidis Spinellis
  1172. X    Imperial College, University of London
  1173. X    Myrsinis 1
  1174. X    GR-145 62 Kifissia
  1175. X    Greece
  1176. X
  1177. X
  1178. XJudges' comments:
  1179. X
  1180. X    Compile and run.  Give the following lines as input:
  1181. X    
  1182. X    OLD LANDER.BAS
  1183. X    RUN
  1184. X
  1185. X    Be sure not to run out of fuel!
  1186. X
  1187. X
  1188. XSelected notes from the author:
  1189. X
  1190. X    This is the DDS-BASIC Interpreter (Version 1.00). 
  1191. X
  1192. X    Immediate commands:
  1193. X
  1194. X    RUN    LIST    NEW    OLD filename
  1195. X    BYE    SAVE filename
  1196. X
  1197. X    Program commands:
  1198. X
  1199. X    variable names a to z        variables initialized to 0 on RUN
  1200. X    FOR var = exp TO exp        NEXT variable
  1201. X    GOSUB exp            RETURN
  1202. X    GOTO exp            IF exp THEN exp
  1203. X    INPUT variable            PRINT string
  1204. X    PRINT exp            var = exp
  1205. X    REM any text            END
  1206. X
  1207. X    Expressions (ranked by precedence):
  1208. X
  1209. X    Bracketed expressions
  1210. X    number (leading 0 for octal, 0x for hex, else decimal), variable
  1211. X    Unary -
  1212. X    * / 
  1213. X    + - 
  1214. X    = <> 
  1215. X    > < 
  1216. X    <= >=
  1217. X    (* and + are also used for boolean AND and boolean OR)
  1218. X    Boolean expressions evaluate to 0 for false and 1 for true
  1219. X
  1220. X    Editing:
  1221. X
  1222. X    - Line editor using line re-entry.
  1223. X    - A line number with nothing following it, deletes the line.
  1224. X
  1225. X    Input format:
  1226. X
  1227. X    - Free format positioning of tokens on the line.
  1228. X    - No space is allowed before the line number.
  1229. X    - Exactly one space is needed between the OLD or SAVE command and 
  1230. X      the filename.
  1231. X    - ALL INPUT MUST BE UPPERCASE.
  1232. X
  1233. X    Limits:
  1234. X
  1235. X    Line numbers        1-10000
  1236. X    Line length        999 characters
  1237. X    FOR nesting        26
  1238. X    GOSUB            999 levels
  1239. X    Program            Dynamically allocated
  1240. X    Expressions        -32768 - 32767 for 16 bit machines, 
  1241. X                -2147483648 - 2147483647 for 32 bit machines
  1242. X
  1243. X    Error checking / error reports:
  1244. X
  1245. X    No error checking is performed.
  1246. X    The message `core dumped' signifies a syntax or semantic error.
  1247. X
  1248. X    Hosting Environment:
  1249. X
  1250. X    ANSI C, traditional K&R C or OSF ANDF
  1251. X    ASCII or EBCIDIC character set
  1252. X    48K bytes memory
  1253. X
  1254. X    The Speed of DDS-BASIC Interpreter (Version 1.00). relative to
  1255. X    Microsoft Advanced BASIC 3.31 is Approximately 60%.
  1256. X
  1257. X    The code size could be further reduced by doing ugly things like
  1258. X    not declaring the return type of functions, not freeing memory,
  1259. X    #defining define, and joining lines.  In its present 1536 character
  1260. X    form the program is reasonably portable (it may fail to run in a
  1261. X    tagged object architecture) and nicely formatted (it fits in an
  1262. X    80*25 screen).
  1263. //E*O*F dds.hint//
  1264.  
  1265. echo x - dg.hint
  1266. sed -e 's/^X//' > "dg.hint" << '//E*O*F dg.hint//'
  1267. XBest Abuse of the C Preprocessor: <harvard!xait!pallio!dg> David Goodenough
  1268. X
  1269. X    David Goodenough
  1270. X    anonymous organization
  1271. X    541 Commonwealth Ave,
  1272. X    Newton, MA 02159
  1273. X    USA
  1274. X
  1275. XJudges' comments:
  1276. X
  1277. X    Compile and run.  Try:
  1278. X
  1279. X    echo "to C or not to C" | dg
  1280. X
  1281. X    Some C preprocessors get confused about single quotes in certain cases.
  1282. X    In particular, the following source line:
  1283. X
  1284. X   Cb12(ase(bco(acp(bi(acp(bcp(acp(bpl(aqu(bqu(A))))))))))))))))))))))))))))))
  1285. X
  1286. X    may need to be changed to:
  1287. X
  1288. X   Cb12(ase(bco(acp(bi(acp(bcp(acp(bpl('A'))))))))))))))))))))))))))))
  1289. X
  1290. X    if your C preprocessor botches single quotes in cpp expansions.
  1291. X
  1292. X    Systems that use strchr() instead of index() (e.g., SVR3) should
  1293. X    compile with -Dindex=strchr.
  1294. X
  1295. XSelected notes from the author:
  1296. X
  1297. X    If my preprocessor could hack it, I could write this as one single
  1298. X    line rather than 4, but when I do that I get a complaint "defines
  1299. X    nested too deeply".
  1300. X
  1301. X    Spoiler: (rot13 to read)
  1302. X
  1303. X    Guvf vf nabgure ebg13 wbo (oryvrir vg be abg) - gur #qrsvarf ner n
  1304. X    abiry jnl bs nqqvat gbxraf: '#qrsvar o12(k) 12 k' zrnaf gung ng
  1305. X    fbzr cbvag va gur fbhepr n 12 vf sbyybjrq ol gur pbzcerffrq arfgrq
  1306. X    qrsvarf. Gur o12 trgf gur cerivbhf pbzcerffvba nf na nethzrag, naq
  1307. X    cercraqf gur 12, guhf znxvat nabgure fgrc va gur erperngvba bs gur
  1308. X    fbhepr. Gur nkk() qrsvarf qb gur fnzr, ohg nqq gbxraf nsgre.
  1309. X
  1310. X    Nf sbe gur ebg13 nytbevguz, vg eryvrf ba vaqrk() gb svaq vs gur
  1311. X    punenpgre vf va gur frg N-Mn-m. y[] vf na neenl gung trgf svyyrq
  1312. X    jvgu:
  1313. X
  1314. X    "abcdefghijklmmmmnopqrstuvwxyzzzzABCDEFGHIJKLMMMMNOPQRSTUVWXYZZZZ"
  1315. X
  1316. X    Vs vaqrk() fnlf gur pune vf va gur nycunorg, gura kbe gur bssfrg
  1317. X    jvgu 16 gb genafyngr, naq bhgchg, bgurejvfr cnff vg hapunatrq.
  1318. //E*O*F dg.hint//
  1319.  
  1320. echo x - jaw.hint
  1321. sed -e 's/^X//' > "jaw.hint" << '//E*O*F jaw.hint//'
  1322. XBest Entropy-reducer: <see below> Woods, Fox & Eggert
  1323. X
  1324. X    James A. Woods                     jaw@riacs.edu
  1325. X    Research Institute for Advanced Computer Science
  1326. X    MS 230-5
  1327. X    NASA Ames Research Center
  1328. X    Moffett Field, CA 94131
  1329. X    USA
  1330. X
  1331. X    Karl F. Fox                     karl@MorningStar.com
  1332. X    Morning Star Technologies, Inc.
  1333. X    1760 Zollinger Road
  1334. X    Columbus, OH 43221
  1335. X    USA
  1336. X
  1337. X    Paul Eggert                     eggert@twinsun.com
  1338. X    Twin Sun Inc.
  1339. X    360 N. Sepulveda Blvd. #2055
  1340. X    El Segundo, CA 90245
  1341. X    USA
  1342. X
  1343. X
  1344. XJudges' comments:
  1345. X
  1346. X    The program, in its base form, implements two useful utilities:
  1347. X
  1348. X    atob - ascii to binary conversion
  1349. X    zcat - decompression filter
  1350. X
  1351. X    To test the official C entry, one might try:
  1352. X
  1353. X    echo "Quartz glyph jocks vend, fix, BMW." | compress | btoa | jaw
  1354. X
  1355. X    which should apply the identity transformation to a minimal
  1356. X    holoalphabetic sentence.
  1357. X
  1358. X    Included with this entry is a shell script (with comments edited down
  1359. X    to reduce it to 1530 bytes) which implements the complete
  1360. X    shark utility.  The script, shark.sh, contains a 'jaw.c' embedded
  1361. X    within it!
  1362. X
  1363. X    The sender must have 'compress' and 'btoa'.  To send, try:
  1364. X
  1365. X    sh shark.sh jaw.* > receive
  1366. X
  1367. X    The resulting file, 'receive', unpacks the input files
  1368. X    even if the receiver lacks 'uncompress' and 'atob':
  1369. X
  1370. X    mkdir test
  1371. X    cd test
  1372. X    sh ../receive
  1373. X    cmp ../jaw.c jaw.c
  1374. X    cmp ../jaw.hint jaw.hint
  1375. X
  1376. XSelected notes from the authors:
  1377. X
  1378. X                 ABSTRACT
  1379. X
  1380. X           Minimal, Universal File Bundling
  1381. X     (or, Functional Obfuscation in a Self-Decoding Unix Shell Archive)
  1382. X
  1383. X               James A. Woods
  1384. X           Universities Space Research Association
  1385. X              NASA Ames Research Center
  1386. X
  1387. X
  1388. X           "Use an algorithm, go to jail."
  1389. X                [anon., circa 1988, pre-Morris worm era]
  1390. X
  1391. X
  1392. X      Myriad formats have been proposed for  network-mailable
  1393. X     data.  A major difficulty undermining the popularity of most
  1394. X     file/message bundlers  is  that  the  sender  assumes  prior
  1395. X     installation  of  the  computational  dual  of such bundling
  1396. X     software by the receiver.  Command shell archives  alleviate
  1397. X     this problem somewhat, but still require standardization for
  1398. X     the  function  of  data  compression  and  mail-transparency
  1399. X     encoding.  On Unix, these coding format quandaries are over-
  1400. X     come by planting a novel Trojan Horse in the archive  header
  1401. X     to perform negotiationless decoding.
  1402. X
  1403. X      Specifically, we outline the development of an extraor-
  1404. X     dinarily   compact  portable  (un)bundler  to  (dis)assemble
  1405. X     data-compressed,  binary-to-ASCII-converted,   length-split,
  1406. X     and  checksummed  directory  structures  using standard Unix
  1407. X     tools.  Miniature versions of counterparts to  a  Lempel-Ziv
  1408. X     coder ('compress' or 'squeeze') and an efficient bit packet-
  1409. X     izer ('btoa') are compiled on-the-fly  at  mail  destination
  1410. X     sites  where  they may not already exist.  These are written
  1411. X     in purposefully obfuscated-C to  accompany  similarly-shrunk
  1412. X     shell command glue.  This resulting shell archiver is dubbed
  1413. X     'shark'.
  1414. X
  1415. X       'Shark' procedure overhead consumes as  few  as  three
  1416. X     dozen  shell  lines  (or ~1100 bytes), commensurate with the
  1417. X     size of many Internet mail headers; it  amortizes  favorably
  1418. X     with  message  size.   'Shark' is portable across Unix vari-
  1419. X     ants, while the underlying technique is inherently  general-
  1420. X     izable to other encoding schemes.
  1421. X
  1422. X      In   the   function-theoretic    sense    of    minimal
  1423. X     Chaitin/Kolmogorov complexity, and within a modified Shannon
  1424. X     model of communication, the 'shark' effort aims to construct
  1425. X     a  "shortest  program"  for  source  decoding in the Turing-
  1426. X     universal Unix environment.
  1427. X
  1428. X     ----------------------------------------------
  1429. X
  1430. X       Oh, the shark has pretty teeth, dear--
  1431. X       And he shows them pearly white
  1432. X       Just a jackknife has Macheath, dear--
  1433. X       And he keeps it out of sight.
  1434. X
  1435. X            [Bertolt Brecht, Threepenny Opera]
  1436. X
  1437. X     ----------------------------------------------
  1438. X
  1439. X    We have ported this program to a wide variety of systems.  Among
  1440. X    these are:
  1441. X
  1442. X    SunOS 4.1 / Sun Sparcstation 1 (using both 'cc' and 'gcc 1.37.1')
  1443. X    SunOS 4.0.3 / Sun 3
  1444. X    BSD 4.3 / VAX 8650
  1445. X    SEIUX / Sumitomo Electric Ustation/S
  1446. X    Sony NEWS-OS 3.3 / Sony NEWS (fairly vanilla 4.3BSD)
  1447. X    System V.? / Hitachi 2050
  1448. X    System V.? / NEC EWS 4800
  1449. X    UNIOS-B / Omron Luna
  1450. X    Dynix / Sequent Balance ('cc' for Natl. Semi. base + 'gcc 1.36')
  1451. X    Unicos / Cray 2
  1452. X
  1453. X     We (the authors) feel this program is obfuscated for the
  1454. X     following reasons:
  1455. X
  1456. X     (0) This is one of the few programs you'll see WHOSE VERY UTILITY
  1457. X     DEPENDS ON ITS OBFUSCATION!
  1458. X
  1459. X     (1) The contest entry may be used to send its wonderful self to
  1460. X     anyone in the Unix world!  Virus writers need not apply...
  1461. X
  1462. X     (2) The basic idea is twisted enough to be patentable, but is,
  1463. X     out of the kindness of our hearts (as well as to maintain
  1464. X     eligibility for the large IOCCC prize fund), dedicated to
  1465. X     the public domain.  Claude Shannon, meet Alan Turing.
  1466. X
  1467. X     (3) Meta-obfuscation is via obfuscated description (see ABSTRACT).
  1468. X
  1469. X     (4) "Literary" allusion.  Production code contains a reference to
  1470. X     self-reference, preserved at amazing cost for sheer perversity.
  1471. X
  1472. X     (5) Many, many micro obfuscations below, honed over three years
  1473. X     time, in shell as well as C.  Ask about the 'tar' pit escape,
  1474. X     the argv[0] flip, Paul's &4294967295 portability hack, the
  1475. X     "void where prohibited by flaw" fix, the scanf() spacesaver,
  1476. X     shift shenanigans, signal madness, exit()ing stage left, and
  1477. X     source-to-source transformations galore.
  1478. X
  1479. X     For extra credit:
  1480. X
  1481. X    Construct 'sharkmail', to auto-split sharkives into mailable
  1482. X    segments and mail them.  Here's a simple one, which could be
  1483. X    extended to enable auto-reassembly with one shell cmd at the
  1484. X    far end.
  1485. X
  1486. X     ------------------------ cut here for sharkmail -----------------------
  1487. X     #!/bin/sh
  1488. X     m=$1; shift
  1489. X     shark $* | split -800 - /tmp/shark$$
  1490. X     n=`ls /tmp/shark$$* | wc -l | sed 's/  *//'`
  1491. X     p=0
  1492. X     for f in `ls /tmp/shark$$*`
  1493. X     do
  1494. X     p=`expr $p + 1`
  1495. X     mail -s "bundle ($p of $n) from '`whoami`'" $m < $f
  1496. X     done
  1497. X     rm /tmp/shark$$*
  1498. X     ------------------------ end of sharkmail -----------------------------
  1499. X
  1500. X
  1501. XShark history:
  1502. X
  1503. X       May 1987: Karl Fox introduces 1023-byte zcat.c to USENET.
  1504. X         It's too late for the 4th IOCCC.
  1505. X
  1506. X       May 21, 1987: James A. Woods extends idea to construct self
  1507. X         decompressing shar Trojan horse, utilizing 'cc', 'shar',
  1508. X         'zcat', & 'atob'; size: 2303 bytes.
  1509. X
  1510. X       May 23, 1987: 'jaw' trims 250 bytes without much thought.
  1511. X
  1512. X       June 2, 1987: 52 lines of shell, 1991 bytes, now made with 'tar',
  1513. X         short-circuit C-compile at far end, dual-use main.c,
  1514. X         portability mods. (jaw)
  1515. X
  1516. X       Mar-May 1988: abortive run at 5th IOCCC.
  1517. X         jaw.c - 1529 bytes.  compile line: 152 bytes.
  1518. X         generated funny code with execvp() to invoke shell.
  1519. X
  1520. X       Aug 29, 1988: production version, now at 1830 bytes.
  1521. X
  1522. X       Jan 1990: Paul Eggert does tour-de-force shark re-engineering.
  1523. X
  1524. X       May 24, 1990: collaboration yields 999-byte jaw.c core (see above)
  1525. X         and 1530-byte production shell code (w/comments).
  1526. X         Eggert comes through with lion's share of improvements.
  1527. X         7th IOCCC code now faster than the atob/zcat it replaces.
  1528. X
  1529. X       May 1990: 'jaw' develops experimental replacement using
  1530. X         Dan Bernstein's high-compression 'squeeze'.
  1531. X
  1532. X
  1533. XTo which we add:
  1534. X
  1535. X       June 1990: 'shark' wins the IOCCC, finally!  :-)
  1536. //E*O*F jaw.hint//
  1537.  
  1538. echo x - pjr.hint
  1539. sed -e 's/^X//' > "pjr.hint" << '//E*O*F pjr.hint//'
  1540. X
  1541. XMost Unusual Data Structure <pjr@pyra.co.uk> Peter J Ruczynski
  1542. X
  1543. X    Peter J Ruczynski.
  1544. X    Pyramid Technology Ltd.
  1545. X    Pyramid House,
  1546. X    Solatron Road
  1547. X    Farnborough.
  1548. X    Hants GU14 7PL
  1549. X    England, U.K.
  1550. X
  1551. X
  1552. XJudges' comments:
  1553. X
  1554. X    This program prints out a string.  Can you figure out how
  1555. X    it is done?
  1556. X
  1557. X    By use of pointers to functions returning a struct of pointers 
  1558. X    to functions!
  1559. X
  1560. X    Note that some compilers will be unable to compile the
  1561. X    expression 'X=g()...' in main due to lack of temporary
  1562. X    value space.  One might want to try replacing main with:
  1563. X
  1564. X        main(){X=s().v().o().o().l().S().d().l().i().o().w().N();}
  1565. X    
  1566. X    if this is a problem.
  1567. X
  1568. X
  1569. XSpoiler: (rot13 to read)
  1570. X
  1571. X    Guvf cebtenz cevagf bhg gur fgevat:
  1572. X
  1573. X    gur dhvpx oebja sbk whzcrq bire gur ynml qbt
  1574. X
  1575. X    ol hfr bs cbvagref gb shapgvbaf ergheavat n fgehpg bs cbvagref 
  1576. X    gb shapgvbaf!
  1577. X
  1578. X
  1579. XSelected notes from the author: (rot13 to read)
  1580. X
  1581. X    Vg vf fvzcyr gb znxr gur cebtenz cevag bgure fgevatf.  Rnpu
  1582. X    nycunorgvpny punenpgre sebz n gb m vf cevagrq bhg nf vgf
  1583. X    bccbfvgr:
  1584. X
  1585. X        n->m o->l p->k rgp
  1586. X
  1587. X    Gb rapbqr n arj fgevat vachg gur fgevat nf vg vf zrnag gb pbzr bhg:
  1588. X
  1589. X        K=f().i().b().b().y().F().q().y().v().b().j().A();
  1590. X
  1591. X    Abgr: F() ercerfragf n fcnpr naq A() n arjyvar.  Guvf jvyy abj
  1592. X    cebqhpr...
  1593. X
  1594. X        uryyb jbeyq
  1595. X
  1596. X    By the way, there is actually a piece of code which is not used
  1597. X    in the original program! I leave it as an intellectual exercise
  1598. X    to the reader to find out what it is.
  1599. X
  1600. //E*O*F pjr.hint//
  1601.  
  1602. echo x - scjones.hint
  1603. sed -e 's/^X//' > "scjones.hint" << '//E*O*F scjones.hint//'
  1604. XANSI Committee's Worst Abuse of C: <scjones@sdrc.uu.net> Larry Jones
  1605. X
  1606. X    Larry Jones
  1607. X    SDRC
  1608. X    2000 Eastman Dr
  1609. X    Milford, OH 45150  
  1610. X    USA
  1611. X
  1612. X
  1613. XJudges' comments:
  1614. X
  1615. X    The addition of trigraphs has made it easier to make programs 
  1616. X    hard to read.  It was a dark and stormy night for C when the
  1617. X    ANSI C committee added trigraphs to the standard.  Too bad
  1618. X    that they didn't just simply require a more reasonable ISO
  1619. X    character set.
  1620. X
  1621. X    The common.mk (non-ANSI) makefile uses sed to form scjones.alt.c.
  1622. X    The scjones.alt.c is similar to the original scjones.c source,
  1623. X    but with all the trigraphs converted.  You might want to try:
  1624. X
  1625. X        make -f common.mk scjones.alt.c
  1626. X
  1627. X    even if you only have an ANSI compiler, just to see how
  1628. X    the trigrapsh are converted.
  1629. X
  1630. XWARNING: In the future, we will be passing ANSI programs through a
  1631. X     trigraph filter before reading.  Trigraph-ifacation will
  1632. X     not be a major consideration in future contests.  People 
  1633. X     should exploit more interesting features of ANSI C.
  1634. X
  1635. X
  1636. XSelected notes from the author:
  1637. X
  1638. X    Since this year's contest is dedicated to ANSI C, here is a
  1639. X    strictly conforming entry.  In accordance with the ANSI
  1640. X    definition of a strictly conforming program it does not produce
  1641. X    output dependent on any unspecified, undefined, or implementation
  1642. X    defined behavior, and it does not exceed any of the minimum
  1643. X    implementation limits.  It adheres to all of the syntactic and
  1644. X    semantic constraints of the standard, #includes the relevant
  1645. X    headers for the functions it uses, and uses the EXIT_SUCCESS and
  1646. X    EXIT_FAILURE macros to return a correct success/fail status to
  1647. X    the invoking program.  It also uses trigraphs for characters
  1648. X    which are not in the Invariant Code Set of ISO 646:1983, so it
  1649. X    will be portable to machines with deficient (from C's standpoint)
  1650. X    character sets.  In short, it should be very widely portable.  As
  1651. X    an extra added attraction, all of the lines are under 72
  1652. X    characters long, which would allow for sequence numbers to be
  1653. X    punched in columns 73-80 :-).
  1654. X
  1655. X    [[ The Author sent us this note after he was informed that he won ]]
  1656. X
  1657. X    Although I am quite grateful for the "ANSI Committee's Worst Abuse
  1658. X    of C" title (were you aware that I am a member of the committee or
  1659. X    is the double meaning unintentional?), I was really hoping for
  1660. X    something more along the lines of "Closest Resemblance to Line Noise."  :-)
  1661. X
  1662. X    [[ ... it was unintentional ]]
  1663. //E*O*F scjones.hint//
  1664.  
  1665. echo x - stig.hint
  1666. sed -e 's/^X//' > "stig.hint" << '//E*O*F stig.hint//'
  1667. XStrangest Abuse of the Rules: <stig@solan.unit.no> Stig Hemmer
  1668. X
  1669. X    Stig Hemmer
  1670. X    Norwegian Institute of Technology
  1671. X    N-7034 Trondheim-NTH
  1672. X    Norway 
  1673. X
  1674. XJudges' comments:
  1675. X
  1676. X    We changed the alias that the author's suggested alias from a
  1677. X    C-shell alias to a Korn shell alias because many C-shells
  1678. X    did not allow Stig Hemmer's form of aliasing.  (The error 
  1679. X    may have also been due to some uucp site corrupting his 
  1680. X    entry) Below is the author's 'how to compile' sections as 
  1681. X    mailed to us:
  1682. X
  1683. X    ---how to ANSI compile---
  1684. X    Xecho alias c cc -E -o o.c shst.c -"\''Dc=main(){printf("\"N%sested E
  1685. X    Ccomments allowed.\\n\",'/*/*/0*/**/'1?\"\":\"o n\"");}'\'';cc -o c o.c'
  1686. X    Xsource shst.c"|csh
  1687. X    ---how to common compile---
  1688. X    Xecho alias c cc -E -o o.c shst.c -"\''Dc=main(){printf("\"N%sested E
  1689. X    Ccomments allowed.\\n\",'/*/*/0*/**/'1?\"\":\"o n\"");}'\'';cc -o c o.c'
  1690. X    Xsource shst.c"|csh
  1691. X
  1692. X    Note that shst.c is renamed to stig.c in the distribution.
  1693. X
  1694. X    Producing an equivalent C-shell alias or /bin/sh function
  1695. X    is left as an exercise to the reader.
  1696. X
  1697. XWARNING: This program's 'how to compile' is too specific to a particular
  1698. X     shell.  The obfuscation of this program to more related to
  1699. X     shell obfuscation than C obfuscation.  This type of entry will 
  1700. X     not be permitted in future contests.
  1701. X
  1702. XSelected notes from the author:
  1703. X
  1704. X    If you like shell programming you may also admire my
  1705. X    creative quoting. (I use echo to create an alias
  1706. X    which when run calls cc with the -D option to create a
  1707. X    C macro with double quotes in it. ARRRRRGGGHHH!)
  1708. X
  1709. X    The program is totally portable, but the compile
  1710. X    commands are very shell specific so don't be TOO mad
  1711. X    at me if they don't work for you.
  1712. X
  1713. X    If you want to put these commands in a Makefile you
  1714. X    must add 4 - four - backslashes at the end on first
  1715. X    line. (At least that's what works here.)
  1716. X
  1717. X    If everything works correctly it create an executable
  1718. X    named c which checks whether your compiler supports
  1719. X    nested comments. I've stolen the "/*/*/0*/**/1" from
  1720. X    somewhere so don't give me any points for it. Of
  1721. X    course neither ANSI nor K&R support nested comments
  1722. X    when properly implemented, but what the heck. 
  1723. //E*O*F stig.hint//
  1724.  
  1725. echo x - tbr.hint
  1726. sed -e 's/^X//' > "tbr.hint" << '//E*O*F tbr.hint//'
  1727. XBest Utility: <tbr@acm.princeton.edu, smd@att.research.com> Rakitzis & Dorward
  1728. X
  1729. X    Byron Rakitzis           Sean Dorward
  1730. X    Princeton University   Princeton University
  1731. X    5707 Old Lodge Dr.     10274 Burleigh Cottage Lane
  1732. X    Houston, TX 77066      Ellicott City, MD 21043
  1733. X    USA               USA
  1734. X
  1735. XJudges' comments:
  1736. X
  1737. X    This program implements a subject a well known Un*x utility whose 
  1738. X    original source was considered to be extremely obfuscated by many
  1739. X    people, excluding its author.  In fact, this utility one a major
  1740. X    inspiration for the formation of this contest.
  1741. X
  1742. X    The author supplied us with a slightly smaller unformatted version
  1743. X    of the program which we include below:
  1744. X
  1745. X    #define D ,close(
  1746. X    char*c,q[512],m[256],*v[99],**u,*i[3];int f[2],p;main(){for(m[m[60]=m[62]=
  1747. X    32]=m[*m=124[m]=9]=6;e(-8),gets(1+(c=q))||exit(0);r(0,0))for(;*++c;);}
  1748. X    r(t,o){*i=i[2]=0;for(u=v+98;m[*--c]^9;m[*c]&32?i[*c&2]=
  1749. X    *u,u-v^98&&++u:3)if(!m[*c]){for(*++c=0;!m[*--c];);*--u=
  1750. X    ++c;}u-v^98?strcmp(*u,"cd")?*c?pipe(f),o=f[1]:1,(p=fork())?e(p),o?
  1751. X    r(o,0)D o)D*f):4,wait(0):(o?dup2(*f,0)D*f)D o):*i?1 D
  1752. X    0),e(open(*i,0)):5,t?dup2(t,1)D t):i[2]?9 D
  1753. X    1),e(creat(i[2],438)):2,e(execvp(*u,u))):e(chdir(u[1])*2):6;}
  1754. X    e(x){x<0?write(2,"?\n$ "-x/4,2),x+1||exit(1):5;}
  1755. X    
  1756. XSelected notes from the author: (rot13 to read)
  1757. X
  1758. X    Guvf cebtenz vf n ehqvzragnel furyy. Vg qbrf v/b erqverpgvba, cvcrf
  1759. X    naq pq. Vg syntf reebef ba snvyrq puqve'f, bcra'f, perng'f
  1760. X    rkrpic'f, sbex'f naq n srj flagnk reebef.
  1761. X
  1762. X    Guvf cebtenz vf boshfpngrq va n srj abgnoyr jnlf: ncneg sebz gur
  1763. X    ynlbhg (na hasbeznggrq (ohg pehapurq) irefvba vf vapyhqrq sbe
  1764. X    crbcyr jub jnag gb chg guvf guebhtu po) vg znxrf pyrire hfr bs n
  1765. X    jevgr fgngrzrag, fb gung gur fnzr fgngrzrag pna or hfrq gb cevag
  1766. X    reebef naq gur cebzcg. Ol pnyyvat gur reebe shapgvba jvgu gur inyhr
  1767. X    -8, gur cbvagre bssfrg va gur rkcerffvba "?\a$ "-k/4 tbrf sebz 0 gb
  1768. X    2.  Cerfgb!  N cebzcg. Sbe reebef jvgu ahzoref fznyyre guna -4
  1769. X    (v.r., HAVK flfgrz pnyyf) n dhrfgvba znex vf cevagrq.
  1770. X
  1771. X    Gur reebe inyhr bs puqve vf qbhoyrq fb gung jr qba'g rkvg sebz gur
  1772. X    cnerag furyy ba n puqve reebe (fvapr r() rkvgf ba -1 reebef bayl).
  1773. X    Nyy bgure flfgrz pnyy snvyherf rkvg fvapr gurl ner sebz fhofuryyf.
  1774. X
  1775. X    Erphefvba vf farnxvyl rzcyblrq gb nibvq n frpbaq pnyy gb sbex(),
  1776. X    naq gur yvar vf cnefrq va n snveyl ovmneer snfuvba:  onpxjneqf. Gur
  1777. X    urneg bs gur cebtenz, gung vf, gur cneg juvpu cresbezf nyy sbexf,
  1778. X    rkrpf, bcraf, rgp. vf BAR P FGNGRZRAG.
  1779. X
  1780. X    Gur zrgn-inyhrf neenl vf vavgvnyvmrq va n ovmneer snfuvba, naq gur
  1781. X    fhofrdhrag purpxf sbe gur '<' naq '>' ner cresbezrq va n fvatyr
  1782. X    fgngrzrag hfvat n znfx, fvapr lbh xabj gung '>'&2 vf 0, jurernf
  1783. X    '<'&2 vf 2. Bgure fhpu zvpeb-boshfpngvbaf nobhaq.
  1784. X
  1785. X    Svanyyl, vg vf abgnoyr gung gur pbqr jnf unpxrq sbe zvavznyvgl. Vs
  1786. X    lbh ybbx ng gur pbzcerffrq irefvba, lbh jvyy or uneq-cerffrq gb
  1787. X    ryvzvangr zber guna n srj punenpgref (jr pna'g frr ubj gb znxr vg
  1788. X    nal fznyyre!).  550 punenpgref vf cerggl yrna sbe n furyy gung qbrf
  1789. X    guvf zhpu.
  1790. X
  1791. X    OHTF
  1792. X
  1793. X    Gur flagnk bs gur furyy unf abg orra shyyl rkcyberq, ohg vs lbh gel
  1794. X    gb erqverpg va gur fnzr qverpgvba zber guna bapr, bayl bar
  1795. X    erqverpgvba vf cresbezrq. Guvf vf n "srngher" bs gur jnl gur yvar
  1796. X    vf cnefrq; n cbvagre gb gur fgnpx bs nethzragf vf nffvtarq naq na
  1797. X    nethzrag vf fgbyra rirel gvzr n ">" be "<" vf rapbhagrerq.  Gur
  1798. X    furyy syntf na reebe vs ab nethzragf ner ba gur fgnpx. Guhf, sbe
  1799. X    rknzcyr:
  1800. X        png > sbb > one
  1801. X    pngf gb sbb, fvapr vg jnf chfurq ynfg, ohg
  1802. X        png > > sbb one
  1803. X    pngf gb one, fvapr one jnf chfurq haqre sbb. (erzrzore jr'er
  1804. X    cnefvat evtug-yrsg)
  1805. X
  1806. X    Qrcraqvat ba lbhe synibe bs HA*K, pq jvgubhg na nethzrag jvyy
  1807. X    rvgure cebqhpr na reebe be whfg qb abguvat.
  1808. X
  1809. X    Gurer vf whfg bar reebe zrffntr, gur dhrfgvba znex, ohg url, gung'f
  1810. X    nyy rq qbrf gbb.
  1811. //E*O*F tbr.hint//
  1812.  
  1813. echo x - theorem.hint
  1814. sed -e 's/^X//' > "theorem.hint" << '//E*O*F theorem.hint//'
  1815. XBest of Show: <theorem@blake.u.washington.edu> Adrian Mariano
  1816. X
  1817. X    Adrian Mariano
  1818. X    University of Washington
  1819. X    2729 72nd Ave SE
  1820. X    Mercer Island, WA 98040
  1821. X    USA
  1822. X
  1823. X
  1824. XJudges' comments:
  1825. X
  1826. X    The program's source implements four functions, all from the
  1827. X    same source file!
  1828. X
  1829. X    Usage:
  1830. X
  1831. X    theorem expression x1 x2 h y1
  1832. X
  1833. X    where:
  1834. X        expression - function f(x,y)  (see below)
  1835. X        x1 - start of interval
  1836. X        x2 - end of interval
  1837. X        h - step size
  1838. X        y1 - initial value  (y(x1) == y1)
  1839. X
  1840. X    When you compile theorem.c as is and run with 5 args, it numerically
  1841. X    solves the equation y'=f(x,y), with a step size of h, over the interval 
  1842. X    x=[x1,x2], with the initial condition of y(x1)=y1.
  1843. X
  1844. X    The 'expression' f(x,y), is any function of 'x' and 'y' with the
  1845. X    operators:
  1846. X    
  1847. X        +    -    *    /    ^
  1848. X
  1849. X    The symbol '^' is the power operator.  Note that it only supports
  1850. X    integer powers.  Also note that all expressions are evaluated strictly 
  1851. X    left to right.  (i.e., parenthesis aren't supported).
  1852. X
  1853. X    Try running the program with the following args:
  1854. X
  1855. X    theorem y 0 1 0.1 1
  1856. X    theorem 1/x 1 2 0.1 0
  1857. X    theorem 'x^2/y+x' 0 1 0.1 6
  1858. X    
  1859. X    But wait, there is more!  You also get, free of charge, a 
  1860. X    reversing filter!  Try:
  1861. X
  1862. X    theorem -r 0 0 0 0 < theorem.c > sorter.c
  1863. X    
  1864. X    Still not impressed?  The author throws in for free, a 
  1865. X    sort program! Try:
  1866. X
  1867. X    cc sorter.c -o sorter
  1868. X    ls | sorter
  1869. X    
  1870. X    This program is safe for home use as well.  The author has
  1871. X    included a safety feature in case you misplace the original
  1872. X    program source:
  1873. X
  1874. X    sorter -r 0 0 0 0 < sorter.c > theorem_bkp.c
  1875. X    
  1876. X    And finally, as a special offer to users of this entry,
  1877. X    the author provides a Fibonacci sequence generator!  Try:
  1878. X
  1879. X    sorter 0 0 0 0 < theorem.c > fibonacci.c
  1880. X    cc fibonacci.c -o fibonacci
  1881. X    fibonacci 1 1
  1882. X    fibonacci 2 1
  1883. X
  1884. X    Program available 9 track and cartridge cassette.  Gensu knife
  1885. X    not included!  :-)
  1886. X
  1887. X    When this program was first shown at the 1990 Summer Usenix 
  1888. X    conference, it received a standing ovation; a first for
  1889. X    a contest entry.
  1890. X
  1891. X    It should be noted that the 4 trailing args '0 0 0 0', are
  1892. X    required on systems that dump core when NULL is dereferenced.
  1893. X
  1894. X
  1895. XSelected notes from the author:
  1896. X
  1897. X    Differential equations are solved via the Runge-Kutta method, 
  1898. X    which guarantees local error proportional to h^5, and total
  1899. X    error across a finite interval is at most a constant times h^4.
  1900. X    
  1901. X    Sorting is accomplished with a standard shell sort.
  1902. X
  1903. X    Note that the sorting and reversing is limited to files with 
  1904. X    fewer than 500 lines, each less than 99 characters long.  
  1905. //E*O*F theorem.hint//
  1906.  
  1907. echo x - westley.hint
  1908. sed -e 's/^X//' > "westley.hint" << '//E*O*F westley.hint//'
  1909. XBest Layout: <...uunet!rosevax!jhereg!quest!digibd!merlyn> Merlyn LeRoy
  1910. X
  1911. X    Brian Westley (Merlyn LeRoy on usenet)
  1912. X    DigiBoard, Inc.
  1913. X    1026 Blair Ave.
  1914. X    St. Paul, MN  55104  
  1915. X    USA
  1916. X
  1917. XJudges' comments:
  1918. X
  1919. X    usage: westley <number>
  1920. X
  1921. X    If you would rather "Daisy" someone other than Westley, rename 
  1922. X    the program as needed.  :-)
  1923. X
  1924. X    Read each block of code as if it were a piece of correspondence.
  1925. X    For example, the first block of code would read:
  1926. X
  1927. X    charlie,
  1928. X        doubletime me, OXFACE!
  1929. X        not interested, get out
  1930. X        mainly die, charly, *die*
  1931. X            signed charlotte
  1932. X
  1933. X    The original source had control-L's after each code block.  To 
  1934. X    make it easier on news readers, we converted each control-L to 
  1935. X    a blank line.
  1936. X
  1937. X    Some ANSI compilers will not accept '1s' as a short integer - for
  1938. X    these compilers replace the '1s' with '1'.
  1939. X
  1940. X
  1941. XSelected notes from the author:
  1942. X
  1943. X    This is a "Picking the Daisy" simulation.  Now, instead of mangling a 
  1944. X    daisy, simply run this program with the number of petals desired as 
  1945. X    the argument.
  1946. X    
  1947. X    This is a good counter-example to peoples' complaints that C doesn't
  1948. X    have an "English-like" syntax.
  1949. X    
  1950. X    Lint complains about everything - null effect, xxx may be used before
  1951. X    set, statement not reached, return(e) and return.  Lint dumps core
  1952. X    on some systems.  My personal favorite lint complaint is
  1953. X    
  1954. X        "warning: eroticism unused in function main".
  1955. X    
  1956. X    Also obviously, (char)lotte and (char*)lie are incompatible types...
  1957. //E*O*F westley.hint//
  1958.  
  1959. echo x - LANDER.BAS
  1960. sed -e 's/^X//' > "LANDER.BAS" << '//E*O*F LANDER.BAS//'
  1961. X10 REM Lunar Lander
  1962. X20 REM By Diomidis Spinellis
  1963. X30 PRINT "You aboard the Lunar Lander about to leave the spacecraft."
  1964. X60 GOSUB 4000
  1965. X70 GOSUB 1000
  1966. X80 GOSUB 2000
  1967. X90 GOSUB 3000
  1968. X100 H = H - V
  1969. X110 V = ((V + G) * 10 - U * 2) / 10
  1970. X120 F = F - U
  1971. X130 IF H > 0 THEN 80
  1972. X135 H = 0
  1973. X140 GOSUB 2000
  1974. X150 IF V > 5 THEN 200
  1975. X160 PRINT "Congratulations!  This was a very good landing."
  1976. X170 GOSUB 5000
  1977. X180 GOTO 10
  1978. X200 PRINT "You have crashed."
  1979. X210 GOTO 170
  1980. X1000 REM Initialise
  1981. X1010 V = 70
  1982. X1020 F = 500
  1983. X1030 H = 1000
  1984. X1040 G = 2
  1985. X1050 RETURN
  1986. X2000 REM Print values
  1987. X2010 PRINT "        Meter readings"
  1988. X2015 PRINT "        --------------"
  1989. X2020 PRINT "Fuel (gal):"
  1990. X2030 PRINT F
  1991. X2040 GOSUB 2100 + 100 * (H <> 0)
  1992. X2050 PRINT V
  1993. X2060 PRINT "Height (m):"
  1994. X2070 PRINT H
  1995. X2080 RETURN
  1996. X2100 PRINT "Landing velocity (m/sec):"
  1997. X2110 RETURN
  1998. X2200 PRINT "Velocity (m/sec):"
  1999. X2210 RETURN
  2000. X3000 REM User input
  2001. X3005 IF F = 0 THEN 3070
  2002. X3010 PRINT "How much fuel will you use?"
  2003. X3020 INPUT U
  2004. X3025 IF U < 0 THEN 3090
  2005. X3030 IF U <= F THEN 3060
  2006. X3040 PRINT "Sorry, you have not got that much fuel!"
  2007. X3050 GOTO 3010
  2008. X3060 RETURN
  2009. X3070 U = 0
  2010. X3080 RETURN
  2011. X3090 PRINT "No cheating please!  Fuel must be >= 0."
  2012. X3100 GOTO 3010
  2013. X4000 REM Detachment
  2014. X4005 PRINT "Ready for detachment"
  2015. X4007 PRINT "-- COUNTDOWN --"
  2016. X4010 FOR I = 1 TO 11
  2017. X4020   PRINT 11 - I
  2018. X4025   GOSUB 4500
  2019. X4030 NEXT I
  2020. X4035 PRINT "You have left the spacecraft."
  2021. X4037 PRINT "Try to land with velocity less than 5 m/sec."
  2022. X4040 RETURN
  2023. X4500 REM Delay
  2024. X4510 FOR J = 1 TO 500
  2025. X4520 NEXT J
  2026. X4530 RETURN
  2027. X5000 PRINT "Do you want to play again? (0 = no, 1 = yes)"
  2028. X5010 INPUT Y
  2029. X5020 IF Y = 0 THEN 5040
  2030. X5030 RETURN
  2031. X5040 PRINT "Have a nice day."
  2032. //E*O*F LANDER.BAS//
  2033.  
  2034. echo x - stig.ksh
  2035. sed -e 's/^X//' > "stig.ksh" << '//E*O*F stig.ksh//'
  2036. Xalias c="cc -E stig.c -Dc='main(){printf(\"N%sested comments allowed.\\n"'",/*/
  2037. X*/0*/**/1?"":"o n"'");}'|grep -v '^#'>o.c;cc -o o o.c;o"
  2038. //E*O*F stig.ksh//
  2039.  
  2040. echo x - shark.sh
  2041. sed -e 's/^X//' > "shark.sh" << '//E*O*F shark.sh//'
  2042. Xfor i in "${@?${usage?$0 file...}}";do<"$i"||exit;done
  2043. X(cat&&tar cbf 1 - "$@"|compress|btoa&&echo w)<<\Z
  2044. X#!/bin/sh
  2045. X#
  2046. X# GENTLE READER -- write this message to file [no headers!]; run "sh file".
  2047. X#
  2048. X# [un]shark: By James A. Woods.
  2049. X# Seed planted by Karl Fox; code intensified by Paul Eggert.
  2050. X#
  2051. X# "Cleverly he dialed from within." -- D. Van Vliet, "Trout Mask Replica"
  2052. X#
  2053. XPATH=$PATH:. a=atob m=unshark z=zcat
  2054. Xr="rm -f $a $m* $z" v="cc -o $z $m.c"
  2055. Xtrap "$r;exit 1" 1 2 13 15
  2056. Xecho decoding...
  2057. X(:|compress|btoa|$a|$z)2>$m>&2||(sed '1,9s/./#define & /
  2058. Xs/@/[w]/g
  2059. Xs/C/char /g
  2060. Xs/I/;if(/g
  2061. Xs/W/;while(/g
  2062. Xs/Y/%lx /g
  2063. Xs/}/;}/g'>$m.c<<_&&
  2064. XFX,perror("$m bite: resend"),1;
  2065. XGgetC()
  2066. XH(w=g())
  2067. XK[69001]
  2068. XPputC
  2069. XQ256
  2070. XU*p
  2071. XXreturn 0
  2072. XZw=QWw--)t@=0
  2073. X#include<stdio.h>
  2074. Xlong M,N,c,f,m,o,r,s,w;y(l){o^=l;m+=l+1;f=f*2+l+(f>>31&1)}int
  2075. XO,S,e,i,k,n,q,t K;b(g){k=4Wg<k)y(P((C)(w>>--k*8)&255));w=0}CD K,h
  2076. XK;main(g,V)C**V;{I**V-97)X,a()WG-10)W(g=G)+1&&g-'x')if(g-10)
  2077. X{I4<k)b(0)Ig>32&g<'v')w=w*85+g-33,++k;else{Ig-'z'|k)F
  2078. Xw=0;k=5}}WG-78)Iscanf("%ldYEYSYRY",&M,&N,&c,&s,&r)-5)F
  2079. XIM){b(g=3-(M-1&3))Wg--)y(0)}I(M-N|c-o|s-m|r-f)&4294967295)F X}long
  2080. Xg(){CUIm<f&n<k&&(m=(1l<<++n)-1)||O>=S){O=0;S=fread(D,1,n,stdin)*8IS<8)X-1;
  2081. XS-=n-1}p=D+O/8;q=O&7;O+=n;X,(1<<8-q)-1&U>>q|m&((15<n+q)U[2]*Q|p[1]&255)<<8-q}
  2082. Xa(){CU=D+Q;G;G;k=G;e=k>>7&1;k&=31Ik>16)F
  2083. XZ,h@=w;n=8;f=Q+e;i=o=HIo<0)X,1;P(i)WH+1){Iw==Q&e){Z;m=n=8;f=QIH<0)X}
  2084. Xc=wIw>=f)U++=i,w=oWw>=Q)U++=h@,w=t@;P(i=h@)Wp>D+Q)P(*--p)
  2085. XI(w=f)<1l<<k)t@=o,h[f++]=i;o=c}X}
  2086. X_
  2087. X($v||$v -Mh)&&ln $z $a)&&$a<<\w>$m-&&$z<$m->$m&&tar xvf $m&&$r
  2088. XZ
  2089. //E*O*F shark.sh//
  2090.  
  2091. echo Possible errors detected by \'wc\' [hopefully none]:
  2092. temp=/tmp/shar$$
  2093. trap "rm -f $temp; exit" 0 1 2 3 15
  2094. cat > $temp <<\!!!
  2095.      27    220   1265 README
  2096.     218   1441   8876 rules
  2097.      60    231   1318 Makefile
  2098.      86    259   1710 ansi.mk
  2099.     104    340   2326 common.mk
  2100.       8      9    233 baruch.c
  2101.      33     62   1515 cmills.c
  2102.      24     70   1536 dds.c
  2103.      74    223   1531 dg.c
  2104.      22     65    999 jaw.c
  2105.      14     37    879 pjr.c
  2106.      46     66   1474 scjones.c
  2107.       1      1      2 stig.c
  2108.      23     80    886 tbr.c
  2109.      93    133   1511 theorem.c
  2110.     107    208   1529 westley.c
  2111.      68    297   1908 baruch.hint
  2112.      39    161   1054 cmills.hint
  2113.      94    360   2315 dds.hint
  2114.      51    246   1726 dg.hint
  2115.     214   1011   7401 jaw.hint
  2116.      60    220   1479 pjr.hint
  2117.      59    382   2466 scjones.hint
  2118.      56    330   2213 stig.hint
  2119.      84    553   3890 tbr.hint
  2120.      90    414   2585 theorem.hint
  2121.      48    212   1489 westley.hint
  2122.      71    346   1624 LANDER.BAS
  2123.       2     14    137 stig.ksh
  2124.      47    131   1522 shark.sh
  2125.    1923   8122  59399 total
  2126. !!!
  2127. wc README rules Makefile ansi.mk common.mk baruch.c cmills.c dds.c dg.c jaw.c \
  2128.   pjr.c scjones.c stig.c tbr.c theorem.c westley.c baruch.hint cmills.hint \
  2129.   dds.hint dg.hint jaw.hint pjr.hint scjones.hint stig.hint tbr.hint \
  2130.   theorem.hint westley.hint LANDER.BAS stig.ksh shark.sh | \
  2131.   sed 's=[^ ]*/==' | diff -b $temp -
  2132. echo unpack long lines in baruch.c
  2133. ed baruch.c << '//long baruch.c//'
  2134. 4,6j
  2135. w
  2136. q
  2137. //long baruch.c//
  2138. echo unpack long lines in cmills.c
  2139. ed cmills.c << '//long cmills.c//'
  2140. 9,12j
  2141. w
  2142. q
  2143. //long cmills.c//
  2144. echo unpack long lines in dg.c
  2145. ed dg.c << '//long dg.c//'
  2146. 73,74j
  2147. 71,72j
  2148. 69,70j
  2149. 66,68j
  2150. w
  2151. q
  2152. //long dg.c//
  2153. echo unpack long lines in stig.ksh
  2154. ed stig.ksh << '//long stig.ksh//'
  2155. 1,2j
  2156. w
  2157. q
  2158. //long stig.ksh//
  2159. exit 0
  2160.