From add3204f83d7f723ff0f103aa0e3d643799aff10 Mon Sep 17 00:00:00 2001 From: Corwin Brust Date: Sat, 9 May 2026 03:45:58 -0400 Subject: [PATCH] (identity) add gn_for: send each valid gn to stdin of PROG_AND_ARGS --- ghostwheel.fn.sh | 38 +++++++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/ghostwheel.fn.sh b/ghostwheel.fn.sh index 5fe53c6..5d6e658 100755 --- a/ghostwheel.fn.sh +++ b/ghostwheel.fn.sh @@ -513,18 +513,24 @@ function c4.i.gn_skipped { done fi fi - test 0 -eq "${C4_I_GN_SKIPPED[$gn]}" + test 0 -ne "${C4_I_GN_SKIPPED[$gn]}" } ## check validity/availability of a node -_c4_is_gn= +function c4.i.gn_for { + for gn in $(seq $( c4.i.gn_min ) $( c4.i.gn_max )) ; do + c4.i.gn_skipped $gn ||\ + printf "%s" $gn | $@ + done + +} #function c4.i.is_gn { #seq "$(<.min)" "$(<.max)" | grep -v "$( perl -le 'printf q{\(%s\)}, join q{\|}, map {chomp;$_} <>' <.skip )" | grep "$(hostname -s | tr -d '[[:alpha:]]')" >/dev/null 2>&1 && echo OK #} function c4.fa_src { - local src #="$(case $# in 1) $1 ;; *) $( c4.i.of $@ ) ;; esac) 1)"; shift; + local src #="$(case $# in 1) $1 ;; *) $( c4.i.of $@ ) ;; esac)"; shift; case $# in 1) src=$1 ;; *) src=$( c4.i.of $@ ) ;; @@ -668,6 +674,32 @@ function c4.i.has { #c4.i.has "gn" "max" && echo ok || echo nope #c4.i.has "users" && echo ok || echo nope +C4_TR='H'; ### HEAPS + +## fill given array var with lines from STDIN +declare C4_H_FOR_HI=/dev/stdin +#declare -p C4_H_FOR_AO >/dev/null 2>&1 && unset C4_H_FOR_AO; +declare -a C4_H_FOR_AO=() +declare -i C4_H_FOR_CI=-1 +declare -i C4_H_FOR_CO=-1 +function c4.h.array { + local line= + local IFS= + + C4_H_FOR_AO=() + C4_H_FOR_CI=-1 + C4_H_FOR_CO=-1 + + if test -p $C4_H_FOR_HI ; then + while read line ; do + C4_H_FOR_CI=$((C4_H_FOR_CI+1)) + test -n "$line" || continue + C4_H_FOR_CO=$((C4_H_FOR_CO+1)) + C4_H_FOR_AO+=("$line") + echo "GOT: ${C4_H_FOR_AO[$C4_H_FOR_CO]}" + done <$C4_H_FOR_IH + fi +} C4_TR='S'; ### SPOKES