We improve the `inc/footer.default.html` file to make
the _Copyright and CC BY-SA 4.0 License_ clear.
We add `license.md` and generate `license.html` (via `make
gen_top_html`) so that key features and terms of the _Copyright and
CC BY-SA 4.0 License_ are accessible.
Add CC BY-SA 4.0 license images into the `png/` directory.
FYI: We use the license to allow the open use of IOCCC entry code,
and at the same time, we help ensure that those working on the IOCCC
have proper Attribution including, of course, the IOCCC winners
themselves! The _Copyright and CC BY-SA 4.0 License_ help ensure
that everyone may enjoy the IOCCC.
Added '#copyright' to all generated HTML pages so that the
_Copyright and CC BY-SA 4.0 License_ may be reached.
Changed `bin/gen-top-html.sh` VERSION from "1.2.2 2024-03-26"
to "1.2.3 2024-04-12".
Fix `bin/gen-sitemap.sh` to remove requirement of `ioccc.tar.bz2`.
Changed `bin/gen-sitemap.sh` VERSION from "1.3.4 2024-03-27"
to "1.3.5 2024-04-13".
Perform `make www sitemap` to perform the above.
We also give a _hint_ as to the next project.
TODO: Complete that next project we are _hinting_ at.
TODO: Review the work being done by a web designer to see
how their work might be incorporated into the web site.
364 lines
18 KiB
HTML
364 lines
18 KiB
HTML
<!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>1990/tbr - Best Utility</title>
|
||
<link rel="icon" type="image/x-icon" href="../../favicon.ico">
|
||
<meta name="description" content="1990 IOCCC entry tbr - Best Utility">
|
||
<meta name="keywords" content="IOCCC, 1990, IOCCC 1990, IOCCC entry, tbr, Best Utility">
|
||
</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: 1990/tbr/README.md -->
|
||
<!-- -->
|
||
|
||
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||
<!-- !!! Do not modify this web page, instead modify the file: 1990/tbr/README.md !!! -->
|
||
<!-- !!! Do not modify this web page, instead modify the file: 1990/tbr/README.md !!! -->
|
||
<!-- !!! Do not modify this web page, instead modify the file: 1990/tbr/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>1990/tbr - Best Utility</h2>
|
||
</div>
|
||
|
||
<!-- END: this line ends content from: inc/header.default.html -->
|
||
<!-- START: this line starts content from: inc/topnav.mid.html -->
|
||
|
||
<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="https://github.com/ioccc-src/temp-test-ioccc/1990/tbr/tbr.c">C code</a>
|
||
<a class="Right" href="https://github.com/ioccc-src/temp-test-ioccc/1990/tbr/Makefile">Makefile</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="../../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 & (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="authors"><a name="author"></a>Authors:</h2>
|
||
<ul>
|
||
<li>Name: <a href="../../authors.html#Byron_Rakitzis">Byron Rakitzis</a><br>
|
||
Location: <a href="../../location.html#US">US</a> - <em>United States of America</em> (<em>United States</em>)
|
||
<br><br></li>
|
||
<li>Name: <a href="../../authors.html#Sean_Dorward">Sean Dorward</a><br>
|
||
Location: <a href="../../location.html#ZZ">ZZ</a> - <em>Unknown location</em></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>
|
||
<pre class="<!---sh-->"><code> make all</code></pre>
|
||
<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.html#1990_tbr">1990 tbr bugs</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>
|
||
<pre class="<!---sh-->"><code> ./tbr
|
||
$ warning: this program uses gets(), which is unsafe.</code></pre>
|
||
<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>
|
||
<pre class="<!---sh-->"><code> ./tbr
|
||
$ enter some shell commands</code></pre>
|
||
<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>
|
||
<pre class="<!---sh-->"><code> ./tbr
|
||
$ ls -l tbr tbr.c
|
||
|
||
# notice how the following does not work:
|
||
ls tbr*
|
||
|
||
# try figuring out how this entry works in an editor:
|
||
vi tbr.c
|
||
|
||
# then figure out how to exit vi :-)</code></pre>
|
||
<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>
|
||
<pre class="<!---c-->"><code> #define D ,close(
|
||
char*c,q[512],m[256],*v[99],**u,*i[3];int f[2],p;main(){for(m[m[60]=m[62]=
|
||
32]=m[*m=124[m]=9]=6;e(-8),gets(1+(c=q))||(exit(0),0);r(0,0))for(;*++c;);}
|
||
r(t,o){*i=i[2]=0;for(u=v+98;m[*--c]^9;m[*c]&32?i[*c&2]=
|
||
*u,u-v^98&&++u:3)if(!m[*c]){for(*++c=0;!m[*--c];);*--u=
|
||
++c;}u-v^98?strcmp(*u,"cd")?*c?pipe(f),o=f[1]:1,(p=fork())?e(p),o?
|
||
r(o,0)D o)D*f):4,wait(0):(o?dup2(*f,0)D*f)D o):*i?1 D
|
||
0),e(open(*i,0)):5,t?dup2(t,1)D t):i[2]?9 D
|
||
1),e(creat(i[2],438)):2,e(execvp(*u,u))):e(chdir(u[1])*2):6;}
|
||
e(x){x<0?write(2,"?\n$ "-x/4,2),x+1||(exit(1),0):5;}</code></pre>
|
||
<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>
|
||
<pre class="<!---sh-->"><code> make alt</code></pre>
|
||
<h3 id="alternate-use">Alternate use:</h3>
|
||
<pre class="<!---sh-->"><code> ./tbr.alt</code></pre>
|
||
<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>
|
||
<pre class="<!---sh-->"><code> cat > foo > bar</code></pre>
|
||
<p>cats to <code>foo</code>, since it was pushed last, but</p>
|
||
<pre class="<!---sh-->"><code> cat > > foo bar</code></pre>
|
||
<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>
|
||
<!--
|
||
|
||
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-1990tbr"><a name="inventory"></a>Inventory for 1990/tbr</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/1990/tbr/tbr.c">tbr.c</a> - entry source</li>
|
||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1990/tbr/Makefile">Makefile</a> - entry 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 entry</li>
|
||
</ul>
|
||
<h2 id="secondary-files">Secondary files</h2>
|
||
<ul>
|
||
<li><a href="index.html">index.html</a> - this web page</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>
|
||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1990/tbr/.entry.json">.entry.json</a> - description of entry in JSON</li>
|
||
<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>
|
||
</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><a name="copyright"></a>Copyright and CC BY-SA 4.0 License</h2>
|
||
<p>All IOCCC content including this file and web page are:</p>
|
||
<b> Copyright © 1984-2024 by Landon Curt Noll. <a href="https://creativecommons.org/faq/#what-does-some-rights-reserved-mean">Some Rights Reserved</a>.</b>
|
||
<p>This work is licensed by Landon Curt Noll under:</p>
|
||
<p xmlns:cc="http://creativecommons.org/ns#" ><b><a href="https://creativecommons.org/licenses/by-sa/4.0/?ref=chooser-v1"
|
||
target="_blank" rel="license noopener noreferrer" style="display:inline-block;"> CC BY-SA 4.0
|
||
<img style="height:22px!important;margin-left:3px;vertical-align:text-bottom;"
|
||
src="../..//svg/cc.svg"
|
||
alt="cc inside circle symbol">
|
||
<img style="height:22px!important;margin-left:3px;vertical-align:text-bottom;"
|
||
src="../..//svg/by.svg"
|
||
alt="person inside circle symbol">
|
||
<img style="height:22px!important;margin-left:3px;vertical-align:text-bottom;"
|
||
src="../..//svg/sa.svg"
|
||
alt="arrow looping back on itself inside circle symbol">
|
||
</a></b></p>
|
||
<p>The <b>CC BY-SA 4.0 LEGAL CODE</b> for this license is found under:</p>
|
||
<p> <b><a href="https://creativecommons.org/licenses/by-sa/4.0/legalcode.en">
|
||
https://creativecommons.org/licenses/by-sa/4.0/legalcode.en</a></b></p>
|
||
<p>You should <b>carefully review</b> all of the terms and conditions of the
|
||
<a href="https://creativecommons.org/licenses/by-sa/4.0/legalcode.en">actual license</a>
|
||
before using the licensed material.</p>
|
||
<p>You may wish to review the <b><a href="../../license.html">highlights of some of the key
|
||
features and terms</a></b> of the <a href="https://creativecommons.org/licenses/by-sa/4.0/legalcode.en">actual license</a>.</p>
|
||
<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 -->
|