#  FILE NAME is 'awk_fpe'
#
#  @(#)awk_fpe	2.3 84/06/13
#
#  This awk file is called by the script f_create.
#
#  This file looks at the output from a FORTRAN compile and outputs the name
#  of the file if the line it sees is of the format...
#
#             2 Errors in file ROUTINENAME.f   or
#             1 Error in file ROUTINENAME.f  or
#             2 Errors and 1 Warning in file ROUTINENAME.f
#
#  It does this by looking for numbers > 0 as the first thing on a line, 
#  followed by the keyword 'Error' or 'Errors'.  Next, it searches the string
#  for the keyword 'file' and gets the string immediately following this
#  word.  Finally, the file name is printed to standard output.
#
{
  if (( $0 ~ /^[ 	]*[1-9]*[ 	]*(Error|Errors).*/ ) || \
      ( $0 ~ /^[ 	]*[1-9][0-9]*[ 	]*Errors.*/))
    {
      for ( i=0; i<length; i++ )
       {
         if ( substr ($0,i,4) == "file" )
          {
            i +=5;
            for ( j=i; j<length; j++ )
              { 
                if ( substr ( $0,j,1 ) ~ /[ 	]/ )
                 {
                   j--;
                   break;
                 };
              }
            print ( substr ( $0,i,j-i+1 ) );
          };
        }
     };
}
