/*reads a config file with the following format: name1=setting1 name2=setting2 example: relay = FALSE debug = 1 mods=12345;98765;13456 returns a pointer to a struct wich needs to be freed later on should be portable on pretty much every platform where there is a C compiler with malloc() and enough RAM, this is not optimized for ICs constants and struct defined in header implement comments later */ #include #include #include #include"read_cfg.h" options *read_cfg(char filename[]) { FILE *fpointer; char str[LINEBUFF]; char line[LINEBUFF]; int i=0; int ib=0; int il=0; options *option; option = malloc(MAXLINE*sizeof(*option)); //160 KB HEAP needs to be freed later in main.c if ((fpointer = fopen(filename,"r")) == NULL){ printf("Error opening file"); return 0; } while( fgets (str, LINEBUFF, fpointer)!=NULL || il<=MAXLINE ) { while (i