ln_ignore=false;//We've reached a new line try to find a key again
continue;
}
if(ln_ignore)continue;
if(ln_char==' '){
ln_space=true;
continue;
}
if(ln_char=='='){
key[ln_buf]='\0';
len_k=ln_buf;
key_found=true;
break;//key finded and buffered
}
if(ln_char==';'||ln_buf+1>=len_k||ln_space&&ln_buf>0){//comments on key is not allowd. Also key len can't be longer than len_k or contain spaces. Stop buffering and try the next line
ln_ignore=true;
continue;
}
ln_space=false;
key[ln_buf]=ln_char;
ln_buf++;
}
if(!key_found){//definitly there isn't no more key that can be readed in the file
key[0]='\0';
value[0]='\0';
len_k=0;
len_v=0;
return;
}
ln_buf=0;
ln_ignore=false;
while(!eof()){//READ VALUE
ln_char=(char)get();
if(ln_char=='\n'){
value[ln_buf]='\0';
len_v=ln_buf;
break;//new line reached, we can stop
}
if(ln_ignore||ln_char==' '&&ln_buf==0)continue;//ignore also initial spaces of the value
if(ln_char==';'||ln_buf+1>=len_v){//comments reached or value len longer than len_v. Stop buffering and go to the next line.