#! /bin/sh
#
# $Id: //poco/1.4/build/script/projname#3 $
#
# projname
#
# Usage: projname PROJECT_BASE
#
# Extract the project name from the current path
# NOTE: the cd $PROJECT_BASE is necessary to resolve symbolic links,
#       ditto is the kinda strange sh -c pwd
#

PROJECT_BASE=$1
cdir=`sh -c pwd`
cd $PROJECT_BASE
projbase=`sh -c pwd`
cd "$cdir"
if [ "`uname`" = "CYGWIN" ] ; then
	# In 64-bit cygwin, the drive letters in /cygdrive seem to change case.
	# We use a case-insensitive match in the line below to get round this.
	sh -c pwd | sed "s:^$projbase::i" | sed "s:^/::"
else
	sh -c pwd | sed "s:^$projbase::" | sed "s:^/::"
fi
