#! /bin/csh -f

#
# isargflag
#
# USAGE: isargflag string
#
# Returns 1 if string begins with a "-" otherwise returns 0. If the
# string = -1, returns 0.
# 
# Original Author: Doug Greve
# CVS Revision Info:
#    $Author: greve $
#    $Date: 2010/04/26 17:17:19 $
#    $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 "USAGE: isargflag string"
  echo " Returns 1 if string begins with a dash (-) otherwise returns 0. If the"
  echo " string = -1, returns 0."
  exit 1;
endif

set string = $argv[1]; shift;
set tmp = `echo $string | cut -c1-1`
if("$tmp" == "-") then
  set r = 1;
else
  set r = 0;
endif

if($string == "-1") set r = 0;

echo $r;

exit 0;
