aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-07-31 11:53:31 +1200
committerTom Ryder <tom@sanctum.geek.nz>2016-07-31 11:54:55 +1200
commit17f6305e253cc36acec5384c55d8369405645a03 (patch)
tree12aff25cfd17fa3deabbab1b8b42fb46a090f96c /bin
parentRemove poetry games tinkering scripts (diff)
downloaddotfiles-17f6305e253cc36acec5384c55d8369405645a03.tar.gz
dotfiles-17f6305e253cc36acec5384c55d8369405645a03.zip
Split out sls(1) into shell and awk
Diffstat (limited to 'bin')
-rwxr-xr-xbin/sls26
-rwxr-xr-xbin/slsf9
2 files changed, 17 insertions, 18 deletions
diff --git a/bin/sls b/bin/sls
index 278d79b4..c5281aa7 100755
--- a/bin/sls
+++ b/bin/sls
@@ -1,18 +1,8 @@
-#!/usr/bin/awk -f
-
-# If no arguments, assume the default config files
-BEGIN {
- if (ARGC == 1) {
- ARGV[1] = "/etc/ssh/ssh_config"
- ARGV[2] = ENVIRON["HOME"] "/.ssh/config"
- ARGC += 2
- }
-}
-
-# Manage the processing flag (starts set)
-NR == 1 || /### sls/ { sls = 1 }
-/### nosls/ { sls = 0 }
-
-# If processing flag set, directive is "Host", and hostname has no wildcards,
-# then print it
-sls && $1 == "Host" && $2 !~ /\*/ { print $2 }
+#!/bin/sh
+if [ "$#" -eq 0 ] ; then
+ for cfg in /etc/ssh_config "$HOME"/.ssh/config ; do
+ [ -e "$cfg" ] || continue
+ set -- "$@" "$cfg"
+ done
+fi
+exec slsf -- "$@"
diff --git a/bin/slsf b/bin/slsf
new file mode 100755
index 00000000..72af8691
--- /dev/null
+++ b/bin/slsf
@@ -0,0 +1,9 @@
+#!/usr/bin/awk -f
+
+# Manage the processing flag (starts set in each file)
+FNR == 1 || /### sls/ { sls = 1 }
+/### nosls/ { sls = 0 }
+
+# If processing flag set, directive is "Host", and hostname has no wildcards,
+# then print it
+sls && $1 == "Host" && $2 !~ /\*/ { print $2 }