Fix 1991/dds for clang

Looking at the author's remarks (which I hadn't checked yet) I was able
to determine how to get the code to disable warnings when compiling the
generated C code. The text

    !.Xop.fssps!.Xop.sfuvso.uzqf!.Xop.jnqmjdju.gvodujpo.efdmbsbujpo

had to be added to the string 'q' and then

    system(q-6);

had to be changed to

    system(q-69);

to disable the warnings that clang (at least in macOS - not sure
elsewhere) ended up being errors due to the forcing of -Wno-error.

An important point is that the placement of that text does matter due to
the code:

    *o=fopen(q-3,"w");

If the file name is not at the end then what will happen is the 'a.c' file
will not be created as the end of the string 's' will not be (when
decrypted) 'a.c'. At that point the compilation would fail as there is
no file to compile that is created. Thus the end of the string has to
be:

    !.Xop.fssps!.Xop.sfuvso.uzqf!.Xop.jnqmjdju.gvodujpo.efdmbsbujpo!b/d

With this the file can be generated and compiled with both gcc and clang
even if -Werror would otherwise cause problems.

The alt code has been removed and the Makefile no longer has alt code
nor does it have the 'a' rule.
This commit is contained in:
Cody Boone Ferguson committed 2023-10-21 10:40:19 -07:00
1 parent 365bd6cba7
commit 7257727dfa
7 files changed
+50 -103

No files matched your search

+5 -6
View File
@@ -685,7 +685,6 @@ This entry will also enter an infinite loop if input is not a number > 0.
# 1991
## [1991/dds](1991/dds/dds.c) ([README.md)(1991/dds/README.md))
## [1991/dds.alt](1991/dds/dds.alt.c) ([README.md)(1991/dds/README.md))
## STATUS: INABIAF - please **DO NOT** fix
If the BASIC file cannot be opened for reading or the output file cannot be
@@ -693,14 +692,14 @@ opened for writing the program will very likely crash or do something funny.
This is not a bug but a feature. Please do not fix this except for the
challenge to yourself.
Please also note that for `clang` you have to use [dds.alt](1991/dds/dds.alt.c) not
[dds.c](1991/dds/dds.c).
## STATUS: uses gets() - change to fgets() if possible
That being said the compiled code uses `gets()` not `fgets()`. Can you fix this?
You might find that the `s` array is relevant but if you do change it please
make sure to test all functionality!
It's quite complicated to do: the `s` array is certainly relevant and you can
see a bit of the magic in the [thanks](/thanks-for-fixes.md) and the README.md
file for how it works. It's easy enough to get the code to refer to `fgets()`
and call it correctly but it might take more work to get the generated code
sorted. This will be looked at later.
## [1991/westley](1991/westley/westley.c) ([README.md](1991/westley/README.md))
## STATUS: INABIAF - please **DO NOT** fix