#!/bin/csh -f
#
# Queries the current working directory name for version and
# revision information, assuming that the directory goes by
# the name "xcircuit-x.y.z".  This script determines the number
# z and returns it.
#
set pkgname=`pwd`
set pkgname=${pkgname:t}
set version=${pkgname:s/xcircuit-//}
if ( ${version} == ${pkgname} ) then
   set pkgname=`(cd ..; pwd)`
   set pkgname=${pkgname:t}
   set version=${pkgname:s/xcircuit-//}
   if ( ${version} == "xcircuit" ) then
      set rootnames=`(cd ../..; ls | grep xcircuit)`    
      foreach i ($rootnames)
         if (`(cd ../..; readlink $i)` == "xcircuit") then
            set pkgname=$i
            set version=${pkgname:s/xcircuit-//}
            break;
         endif
      end
   endif
endif
set revision=`echo $version | cut -d. -f3`
echo $revision
