1 #ifdef HAVE_STDLIB_H
2 #include <stdlib.h>
3 #endif
4 #include <stdio.h>
5 #include "yagi.h"
6 
7 #include <errno.h>
8 
end_if_stop_exists(int * i,int iterations,int divisor)9 void end_if_stop_exists(int *i, int iterations,int divisor)
10 {
11 	if(*i%divisor==0)
12 	{
13 		if(fopen("stop","rt") != NULL)
14 			*i=iterations;  /* force it to exit very soon */
15 		errno=0; /* Will be set to non zero if file dont exist */
16 		printf("%d\r", *i);
17 	}
18 }
19 
20