add hack-a-round for language specified markdown code blocks

When language is specified in a markdown code block such as:

````
```c
    printf("Hello, world!\n");
```
````

is used, the resulting HTML as produced by `pandoc(1)` combined
with our revised `ioccc.css` is not intent the code block well.

A temporary "_hack-a-round_" is to turn the "markdown code language
specifier" into an HTML comment.  For example:

````
```<!---c-->
    printf("Hello, world!\n");
```
````

This commits turns off existing markdown code language specifiers
for now, while preserving our ability to restore them in the future
when a better  "_hack-a-round_" to the "markdown code language
specifier" problem is found.

The HTML impact if this "_hack-a-round_" is to produce HTML that
looks like this:

```
<pre class="&lt;!---c--&gt;"><code> .. </code></pre>
```

We might be able to create a complex set of classes for each markdown
code language (there won't be very many) in `ioccc.css`, or we might
find a more general CSS (or maybe `pandoc(1)`?) solution.

For now, this hack-a-round will have to do.
This commit is contained in:
Landon Curt Noll committed 2024-04-04 14:50:38 -07:00
1 parent 3919df50fb
commit b66c79254a
700 files changed
+7052 -7056

No files matched your search

+4 -4
View File
@@ -1,6 +1,6 @@
## To build:
```sh
```<!---sh-->
make all
```
@@ -21,7 +21,7 @@ For more detailed information see [1990 baruch bugs](../../bugs.html#1990_baruch
## To use:
```sh
```<!---sh-->
echo 4 | ./baruch
echo 7 | ./baruch
```
@@ -29,7 +29,7 @@ For more detailed information see [1990 baruch bugs](../../bugs.html#1990_baruch
## Try:
```sh
```<!---sh-->
./try.sh
```
@@ -47,7 +47,7 @@ question. YMMV.
### Alternate build:
```sh
```<!---sh-->
make alt
```
+5 -5
View File
@@ -144,7 +144,7 @@ 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>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<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>
@@ -152,10 +152,10 @@ code</a> below for details.</p>
<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>
<pre class="&lt;!---sh--&gt;"><code> echo 4 | ./baruch
echo 7 | ./baruch</code></pre>
<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>
<pre class="&lt;!---sh--&gt;"><code> ./try.sh</code></pre>
<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>
@@ -165,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>
<pre class="&lt;!---sh--&gt;"><code> make alt</code></pre>
<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>
+3 -3
View File
@@ -1,20 +1,20 @@
## To build:
```sh
```<!---sh-->
make all
```
## To use:
```sh
```<!---sh-->
./cmills [starting_cash]
```
## Try:
```sh
```<!---sh-->
./cmills 5000
```
+3 -3
View File
@@ -141,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>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<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>
<pre class="&lt;!---sh--&gt;"><code> ./cmills [starting_cash]</code></pre>
<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>
<pre class="&lt;!---sh--&gt;"><code> ./cmills 5000</code></pre>
<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>
+3 -3
View File
@@ -1,13 +1,13 @@
## To build:
```sh
```<!---sh-->
make all
```
## To use:
```sh
```<!---sh-->
./dds
```
@@ -16,7 +16,7 @@
Give the following lines as input:
```basic
```<!---basic-->
OLD LANDER.BAS
RUN
```
+3 -3
View File
@@ -141,12 +141,12 @@ 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>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<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>
<pre class="&lt;!---sh--&gt;"><code> ./dds</code></pre>
<h2 id="try">Try:</h2>
<p>Give the following lines as input:</p>
<pre class="basic"><code> OLD LANDER.BAS
<pre class="&lt;!---basic--&gt;"><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
+6 -6
View File
@@ -1,20 +1,20 @@
## To build:
```sh
```<!---sh-->
make all
```
## To use:
```sh
```<!---sh-->
echo foo bar | ./dg
```
## Try:
```sh
```<!---sh-->
./try.sh
```
@@ -24,13 +24,13 @@
Some C preprocessors got confused about single quotes in certain cases.
In particular, the following source line:
```c
```<!---c-->
b12(ase(bco(acp(bi(acp(bcp(acp(bpl(aqu(bqu(A))))))))))))))))))))))))))))))
```
sometimes has to be changed to:
```c
```<!---c-->
b12(ase(bco(acp(bi(acp(bcp(acp(bpl('A'))))))))))))))))))))))))))))
```
@@ -56,7 +56,7 @@ As for the rot13 algorithm, it relies on `index(3)` to find if the
character is in the set `A-Za-z`. `l[]` is an array that gets filled
with:
```c
```<!---c-->
"nopqrstuvwxyzzzzabcdefghijklmmmmNOPQRSTUVWXYZZZZABCDEFGHIJKLMMMM"
```
+6 -6
View File
@@ -141,17 +141,17 @@ Location: <a href="../../location.html#ZZ">ZZ</a> - <em>Unknown location</em></l
<!-- 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>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<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>
<pre class="&lt;!---sh--&gt;"><code> echo foo bar | ./dg</code></pre>
<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>
<pre class="&lt;!---sh--&gt;"><code> ./try.sh</code></pre>
<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>
<pre class="&lt;!---c--&gt;"><code> b12(ase(bco(acp(bi(acp(bcp(acp(bpl(aqu(bqu(A))))))))))))))))))))))))))))))</code></pre>
<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">&#39;A&#39;</span><span class="op">))))))))))))))))))))))))))))</span></span></code></pre></div>
<pre class="&lt;!---c--&gt;"><code> b12(ase(bco(acp(bi(acp(bcp(acp(bpl(&#39;A&#39;))))))))))))))))))))))))))))</code></pre>
<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>
@@ -167,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">&quot;nopqrstuvwxyzzzzabcdefghijklmmmmNOPQRSTUVWXYZZZZABCDEFGHIJKLMMMM&quot;</span></span></code></pre></div>
<pre class="&lt;!---c--&gt;"><code> &quot;nopqrstuvwxyzzzzabcdefghijklmmmmNOPQRSTUVWXYZZZZABCDEFGHIJKLMMMM&quot;</code></pre>
<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>
<!--
+6 -6
View File
@@ -1,6 +1,6 @@
## To build:
```sh
```<!---sh-->
make all
```
@@ -9,7 +9,7 @@
To test the official C entry, one might try:
```sh
```<!---sh-->
echo "Quartz glyph jocks vend, fix, BMW." | compress | ./btoa | ./jaw
```
@@ -19,7 +19,7 @@ sentence.
#### Also try:
```sh
```<!---sh-->
./try.sh
```
@@ -39,14 +39,14 @@ it to 1530 bytes) which implements the complete shark utility. The script,
The sender must have `compress` and `btoa`. To send, try:
```sh
```<!---sh-->
./shark.sh jaw.* README.md > receive
```
The resulting file, `receive`, unpacks the input files
even if the receiver lacks `uncompress` and `btoa`:
```sh
```<!---sh-->
mkdir -p test
cd test
sh ../receive
@@ -168,7 +168,7 @@ Construct `sharkmail`, to auto-split `sharkives` 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.
```sh
```<!---sh-->
#!/bin/sh
m=$1; shift
shark $* | split -800 - /tmp/shark$$
+20 -20
View File
@@ -147,14 +147,14 @@ Location: <a href="../../location.html#ZZ">ZZ</a> - <em>Unknown location</em></l
<!-- 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>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<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">&quot;Quartz glyph jocks vend, fix, BMW.&quot;</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>
<pre class="&lt;!---sh--&gt;"><code> echo &quot;Quartz glyph jocks vend, fix, BMW.&quot; | compress | ./btoa | ./jaw</code></pre>
<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>
<pre class="&lt;!---sh--&gt;"><code> ./try.sh</code></pre>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>The program, in its base form, implements two useful utilities:</p>
<ul>
@@ -165,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">&gt;</span> receive</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./shark.sh jaw.* README.md &gt; receive</code></pre>
<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>
<pre class="&lt;!---sh--&gt;"><code> mkdir -p test
cd test
sh ../receive
cmp ../jaw.c jaw.c
cmp ../README.md README.md</code></pre>
<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>
@@ -262,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">&#39;s/ *//&#39;</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">&quot;bundle (</span><span class="va">$p</span><span class="st"> of </span><span class="va">$n</span><span class="st">) from &#39;</span><span class="kw">`</span><span class="fu">whoami</span><span class="kw">`</span><span class="st">&#39;&quot;</span> <span class="va">$m</span> <span class="op">&lt;</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>
<pre class="&lt;!---sh--&gt;"><code> #!/bin/sh
m=$1; shift
shark $* | split -800 - /tmp/shark$$
n=`ls /tmp/shark$$* | wc -l | sed &#39;s/ *//&#39;`
p=0
for f in `ls /tmp/shark$$*`
do
p=`expr $p + 1`
mail -s &quot;bundle ($p of $n) from &#39;`whoami`&#39;&quot; $m &lt; $f
done
rm /tmp/shark$$*</code></pre>
<h3 id="shark-history">Shark history:</h3>
<ul>
<li><p>May 1987: Karl Fox introduces 1023-byte <code>zcat.c</code> to USENET.
+6 -6
View File
@@ -1,6 +1,6 @@
## To build:
```sh
```<!---sh-->
make all
```
@@ -11,7 +11,7 @@ that can be used if your compiler is incapable of compiling `X=g()...` in
## To use:
```sh
```<!---sh-->
./pjr
```
@@ -22,7 +22,7 @@ Note that some compilers will be unable to compile the expression `X=g()...` in
`main()` due to lack of temporary stack space. One might want to try replacing
`main()` with:
```c
```<!---c-->
main(){X=s().v().o().o().l().S().d().l().i().o().w().N();}
```
@@ -34,14 +34,14 @@ well.
### Alternate build:
```sh
```<!---sh-->
make alt
```
### Alternate use:
```sh
```<!---sh-->
./pjr.alt
```
@@ -74,7 +74,7 @@ opposite:
To encode a new string input the string as it is meant to come out:
```c
```<!---c-->
X=s().v().o().o().l().S().d().l().i().o().w().N();
```
+6 -6
View File
@@ -141,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>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<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>
<pre class="&lt;!---sh--&gt;"><code> ./pjr</code></pre>
<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>
<pre class="&lt;!---c--&gt;"><code> main(){X=s().v().o().o().l().S().d().l().i().o().w().N();}</code></pre>
<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>
<pre class="&lt;!---sh--&gt;"><code> make alt</code></pre>
<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>
<pre class="&lt;!---sh--&gt;"><code> ./pjr.alt</code></pre>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>This program prints out a string. Can you figure out how
it is done?</p>
@@ -175,7 +175,7 @@ alphabetical character from a to z is printed out as its
opposite:</p>
<pre><code> a-&gt;z b-&gt;y c-&gt;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>
<pre class="&lt;!---c--&gt;"><code> X=s().v().o().o().l().S().d().l().i().o().w().N();</code></pre>
<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>
+3 -3
View File
@@ -1,20 +1,20 @@
## To build:
```sh
```<!---sh-->
make all
```
## To use:
```sh
```<!---sh-->
./scjones
```
## Try:
```sh
```<!---sh-->
./try.sh
```
+3 -3
View File
@@ -141,11 +141,11 @@ Location: <a href="../../location.html#ZZ">ZZ</a> - <em>Unknown location</em></l
<!-- 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>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<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>
<pre class="&lt;!---sh--&gt;"><code> ./scjones</code></pre>
<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>
<pre class="&lt;!---sh--&gt;"><code> ./try.sh</code></pre>
<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
View File
@@ -1,19 +1,19 @@
## To build:
```sh
```<!---sh-->
make all
```
## To use:
```sh
```<!---sh-->
make all
```
NOTE: that's not a typo or mistake but one can also do:
```sh
```<!---sh-->
./o
```
+3 -3
View File
@@ -141,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>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<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>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<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>
<pre class="&lt;!---sh--&gt;"><code> ./o</code></pre>
<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>
+9 -9
View File
@@ -1,6 +1,6 @@
## To build:
```sh
```<!---sh-->
make all
```
@@ -25,7 +25,7 @@ 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:
```sh
```<!---sh-->
./tbr
$ warning: this program uses gets(), which is unsafe.
```
@@ -40,7 +40,7 @@ below, in the [alternate version](#alternate-code) section.
## To use:
```sh
```<!---sh-->
./tbr
$ enter some shell commands
```
@@ -54,7 +54,7 @@ just `exit` or `logout`? Hint: see the authors' remarks.
## Try:
```sh
```<!---sh-->
./tbr
$ ls -l tbr tbr.c
@@ -79,7 +79,7 @@ documented, are not considered bugs as such in the context of the contest.
The authors supplied us with a slightly smaller unformatted version
of the program which we include below:
```c
```<!---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;);}
@@ -99,14 +99,14 @@ equivalent like the authors intended.
### Alternate build:
```sh
```<!---sh-->
make alt
```
### Alternate use:
```sh
```<!---sh-->
./tbr.alt
```
@@ -165,13 +165,13 @@ argument is stolen every time a `>` or `<` is encountered. The
shell flags an error if no arguments are on the stack. Thus, for
example:
```sh
```<!---sh-->
cat > foo > bar
```
cats to `foo`, since it was pushed last, but
```sh
```<!---sh-->
cat > > foo bar
```
+29 -29
View File
@@ -144,7 +144,7 @@ Location: <a href="../../location.html#ZZ">ZZ</a> - <em>Unknown location</em></l
<!-- 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>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<p>The authors provided another version of this program. See the <a href="#alternate-code">alternate
version</a> section below.</p>
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
@@ -155,31 +155,31 @@ version</a> section below.</p>
<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>
<pre class="&lt;!---sh--&gt;"><code> ./tbr
$ warning: this program uses gets(), which is unsafe.</code></pre>
<p>which kind of hid the prompt. Thus the entry was changed to use <code>fgets(3)</code> which
is referred to later in this file.</p>
<p>Also <code>exit(3)</code> returns <code>void</code> but the entry was using it in a binary expression so
this entry would not compile in modern systems. This fix is also referred to
below, in the <a href="#alternate-code">alternate version</a> section.</p>
<h2 id="to-use">To use:</h2>
<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>
<pre class="&lt;!---sh--&gt;"><code> ./tbr
$ enter some shell commands</code></pre>
<p>NOTE: globs do not work with this entry. Why?</p>
<p>NOTE: <code>exit</code> does not work and neither does <code>logout</code>. To exit try sending ctrl-d
or ctrl-c (or kill it from another terminal :-) ). But why does it not work with
just <code>exit</code> or <code>logout</code>? Hint: see the authors’ remarks.</p>
<h2 id="try">Try:</h2>
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./tbr</span></span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a> <span class="ex">$</span> ls <span class="at">-l</span> tbr tbr.c</span>
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb5-4"><a href="#cb5-4" aria-hidden="true" tabindex="-1"></a> <span class="co"># notice how the following does not work:</span></span>
<span id="cb5-5"><a href="#cb5-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">ls</span> tbr<span class="pp">*</span></span>
<span id="cb5-6"><a href="#cb5-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb5-7"><a href="#cb5-7" aria-hidden="true" tabindex="-1"></a> <span class="co"># try figuring out how this entry works in an editor:</span></span>
<span id="cb5-8"><a href="#cb5-8" aria-hidden="true" tabindex="-1"></a> <span class="fu">vi</span> tbr.c</span>
<span id="cb5-9"><a href="#cb5-9" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb5-10"><a href="#cb5-10" aria-hidden="true" tabindex="-1"></a> <span class="co"># then figure out how to exit vi :-)</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./tbr
$ ls -l tbr tbr.c
# notice how the following does not work:
ls tbr*
# try figuring out how this entry works in an editor:
vi tbr.c
# then figure out how to exit vi :-)</code></pre>
<p>What happens if you try using <code>cd -</code> to return to previous directory? What about
<code>cd</code> with no args?</p>
<p>The authors include a section called <a href="#bugs">BUGS</a> that, because they were
@@ -187,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">]&amp;</span><span class="dv">32</span><span class="op">?</span>i<span class="op">[*</span>c<span class="op">&amp;</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">&amp;&amp;++</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">&quot;cd&quot;</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">&lt;</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">&quot;?</span><span class="sc">\n</span><span class="st">$ &quot;</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>
<pre class="&lt;!---c--&gt;"><code> #define D ,close(
char*c,q[512],m[256],*v[99],**u,*i[3];int f[2],p;main(){for(m[m[60]=m[62]=
32]=m[*m=124[m]=9]=6;e(-8),gets(1+(c=q))||(exit(0),0);r(0,0))for(;*++c;);}
r(t,o){*i=i[2]=0;for(u=v+98;m[*--c]^9;m[*c]&amp;32?i[*c&amp;2]=
*u,u-v^98&amp;&amp;++u:3)if(!m[*c]){for(*++c=0;!m[*--c];);*--u=
++c;}u-v^98?strcmp(*u,&quot;cd&quot;)?*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&lt;0?write(2,&quot;?\n$ &quot;-x/4,2),x+1||(exit(1),0):5;}</code></pre>
<p>and in the <a href="tbr.alt.c">alternate source</a>. It has the <code>exit()</code> returns <code>void</code> fix
as well as the <code>gets()</code> to <code>fgets()</code> fix applied to it to make it functionally
equivalent like the authors intended.</p>
<h3 id="alternate-build">Alternate build:</h3>
<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>
<pre class="&lt;!---sh--&gt;"><code> make alt</code></pre>
<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>
<pre class="&lt;!---sh--&gt;"><code> ./tbr.alt</code></pre>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>This program touches on a well known Unix utility, the 6th edition Bourne Shell
(<code>/bin/sh</code>), whose original source was considered to be extremely obfuscated by
@@ -245,9 +245,9 @@ is parsed; a pointer to the stack of arguments is assigned and an
argument is stolen every time a <code>&gt;</code> or <code>&lt;</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">&gt;</span> foo <span class="op">&gt;</span> bar</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> cat &gt; foo &gt; bar</code></pre>
<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">&gt;</span> <span class="op">&gt;</span> foo bar</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> cat &gt; &gt; foo bar</code></pre>
<p>cats to <code>bar</code>, since <code>bar</code> was pushed under <code>foo</code> (remember we’re
parsing right-left).</p>
<p>Depending on your flavor of Unix, <code>cd</code> without an argument will
+8 -8
View File
@@ -1,6 +1,6 @@
## To build:
```sh
```<!---sh-->
make all
```
@@ -18,7 +18,7 @@ For more detailed information see [1990 theorem bugs](../../bugs.html#1990_theor
## To use:
```sh
```<!---sh-->
./theorem expression x1 x2 h y1
```
@@ -35,7 +35,7 @@ where:
## Try:
```sh
```<!---sh-->
./try.sh
```
@@ -62,7 +62,7 @@ left to right. (i.e., parenthesis aren't supported).
Try running the program with the following args:
```sh
```<!---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
@@ -71,14 +71,14 @@ Try running the program with the following args:
But wait, there is more! You also get, free of charge, a
reversing filter! Try:
```sh
```<!---sh-->
./theorem -r 0 0 0 0 < theorem.c > sorter.c
```
Still not impressed? The author throws in for free, a
sort program! Try:
```sh
```<!---sh-->
make sorter
ls | ./sorter
```
@@ -87,14 +87,14 @@ This program is safe for home use as well. The author has
included a safety feature in case you misplace the original
program source:
```sh
```<!---sh-->
./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
```<!---sh-->
./sorter 0 0 0 0 < theorem.c > fibonacci.c
make fibonacci
./fibonacci 1 1
+14 -14
View File
@@ -141,13 +141,13 @@ 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>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
<p>The current status of this entry is:</p>
<pre><code> STATUS: INABIAF - please **DO NOT** fix</code></pre>
<p>For more detailed information see <a href="../../bugs.html#1990_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>
<pre class="&lt;!---sh--&gt;"><code> ./theorem expression x1 x2 h y1</code></pre>
<p>where:</p>
<pre><code> expression - function f(x,y) (see below)
x1 - start of interval
@@ -155,7 +155,7 @@ Location: <a href="../../location.html#US">US</a> - <em>United States of America
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>
<pre class="&lt;!---sh--&gt;"><code> ./try.sh</code></pre>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>The program’s source implements four functions, all from the
same source file!</p>
@@ -169,26 +169,26 @@ operators:</p>
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">&#39;x^2/y+x&#39;</span> 0 1 0.1 6</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./theorem y 0 1 0.1 1
./theorem 1/x 1 2 0.1 0
./theorem &#39;x^2/y+x&#39; 0 1 0.1 6</code></pre>
<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">&lt;</span> theorem.c <span class="op">&gt;</span> sorter.c</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./theorem -r 0 0 0 0 &lt; theorem.c &gt; sorter.c</code></pre>
<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>
<pre class="&lt;!---sh--&gt;"><code> make sorter
ls | ./sorter</code></pre>
<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">&lt;</span> sorter.c <span class="op">&gt;</span> theorem_bkp.c</span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./sorter -r 0 0 0 0 &lt; sorter.c &gt; theorem_bkp.c</code></pre>
<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">&lt;</span> theorem.c <span class="op">&gt;</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>
<pre class="&lt;!---sh--&gt;"><code> ./sorter 0 0 0 0 &lt; theorem.c &gt; fibonacci.c
make fibonacci
./fibonacci 1 1
./fibonacci 2 1</code></pre>
<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
+5 -5
View File
@@ -1,13 +1,13 @@
## To build:
```sh
```<!---sh-->
make all
```
## To use:
```sh
```<!---sh-->
./westley <number>
```
@@ -16,7 +16,7 @@ The number should be greater than 0.
## Try:
```sh
```<!---sh-->
./try.sh
```
@@ -30,14 +30,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
```<!---sh-->
make alt
```
### Alternate use:
```sh
```<!---sh-->
./westley.alt <number>
```
+5 -5
View File
@@ -141,19 +141,19 @@ 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>
<pre class="&lt;!---sh--&gt;"><code> make all</code></pre>
<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">&lt;</span>number<span class="op">&gt;</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./westley &lt;number&gt;</code></pre>
<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>
<pre class="&lt;!---sh--&gt;"><code> ./try.sh</code></pre>
<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>
<pre class="&lt;!---sh--&gt;"><code> make alt</code></pre>
<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">&lt;</span>number<span class="op">&gt;</span></span></code></pre></div>
<pre class="&lt;!---sh--&gt;"><code> ./westley.alt &lt;number&gt;</code></pre>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>If you would rather “Daisy” someone other than Westley, rename
the program as needed. :-)</p>