#!/usr/local/bin/ksh93

if [ "x$1" == "x" ]; then
   echo "Usage: ${0##*/} <infostore varname>"
   exit 3
fi

if [ ! -d "$FVWM_USERDIR"/tmp ]; then
   mkdir -p "$FVWM_USERDIR"/tmp
fi

/usr/local/sbin/nscde_fvwmclnt "Exec exec echo \$[infostore.$1] > \"$FVWM_USERDIR\"/tmp/ifsvar_get.$$"
cnt=50
while [ ! -r "$FVWM_USERDIR"/tmp/ifsvar_get.$$ ]
do
   if (($cnt == 0)); then
      echo ${0##*/}: Cannot read "$FVWM_USERDIR"/tmp/ifsvar_get.$$
      rm -f "$FVWM_USERDIR"/tmp/ifsvar_get.$$
      exit 4
   fi
   sleep .1
   ((cnt = cnt - 1 ))
done

cat "$FVWM_USERDIR"/tmp/ifsvar_get.$$
rm "$FVWM_USERDIR"/tmp/ifsvar_get.$$

