void lp_config_parse(LpConfig *lpconfig, bctbx_vfs_file_t* pFile){ char tmp[MAX_LEN]= {'\0'}; LpSection* current_section = NULL; int size =0; if (pFile==NULL) return; while(( size = bctbx_file_get_nxtline(pFile, tmp, MAX_LEN)) > 0){ //tmp[size] = '\0'; current_section = lp_config_parse_line(lpconfig, tmp, current_section); } }
void lp_config_parse(LpConfig *lpconfig, FILE *file){ char tmp[MAX_LEN]= {'\0'}; LpSection* current_section = NULL; if (file==NULL) return; while(fgets(tmp,MAX_LEN,file)!=NULL){ tmp[sizeof(tmp) -1] = '\0'; current_section = lp_config_parse_line(lpconfig, tmp, current_section); } }
LpConfig * lp_config_new_from_buffer(const char *buffer){ LpConfig* conf = lp_new0(LpConfig,1); LpSection* current_section = NULL; char* ptr = ms_strdup(buffer); char* strtok_storage = NULL; char* line = strtok_r(ptr, "\n", &strtok_storage); conf->refcnt=1; while( line != NULL ){ current_section = lp_config_parse_line(conf,line,current_section); line = strtok_r(NULL, "\n", &strtok_storage); } ms_free(ptr); return conf; }