Commits

Cameron Simpson  committed 5f50433

portfwd: move winclausevars invantation into shell function

  • Participants
  • Parent commits 2c153d1

Comments (0)

Files changed (1)

   "$HOME/bin-local/do-portfwd"
 }
 
+# getconfig target
+#
+# Set cfg_* vars from $fwdcfg[$target].
+#
+getconfig()
+{ _gc_wcv=`[ ! -s "$fwdcfg" ] || winclausevars "$fwdcfg" "$1" cfg`
+  eval "$_gc_wcv"
+}
+
 cmd="$cmd $target"
 target_disable_flag=PORTFWD_DISABLE_`echo "$target" | tr '[a-z-]' '[A-Z_]'`
 
   cfg_command=
   cfg_outlog=portfwd-$target    # /dev/null
   cfg_monitor=
-  if [ -s "$fwdcfg" ]
-  then
-    wcv=`winclausevars "$fwdcfg" "$target" cfg`
-    eval "$wcv"
-  fi
+  getconfig "$target"
   case $cfg_pidfile in
     /*) ;; *) cfg_pidfile=$VARRUN/$cfg_pidfile ;;
   esac