CCL Home Page
Up Directory CCL find_line
#include "utility.h"

char *find_line(file,string,line,line_size)
/*=========================================================================*/
/* PURPOSE: FIND THE NEXT LINE IN THE FILE CONTAINING THE STRING.
/* INPUTS:
/*	FILE		OPEN FILE DESCRIPTOR OF TEXT FILE TO READ.
/*	STRING		STRING TO BE MATCHED.
/*	LINE_SIZE	SIZEOF LINE.
/* OUTPUTS:
/*	LINE		RAW FILE LINE CONTAINING STRING IF FUNCTION IS NON NULL.
/*	RETURN VALUE	POINTER TO START OF MATCHED STRING IN LINE, ELSE NULL.
/* WRITTEN: M.V.GRIESHABER
/* LAST MODIFICATION: 11 JUNE 1991 MVG
*/
   FILE *file;
   char string[];
   char line[];
   int line_size;
   {
   char *str_ptr;	/* POINTER TO START OF MATCHED STRING. */

   /* CHECK EACH LINE OF THE FILE. */
   while (fgets(line,line_size,file)!=NULL)
      {
      /* IF THIS LINE CONTAINS STRING, RETURN POINTER TO START OF STRING. */
      if ((str_ptr=find_string(line,string))!=NULL) return(str_ptr);
      }

   /* HIT END OF FILE WITHOUT FINDING LINE CONTAINING STRING. */
   return(NULL);
   }
Modified: Fri Feb 11 17:00:00 1994 GMT
Page accessed 4940 times since Sat Apr 17 21:58:53 1999 GMT