Hamilton LaboratoriesHamilton C shell 2012User guideSamples

findinclude.csh

Oregon Coast

findinclude.csh
Previous | Next

#  Search the INCLUDE directories for the specified header file.

#  For example:
#
#     9 C% findinclude.csh winnt.h
#     C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winnt.h

#  Copyright (c) 2011-2012 by Hamilton Laboratories.  All rights reserved.

proc findinclude( includefile )

   #  Split the raw INCLUDE variable into a list of directories,
   #  one per line using splitstring, then iterate over the
   #  list using `` ... `` to read whole lines as words.

   foreach i ( ``splitstring $INCLUDE ";"`` )

      #  Check to see if the desired header file exists in
      #  this INCLUDE directory.

      if ( -e $i\$includefile ) echo $i\$includefile

   end
end

@ findinclude( argv )

Previous | Next