Fix script in 1990/jaw

Now the files added to the archive will be extracted. It is unfortunate
but a temporary tarball has to be formed rather than writing to stdout.
There is a possible fix to this but it hasn't been looked into yet. The
tarball is temporary, however, and is deleted after it is extracted. The
script MUST be run from a subdirectory of the entry but as the script
had hardcoded the paths before this shouldn't be that big of a deal.

Another problem was more to do with paths and also the script relying on
the exit code allowing for &&. Now it's ';' between most commands.

There still remains, Landon and I believe, a bug in the entry and this
has been added to the bugs.md file; the script not working has been
removed from the bugs.md.
This commit is contained in:
Cody Boone Ferguson committed 2023-11-01 04:48:25 -07:00
1 parent 5041a0d592
commit 8741610110
4 files changed
+12 -22

No files matched your search

-13
View File
@@ -1,22 +1,12 @@
# Best Entropy-reducer # Best Entropy-reducer
James A. Woods\ James A. Woods\
Research Institute for Advanced Computer Science\
MS 230-5\
NASA Ames Research Center\
Moffett Field, CA 94131\
US US
Karl F. Fox\ Karl F. Fox\
Morning Star Technologies, Inc.\
1760 Zollinger Road\
Columbus, OH 43221\
US US
Paul Eggert\ Paul Eggert\
Twin Sun Inc.\
360 N. Sepulveda Blvd. #2055\
El Segundo, CA 90245\
US US
## To build: ## To build:
@@ -25,9 +15,6 @@ US
make all make all
``` ```
NOTE: see the [bugs.md](/bugs.md) file for information on what appears to be a
bug in macOS but is actually not.
### Bugs and (Mis)features ### Bugs and (Mis)features
+4 -4
View File
@@ -1,5 +1,5 @@
for i in "${@?${usage?$0 file...}}";do<"$i"||exit;done for i in "${@?${usage?$0 file...}}";do<"$i"||exit;done
(cat&&tar cbf 1 - "$@"|compress|./btoa&&echo w)<<\Z (cat&&tar cbf 1 unshark.tar "$@"|compress|./btoa&&echo w)<<\Z
#!/bin/sh #!/bin/sh
# #
# GENTLE READER -- write this message to file [no headers!]; run "sh file". # GENTLE READER -- write this message to file [no headers!]; run "sh file".
@@ -9,11 +9,11 @@ for i in "${@?${usage?$0 file...}}";do<"$i"||exit;done
# #
# "Cleverly he dialed from within." -- D. Van Vliet, "Trout Mask Replica" # "Cleverly he dialed from within." -- D. Van Vliet, "Trout Mask Replica"
# #
PATH=$PATH:. a=atob m=unshark z=zcat PATH=$PATH:.:.. a=atob m=unshark z=zcat
r="rm -f $a $m* $z" v="cc -Wno-implicit-function-declaration -o $z $m.c" r="rm -f $a $m* $z" v="cc -Wno-implicit-function-declaration -o $z $m.c"
trap '$r;exit 1' 1 2 13 15 trap '$r;exit 1' 1 2 13 15
echo decoding... echo decoding...
(:|compress|./btoa|./$a|./$z)2>$m>&2||(sed '1,9s/./#define & / (:|compress|btoa|./$a|./$z)2>$m>&2||(sed '1,9s/./#define & /
s/@/[w]/g s/@/[w]/g
s/C/char /g s/C/char /g
s/I/;if(/g s/I/;if(/g
@@ -43,5 +43,5 @@ Z,h@=w;n=8;f=Q+e;i=o=HIo<0)X,1;P(i)WH+1){Iw==Q&e){Z;m=n=8;f=QIH<0)X}
c=wIw>=f)U++=i,w=oWw>=Q)U++=h@,w=t@;P(i=h@)Wp>D+Q)P(*--p) c=wIw>=f)U++=i,w=oWw>=Q)U++=h@,w=t@;P(i=h@)Wp>D+Q)P(*--p)
I(w=f)<1l<<k)t@=o,h[f++]=i;o=c}X} I(w=f)<1l<<k)t@=o,h[f++]=i;o=c}X}
_ _
($v)&&ln -f $z $a)&&./$a<<\w>./$m-&&./$z<./$m->./$m&&tar xvf ./$m&&$r ($v);ln -f $z $a);./$a<<\w>./$m-&&./$z<./$m->./$m;tar xvf ../$m.tar&&$r
Z Z
+1 -1
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
echo "Running shark.sh:" echo "Running shark.sh:"
sh shark.sh README.md jaw.c README.md > receive || exit 1 sh shark.sh shark.sh README.md jaw.c > receive || exit 1
echo "Done." echo "Done."
echo "Attempting to extract files:" echo "Attempting to extract files:"
+7 -4
View File
@@ -932,16 +932,19 @@ With these improvements the entry looks much more like the original!
## [1990/jaw](1990/jaw/jaw.c) ([README.md](1990/jaw/README.md])) ## [1990/jaw](1990/jaw/jaw.c) ([README.md](1990/jaw/README.md]))
Cody fixed the script to work properly in modern environments (to do with `$PATH` Cody fixed the script to work properly in modern environments including paths,
not having `.` in it). Other adjustments were made as well. writing to and extracting from stdout, (to do with `$PATH`
not having `.` in it) and relying on the exit code in the commands to allow for
`&& ...`.
He also changed the `perror(3)` call to `fprintf(3)` because in macOS when errno He also changed the `perror(3)` call to `fprintf(3)` because in macOS when errno
is 0 it shows what looks like an error. is 0 it shows what looks like an error.
He added the [try.sh](1990/jaw/try.sh) to run the commands that we suggested at He added the [try.sh](1990/jaw/try.sh) to run the commands that we suggested at
the time. However, there is a known bug still, see [bugs.md](bugs.md) for the time.
details.
However, there is a known bug still, see [1990 jaw in
bugs.md](/bugs.md#1990-jaw) for details.
NOTE: as `btoa` is not common we used a ruby script from Yusuke. NOTE: as `btoa` is not common we used a ruby script from Yusuke.