summaryrefslogtreecommitdiff
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
parente44af5d89c4d34591f2dfb4a208756db6f2c24d9 (diff)
downloaddotfiles-27bfaa1f9ca6f1c097d0d38190f63d50e21bc801.tar.gz
hstow: move a few other things out to posix-defuns.sh
-rwxr-xr-xbin/hstow12
-rw-r--r--lib-src/posix-defuns.sh14
2 files changed, 13 insertions, 13 deletions
diff --git a/bin/hstow b/bin/hstow
index 835e2a84..7dbcf0ec 100755
--- a/bin/hstow
+++ b/bin/hstow
@@ -33,9 +33,6 @@
set -efu
IFS="$(printf '\n\t')"
export LC_ALL=C
-tab="$(printf '\t')"
-cchars="$(printf '*[\001-\037\177]*')"
-
. ~/src/dotfiles/lib-src/posix-defuns.sh
# readlink(1) is not POSIX, so we require an alternative.
@@ -88,15 +85,6 @@ disjoin_file () {
fi
}
-dir_contents () {
- ( cd "$1"; find . ! -name . ! -name "$cchars" -print -prune )
-}
-
-fail () {
- echo >&2 "hstow: $*"
- exit 127
-}
-
usage () {
fail "usage: hstow stow|unstow|restow|adopt DIRECTORY"
}
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=