Fixes in 1990/jaw

The program (and the generated program made by shark.sh) no longer use
perror(3) and instead use fprintf(3) (writing to stderr). This is mostly
because in macOS errno == 0 looks like an error.

Some updates to the shark.sh script were also made.

The bug status has been updated as there is apparently another bug
though I was sure it was solved when I last looked at it. It happens
with and without the above updates. I'm unsure about other things too
but these are not in the bugs.md yet as I'm not even sure what to say
just yet.

Added try.sh script which does some of the commands. However as there is
that bug it doesn't do any comparisons - for now.
This commit is contained in:
Cody Boone Ferguson committed 2023-10-30 09:56:23 -07:00
1 parent 1df3b50b23
commit 1d6ef234d0
7 files changed
+35 -53

No files matched your search

+1 -1
View File
@@ -67,7 +67,7 @@ CINCLUDE=
# Optimization
#
OPT= -O3
OPT=
# Default flags for ANSI C compilation
#
+4 -4
View File
@@ -67,7 +67,7 @@ shark.sh, contains a 'jaw.c' embedded within it!
The sender must have `compress` and `btoa`. To send, try:
```sh
sh shark.sh jaw.* README.md > receive
./shark.sh jaw.* README.md > receive
```
The resulting file, `receive`, unpacks the input files
@@ -86,7 +86,7 @@ cmp ../README.md README.md
### ABSTRACT
#### Minimal, Universal File Bundling (or, Functional Obfuscation in a Self-Decoding Unix Shell Archive)
\
James A. Woods\
Universities Space Research Association\
NASA Ames Research Center
@@ -94,7 +94,7 @@ NASA Ames Research Center
---
> "Use an algorithm, go to jail."
>\
>
> -- anon., circa 1988, pre-Morris worm era
----
@@ -134,7 +134,7 @@ environment.
> And he shows them pearly white
> Just a jackknife has Macheath, dear--
> And he keeps it out of sight.
>\
>
> -- Bertolt Brecht, Threepenny Opera
----------------------------------------------
+1 -1
View File
@@ -1,5 +1,5 @@
#define C char
#define F X,perror("oops"),1
#define F X,fprintf(stderr,"oops\n"),1
#define G getchar()
#define I ;if(
#define P putchar
+4 -4
View File
@@ -11,16 +11,16 @@ for i in "${@?${usage?$0 file...}}";do<"$i"||exit;done
#
PATH=$PATH:. a=atob m=unshark z=zcat
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...
(:|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/C/char /g
s/I/;if(/g
s/W/;while(/g
s/Y/%lx /g
s/}/;}/g'>$m.c<<_&&
FX,perror("$m bite: resend"),1;
FX,fprintf(stderr,"$m bite: resend\n"),1;
GgetC()
H(w=g())
K[69001]
@@ -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)
I(w=f)<1l<<k)t@=o,h[f++]=i;o=c}X}
_
($v)&&ln $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&&$r
Z
+11
View File
@@ -0,0 +1,11 @@
#!/usr/bin/env bash
echo "Running shark.sh:"
sh shark.sh README.md jaw.c README.md > receive || exit 1
echo "Done."
echo "Attempting to extract files:"
mkdir -p test
cd test
sh ../receive