From 3319d70e4e8fd89fe6140e95504a718717bd4e80 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Wed, 15 Mar 2023 14:24:10 -0500 Subject: Rewrite with sh --- shin.awk | 60 ------------------------------------------------------------ 1 file changed, 60 deletions(-) delete mode 100755 shin.awk (limited to 'shin.awk') diff --git a/shin.awk b/shin.awk deleted file mode 100755 index 80c76aa..0000000 --- a/shin.awk +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/awk -f -# SHIN: include files in shell scripts -# by Case Duckworth -# usage: shin -- FILE.shin... -# each FILE.shin will output to FILE.sh in the same directory -BEGIN { - if (ENVIRON["SHINPATH"]) { - split(ENVIRON["SHINPATH"], SHINPATH, ":") - } else { - SHINPATH[1] = "." - } -} - -FNR == 1 { - outfile = FILENAME - sub(/in$/, "", outfile) -} - -{ - print($0) > outfile -} - -/^# outfile - } - close(inclfile) - sub(/", $0) - print > outfile -} - - -function shin_resolve(filename) -{ - if (match(filename, "^/")) { - return shin_test(filename) - } - if (match(filename, "^~")) { - return shin_test(ENVIRON["HOME"] "/" substr(filename, 2)) - } - sub(/^[ \t]*/, "", filename) - sub(/[ \t]*$/, "", filename) - sp = "" - for (p in SHINPATH) { - sp = sp (sp ? ", " : "") "\"" SHINPATH[p] "\"" - f = SHINPATH[p] "/" filename - gsub("//", "/", f) - return shin_test(f) - } -} - -function shin_test(filename) -{ - if (! system("test -f \"" f "\"")) { - return filename - } - print("Cannot find \"" filename "\" in " sp) > (STDERR ? STDERR : "/dev/stderr") - exit 1 -} -- cgit 1.4.1-21-gabe81