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:
Landon Curt Noll committed 2024-01-17 00:32:39 -08:00
1 parent 893cd915b6
commit c1466f5165
350 files changed
+95242 -4217

No files matched your search

+394 -13
View File
@@ -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,406 @@
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- file: 2018/burton1/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>2018 burton1</title>
<meta name="description" content="IOCCC year: 2018 IOCCC winner: burton1 winner index page">
<meta name="keywords" content="IOCCC,2018,burton1,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>2018/burton1</title>
<meta name="description" content="2018 IOCCC winner burton1">
<meta name="keywords" content="IOCCC, 2018, IOCCC 2018, IOCCC winner, burton1">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<h1>2018 burton1</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>2018/burton1</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%2F2018%2Fburton1%2Findex.html">Nu Html check https://ioccc-src.github.io/temp-test-ioccc/2018/burton1/index.html</a></p>
<!-- End Nu Html Checker -->
<div class="topnav">
<a class="Left" href="../bellard/index.html">&larr; bellard</a>
<a class="Left" href="../index.html">&uarr; 2018 &uarr;</a>
<a class="Left" href="../burton2/index.html">burton2 &rarr;</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 &amp; (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>Author:</strong></a> <br><br>Name: <a
href="/temp-test-ioccc/winners.html#Dave_Burton">Dave Burton</a><br>
Location: <a href="/temp-test-ioccc/location.html#US">US</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></span></code></pre></div>
<p>There is an alternate version of this entry. See <a
href="#alternate-code">Alternate code</a> below.</p>
<h2 id="to-use">To use:</h2>
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> <span class="op">&lt;</span> any-file</span></code></pre></div>
<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>
<h2 id="alternate-code">Alternate code:</h2>
<p>An alternate version of this entry, <a
href="prog.alt.c">prog.alt.c</a>, is provided This alternate code was
supposed to compile without warnings, however with modern compilers this
is no longer the case so it will only cleanly compile with
<code>-Wno-</code> options.</p>
<h3 id="alternate-build">Alternate build:</h3>
<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="fu">make</span> alt</span></code></pre></div>
<h3 id="alternate-use">Alternate use:</h3>
<p>Use <code>prog.alt</code> as you would <code>prog</code>.</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>One line, one array, one loop and one statement but it prints many
bytes. It won.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p>Feed this anything on <code>stdin</code>.</p>
<p>The <a href="scripthd.sh">included script.sh</a> may be used as a
driver program for this entry. It adds several nice-to-have features,
and allows salt-to-taste customizability.</p>
<p>This code has been compiled and tested on:</p>
<ul>
<li>OSX-10.11, gcc 4.2.1 and clang 3.0, -O0 and -O3</li>
<li>X86-Linux, gcc 4.1.2 and 4.8.4, -O0 and -O3</li>
<li>ARM-QEMU, gcc 4.8.4, -O0 and -O3</li>
<li>X86-FreeBSD 10.3, clang 3.4.1, -O0 and -O3</li>
<li>TCC 0.9.26 (x86-64) (used as a proxy for <a
href="/years.html#2001_bellard">2001/bellard</a>)</li>
<li>UNIX V7 pcc (Johnson’s C compiler) on a <a
href="http://simh.trailing-edge.com/">simulated PDP-11/45</a> (see
spoiler for further detail)</li>
</ul>
<div style="margin-bottom:60em;margin-top:4em">
<strong>Spoiler below; scroll down.</strong>
</div>
<h3 id="spoiler">SPOILER:</h3>
<p>This started life as a personal challenge: write the shortest hex
dump utility in C.</p>
<p>The self-imposed ground rules in the hunt for shortest:</p>
<ul>
<li>The code has to output correctly.</li>
<li>No extraneous newlines, the code must be portable, and without
bypassing the solution using <code>execve(2)</code>, or functions built
upon it (<code>system(3)</code>, <code>popen(3)</code>, etc).</li>
</ul>
<p>E.g:</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a>main<span class="op">(){</span>system<span class="op">(</span><span class="st">&quot;hd&quot;</span><span class="op">);}</span> <span class="co">// it&#39;s turtles all the way down!</span></span></code></pre></div>
<p>is not acceptable.</p>
<p>And, “output correctly” is the output format of this entry. QED.</p>
<p>Early attempts ended up at a reasonably short 157 characters. This
was too long for a one-liner, so it had to be formatted as something
more interesting. This solution is pleasing, but a true one-liner was
the hoped-for goal. Here is the 157 character version in it’s
entirety:</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="dt">char</span> O<span class="op">,</span>o<span class="op">[</span> <span class="dv">20</span><span class="op">];</span>L<span class="op">(</span>O<span class="op">){</span></span>
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a>putchar <span class="op">(</span> O<span class="op">+</span> <span class="dv">48</span><span class="op">+</span><span class="dv">39</span> <span class="op">*(</span><span class="dv">9</span><span class="op">&lt;</span></span>
<span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a>O<span class="op">));}</span> I<span class="op">(</span>O<span class="op">)</span> <span class="op">{</span>L<span class="op">(~</span> <span class="dv">15</span><span class="op">);</span></span>
<span id="cb6-4"><a href="#cb6-4" aria-hidden="true" tabindex="-1"></a>O<span class="op">||</span> puts<span class="op">(</span>o<span class="op">);}</span> main <span class="op">(</span>l<span class="op">){</span></span>
<span id="cb6-5"><a href="#cb6-5" aria-hidden="true" tabindex="-1"></a><span class="cf">for</span><span class="op">(;~(</span>l<span class="op">=</span>getchar<span class="op">())</span> <span class="op">;</span>I<span class="op">(</span>O</span>
<span id="cb6-6"><a href="#cb6-6" aria-hidden="true" tabindex="-1"></a><span class="op">&amp;=</span><span class="dv">15</span> <span class="op">))</span>o<span class="op">[</span> O<span class="op">++</span> <span class="op">]=</span><span class="dv">4</span><span class="op">&lt;</span></span>
<span id="cb6-7"><a href="#cb6-7" aria-hidden="true" tabindex="-1"></a><span class="op">(</span><span class="dv">4</span><span class="op">^</span>l <span class="op">&gt;&gt;</span><span class="dv">5</span><span class="op">)</span> <span class="op">?</span>l<span class="op">:</span> <span class="dv">46</span><span class="op">,</span>L</span>
<span id="cb6-8"><a href="#cb6-8" aria-hidden="true" tabindex="-1"></a><span class="op">(</span>l<span class="op">&gt;&gt;</span> <span class="dv">4</span><span class="op">),</span>L <span class="op">(</span>l<span class="op">&amp;</span><span class="dv">15</span><span class="op">);</span>O<span class="op">&amp;&amp;</span></span>
<span id="cb6-9"><a href="#cb6-9" aria-hidden="true" tabindex="-1"></a>I<span class="op">(</span>o<span class="op">[</span> O<span class="op">]=</span><span class="dv">0</span> <span class="op">);}</span><span class="co">//157c</span></span></code></pre></div>
<p>While thinking about this in the shower (you are not the only one
that does this!) came the idea which reduced the code to just 119 chars.
This dramatic reduction started to feel close to minimal, and the hunt
resumed. The progression to the present size is interesting, and it is
interesting that the same algorithm can be expressed so differently by
slight rearrangement of its parts.</p>
<div class="sourceCode" id="cb7"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a><span class="co">// 119</span></span>
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a><span class="dt">char</span> O<span class="op">,</span>o<span class="op">[</span><span class="dv">20</span><span class="op">];</span>main<span class="op">(</span>l<span class="op">){</span><span class="cf">for</span><span class="op">(;~(</span>l<span class="op">=</span>getchar<span class="op">());</span>O<span class="op">||</span>puts<span class="op">(</span>o<span class="op">))</span>o<span class="op">[</span>O<span class="op">++]=</span>isprint<span class="op">(</span>l<span class="op">)?</span>l<span class="op">:</span><span class="dv">46</span><span class="op">,</span>O<span class="op">&amp;=</span><span class="dv">15</span><span class="op">,</span>printf<span class="op">(</span><span class="st">&quot;</span><span class="sc">%02x</span><span class="st"> &quot;</span><span class="op">,</span>l<span class="op">);</span>O<span class="op">[</span>o<span class="op">]=</span><span class="dv">0</span><span class="op">;</span>O<span class="op">&amp;&amp;</span>puts<span class="op">(</span>o<span class="op">);}</span></span>
<span id="cb7-3"><a href="#cb7-3" aria-hidden="true" tabindex="-1"></a><span class="co">// 116</span></span>
<span id="cb7-4"><a href="#cb7-4" aria-hidden="true" tabindex="-1"></a><span class="dt">char</span> O<span class="op">,</span>o<span class="op">[</span><span class="dv">20</span><span class="op">];</span>main<span class="op">(</span>l<span class="op">){</span><span class="cf">for</span><span class="op">(;</span>O<span class="op">++[</span>o<span class="op">]=~(</span>l<span class="op">=</span>getchar<span class="op">())?</span><span class="dv">4</span><span class="op">&lt;(</span><span class="dv">4</span><span class="op">^</span>l<span class="op">&gt;&gt;</span><span class="dv">5</span><span class="op">)?</span>l<span class="op">:</span><span class="dv">46</span><span class="op">:</span><span class="dv">0</span><span class="op">;(</span>O<span class="op">&amp;=</span><span class="dv">15</span><span class="op">)||</span>puts<span class="op">(</span>o<span class="op">))</span>printf<span class="op">(</span><span class="st">&quot;</span><span class="sc">%02x</span><span class="st"> &quot;</span><span class="op">,</span>l<span class="op">);</span>O<span class="op">&gt;</span><span class="dv">1</span><span class="op">&amp;&amp;</span>puts<span class="op">(</span>o<span class="op">);}</span></span>
<span id="cb7-5"><a href="#cb7-5" aria-hidden="true" tabindex="-1"></a><span class="co">// 115</span></span>
<span id="cb7-6"><a href="#cb7-6" aria-hidden="true" tabindex="-1"></a><span class="dt">char</span> O<span class="op">,</span>o<span class="op">[</span><span class="dv">20</span><span class="op">];</span>main<span class="op">(</span>l<span class="op">){</span><span class="cf">for</span><span class="op">(;</span>O<span class="op">[</span>o<span class="op">]=~(</span>l<span class="op">=</span>getchar<span class="op">())?</span><span class="dv">4</span><span class="op">&lt;(</span><span class="dv">4</span><span class="op">^</span>l<span class="op">&gt;&gt;</span><span class="dv">5</span><span class="op">)?</span>l<span class="op">:</span><span class="dv">46</span><span class="op">:</span><span class="dv">0</span><span class="op">;(</span>O<span class="op">=-~</span>O<span class="op">&amp;</span><span class="dv">15</span><span class="op">)||</span>puts<span class="op">(</span>o<span class="op">))</span>printf<span class="op">(</span><span class="st">&quot;</span><span class="sc">%02x</span><span class="st"> &quot;</span><span class="op">,</span>l<span class="op">);</span>O<span class="op">&amp;&amp;</span>puts<span class="op">(</span>o<span class="op">);}</span></span>
<span id="cb7-7"><a href="#cb7-7" aria-hidden="true" tabindex="-1"></a><span class="co">// 113</span></span>
<span id="cb7-8"><a href="#cb7-8" aria-hidden="true" tabindex="-1"></a><span class="dt">char</span> O<span class="op">,</span>o<span class="op">[</span><span class="dv">20</span><span class="op">];</span>main<span class="op">(</span>l<span class="op">){</span><span class="cf">for</span><span class="op">(;~</span>l<span class="op">;(</span>O<span class="op">=~</span>l<span class="op">?</span>printf<span class="op">(</span><span class="st">&quot;</span><span class="sc">%02x</span><span class="st"> &quot;</span><span class="op">,</span>l<span class="op">),-~</span>O<span class="op">&amp;</span><span class="dv">15</span><span class="op">:!</span>O<span class="op">)||</span>puts<span class="op">(</span>o<span class="op">))</span>O<span class="op">[</span>o<span class="op">]=~(</span>l<span class="op">=</span>getchar<span class="op">())?</span><span class="dv">4</span><span class="op">&lt;(</span><span class="dv">4</span><span class="op">^</span>l<span class="op">&gt;&gt;</span><span class="dv">5</span><span class="op">)?</span>l<span class="op">:</span><span class="dv">46</span><span class="op">:</span><span class="dv">0</span><span class="op">;}</span></span>
<span id="cb7-9"><a href="#cb7-9" aria-hidden="true" tabindex="-1"></a><span class="co">// 112</span></span>
<span id="cb7-10"><a href="#cb7-10" aria-hidden="true" tabindex="-1"></a><span class="dt">char</span> O<span class="op">,</span>o<span class="op">[</span><span class="dv">20</span><span class="op">];</span>main<span class="op">(</span>l<span class="op">){</span><span class="cf">for</span><span class="op">(;~</span>l<span class="op">;(</span>O<span class="op">=~</span>l<span class="op">?-~</span>O<span class="op">&amp;</span>printf<span class="op">(</span><span class="st">&quot;</span><span class="sc">%02x</span><span class="st"> &quot;</span><span class="op">,</span>l<span class="op">)*</span><span class="dv">5</span><span class="op">:!</span>O<span class="op">)||</span>puts<span class="op">(</span>o<span class="op">))</span>O<span class="op">[</span>o<span class="op">]=~(</span>l<span class="op">=</span>getchar<span class="op">())?</span><span class="dv">4</span><span class="op">&lt;(</span><span class="dv">4</span><span class="op">^</span>l<span class="op">&gt;&gt;</span><span class="dv">5</span><span class="op">)?</span>l<span class="op">:</span><span class="dv">46</span><span class="op">:</span><span class="dv">0</span><span class="op">;}</span></span>
<span id="cb7-11"><a href="#cb7-11" aria-hidden="true" tabindex="-1"></a><span class="co">// 111</span></span>
<span id="cb7-12"><a href="#cb7-12" aria-hidden="true" tabindex="-1"></a><span class="dt">char</span> O<span class="op">,</span>o<span class="op">[</span><span class="dv">20</span><span class="op">];</span>main<span class="op">(</span>l<span class="op">){</span><span class="cf">for</span><span class="op">(;~</span>l<span class="op">;</span>O<span class="op">||</span>puts<span class="op">(</span>o<span class="op">))</span>O<span class="op">=(</span>O<span class="op">[</span>o<span class="op">]=~(</span>l<span class="op">=</span>getchar<span class="op">())?</span><span class="dv">4</span><span class="op">&lt;(</span><span class="dv">4</span><span class="op">^</span>l<span class="op">&gt;&gt;</span><span class="dv">5</span><span class="op">)?</span>l<span class="op">:</span><span class="dv">46</span><span class="op">:</span><span class="dv">0</span><span class="op">)?-~</span>O<span class="op">&amp;</span>printf<span class="op">(</span><span class="st">&quot;</span><span class="sc">%02x</span><span class="st"> &quot;</span><span class="op">,</span>l<span class="op">)*</span><span class="dv">5</span><span class="op">:!</span>O<span class="op">;}</span></span>
<span id="cb7-13"><a href="#cb7-13" aria-hidden="true" tabindex="-1"></a><span class="co">// 110</span></span>
<span id="cb7-14"><a href="#cb7-14" aria-hidden="true" tabindex="-1"></a><span class="dt">char</span> O<span class="op">,</span>o<span class="op">[</span><span class="dv">0</span><span class="op">];</span>main<span class="op">(</span>l<span class="op">){</span><span class="cf">for</span><span class="op">(;~</span>l<span class="op">;</span>O<span class="op">||</span>puts<span class="op">(</span>o<span class="op">))</span>O<span class="op">=(</span>O<span class="op">[</span>o<span class="op">]=~(</span>l<span class="op">=</span>getchar<span class="op">())?</span><span class="dv">4</span><span class="op">&lt;(</span><span class="dv">4</span><span class="op">^</span>l<span class="op">&gt;&gt;</span><span class="dv">5</span><span class="op">)?</span>l<span class="op">:</span><span class="dv">46</span><span class="op">:</span><span class="dv">0</span><span class="op">)?-~</span>O<span class="op">&amp;</span>printf<span class="op">(</span><span class="st">&quot;</span><span class="sc">%02x</span><span class="st"> &quot;</span><span class="op">,</span>l<span class="op">)*</span><span class="dv">5</span><span class="op">:!</span>O<span class="op">;}</span></span>
<span id="cb7-15"><a href="#cb7-15" aria-hidden="true" tabindex="-1"></a><span class="co">// 109</span></span>
<span id="cb7-16"><a href="#cb7-16" aria-hidden="true" tabindex="-1"></a><span class="dt">char</span> O<span class="op">,</span>o<span class="op">[];</span>main<span class="op">(</span>l<span class="op">){</span><span class="cf">for</span><span class="op">(;~</span>l<span class="op">;</span>O<span class="op">||</span>puts<span class="op">(</span>o<span class="op">))</span>O<span class="op">=(</span>O<span class="op">[</span>o<span class="op">]=~(</span>l<span class="op">=</span>getchar<span class="op">())?</span><span class="dv">4</span><span class="op">&lt;(</span><span class="dv">4</span><span class="op">^</span>l<span class="op">&gt;&gt;</span><span class="dv">5</span><span class="op">)?</span>l<span class="op">:</span><span class="dv">46</span><span class="op">:</span><span class="dv">0</span><span class="op">)?-~</span>O<span class="op">&amp;</span>printf<span class="op">(</span><span class="st">&quot;</span><span class="sc">%02x</span><span class="st"> &quot;</span><span class="op">,</span>l<span class="op">)*</span><span class="dv">5</span><span class="op">:!</span>O<span class="op">;}</span></span></code></pre></div>
<p>There are solutions without the ASCII sidebar that are significantly
shorter. These do not compete in the same category, since their output
is materially different. They are derived from the solutions above, but
are still fascinating as concise utilities, so here is their
progression, for the curious:</p>
<div class="sourceCode" id="cb8"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a><span class="co">// 102</span></span>
<span id="cb8-2"><a href="#cb8-2" aria-hidden="true" tabindex="-1"></a>I<span class="op">;</span>O<span class="op">(</span>O<span class="op">){</span>putchar<span class="op">(</span>O<span class="op">+</span><span class="dv">48</span><span class="op">+</span><span class="dv">39</span><span class="op">*(</span><span class="dv">9</span><span class="op">&lt;</span>O<span class="op">));}</span>main<span class="op">(</span>l<span class="op">){</span><span class="cf">for</span><span class="op">(;~(</span>l<span class="op">=</span>getchar<span class="op">());</span>O<span class="op">(++</span>I<span class="op">&amp;</span><span class="dv">15</span><span class="op">?~</span><span class="dv">15</span><span class="op">:~</span><span class="dv">37</span><span class="op">))</span>O<span class="op">(</span>l<span class="op">&gt;&gt;</span><span class="dv">4</span><span class="op">),</span>O<span class="op">(</span>l<span class="op">&amp;</span><span class="dv">15</span><span class="op">);</span>O<span class="op">(-</span><span class="dv">38</span><span class="op">);}</span></span>
<span id="cb8-3"><a href="#cb8-3" aria-hidden="true" tabindex="-1"></a><span class="co">// 80</span></span>
<span id="cb8-4"><a href="#cb8-4" aria-hidden="true" tabindex="-1"></a>O<span class="op">;</span>main<span class="op">(</span>l<span class="op">){</span><span class="cf">while</span><span class="op">(~(</span>l<span class="op">=</span>getchar<span class="op">()))</span>printf<span class="op">(</span><span class="st">&quot;</span><span class="sc">%02x%c</span><span class="st">&quot;</span><span class="op">,</span>l<span class="op">,++</span>O<span class="op">&amp;</span><span class="dv">15</span><span class="op">?</span><span class="dv">32</span><span class="op">:</span><span class="dv">10</span><span class="op">);</span>O<span class="op">&amp;</span><span class="dv">15</span><span class="op">&amp;&amp;</span>puts<span class="op">(</span><span class="st">&quot;&quot;</span><span class="op">);}</span></span>
<span id="cb8-5"><a href="#cb8-5" aria-hidden="true" tabindex="-1"></a><span class="co">// 78</span></span>
<span id="cb8-6"><a href="#cb8-6" aria-hidden="true" tabindex="-1"></a>O<span class="op">;</span>main<span class="op">(</span>l<span class="op">){</span><span class="cf">for</span><span class="op">(;~</span>l<span class="op">;(</span>O<span class="op">=~(</span>l<span class="op">=</span>getchar<span class="op">())?</span>printf<span class="op">(</span><span class="st">&quot;</span><span class="sc">%02x</span><span class="st"> &quot;</span><span class="op">,</span>l<span class="op">),-~</span>O<span class="op">&amp;</span><span class="dv">15</span><span class="op">:!</span>O<span class="op">)||</span>puts<span class="op">(</span><span class="st">&quot;&quot;</span><span class="op">));}</span></span>
<span id="cb8-7"><a href="#cb8-7" aria-hidden="true" tabindex="-1"></a><span class="co">// 77</span></span>
<span id="cb8-8"><a href="#cb8-8" aria-hidden="true" tabindex="-1"></a>O<span class="op">;</span>main<span class="op">(</span>l<span class="op">){</span><span class="cf">for</span><span class="op">(;~</span>l<span class="op">;(</span>O<span class="op">=~(</span>l<span class="op">=</span>getchar<span class="op">())?-~</span>O<span class="op">&amp;</span>printf<span class="op">(</span><span class="st">&quot;</span><span class="sc">%02x</span><span class="st"> &quot;</span><span class="op">,</span>l<span class="op">)*</span><span class="dv">5</span><span class="op">:!</span>O<span class="op">)||</span>puts<span class="op">(</span><span class="st">&quot;&quot;</span><span class="op">));}</span></span>
<span id="cb8-9"><a href="#cb8-9" aria-hidden="true" tabindex="-1"></a><span class="co">// 76</span></span>
<span id="cb8-10"><a href="#cb8-10" aria-hidden="true" tabindex="-1"></a>O<span class="op">;</span>main<span class="op">(</span>l<span class="op">){</span><span class="cf">for</span><span class="op">(;~</span>l<span class="op">;</span>O<span class="op">||</span>puts<span class="op">(&amp;</span>O<span class="op">))</span>O<span class="op">=~(</span>l<span class="op">=</span>getchar<span class="op">())?-~</span>O<span class="op">&amp;</span>printf<span class="op">(</span><span class="st">&quot;</span><span class="sc">%02x</span><span class="st"> &quot;</span><span class="op">,</span>l<span class="op">)*</span><span class="dv">5</span><span class="op">:!</span>O<span class="op">;}</span></span></code></pre></div>
<p>It is possible to reduce the size of each of these by one by eliding
the trailing newline. This was not reported above since the newline kept
getting appended by processing software, and it is more interesting to
remove characters by changing code than by filtering:</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="ex">$</span> tr <span class="at">-d</span> <span class="st">&#39;\012&#39;</span> <span class="op">&lt;</span> 109.c <span class="kw">|</span> <span class="fu">wc</span> <span class="at">-c</span></span>
<span id="cb9-2"><a href="#cb9-2" aria-hidden="true" tabindex="-1"></a><span class="ex">108</span></span>
<span id="cb9-3"><a href="#cb9-3" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> tr <span class="at">-d</span> <span class="st">&#39;\012&#39;</span> <span class="op">&lt;</span> 76.c <span class="kw">|</span> <span class="fu">wc</span> <span class="at">-c</span></span>
<span id="cb9-4"><a href="#cb9-4" aria-hidden="true" tabindex="-1"></a><span class="ex">75</span></span>
<span id="cb9-5"><a href="#cb9-5" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> tr <span class="at">-d</span> <span class="st">&#39;\012&#39;</span> <span class="op">&lt;</span> 109.c <span class="kw">|</span> <span class="fu">cc</span> <span class="at">-o</span> 108 <span class="at">-xc</span> <span class="at">-</span></span>
<span id="cb9-6"><a href="#cb9-6" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> verify 108</span>
<span id="cb9-7"><a href="#cb9-7" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span></span></code></pre></div>
<p>An obfuscated hex dump has been done before: <a
href="/1986/bright/README.md">1986/bright</a> is similar in function,
but it uses more characters in just setting up its obfuscation than this
entire solution!</p>
<h3 id="bigger-spoiler">BIGGER SPOILER:</h3>
<p>If you are unhappy with the way DEL (character 127) is handled,
replace the cryptic expression <code>4&lt;(4^l&gt;&gt;5)?l:46</code>
with <code>32&gt;l|l&gt;126?46:l</code>. Both take the same number of
characters, but the former is a bit more interesting. Bonus question:
how does the first expression work?</p>
<h3 id="biggest-spoiler-and-some-history">BIGGEST SPOILER (and some
history):</h3>
<p>Technically, <code>char o[0];</code> is illegal (SS 6.7.6.2)
according to ISO (N1570). And <code>char o[];</code> is a conditionally
supported feature (SS 6.7.6.2, 6.10.8.3). However, it works in modern C
implementations as an extension, including GCC, Clang and TCC, for X86
and ARM, on multiple operating systems (Linux, OSX/macOS, FreeBSD), so
it is <em>functionally</em> correct. MicroSoft Visual C++ does not allow
<code>char o[]</code> or <code>char o[0]</code>, and implements its
close relative <code>char o[1]</code> such that writing more than a
single char will cause a fault, which is <em>technically</em>
correct.</p>
<p>But how does this work at all, even as an extension? <code>o[]</code>
allocates one(!) byte in a zero-filled data area (formerly <a
href="https://en.wikipedia.org/wiki/.bss">BSS</a>). The UNIX-derived
systems this code was run upon all place the storage of <code>O</code>
and <code>o</code> into a zero-filled VM page with nothing following:
thus, there are plenty of available and unused zero bytes following
<code>O</code>, addressed via <code>o</code>, and this code only needs
17. This is <em>undefined</em> behavior, but as shown, it is widely
available.</p>
<p>The <a href="http://minnie.tuhs.org/cgi-bin/utree.pl">1979 Seventh
Edition UNIX</a> (v7) system pre-dates the IOCCC by several years, and
the source code to <code>sh</code>(1) was a <a
href="/all/README.md">significant inspiration for this contest</a>.
There are two C compilers present: <code>cc</code> written by Dennis
Ritchie, and <code>pcc</code> written by Steven Johnson. The nested
conditional expressions in 116 and smaller are too complex for
<code>cc</code> (“Illegal conditional”) but <code>pcc</code> handles
them correctly, and neither compiler accepts <code>char o[]</code> or
<code>char o[0]</code> and neither put the bytes in a zero-filled page
(as a paged VM was not yet written for UNIX).</p>
<p>More significant is that v7 <code>printf(3)</code> does not report
the number of characters written, and therefore 111 compiles but does
not work correctly; 113 is the shortest code that compiles and runs
correctly in Ancient UNIX.</p>
<p>Interesting digression: v7 <code>printf</code> (<code>_doprnt</code>)
was written in PDP-11 assembly. It pre-dates <code>varargs.h</code>, and
assembly was the only way to gain access to the variable argument types.
The first edition <em>The C Programming Language</em>, 1978, page 71,
remarks:</p>
<blockquote>
<p>By the way, there is no entirely satisfactory way to write a portable
function that accepts a variable number of arguments, because there is
no portable way for the called function to determine how many arguments
where actually passed to it in a given call. …<br />
<code>printf</code>, the most common C function with a variable number
of arguments, … is also non-portable and must be modified for different
environments.</p>
</blockquote>
<p>It is fascinating to explore the roots of C through the history of
the operating system it was birthed within. C is often criticized as a
difficult, inscrutable language, but as this contest demonstrates, this
is in parody. <em>Shell-gol</em> is one of those instances where someone
<a href="http://ioccc.org/all/README">preferred a different
language</a>, and (ab)used the preprocessor to re-mold C into something
they found comfortable. Most of the rest of the system, especially in
the kernel, are models of clarity and efficient expression.</p>
<h3 id="tldr">TL;DR:</h3>
<p>So which version is the shortest, portable hex dump?</p>
<ul>
<li>109 works with (most?) modern Unix-like systems and compilers, see
example list above.</li>
<li>111 works adds Microsoft, is standards-approved, and does not
exploit undefined behavior.</li>
<li>113 works on Ancient UNIX and the portable C compiler.</li>
<li>119 works on all platforms, including the original Ritchie PDP-11 C
compiler.</li>
</ul>
<h3 id="coda">Coda:</h3>
<p>Clearly, the smallest possible program violates modern best practice.
It is not even possible to compile cleanly, but it will compile
correctly.</p>
<p>Included is <a href="prog.alt.c">prog.alt.c</a>, a modern C
implementation that is – perhaps – the smallest, clean-compiling version
using <code>clang</code> or <code>gcc</code> with
<code>-Wall -pedantic</code>. Note that while this is larger than all
but the original attempt, it will <em>not</em> work with the original
Ritchie PDP-11 C compiler, since the expression within the ternary
remains too complex.</p>
<p>Try:</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> prog.c prog.alt.c</span></code></pre></div>
<p>or</p>
<div class="sourceCode" id="cb11"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a><span class="fu">cmp</span> <span class="at">-b</span> prog.c prog.alt.c</span></code></pre></div>
<p>to compare the differences (<code>diff</code> is not helpful on a
one-liner).</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-2018burton1"><a name="inventory"></a>Inventory for
2018/burton1</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/2018/burton1/prog.c">prog.c</a>
- winning source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton1/Makefile">Makefile</a>
- winner Makefile</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton1/prog.alt.c">prog.alt.c</a>
- alternative source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton1/prog.orig.c">prog.orig.c</a>
- original source</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton1/scripthd.sh">scripthd.sh</a>
- driver program - adds several nice-to-have features</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton1/try.sh">try.sh</a>
- how to run</li>
<li><a href="2018_burton1.tar.bz2">2018_burton1.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/2018/burton1/.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/2018/burton1/.winner.json">.winner.json</a>
- description of winner in JSON</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2018/burton1/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%2F2018%2Fburton1%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 -->