summaryrefslogtreecommitdiff
path: root/lib-src
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2023-01-23 08:17:06 -0700
committerSean Whitton <spwhitton@spwhitton.name>2023-01-27 15:16:03 -0700
commit27bfaa1f9ca6f1c097d0d38190f63d50e21bc801 (patch)
treeb25f1096f16bd32efb30fd92ddb778bc28a7f405 /lib-src
parente44af5d89c4d34591f2dfb4a208756db6f2c24d9 (diff)
downloaddotfiles-27bfaa1f9ca6f1c097d0d38190f63d50e21bc801.tar.gz
hstow: move a few other things out to posix-defuns.sh
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/posix-defuns.sh14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib-src/posix-defuns.sh b/lib-src/posix-defuns.sh
index edacea49..a347fa1e 100644
--- a/lib-src/posix-defuns.sh
+++ b/lib-src/posix-defuns.sh
@@ -1,4 +1,4 @@
-# POSIX sh-compatible shell functions
+# POSIX sh-compatible shell definitions
#
# Copyright (C) 2021, 2023 Sean Whitton <spwhitton@spwhitton.name>
#
@@ -15,6 +15,18 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+tab="$(printf '\t')"
+cchars="$(printf '*[\001-\037\177]*')"
+
+fail () {
+ echo >&2 "${0##*/}: $*"
+ exit 127
+}
+
+dir_contents () {
+ ( cd "$1"; find . ! -name . ! -name "$cchars" -print -prune )
+}
+
# Copied from src/connection.lisp in Consfigurator, which see for commentary.
mkstemp () {
local template="${1:-${TMPDIR:-/tmp}/tmp.XXXXXX}" err=