Fix 1989/jar.2
There were some things unclear in the README.md file that have now been corrected. Clarified in the README.md that running make clobber all will run the program itself. The make alt target now runs the alt code just like the entry itself. This is fine because it is a simulation (to avoid annoyance of writing binary data to /dev/tty) and since one may still run the program or script directly it's fine. The alternate code section in the README.md was cleaned up and formatted as well.
This commit is contained in:
1 parent
7b1ed2bc94
commit
db6b154b70
5 files changed
+50
-10
No files matched your search
+3
-1
@@ -140,10 +140,12 @@ alt: data ${ALT_TARGET}
|
||||
@${TRUE}
|
||||
|
||||
${PROG}.alt: ${PROG}.alt.c
|
||||
@echo "NOTE: The original source might not compile using modern compilers."
|
||||
@echo NOTE: this compilation results in running the program itself.
|
||||
${RM} -f $@
|
||||
${CP} jar.1.alt.sh $@
|
||||
${CHMOD} +x $@
|
||||
@echo NOTE: We will now simulate: ${CC} -c -o /dev/tty jar.1.alt.c
|
||||
${CC} -c -o /dev/stdout jar.1.alt.c 2>/dev/null | ${STRINGS}
|
||||
|
||||
# data files
|
||||
#
|
||||
|
||||
+15
-6
@@ -9,36 +9,45 @@ Finland
|
||||
|
||||
## To build:
|
||||
|
||||
NOTE: this will run the program itself.
|
||||
|
||||
```sh
|
||||
make clobber all
|
||||
```
|
||||
|
||||
There is an alternate version with a slight difference. See [Alternate
|
||||
code](#alternate-code) below.
|
||||
|
||||
## To run:
|
||||
|
||||
NOTE: this will run the program itself:
|
||||
|
||||
```sh
|
||||
make clobber all
|
||||
```
|
||||
|
||||
### Alternate code:
|
||||
|
||||
One may try:
|
||||
This code, which prints something slightly different, is provided as well.
|
||||
|
||||
```
|
||||
./jar.1.sh
|
||||
```
|
||||
#### To build:
|
||||
|
||||
Or for the original $xurce might not compile using modern compilers, try:
|
||||
NOTE: this will run the program itself.
|
||||
|
||||
```sh
|
||||
make clobber alt
|
||||
```
|
||||
|
||||
or even:
|
||||
#### To run:
|
||||
|
||||
Alternatively, you can run it directly:
|
||||
|
||||
|
||||
```sh
|
||||
./jar.1.alt.sh
|
||||
```
|
||||
|
||||
|
||||
## Judges' remarks:
|
||||
|
||||
On many systems the compiler will not allow you to send the object file to
|
||||
|
||||
@@ -4,5 +4,12 @@
|
||||
# run/compile it
|
||||
rm -f jar.1.alt.o
|
||||
cc jar.1.alt.c -c
|
||||
cat jar.1.alt.o | strings
|
||||
# we do it this way to prevent ShellCheck from whining about useless use of cat,
|
||||
# a most ill-famed warning. Why is it ill-famed? Because there is no such thing
|
||||
# as a useless cat! In fact, the fact cats exist is proof that the Earth is NOT
|
||||
# flat: if it was flat they would have pushed everything off it by now! :-) And
|
||||
# besides that, they provide hours and hours, years and years even, of joy and
|
||||
# companionship to ailurophiles and, contrary to popular belief, they most
|
||||
# certainly do have personalities and they can be very sociable too!
|
||||
strings < jar.1.alt.o
|
||||
rm -f jar.1.alt.o
|
||||
+8
-1
@@ -4,5 +4,12 @@
|
||||
# run/compile it
|
||||
rm -f jar.1.o
|
||||
cc jar.1.c -c
|
||||
cat jar.1.o | strings
|
||||
# we do it this way to prevent ShellCheck from whining about useless use of cat,
|
||||
# a most ill-famed warning. Why is it ill-famed? Because there is no such thing
|
||||
# as a useless cat! In fact, the fact cats exist is proof that the Earth is NOT
|
||||
# flat: if it was flat they would have pushed everything off it by now! :-) And
|
||||
# besides that, they provide hours and hours, years and years even, of joy and
|
||||
# companionship to ailurophiles and, contrary to popular belief, they most
|
||||
# certainly do have personalities and they can be very sociable too!
|
||||
strings < jar.1.o
|
||||
rm -f jar.1.o
|
||||
+16
-1
@@ -502,11 +502,26 @@ entry as seeing the code with the result at once is far more beautiful.
|
||||
|
||||
## [1989/fubar](1989/fubar/fubar.c) ([README.md](1989/fubar/README.md]))
|
||||
|
||||
Cody got this to work with modern systems. The `main()` issues were an
|
||||
Cody got this to work with modern systems. The main issues were that an
|
||||
`#include` had to be added along with fixing the path (due to `.` not being in
|
||||
`$PATH`) to files referred to in the code.
|
||||
|
||||
|
||||
## [1989/jar.1](1989/jar.1/jar.1.c) ([README.md](1989/jar.1/README.md]))
|
||||
|
||||
To prevent annoying output to `/dev/tty` we changed the code to simulate the
|
||||
output via `strings(1)` but Cody removed the ill-famed `useless use of cat` to
|
||||
shut ShellCheck up. Why is it ill-famed? Because there is no such thing as a
|
||||
useless cat, that's why! For instance, the fact they even exist is proof that
|
||||
the Earth is **NOT** flat: because if it was they would have pushed everything
|
||||
off it by now! :-) They're also a great joy to all ailurophiles and yes they
|
||||
most certainly do have a personality and they can be very sociable.
|
||||
|
||||
Whilst he was at it, Cody made it so that one need not run the alt script or alt
|
||||
code directly, to match that of the main entry. As we simulate the functionality
|
||||
anyway, and since one may still run the code or the script (for the original
|
||||
entry and the alt code) anyway, it works out well.
|
||||
|
||||
## [1989/jar.2](1989/jar.2/jar.2.c) ([README.md](1989/jar.2/README.md]))
|
||||
|
||||
Cody fixed this to work with modern compilers. Modern compilers do not allow
|
||||
|
||||
Reference in new issue
Block a user