#! /bin/tcsh -f

#
# getfullpath
#
# Returns the full path name to the given file
#
# Original Author: REPLACE_WITH_FULL_NAME_OF_CREATING_AUTHOR
# CVS Revision Info:
#    $Author: nicks $
#    $Date: 2007/01/06 00:01:14 $
#    $Revision: 1.3 $
#
# Copyright (C) 2002-2007,
# The General Hospital Corporation (Boston, MA).
# All rights reserved.
#
# Distribution, usage and copying of this software is covered under the
# terms found in the License Agreement file named 'COPYING' found in the
# FreeSurfer source code root directory, and duplicated here:
# https://surfer.nmr.mgh.harvard.edu/fswiki/FreeSurferOpenSourceLicense
#
# General inquiries: freesurfer@nmr.mgh.harvard.edu
# Bug reports: analysis-bugs@nmr.mgh.harvard.edu
#


if($#argv < 1) then
  echo "getfullpath filename"
  exit 1;
endif

set fname = $argv[1];

set dirname = `dirname $fname`;
if(! -e $dirname) then
  echo "ERROR: cannot find $dirname"
  exit 1;
endif

pushd $dirname > /dev/null
set dirname = `pwd`;

set base = `basename $fname`;

echo $dirname/$base

exit 0
