They now show the garry.data file and also show a bit more of what is
being done (in the script).
In the thanks file I removed the details as to why there are two
scripts, one for the main version and one for the alt, as that was only
there as at one point using environmental variables was the way it was
being done, but that is no longer important or useful to know.
The try.sh script demonstrates both positive numbers and input that is
not a number at all (comparing two different strings).
The bugs.md has a new INABIAF - negative numbers will hang the program.
It is not clear if another version should be added to gracefully handle
this but that can be decided another time. It is not a documented
feature so it might be called a bug to fix.
There are four scripts:
try.color.sh # original entry colour mode
try.bw.sh # original entry black and white mode
try.alt.color.sh # alt code colour mode
try.alt.bw.sh # alt code black and white mode
The inclusion of unistd.h is for getpid(2). While not strictly necessary
(at least not observed) this type of thing can be a problem and in some
other entries a missing or incorrect prototype caused the entry to fail
(sometimes only some systems namely macOS). This was just noticed by
chance and I did it on a whim.
The try.sh and try.alt.sh scripts correspond to the original entry and
the alt code (which is enhanced).
The PDF files might need a bit more explaining. The author wrote an
article in 'The USENIX Association Newsletter ;login: September /
October 1992 Vol. 17, No. 5' (the exact title from the PDF) called
'Using GraphTab'. I found the full newsletter in the Internet Wayback
Machine which is now added to the repo (okay: the newsletter as a PDF is
added to the repo, not the Internet Wayback Machine :-) ). But the pages
cited are 28-31 so I extracted (with macOS Preview app: File -> Print
option) the specific pages so one need not look at the full newsletter
if they do not wish to. It felt better to have the PDF rather than
images as it's easier to deal with what the right size is: the size is
there and one can zoom in or out as they see fit (whereas with images
different resolutions make it easier or harder to see what is in them).
The primes.sh script is like 1985/august/primes.sh but it only acts on
reversed output (if rev(1) is installed) of the weisberg because
weisberg actually prints out primes so there's no point doing it without
reversing it. One can specify the number of lines to reverse (not how
many primes to show) by passing an arg to the script. The try.sh script
uses the default (15) and also 25.
The two scripts allow one to specify the number and the arg
(corresponding to the argv[1] and argv[2] of the program). The alt
script has a way to redefine the SLEEP variable (in the Makefile) like
SLEEP=500 ./try.alt.sh
The ants.txt file is something that kids throughout the English speaking
world are tortured with, some having been forced to repeat it many,
many, many, too many times, but which fits well here: a grep program
called 'ant' should find lots of ants :-) (and it is a fun use .. or
maybe I just wish to subject others to the torture I was subjected to
decades ago? :-) )
This script shows the entry itself as well as some of the other tools
that the entry generates. The adwc / wc one uses a pipeline to show the
output (with leading spaces and filename removed along with squeezing
spaces) and also writes each to a text file to use diff on, to show how
they have the same output.
Not all the tools are in the script. The adbasename might have a bug
(in any case it doesn't appear to function exactly like basename(1) in
that it requires two args, not one) so it is not used and adgrep is not
used either. For the latter one the author's remarks might provide some
clues as to why I did not include it.
If you like ants there are now 1992 of them here to try out (whatever
that means :-) ).
Some typos in the test Makefile were also fixed (just those that I saw
as the command was scrolling by - I didn't look at the whole file).
The bug fix is simply so it can compile. It assumed exit(3) returned a
value, not void. The fixes noted in the remarks (though I did not see
them at a quick glance) of the author are not in the alt version (that's
the purpose of it).
The try.sh and try.alt.sh scripts correspond to the entry and the alt
code.
Updated .gitignore.
Added 'first.alt' to Makefile for the try.alt.sh script.
In some cases if one were to modify the C code (possibly the same with
the script) in certain ways the program would fail to work even after
changing the code back. Trying to figure out what to put in bugs.md and
on a hunch, changing the fubar.sh script (in particular the ex(1) part)
remedies the problem (or so it seems from the various tests I have
performed including some that caused a problem). In particular:
--- i/1989/fubar/fubar.sh
+++ w/1989/fubar/fubar.sh
@@ -7,13 +7,12 @@ if [[ $# -ne 1 ]]; then
exit 1
fi
# run/compile it
rm -f ouroboros.c x1 x
-ex - <<EOF
-r fubar.c
+ex fubar.c <<EOF
8,9j
w ouroboros.c
EOF
chmod +x ouroboros.c
The C code was also changed to make it even more like the original code.
The script now lets one specify which compiler to use so that one can
(in the case that their cc is clang, for instance like it is with macOS)
specify a path to a real gcc compiler.
The try.txt is a file for the rot13 SORTA file. All but one of the
sorta.* files is used. The only one that is not prints out a verr long
line of output and would flood the screen. The try section in the
README.md does suggest one try it just to be complete.
This script shows not just theorem but the sorter and the Fibonacci
generator as well. For the sorter it reverses output of ls (redirected
to a file) and then shows how using sorter on it results in the same
output of ls (with no options specified). Of course if different ls
sorts output differently this could fail but I did not think of that
until after I wrote it.
The script allows one to more easily see (and verify) what the entry
does. This involves a temporary file that is created (and removed at the
end of the script but which has also been added to .gitignore).
It runs the program with a couple strings and then it feeds the source
code to the program (piped to less) as well (after showing the source
code with less).
Also updated bugs.md with another case where the program might 'break
into tiny bits' but as a feature not a bug. Checking the source code
will give all you need to know about the 'problem' quite well.
One can now do
make clobber P=5 alt
instead of the more awkward
make clobber CDEFINE="-DP=5" alt
The try.alt.sh script was added and allows one to do
P=5 ./try.alt.sh
If P is not specified it uses the default of the alt code (which checks
if it's defined first via #ifdef..#endif). Otherwise it uses the new
value. Of course if one specifies not an int or too high value (or maybe
too low - didn't try that) the program will fail. That is the fault of
the user. The author does note a reasonable range to try.
It now clarifies that in the likely case it fails to compile the alt
version will be built as lmfjyh itself rather than suggesting one run
make alt (which basically did already). It does show how one can compile
the alt code manually still but it is not strictly necessary as this
entry is one of the rare cases where if the primary target fails the alt
target is built automatically.
The script now first checks columns (tput cols) and if it's not 80 it
will ask the user if they still wish to continue. Checking the tab
length of 8 and wraparound is probably not worth the effort. Also
unfortunately output is not as nice as it used to be because compilers
show more context with errors. Still having columns at 80 does improve
the output a fair bit.
The 64-bit code binaries have been renamed to .alt: anonymous.ten.alt
and anonymous.bed.alt. This is because it's theoretically possible that
they are not compiled as 64-bit binaries (though how this might be I
cannot think of at this time) and in any case they are alt builds
(though they use the same source).
In the case the -m32 fails (whether due to compiler[0] or no access to
32-bit binary compilation) make alt will be used with warnings that the
entry cannot work with them. The reason these are built as .alt and not
the original is to be clearer whereas in other cases (like
1985/sicherman) the point was just a backup plan in case a compiler
objects to it. Here they must be compiled as 32-bit ELF binaries (though
we cannot check if they are ELF - at least not easily and in an entirely
portable way - we can at least determine if they compiled as 32-bit) so
the alt builds are set to be .alt in filenames.
The try.sh script has been updated for this and in the case. However
this file needs to be looked at again and will be later. The purpose of
this commit was to resolve another issue that is in the todo file (this
is not yet done and might or might not be done later today).
In the case that the original entry fails to compile (if you don't have
gcc < 2.3.3 this will happen) the alt code will automatically be built.
One can still manually compile the alt code, of course, but this way one
can at least use the entry. Note that in the case the alt code is
automatically compiled it is compiled to the lmfjyh just like what I did
with 1985/sicherman. This was discussed after I did the 1985/sicherman
(which will compile anyway after my fixes unless a compiler objects to
main() having only one arg).