build index.html for all winners
Updated manifest as per recent file changes. Updated winner `.winner.json` to reflect the manifest changes. Added [bin/all_run.sh](bin/all_run.sh) tool to run a command over all winning entries. These tools had slight improvements in the help usage message: * bin/gen-author.sh VERSION="1.3.1 2024-01-16" * bin/gen-inventory.sh VERSION="1.0.1 2024-01-16" * bin/pandoc_wrapper.sh VERSION="1.3.1 2024-01-16" * bin/subst.default.sh VERSION="1.1.1 2024-01-16" * bin/subst.winner-index.sh VERSION="1.1.1 2024-01-16" The `bin/readme2index.sh` tool was improved so that if the `index.html` file exists and the tool forms the exact same content, then the file `index.html` file is NOT touched. * bin/readme2index.sh VERSION="1.1 2024-01-16" We used the following command to generate `index.html` files for all winning entries: ```sh bin/all_run.sh -v 3 bin/readme2index.sh ``` NOTE: We have not (yet) built HTML files above the winner directory level (e.g., no year level nor top level HTML), nor have be built non-index HTML files for winners. NOTE: By default we are running `pandoc(1)` with: ``` --fail-if-warnings=true ``` This means that any problems with markdown to HTML generates an error. This is done to be sure that the HTML conversion is clean. We had to fix the following `README.md` files: * `2000/rince/README.md` The reference [^2] was never used. We made a guess that [^2] applies to the same spot as [^1]. Perhaps there is a better spot where [^2] applies? NOTE: For every reference, there MUST be some place where that reference is used. * 2012/vik/README.md The string "$...$" is assumed to be a TeX encoded string. NOTE: Every "$..$" needs to be backslashed as in "\$..\$". * 2018/burton1/README.md The reference [2] was duplicated. We changed the second [2] to [3]. NOTE: Every reference needs to have a unique number. * 2020/carlini/README.md The string "$...$" is assumed to be a TeX encoded string. NOTE: Every "$..$" needs to be backslashed as in "\$..\$". We also found 2 errors in the `author/author_handle.json` file set: * author/Anonymous_2001.json The `author/Anonymous_2001.json` file was missing. * author/Jari_Arkko.json The winner ID for `1989_jar.1` had a typo.
This commit is contained in:
1 parent
893cd915b6
commit
c1466f5165
350 files changed
+95242
-4217
No files matched your search
+301
-13
@@ -1,4 +1,6 @@
|
||||
<!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 -->
|
||||
<!-- -->
|
||||
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
|
||||
@@ -6,27 +8,313 @@
|
||||
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
|
||||
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||
<!-- -->
|
||||
<!-- file: 1990/tbr/index.html created by: fake.gen_index.sh version: 1.0.5 2023-10-31 -->
|
||||
<html lang="en">
|
||||
<!-- END: this line ends content from: inc/top.default.html -->
|
||||
<!-- -->
|
||||
<!-- This file was formed by the tool: bin/readme2index.sh version: 1.1 2024-01-16 -->
|
||||
<!-- -->
|
||||
<!-- START: this line starts content from: inc/head.default.html -->
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>1990 tbr</title>
|
||||
<meta name="description" content="IOCCC year: 1990 IOCCC winner: tbr winner index page">
|
||||
<meta name="keywords" content="IOCCC,1990,tbr,winner index page">
|
||||
<link rel="stylesheet" href="/temp-test-ioccc/ioccc.css">
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
<title>1990/tbr</title>
|
||||
<meta name="description" content="1990 IOCCC winner tbr">
|
||||
<meta name="keywords" content="IOCCC, 1990, IOCCC 1990, IOCCC winner, tbr">
|
||||
</head>
|
||||
|
||||
<!-- END: this line ends content from: inc/head.default.html -->
|
||||
<!-- START: this line starts content from: inc/body.default.html -->
|
||||
|
||||
<body>
|
||||
|
||||
<h1>1990 tbr</h1>
|
||||
<!-- END: this line ends content from: inc/body.default.html -->
|
||||
<!-- START: this line starts content from: inc/header.default.html -->
|
||||
|
||||
<p>XXX - fake content until readme2index is working - XXX</p>
|
||||
<div class="header">
|
||||
<img src="/temp-test-ioccc/png/ioccc.png" alt="IOCCC image by Matt Zucker" width=300 height=110>
|
||||
<h1>The International Obfuscated C Code Contest</h1>
|
||||
<h2>1990/tbr</h2>
|
||||
</div>
|
||||
|
||||
<hr style="width:50%;text-align:left;margin-left:0">
|
||||
<!-- END: this line ends content from: inc/header.default.html -->
|
||||
<!-- START: this line starts content from: inc/topnav.mid.html -->
|
||||
|
||||
<!-- Start Nu Html Checker -->
|
||||
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F1990%2Ftbr%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/1990/tbr/index.html</a></p>
|
||||
<!-- End Nu Html Checker -->
|
||||
<div class="topnav">
|
||||
<a class="Left" href="../stig/index.html">← stig</a>
|
||||
<a class="Left" href="../index.html">↑ 1990 ↑</a>
|
||||
<a class="Left" href="../theorem/index.html">theorem →</a>
|
||||
<a class="Right" href="#inventory">Inventory</a>
|
||||
</div>
|
||||
|
||||
<!-- END: this line ends content from: inc/topnav.mid.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="/temp-test-ioccc/index.html">IOCCC Home</a>
|
||||
<a href="/temp-test-ioccc/years.html">Winning Entries</a>
|
||||
<a href="/temp-test-ioccc/winners.html">People who have won</a>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="sidenav">
|
||||
<a href="/temp-test-ioccc/news.html">IOCCC News</a>
|
||||
<a href="/temp-test-ioccc/faq.html#submit">How to enter the IOCCC</a>
|
||||
<a href="/temp-test-ioccc/faq.html">FAQ</a>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="sidenav">
|
||||
<a href="/temp-test-ioccc/bugs.html">Bugs & (mis)features</a>
|
||||
<a href="/temp-test-ioccc/faq.html#fix_a_winner">Fixing IOCCC winners</a>
|
||||
<a href="/temp-test-ioccc/faq.html#fix_web_site">Fixing the web site</a>
|
||||
<a href="/temp-test-ioccc/faq.html#fix_author">Fixing winner info</a>
|
||||
<a href="/temp-test-ioccc/thanks-for-help.html">Thanks for the help</a>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="sidenav">
|
||||
<a href="/temp-test-ioccc/judges.html">The IOCCC Judges</a>
|
||||
<a href="/temp-test-ioccc/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 generated by: bin/gen-author.sh -->
|
||||
|
||||
<p><a name="author"><strong>Authors:</strong></a> <br><br>Name: <a
|
||||
href="/temp-test-ioccc/winners.html#Byron_Rakitzis">Byron
|
||||
Rakitzis</a><br> Location: <a
|
||||
href="/temp-test-ioccc/location.html#US">US</a> <br><br>Name: <a
|
||||
href="/temp-test-ioccc/winners.html#Sean_Dorward">Sean Dorward</a><br>
|
||||
Location: <a href="/temp-test-ioccc/location.html#null">unknown</a></p>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/gen-author.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>
|
||||
<p>The authors provided another version of this program. See the <a
|
||||
href="#alternate-code">alternate version</a> section below.</p>
|
||||
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
|
||||
<p>The current status of this entry is:</p>
|
||||
<pre><code>STATUS: INABIAF - please **DO NOT** fix</code></pre>
|
||||
<p>For more detailed information see <a href="/bugs.md#1990-tbr">1990
|
||||
tbr in bugs.md</a>.</p>
|
||||
<h3 id="a-note-about-the-fixes-of-this-entry-in-2023">A note about the
|
||||
fixes of this entry in 2023:</h3>
|
||||
<p>In 2023 it was noticed that in some systems like macOS there was
|
||||
confusing output due to a warning at runtime that was interspersed with
|
||||
the output of the program. For instance it would show:</p>
|
||||
<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">./tbr</span></span>
|
||||
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> warning: this program uses gets<span class="er">(</span><span class="kw">)</span><span class="ex">,</span> which is unsafe.</span></code></pre></div>
|
||||
<p>which kind of hid the prompt. Thus the entry was changed to use
|
||||
<code>fgets(3)</code> which is referred to later in this file.</p>
|
||||
<p>Also <code>exit(3)</code> returns <code>void</code> but the entry was
|
||||
using it in a binary expression so this entry would not compile in
|
||||
modern systems. This fix is also referred to below, in the <a
|
||||
href="#alternate-code">alternate version</a> section.</p>
|
||||
<h2 id="to-use">To use:</h2>
|
||||
<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">./tbr</span></span>
|
||||
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> enter some shell commands</span></code></pre></div>
|
||||
<p>NOTE: globs do not work with this entry. Why?</p>
|
||||
<p>NOTE: <code>exit</code> does not work and neither does
|
||||
<code>logout</code>. To exit try sending ctrl-d or ctrl-c (or kill it
|
||||
from another terminal :-) ). But why does it not work with just
|
||||
<code>exit</code> or <code>logout</code>? Hint: see the authors’
|
||||
remarks.</p>
|
||||
<h2 id="try">Try:</h2>
|
||||
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./tbr</span></span>
|
||||
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> ls <span class="at">-l</span> tbr tbr.c</span>
|
||||
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb5-4"><a href="#cb5-4" aria-hidden="true" tabindex="-1"></a><span class="co"># notice how the following does not work:</span></span>
|
||||
<span id="cb5-5"><a href="#cb5-5" aria-hidden="true" tabindex="-1"></a><span class="fu">ls</span> tbr<span class="pp">*</span></span>
|
||||
<span id="cb5-6"><a href="#cb5-6" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb5-7"><a href="#cb5-7" aria-hidden="true" tabindex="-1"></a><span class="co"># try figuring out how this entry works in an editor:</span></span>
|
||||
<span id="cb5-8"><a href="#cb5-8" aria-hidden="true" tabindex="-1"></a><span class="fu">vi</span> tbr.c</span>
|
||||
<span id="cb5-9"><a href="#cb5-9" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb5-10"><a href="#cb5-10" aria-hidden="true" tabindex="-1"></a><span class="co"># then figure out how to exit vi :-)</span></span></code></pre></div>
|
||||
<p>What happens if you try using <code>cd -</code> to return to previous
|
||||
directory? What about <code>cd</code> with no args?</p>
|
||||
<p>The authors include a section called <a href="#bugs">BUGS</a> that,
|
||||
because they were documented, are not considered bugs as such in the
|
||||
context of the contest.</p>
|
||||
<h2 id="alternate-code">Alternate code:</h2>
|
||||
<p>The authors supplied us with a slightly smaller unformatted version
|
||||
of the program which we include below:</p>
|
||||
<div class="sourceCode" id="cb6"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="pp">#define D </span><span class="op">,</span><span class="pp">close</span><span class="op">(</span></span>
|
||||
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a><span class="dt">char</span><span class="op">*</span>c<span class="op">,</span>q<span class="op">[</span><span class="dv">512</span><span class="op">],</span>m<span class="op">[</span><span class="dv">256</span><span class="op">],*</span>v<span class="op">[</span><span class="dv">99</span><span class="op">],**</span>u<span class="op">,*</span>i<span class="op">[</span><span class="dv">3</span><span class="op">];</span><span class="dt">int</span> f<span class="op">[</span><span class="dv">2</span><span class="op">],</span>p<span class="op">;</span>main<span class="op">(){</span><span class="cf">for</span><span class="op">(</span>m<span class="op">[</span>m<span class="op">[</span><span class="dv">60</span><span class="op">]=</span>m<span class="op">[</span><span class="dv">62</span><span class="op">]=</span></span>
|
||||
<span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a><span class="dv">32</span><span class="op">]=</span>m<span class="op">[*</span>m<span class="op">=</span><span class="dv">124</span><span class="op">[</span>m<span class="op">]=</span><span class="dv">9</span><span class="op">]=</span><span class="dv">6</span><span class="op">;</span>e<span class="op">(-</span><span class="dv">8</span><span class="op">),</span>gets<span class="op">(</span><span class="dv">1</span><span class="op">+(</span>c<span class="op">=</span>q<span class="op">))||(</span>exit<span class="op">(</span><span class="dv">0</span><span class="op">),</span><span class="dv">0</span><span class="op">);</span>r<span class="op">(</span><span class="dv">0</span><span class="op">,</span><span class="dv">0</span><span class="op">))</span><span class="cf">for</span><span class="op">(;*++</span>c<span class="op">;);}</span></span>
|
||||
<span id="cb6-4"><a href="#cb6-4" aria-hidden="true" tabindex="-1"></a>r<span class="op">(</span>t<span class="op">,</span>o<span class="op">){*</span>i<span class="op">=</span>i<span class="op">[</span><span class="dv">2</span><span class="op">]=</span><span class="dv">0</span><span class="op">;</span><span class="cf">for</span><span class="op">(</span>u<span class="op">=</span>v<span class="op">+</span><span class="dv">98</span><span class="op">;</span>m<span class="op">[*--</span>c<span class="op">]^</span><span class="dv">9</span><span class="op">;</span>m<span class="op">[*</span>c<span class="op">]&</span><span class="dv">32</span><span class="op">?</span>i<span class="op">[*</span>c<span class="op">&</span><span class="dv">2</span><span class="op">]=</span></span>
|
||||
<span id="cb6-5"><a href="#cb6-5" aria-hidden="true" tabindex="-1"></a><span class="op">*</span>u<span class="op">,</span>u<span class="op">-</span>v<span class="op">^</span><span class="dv">98</span><span class="op">&&++</span>u<span class="op">:</span><span class="dv">3</span><span class="op">)</span><span class="cf">if</span><span class="op">(!</span>m<span class="op">[*</span>c<span class="op">]){</span><span class="cf">for</span><span class="op">(*++</span>c<span class="op">=</span><span class="dv">0</span><span class="op">;!</span>m<span class="op">[*--</span>c<span class="op">];);*--</span>u<span class="op">=</span></span>
|
||||
<span id="cb6-6"><a href="#cb6-6" aria-hidden="true" tabindex="-1"></a><span class="op">++</span>c<span class="op">;}</span>u<span class="op">-</span>v<span class="op">^</span><span class="dv">98</span><span class="op">?</span>strcmp<span class="op">(*</span>u<span class="op">,</span><span class="st">"cd"</span><span class="op">)?*</span>c<span class="op">?</span>pipe<span class="op">(</span>f<span class="op">),</span>o<span class="op">=</span>f<span class="op">[</span><span class="dv">1</span><span class="op">]:</span><span class="dv">1</span><span class="op">,(</span>p<span class="op">=</span>fork<span class="op">())?</span>e<span class="op">(</span>p<span class="op">),</span>o<span class="op">?</span></span>
|
||||
<span id="cb6-7"><a href="#cb6-7" aria-hidden="true" tabindex="-1"></a>r<span class="op">(</span>o<span class="op">,</span><span class="dv">0</span><span class="op">)</span>D o<span class="op">)</span>D<span class="op">*</span>f<span class="op">):</span><span class="dv">4</span><span class="op">,</span>wait<span class="op">(</span><span class="dv">0</span><span class="op">):(</span>o<span class="op">?</span>dup2<span class="op">(*</span>f<span class="op">,</span><span class="dv">0</span><span class="op">)</span>D<span class="op">*</span>f<span class="op">)</span>D o<span class="op">):*</span>i<span class="op">?</span><span class="dv">1</span> D</span>
|
||||
<span id="cb6-8"><a href="#cb6-8" aria-hidden="true" tabindex="-1"></a><span class="dv">0</span><span class="op">),</span>e<span class="op">(</span>open<span class="op">(*</span>i<span class="op">,</span><span class="dv">0</span><span class="op">)):</span><span class="dv">5</span><span class="op">,</span>t<span class="op">?</span>dup2<span class="op">(</span>t<span class="op">,</span><span class="dv">1</span><span class="op">)</span>D t<span class="op">):</span>i<span class="op">[</span><span class="dv">2</span><span class="op">]?</span><span class="dv">9</span> D</span>
|
||||
<span id="cb6-9"><a href="#cb6-9" aria-hidden="true" tabindex="-1"></a><span class="dv">1</span><span class="op">),</span>e<span class="op">(</span>creat<span class="op">(</span>i<span class="op">[</span><span class="dv">2</span><span class="op">],</span><span class="dv">438</span><span class="op">)):</span><span class="dv">2</span><span class="op">,</span>e<span class="op">(</span>execvp<span class="op">(*</span>u<span class="op">,</span>u<span class="op">))):</span>e<span class="op">(</span>chdir<span class="op">(</span>u<span class="op">[</span><span class="dv">1</span><span class="op">])*</span><span class="dv">2</span><span class="op">):</span><span class="dv">6</span><span class="op">;}</span></span>
|
||||
<span id="cb6-10"><a href="#cb6-10" aria-hidden="true" tabindex="-1"></a>e<span class="op">(</span>x<span class="op">){</span>x<span class="op"><</span><span class="dv">0</span><span class="op">?</span>write<span class="op">(</span><span class="dv">2</span><span class="op">,</span><span class="st">"?</span><span class="sc">\n</span><span class="st">$ "</span><span class="op">-</span>x<span class="op">/</span><span class="dv">4</span><span class="op">,</span><span class="dv">2</span><span class="op">),</span>x<span class="op">+</span><span class="dv">1</span><span class="op">||(</span>exit<span class="op">(</span><span class="dv">1</span><span class="op">),</span><span class="dv">0</span><span class="op">):</span><span class="dv">5</span><span class="op">;}</span></span></code></pre></div>
|
||||
<p>and in the <a href="tbr.alt.c">alternate source</a>. It has the
|
||||
<code>exit()</code> returns <code>void</code> fix as well as the
|
||||
<code>gets()</code> to <code>fgets()</code> fix applied to it to make it
|
||||
functionally equivalent like the authors intended.</p>
|
||||
<h3 id="alternate-build">Alternate build:</h3>
|
||||
<div class="sourceCode" id="cb7"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> alt</span></code></pre></div>
|
||||
<h3 id="alternate-use">Alternate use:</h3>
|
||||
<div class="sourceCode" id="cb8"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./tbr.alt</span></span></code></pre></div>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>This program touches on a well known Unix utility, the 6th edition
|
||||
Bourne Shell (<code>/bin/sh</code>), whose original source was
|
||||
considered to be extremely obfuscated by many people (although Steve
|
||||
Bourne might disagree). Did you know that the Bourne Shell source was a
|
||||
major inspiration for the formation of the IOCCC back in 1984?</p>
|
||||
<h2 id="authors-remarks">Authors’ remarks:</h2>
|
||||
<p>This program is a rudimentary shell. It does I/O redirection, pipes
|
||||
and cd. It flags errors on failed <code>chdir()</code>,
|
||||
<code>open()</code>, <code>creat()</code>, <code>execvp()</code>,
|
||||
<code>fork()</code> and a few syntax errors.</p>
|
||||
<p>This program is obfuscated in a few notable ways: apart from the
|
||||
layout (an unformatted (but crunched) version is included for people who
|
||||
want to put this through <code>cb</code>) it makes clever use of a
|
||||
<code>write()</code> statement, so that the same statement can be used
|
||||
to print errors and the prompt. By calling the error function with the
|
||||
value <code>-8</code>, the pointer offset in the expression
|
||||
<code>"?\n$ "-x/4</code> goes from 0 to 2. Presto! A prompt. For errors
|
||||
with numbers smaller than <code>-4</code> (i.e., UNIX system calls) a
|
||||
question mark is printed.</p>
|
||||
<p>The error value of <code>chdir()</code> is doubled so that we don’t
|
||||
exit from the parent shell on a <code>chdir()</code> error (since
|
||||
<code>e()</code> exits on <code>-1</code> errors only). All other system
|
||||
call failures exit since they are from sub-shells.</p>
|
||||
<p>Recursion is sneakily employed to avoid a second call to
|
||||
<code>fork()</code>, and the line is parsed in a fairly bizarre fashion:
|
||||
backwards. The heart of the program, that is, the part which performs
|
||||
all <code>fork()</code>s, <code>exec()</code>s, <code>open()</code>s,
|
||||
etc. is ONE C STATEMENT.</p>
|
||||
<p>The meta-values array is initialized in a bizarre fashion, and the
|
||||
subsequent checks for the <code>'<'</code> and <code>'>'</code>
|
||||
are performed in a single statement using a mask, since you know that
|
||||
<code>'>'&2</code> is 0, whereas <code>'<'&2</code> is 2.
|
||||
Other such micro-obfuscations abound.</p>
|
||||
<p>Finally, it is notable that the code was hacked for minimality. If
|
||||
you look at the compressed version, you will be hard-pressed to
|
||||
eliminate more than a few characters (we can’t see how to make it any
|
||||
smaller!). 550 characters is pretty lean for a shell that does this
|
||||
much.</p>
|
||||
<h3 id="bugs">BUGS</h3>
|
||||
<p>The syntax of the shell has not been fully explored, but if you try
|
||||
to redirect in the same direction more than once, only one redirection
|
||||
is performed. This is a “feature” of the way the line is parsed; a
|
||||
pointer to the stack of arguments is assigned and an argument is stolen
|
||||
every time a <code>></code> or <code><</code> is encountered. The
|
||||
shell flags an error if no arguments are on the stack. Thus, for
|
||||
example:</p>
|
||||
<div class="sourceCode" id="cb9"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="fu">cat</span> <span class="op">></span> foo <span class="op">></span> bar</span></code></pre></div>
|
||||
<p>cats to <code>foo</code>, since it was pushed last, but</p>
|
||||
<div class="sourceCode" id="cb10"><pre
|
||||
class="sourceCode sh"><code class="sourceCode bash"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a><span class="fu">cat</span> <span class="op">></span> <span class="op">></span> foo bar</span></code></pre></div>
|
||||
<p>cats to <code>bar</code>, since <code>bar</code> was pushed under
|
||||
<code>foo</code> (remember we’re parsing right-left).</p>
|
||||
<p>Depending on your flavor of Unix, <code>cd</code> without an argument
|
||||
will either produce an error or just do nothing.</p>
|
||||
<p>There is just one error message, the question mark, but hey, that’s
|
||||
all <code>ed(1)</code> does too.</p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
|
||||
License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
|
||||
Reserved. You are free to share and adapt this file under the terms of
|
||||
this license:</p>
|
||||
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
|
||||
<p>For more information, see:
|
||||
https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
<!-- START: this line starts content generated by: bin/gen-inventory.sh -->
|
||||
|
||||
<h1 id="inventory-for-1990tbr"><a name="inventory"></a>Inventory for
|
||||
1990/tbr</h1>
|
||||
<h2 id="primary-files">Primary files</h2>
|
||||
<ul>
|
||||
<li><a href="index.html">index.html</a> - winner home page</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1990/tbr/tbr.c">tbr.c</a>
|
||||
- winning source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1990/tbr/Makefile">Makefile</a>
|
||||
- winner Makefile</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1990/tbr/tbr.alt.c">tbr.alt.c</a>
|
||||
- alternative source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1990/tbr/tbr.orig.c">tbr.orig.c</a>
|
||||
- original source</li>
|
||||
<li><a href="1990_tbr.tar.bz2">1990_tbr.tar.bz2</a> - download winning
|
||||
source</li>
|
||||
</ul>
|
||||
<h2 id="secondary-files">Secondary files</h2>
|
||||
<ul>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1990/tbr/.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>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1990/tbr/.winner.json">.winner.json</a>
|
||||
- description of winner in JSON</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1990/tbr/README.md">README.md</a>
|
||||
- markdown source for index.html</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/gen-inventory.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 -->
|
||||
|
||||
<div class="footer">
|
||||
<hr>
|
||||
<h2>Coda</h2>
|
||||
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F1990%2Ftbr%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 -->
|
||||
Reference in new issue
Block a user