#!/bin/sh


dirs="/usr/share/alt-notes
	  /usr/share/alterator-livecd/notes"

find_htmlfile()
{
	local name="$1"
	local languages="$2"
	local path= html_file=

	for path in $dirs; do
		for lang in $languages; do
			case "$lang" in
				POSIX|C|all) lang="all";;
				*) lang="$(printf %s "${lang%%_*}" |tr '[A-Z]' '[a-z]')";;
			esac
			html_file="$path/$name.$lang.html"
			if [ -s "$html_file" ]; then
				echo "$html_file"
				return
			fi
		done
	done
}
