######
progress() {
 if test "$old_progstr" != ""; then
   echo -ne "\r" 1>&2
 fi
 echo -n "$@" 1>&2
 if echo "$@" | egrep 'done$' > /dev/null; then
   echo "" 1>&2
   old_progstr=""
 else 
   old_progstr="$@"
 fi
}

verbose() {
  if test "x$VERBOSE" != "x"; then
    echo "$@" 1>&2
  fi
}

doit() {
  verbose $@
  if test "x$NO_ACT" = "x"; then
    "$@"
  fi
}

# include <str> <strs...>
include() {
  for i in $2
  do
    if test "x$1" = "x$i"; then
      return 0
    fi
  done
  return 1
}

# encode <value>
encode() {
  if test -x "$ULTRAPOSSUM_ENCODE"; then
    echo "$@" | $ULTRAPOSSUM_ENCODE
  else 
    echo "$@" 
  fi
}

# decode <value>
decode() {
  if test -x "$ULTRAPOSSUM_DECODE"; then
    echo "$@" | $ULTRAPOSSUM_DECODE
  else 
    echo "$@" 
  fi
}

# source <path>
source_shell() {
  if test -r "$1"; then
    . $1
  else
    echo "E: no permission to read $1" 1>&2
    exit 1
  fi
}

################################################################

