If you want to stop the loop when strtok is set to null, that has to be the last statement in the loop:
strtok fileword
--> loop the loop while not null
| call asearch
| do the if-check
| strtok fileword
+-- loop the loop
Maybe that will help, if I understand the question.