#!/bin/sh
# Wrap script for search and run CHM Viewer in the host system
# Copyright 2008 Etersoft
# FIXME: GUI warning

# do not translate URL
if echo "$1" | grep ".*://" >/dev/null ; then
    UNIXPATH="$1"
else
    UNIXPATH=`winepath "$1"`
fi

PLAYERLIST="kchmviewer kchm gnochm xchm"

for i in $PLAYERLIST ; do
	test -n "$CHMVIEWER" && break
	CHMVIEWER=`which $i 2>/dev/null`
done

test -z "$CHMVIEWER" && { echo "No CHM Viewer is found on your system" ; exit 1 ; }
$CHMVIEWER "$UNIXPATH"
