#!/bin/sh

cosnames="/usr/bin/omniNames"
orb="omniORB"
#
#  @file rtm-naming
#  @brief OpenRTM-aist name server launcher
#  @date $Date: 2005/05/12 09:06:19 $
#  @author Noriaki Ando <n-ando@aist.go.jp>
# 
#  Copyright (C) 2003-2005
#      Task-intelligence Research Group,
#      Intelligent Systems Research Institute,
#      National Institute of
#          Advanced Industrial Science and Technology (AIST), Japan
#      All rights reserved.
# 
#  $Id: rtm-naming.in,v 1.1.1.1 2005/05/12 09:06:19 n-ando Exp $
# 

#
#  $Log: rtm-naming.in,v $
#  Revision 1.1.1.1  2005/05/12 09:06:19  n-ando
#  Public release.
#
# 


hostname=`hostname`
currdir=`pwd`


usage()
{
	cat<<EOF
Usage: rtm-naming port_number
EOF
}

omniname()
{
	if test -f $cosnames ; then
		rm -f ./omninames-$hostname.log
		rm -f ./omninames-$hostname.bak
		echo 'Starting omniORB omniNames: '$hostname':'$port
		$cosnames -start $port -logdir $currdir &

	fi
}

taonames()
{
	if test -f $cosnames ; then
		echo 'Starting TAO Naming_Service: '$hostname':'$port
		$cosnames -ORBEndPoint iiop://$hostname:$port &
	fi
}


port=$1

case $orb in
	omniORB)
		omniname
		;;
	TAO)
		taonames
		;;
	*)
		usage
		;;
esac

