home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume32 / iocc1992 / part02 < prev    next >
Encoding:
Text File  |  1992-09-10  |  54.4 KB  |  1,472 lines

  1. Newsgroups: comp.sources.misc
  2. From: chongo@toad.com (Landon Curt Noll)
  3. Subject:  v32i029:  ioccc.1992 - 1992 International Obfuscated C Code Contest winners, Part02/05
  4. Message-ID: <1992Sep10.154310.27096@sparky.imd.sterling.com>
  5. X-Md4-Signature: b08cc8eace3e6682a3ae4932cae42c5d
  6. Date: Thu, 10 Sep 1992 15:43:10 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: chongo@toad.com (Landon Curt Noll)
  10. Posting-number: Volume 32, Issue 29
  11. Archive-name: ioccc.1992/part02
  12. Environment: C
  13.  
  14. #! /bin/sh
  15. # This is a shell archive.  Remove anything before this line, then feed it
  16. # into a shell via "sh file" or similar.  To overwrite existing files,
  17. # type "sh file -c".
  18. # Contents:  1992/Makefile 1992/ant.README 1992/buzzard.1.hint
  19. #   1992/buzzard.2.hint 1992/demo1.1st 1992/gson.hint 1992/rules
  20. # Wrapped by kent@sparky on Thu Sep 10 10:21:20 1992
  21. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
  22. echo If this archive is complete, you will see the following message:
  23. echo '          "shar: End of archive 2 (of 5)."'
  24. if test -f '1992/Makefile' -a "${1}" != "-c" ; then 
  25.   echo shar: Will not clobber existing file \"'1992/Makefile'\"
  26. else
  27.   echo shar: Extracting \"'1992/Makefile'\" \(5632 characters\)
  28.   sed "s/^X//" >'1992/Makefile' <<'END_OF_FILE'
  29. X# %W% %G% %U%
  30. X#
  31. X# 1992 makefile
  32. X
  33. XSHELL=/bin/sh
  34. XCHMOD=chmod
  35. XCP=cp
  36. XRM=rm
  37. XSED=sed
  38. XLN=ln
  39. XUNIQ=uniq
  40. XCB=cb 
  41. XGREP=grep
  42. X# set this to where your C Processor resides
  43. X#
  44. X# On some systems:
  45. X#    CPP=/lib/cpp
  46. X#
  47. XCPP=/usr/ccs/lib/acpp
  48. X
  49. X# flags for ansi compiles
  50. X#
  51. X# NOTE: Some ANSI compilers make use of -Xa to turn on ANSI mode,
  52. X#    others such as gcc may want -ansi, others may want nothing
  53. X#    at all.  Adjust the CFLAGS line as needed.
  54. X#
  55. X# NOTE: Some compilers cannot optimize, or optimize some entries
  56. X#    entries incorrectly.  You might want need to turn on -O 
  57. X#    to see if your compiler can handle them.
  58. X#
  59. X#CFLAGS=-O -Xa
  60. XCFLAGS=-Xa
  61. XCC=cc
  62. X
  63. X# misc shell babble
  64. X#
  65. XNOINCLUDE=$(SED) -e 's/^.\([     ]*\)include/%include/'
  66. XSPACECLEAN=$(SED) -e 's/\([^     ]\)\([     ]\)[     ][     ]*/\1\2/g'
  67. XCPPCLEAN=$(GREP) -v '^. [0-9][0-9]*'
  68. X
  69. X# winners that compile under ANSI C
  70. X#
  71. XWINNERS= adrian albert ant buzzard.1 buzzard.2 gson kivinen imc \
  72. X    lush marangon nathan vern westley
  73. XALT_NAMES= adgrep am babble first ag whereami
  74. X
  75. Xall: $(WINNERS) $(ALT_NAMES)
  76. X
  77. Xadrian: adrian.c
  78. X    $(CC) $(CFLAGS) adrian.c -o adrian
  79. X    $(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c
  80. X    $(SED) '1s/\..*\./. wc ./' adrian.c > ad.temp
  81. X    -./adrian ad.temp <ad.temp >adwc.c
  82. X    $(CC) -o adwc adwc.c
  83. X    $(SED) '1s/\..*\./. basename ./' adrian.c > ad.temp
  84. X    -./adrian ad.temp <ad.temp >adbasename.c
  85. X    $(CC) -o adbasename adbasename.c
  86. X    $(SED) '1s/\..*\./. echo| ./' adrian.c > ad.temp
  87. X    -./adrian ad.temp <ad.temp >adecho.c
  88. X    $(CC) -o adecho adecho.c
  89. X    $(SED) '1s/\..*\./. head; ./' adrian.c > ad.temp
  90. X    -./adrian ad.temp <ad.temp >adhead.c
  91. X    $(CC) -o adhead adhead.c
  92. X    $(SED) '1s/\..*\./. sleep ./' adrian.c > ad.temp
  93. X    -./adrian ad.temp <ad.temp >adsleep.c
  94. X    $(CC) -o adsleep adsleep.c
  95. X    $(RM) -f ad.temp
  96. X
  97. X# NOTE: this is the original source that won
  98. X#
  99. Xadrian.orig: adrian.orig.c
  100. X    $(CC) $(CFLAGS) adrian.orig.c -o adrian.orig
  101. X
  102. Xalbert: albert.c
  103. X    $(CC) $(CFLAGS) albert.c -o albert
  104. X
  105. X# NOTE: this is the original source that won
  106. X#
  107. Xalbert.orig: albert.orig.c
  108. X    $(CC) $(CFLAGS) albert.orig.c -o albert.orig
  109. X
  110. Xant: ant.c
  111. X    $(CC) $(CFLAGS) ant.c -o ant
  112. X
  113. Xbuzzard.1: buzzard.1.c
  114. X    $(CC) $(CFLAGS) buzzard.1.c -o buzzard.1
  115. X
  116. Xbabble.cppcb: buzzard.1.c
  117. X    $(NOINCLUDE) buzzard.1.c | \
  118. X        $(CPP) $(CPPFLAGS) | \
  119. X        $(CPPCLEAN) | \
  120. X        $(CB) $(CBFLAGS) | \
  121. X        $(UNIQ) | \
  122. X        $(SPACECLEAN) > babble.cppcb 2>&1
  123. X
  124. Xbuzzard.2: buzzard.2.c
  125. X    $(CC) $(CFLAGS) buzzard.2.c -o buzzard.2
  126. X
  127. X# NOTE: this is the original source that won
  128. X#
  129. Xbuzzard.2.orig: buzzard.2.orig.c
  130. X    $(CC) $(CFLAGS) buzzard.2.orig.c -o buzzard.2.orig
  131. X
  132. Xgson: gson.c
  133. X    $(CC) $(CFLAGS) gson.c -o gson
  134. X
  135. X# NOTE: some systems may only need:
  136. X#
  137. X#  $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11
  138. X#
  139. Xkivinen: kivinen.c
  140. X    $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11 -lsocket -lresolv -lnsl
  141. X
  142. X# NOTE: this is the original program that won
  143. X#
  144. X# NOTE: some systems may only need:
  145. X#
  146. X#  $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11
  147. X#
  148. Xkivinen.orig: kivinen.orig.c
  149. X    $(CC) $(CFLAGS) kivinen.orig.c -o kivinen.orig -lX11 \
  150. X        -lsocket -lresolv -lnsl
  151. X
  152. Ximc: imc.c
  153. X    $(CC) $(CFLAGS) imc.c -o imc
  154. X
  155. X# NOTE: this is the original program that won
  156. X#
  157. Ximc.orig: imc.orig.c
  158. X    $(CC) $(CFLAGS) imc.orig.c -o imc.orig
  159. X
  160. Xlush: lush.c
  161. X    $(CC) $(CFLAGS) lush.c -o lush
  162. X
  163. Xlush.again: lush.c
  164. X    $(CC) $(CFLAGS) lush.c -o lush.again
  165. X    $(RM) -f lush.again
  166. X
  167. X# NOTE: this is the original program that won
  168. X#
  169. Xlush.orig: lush.orig.c
  170. X    $(CC) $(CFLAGS) lush.orig.c -o lush.orig
  171. X
  172. X# NOTE: some systems may need:
  173. X#
  174. X#  $(CC) $(CFLAGS) marangon.c -o marangon -lcurses -ltermcap
  175. X#
  176. Xmarangon: marangon.c
  177. X    $(CC) $(CFLAGS) marangon.c -o marangon -lcurses
  178. X
  179. X# NOTE: this is the original program that won
  180. X#
  181. X# NOTE: some systems may need:
  182. X#
  183. X#  $(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses -ltermcap
  184. X#
  185. Xmarangon.orig: marangon.orig.c
  186. X    $(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses
  187. X
  188. Xnathan: nathan.c
  189. X    $(CC) $(CFLAGS) nathan.c -o nathan
  190. X
  191. X# NOTE: this is the original program that won
  192. X#
  193. Xnathan.orig: nathan.orig.c
  194. X    $(CC) $(CFLAGS) nathan.orig.c -o nathan.orig
  195. X
  196. Xvern: vern.tmp.c
  197. X    $(CC) $(CFLAGS) vern.tmp.c -o vern
  198. X
  199. Xvern.tmp.c: vern.c
  200. X    $(RM) -f vern.tmp.c
  201. X    $(SED) <vern.c 's/{ /(/g;s/} /)/g;s/;    /#define /' | \
  202. X        $(SED) 's/}    /=/g;s/{    /i/g' >vern.tmp.c
  203. X
  204. X# NOTE: this is the original program that won
  205. X#
  206. Xvern.orig: vern.orig.tmp.c
  207. X    $(CC) $(CFLAGS) vern.orig.tmp.c -o vern.orig
  208. X
  209. Xvern.orig.tmp.c: vern.orig.c
  210. X    $(RM) -f vern.orig.tmp.c
  211. X    $(SED) <vern.orig.c 's/{ /(/g;s/} /)/g;s/;    /#define /' | \
  212. X        $(SED) 's/}    /=/g;s/{    /i/g' >vern.orig.tmp.c
  213. X
  214. Xwestley: westley.c
  215. X    $(CC) $(CFLAGS) westley.c -o westley
  216. X
  217. X# alternate names for selected entries
  218. X#
  219. Xadgrep: adrian
  220. X    $(RM) -f adgrep
  221. X    $(LN) adrian adgrep
  222. Xam: ant
  223. X    $(RM) -f am
  224. X    $(LN) ant am
  225. Xbabble: buzzard.1
  226. X    $(RM) -f babble
  227. X    $(LN) buzzard.1 babble
  228. Xfirst: buzzard.2
  229. X    $(RM) -f first
  230. X    $(LN) buzzard.2 first
  231. Xag: gson
  232. X    $(RM) -f ag
  233. X    $(LN) gson ag
  234. Xwhereami: westley
  235. X    $(RM) -f whereami
  236. X    $(LN) westley whereami
  237. X
  238. Xclean:
  239. X    $(RM) -f *.o a.out core 
  240. X    $(RM) -f vern.tmp.c lush.again babble.cppcb vern.orig.tmp.c
  241. X    $(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c
  242. X
  243. Xclobber: clean
  244. X    $(RM) -f $(WINNERS) a.out
  245. X    $(RM) -f $(ALT_NAMES)
  246. X    $(RM) -f adwc adbasename adecho adhead adsleep
  247. X    $(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig
  248. X    $(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig
  249. X
  250. Xam_clobber: clean am
  251. X    $(RM) -f am.safe
  252. X    $(CP) am am.safe
  253. X    $(RM) -f $(WINNERS) a.out
  254. X    $(RM) -f $(ALT_NAMES)
  255. X    $(RM) -f adwc adbasename adecho adhead adsleep
  256. X    $(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig
  257. X    $(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig
  258. X    $(CP) am.safe am
  259. X    $(RM) -f am.safe
  260. X
  261. Xnuke: clobber
  262. X    @true
  263. X
  264. Xinstall: all
  265. X    cat $(WINNERS) > /dev/null
  266. END_OF_FILE
  267.   if test 5632 -ne `wc -c <'1992/Makefile'`; then
  268.     echo shar: \"'1992/Makefile'\" unpacked with wrong size!
  269.   fi
  270.   # end of '1992/Makefile'
  271. fi
  272. if test -f '1992/ant.README' -a "${1}" != "-c" ; then 
  273.   echo shar: Will not clobber existing file \"'1992/ant.README'\"
  274. else
  275.   echo shar: Extracting \"'1992/ant.README'\" \(8745 characters\)
  276.   sed "s/^X//" >'1992/ant.README' <<'END_OF_FILE'
  277. XNAME
  278. X
  279. X    am        Anthony's Make 
  280. X
  281. X
  282. XSYNOPSIS
  283. X
  284. X    am <makefile> [target]
  285. X
  286. X
  287. XDESCRIPTION
  288. X
  289. XAM is a programmer's tool to maintain, update, and regenerate groups
  290. Xof files and/or programs.  It is similar to MAKE as described by the
  291. XPOSIX.2 draft standard 11.2, and this document parallels the draft
  292. Xin order to point out the subtle differences between AM and MAKE.
  293. X
  294. XThe AM utility can be used as part of software development to update
  295. Xfiles that are derived from other files.  A typical case is one where
  296. Xobject files are derived from the corresponding source files.  The AM
  297. Xutility examines time relationships and updates those derived files
  298. X(targets) that have modified times earlier than the modified times of
  299. Xthe files (prerequisites) from which they are derived.  A description 
  300. Xfile ("makefile") contains a description of the relationships between 
  301. Xfiles, and the commands that must be executed to update the targets to
  302. Xreflect changes in their prerequisites.  Each specification, or rule, 
  303. Xshall consist of a target, optional prerequisites, and optional 
  304. Xcommands to be executed when a prerequisite is newer than the target.
  305. X
  306. X
  307. XOPTIONS
  308. X
  309. XNone.
  310. X
  311. X
  312. XOPERANDS
  313. X
  314. Xmakefile    This required argument, is a pathname of a description
  315. X        file, which is also referred to as the "makfile".  A
  316. X        pathname of "-", shall *NOT* denote the standard input.
  317. X
  318. Xtarget        This optional argument, is the first target to be 
  319. X        processed.  If no target is specified, when AM is
  320. X        processing the makefile, the first target that AM
  321. X        encounters shall be used.
  322. X
  323. X
  324. XEXTERNAL INFLUENCES
  325. X
  326. XSTANDARD INPUT
  327. X
  328. XNot used.
  329. X
  330. X
  331. XINPUT FILES
  332. X
  333. XThe input file, otherwise known as the makefile, is a text file
  334. Xcontaining rules, macro definitions, and comments.
  335. X
  336. X
  337. XASYNCHRONOUS EVENTS
  338. X
  339. XAll traps are left to their default actions.  If AM receives a SIGHUP,
  340. XSIGTERM, SIGINT, or SIGQUIT then AM will terminate as per request
  341. X*WITHOUT* removing the current target.
  342. X
  343. X
  344. XEXTERNAL EFFECTS
  345. X
  346. XSTANDARD OUTPUT
  347. X
  348. XThe AM utility shall write all commands to be executed to standard
  349. Xoutput unless the command is prefixed with an at-sign (@).  If AM is
  350. Xinvoked without any work needing to be done, it shall *NOT* write a
  351. Xmessage to standard output indicating that no action was taken. 
  352. X
  353. X
  354. XSTANDARD ERROR
  355. X
  356. XStandard error is used for diagnostic messages only.
  357. X
  358. X
  359. XOUTPUT FILES
  360. X
  361. XNone.  However, the utilities invoked by AM may create additional files.
  362. X
  363. X
  364. XEXTENDED DESCRIPTION
  365. X
  366. XThe AM utility attempts to perform the actions required to ensure
  367. Xthat the specified target(s) are up-to-date.  A target is considered
  368. Xout-of-date if it is older than any of its prerequisites or it does
  369. Xnot exist.  The AM utility shall treat all prerequisites as targets
  370. Xthemselves and recursively ensure that they are up-to-date, processing
  371. Xthem in the order which they appear in the rule.  The AM utility shall
  372. Xuse the modification times of files to determine if the corresponding
  373. Xtargets are out-of-date.
  374. X
  375. XAfter AM has ensured that all of the prerequisites of a target are
  376. Xup-to-date, and if the target is out-of-date, the commands associated
  377. Xwith the target entry shall be executed.  If there are no commands
  378. Xlisted for the target, the target shall be treated as up-to-date.
  379. X
  380. X
  381. XMAKEFILE SYNTAX
  382. X
  383. XA makefile can contain rules, macro definitions, and comments.  If a
  384. Xmacro is defined more than once, the value of the macro shall be the
  385. Xlast one specified.  Comments start with a number-sign (#) and
  386. Xcontinue until an unescaped <newline> is reached.
  387. X
  388. XA backslash before a <newline> serves as a line continuation mark, and 
  389. Xis used to create long-lines.   A line will continue to be extended until 
  390. Xan unescaped <newline> is reached.
  391. X
  392. XWhen an escaped <newline> (one preceded by a backslash) is found anywhere
  393. Xin the makefile, it shall be replaced, along with any leading white 
  394. Xspace on the following line, with a single <space>.  
  395. X
  396. X
  397. XMAKEFILE EXECUTION
  398. X
  399. XCommand lines shall be processed one at a time by writing the command
  400. Xline to standard output, unless prefixed with an at-sign (@), and
  401. Xexecuting the command(s) in the line.  Commands shall be executed by
  402. Xpassing the command line to the command interpreter via the system()
  403. Xfunction.
  404. X
  405. XThe environment for the command being executed shall contain all of the
  406. Xvariables in the environment of AM.  All macros are considered to be part 
  407. Xof the environment too.
  408. X
  409. XBy default, when AM receives a non-zero status from the execution of a
  410. Xcommand, it terminates with an error message to standard error.  If
  411. Xthe command is prefixed by a hyphen (-) then any error found while
  412. Xexecuting the command shall be ignored.
  413. X
  414. XCommand lines can have one or more of the following prefixes: a hyphen
  415. X(-) to ignore errors, an at-sign (@) to be silent, or a plus-sign (+)
  416. Xif the command is always executed (this prefix is for compatibility with
  417. XMAKE and is ignored).
  418. X
  419. X
  420. XTARGET RULES
  421. X
  422. XTarget rules are formatted as follows:
  423. X
  424. X    target [target ...] : [prerequisite ...]
  425. X    [<tab>command
  426. X     <tab>command
  427. X     ...]
  428. X
  429. X    (line that does not begin with <tab>)
  430. X
  431. XTarget entries are specified by a <blank>-separated, non-null list of
  432. Xtargets, then a colon, then a <blank>-separated, possibly empty list
  433. Xof prerequisite.  All following lines, if any, that begin with a <tab>,
  434. Xare command lines to be executed to update the target(s).  The first
  435. Xline that does not begin with a <tab> shall begin a new entry.
  436. X
  437. XTarget names can be any character supported by the host system,
  438. Xexcluding <blank>s, <tab>s, <newline>s, and colons (:), which are used 
  439. Xfor delimiters.
  440. X
  441. XFor any given target there can be only one target rule.  The first
  442. Xoccurrence of a target in a makefile shall be used.  All subsequent
  443. Xrules for the same target are ignored.  There is *no* support for 
  444. Xadding prerequisites to a target's prerequisite list once a target
  445. Xrule is defined.
  446. X
  447. XThere are no special targets or inference rule support.  
  448. X
  449. X
  450. XMACROS
  451. X
  452. XMacro definitions are in the form:
  453. X
  454. X    string1 = [string2]
  455. X
  456. XThe macro named string1 is defined as having the value of string2,
  457. Xwhere string2 is defined as all characters, if any, after the equal
  458. Xsign up to an unescaped <newline>.  Any <blank>s immediately before or
  459. Xafter the equal sign shall be ignored.
  460. X
  461. XSubsequent appearances of $(string1) shall be replaced by string2.
  462. XThe parentheses are *NOT* optional if string1 is a single character.
  463. XThe macro $$ shall be replaced by the single character $.  
  464. X
  465. XMacro names can be any character that the host system would allow in 
  466. Xthe definition of environment variables, excluding parentheses, ( and ), 
  467. Xwhich are used for delimiters.
  468. X
  469. XMacros can appear anywhere in the makefile, except within other macro 
  470. Xreferences (ie. no nesting).  Macros in target and command lines shall 
  471. Xbe evaluated when the line is read.  Macros in macro definition lines 
  472. Xshall be evaluated *IMMEDIATELY*.  A macro that has not been defined 
  473. Xshall evaluate to a null string without causing any error condition.  
  474. X
  475. XIf a macro is defined more than once, the value of the macro shall be the 
  476. Xlast one specified prior to it being referenced.
  477. X
  478. XMacro assignments shall be accepted from the sources listed below, in 
  479. Xthe order shown.  If a macro name already exists at the time it is being
  480. Xprocessed, the newer definition shall replace the existing definition.
  481. X
  482. X   1)    The contents of the environment, including the variables with
  483. X    null values in the order defined in the environment.
  484. X
  485. X   2)    Macros defined in the makefile, processed in the order specified.
  486. X
  487. XThere are no internal macros supported.  The SHELL macro shall *NOT* be
  488. Xtreated specially.
  489. X
  490. X
  491. XEXIT STATUS
  492. X
  493. X  0    Successful completion.
  494. X  1    General error.
  495. X  2    Usage error.
  496. X  3    Failed to open makefile.
  497. X  4    Failed to allocate memory.
  498. X
  499. X
  500. XINSTALLATION
  501. X
  502. XAM can be built on any system providing at least K&R C.  It has been 
  503. Xtested on 
  504. X
  505. X    o  SunOS with GCC
  506. X    o  ATARI Mega ST with Sozobon C
  507. X    o  PC clone with Turbo C
  508. X    o  Interactive UNIX System V/386 release 3.2
  509. X
  510. XFor all machines, the compile command line should be
  511. X
  512. X    cc -O -o am am.c
  513. X
  514. XThe value RULES represents the number of slots available to record
  515. Xtarget rules, dependencies, and commands.  The default value chosen
  516. Xshould handle most project makefiles.  RULES can be overridden on the
  517. Xcommand line with -DRULES=nn, where 0 < nn < INT_MAX.
  518. X
  519. XOn a DOS machine using Turbo C, it may be necessary to add the include
  520. Xdirective
  521. X
  522. X    #include <time.h>
  523. X
  524. Xwith the rest of the includes if sys/stat.h does not properly define or
  525. Xuse time_t.  Also, on some older K&R C compilers, stdlib.h may not be 
  526. Xdefined and so it might be necessary to remove the include directive for 
  527. Xit. 
  528. X
  529. X
  530. XREFERENCES
  531. X
  532. X[Mil87]    Webb Miller, "A Software Tools Sampler", Prentice Hall, 87
  533. X    ISBN 0-13-822305-X, chaper 2
  534. X
  535. X[POSIX]    POSIX.2 draft 11.2 MAKE
  536. X
  537. X
  538. XFILES
  539. X
  540. Xant.c        Obfuscated source
  541. Xant.README    Manual for AM
  542. Xant.test.mk    Test makefile
  543. X
  544. X
  545. XBUGS
  546. X
  547. XUnknown as of 20 March 92.
  548. END_OF_FILE
  549.   if test 8745 -ne `wc -c <'1992/ant.README'`; then
  550.     echo shar: \"'1992/ant.README'\" unpacked with wrong size!
  551.   fi
  552.   # end of '1992/ant.README'
  553. fi
  554. if test -f '1992/buzzard.1.hint' -a "${1}" != "-c" ; then 
  555.   echo shar: Will not clobber existing file \"'1992/buzzard.1.hint'\"
  556. else
  557.   echo shar: Extracting \"'1992/buzzard.1.hint'\" \(8217 characters\)
  558.   sed "s/^X//" >'1992/buzzard.1.hint' <<'END_OF_FILE'
  559. XMost Obfuscated Algorithm: <sean@stat.tamu.edu> Sean Barrett
  560. X
  561. X    Sean Barrett
  562. X    Software Construction Company
  563. X    430 Southwest Parkway, #1906
  564. X    College Station, TX 77840
  565. X    USA
  566. X
  567. X    Direct bounced email to <jon@stat.tamu.edu>.
  568. X
  569. XJudges' comments:
  570. X
  571. X    To see clearly why this won an award:
  572. X    make babble
  573. X    
  574. X    Try:
  575. X    babble 0 10
  576. X    babble 56 720
  577. X    babble 1 521
  578. X    
  579. X    To see good C Preprocessor babble, try:
  580. X    make babble.cppcb
  581. X    cat babble.cppcb
  582. X    
  583. X    Notice how many statements it takes to do anything useful?
  584. X
  585. X
  586. XSelected notes from the author:
  587. X
  588. X    What you shouldn't think about babble:
  589. X
  590. X      babble doesn't just do a mass of #defines as its obfuscation.
  591. X
  592. X
  593. X    What you should be glad about:
  594. X
  595. X      I didn't just submit the post-C-preprocessed output as an entry.
  596. X
  597. X
  598. X    Cute trick warning:
  599. X
  600. X      babble contains only a numeric printf, yet sometimes it prints out
  601. X      short strings.
  602. X
  603. X
  604. X    What it does:
  605. X
  606. X      babble is a simple mathematical program. It expects two numeric
  607. X      arguments.
  608. X
  609. X      % babble 0 <num>
  610. X      will print out the factorial of <num>.
  611. X
  612. X      % babble <num1> <num2>
  613. X      will print out the largest common factor of num1 and num2.
  614. X
  615. X      % babble 1 <num2>
  616. X      will print out a factor of num2 if it's composite, or else
  617. X      it will print a string informing you that num2 is prime.
  618. X
  619. X      If the first argument is less than 0, it prints out an
  620. X      error message.
  621. X
  622. X
  623. X    What it is:
  624. X
  625. X      babble is a translator from a pseudo-assembly language into a
  626. X      subset of C suitable for execution on Charles Babbage's
  627. X      Analytical Engine.  Or rather, the #defines in babble are that
  628. X      translator.  The rest of babble is a babble program.  If you run the
  629. X      whole mess through CPP and a beautifier, you will see that
  630. X      all you have is a loop that runs until a variable is not 0, and
  631. X      a sequence of assignment statements.  The assignment statements
  632. X      are all of the form 'a op= b' or 'a = b'.  The Engine actually
  633. X      allowed 'a = b op c'.  Only +, -, /, and * are used--no boolean
  634. X      or bitwise operators.  The infinite loop could have been
  635. X      simulated on the AE by connecting the already-processed 
  636. X      card stack to the input card stack.
  637. X
  638. X
  639. X    How to try to understand it:
  640. X
  641. X      *Don't* expand the #defines!  Rather, decipher what they do.
  642. X      Some of them are mere obfuscational fodder, put in to encourage
  643. X      you to run it through CPP.
  644. X
  645. X
  646. X    What it doesn't quite do right as an emulator:
  647. X
  648. X      Because of the definitional constraints, calls to atoi(argv[#])
  649. X      also appear inside the loop.  These could be put outside--
  650. X      the initial values of the "registers" on the AE--but the
  651. X      macro conventions being used didn't lend themselves to it.
  652. X
  653. X
  654. X    Theoretical observations:
  655. X
  656. X      The simulated comparison operations only work with a certain
  657. X      range of numbers; numbers that are too large will cause the
  658. X      output code to fail to simulate the input code.  This means
  659. X      that this implementation of babble would not be turing-complete,
  660. X      even if the AE could process indefinitely-sized numbers.
  661. X      However, this is actually a constraint that no actual computer
  662. X      can meet, either, so we can conclude that if an AE, with
  663. X      card bins connected as suggested above, were hooked up to
  664. X      a memory unit of sufficient size, it would be as turing
  665. X      complete as any existing machine (or, for those who
  666. X      interpret that excessively critically, i.e. "not at all" for
  667. X      both, we can simply say that the AE could simulate any
  668. X      existing machine--although not quickly).  This would be a
  669. X      good place to site some references on the AE, but I don't
  670. X      have any.
  671. X
  672. X
  673. X    Definition of the input language to babble:
  674. X    (OR What Exactly Do All The Macros Do?)
  675. X
  676. X    [Don't read this unless you're stumped!]
  677. X
  678. X
  679. X      MACRO        FUNCTION                MNEMONIC
  680. X        V               begin variable declarations        Variable
  681. X        C               begin program                Code
  682. X
  683. X        Q(b,a)          let b = a                eQuals
  684. X        A(c,a,b)        let c = a + b                Add
  685. X        S(c,a,b)        let c = a - b                Subtract
  686. X        D(c,a,b)        let c = a / b, where b is a *constant*  Divide
  687. X        U(c,a,b)        let c = a / b, where b is anything      Unknown
  688. X        M(c,a,b)        let c = a * b                Multiply
  689. X
  690. X        O(c,a,b)        let c = a boolean-or b (a,b are 0 or 1) Or
  691. X        B(b, a)         let b = boolean value of a        Boolean
  692. X        P(b, a)         let b = 1 if a>0, else 0.        Positive
  693. X
  694. X        l               emit next sequential label        Label
  695. X        J(x)            goto label #x                Jump
  696. X
  697. X        Z(a,d)          if a is 0 goto d    (a is 0 or 1)    Zero
  698. X        E(a,d)          if a is 1 goto d    (a is 0 or 1)    Else
  699. X
  700. X        H               halt                    Haly
  701. X
  702. X        K(x)            let x = number of cmd line arguments    Kount
  703. X        G(x,y)          let x = the value if the yth argument   Get argument
  704. X
  705. X        T               end of code; begin output section    Terminate
  706. X        X(y)            print out hexadecimal value of y    heXadecimal
  707. X        T               end of output section and program    Terminate
  708. X
  709. X        You can figure out the other macros yourself.  In the sample
  710. X        program, I've actually implemented subroutines by saving
  711. X        a return address in a variable and then jumping to a routine--
  712. X        specifically, a routine that converts a number into bcd, so
  713. X        it can be output by the hexadecimal output statement.
  714. X
  715. X
  716. X    How it works, i.e., how to get useful programs from a op= b
  717. X
  718. X      The essential statement to be able to do to do interesting
  719. X      programs is the conditional (given that we have loops).
  720. X      Since all you can do in the given operation output set is
  721. X      assignment, we implement "conditional assignment":
  722. X
  723. X        if (x) y = z;
  724. X
  725. X      To implement this, we constrain x to be either 0 or 1, and
  726. X      simply compute:
  727. X
  728. X        y = (z * x) + (y * (1-x));
  729. X
  730. X      This is more obscured by factoring out common terms and restricting
  731. X      ourselves to two operand operations:
  732. X
  733. X        temp = z;                       (temp == z)
  734. X        temp -= y;                      (temp == z-y)
  735. X        temp *= x;                      (temp == (z-y)*x)
  736. X        y += temp;                      (y    == (z-y)*x + y)
  737. X                                        (     == z*x - y*x + y)
  738. X                                        (     == z*x + y*(1-x))
  739. X
  740. X      Next we imagine we have a pc.  "I'm supposed to execute statement
  741. X      pc next", says our emulator.  But suppose we're not currently
  742. X      coming up on statement pc.  To handle this, we simply make every
  743. X      operation conditional on the pc having the correct value:
  744. X
  745. X        if (pc == some_constant) y = z;
  746. X
  747. X      To combine this with other operations, we simply multiply by our
  748. X      (pc == some_constant) flag right after the above 'temp *= x'.
  749. X
  750. X      To evaluate pc == some_constant requires one more trick.  We assume
  751. X      that numbers can only be in some limited range.  Then we use successive
  752. X      additions and divisions to reduce that number down to -1, 0, or 1.
  753. X      You could, for instance, do this by using mod by 2 and div by 2 to
  754. X      count bits, stopping after, say, 32 iterations.  The number you get
  755. X      is between 0..32, so another 6 iterations on it reduces it to 0..6.
  756. X      Three iterations on this produces 0..2 (3 would be '7'), and then
  757. X      two iterations on this produces 0 or 1.  Instead I use a shorter
  758. X      two-divide approach that assumes I'm allowed to use numbers slightly 
  759. X      larger than the numbers I'm operating on.
  760. X
  761. X      A similar approach is used to detect positive numbers.
  762. X
  763. X      Note that the obvious code to compute y/x will not work correctly,
  764. X      because every value is computed, even if the pc is not set correctly;
  765. X      if x is ever 0 when the real C code reaches this computation the
  766. X      program will die.  (This was discovered the hard way.)  The solution
  767. X      is to stick x in a temporary, and if the current code is not about
  768. X      to be executed, set the temporary to 1.
  769. X  
  770. X    Thanks to Bill Pugh for bringing the loopability of the AE to
  771. X    my attention.
  772. X
  773. X    babble was originally named 'cb', for obvious reasons, and is
  774. X    dedicated to the memory of Charles Barrett.
  775. END_OF_FILE
  776.   if test 8217 -ne `wc -c <'1992/buzzard.1.hint'`; then
  777.     echo shar: \"'1992/buzzard.1.hint'\" unpacked with wrong size!
  778.   fi
  779.   # end of '1992/buzzard.1.hint'
  780. fi
  781. if test -f '1992/buzzard.2.hint' -a "${1}" != "-c" ; then 
  782.   echo shar: Will not clobber existing file \"'1992/buzzard.2.hint'\"
  783. else
  784.   echo shar: Extracting \"'1992/buzzard.2.hint'\" \(8915 characters\)
  785.   sed "s/^X//" >'1992/buzzard.2.hint' <<'END_OF_FILE'
  786. XBest Language Tool: <sean@stat.tamu.edu> Sean Barrett
  787. X
  788. X    Sean Barrett
  789. X    Software Construction Company
  790. X    430 Southwest Parkway, #1906
  791. X    College Station, TX 77840
  792. X    USA
  793. X
  794. X        Direct bounced email to <jon@stat.tamu.edu>.
  795. X
  796. XJudges' comments:
  797. X
  798. X    First:
  799. X    make first
  800. X    
  801. X    Second:
  802. X    echo help | cat third help.th - | first
  803. X    cat third demo5.th | first
  804. X    
  805. X    Third:
  806. X    cat third help.th - | first
  807. X
  808. X    Wait until Ok is printed and the type:
  809. X        2 3 + . cr        <-- yes you should really type the 2 letters: cr
  810. X
  811. X    Forth:
  812. X    Sorry, this is third!
  813. X
  814. X
  815. XSelected notes from the author:
  816. X
  817. X    What it does:
  818. X
  819. X        first implements a relatively primitive stack machine.  How
  820. X        primitive?  It supplies 13 visible primitives: 3 arithmetic,
  821. X        1 comparison, 2 memory-access, 2 character I/O, 3 primitives
  822. X        for defining new words, 1 tokenizing, and 1 special stack
  823. X        operation.  (There are also three internal operations for
  824. X        the stack machine: 'push this integer', 'call this code',
  825. X        and 'compile a call to this code'.)
  826. X
  827. X        It is very difficult to accomplish anything with this set
  828. X        of primitives, but they do have an interesting property.
  829. X
  830. X        This--what this interesting property is, or in other words
  831. X        what first is good for--is the major obfuscation; there are
  832. X        also minor source obfuscations, as well as some design tricks
  833. X        that are effectively obfuscations.  Details on the obfuscations
  834. X        are below, and the interesting property is discussed much
  835. X        further down.
  836. X
  837. X
  838. X    How to run it:
  839. X
  840. X        first expects you to first enter the names of the 13 primitives,
  841. X        separated by whitespace--it doesn't care what you name them, but
  842. X        if all the names aren't unique, you won't be able to use some of
  843. X        them.  After this you may type any sequence of valid first input.
  844. X        Valid first input is defined as any sequence of whitespace-delimited
  845. X        tokens which consist of primitives, new words you've defined, and
  846. X        integers (as parsed by "%d").  Invalid input behaves unpredictably,
  847. X        but gives no warning messages.  A sample program, demo1.1st, is
  848. X        included, but it only works on ASCII systems.
  849. X
  850. X        Do not expect to be able to do anything interesting with first.
  851. X
  852. X        To do something interesting, you need to feed first the file
  853. X        third first.  In unix, you can do
  854. X
  855. X                % cat third help.th - | first
  856. X
  857. X        to do this.  Hopefully most operating systems will provide a
  858. X        way to do this.  It may take some time for this to complete
  859. X    (I seem to remember it taking several minutes on an 8086 PC);
  860. X        THIRD will prompt you when it is finished.  The file third has
  861. X        not been obfuscated, due to sheer kindness on the author's part.
  862. X
  863. X        For more information on what you can do once you've piped
  864. X        THIRD into first, type 'help' and consult FORTH manuals for
  865. X        further reference.  Six sample THIRD programs are included
  866. X    in the files demo[1-6].th.  buzzard.2.README has more
  867. X    information.
  868. X
  869. X        Keep in mind that you are still running first, and
  870. X        are for the most part limited by first's tokenizer
  871. X        (notably, unknown words will attempt to be parsed as
  872. X        integers.)  It is possible to build a new parser that
  873. X        parses by hand, reading a single character at a time;
  874. X    however, such a parser cannot easily use the existing
  875. X    dictionary, and so would have to implement its own,
  876. X    thus requiring reimplementing all of first and third
  877. X    a second time--I did not care to tackle this project.
  878. X
  879. X
  880. X    Compiling:
  881. X
  882. X        first is reasonably portable.  You may need to adjust the
  883. X        size of the buffers on smaller machines; m[] needs to be
  884. X        at least 2000 long, though.
  885. X
  886. X        I say first is portable mainly because it uses native types.
  887. X        Unlike FORTH, which traditionally allows byte and multi-byte
  888. X        operations, all operations are performed on C 'int's.  That
  889. X        means first code is only as portable as the same code would
  890. X        be in C.  As in C, the result of dividing -1 by 2 is machine
  891. X        (or rather compiler) dependent.
  892. X
  893. X    How is first obfuscated?
  894. X
  895. X        first is obfuscated in several ways.  Some minor obfuscations
  896. X        like &w[&m[1]][s] for s+m[w+1] were in the original source
  897. X    but are no longer because, apparently, ANSI doesn't allow it
  898. X    (gcc -ansi -pedantic doesn't mind it, though.)
  899. X    Other related obfuscations are still present.  The top of the
  900. X    stack is cached in a variable, which increases performance
  901. X    massively if the compiler can figure out to keep it in a register;
  902. X    it also obfuscates the code.  (Unfortunately, the top of stack
  903. X    is a global variable and neither gcc nor most bundled compilers
  904. X    seem to register allocate it.)
  905. X    
  906. X        More significant are the design obfuscations.  m[0] is the
  907. X        "dictionary pointer", used when compiling words, and m[1] is
  908. X        the return stack index.  Both are used as integer offsets into
  909. X        m.  Both are kept in m, instead of as separate pointers,
  910. X        because they are then accessible to first programs, which is a
  911. X        crucial property of first.  Similarly the way words are stored
  912. X        in the dictionary is not obvious, so it can be difficult to
  913. X        follow exactly what the compiler words are doing.
  914. X
  915. X        Assuming you've waded through all that, you still have
  916. X        to penetrate the most significant obfuscation.  Traditionally,
  917. X        the question is whether a reader can answer the question "what
  918. X        will this do when I run it".  A reader who has deciphered first
  919. X        to this point may think they know the answer to this question,
  920. X        but they may not know the answer to the more important question,
  921. X        "what will this program do when given the right input?"  FORTH
  922. X        afficianados, and especially FORTH implementors, may recognize
  923. X        the similarity of the internal compiler format to many FORTH
  924. X        interal representations, and, being aware that FORTH interpreters
  925. X        can often by self-compiling, may be suspicious that this program
  926. X        can compile FORTH, or a significant subset of it, or at least be
  927. X        capable of doing so if fed the right input.  Of course, the name
  928. X        "THIRD" should be a dead giveaway, if the name "first" wasn't.
  929. X        (These numbers were largely chosed because they were five letters
  930. X        long, like "FORTH", and would not require truncation to five
  931. X        letters, which would be a dead giveaway.  Besides, THIRD represents
  932. X        a step backwards, in more ways than one.)
  933. X
  934. X
  935. X    What exactly is first, then?
  936. X
  937. X    first is a tiny interpreter which implements a sufficient
  938. X    pseudo-subset of FORTH to allow it to bootstrap a relatively
  939. X    complete version of FORTH (based loosely on forth79), which
  940. X    I call THIRD.  Complete relative to what, I'm not sure.
  941. X
  942. X    I believe first is close to the smallest amount of code possible
  943. X    to get this effect *using forth-style primitives*, and still have
  944. X    some efficiency (it is possible to get by without multiplication
  945. X    if you have addition, obviously).  In the design file, design,
  946. X    I give a justification for why each primitive in first was included.
  947. X
  948. X    THIRD is sorta slow, because first has so few primitives that
  949. X    many things that are primitives in FORTH (like swap) take a
  950. X    significant amount of time in THIRD.
  951. X
  952. X    When you get the 'Ok.' message from third, try out some sample
  953. X    FORTH code (first has no way of knowing if keyboard input is
  954. X    waiting, so it can't actually prompt you in a normal way.  It
  955. X    only prints 'Ok.' after you define a word).
  956. X
  957. X        2 3 + . cr    ( add 2 and 3, and print it and a newline.)
  958. X
  959. X    and THIRD responds
  960. X
  961. X        5
  962. X
  963. X    Now try:
  964. X
  965. X        : test 11 1 do i . loop cr ;
  966. X        test
  967. X
  968. X    and THIRD responds
  969. X
  970. X        1 2 3 4 5 6 7 8 9 10
  971. X
  972. X
  973. X    When in THIRD, you can see how much space you're currently
  974. X    using by typing
  975. X
  976. X        here .
  977. X
  978. X    The number THIRD replies is the number of machine words (ints)
  979. X    that the dictionary (the first code) takes up, plus the
  980. X    512 ints for the return stack.  If you compile the basic
  981. X    THIRD system without the help word (strings take up one
  982. X    int per character in the string!), you should find that
  983. X    you're using around 1000 ints (plus the return stack).
  984. X
  985. X    Thus THIRD gives you a relatively complete FORTH system in
  986. X    less than 700 chars of C source + about 1000 ints of
  987. X    memory--and it's portable too (you could copy over the
  988. X    THIRD memory dump to another machine, in theory).  If the
  989. X    above numbers seem to you to be mixing apples and oranges
  990. X    (C source and compiled THIRD code), note that you should
  991. X    in theory be able to stick the compiled THIRD code into
  992. X    the C source.
  993. X
  994. X
  995. X    Software Construction Company gets credit for rekindling
  996. X    my interest in FORTH and thus indirectly inspiring me
  997. X    to write this program.
  998. END_OF_FILE
  999.   if test 8915 -ne `wc -c <'1992/buzzard.2.hint'`; then
  1000.     echo shar: \"'1992/buzzard.2.hint'\" unpacked with wrong size!
  1001.   fi
  1002.   # end of '1992/buzzard.2.hint'
  1003. fi
  1004. if test -f '1992/demo1.1st' -a "${1}" != "-c" ; then 
  1005.   echo shar: Will not clobber existing file \"'1992/demo1.1st'\"
  1006. else
  1007.   echo shar: Extracting \"'1992/demo1.1st'\" \(212 characters\)
  1008.   sed "s/^X//" >'1992/demo1.1st' <<'END_OF_FILE'
  1009. X: immediate _read @ ! - * / <0 exit echo key _pick
  1010. X
  1011. X: show echo echo echo echo exit
  1012. X: all show show show show echo exit
  1013. X
  1014. X: doit immediate
  1015. X    10 33 100 108 114 111 87
  1016. X    32 111 108 108 101 72
  1017. X    all
  1018. Xexit
  1019. X
  1020. Xdoit
  1021. END_OF_FILE
  1022.   if test 212 -ne `wc -c <'1992/demo1.1st'`; then
  1023.     echo shar: \"'1992/demo1.1st'\" unpacked with wrong size!
  1024.   fi
  1025.   # end of '1992/demo1.1st'
  1026. fi
  1027. if test -f '1992/gson.hint' -a "${1}" != "-c" ; then 
  1028.   echo shar: Will not clobber existing file \"'1992/gson.hint'\"
  1029. else
  1030.   echo shar: Extracting \"'1992/gson.hint'\" \(10891 characters\)
  1031.   sed "s/^X//" >'1992/gson.hint' <<'END_OF_FILE'
  1032. XMost Humorous Output: <gson@niksula.hut.fi> Andreas Gustafsson
  1033. X
  1034. X    Andreas Gustafsson
  1035. X    Helsinki University of Technology
  1036. X    Arentikuja 1 D 305            (home address)
  1037. X    00410 Helsinki
  1038. X    FINLAND
  1039. X
  1040. X
  1041. XJudges' comments:
  1042. X
  1043. X    To make:
  1044. X    make ag
  1045. X    
  1046. X    Determine where your system dictionary is located.  You may find
  1047. X    it located in one of the following places:
  1048. X
  1049. X        /usr/dict/words
  1050. X        /usr/share/lib/spell/words
  1051. X        /usr/ucblib/dict/words
  1052. X        /dev/null            <-- for machines with nothing to say
  1053. X    
  1054. X    Then using the proper dictionary:
  1055. X
  1056. X        ag free software foundation    < /usr/dict/words
  1057. X        ag obfuscated c contest        < /usr/dict/words
  1058. X        ag unix international        < /usr/dict/words
  1059. X    ag george bush            < /usr/dict/words
  1060. X    ag bill clinton            < /usr/dict/words
  1061. X    ag ross perot            < /usr/dict/words
  1062. X    ag paul e tsongas        < /usr/dict/words
  1063. X
  1064. X    Recently some newspapers printed amusing anagrams of one of the
  1065. X    names listed above.  Run this program to find the anagrams they
  1066. X    weren't allowed to print!
  1067. X
  1068. X
  1069. XSelected notes from the author:
  1070. X
  1071. X    The name of the game:
  1072. X    
  1073. X    AG is short for either Anagram Generator or simply AnaGram.
  1074. X    It might also be construed to mean Alphabet Game, and by pure
  1075. X    coincidence it happens to be the author's initials.
  1076. X    
  1077. X    
  1078. X    What it does:
  1079. X    
  1080. X    AG takes one or more words as arguments, and tries to find
  1081. X    anagrams of those words, i.e. words or sentences containing
  1082. X    exactly the same letters.
  1083. X    
  1084. X    
  1085. X    How to use it:
  1086. X    
  1087. X    To run AG, you need a dictionary file consisting of distinct words
  1088. X    in the natural language of your choice, one word on each line.  If
  1089. X    your machine doesn't have one already, you can make your own
  1090. X    dictionary by concatenating a few hundred of your favourite Usenet
  1091. X    articles and piping them through the following obfuscated shell
  1092. X    script:
  1093. X    
  1094. X        #!/bin/sh
  1095. X        z=a-z];tr [A-Z\] \[$z|sed s/[\^$z[\^$z*/_/g|tr _ \\012|grep ..|sort -u
  1096. X    
  1097. X    Using articles from alt.folklore.computers is likely to make
  1098. X    a more professional-looking dictionary than rec.arts.erotica.
  1099. X    
  1100. X    AG must be run with the dictionary file as standard input.
  1101. X    
  1102. X    Because anagrams consisting of just a few words are generally more
  1103. X    meaningful than those consisting of dozens of very short words, the
  1104. X    number of words in the anagrams is limited to 3 by default.  This
  1105. X    limit can be changed using a numeric command line option, as in
  1106. X    "ag -4 international obfuscated c code contest </usr/dict/words".
  1107. X    
  1108. X    Bugs:
  1109. X    
  1110. X      - There is no error checking
  1111. X      - Standard input must be seekable, so you can't pipe the dictionary
  1112. X        into AG.
  1113. X      - The input sentence and each line in the dictionary may contain
  1114. X        at most 32 distinct letters, and each letter may occur at most 15
  1115. X        times.
  1116. X      - Words in the dictionary may be at most 255 bytes long
  1117. X      - AG cannot handle characters that sign-extend to negative values
  1118. X      - Although AG works on both 16-bit and 32-bit machines, 
  1119. X        the size of the problems it can solve is severely limited 
  1120. X        on machines that limit the stack size to 64k or less.
  1121. X    
  1122. X    
  1123. X    Obfuscatory notes:
  1124. X    
  1125. X    As you can see, AG takes advantage of the new '92 whitespace rules to
  1126. X    achieve a clear, readable, self-documenting layout.  The identifiers
  1127. X    have been chosen in a way appropriate for an alphabet game, and common
  1128. X    sources of bugs such as goto statements and malloc/free have been
  1129. X    eliminated.  As AG also refrains from abusing the preprocessor, it
  1130. X    doesn't really have much to offer in terms of "surface obfuscation".
  1131. X    Instead, it tries to achieve both its speed and its obscurity through a
  1132. X    careful choice of algorithms.  Some of the finer points of those
  1133. X    algorithms are outlined in the rot-13 encoded spoiler below.
  1134. X    
  1135. X    How it works:  (ROT13 to read)
  1136. X    
  1137. X    Urer sbyybjf n qrfpevcgvba bs fbzr bs gur qngn fgehpgherf naq
  1138. X    nytbevguzf hfrq ol NT.  Vg vf ol ab zrnaf pbzcyrgr, ohg vg znl uryc
  1139. X    lbh trg na vqrn nobhg gur trareny cevapvcyrf.
  1140. X    
  1141. X    --
  1142. X    
  1143. X    Vagreanyyl, NT ercerfragf jbeqf naq fragraprf nf neenlf bs 32
  1144. X    4-ovg vagrtre ryrzragf.  Rnpu ryrzrag ercerfragf gur ahzore bs
  1145. X    gvzrf n yrggre bpphef va gur jbeq/fragrapr.  Gurer ner 32 ryrzragf
  1146. X    orpnhfr 32 vf n pbairavrag cbjre bs gjb ynetre guna gur ahzore bs
  1147. X    yrggref va zbfg jrfgrea nycunorgf, naq gur ryrzragf ner 4 ovgf
  1148. X    rnpu orpnhfr gur fnzr yrggre vf hayvxryl gb bpphe zber guna 15
  1149. X    gvzrf va n cenpgvpny nantenz trarengvba ceboyrz.
  1150. X    
  1151. X    Gurfr 32*4-ovg neenlf ner npghnyyl fgberq va zrzbel va n
  1152. X    "ovg-genafcbfrq" sbezng, nf neenlf bs sbhe "ybat" inyhrf.  Vg vf
  1153. X    nffhzrq gung n "ybat" vf ng yrnfg 32 ovgf.  Gur svefg 4-ovg yrggre
  1154. X    pbhag vf sbezrq ol gur yrnfg fvtavsvpnag (2^0) ovg va rnpu bs gur
  1155. X    sbhe ybatf, gur arkg bar vf sbezrq ol gur 2^1 ovgf, rgp.
  1156. X    
  1157. X    Guvf fgbentr sbezng znxrf vg cbffvoyr gb nqq be fhogenpg gjb fhpu
  1158. X    irpgbef bs 32 4-ovg inyhrf va cnenyyry ol fvzhyngvat n frg bs 32
  1159. X    ovanel shyy nqqref va fbsgjner hfvat ovgjvfr ybtvpny bcrengvbaf.
  1160. X    R.t., nyy gur YFO:f bs gur erfhyg ner sbezrq va cnenyyry ol gnxvat
  1161. X    gur rkpyhfvir BE bs gur YFO:f va rnpu fhzznaq, naq 32 pneel ovgf
  1162. X    ner sbezrq va cnenyyry va n fvzvyne jnl hfvat n ybtvpny NAQ.
  1163. X    Guhf, 32 vaqrcraqrag 4-ovg nqqvgvbaf pna or cresbezrq ol whfg sbhe
  1164. X    vgrengvbaf bs n ybbc pbagnvavat fbzr 32-ovg ovgjvfr ybtvpny
  1165. X    bcrengvbaf, ohg ab nevguzrgvp bcrengvbaf bgure guna gubfr vzcyvrq
  1166. X    ol neenl vaqrkvat.
  1167. X    
  1168. X    Fhogenpgvba jbexf fvzvyneyl, naq va snpg NT bayl vzcyrzragf
  1169. X    fhogenpgvba qverpgyl, unaqyvat nqqvgvba ol zrnaf bs gur vqragvgl
  1170. X    n+o = n-(0-o).
  1171. X    
  1172. X    Va nqqvgvba gb guvf 32*4-ovg ercerfragngvba, NT nyfb sbezf n fb-pnyyrq
  1173. X    "fvtangher" gung vf gur ovgjvfr BE bs gur sbhe ybatf, juvpu vf
  1174. X    rdhvinyrag gb fnlvat gung gur fvtangher bs n jbeq pbagnvaf n ybtvpny 1
  1175. X    va gur ovg cbfvgvbaf pbeerfcbaqvat gb yrggref bppheevat ng yrnfg bapr
  1176. X    va gung jbeq.
  1177. X    
  1178. X    Gur svefg guvat NT qbrf vf gb pbafgehpg n ybbxhc gnoyr bs 256
  1179. X    ybatf, bar sbe rnpu 8-ovg punenpgre inyhr.  Gur ragel sbe n
  1180. X    punenpgre jvyy or mreb vs gung punenpgre qbrfa'g nccrne va gur
  1181. X    fragrapr tvira ba gur pbzznaq yvar, be vg jvyy unir n fvatyr ovg
  1182. X    frg vs gur punenpgre qbrf nccrne va gur fragrapr.  Ol nqqvat
  1183. X    gbtrgure gur ovg znfxf sbe nyy gur yrggref va gur vachg fragrapr
  1184. X    hfvat gur genafcbfr nqqvgvba zrgubq qrfpevorq nobir, NT sbezf gur
  1185. X    32*4 ovg neenl ercerfragngvba bs gur vachg fragrapr.
  1186. X    
  1187. X    Gur arkg npgvba cresbezrq vf ernqvat gur qvpgvbanel.  Gubfr jbeqf gung
  1188. X    pbagnva yrggref abg va gur vachg fragrapr ner vzzrqvngryl qvfpneqrq.
  1189. X    Jbeqf pbagnvavat gur evtug yrggref ohg va rkprffvir ahzoref ner
  1190. X    ryvzvangrq va n frcnengr purpx vaibyivat gur 32*4 ovg neenl.
  1191. X    
  1192. X    Gur erznvavat jbeqf, juvpu jvyy or ersreerq gb nf "pnaqvqngr jbeqf",
  1193. X    ner fgberq va 32*4-ovg ercerfragngvba, gbtrgure jvgu gurve fvtangherf 
  1194. X    naq bssfrgf vagb gur qvpgvbanel svyr fb gung gur cynva-grkg irefvba bs
  1195. X    n jbeq pna yngre or sbhaq sbe cevagvat.  Guvf vasbezngvba vf xrcg va n
  1196. X    ybpny "fgehpg" va gur qvpgvbanel-ernqvat shapgvba, naq zrzbel vf
  1197. X    nyybpngrq sbe rnpu pnaqvqngr jbeq fvzcyl ol znxvat nabgure erphefvir
  1198. X    pnyy gb gung shapgvba.
  1199. X    
  1200. X    Rnpu fgehpg fb nyybpngrq vf yvaxrq vagb n svkrq-fvmr unfu gnoyr bs
  1201. X    4096 ragevrf vaqrkrq ol gur 12 ybj ovgf bs gur jbeq'f fvtangher. 
  1202. X    Jura gur qvpgvbanel-ernqvat shapgvba rapbhagref raq-bs-svyr, nyy gur
  1203. X    pnaqvqngr jbeqf unir orra fgberq va arfgrq npgvingvba erpbeqf ba gur
  1204. X    fgnpx, npprffvoyr guebhtu gur unfu gnoyr.
  1205. X    
  1206. X    Trarengvat gur nantenzf vf gura qbar ol genirefvat gur unfu gnoyr naq
  1207. X    fhogenpgvat gur yrggref bs rnpu jbeq va gur unfu gnoyr sebz gur
  1208. X    "pheerag fragrapr", juvpu vavgvnyyl vf gur fragrapr tvira ba gur
  1209. X    pbzznaq yvar.
  1210. X    
  1211. X    Gur fhogenpgvba vf cresbezrq va cnenyyry ba gur 4-ovg yrggre pbhagf
  1212. X    nf qrfpevorq nobir, naq vs nyy 32 erfhygf ner mreb, na nantenz unf
  1213. X    orra sbhaq.  Vs gur erfhyg vf artngvir sbe bar be zber bs gur yrggref
  1214. X    (nf vaqvpngrq ol bar be zber "1" va n irpgbe bs 32 obeebj ovgf
  1215. X    erghearq ol gur fhogenpgvba ebhgvar), gur jbeq qvq abg zngpu gur
  1216. X    pheerag fragrapr naq vf vtaberq.  Svanyyl, vs gur erfhyg pbagnvarq
  1217. X    bayl abaartngvir yrggre pbhagf, jr unir sbhaq n cnegvny nantenz: 
  1218. X    n jbeq pbagnvavat fbzr, ohg abg nyy, bs gur yrggref va gur pheerag
  1219. X    fragrapr.  Va guvf pnfr jr erphefviryl gel gb svaq na nantenz bs gur
  1220. X    erznvavat yrggref.  Gur qrcgu bs gur erphefvba vf yvzvgrq gb gur
  1221. X    znkvzhz ahzore bs jbeqf va gur nantenz, nf fcrpvsvrq ol gur hfre.
  1222. X    
  1223. X    Jura gur qrrcrfg erphefvba yriry unf orra ernpurq, na bcgvzvmngvba pna
  1224. X    or nccyvrq: orpnhfr ab shegure erphefvba jvyy or qbar, gurer vf ab
  1225. X    arrq gb ybbx sbe cnegvny nantenzf, naq gurersber NT bayl arrqf gb
  1226. X    purpx sbe jbeqf gung pbagnva rknpgyl gur fnzr yrggref nf gur pheerag
  1227. X    fragrapr.  Gubfr jbeqf pna or sbhaq fvzcyl ol vaqrkvat gur unfu gnoyr
  1228. X    jvgu gur fvtangher bs gur pheerag fragrapr.
  1229. X    
  1230. X    Rira jura abg ba gur qrrcrfg erphefvba yriry, NT trarenyyl nibvqf
  1231. X    rknzvavat nyy gur ragevrf bs gur unfu gnoyr.  Gur vqrn vf gung jr ner
  1232. X    abg vagrerfgrq va unfu ohpxrgf jubfr jbeqf pbagnva nal yrggref abg
  1233. X    va gur pheerag fragrapr; gurfr ohpxrgf ner rknpgyl gubfr jubfr vaqrk
  1234. X    unf n ybtvpny bar va n ovg cbfvgvba jurer gur fvtangher bs gur pheerag
  1235. X    fragrapr unf n mreb.  Chg nabgure jnl, jr jnag gb ybbc guebhtu bayl
  1236. X    gubfr unfu ohpxrg vaqvprf "v" gung pbagnva mrebrf va nyy gur ovg
  1237. X    cbfvgvbaf jurer gur fvtangher "f" bs gur pheerag fragrapr pbagnvaf
  1238. X    n mreb; guvf pna or rkcerffrq va P nf (v & ~f == 0).
  1239. X    
  1240. X    Vg vf cbffvoyr gb ybbc guebhtu nyy fhpu ahzoref va na rssvpvrag jnl ol
  1241. X    gnxvat nqinagntr bs pregnva cebcregvrf bs ovanel nevguzrgvp: ol
  1242. X    sbepvat gur ovgf pbeerfcbaqvat gb mrebrf va "f" gb barf, jr pna znxr
  1243. X    gur pneevrf trarengrq va vaperzragvat "v" cebcntngr fgenvtug npebff
  1244. X    gubfr ovgf gung fubhyq erznva mreb.  Sbe rknzcyr, gur sbyybjvat
  1245. X    cebtenz cevagf nyy gubfr 16-ovg vagrtref gung pbagnva mrebrf va nyy
  1246. X    rira ovg cbfvgvbaf:
  1247. X    
  1248. X        znva(){vag v=0,f=0kNNNN;qb{cevags("%04k\g",v);}juvyr(v=((v|~f)+1)&f);}
  1249. X    
  1250. X    NT hfrf n fvzvyne zrgubq ohg jbexf va gur bccbfvgr qverpgvba, svaqvat
  1251. X    gur arkg ybjre inyhr jvgu mrebrf va tvira ovg cbfvgvbaf ol cebcntngvat
  1252. X    obeebjf npebff gubfr ovgf.  Fbzr nqqvgvbany nqwhfgzragf ner znqr
  1253. X    gb gur unfu gnoyr vaqrk jura vavgvngvat n erphefvir frnepu, hfvat
  1254. X    fvzvyne ovg-gjvqqyvat grpuavdhrf.
  1255. X    
  1256. X    Jurarire na nantenz unf orra sbhaq, vg vf cevagrq ol genirefvat n
  1257. X    yvaxrq yvfg sbezrq ol fgehpgf va gur npgvingvba erpbeqf bs gur
  1258. X    erphefvir vaibpngvbaf bs gur frnepu shapgvba, frrxvat gb gur ortvaavat
  1259. X    bs gur jbeq zngpurq ol gung vaibpngvba, naq pbclvat gur punenpgref bs
  1260. X    gur jbeq qverpgyl sebz fgnaqneq vachg gb fgnaqneq bhgchg.
  1261. END_OF_FILE
  1262.   if test 10891 -ne `wc -c <'1992/gson.hint'`; then
  1263.     echo shar: \"'1992/gson.hint'\" unpacked with wrong size!
  1264.   fi
  1265.   # end of '1992/gson.hint'
  1266. fi
  1267. if test -f '1992/rules' -a "${1}" != "-c" ; then 
  1268.   echo shar: Will not clobber existing file \"'1992/rules'\"
  1269. else
  1270.   echo shar: Extracting \"'1992/rules'\" \(7451 characters\)
  1271.   sed "s/^X//" >'1992/rules' <<'END_OF_FILE'
  1272. X9th International Obfuscated C Code Contest Rules
  1273. X
  1274. X    Obfuscate:  tr.v.  -cated, -cating, -cates.  1. a.  To render obscure.
  1275. X        b.  To darken.  2. To confuse:  his emotions obfuscated his
  1276. X        judgment.  [LLat. obfuscare, to darken : ob(intensive) +
  1277. X        Lat. fuscare, to darken < fuscus, dark.] -obfuscation n.
  1278. X        obfuscatory adj.
  1279. X
  1280. X
  1281. XGOALS OF THE CONTEST:
  1282. X
  1283. X    * To write the most Obscure/Obfuscated C program under the rules below.
  1284. X    * To show the importance of programming style, in an ironic way.
  1285. X    * To stress C compilers with unusual code.
  1286. X    * To illustrate some of the subtleties of the C language.
  1287. X    * To provide a safe forum for poor C code.  :-)
  1288. X
  1289. X
  1290. XRULES:
  1291. X
  1292. X    To help us with the volume of entries, we ask that you follow these rules:
  1293. X
  1294. X    1) Your entry must be a complete program.
  1295. X
  1296. X    2) Your entry must be <= 3217 bytes in length.  The number of characters
  1297. X       excluding whitespace (tab, space, newline), and excluding any ; { or }
  1298. X       followed by either whitespace or end of file, must be <= 1536.
  1299. X
  1300. X    3) Your entry must be submitted in the following format:
  1301. X
  1302. X---entry---
  1303. Xrule:    1992
  1304. Xtitle:    title of entry  (see comments below)
  1305. Xentry:    Entry number from 0 to 7 inclusive
  1306. Xdate:    Date/time of submission   (use the format of the date command)
  1307. Xhost:    Machine(s) and OS(s) under which your entry was tested
  1308. X    Use tab indented lines if needed
  1309. X---remark---
  1310. X    Place remarks about this entry in this section.  It would be helpful if
  1311. X    you were to indent your remarks with 4 spaces, though it is not a
  1312. X    requirement.  Also, if possible, try to avoid going beyond the 79th
  1313. X    column.  Blank lines are ok.
  1314. X---author---
  1315. Xname:    your name
  1316. Xorg:    School/Company/Organization
  1317. Xaddr:    postal address
  1318. X    use tab indented lines to continue
  1319. X    don't forget to include the country
  1320. Xemail:  Email address from a well known site or registered domain.
  1321. X        If you give several forms, list them on separate tab indented lines.
  1322. Xanon:    y or n       (y => remain anonymous, n => ok to publish this info)
  1323. X---info---
  1324. XIf your program needs an info file, place a uuencoded copy of it in
  1325. Xthis section.  In the case of multiple info files, use multiple info
  1326. Xsections.  If your entry does not need a info file, skip this section.
  1327. X---build---
  1328. XPlace a uuencoded copy of the command(s) used to compile/build your program
  1329. Xin this section.  It must uudecode into a file named 'build'.  The resulting
  1330. Xfile must be 255 bytes or less.
  1331. X---program---
  1332. XPlace a uuencoded copy of your program in this section.  It must uudecode
  1333. Xinto a file named is 'prog.c'.  The resulting file must follow rule #2.
  1334. X---end---
  1335. X
  1336. X      Regarding the above format:
  1337. X
  1338. X    * The title must match expression: [a-zA-Z0-9_+=,][a-zA-Z0-9_+=,.-]*
  1339. X      and must be 1 to 10 characters in length.
  1340. X
  1341. X      It is suggested, but not required, that the title should
  1342. X      incorporate your username; in the case of multiple authors,
  1343. X      consider using parts of the usernames of the authors.
  1344. X
  1345. X    * All text outside of the above format will be kept confidential,
  1346. X      unless otherwise stated.  Notes about an author of a winning entry
  1347. X      will be published unless 'y' was given to that author's 'anon' line.
  1348. X
  1349. X    * To credit multiple authors, include an ---author--- section for
  1350. X      each author.  Each should start with ---author--- line, and
  1351. X      should be found between the ---entry--- and ---build--- sections.
  1352. X
  1353. X    * The entry's remarks should include:
  1354. X        - what this program does
  1355. X        - how to run the program (sample args or input)
  1356. X        - special compile or execution instructions, if any
  1357. X        - special filename requirements (see rule 4 and 5)
  1358. X        - information about any ---data--- files
  1359. X        - why you think the program is obfuscated
  1360. X        - note if this entry is a re-submission of a previous entry.
  1361. X        - any other remarks (humorous or otherwise)
  1362. X
  1363. X        * Info files should be used only to supplement your entry.  They 
  1364. X      should not be required to exist.
  1365. X
  1366. X      If your entry does not need an info file, skip the ---info---
  1367. X      section.  If your entry needs multiple info files, use multiple 
  1368. X      ---info--- sections, one per info file.  You should describe
  1369. X      each info file in the ---remark--- section.
  1370. X
  1371. X    4) If your entry is selected as a winner, it will be modified as follows:
  1372. X
  1373. X       'build' is incorporated into a makefile, and 'build' is removed
  1374. X       'prog.c' is renamed to your entry's title, followed by an optional
  1375. X           digit, followed by '.c'
  1376. X       your entry is compiled into a file with the name of your entry's
  1377. X           title, possibly followed by a digit
  1378. X
  1379. X       If your entry requires that a build file exist, state so in your
  1380. X       entry's remark section.  The makefile will be arranged to execute a
  1381. X       build shell script containing the 'build' information.  The name of
  1382. X       this build shell script will be your entry's title, possibly followed
  1383. X       by a digit, followed by '.sh'.
  1384. X
  1385. X       If needed, your entry's remarks should indicate how your entry must
  1386. X       be changed in order to deal with the new filenames.
  1387. X
  1388. X    5) The build file, the source and the resulting executable should be
  1389. X       treated as read-only files.  If your entry needs to modify these files,
  1390. X       it should make and modify a copy of the appropriate file.  If this
  1391. X       occurs, state so in your entry's remarks.
  1392. X
  1393. X    6) Your entry must be written in C.  Use of ANSI C is preferred.  Use
  1394. X       of common C (K&R + extensions) is permitted, as long as it does not
  1395. X       cause major problems for ANSI C compilers.
  1396. X
  1397. X    7) The program must be of original work.  All programs must be in the
  1398. X       public domain.  All copyrighted programs will be rejected.
  1399. X
  1400. X    8) Entries must be received prior to 09-May-92 0:00 UTC.  (UTC is
  1401. X       essentially equivalent to Greenwich Mean Time)  Email your entries to:
  1402. X
  1403. X        ...!{apple,pyramid,sun,uunet}!hoptoad!obfuscate
  1404. X        obfuscate@toad.com
  1405. X
  1406. X       We request that your message use the subject 'ioccc entry'.
  1407. X
  1408. X       If possible, we request that you hold off on Emailing your entries
  1409. X       until 1-Mar-92 0:00 UTC.  Early entries will be accepted, however.
  1410. X       We will attempt to email a confirmation to the the first author for
  1411. X       all entries received after 1-Mar-92 0:00 UTC.
  1412. X
  1413. X    9) Each person may submit up to 8 entries per contest year.  Each entry
  1414. X       must be sent in a separate Email letter.
  1415. X
  1416. X   10) Entries requiring human interaction to be built are not allowed.  
  1417. X       Compiling an entry produce a file (or files) which may be executed.
  1418. X
  1419. X
  1420. XFOR MORE INFORMATION:
  1421. X
  1422. X    The Judging will be done by Landon Noll and Larry Bassel.  Please send
  1423. X    questions or comments (but not entries) about the contest, to:
  1424. X
  1425. X    ...!{apple,pyramid,sun,uunet}!hoptoad!judges
  1426. X    judges@toad.com
  1427. X
  1428. X    The rules and the guidelines may (and often do) change from year to
  1429. X    year.  You should be sure you have the current rules and guidelines
  1430. X    prior to submitting entries.  The IOCCC rules and guidelines may be
  1431. X    obtained from the judges at the address above.  Please use one of
  1432. X    the following subjects in your request:
  1433. X
  1434. X    send rules      to obtain the current IOCCC rules
  1435. X    send guidelines      to obtain the current IOCCC guidelines
  1436. X    send mkentry      to obtain the current IOCCC mkentry program
  1437. X    send all      to obtain the current IOCCC rules,guidelines,mkentry
  1438. X
  1439. X    One may also obtain them via anonymous ftp from:
  1440. X
  1441. X    host: ftp.uu.net    (137.39.1.9)
  1442. X    user: anonymous
  1443. X    pass: yourname@yourhost
  1444. X    dir:  /pub/ioccc
  1445. X
  1446. X
  1447. Xchongo <Landon Curt Noll> /\cc/\      hoptoad!chongo
  1448. XLarry Bassel                  {uunet,ucbvax,cbosgd}|sun!lab
  1449. END_OF_FILE
  1450.   if test 7451 -ne `wc -c <'1992/rules'`; then
  1451.     echo shar: \"'1992/rules'\" unpacked with wrong size!
  1452.   fi
  1453.   # end of '1992/rules'
  1454. fi
  1455. echo shar: End of archive 2 \(of 5\).
  1456. cp /dev/null ark2isdone
  1457. MISSING=""
  1458. for I in 1 2 3 4 5 ; do
  1459.     if test ! -f ark${I}isdone ; then
  1460.     MISSING="${MISSING} ${I}"
  1461.     fi
  1462. done
  1463. if test "${MISSING}" = "" ; then
  1464.     echo You have unpacked all 5 archives.
  1465.     rm -f ark[1-9]isdone
  1466. else
  1467.     echo You still must unpack the following archives:
  1468.     echo "        " ${MISSING}
  1469. fi
  1470. exit 0
  1471. exit 0 # Just in case...
  1472.