diff --git a/config.c b/config.c index 0da3502..517bd6e 100644 --- a/config.c +++ b/config.c @@ -6,14 +6,14 @@ int loadConfig(char *str_file, char **str_entry,char **host,int *intervall,int size) { int i=0; - FILE *f_config; + FILE *f_config; char temp_str[256]; char *ret = NULL; - printf("\nopening config file\n"); - f_config = fopen(str_file,"r"); - if(f_config != NULL) - { + printf("\nopening config file\n"); + f_config = fopen(str_file,"r"); + if(f_config != NULL) + { ret = fgets(temp_str,256,f_config); while(ret!=NULL) { @@ -35,12 +35,12 @@ int loadConfig(char *str_file, char **str_entry,char **host,int *intervall,int s ptr_host[strcspn(ptr_host,"\n")]=0; while(ptr_host[0]==' ') //Potential segfault?? { - if(ptr_host < (temp_str + strlen(temp_str))) - { - ptr_host = ptr_host + 1; - }else{ - break; - } + if(ptr_host < (temp_str + strlen(temp_str))) + { + ptr_host = ptr_host + 1; + }else{ + break; + } } *host = strdup(ptr_host); printf("my host is:%s\n",*host); @@ -101,22 +101,22 @@ int loadConfig(char *str_file, char **str_entry,char **host,int *intervall,int s }else{ ret = fgets(temp_str,256,f_config); } - } - } - else - { - fprintf(stderr,"error opening file[%s]\n",str_file); - } + } + } + else + { + fprintf(stderr,"error opening file[%s]\n",str_file); + } printf("Done reading config file\n"); - return 0; + return 0; } /*int parseConfig(File *file, char *str_entry) { - char sub_str[256]; - if(strcmp(str_entry,"[Host]")==0)//section - { - fgets(sub_str,256,file); + char sub_str[256]; + if(strcmp(str_entry,"[Host]")==0)//section + { + fgets(sub_str,256,file); - //do sub parsing - } + //do sub parsing + } }*/