From d8ce37e3618a1bcbedba619c34d1993f567e5810 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Sat, 4 Nov 2023 04:55:14 -0700 Subject: [PATCH] Don't hard code paths in 1990/jaw/shark.sh It is not actually necessary to mess with the path and in fact the $PATH variable is no longer modified or even referred to. The purpose of the program was that even without btoa and uncompress the script should be able to extract the tarball. Now only the tarball path is hard coded as reading a tarball from stdin is problematic though I'm pretty sure it used to work. --- 1990/jaw/Makefile | 2 +- 1990/jaw/shark.sh | 4 ++-- thanks-for-fixes.md | 9 ++++----- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/1990/jaw/Makefile b/1990/jaw/Makefile index 89565d2e9..baf6b45f4 100644 --- a/1990/jaw/Makefile +++ b/1990/jaw/Makefile @@ -142,7 +142,7 @@ atob: zcat ${PROG}: ${RM} -f $@ echo 'PATH=;export PATH;./atob|./zcat' > $@ - ${CHMOD} 0555 $@ + ${CHMOD} 0755 $@ # alternative executable # diff --git a/1990/jaw/shark.sh b/1990/jaw/shark.sh index f37225ad6..76c6faf2e 100755 --- a/1990/jaw/shark.sh +++ b/1990/jaw/shark.sh @@ -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" # -PATH=$PATH:.:.. a=atob m=unshark z=zcat +a=atob m=unshark z=zcat r="rm -f $a $m* ../$m.tar $z" v="cc -Wno-implicit-function-declaration -Wno-implicit-int -o $z $m.c" 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 diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md index d5770fa29..58222e219 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -948,10 +948,9 @@ with if the C preprocessor botches single quotes in cpp expansion. ## [1990/jaw](1990/jaw/jaw.c) ([README.md](1990/jaw/README.md])) -Cody fixed the script to work properly in modern environments including paths, -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 -`&& ...`. +Cody fixed the script to work properly in modern environments including writing +to and extracting from `stdout` 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 is 0 it shows what looks like an error. @@ -961,7 +960,7 @@ the time. NOTE: as `btoa` is not common we used a ruby script from Yusuke but with a minor fix applied by Cody that made the program just show `oops` twice from invalid -input. +input but which now works. ## [1990/pjr](1990/pjr/pjr.c) ([README.md](1990/pjr/README.md]))