#!/bin/sh

# determine the installation directory of stic_std_variables and execute inline
if test -n "$STIC_MAIN_DIR"
then
  stic_init_dir=$STIC_MAIN_DIR
elif test -r $HOME/.stic_main_dir
then
  stic_init_dir=$(cat $HOME/.stic_main_dir)
fi
if test "$stic_init_dir" = ""
then
  stic_init_dir=$(dirname "$0")/
else
  stic_init_dir="$stic_init_dir"/scripts/
fi
if test -r "$stic_init_dir"stic_std_variables
then
  . "$stic_init_dir"stic_std_variables
elif test  -z "$STIC_NO_BASH" -a -n "$(type -p stic_std_variables)"
then
  . stic_std_variables
fi


if test -z "$1"
then
  echo "usage : $0  filename [options]" >&2
  exit 1
fi

name="$1"
shift 1

found=$("$stic_bin_dir"similar "$@" -search:"$name")
if test -n "$found"
then
  echo
  echo $found =?= "$name"
  xv $found "$name" -geometry +0+0
else
  echo no similar pic found for "$name"
fi 

exit 0
