+}
+
+add-x3-target() {
+ # main work machine
+ if ping -q -c1 -w1 x3.office.fsf.org &>/dev/null; then
+ targets+=(x3.office.fsf.org)
+ elif ping -q -c1 -w1 $h.b8.nz &>/dev/null; then
+ # in case we took it home
+ targets+=(x3.b8.nz)
+ else
+ targets+=(x3wg.b8.nz)
+ fi
+}
+
+add-wireless-target-h() {
+ if ping -q -c1 -w1 $h.b8.nz &>/dev/null; then
+ targets+=($h.b8.nz)
+ elif ping -q -c1 -w1 ${h}w.b8.nz &>/dev/null; then
+ targets+=(${h}w.b8.nz)
+ fi
+}
+
+
+# set default targets
+if [[ ! -v targets && ! $source ]]; then
+ exit-if-no-default-targets
+ set-location
+ if $at_home; then
+ if ! $kd_spread && [[ $HOSTNAME != x3 ]]; then
+ add-x3-target
+ fi
+ if [[ $HOSTNAME != kd ]]; then
+ targets+=(kd.b8.nz)
+ fi
+ wireless_home_hosts=(
+ x2
+ sy
+ )
+ for h in ${wireless_home_hosts[@]}; do
+ if [[ $HOSTNAME != "$h" ]]; then
+ add-wireless-target-h
+ fi
+ done
+ elif $at_work; then
+ targets+=(i.b8.nz)
+ for h in x2 x3 kw; do
+ if [[ $HOSTNAME == "$h" ]]; then
+ continue
+ fi
+ if ping -q -c1 -w1 $h.office.fsf.org &>/dev/null; then
+ targets+=($h.office.fsf.org)
+ fi
+ done
+ else
+ targets+=(i.b8.nz)
+ fi