#!/bin/sh
#
# splint install script for BeOS
#	sena <sena__@hotmail.com>
#

PREFIX=/boot/home/config

test -d ${PREFIX}/share/splint
if [ 1 = $? ]
then
	mkdir -p ${PREFIX}/share/splint
fi

cp ./bin/splint ${PREFIX}/bin/splint
cp -r ./imports ${PREFIX}/share/splint/
cp -r ./lib ${PREFIX}/share/splint/

if [ $LANG = "ja" ]
then
	read -p "環境変数を .profile ファイルに追加しますか？(y/n)" rslt
else
	read -p "Do you want to add variables into your .profile file?(y/n)" rslt
fi

if [ "$rslt" = "y" ]
then
	echo "# splint" >> ~/.profile
	echo "export LARCH_PATH=${PREFIX}/share/splint/lib" >> ~/.profile
	echo "export LCLIMPORTDIR=${PREFIX}/share/splint/imports" >> ~/.profile
fi

if [ $LANG = "ja" ]
then
	read -p "man ファイルをインストールしますか？(y/n)" rslt
else
	read -p "Do you install man file?(y/n)" rslt
fi

if [ "$rslt" = "y" ]
then
	if [ -z $MANPATH ]
	then
		mkdir /boot/home/config/man
		MANPATH=/boot/home/config/man
		echo "# man" >> ~/.profile
		echo "export MANPATH=\"/boot/home/config/man\"" >> ~/.profile
	fi

	cp ./doc/splint.1 $MANPATH/man1
fi

