Files
ioccc/1992/adrian/index.html
T
Landon Curt Noll c457b16358 fix all HTML headers
Renamed `ioccc.ico` to `favicon.ico`.

Correctly added use of `favicon.ico` to all constructed HTML headers.
Fixed the smart quote in HTML elements problem.

Moved HTML "DO NOT EDIT" comments down below at the bottom of the
HTML phase 1 section.  According to to the Nu Html Checker, a charset
attribute on a meta element found after the first 1024 bytes.

Changed `bin/md2html.sh` VERSION from "1.1.3 2024-03-28"
to "1.2 2024-03-30".

Improved `bin/gen-status.sh` to adjust the "status_update" value
only when the "contest_status" is changed.

Performed a `make www` to perform and test the above under macOS.
2024-03-30 22:21:45 -07:00

395 lines
21 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- START: two lines up starts content from: inc/top.default.html -->
<!-- END: this line ends content from: inc/top.default.html -->
<!-- START: this line starts content from: inc/head.default.html -->
<head>
<link rel="stylesheet" href="../../ioccc.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>1992/adrian - Most Educational</title>
<link rel="icon" type="image/x-icon" href="../../favicon.ico">
<meta name="description" content="1992 IOCCC entry adrian - Most Educational">
<meta name="keywords" content="IOCCC, 1992, IOCCC 1992, IOCCC entry, adrian, Most Educational">
</head>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- END: this line ends content from: inc/head.default.html -->
<!-- -->
<!-- This web page was formed via the tool: bin/readme2index.sh -->
<!-- The content of main section of this web page came from: 1992/adrian/README.md -->
<!-- -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- !!! Do not modify this web page, instead modify the file: 1992/adrian/README.md !!! -->
<!-- !!! Do not modify this web page, instead modify the file: 1992/adrian/README.md !!! -->
<!-- !!! Do not modify this web page, instead modify the file: 1992/adrian/README.md !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- Markdown content was converted into HTML via the tool: bin/md2html.sh -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<!-- END: this line ends content from: inc/body.default.html -->
<!-- START: this line starts content from: inc/header.default.html -->
<div class="header">
<img src="../../png/ioccc.png" alt="IOCCC image by Matt Zucker" width=300 height=110>
<h1>The International Obfuscated C Code Contest</h1>
<h2>1992/adrian - Most Educational</h2>
</div>
<!-- END: this line ends content from: inc/header.default.html -->
<!-- START: this line starts content from: inc/topnav.first.html -->
<div class="topnav">
<a class="Left Disabled" href="#">first entry</a>
<a class="Left" href="../index.html">&uarr; 1992 &uarr;</a>
<a class="Left" href="../albert/index.html">albert &rarr;</a>
<a class="Right" href="https://github.com/ioccc-src/temp-test-ioccc/1992/adrian/adrian.c">C code</a>
<a class="Right" href="https://github.com/ioccc-src/temp-test-ioccc/1992/adrian/Makefile">Makefile</a>
<a class="Right" href="#inventory">Inventory</a>
</div>
<!-- END: this line ends content from: inc/topnav.first.html -->
<!-- START: this line starts content from: inc/begin-row.default.html -->
<div class="row">
<!-- END: this line ends content from: inc/begin-row.default.html -->
<!-- START: this line starts content from: inc/begin-leftcolumn.default.html -->
<div class="leftcolumn">
<!-- END: this line ends content from: inc/begin-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/sidenav.default.html -->
<div class="sidenav">
<a href="#content">Jump to contents</a>
</div>
<hr>
<div class="sidenav">
<a href="../../index.html">IOCCC Home</a>
<a href="../../years.html">Winning Entries</a>
<a href="../../authors.html">People who have won</a>
<a href="../../location.html">Location of authors</a>
</div>
<hr>
<div class="sidenav">
<a href="../../news.html">IOCCC News</a>
<a href="../../status.html">Contest status</a>
<a href="../../faq.html#submit">How to enter the IOCCC</a>
<a href="../../faq.html">FAQ</a>
</div>
<hr>
<div class="sidenav">
<a href="../../bugs.html">Bugs &amp; (mis)features</a>
<a href="../../faq.html#fix_an_entry">Fixing IOCCC entries</a>
<a href="../../faq.html#fix_web_site">Fixing the web site</a>
<a href="../../faq.html#fix_author">Fixing author info</a>
<a href="../../thanks-for-help.html">Thanks for the help</a>
</div>
<hr>
<div class="sidenav">
<a href="../../judges.html">The IOCCC Judges</a>
<a href="../../contact.html">Contacting the IOCCC</a>
</div>
<hr>
<div class="sidenav">
<a href="#top">Jump to top</a>
</div>
<!-- END: this line ends content from: inc/sidenav.default.html -->
<!-- START: this line starts content from: inc/end-leftcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/begin-rightcolumn.default.html -->
<div class="rightcolumn">
<!-- END: this line ends content from: inc/begin-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/before-content.default.html -->
<a name="content"></a>
<!-- END: this line ends content from: inc/before-content.default.html -->
<!-- START: this line starts content for HTML phase 20 by: bin/output-index-author.sh via bin/md2html.sh -->
<!-- START: this line starts content generated by: bin/output-index-author.sh -->
<h2 id="author"><a name="author"></a>Author:</h2>
<ul>
<li>Name: <a href="../../authors.html#Adrian_Mariano">Adrian Mariano</a><br>
Location: <a href="../../location.html#US">US</a> - <em>United States of America</em> (<em>United States</em>)
<br><br></li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
<!-- END: this line ends content for HTML phase 20 by: bin/output-index-author.sh via bin/md2html.sh -->
<!-- START: this line starts content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<h2 id="to-build">To build:</h2>
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> all</span></code></pre></div>
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
<p>The current status of this entry is:</p>
<pre><code>STATUS: known bug - please help us fix
STATUS: INABIAF - please **DO NOT** fix</code></pre>
<p>For more detailed information see <a href="../../bugs.html#1992_adrian">1992 adrian bugs</a>.</p>
<h2 id="try">Try:</h2>
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span></code></pre></div>
<p>For the slow minded, try:</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./adsleep</span> 32767</span></code></pre></div>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>Once you get past the obfuscation, you have an opportunity to learn
about regular expressions and state machines.</p>
<p>NOTE: Some compilers have had trouble optimizing this entry.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="adrians-grep-adgrep">ADrian’s GREP (adgrep)</h3>
<p>For those confused by the complexity of full-blown <code>egrep(1)</code> style regular
expressions, this program offers an alternative. It implements an equivalent
search, using a deterministic finite automaton.</p>
<p>A deterministic finite automaton consists of a finite set of states,
along with transition rules to move from one state to another, an initial
state, and a set of accepting states. The automaton takes a string as
input and begins in the start state. It reads a character of the string
and consults the rules for the current state, moving to the new state
indicated by the appropriate rule. This process is repeated until the
string is consumed. If the current state at this point is one of the
accepting states, then the string is accepted.</p>
<p>The deterministic finite automaton is specified as a series of rules for
each state:</p>
<pre><code>&lt;state&gt; chars1 &lt;dest1&gt; chars2 &lt;dest2&gt; ...</code></pre>
<p><code>chars1</code> is a list of characters (<em>only the first 8</em> are significant) which
should trigger a transition to <code>&lt;dest1&gt;</code>. <code>&lt;dest1&gt;</code> is another state which
should have a similar specification somewhere. A state is accepting if
it is specified in square brackets: <code>[final]</code>; state strings are
significant to only eight characters like <code>chars1</code>.</p>
<h3 id="example-1-matches-abc">Example 1: matches <code>^abc$</code></h3>
<pre><code>&lt;q0&gt; a &lt;q1&gt; The first state to appear is the start state
&lt;q1&gt; b &lt;q2&gt;
&lt;q2&gt; c [q3]
[q3]</code></pre>
<p>Technically, a deterministic finite automaton should have a rule for each
possible input character at each state. To simplify descriptions of the
automata, if no rule is present, the string will not be accepted. Also,
the <code>.</code> character matches any character if it occurs first in the
character list.</p>
<h3 id="example-2-abc">Example 2: <code>^abc</code></h3>
<pre><code>&lt;q0&gt; a &lt;q1&gt;
&lt;q1&gt; b &lt;q2&gt;
&lt;q2&gt; c [q3]
[q3] . [q3]</code></pre>
<h3 id="example-3-abc">Example 3: <code>abc$</code></h3>
<pre><code>&lt;q0&gt; a &lt;q1&gt; . &lt;q0&gt;
&lt;q1&gt; b &lt;q2&gt; a &lt;q1&gt; . &lt;q0&gt;
&lt;q2&gt; c [q3] a &lt;q1&gt; . &lt;q0&gt;
[q3] . &lt;q1&gt;</code></pre>
<h3 id="example-4-abc">Example 4: <code>^(abc)*$</code></h3>
<pre><code>[q0] a &lt;q1&gt;
&lt;q1&gt; b &lt;q2&gt;
&lt;q2&gt; c [q0]</code></pre>
<h3 id="example-5-abcdef">Example 5: <code>^[ab][cd][ef]$</code></h3>
<pre><code>&lt;q0&gt; ab &lt;q1&gt;
&lt;q1&gt; cd &lt;q2&gt;
&lt;q2&gt; ef [q3]
[q3]</code></pre>
<h3 id="example-6-abcefg">Example 6: <code>^(abc|efg)$</code></h3>
<pre><code>&lt;q0&gt; a &lt;q1&gt; e &lt;q3&gt;
&lt;q1&gt; b &lt;q2&gt;
&lt;q2&gt; c [q5]
&lt;q3&gt; f &lt;q4&gt;
&lt;q4&gt; g [q5]
[q5]</code></pre>
<p>With the automaton specification in <code>filename</code>, invoke the program by
typing</p>
<div class="sourceCode" id="cb12"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./adrian</span> filename</span></code></pre></div>
<p>It will read the file and print out all the lines which the automaton
accepts. If the file cannot be opened, a system error message will
be printed. If the input contains errors, then an error message along
with the number of the offending line will be printed to stderr. The
number of rules for each state is limited to 17. If more than 17 rules
are present, you get the error <code>too_many_rules</code>, and the state that was
being processed is printed. Error <code>no_destination</code> occurs if you specify a
set of characters, but no destination state, and error <code>too_many_states</code>
occurs if your automaton has more than 257 states.</p>
<p>Running:</p>
<div class="sourceCode" id="cb13"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./adrian</span> from <span class="op">&lt;</span> your_mailbox</span></code></pre></div>
<p>will perform a function similar to that of the unix <code>from</code> command.</p>
<p>If no filename is specified on the command line, then <code>__FILE__</code> is used as the
specification for the automaton. (Originally this was <code>"adgrep.c"</code> but the file
was renamed to <code>adrian.c</code> by the judges and for more portability the arg was
changed to <code>__FILE__</code>.) In this case, the program will search for matches to
the regular expression:</p>
<pre><code>^.[^|C][^w[Q]*(Q|[w[]c).*|^.[C|]$</code></pre>
<p>I suggest using <code>adrian.c</code> as input, and storing the output in <code>adwc.c</code>:</p>
<div class="sourceCode" id="cb15"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb15-1"><a href="#cb15-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./adrian</span> <span class="op">&lt;</span> adrian.c <span class="op">&gt;</span> adwc.c</span></code></pre></div>
<p>Compiling the new file, <code>adwc.c</code>, yields a clone of the unix <code>wc</code> command. It
runs on one file, defaulting to <code>"adrian.c"</code> if no file is given (again, this
was changed to be <code>__FILE__</code>) and displays the number of lines, words, and bytes
in the input file.</p>
<p>Another possibly interesting automaton can be created by slightly
adjusting the <code>adrian.c</code> file. Change the first line to read</p>
<div class="sourceCode" id="cb16"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb16-1"><a href="#cb16-1" aria-hidden="true" tabindex="-1"></a><span class="co">/* . echo| . */</span></span></code></pre></div>
<p>and repeat the process above</p>
<div class="sourceCode" id="cb17"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb17-1"><a href="#cb17-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./adrian</span> <span class="op">&lt;</span>adrian.c <span class="op">&gt;</span> adecho.c</span></code></pre></div>
<p>The new file now contains all lines which match</p>
<pre><code>^.[^5|m^]*[m^]([e=p,;]|[^e=+p,;].*)$</code></pre>
<p>Compile and run. This is an <code>echo(1)</code> clone. Note the efficient algorithm
employed.</p>
<p>Two other adjustments to the first line also yield useful results. By
changing it to</p>
<div class="sourceCode" id="cb19"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb19-1"><a href="#cb19-1" aria-hidden="true" tabindex="-1"></a><span class="co">/* . head; . */</span></span></code></pre></div>
<p>you can search for matches to</p>
<pre><code>^.[^W]*W..*$</code></pre>
<p>By some freak happenstance, lines of <code>adrian.c</code> which match this regular
expression form a unix <code>head(1)</code> command. It prints the first ten lines of
the file specified on the command line or <code>adrian.c</code> if no file is
specified (again this was changed to <code>__FILE__</code>).</p>
<p>By setting the first line to</p>
<div class="sourceCode" id="cb21"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb21-1"><a href="#cb21-1" aria-hidden="true" tabindex="-1"></a><span class="co">/* . basename . */</span></span></code></pre></div>
<p>a clone of the unix <code>basename(1)</code> command can be unearthed. The automaton will
search for</p>
<pre><code>^.[^j]*jr.*$</code></pre>
<p>on standard input. And the program which results by running <code>adrian.c</code>
through this filter requires two parameters. The first is meant to be a
filename, and the second, an extension. All leading pathname components
are removed from the filename, and the extension is removed if present.
The resulting base name is printed to stdout.</p>
<p>Lastly, by setting the first line to</p>
<div class="sourceCode" id="cb23"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb23-1"><a href="#cb23-1" aria-hidden="true" tabindex="-1"></a><span class="co">/* . sleep . */</span></span></code></pre></div>
<p>you can search for</p>
<pre><code>^.[^(~][^s]*sl.*$</code></pre>
<p>Filtering <code>adrian.c</code> through this search yields a clone of the <code>sleep(1)</code>
command. Invoke with a single integer parameter, and it will pause for that
many seconds.</p>
<p>If either <code>adbasename</code> or <code>adsleep</code> is invoked with too few parameters,
the program will print the error message:</p>
<blockquote>
<p>Segmentation fault (core dumped)</p>
</blockquote>
<p>(The exact text of the above error messages varies from machine to
machine.) The four programs which read from stdin require lines
shorter than 999 characters.</p>
<p>The other info files are <code>adrian.grep.[1-6]</code> which contain the six
examples that appear above, and from, which is used to emulate the
unix <code>from</code> command. For reasons of clarity, the name <code>"from"</code> should
probably not be changed if possible. I wouldn’t want to be accused of
confusing people by giving the input files weird names.</p>
<p>If you want to change the default input filename (line 80) you must be
careful to choose a name that doesn’t match the wrong search patterns,
introducing extra lines into one of the programs (again, this was changed to be
<code>__FILE__</code>).</p>
<p>The program will produce at least one warning and possible several
when compiled depending on the compiler.</p>
<!--
Copyright © 1984-2024 by Landon Curt Noll. All Rights Reserved.
You are free to share and adapt this file under the terms of this license:
Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
For more information, see:
https://creativecommons.org/licenses/by-sa/4.0/
-->
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
<h1 id="inventory-for-1992adrian"><a name="inventory"></a>Inventory for 1992/adrian</h1>
<p><a href="#top">Jump to top</a></p>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1992/adrian/adrian.c">adrian.c</a> - entry source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1992/adrian/Makefile">Makefile</a> - entry Makefile</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1992/adrian/adrian.orig.c">adrian.orig.c</a> - original source</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1992/adrian/adrian.grep.1">adrian.grep.1</a> - agrep script</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1992/adrian/adrian.grep.2">adrian.grep.2</a> - agrep script</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1992/adrian/adrian.grep.3">adrian.grep.3</a> - agrep script</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1992/adrian/adrian.grep.4">adrian.grep.4</a> - agrep script</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1992/adrian/adrian.grep.5">adrian.grep.5</a> - agrep script</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1992/adrian/adrian.grep.from">adrian.grep.from</a> - agrep script</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1992/adrian/adrian.grep.try">adrian.grep.try</a> - agrep script</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1992/adrian/try.sh">try.sh</a> - how to run</li>
<li><a href="1992_adrian.tar.bz2">1992_adrian.tar.bz2</a> - download entry</li>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<li><a href="index.html">index.html</a> - entry home page</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1992/adrian/README.md">README.md</a> - markdown source for index.html</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1992/adrian/.entry.json">.entry.json</a> - description of entry in JSON</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1992/adrian/.gitignore">.gitignore</a> - list of files that should not be committed under git</li>
<li><a href=".path">.path</a> - directory path from top directory</li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
<!-- END: this line ends content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
<!-- START: this line starts content from: inc/after-content.default.html -->
<!-- END: this line ends content from: inc/after-content.default.html -->
<!-- START: this line starts content from: inc/end-rightcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/end-row.default.html -->
</div>
<!-- END: this line ends content from: inc/end-row.default.html -->
<!-- START: this line starts content from: inc/footer.default.html -->
<!--
Copyright © 1984-2024 by Landon Curt Noll. All Rights Reserved.
You are free to share and adapt this file under the terms of this license:
Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
For more information, see:
https://creativecommons.org/licenses/by-sa/4.0/
-->
<div class="footer">
<h2>Copyright and CC BY-SA 4.0 License</h2>
<p>This file and web page is:</p>
<blockquote><b>Copyright &copy; 1984-2024 by Landon Curt Noll. All Rights Reserved.</b></p></blockquote>
<p>You are free to share and adapt this file under the terms of this license:</p>
<blockquote><b>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</b></blockquote>
<p>For more information, see:</p>
<blockquote><a
href="https://creativecommons.org/licenses/by-sa/4.0/">https://creativecommons.org/licenses/by-sa/4.0/</a></blockquote>
<h2>Coda</h2>
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F1992%2Fadrian%2Findex.html">Nu HTML check this web page</a></p>
<p><a href="#top">Jump to top</a> <a href="#content">Jump to Content</a> <a href="#inventory">Jump to Inventory</a></p>
</div>
<!-- END: this line ends content from: inc/footer.default.html -->
<!-- START: this line starts content from: inc/bottom.default.html -->
</body>
</html>
<!-- END: this line ends content from: inc/bottom.default.html -->