improved indentation and whitespace for markdown code blocks
All code blocks in markdown have been intended by at least 4 spaces. We add `--tab-stop=8` to all `pandoc(1)` executions in order to set a better tab stop indentation, especially for tab intended code blocks. Changed `bin/pandoc-wrapper.sh` VERSION from "1.5.3 2024-03-26" to "1.6 2024-03-31". Fixed `1991/brnstnd/sorta.README.md` so that the sorta code is code blocks. Removed unneeded paragraph group in copyright in `inc/footer.default.html`. Fixed excess whitespace after list Author on entry `index.html` page. Changed `bin/output-index-author.sh` VERSION from "1.5.2 2024-03-26" to "1.6 2024-03-31". Performed `make www` to perform the above and test under macOS. TODO: Fix the problem of the initial line of code being extra intended. TODO: Fix excess whitespace around code that is inline.
This commit is contained in:
1 parent
b84c27ce02
commit
a996f8d2b8
734 files changed
+16723
-16963
No files matched your search
@@ -1,7 +1,7 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
make all
|
||||
make all
|
||||
```
|
||||
|
||||
There is an alternate version for those using Turbo-C or MSC. See [alternate
|
||||
@@ -13,7 +13,7 @@ code](#alternate-code) below for details.
|
||||
The current status of this entry is:
|
||||
|
||||
```
|
||||
STATUS: INABIAF - please **DO NOT** fix
|
||||
STATUS: INABIAF - please **DO NOT** fix
|
||||
```
|
||||
|
||||
For more detailed information see [1990 baruch bugs](../../bugs.html#1990_baruch).
|
||||
@@ -22,15 +22,15 @@ For more detailed information see [1990 baruch bugs](../../bugs.html#1990_baruch
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
echo 4 | ./baruch
|
||||
echo 7 | ./baruch
|
||||
echo 4 | ./baruch
|
||||
echo 7 | ./baruch
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```sh
|
||||
./try.sh
|
||||
./try.sh
|
||||
```
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ question. YMMV.
|
||||
### Alternate build:
|
||||
|
||||
```sh
|
||||
make alt
|
||||
make alt
|
||||
```
|
||||
|
||||
|
||||
|
||||
@@ -135,8 +135,7 @@
|
||||
Location: <a href="../../location.html#IL">IL</a> - <em>State of Israel</em> (<em>Israel</em>)
|
||||
<br><br></li>
|
||||
<li>Name: <a href="../../authors.html#Doron_Osovlanski">Doron Osovlanski</a><br>
|
||||
Location: <a href="../../location.html#IL">IL</a> - <em>State of Israel</em> (<em>Israel</em>)
|
||||
<br><br></li>
|
||||
Location: <a href="../../location.html#IL">IL</a> - <em>State of Israel</em> (<em>Israel</em>)</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -145,18 +144,18 @@ Location: <a href="../../location.html#IL">IL</a> - <em>State of Israel</em> (<e
|
||||
<!-- 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>
|
||||
<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>There is an alternate version for those using Turbo-C or MSC. See <a href="#alternate-code">alternate
|
||||
code</a> below for details.</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>
|
||||
<pre><code> STATUS: INABIAF - please **DO NOT** fix</code></pre>
|
||||
<p>For more detailed information see <a href="../../bugs.html#1990_baruch">1990 baruch bugs</a>.</p>
|
||||
<h2 id="to-use">To use:</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="bu">echo</span> 4 <span class="kw">|</span> <span class="ex">./baruch</span></span>
|
||||
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a><span class="bu">echo</span> 7 <span class="kw">|</span> <span class="ex">./baruch</span></span></code></pre></div>
|
||||
<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="bu">echo</span> 4 <span class="kw">|</span> <span class="ex">./baruch</span></span>
|
||||
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a> <span class="bu">echo</span> 7 <span class="kw">|</span> <span class="ex">./baruch</span></span></code></pre></div>
|
||||
<h2 id="try">Try:</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">./try.sh</span></span></code></pre></div>
|
||||
<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">./try.sh</span></span></code></pre></div>
|
||||
<h2 id="alternate-code">Alternate code:</h2>
|
||||
<p>This alternate code is for the <a href="https://en.wikipedia.org/wiki/0">very few</a>
|
||||
<a href="https://en.wikipedia.org/wiki/Microsoft_Windows">users</a>
|
||||
@@ -166,7 +165,7 @@ the <code>" #Q"</code> string was not changed as that showed worse looking outpu
|
||||
of improved output though admittedly we have no way to test the compilers in
|
||||
question. YMMV.</p>
|
||||
<h3 id="alternate-build">Alternate build:</h3>
|
||||
<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="fu">make</span> alt</span></code></pre></div>
|
||||
<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="fu">make</span> alt</span></code></pre></div>
|
||||
<h3 id="alternate-use">Alternate use:</h3>
|
||||
<p>Use <code>baruch.alt</code> as you would <code>baruch</code>.</p>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
make all
|
||||
make all
|
||||
```
|
||||
|
||||
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
./cmills [starting_cash]
|
||||
./cmills [starting_cash]
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```sh
|
||||
./cmills 5000
|
||||
./cmills 5000
|
||||
```
|
||||
|
||||
|
||||
|
||||
@@ -132,8 +132,7 @@
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Christopher_Mills">Christopher Mills</a><br>
|
||||
Location: <a href="../../location.html#US">US</a> - <em>United States of America</em> (<em>United States</em>)
|
||||
<br><br></li>
|
||||
Location: <a href="../../location.html#US">US</a> - <em>United States of America</em> (<em>United States</em>)</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -142,11 +141,11 @@ Location: <a href="../../location.html#US">US</a> - <em>United States of America
|
||||
<!-- 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>
|
||||
<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>
|
||||
<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">./cmills</span> <span class="pp">[</span><span class="ss">starting_cash</span><span class="pp">]</span></span></code></pre></div>
|
||||
<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">./cmills</span> <span class="pp">[</span><span class="ss">starting_cash</span><span class="pp">]</span></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">./cmills</span> 5000</span></code></pre></div>
|
||||
<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">./cmills</span> 5000</span></code></pre></div>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>The Makefile uses several <code>-D</code> defines. The following is is a list of the macros
|
||||
that may be changed:</p>
|
||||
|
||||
+4
-4
@@ -1,14 +1,14 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
make all
|
||||
make all
|
||||
```
|
||||
|
||||
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
./dds
|
||||
./dds
|
||||
```
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@ make all
|
||||
Give the following lines as input:
|
||||
|
||||
```basic
|
||||
OLD LANDER.BAS
|
||||
RUN
|
||||
OLD LANDER.BAS
|
||||
RUN
|
||||
```
|
||||
|
||||
NOTE: this entry is probably one of the only times CAPS LOCK might be worth
|
||||
|
||||
+5
-6
@@ -132,8 +132,7 @@
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Diomidis_Spinellis">Diomidis Spinellis</a><br>
|
||||
Location: <a href="../../location.html#GR">GR</a> - <em>Hellenic Republic</em> (<em>Greece</em>)
|
||||
<br><br></li>
|
||||
Location: <a href="../../location.html#GR">GR</a> - <em>Hellenic Republic</em> (<em>Greece</em>)</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -142,13 +141,13 @@ Location: <a href="../../location.html#GR">GR</a> - <em>Hellenic Republic</em> (
|
||||
<!-- 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>
|
||||
<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>
|
||||
<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">./dds</span></span></code></pre></div>
|
||||
<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">./dds</span></span></code></pre></div>
|
||||
<h2 id="try">Try:</h2>
|
||||
<p>Give the following lines as input:</p>
|
||||
<pre class="basic"><code>OLD LANDER.BAS
|
||||
RUN</code></pre>
|
||||
<pre class="basic"><code> OLD LANDER.BAS
|
||||
RUN</code></pre>
|
||||
<p>NOTE: this entry is probably one of the only times CAPS LOCK might be worth
|
||||
having (though still not useful enough to enable :-) ) as all input has to be
|
||||
UPPER CASE.</p>
|
||||
|
||||
+6
-6
@@ -1,21 +1,21 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
make all
|
||||
make all
|
||||
```
|
||||
|
||||
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
echo foo bar | ./dg
|
||||
echo foo bar | ./dg
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```sh
|
||||
./try.sh
|
||||
./try.sh
|
||||
```
|
||||
|
||||
|
||||
@@ -25,13 +25,13 @@ Some C preprocessors got confused about single quotes in certain cases.
|
||||
In particular, the following source line:
|
||||
|
||||
```c
|
||||
b12(ase(bco(acp(bi(acp(bcp(acp(bpl(aqu(bqu(A))))))))))))))))))))))))))))))
|
||||
b12(ase(bco(acp(bi(acp(bcp(acp(bpl(aqu(bqu(A))))))))))))))))))))))))))))))
|
||||
```
|
||||
|
||||
sometimes has to be changed to:
|
||||
|
||||
```c
|
||||
b12(ase(bco(acp(bi(acp(bcp(acp(bpl('A'))))))))))))))))))))))))))))
|
||||
b12(ase(bco(acp(bi(acp(bcp(acp(bpl('A'))))))))))))))))))))))))))))
|
||||
```
|
||||
|
||||
particularly if the C preprocessor botches single quotes in cpp expansions,
|
||||
@@ -57,7 +57,7 @@ character is in the set `A-Za-z`. `l[]` is an array that gets filled
|
||||
with:
|
||||
|
||||
```c
|
||||
"nopqrstuvwxyzzzzabcdefghijklmmmmNOPQRSTUVWXYZZZZABCDEFGHIJKLMMMM"
|
||||
"nopqrstuvwxyzzzzabcdefghijklmmmmNOPQRSTUVWXYZZZZABCDEFGHIJKLMMMM"
|
||||
```
|
||||
|
||||
If `index(3)` says the char is in the alphabet, then XOR the offset
|
||||
|
||||
+7
-8
@@ -132,8 +132,7 @@
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#David_Goodenough">David Goodenough</a><br>
|
||||
Location: <a href="../../location.html#ZZ">ZZ</a> - <em>Unknown location</em>
|
||||
<br><br></li>
|
||||
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 -->
|
||||
@@ -142,17 +141,17 @@ Location: <a href="../../location.html#ZZ">ZZ</a> - <em>Unknown location</em>
|
||||
<!-- 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>
|
||||
<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>
|
||||
<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="bu">echo</span> foo bar <span class="kw">|</span> <span class="ex">./dg</span></span></code></pre></div>
|
||||
<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="bu">echo</span> foo bar <span class="kw">|</span> <span class="ex">./dg</span></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>
|
||||
<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="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>Some C preprocessors got confused about single quotes in certain cases.
|
||||
In particular, the following source line:</p>
|
||||
<div class="sourceCode" id="cb4"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a>b12<span class="op">(</span>ase<span class="op">(</span>bco<span class="op">(</span>acp<span class="op">(</span>bi<span class="op">(</span>acp<span class="op">(</span>bcp<span class="op">(</span>acp<span class="op">(</span>bpl<span class="op">(</span>aqu<span class="op">(</span>bqu<span class="op">(</span>A<span class="op">))))))))))))))))))))))))))))))</span></span></code></pre></div>
|
||||
<div class="sourceCode" id="cb4"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a> b12<span class="op">(</span>ase<span class="op">(</span>bco<span class="op">(</span>acp<span class="op">(</span>bi<span class="op">(</span>acp<span class="op">(</span>bcp<span class="op">(</span>acp<span class="op">(</span>bpl<span class="op">(</span>aqu<span class="op">(</span>bqu<span class="op">(</span>A<span class="op">))))))))))))))))))))))))))))))</span></span></code></pre></div>
|
||||
<p>sometimes has to be changed to:</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>b12<span class="op">(</span>ase<span class="op">(</span>bco<span class="op">(</span>acp<span class="op">(</span>bi<span class="op">(</span>acp<span class="op">(</span>bcp<span class="op">(</span>acp<span class="op">(</span>bpl<span class="op">(</span><span class="ch">'A'</span><span class="op">))))))))))))))))))))))))))))</span></span></code></pre></div>
|
||||
<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> b12<span class="op">(</span>ase<span class="op">(</span>bco<span class="op">(</span>acp<span class="op">(</span>bi<span class="op">(</span>acp<span class="op">(</span>bcp<span class="op">(</span>acp<span class="op">(</span>bpl<span class="op">(</span><span class="ch">'A'</span><span class="op">))))))))))))))))))))))))))))</span></span></code></pre></div>
|
||||
<p>particularly if the C preprocessor botches single quotes in cpp expansions,
|
||||
which we have done for the wider audience.</p>
|
||||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||||
@@ -168,7 +167,7 @@ source. The <code>axx()</code> <code>#define</code>s do the same, but add tokens
|
||||
<p>As for the rot13 algorithm, it relies on <code>index(3)</code> to find if the
|
||||
character is in the set <code>A-Za-z</code>. <code>l[]</code> is an array that gets filled
|
||||
with:</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="st">"nopqrstuvwxyzzzzabcdefghijklmmmmNOPQRSTUVWXYZZZZABCDEFGHIJKLMMMM"</span></span></code></pre></div>
|
||||
<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="st">"nopqrstuvwxyzzzzabcdefghijklmmmmNOPQRSTUVWXYZZZZABCDEFGHIJKLMMMM"</span></span></code></pre></div>
|
||||
<p>If <code>index(3)</code> says the char is in the alphabet, then XOR the offset
|
||||
with <code>16</code> to translate, and output, otherwise pass it unchanged.</p>
|
||||
<!--
|
||||
|
||||
+20
-20
@@ -1,7 +1,7 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
make all
|
||||
make all
|
||||
```
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ make all
|
||||
To test the official C entry, one might try:
|
||||
|
||||
```sh
|
||||
echo "Quartz glyph jocks vend, fix, BMW." | compress | ./btoa | ./jaw
|
||||
echo "Quartz glyph jocks vend, fix, BMW." | compress | ./btoa | ./jaw
|
||||
```
|
||||
|
||||
which should apply the identity transformation to a minimal holoalphabetic
|
||||
@@ -20,7 +20,7 @@ sentence.
|
||||
#### Also try:
|
||||
|
||||
```sh
|
||||
./try.sh
|
||||
./try.sh
|
||||
```
|
||||
|
||||
|
||||
@@ -40,18 +40,18 @@ The sender must have `compress` and `btoa`. To send, try:
|
||||
|
||||
|
||||
```sh
|
||||
./shark.sh jaw.* README.md > receive
|
||||
./shark.sh jaw.* README.md > receive
|
||||
```
|
||||
|
||||
The resulting file, `receive`, unpacks the input files
|
||||
even if the receiver lacks `uncompress` and `btoa`:
|
||||
|
||||
```sh
|
||||
mkdir -p test
|
||||
cd test
|
||||
sh ../receive
|
||||
cmp ../jaw.c jaw.c
|
||||
cmp ../README.md README.md
|
||||
mkdir -p test
|
||||
cd test
|
||||
sh ../receive
|
||||
cmp ../jaw.c jaw.c
|
||||
cmp ../README.md README.md
|
||||
```
|
||||
|
||||
NOTE: a limitation is that the script should be in the parent directory of the
|
||||
@@ -169,17 +169,17 @@ them. Here's a simple one, which could be extended to enable auto-reassembly
|
||||
with one shell cmd at the far end.
|
||||
|
||||
```sh
|
||||
#!/bin/sh
|
||||
m=$1; shift
|
||||
shark $* | split -800 - /tmp/shark$$
|
||||
n=`ls /tmp/shark$$* | wc -l | sed 's/ *//'`
|
||||
p=0
|
||||
for f in `ls /tmp/shark$$*`
|
||||
do
|
||||
p=`expr $p + 1`
|
||||
mail -s "bundle ($p of $n) from '`whoami`'" $m < $f
|
||||
done
|
||||
rm /tmp/shark$$*
|
||||
#!/bin/sh
|
||||
m=$1; shift
|
||||
shark $* | split -800 - /tmp/shark$$
|
||||
n=`ls /tmp/shark$$* | wc -l | sed 's/ *//'`
|
||||
p=0
|
||||
for f in `ls /tmp/shark$$*`
|
||||
do
|
||||
p=`expr $p + 1`
|
||||
mail -s "bundle ($p of $n) from '`whoami`'" $m < $f
|
||||
done
|
||||
rm /tmp/shark$$*
|
||||
```
|
||||
|
||||
|
||||
|
||||
+21
-22
@@ -138,8 +138,7 @@ Location: <a href="../../location.html#ZZ">ZZ</a> - <em>Unknown location</em>
|
||||
Location: <a href="../../location.html#ZZ">ZZ</a> - <em>Unknown location</em>
|
||||
<br><br></li>
|
||||
<li>Name: <a href="../../authors.html#Paul_Eggert">Paul Eggert</a><br>
|
||||
Location: <a href="../../location.html#ZZ">ZZ</a> - <em>Unknown location</em>
|
||||
<br><br></li>
|
||||
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 -->
|
||||
@@ -148,14 +147,14 @@ Location: <a href="../../location.html#ZZ">ZZ</a> - <em>Unknown location</em>
|
||||
<!-- 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>
|
||||
<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>
|
||||
<h2 id="try">Try:</h2>
|
||||
<p>To test the official C entry, one might try:</p>
|
||||
<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="bu">echo</span> <span class="st">"Quartz glyph jocks vend, fix, BMW."</span> <span class="kw">|</span> <span class="ex">compress</span> <span class="kw">|</span> <span class="ex">./btoa</span> <span class="kw">|</span> <span class="ex">./jaw</span></span></code></pre></div>
|
||||
<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="bu">echo</span> <span class="st">"Quartz glyph jocks vend, fix, BMW."</span> <span class="kw">|</span> <span class="ex">compress</span> <span class="kw">|</span> <span class="ex">./btoa</span> <span class="kw">|</span> <span class="ex">./jaw</span></span></code></pre></div>
|
||||
<p>which should apply the identity transformation to a minimal holoalphabetic
|
||||
sentence.</p>
|
||||
<h4 id="also-try">Also try:</h4>
|
||||
<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>
|
||||
<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="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>The program, in its base form, implements two useful utilities:</p>
|
||||
<ul>
|
||||
@@ -166,14 +165,14 @@ sentence.</p>
|
||||
it to 1530 bytes) which implements the complete shark utility. The script,
|
||||
<a href="shark.sh">shark.sh</a>, contains a <code>jaw.c</code> embedded within it!</p>
|
||||
<p>The sender must have <code>compress</code> and <code>btoa</code>. To send, 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">./shark.sh</span> jaw.<span class="pp">*</span> README.md <span class="op">></span> receive</span></code></pre></div>
|
||||
<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">./shark.sh</span> jaw.<span class="pp">*</span> README.md <span class="op">></span> receive</span></code></pre></div>
|
||||
<p>The resulting file, <code>receive</code>, unpacks the input files
|
||||
even if the receiver lacks <code>uncompress</code> and <code>btoa</code>:</p>
|
||||
<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="fu">mkdir</span> <span class="at">-p</span> test</span>
|
||||
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a><span class="bu">cd</span> test</span>
|
||||
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a><span class="fu">sh</span> ../receive</span>
|
||||
<span id="cb5-4"><a href="#cb5-4" aria-hidden="true" tabindex="-1"></a><span class="fu">cmp</span> ../jaw.c jaw.c</span>
|
||||
<span id="cb5-5"><a href="#cb5-5" aria-hidden="true" tabindex="-1"></a><span class="fu">cmp</span> ../README.md README.md</span></code></pre></div>
|
||||
<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="fu">mkdir</span> <span class="at">-p</span> test</span>
|
||||
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a> <span class="bu">cd</span> test</span>
|
||||
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">sh</span> ../receive</span>
|
||||
<span id="cb5-4"><a href="#cb5-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">cmp</span> ../jaw.c jaw.c</span>
|
||||
<span id="cb5-5"><a href="#cb5-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">cmp</span> ../README.md README.md</span></code></pre></div>
|
||||
<p>NOTE: a limitation is that the script should be in the parent directory of the
|
||||
directory it is run from.</p>
|
||||
<h2 id="authors-remarks">Authors’ remarks:</h2>
|
||||
@@ -263,17 +262,17 @@ left, and source-to-source transformations galore.</p></li>
|
||||
<p>Construct <code>sharkmail</code>, to auto-split <code>sharkives</code> into mailable segments and mail
|
||||
them. Here’s a simple one, which could be extended to enable auto-reassembly
|
||||
with one shell cmd at the far end.</p>
|
||||
<div class="sourceCode" id="cb6"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="co">#!/bin/sh</span></span>
|
||||
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a><span class="va">m</span><span class="op">=</span><span class="va">$1</span><span class="kw">;</span> <span class="bu">shift</span></span>
|
||||
<span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a><span class="ex">shark</span> <span class="va">$*</span> <span class="kw">|</span> <span class="fu">split</span> <span class="at">-800</span> <span class="at">-</span> /tmp/shark<span class="va">$$</span></span>
|
||||
<span id="cb6-4"><a href="#cb6-4" aria-hidden="true" tabindex="-1"></a><span class="va">n</span><span class="op">=</span><span class="kw">`</span><span class="fu">ls</span> /tmp/shark<span class="va">$$</span><span class="pp">*</span> <span class="kw">|</span> <span class="fu">wc</span> <span class="at">-l</span> <span class="kw">|</span> <span class="fu">sed</span> <span class="st">'s/ *//'</span><span class="kw">`</span></span>
|
||||
<span id="cb6-5"><a href="#cb6-5" aria-hidden="true" tabindex="-1"></a><span class="va">p</span><span class="op">=</span>0</span>
|
||||
<span id="cb6-6"><a href="#cb6-6" aria-hidden="true" tabindex="-1"></a><span class="cf">for</span> f <span class="kw">in</span> <span class="kw">`</span><span class="fu">ls</span> /tmp/shark<span class="va">$$</span><span class="pp">*</span><span class="kw">`</span></span>
|
||||
<span id="cb6-7"><a href="#cb6-7" aria-hidden="true" tabindex="-1"></a><span class="cf">do</span></span>
|
||||
<span id="cb6-8"><a href="#cb6-8" aria-hidden="true" tabindex="-1"></a> <span class="va">p</span><span class="op">=</span><span class="kw">`</span><span class="fu">expr</span> <span class="va">$p</span> + 1<span class="kw">`</span></span>
|
||||
<span id="cb6-9"><a href="#cb6-9" aria-hidden="true" tabindex="-1"></a> <span class="ex">mail</span> <span class="at">-s</span> <span class="st">"bundle (</span><span class="va">$p</span><span class="st"> of </span><span class="va">$n</span><span class="st">) from '</span><span class="kw">`</span><span class="fu">whoami</span><span class="kw">`</span><span class="st">'"</span> <span class="va">$m</span> <span class="op"><</span> <span class="va">$f</span></span>
|
||||
<span id="cb6-10"><a href="#cb6-10" aria-hidden="true" tabindex="-1"></a><span class="cf">done</span></span>
|
||||
<span id="cb6-11"><a href="#cb6-11" aria-hidden="true" tabindex="-1"></a><span class="fu">rm</span> /tmp/shark<span class="va">$$</span><span class="pp">*</span></span></code></pre></div>
|
||||
<div class="sourceCode" id="cb6"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a> <span class="co">#!/bin/sh</span></span>
|
||||
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a> <span class="va">m</span><span class="op">=</span><span class="va">$1</span><span class="kw">;</span> <span class="bu">shift</span></span>
|
||||
<span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a> <span class="ex">shark</span> <span class="va">$*</span> <span class="kw">|</span> <span class="fu">split</span> <span class="at">-800</span> <span class="at">-</span> /tmp/shark<span class="va">$$</span></span>
|
||||
<span id="cb6-4"><a href="#cb6-4" aria-hidden="true" tabindex="-1"></a> <span class="va">n</span><span class="op">=</span><span class="kw">`</span><span class="fu">ls</span> /tmp/shark<span class="va">$$</span><span class="pp">*</span> <span class="kw">|</span> <span class="fu">wc</span> <span class="at">-l</span> <span class="kw">|</span> <span class="fu">sed</span> <span class="st">'s/ *//'</span><span class="kw">`</span></span>
|
||||
<span id="cb6-5"><a href="#cb6-5" aria-hidden="true" tabindex="-1"></a> <span class="va">p</span><span class="op">=</span>0</span>
|
||||
<span id="cb6-6"><a href="#cb6-6" aria-hidden="true" tabindex="-1"></a> <span class="cf">for</span> f <span class="kw">in</span> <span class="kw">`</span><span class="fu">ls</span> /tmp/shark<span class="va">$$</span><span class="pp">*</span><span class="kw">`</span></span>
|
||||
<span id="cb6-7"><a href="#cb6-7" aria-hidden="true" tabindex="-1"></a> <span class="cf">do</span></span>
|
||||
<span id="cb6-8"><a href="#cb6-8" aria-hidden="true" tabindex="-1"></a> <span class="va">p</span><span class="op">=</span><span class="kw">`</span><span class="fu">expr</span> <span class="va">$p</span> + 1<span class="kw">`</span></span>
|
||||
<span id="cb6-9"><a href="#cb6-9" aria-hidden="true" tabindex="-1"></a> <span class="ex">mail</span> <span class="at">-s</span> <span class="st">"bundle (</span><span class="va">$p</span><span class="st"> of </span><span class="va">$n</span><span class="st">) from '</span><span class="kw">`</span><span class="fu">whoami</span><span class="kw">`</span><span class="st">'"</span> <span class="va">$m</span> <span class="op"><</span> <span class="va">$f</span></span>
|
||||
<span id="cb6-10"><a href="#cb6-10" aria-hidden="true" tabindex="-1"></a> <span class="cf">done</span></span>
|
||||
<span id="cb6-11"><a href="#cb6-11" aria-hidden="true" tabindex="-1"></a> <span class="fu">rm</span> /tmp/shark<span class="va">$$</span><span class="pp">*</span></span></code></pre></div>
|
||||
<h3 id="shark-history">Shark history:</h3>
|
||||
<ul>
|
||||
<li><p>May 1987: Karl Fox introduces 1023-byte <code>zcat.c</code> to USENET.
|
||||
|
||||
+8
-8
@@ -1,7 +1,7 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
make all
|
||||
make all
|
||||
```
|
||||
|
||||
There is an [alternate version](#alternate-code) that does something different
|
||||
@@ -12,7 +12,7 @@ that can be used if your compiler is incapable of compiling `X=g()...` in
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
./pjr
|
||||
./pjr
|
||||
```
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ Note that some compilers will be unable to compile the expression `X=g()...` in
|
||||
`main()` with:
|
||||
|
||||
```c
|
||||
main(){X=s().v().o().o().l().S().d().l().i().o().w().N();}
|
||||
main(){X=s().v().o().o().l().S().d().l().i().o().w().N();}
|
||||
```
|
||||
|
||||
if this is a problem, which is what this alternate code is.
|
||||
@@ -35,14 +35,14 @@ well.
|
||||
### Alternate build:
|
||||
|
||||
```sh
|
||||
make alt
|
||||
make alt
|
||||
```
|
||||
|
||||
|
||||
### Alternate use:
|
||||
|
||||
```sh
|
||||
./pjr.alt
|
||||
./pjr.alt
|
||||
```
|
||||
|
||||
|
||||
@@ -69,20 +69,20 @@ alphabetical character from a to z is printed out as its
|
||||
opposite:
|
||||
|
||||
```
|
||||
a->z b->y c->x etc
|
||||
a->z b->y c->x etc
|
||||
```
|
||||
|
||||
To encode a new string input the string as it is meant to come out:
|
||||
|
||||
```c
|
||||
X=s().v().o().o().l().S().d().l().i().o().w().N();
|
||||
X=s().v().o().o().l().S().d().l().i().o().w().N();
|
||||
```
|
||||
|
||||
Note: `S()` represents a space and `N()` a newline. This will now
|
||||
produce...
|
||||
|
||||
```
|
||||
hello world
|
||||
hello world
|
||||
```
|
||||
|
||||
By the way, there is actually a piece of code which is not used
|
||||
|
||||
+9
-10
@@ -132,8 +132,7 @@
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Peter_J_Ruczynski">Peter J Ruczynski</a><br>
|
||||
Location: <a href="../../location.html#GB">GB</a> - <em>United Kingdom of Great Britain and Northern Ireland</em> (<em>United Kingdom</em>)
|
||||
<br><br></li>
|
||||
Location: <a href="../../location.html#GB">GB</a> - <em>United Kingdom of Great Britain and Northern Ireland</em> (<em>United Kingdom</em>)</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -142,24 +141,24 @@ Location: <a href="../../location.html#GB">GB</a> - <em>United Kingdom of Great
|
||||
<!-- 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>
|
||||
<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>There is an <a href="#alternate-code">alternate version</a> that does something different
|
||||
that can be used if your compiler is incapable of compiling <code>X=g()...</code> in
|
||||
<code>main()</code>. It can be used for another purpose too.</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">./pjr</span></span></code></pre></div>
|
||||
<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">./pjr</span></span></code></pre></div>
|
||||
<h2 id="alternate-code">Alternate code:</h2>
|
||||
<p>Note that some compilers will be unable to compile the expression <code>X=g()...</code> in
|
||||
<code>main()</code> due to lack of temporary stack space. One might want to try replacing
|
||||
<code>main()</code> with:</p>
|
||||
<div class="sourceCode" id="cb3"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a>main<span class="op">(){</span>X<span class="op">=</span>s<span class="op">().</span>v<span class="op">().</span>o<span class="op">().</span>o<span class="op">().</span>l<span class="op">().</span>S<span class="op">().</span>d<span class="op">().</span>l<span class="op">().</span>i<span class="op">().</span>o<span class="op">().</span>w<span class="op">().</span>N<span class="op">();}</span></span></code></pre></div>
|
||||
<div class="sourceCode" id="cb3"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a> main<span class="op">(){</span>X<span class="op">=</span>s<span class="op">().</span>v<span class="op">().</span>o<span class="op">().</span>o<span class="op">().</span>l<span class="op">().</span>S<span class="op">().</span>d<span class="op">().</span>l<span class="op">().</span>i<span class="op">().</span>o<span class="op">().</span>w<span class="op">().</span>N<span class="op">();}</span></span></code></pre></div>
|
||||
<p>if this is a problem, which is what this alternate code is.</p>
|
||||
<p>NOTE: it prints something else and it is what the author suggested one try as
|
||||
well.</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>
|
||||
<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>
|
||||
<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">./pjr.alt</span></span></code></pre></div>
|
||||
<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">./pjr.alt</span></span></code></pre></div>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>This program prints out a string. Can you figure out how
|
||||
it is done?</p>
|
||||
@@ -174,12 +173,12 @@ to functions!</p>
|
||||
<p>It is simple to make the program print other strings. Each
|
||||
alphabetical character from a to z is printed out as its
|
||||
opposite:</p>
|
||||
<pre><code>a->z b->y c->x etc</code></pre>
|
||||
<pre><code> a->z b->y c->x etc</code></pre>
|
||||
<p>To encode a new string input the string as it is meant to come out:</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>X<span class="op">=</span>s<span class="op">().</span>v<span class="op">().</span>o<span class="op">().</span>o<span class="op">().</span>l<span class="op">().</span>S<span class="op">().</span>d<span class="op">().</span>l<span class="op">().</span>i<span class="op">().</span>o<span class="op">().</span>w<span class="op">().</span>N<span class="op">();</span></span></code></pre></div>
|
||||
<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> X<span class="op">=</span>s<span class="op">().</span>v<span class="op">().</span>o<span class="op">().</span>o<span class="op">().</span>l<span class="op">().</span>S<span class="op">().</span>d<span class="op">().</span>l<span class="op">().</span>i<span class="op">().</span>o<span class="op">().</span>w<span class="op">().</span>N<span class="op">();</span></span></code></pre></div>
|
||||
<p>Note: <code>S()</code> represents a space and <code>N()</code> a newline. This will now
|
||||
produce…</p>
|
||||
<pre><code>hello world</code></pre>
|
||||
<pre><code> hello world</code></pre>
|
||||
<p>By the way, there is actually a piece of code which is not used
|
||||
in the original program! I leave it as an intellectual exercise
|
||||
to the reader to find out what it is.</p>
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
make all
|
||||
make all
|
||||
```
|
||||
|
||||
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
./scjones
|
||||
./scjones
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```sh
|
||||
./try.sh
|
||||
./try.sh
|
||||
```
|
||||
|
||||
|
||||
|
||||
@@ -132,8 +132,7 @@
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Larry_Jones">Larry Jones</a><br>
|
||||
Location: <a href="../../location.html#ZZ">ZZ</a> - <em>Unknown location</em>
|
||||
<br><br></li>
|
||||
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 -->
|
||||
@@ -142,11 +141,11 @@ Location: <a href="../../location.html#ZZ">ZZ</a> - <em>Unknown location</em>
|
||||
<!-- 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>
|
||||
<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>
|
||||
<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">./scjones</span></span></code></pre></div>
|
||||
<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">./scjones</span></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>
|
||||
<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="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>The addition of trigraphs has made it easier to make programs hard to read. It
|
||||
was a dark and stormy night for C when the ANSI C committee added trigraphs to
|
||||
|
||||
+3
-3
@@ -1,20 +1,20 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
make all
|
||||
make all
|
||||
```
|
||||
|
||||
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
make all
|
||||
make all
|
||||
```
|
||||
|
||||
NOTE: that's not a typo or mistake but one can also do:
|
||||
|
||||
```sh
|
||||
./o
|
||||
./o
|
||||
```
|
||||
|
||||
|
||||
|
||||
@@ -132,8 +132,7 @@
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Stig_Hemmer">Stig Hemmer</a><br>
|
||||
Location: <a href="../../location.html#NO">NO</a> - <em>Kingdom of Norway</em> (<em>Norway</em>)
|
||||
<br><br></li>
|
||||
Location: <a href="../../location.html#NO">NO</a> - <em>Kingdom of Norway</em> (<em>Norway</em>)</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -142,11 +141,11 @@ Location: <a href="../../location.html#NO">NO</a> - <em>Kingdom of Norway</em> (
|
||||
<!-- 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>
|
||||
<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>
|
||||
<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="fu">make</span> all</span></code></pre></div>
|
||||
<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="fu">make</span> all</span></code></pre></div>
|
||||
<p>NOTE: that’s not a typo or mistake but one can also do:</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">./o</span></span></code></pre></div>
|
||||
<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">./o</span></span></code></pre></div>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>We changed the alias that the author’s suggested alias from a
|
||||
C-shell alias to a Bourne-like shell alias.</p>
|
||||
|
||||
+27
-27
@@ -1,7 +1,7 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
make all
|
||||
make all
|
||||
```
|
||||
|
||||
The authors provided another version of this program. See the [alternate
|
||||
@@ -13,7 +13,7 @@ version](#alternate-code) section below.
|
||||
The current status of this entry is:
|
||||
|
||||
```
|
||||
STATUS: INABIAF - please **DO NOT** fix
|
||||
STATUS: INABIAF - please **DO NOT** fix
|
||||
```
|
||||
|
||||
For more detailed information see [1990 tbr bugs](../../bugs.html#1990_tbr).
|
||||
@@ -26,8 +26,8 @@ output due to a warning at runtime that was interspersed with the output of the
|
||||
program. For instance it would show:
|
||||
|
||||
```sh
|
||||
./tbr
|
||||
$ warning: this program uses gets(), which is unsafe.
|
||||
./tbr
|
||||
$ warning: this program uses gets(), which is unsafe.
|
||||
```
|
||||
|
||||
which kind of hid the prompt. Thus the entry was changed to use `fgets(3)` which
|
||||
@@ -41,8 +41,8 @@ below, in the [alternate version](#alternate-code) section.
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
./tbr
|
||||
$ enter some shell commands
|
||||
./tbr
|
||||
$ enter some shell commands
|
||||
```
|
||||
|
||||
NOTE: globs do not work with this entry. Why?
|
||||
@@ -55,16 +55,16 @@ just `exit` or `logout`? Hint: see the authors' remarks.
|
||||
## Try:
|
||||
|
||||
```sh
|
||||
./tbr
|
||||
$ ls -l tbr tbr.c
|
||||
./tbr
|
||||
$ ls -l tbr tbr.c
|
||||
|
||||
# notice how the following does not work:
|
||||
ls tbr*
|
||||
# notice how the following does not work:
|
||||
ls tbr*
|
||||
|
||||
# try figuring out how this entry works in an editor:
|
||||
vi tbr.c
|
||||
# try figuring out how this entry works in an editor:
|
||||
vi tbr.c
|
||||
|
||||
# then figure out how to exit vi :-)
|
||||
# then figure out how to exit vi :-)
|
||||
```
|
||||
|
||||
What happens if you try using `cd -` to return to previous directory? What about
|
||||
@@ -80,16 +80,16 @@ The authors supplied us with a slightly smaller unformatted version
|
||||
of the program which we include below:
|
||||
|
||||
```c
|
||||
#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;}
|
||||
#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;}
|
||||
```
|
||||
|
||||
and in the [alternate source](tbr.alt.c). It has the `exit()` returns `void` fix
|
||||
@@ -100,14 +100,14 @@ equivalent like the authors intended.
|
||||
### Alternate build:
|
||||
|
||||
```sh
|
||||
make alt
|
||||
make alt
|
||||
```
|
||||
|
||||
|
||||
### Alternate use:
|
||||
|
||||
```sh
|
||||
./tbr.alt
|
||||
./tbr.alt
|
||||
```
|
||||
|
||||
|
||||
@@ -166,13 +166,13 @@ shell flags an error if no arguments are on the stack. Thus, for
|
||||
example:
|
||||
|
||||
```sh
|
||||
cat > foo > bar
|
||||
cat > foo > bar
|
||||
```
|
||||
|
||||
cats to `foo`, since it was pushed last, but
|
||||
|
||||
```sh
|
||||
cat > > foo bar
|
||||
cat > > foo bar
|
||||
```
|
||||
|
||||
cats to `bar`, since `bar` was pushed under `foo` (remember we're
|
||||
|
||||
+28
-29
@@ -135,8 +135,7 @@
|
||||
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>
|
||||
<br><br></li>
|
||||
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 -->
|
||||
@@ -145,42 +144,42 @@ Location: <a href="../../location.html#ZZ">ZZ</a> - <em>Unknown location</em>
|
||||
<!-- 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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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-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-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>
|
||||
<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
|
||||
@@ -188,23 +187,23 @@ 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>
|
||||
<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>
|
||||
<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>
|
||||
<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
|
||||
@@ -246,9 +245,9 @@ 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>
|
||||
<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>
|
||||
<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
|
||||
|
||||
+21
-21
@@ -1,7 +1,7 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
make all
|
||||
make all
|
||||
```
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ make all
|
||||
The current status of this entry is:
|
||||
|
||||
```
|
||||
STATUS: INABIAF - please **DO NOT** fix
|
||||
STATUS: INABIAF - please **DO NOT** fix
|
||||
```
|
||||
|
||||
For more detailed information see [1990 theorem bugs](../../bugs.html#1990_theorem).
|
||||
@@ -19,24 +19,24 @@ For more detailed information see [1990 theorem bugs](../../bugs.html#1990_theor
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
./theorem expression x1 x2 h y1
|
||||
./theorem expression x1 x2 h y1
|
||||
```
|
||||
|
||||
where:
|
||||
|
||||
```
|
||||
expression - function f(x,y) (see below)
|
||||
x1 - start of interval
|
||||
x2 - end of interval
|
||||
h - step size
|
||||
y1 - initial value (y(x1) == y1)
|
||||
expression - function f(x,y) (see below)
|
||||
x1 - start of interval
|
||||
x2 - end of interval
|
||||
h - step size
|
||||
y1 - initial value (y(x1) == y1)
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```sh
|
||||
./try.sh
|
||||
./try.sh
|
||||
```
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ The 'expression' `f(x,y)` is any function of `x` and `y` with the
|
||||
operators:
|
||||
|
||||
```
|
||||
+ - * / ^
|
||||
+ - * / ^
|
||||
```
|
||||
|
||||
The symbol `^` is the power operator. Note that it only supports
|
||||
@@ -63,24 +63,24 @@ left to right. (i.e., parenthesis aren't supported).
|
||||
Try running the program with the following args:
|
||||
|
||||
```sh
|
||||
./theorem y 0 1 0.1 1
|
||||
./theorem 1/x 1 2 0.1 0
|
||||
./theorem 'x^2/y+x' 0 1 0.1 6
|
||||
./theorem y 0 1 0.1 1
|
||||
./theorem 1/x 1 2 0.1 0
|
||||
./theorem 'x^2/y+x' 0 1 0.1 6
|
||||
```
|
||||
|
||||
But wait, there is more! You also get, free of charge, a
|
||||
reversing filter! Try:
|
||||
|
||||
```sh
|
||||
./theorem -r 0 0 0 0 < theorem.c > sorter.c
|
||||
./theorem -r 0 0 0 0 < theorem.c > sorter.c
|
||||
```
|
||||
|
||||
Still not impressed? The author throws in for free, a
|
||||
sort program! Try:
|
||||
|
||||
```sh
|
||||
make sorter
|
||||
ls | ./sorter
|
||||
make sorter
|
||||
ls | ./sorter
|
||||
```
|
||||
|
||||
This program is safe for home use as well. The author has
|
||||
@@ -88,17 +88,17 @@ included a safety feature in case you misplace the original
|
||||
program source:
|
||||
|
||||
```sh
|
||||
./sorter -r 0 0 0 0 < sorter.c > theorem_bkp.c
|
||||
./sorter -r 0 0 0 0 < sorter.c > theorem_bkp.c
|
||||
```
|
||||
|
||||
And finally, as a special offer to users of this entry,
|
||||
the author provides a Fibonacci sequence generator! Try:
|
||||
|
||||
```sh
|
||||
./sorter 0 0 0 0 < theorem.c > fibonacci.c
|
||||
make fibonacci
|
||||
./fibonacci 1 1
|
||||
./fibonacci 2 1
|
||||
./sorter 0 0 0 0 < theorem.c > fibonacci.c
|
||||
make fibonacci
|
||||
./fibonacci 1 1
|
||||
./fibonacci 2 1
|
||||
```
|
||||
|
||||
NOTE: if the two args passed to `fibonacci` and `theorem_bkp` add to 0 it will
|
||||
|
||||
+22
-23
@@ -132,8 +132,7 @@
|
||||
<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>
|
||||
Location: <a href="../../location.html#US">US</a> - <em>United States of America</em> (<em>United States</em>)</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -142,21 +141,21 @@ Location: <a href="../../location.html#US">US</a> - <em>United States of America
|
||||
<!-- 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>
|
||||
<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: INABIAF - please **DO NOT** fix</code></pre>
|
||||
<pre><code> STATUS: INABIAF - please **DO NOT** fix</code></pre>
|
||||
<p>For more detailed information see <a href="../../bugs.html#1990_theorem">1990 theorem bugs</a>.</p>
|
||||
<h2 id="to-use">To use:</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">./theorem</span> expression x1 x2 h y1</span></code></pre></div>
|
||||
<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">./theorem</span> expression x1 x2 h y1</span></code></pre></div>
|
||||
<p>where:</p>
|
||||
<pre><code>expression - function f(x,y) (see below)
|
||||
x1 - start of interval
|
||||
x2 - end of interval
|
||||
h - step size
|
||||
y1 - initial value (y(x1) == y1)</code></pre>
|
||||
<pre><code> expression - function f(x,y) (see below)
|
||||
x1 - start of interval
|
||||
x2 - end of interval
|
||||
h - step size
|
||||
y1 - initial value (y(x1) == y1)</code></pre>
|
||||
<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">./try.sh</span></span></code></pre></div>
|
||||
<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">./try.sh</span></span></code></pre></div>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>The program’s source implements four functions, all from the
|
||||
same source file!</p>
|
||||
@@ -165,31 +164,31 @@ numerically solves the equation <code>y'=f(x,y)</code>, with a step size of <cod
|
||||
usage), over the interval <code>x=[x1,x2]</code>, with the initial condition of <code>y(x1)=y1</code>.</p>
|
||||
<p>The ‘expression’ <code>f(x,y)</code> is any function of <code>x</code> and <code>y</code> with the
|
||||
operators:</p>
|
||||
<pre><code>+ - * / ^</code></pre>
|
||||
<pre><code> + - * / ^</code></pre>
|
||||
<p>The symbol <code>^</code> is the power operator. Note that it only supports
|
||||
integer powers. Also note that all expressions are evaluated strictly
|
||||
left to right. (i.e., parenthesis aren’t supported).</p>
|
||||
<p>Try running the program with the following args:</p>
|
||||
<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="ex">./theorem</span> y 0 1 0.1 1</span>
|
||||
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./theorem</span> 1/x 1 2 0.1 0</span>
|
||||
<span id="cb7-3"><a href="#cb7-3" aria-hidden="true" tabindex="-1"></a><span class="ex">./theorem</span> <span class="st">'x^2/y+x'</span> 0 1 0.1 6</span></code></pre></div>
|
||||
<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="ex">./theorem</span> y 0 1 0.1 1</span>
|
||||
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a> <span class="ex">./theorem</span> 1/x 1 2 0.1 0</span>
|
||||
<span id="cb7-3"><a href="#cb7-3" aria-hidden="true" tabindex="-1"></a> <span class="ex">./theorem</span> <span class="st">'x^2/y+x'</span> 0 1 0.1 6</span></code></pre></div>
|
||||
<p>But wait, there is more! You also get, free of charge, a
|
||||
reversing filter! Try:</p>
|
||||
<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">./theorem</span> <span class="at">-r</span> 0 0 0 0 <span class="op"><</span> theorem.c <span class="op">></span> sorter.c</span></code></pre></div>
|
||||
<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">./theorem</span> <span class="at">-r</span> 0 0 0 0 <span class="op"><</span> theorem.c <span class="op">></span> sorter.c</span></code></pre></div>
|
||||
<p>Still not impressed? The author throws in for free, a
|
||||
sort program! Try:</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">make</span> sorter</span>
|
||||
<span id="cb9-2"><a href="#cb9-2" aria-hidden="true" tabindex="-1"></a><span class="fu">ls</span> <span class="kw">|</span> <span class="ex">./sorter</span></span></code></pre></div>
|
||||
<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">make</span> sorter</span>
|
||||
<span id="cb9-2"><a href="#cb9-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">ls</span> <span class="kw">|</span> <span class="ex">./sorter</span></span></code></pre></div>
|
||||
<p>This program is safe for home use as well. The author has
|
||||
included a safety feature in case you misplace the original
|
||||
program source:</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="ex">./sorter</span> <span class="at">-r</span> 0 0 0 0 <span class="op"><</span> sorter.c <span class="op">></span> theorem_bkp.c</span></code></pre></div>
|
||||
<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="ex">./sorter</span> <span class="at">-r</span> 0 0 0 0 <span class="op"><</span> sorter.c <span class="op">></span> theorem_bkp.c</span></code></pre></div>
|
||||
<p>And finally, as a special offer to users of this entry,
|
||||
the author provides a Fibonacci sequence generator! Try:</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="ex">./sorter</span> 0 0 0 0 <span class="op"><</span> theorem.c <span class="op">></span> fibonacci.c</span>
|
||||
<span id="cb11-2"><a href="#cb11-2" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> fibonacci</span>
|
||||
<span id="cb11-3"><a href="#cb11-3" aria-hidden="true" tabindex="-1"></a><span class="ex">./fibonacci</span> 1 1</span>
|
||||
<span id="cb11-4"><a href="#cb11-4" aria-hidden="true" tabindex="-1"></a><span class="ex">./fibonacci</span> 2 1</span></code></pre></div>
|
||||
<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="ex">./sorter</span> 0 0 0 0 <span class="op"><</span> theorem.c <span class="op">></span> fibonacci.c</span>
|
||||
<span id="cb11-2"><a href="#cb11-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">make</span> fibonacci</span>
|
||||
<span id="cb11-3"><a href="#cb11-3" aria-hidden="true" tabindex="-1"></a> <span class="ex">./fibonacci</span> 1 1</span>
|
||||
<span id="cb11-4"><a href="#cb11-4" aria-hidden="true" tabindex="-1"></a> <span class="ex">./fibonacci</span> 2 1</span></code></pre></div>
|
||||
<p>NOTE: if the two args passed to <code>fibonacci</code> and <code>theorem_bkp</code> add to 0 it will
|
||||
print 0 over and over again in an infinite loop. In this case it should not be
|
||||
fixed (another condition where this occurred was fixed in 2023 as it affected
|
||||
|
||||
+10
-10
@@ -1,14 +1,14 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
make all
|
||||
make all
|
||||
```
|
||||
|
||||
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
./westley <number>
|
||||
./westley <number>
|
||||
```
|
||||
|
||||
The number should be greater than 0.
|
||||
@@ -17,7 +17,7 @@ The number should be greater than 0.
|
||||
## Try:
|
||||
|
||||
```sh
|
||||
./try.sh
|
||||
./try.sh
|
||||
```
|
||||
|
||||
|
||||
@@ -31,14 +31,14 @@ The alternate code is provided to show how C changed.
|
||||
If you have an old enough compiler try and to see how C has changed over the years:
|
||||
|
||||
```sh
|
||||
make alt
|
||||
make alt
|
||||
```
|
||||
|
||||
|
||||
### Alternate use:
|
||||
|
||||
```sh
|
||||
./westley.alt <number>
|
||||
./westley.alt <number>
|
||||
```
|
||||
|
||||
|
||||
@@ -51,11 +51,11 @@ Read each block of code as if it were a piece of correspondence.
|
||||
For example, the first block of code would read:
|
||||
|
||||
```
|
||||
charlie,
|
||||
doubletime me, OXFACE!
|
||||
not interested, get out
|
||||
mainly die, charly, *die*
|
||||
signed charlotte
|
||||
charlie,
|
||||
doubletime me, OXFACE!
|
||||
not interested, get out
|
||||
mainly die, charly, *die*
|
||||
signed charlotte
|
||||
```
|
||||
|
||||
The original source had control-L's after each code block. To
|
||||
|
||||
+11
-12
@@ -132,8 +132,7 @@
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Brian_Westley">Brian Westley</a><br>
|
||||
Location: <a href="../../location.html#US">US</a> - <em>United States of America</em> (<em>United States</em>)
|
||||
<br><br></li>
|
||||
Location: <a href="../../location.html#US">US</a> - <em>United States of America</em> (<em>United States</em>)</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -142,29 +141,29 @@ Location: <a href="../../location.html#US">US</a> - <em>United States of America
|
||||
<!-- 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>
|
||||
<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>
|
||||
<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">./westley</span> <span class="op"><</span>number<span class="op">></span></span></code></pre></div>
|
||||
<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">./westley</span> <span class="op"><</span>number<span class="op">></span></span></code></pre></div>
|
||||
<p>The number should be greater than 0.</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>
|
||||
<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>The alternate code is provided to show how C changed.</p>
|
||||
<h3 id="alternate-build">Alternate build:</h3>
|
||||
<p>If you have an old enough compiler try and to see how C has changed over the years:</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="fu">make</span> alt</span></code></pre></div>
|
||||
<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>
|
||||
<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">./westley.alt</span> <span class="op"><</span>number<span class="op">></span></span></code></pre></div>
|
||||
<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">./westley.alt</span> <span class="op"><</span>number<span class="op">></span></span></code></pre></div>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>If you would rather “Daisy” someone other than Westley, rename
|
||||
the program as needed. :-)</p>
|
||||
<p>Read each block of code as if it were a piece of correspondence.
|
||||
For example, the first block of code would read:</p>
|
||||
<pre><code>charlie,
|
||||
doubletime me, OXFACE!
|
||||
not interested, get out
|
||||
mainly die, charly, *die*
|
||||
signed charlotte</code></pre>
|
||||
<pre><code> charlie,
|
||||
doubletime me, OXFACE!
|
||||
not interested, get out
|
||||
mainly die, charly, *die*
|
||||
signed charlotte</code></pre>
|
||||
<p>The original source had control-L’s after each code block. To
|
||||
make it easier on news readers, we converted each control-L to
|
||||
a blank line.</p>
|
||||
|
||||
Reference in new issue
Block a user