Q:

Looping over an input line and calling a function in C? 

I wrote a small rgrep function and I'll have another text file with words that I am checking a pattern against. 
My text file will be in the following format.  
a
because 
cat 
7.* 

How do i write a loop that will call a function for each of those words in the file?  Thanks! 

A:

Make a state machine for that pattern first, then every char drives that state machine to next state.  Check state to check pattern match.