From a238404e5f3a76868c2a957eddfb784c5b1d2f03 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Tue, 14 May 2024 07:21:52 -0700 Subject: [PATCH] Fix links, typos etc. for thanks in 1991 --- thanks-for-help.html | 108 ++++++++++++++++++++++-------------------- thanks-for-help.md | 110 +++++++++++++++++++++++-------------------- 2 files changed, 115 insertions(+), 103 deletions(-) diff --git a/thanks-for-help.html b/thanks-for-help.html index 0865628a8..da970e7c5 100644 --- a/thanks-for-help.html +++ b/thanks-for-help.html @@ -1397,7 +1397,8 @@ original code.
Cody added alt code that will be a bit easier to use for -those familiar with vim in the following ways:
+those familiar with vim in the following ways (we don’t want vi users to also +not be able to use it or exit it, now do we ? :-) ):0 to go to first column.$ to go to last column.Cody fixed this for modern systems. There were two invalid operands to binary
-expression (char * and void and int and void) to resolve and
+expression (char *, void and int, void) to resolve and
additionally a mis-feature of the C pre-processor which no longer works had to
be changed as well in order to get this to compile. In particular the macro C,
defined as C =G to make += and similar operators no longer works. The
@@ -1425,58 +1426,60 @@ slightly more like the original, even though it’s unused.
Cody fixed this so that the coordinates being specified would not crash the
-program. This happened because the function that calls atoi(3) took an arg
-without any type specified and as an implicit int it was not a char * which
-crashed the program in modern systems.
Cody fixed this so that the coordinates being specified, a documented
+feature, would not crash the program. This happened because the function that
+calls atoi(3) took an arg without any type specified and as an implicit int
+it was not a char * which crashed the program in modern systems.
Cody also made the file name in the code (which is the default maze file) not
hard-coded but instead be __FILE__.
Finally Cody added the alternate
-version which will possibly feel more at
-home with those familiar with vi(m) (it certainly does feel more at home with
-him): k for forward, h for left and l for right. This version also has a
-more useful way to exit, just entering q followed by enter, rather than
-completing or killing the program.
Finally Cody added the alternate
+version which will possibly feel more
+at home with those familiar with vi(m): k for forward, h for left and l
+for right. This version also has a more useful way to exit, just entering q
+followed by enter, rather than completing (and it’s a maze) or killing the
+program. We still recommend you try the original version first, of course.
As some systems like macOS can be particular about not declaring functions Cody
-added to the Makefile some -include options. These appear to not be strictly
-necessary but it was done due to other syscalls being a problem not being
-declared first.
As some systems like macOS can be particular about not declaring functions
+Cody added to the Makefile some -include options. These appear to
+not be strictly necessary (currently) but it was done due to other syscalls
+being a problem not being declared first, to hopefully future-proof it.
Cody fixed a segfault that prevented this entry from working in any condition
-and he also made it work for clang. He also added checks for NULL FILE *s.
-Furthermore he changed it so that the C from the BASIC uses fgets(), not
+
Cody fixed a segfault that prevented this entry from working in any
+condition (the char *s had to be changed to char s[]) and he also made it
+and the generated code work for clang.
Furthermore Cody changed it so that the C from the BASIC uses fgets(), not
gets(). See FAQ 4.1 - Why were some calls to
the libc function gets(3) changed to use
fgets(3)? for why this was done.
For the magic of clang and fgets() see below.
Clang (at least in some systems?) defaults to having -Werror and the code that
-the entry generates had some warnings that were causing compilation to fail if
-cc is clang as it just ran cc a.c. It ran it by what was once system(q-6);
-but if cc is clang like in macOS this is not enough.
(Cody said he stupidly did the below manually until he thought to write a simple
-program to do the conversions which he used for gets() to fgets() and for
-making the generated code return a value from main() rather than just
-return;).
The following had to be added to the string s (which to fix the segfault was
-changed from char*s to char s[]):
For the magic of clang (which was done manually except the returning a value
+in main()) and fgets(3), see below. The problem with clang can be
+described simply as: clang (at least in some systems?) defaults to having
+-Werror and the code that the entry generates had some warnings that were
+causing compilation to fail if cc is clang (the entry runs cc a.c). An
+example problem that had to be fixed is that the generated code returned from
+main() no value but rather just had return;.
The code used to run cc a.c by what was once system(q-6); but if cc is clang
+like in macOS this is not enough.
If you have the time and interest and you wish to follow the below a bit better,
+see the author’s remarks for the way the string works. The following had to be
+added to the string s:
!.Xop.fssps!.Xop.sfuvso.uzqf!.Xop.jnqmjdju.gvodujpo.efdmbsbujpo
-and then the call to system() had to be changed to:
and then the call to system(3) had to be changed to:
system(q-69);
-An important point is that the placement of this string in the s array does
-matter. This is because of the code:
An important point is that the placement of this string in the s array
+does matter. This is because of the code:
*o=fopen(q-3,"w");
which means the file name that translates to a.c has to be at the end of the
string. Thus the end of the string actually looks like:
!.Xop.fssps!.Xop.sfuvso.uzqf!.Xop.jnqmjdju.gvodujpo.efdmbsbujpo!b/d
But then there is the matter of getting the C to use fgets(3). As can be seen
-above it’s not as simple as changing gets(3) to fgets(3). This was more magic
+above it’s not as simple as changing gets(3) to fgets(3). This involved more magic
characters that had to be updated and some added. The C code:
atoi(gets(b))
is in the string:
@@ -1491,7 +1494,7 @@ have-include stdio.h which in this rotated string is:
.jodmvef!tuejp/i
which had to be added after:
efdmbsbujpo!
-which is the end of the warning disabled for clang as described above.
which is the end of the warning disabled for clang (as described above).
But now the system(q-69); had to be changed to system(q-86);.
Then, later on, Cody discovered that in some systems, clang triggers even more
warnings so this had to be corrected too so the string was updated again and
@@ -1511,15 +1514,17 @@ Thus in full the string became:
and it now is system(q-87);.
It is hoped that this is the last time the string has to be updated to work with
-all versions of clang but if not the above is how it works.
clang, but if not the above is how it works.
With these changes in place it will compile and work with both gcc and clang and
the C code generated will use fgets(3), not gets(3), therefore removing the
-annoying warnings. Note that the array passed to fgets(3) is an int but that
-was the same for gets() and is not necessary to update to a char[].
fgets(3) is an int but that
+was the same for gets() and is not necessary to update to a char[]. Thus you
+might still get some warnings there.
The key to the string is that it rotates the character by +1. This was not
immediately clear until reading the author’s remarks so there was an alt version
-that was something of a kludge, running make a instead but that was removed.
Cody also fixed a typo in LANDER.BAS and made it so that if a file could not be
+that was something of a kludge, running make a instead, but after the proper
+fix was implemented the alt code was removed.
Cody also fixed a typo in LANDER.BAS and made it so that if a file could not be
opened for reading or a file could not be opened for writing it would not crash.
The definition of whether that should be a bug to fix or a feature to not fix
was pondered and changed numerous times and ultimately that problem with this
@@ -1528,16 +1533,17 @@ entry was fixed. It has not been done in all.
Cody made it look much more like the original entry even after the fix that -increased the count in characters from 80 to 106, getting it back down to just -85 (and later back down to 80, see below).
+Cody made it look much more like the original entry even after the fix
+for clang (by the judges) that increased the count in characters from 80 to
+106, getting it back down to just 85 (and later back down to 80, see below).
This was done by redefining main at the compiler line so that it looks like
-the original where one didn’t have to worry about the type of args of main() and
-there were other fewer restrictions and also by removing a cast that was
-not strictly necessary (this does create a new warning: ordered comparison between pointer and integer ('char **' and 'int') but it works just fine).
main()
+(when there were fewer restrictions), and also by removing a cast that was
+not strictly necessary (this created a new warning: ordered comparison between pointer and integer ('char **' and 'int') but it’s no longer there, as
+described below).
That was fine as well but Cody decided to drop it back down to its original 80
-which also resolved the warning described above. This was by more clever use of
-the Makefile which now has a -DB=(int)b so that B can be used in place where
+characters which also resolved the warning described above. This was by more clever use of
+the Makefile which now has a -DB=(int)b so that B can be used in place where
(int)b used to be necessary.
Cody also added the try.sh script which feeds the program some fun input for fun but mostly different output. He added a great string from @@ -1562,7 +1568,7 @@ the above fix was applied to these versions too.
Cody fixed a segfault in this program which prevented it from working. The
-problem was that the read-only char array char *z[] was being written to. The
+problem was that the read-only char array char *z[] was being written to. The
fix was to change it to char z[][100] in two spots (see if you can determine
why two places, not one!). Why 100 when the longest string is < 100? Because a
shorter value caused strange output and it’s easier to just choose a larger
@@ -1572,8 +1578,8 @@ also improved it so that warnings/errors/about to compile messages are not shown
unless the -e option is used. This is because the errors being shown kind of
ruins the experience. Finally he made it pass
ShellCheck.
Cody also added the alt version which is based on the author’s remarks, a -version that supposedly (:-) ) always wins.
+Cody also added the alt version which +is based on the author’s remarks, a version that supposedly (:-) ) always wins.
Cody also fixed the make clobber rule where a file was left lying about when it should have been removed.