aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rw-r--r--makefile5
-rw-r--r--src/ini_read.c298
-rw-r--r--src/ini_rw.h43
-rw-r--r--src/main.c30
-rw-r--r--tests/bom.ini4
-rw-r--r--tests/results/boom.txt8
-rw-r--r--tests/results/test.txt69
8 files changed, 274 insertions, 185 deletions
diff --git a/README.md b/README.md
index d5570ef..f34dc91 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-
+
# Lightweight INI style Configuration manager
## Supports (currently)
diff --git a/makefile b/makefile
index a01a0dd..8cab41f 100644
--- a/makefile
+++ b/makefile
@@ -6,7 +6,8 @@ LD = gcc
# néhány apróság:
MKD = /bin/mkdir -p
-RM = /bin/rm
+# A '-' jel miatt átugorja a hibát
+RM = -/bin/rm
# fordíto általános flagek
@@ -29,7 +30,7 @@ all: $(PROG)
# debug-hoz felüldefiniálva
-debug: CFLAGS = -Wall -g -g3 -ggdb -Wpedantic -Wmissing-prototypes
+debug: CFLAGS = -Wall -g -g3 -ggdb -std=c89 -Wpedantic -Wmissing-prototypes
debug: LDFLAGS =
debug: LDLIBS = -lefence
# nem mindegy, hogy mellette van, vagy alatta egy sorral!
diff --git a/src/ini_read.c b/src/ini_read.c
index d285f9b..40db102 100644
--- a/src/ini_read.c
+++ b/src/ini_read.c
@@ -11,9 +11,11 @@
#define ini_read_c
#include "ini_rw.h"
-
+
+/*
enum ini_states state = Start;
-struct lci_data fsmdata;
+struct lci_data fsmdata;
+*/
size_t strNullLen(const char *str){
@@ -25,30 +27,29 @@ size_t strNullLen(const char *str){
}
char *strResize(char *ptr, size_t oldsize, size_t newsize){
- //return ptr;
+ /*return ptr;*/
char *tmp;
- if(newsize <= 0){ //pucol
+ if(newsize <= 0){ /* deleting */
free(ptr);
return NULL;
- } else if(newsize != oldsize){ //Változtat
+ } else if(newsize != oldsize){ /* If any changes needed */
tmp = (char *) malloc(newsize*sizeof(char));
memset(tmp, 0, newsize);
-
- if(tmp == NULL){ //Hiba esetén nem nyúl hozzá
+ if(tmp == NULL){ /* String is not changed at malloc error */
return ptr;
} else if(ptr == NULL) {
return tmp;
- /*} else if(newsize > oldsize) { // FEL
+ /*} else if(newsize > oldsize) { //FEL
strncpy(tmp, ptr, oldsize); // old < new
//snprintf(tmp, newsize, "%s", ptr);
free(ptr);
return tmp;
*/
- } else /*if(newsize < oldsize)*/ { //LE
- //strncpy(tmp, ptr, newsize); // new < old
- snprintf(tmp, newsize, "%s", ptr);
+ } else /*if(newsize < oldsize)*/ {
+ strncpy(tmp, ptr, newsize); /* c89 */
+ /*snprintf(tmp, newsize, "%s", ptr);*/ /* c99 */
free(ptr);
return tmp;
} /*else { //Ide sosem jutunk
@@ -60,131 +61,134 @@ char *strResize(char *ptr, size_t oldsize, size_t newsize){
}
char unescape(char c){
- if(c == 'n'){ //Newline
+ if(c == 'n'){ /* Newline */
return '\n';
- } else if(c == 'a'){ //Bell
+ } else if(c == 'a'){ /* Bell */
return '\a';
- } else if(c == 'b'){ //Backspace
+ } else if(c == 'b'){ /* Backspace */
return '\b';
- } else if(c == 'f'){ //Formfeed Page Break
+ } else if(c == 'f'){ /* Formfeed Page Break */
return '\f';
- } else if(c == 'r'){ //Carrige return
+ } else if(c == 'r'){ /* Carrige return */
return '\r';
- } else if(c == 't'){ //Horizontal tab
+ } else if(c == 't'){ /* Horizontal tab */
return '\t';
- } else if(c == 'v'){ //Vertical tab
+ } else if(c == 'v'){ /* Vertical tab */
return '\v';
} else if(c == 'e'){
return 0x1B;
/*} else if(c < 0x20){ // debug
return '~'; */
- } else { // jó az eredeti
+ } else { /* Original is OK */
return c;
}
}
char eescape(char c){
- if(c == '\n'){ //Newline
+ if(c == '\n'){ /* Newline */
return 'n';
- } else if(c == '\a'){ //Bell
+ } else if(c == '\a'){ /* Bell */
return 'a';
- } else if(c == '\b'){ //Backspace
+ } else if(c == '\b'){ /* Backspace */
return 'b';
- } else if(c == '\f'){ //Formfeed Page Break
+ } else if(c == '\f'){ /* Formfeed Page Break */
return 'f';
- } else if(c == '\r'){ //Carrige return
+ } else if(c == '\r'){ /* Carrige return */
return 'r';
- } else if(c == '\t'){ //Horizontal tab
+ } else if(c == '\t'){ /* Horizontal tab */
return 't';
- } else if(c == '\v'){ //Vertical tab
+ } else if(c == '\v'){ /* Vertical tab */
return 'v';
- //} else if(c == '\''){ //Apostrophe
+ /*} else if(c == '\''){ //Apostrophe debug
// return '\'';
- //} else if(c == '"'){ //Double quotation mark
- // return '\"';
+ //} else if(c == '"'){ //Double quotation mark debug
+ // return '\"'; */
/*} else if(c < 0x20){ //debug
return '~';*/
- } else { // jó az eredeti
+ } else { /* Original is OK */
return c;
}
}
-int64_t getFileMaxLineLen(FILE *tfd){
+size_t getFileMaxLineLen(FILE *tfd){
- int64_t c=0;
- int64_t i=0, max=0;
+ size_t c=0;
+ size_t i=0, max=0;
if (tfd != NULL){
while( c != EOF){
c = fgetc(tfd);
- if (c == '\n' || c == EOF) { //Line End
- i++; // An "\n" is a character
+ if (c == '\n' || c == EOF) { /* Line End */
+ i++; /* The "\n" is a character also */
if(max < i){
max = i;
}
- i = 0; // Recount on every newline
+ i = 0; /* Recount on every newline */
} else {
i++;
}
}
- fseek(tfd, 0, SEEK_SET); //vissza az elejére
+ fseek(tfd, 0, SEEK_SET); /* Pos. to the start */
return max;
- } else { // File open error
+ } else { /* File open error */
return -1;
}
}
-struct lci_data *iniFSM(struct lci_data *data, const char *in, int64_t len){
+struct lci_data *iniFSM(struct lci_data *data, const int *in, int32_t len){
- int64_t i,j, vallen=len;
+ int32_t i,j, vallen=len;
enum ini_states pstate=Start, state=Start;
- //char cc;
+ char cc;
if(data == NULL){
return NULL;
} else {
for(i=0, j=0; i<len; i++, j++){
- //cc = in[i];
+ cc = in[i];
switch (state) {
case Start:
- if(data->nodeState == lci_MULTILINE){ //Elküldjük gyűjteni
- state = DqmW; // Vagy ValW ??
- j = data->valueLen-2; //(x-1) => \0; (x-2) => j--;
- data->value = strResize(data->value, data->valueLen, data->valueLen+len+1); // strResize(ptr, oldsize, newsize
+ if(data->nodeState == lci_MULTILINE){ /* Bypass to the DQM collection */
+ state = DqmW;
+ j = data->valueLen-2; /* (x-1) => \0; (x-2) => j--; */
+ data->value = strResize(data->value, data->valueLen, data->valueLen+len+1); /* strResize(ptr, oldsize, newsize */
vallen = data->valueLen+len+1;
data->nodeState = lci_CONTINUE;
- i--;
+ i--; /* first char is collected also */
pstate = Start;
break;
- } else if(in[i] == '\n' || in[i] == '\r' || in[i] == '\0'){ //sorvége
- state = Stop; // Sorvége
+ } else if(in[i] == '\n' || in[i] == '\r' /*|| in[i] == '\0'*/){ /* Line End */
+ state = Stop;
i--;
- } else if(isspace(in[i])){ //ISSPACE, de nem sorvége
+ }else if(in[i] == 0xEF || in[i] == 0xBB || in[i] == 0xBF || in[i] == 0xFF || in[i] == 0x00 ){ /* UTF8, UTF16, UTF32 BOM */
+ state = Start;
+ } else if(isspace(in[i])){ /* ISSPACE, but not line end */
state = BgnSp;
- } else if(in[i] == ';' || in[i] == '#' ){ //Komment jel az első
+ } else if(in[i] == ';' || in[i] == '#' ){ /* Comment sign first */
j = -1;
state = CommEndW;
data->comment = strResize(data->comment, data->commentLen, len);
memset(data->comment, 0, len);
data->commentStartPos = i;
- data->sectionStartPos = -1; //Hogy pucoljon
- } else if(in[i] == '['){ //Szekció kezdődik
+ data->sectionStartPos = -1; /* Comment only line */
+ data->commentSign = in[i];
+ } else if(in[i] == '['){ /* Section start */
j = -1;
state = SectEndW;
data->section = strResize(data->section, data->sectionLen, len);
memset(data->section, 0, len);
- data->sectionStartPos = i; //zárójeleket is veszi!
- } else if(isalnum(in[i]) ){ //Változó jön
+ data->sectionStartPos = i; /* Brackets [] are counted! */
+ } else if(isalnum(in[i]) ){ /* Parameter is starting */
j = -1;
state = EqW1;
data->param = strResize(data->param, data->paramLen, len);
memset(data->param, 0, len);
data->paramStartPos = i;
i--;
- } else { // control karakterek az 1. pos-ban
+ } else { /* eg: Control characters in pos 1. */
state = Error;
i--;
}
@@ -194,24 +198,25 @@ struct lci_data *iniFSM(struct lci_data *data, const char *in, int64_t len){
break;
- case BgnSp: //Space() at Begining
+ case BgnSp: /* Space() at Begining */
if (in[i] == '\n' || in[i] == '\r' ){
state = Stop;
i--;
- } else if (in[i] == ';' || in[i] == '#'){ //Komment jön
+ } else if (in[i] == ';' || in[i] == '#'){ /* Comment is coming */
j = -1;
state = CommEndW;
data->comment = strResize(data->comment, data->commentLen, len);
memset(data->comment, 0, len);
data->commentStartPos = i;
- data->sectionStartPos = -1; //Hogy pucoljon
- } else if(in[i] == '['){ //Szekció lesz
+ data->sectionStartPos = -1; /* No Section started in this line */
+ data->commentSign = in[i];
+ } else if(in[i] == '['){ /* Section is starting */
j = -1;
state = SectEndW;
data->section = strResize(data->section, data->sectionLen, len);
memset(data->section, 0, len);
data->sectionStartPos = i;
- } else if (isalnum(in[i])){ //Változó lesz belőle
+ } else if (isalnum(in[i])){ /* Parameter will be */
j = -1;
state = EqW1;
data->param = strResize(data->param, data->paramLen, len);
@@ -228,7 +233,7 @@ struct lci_data *iniFSM(struct lci_data *data, const char *in, int64_t len){
break;
- case CommEndW: //Innentől comment, a sor végéig
+ case CommEndW: /* Till comment to the line end */
if(in[i] == '\n' || in[i] == '\r'){
state = Stop;
data->nodeState = lci_READY;
@@ -242,17 +247,17 @@ struct lci_data *iniFSM(struct lci_data *data, const char *in, int64_t len){
break;
- case SectEndW: // Section-t gyűjti
+ case SectEndW: /* Section Collector */
if(in[i] == ']'){
state = SectEndD;
data->section[j] = '\0';
data->sectionLen = j+1;
- if(j == 0){ //empty section
+ if(j == 0){ /* empty section */
state = Error;
}
} else if(isalnum(in[i]) || in[i]=='/' || in[i]==' ' || in[i]=='_' || in[i]=='-' || in[i]=='.'){
data->section[j] = in[i];
- } else /*if((in[i] >= 0x00 && in[i] < 0x20) || in[i] == ';' || in[i] == '#' )*/ { // túl korai sorvég, SP(), vagy komment
+ } else /*if((in[i] >= 0x00 && in[i] < 0x20) || in[i] == ';' || in[i] == '#' )*/ { /* túl korai sorvég, SP(), vagy komment */
state = Error;
data->section[j] = '\0';
data->sectionLen = j+1;
@@ -264,36 +269,37 @@ struct lci_data *iniFSM(struct lci_data *data, const char *in, int64_t len){
break;
- case SectEndD: //Section begyűjtve, utána: SP(), sorvég, vagy komment
+ case SectEndD: /* Section collected, then: SP(), line_end, or comment */
if(in[i] == '\n' || in[i] == '\r'){
state = Stop;
data->nodeState = lci_READY;
i--;
}else if(isspace(in[i])){
- state = SectEndD; //marad helyben
+ state = SectEndD; /* remain here */
} else if (in[i] == ';' || in[i] == '#'){
j = -1;
state = CommEndW;
data->comment = strResize(data->comment, data->commentLen, len);
memset(data->comment, 0, len);
data->commentStartPos = i;
+ data->commentSign = in[i];
data->nodeState = lci_CONTINUE;
} else {
- state = Error; //hibás sor
+ state = Error; /* wrong character in line */
i--;
}
pstate = SectEndD;
break;
- case EqW1: //Egyenlő előtti (változó)
- if(in[i] == '='){ //végén egyenlő
+ case EqW1: /* Parameter name, befora EQ_sign(=) */
+ if(in[i] == '='){ /* EQ sign arrived */
state = ValPSP;
data->param[j] = '\0';
data->paramLen = j + 1;
- } else if(isalnum(in[i]) || in[i]=='[' || in[i]==']' || in[i]=='_' || in[i]=='-' || in[i]=='.'){ //A paraméter neve vagy tömb támogatása (Mint PHP-ben)
+ } else if(isalnum(in[i]) || in[i]=='[' || in[i]==']' || in[i]=='_' || in[i]=='-' || in[i]=='.'){ /* Arrays are supported ins parameter name, like in PHP */
data->param[j] = in[i];
- } else if(isspace(in[i]) && in[i] != '\r' && in[i] != '\n'){ //Végén csak space lehet, egyenlő nélkül sorvég nem
+ } else if(isspace(in[i]) && in[i] != '\r' && in[i] != '\n'){ /* Only SPACE allowed between Param_name and EQ_sign */
state = EqW2;
data->param[j] = '\0';
data->paramLen = j + 1;
@@ -305,11 +311,11 @@ struct lci_data *iniFSM(struct lci_data *data, const char *in, int64_t len){
break;
- case EqW2: //Egyenlő előtti (space)
- if(in[i] == '='){ //Végre egyenlő
+ case EqW2: /* SPACE before EQ_sign */
+ if(in[i] == '='){ /* EQ_sign arrived */
j = -1;
state = ValPSP;
- } else if(isspace(in[i])){ //marad helyben
+ } else if(isspace(in[i])){ /* Another space, remain here */
state = EqW2;
} else {
state = Error;
@@ -319,13 +325,13 @@ struct lci_data *iniFSM(struct lci_data *data, const char *in, int64_t len){
break;
- case ValPSP: //EqD //megvolt az egyenlő, érték előtti space
- if(in[i] == '\n' || in[i] == '\r' /*|| in[i] == '\0'*/ ){ //ekkor üres változó
+ case ValPSP: /* After EQ_sign, (SPACE, or value can arrive) */
+ if(in[i] == '\n' || in[i] == '\r' /*|| in[i] == '\0'*/ ){ /* Empty value */
state = Stop;
data->nodeState = lci_READY;
data->valueDraw = lci_SIMPLEVAL;
i--;
- } else if(in[i] == ';' || in[i] == '#'){ //komment jön
+ } else if(in[i] == ';' || in[i] == '#'){ /* Comment */
j = -1;
state = CommEndW;
data->comment = strResize(data->comment, data->commentLen, len);
@@ -333,8 +339,9 @@ struct lci_data *iniFSM(struct lci_data *data, const char *in, int64_t len){
data->commentStartPos = i;
data->nodeState = lci_CONTINUE;
data->valueDraw = lci_SIMPLEVAL;
+ data->commentSign = in[i];
- } else if( pstate != Bslsh && in[i] == '\"' ){ //Macskaköröm jött
+ } else if( pstate != Bslsh && in[i] == '\"' ){ /* DQM arrived => DQM collector */
j = -1;
state = DqmW;
data->value = strResize(data->value, data->valueLen, len);
@@ -342,9 +349,9 @@ struct lci_data *iniFSM(struct lci_data *data, const char *in, int64_t len){
data->valueStartPos = i;
data->nodeState = lci_CONTINUE;
data->valueDraw = lci_DQUOTEDVAL;
- } else if(isspace(in[i])){ //SPACE jött -> marad helyben
+ } else if(isspace(in[i])){ /* Another SP(), remain here */
state = ValPSP;
- } else if(isalnum(in[i]) || in[i]=='-') { //Változó macskaköröm nélkül
+ } else if(isalnum(in[i]) || in[i]=='-') { /* Normal_Value collector */
j = -1;
state = ValW;
data->value = strResize(data->value, data->valueLen, len);
@@ -361,14 +368,14 @@ struct lci_data *iniFSM(struct lci_data *data, const char *in, int64_t len){
break;
- case ValW: //Érték kigyűjtése
- if(in[i] == '\n' || in[i] == '\r'){ //vége -> új sor
+ case ValW: /* Normal_Value collector */
+ if(in[i] == '\n' || in[i] == '\r'){ /* end -> new_line */
state = Stop;
data->nodeState = lci_READY;
data->value[j] = '\0';
data->valueLen = j + 1;
i--;
- } else if(in[i] == ';' || in[i] == '#'){ //comment
+ } else if(in[i] == ';' || in[i] == '#'){ /* comment */
data->nodeState = lci_CONTINUE;
data->value[j] = '\0';
data->valueLen = j+1;
@@ -377,13 +384,14 @@ struct lci_data *iniFSM(struct lci_data *data, const char *in, int64_t len){
data->comment = strResize(data->comment, data->commentLen, len);
memset(data->comment, 0, len);
data->commentStartPos = i;
+ data->commentSign = in[i];
data->nodeState = lci_CONTINUE;
- //} else if( in[i] == '\\' ){ //Backslash jött
+ /* } else if( in[i] == '\\' ){ // Backslash support
// j--; //A '\' nem számít bele!
- // state = Bslsh;
- } else if( isalnum(in[i]) || in[i]=='_' || in[i]=='-' || in[i]=='.' ){ //Normál betűk, space() csak idézőjelben jöhet!
+ // state = Bslsh; */
+ } else if( isalnum(in[i]) || in[i]=='_' || in[i]=='-' || in[i]=='.' ){ /* Regular characters without SP() */
data->value[j] = in[i];
- } else if(isspace(in[i])){ //Aposztróf nélüli space -> sorvég
+ } else if(isspace(in[i])){ /* SPACE arrived -> line_end */
data->value[j] = '\0';
data->valueLen = j+1;
data->nodeState = lci_READY;
@@ -397,7 +405,7 @@ struct lci_data *iniFSM(struct lci_data *data, const char *in, int64_t len){
break;
- case Bslsh: //Backslash -> escape-re lesz szükség
+ case Bslsh: /* Backslash -> Escaping needed */
if(pstate == ValW){
state = ValW;
data->value[j] = unescape(in[i]);
@@ -407,24 +415,24 @@ struct lci_data *iniFSM(struct lci_data *data, const char *in, int64_t len){
}else if(pstate == DqmW){
state = DqmW;
data->value[j] = unescape(in[i]);
- if(in[i] == '\n'){ //Workaround for UNIX line end
+ if(in[i] == '\n'){ /* Workaround for UNIX line end */
i--;
}
- if( in[i] == '\r'){ //Workaround for WIN line endings
+ if( in[i] == '\r'){ /* Workaround for WIN line endings */
j--;
}
} else {
state = Error;
i--;
}
- //if(0x00 < in[i] && in[i] < 0x20){ //láthatatlan: pl \\n (escapelt sorvége)
+ /* if(0x00 < in[i] && in[i] < 0x20){ //láthatatlan: pl \\n (escapelt sorvége)
// j--;
- //}
+ //} */
pstate = Bslsh;
break;
- case ValFSP: //Érték utáni space
+ case ValFSP: /* Space after value */
if( in[i] == '\n' || in[i] == '\r'){
state = Stop;
i--;
@@ -434,9 +442,10 @@ struct lci_data *iniFSM(struct lci_data *data, const char *in, int64_t len){
data->comment = strResize(data->comment, data->commentLen, len);
memset(data->comment, 0, len);
data->commentStartPos = i;
+ data->commentSign = in[i];
data->nodeState = lci_CONTINUE;
} else if(isspace(in[i])){
- state = ValFSP; //marad helyben
+ state = ValFSP; /* SP() -> ermain here */
} else {
state = Error;
i--;
@@ -445,23 +454,23 @@ struct lci_data *iniFSM(struct lci_data *data, const char *in, int64_t len){
break;
- case DqmW: //dupla idézőjelben az érték
- if( in[i] == '\"'){ //újabb idézőjel -> string vége
+ case DqmW: /* DQM Collector (Double Quotation MArk) */
+ if( in[i] == '\"'){ /* Second DQM => Sring_end */
data->value[j] = '\0';
data->valueLen = j+1;
data->nodeState = lci_READY;
state = ValFSP;
- } else if ( in[i] == '\\'){ //Backslash jött
+ } else if ( in[i] == '\\'){ /* Backslash */
j--;
state = Bslsh;
- } else if( in[i] == '\n' && in[i-1] == '\\'){ ///UNIX style
- data->value[j] = '\0'; // '\\n' => '\n\0'
+ } else if(len > 1 && in[i] == '\n' && in[i-1] == '\\'){ /* UNIX style line endings*/
+ data->value[j] = '\0'; /* '\\n' => '\n\0' */
data->valueLen = j+1;
data->nodeState = lci_MULTILINE;
data->valueDraw = lci_MULTILINEVAL;
state = Stop;
i--;
- } else if( in[i] == '\n' && in[i-1] == '\r' && in[i-2] == '\\'){ //WINDOWS style
+ } else if(len > 2 && in[i] == '\n' && in[i-1] == '\r' && in[i-2] == '\\'){ /* WINDOWS style */
data->value[j] = '\n';
data->value[j+1] = '\0';
data->valueLen = j+2;
@@ -469,7 +478,7 @@ struct lci_data *iniFSM(struct lci_data *data, const char *in, int64_t len){
data->valueDraw = lci_MULTILINEVAL;
state = Stop;
i--;
- } else if( pstate != Bslsh && ( in[i] == '\r' || in[i] == '\n' || in[i] == '\0')){ //túl korai sorvége
+ } else if( pstate != Bslsh && (in[i] == '\r' || in[i] == '\n' || in[i] == '\0')){ /* Too early Line_end */
state = Error;
i--;
} else {
@@ -480,21 +489,21 @@ struct lci_data *iniFSM(struct lci_data *data, const char *in, int64_t len){
case Error:
- data->errorMsg = strResize(data->errorMsg, data->errorMsgLen, 256);
- //memset(data->errorMsg, 0, 256) ;
+ data->errorMsg = strResize(data->errorMsg, data->errorMsgLen, 256); /* Returns zero-filled string */
if(pstate == SectEndW || pstate == SectEndD){
- data->errorMsgLen = snprintf(data->errorMsg, 256, "Illegal character or EMPTY SECTION! (line: %ld, pos: %ld)", data->lineNum, i+1) +1;
+ data->errorMsgLen = sprintf(data->errorMsg, "Illegal character or EMPTY SECTION! (line: %d, pos: %d)", data->lineNum, i+1) +1;
} else if(pstate == EqW1 || pstate == EqW2){
- data->errorMsgLen = snprintf(data->errorMsg, 256, "Illegal character at PARAMETER! (line: %ld, pos: %ld)", data->lineNum, i+1) +1;
+ data->errorMsgLen = sprintf(data->errorMsg, "Illegal character at PARAMETER! (line: %d, pos: %d)", data->lineNum, i+1) +1;
} else if(pstate == ValPSP || pstate == ValW || pstate == ValFSP ){
- data->errorMsgLen = snprintf(data->errorMsg, 256, "Illegal character at VALUE! (line: %ld, pos: %ld)", data->lineNum, i+1) +1;
+ data->errorMsgLen = sprintf(data->errorMsg, "Illegal character at VALUE! (line: %d, pos: %d)", data->lineNum, i+1) +1;
} else if(pstate == DqmW){
- data->errorMsgLen = snprintf(data->errorMsg, 256, "Double quotation mark needed! (line: %ld, pos: %ld)", data->lineNum, i+1) +1;
- } else { //pstate == Stop
- data->errorMsgLen = snprintf(data->errorMsg, 256, "Illegal character! (line: %ld, pos: %ld)", data->lineNum, i+1) +1;
+ data->errorMsgLen = sprintf(data->errorMsg, "Double quotation mark needed! (line: %d, pos: %d)", data->lineNum, i+1) +1;
+ } else {
+ data->errorMsgLen = sprintf(data->errorMsg, "Illegal character! (line: %d, pos: %d)", data->lineNum, i+1) +1;
}
+
i--;
state = Stop;
data->nodeState = lci_ERROR;
@@ -502,7 +511,7 @@ struct lci_data *iniFSM(struct lci_data *data, const char *in, int64_t len){
break;
case Stop:
- if(in[i] == '\n' || in[i] == '\r' || in[i] == '\0' || pstate == Error){ //Sorvége, maradunk
+ if(in[i] == '\n' || in[i] == '\r' || in[i] == '\0' || pstate == Error){ /* Line Ended */
state = Stop;
if(strNullLen(data->section) == 0){data->sectionLen = 0;}
if(strNullLen(data->param) == 0){data->paramLen = 0;}
@@ -519,7 +528,7 @@ struct lci_data *iniFSM(struct lci_data *data, const char *in, int64_t len){
data->valueDraw = lci_EMPTYVAL;
}
return data;
- } else { //minden más-> hiba
+ } else { /* Everything else -> ERROR */
state = Error;
}
pstate = Stop;
@@ -537,7 +546,7 @@ struct lci_data *iniFSM(struct lci_data *data, const char *in, int64_t len){
-lci_data *createNode( lci_data *head, int64_t lineLen ){
+lci_data *createNode( lci_data *head, int64_t lineLen ){ /* Creates one Node */
lci_data *curr;
curr = (lci_data *) calloc(1, sizeof(lci_data));
@@ -559,6 +568,7 @@ lci_data *createNode( lci_data *head, int64_t lineLen ){
curr->valueDraw = lci_EMPTYVAL;
curr->commentLen = lineLen;
curr->commentStartPos = -1;
+ curr->commentSign = '\0';
curr->errorMsgLen=lineLen;
curr->next = NULL;
@@ -568,7 +578,7 @@ lci_data *createNode( lci_data *head, int64_t lineLen ){
return curr;
}
-lci_data *destroyNodes( lci_data *head){
+lci_data *destroyNodes( lci_data *head){ /* Destroys Nodes from HEAD to the end */
lci_data *tmp, *node=head;
while(node != NULL){
free(node->section);
@@ -587,80 +597,68 @@ lci_data *destroyNodes( lci_data *head){
struct lci_data *iniReadOut(const char *filename){
- int c=0;
+ int c=0, *buff;
FILE *fp=NULL;
int64_t linemax, line=0, pos=0;
- char *buff, cc;
+ char cc;
struct lci_data *prev=NULL, *curr=NULL, *list = NULL;
fp = fopen(filename, "rb");
- if(fp == NULL){
- list = createNode(NULL, 120);
- list->errorMsgLen = snprintf(list->errorMsg, 120, "File opening error. Errno: %d (%s)", errno, strerror(errno) );
+ if(!fp ){ /* fp == NULL */
+ list = createNode(NULL, 256);
+ list->errorMsg = strResize(list->errorMsg, list->errorMsgLen, 256);
+ list->errorMsgLen = sprintf(list->errorMsg, "File opening error. Errno: %d (%s)", errno, strerror(errno) );
list->nodeState = lci_ERROR;
- //return list;
+
} else {
- linemax = getFileMaxLineLen(fp) +1;
- //list = createNode(NULL, linemax);
- buff = (char *) malloc(linemax*sizeof(char));
+ linemax = getFileMaxLineLen(fp) +1;
+ buff = (int *) malloc(linemax*sizeof(int));
memset(buff, 0, linemax);
-
while( c != EOF){
c = fgetc(fp);
cc = c;
- if( c == '\n' || c == EOF){ //Ha sorvége
+ if( c == '\n' || c == EOF){
line++;
- if(c == EOF){
- buff[pos] = '\n';
- } else {
- buff[pos] = cc;
- }
+ buff[pos] = '\n';
if(curr == NULL || curr->nodeState != lci_MULTILINE ){
curr = createNode(NULL, linemax);
}
- if(list == NULL){
+ if(list == NULL){ /* First node */
list = curr;
}
- if(prev != NULL && prev != curr && prev->section != NULL && curr != NULL && curr->section != NULL){
- strncpy(curr->section, prev->section, curr->sectionLen);
+ if(prev && curr && prev != curr && prev->section ){ /* Copy SECTION string from previous node to current */
+ curr->section = strResize(curr->section, curr->sectionLen, prev->sectionLen);
+ memcpy(curr->section, prev->section, prev->sectionLen);
curr->sectionLen = prev->sectionLen;
- //curr->section = strResize(curr->section, linemax, curr->sectionLen);
-
}
- if(curr != NULL){
+ if(curr){ /* Call the Finite-State-Machine processor */
curr->lineNum = line;
curr->lineLen = pos + 1;
curr = iniFSM(curr, buff, linemax);
}
- if(curr->nodeState == lci_EMPTY){ //üres sorokat eldobjuk
- if(prev == curr || list == curr){ //Ha csak az az egy van a listában
+ if(curr->nodeState == lci_EMPTY){ /* Dropping empty lines */
+ if(list == curr || prev == curr ){ /* File contains empty lines */
list = NULL;
prev = NULL;
}
curr = destroyNodes(curr);
- //} else if(curr->nodeState = ERROR){
- //destroyNodes(list);
- //} else if (curr->nodeState == MULTILINE){
- //multiline
- } else {
- //????????
}
- if(prev == NULL){ //Ha még üres
+ if(!prev){ /* Prew is null */
prev = curr;
- } else { //Az előzőhöz hozzávesszük a mostanit
+ } else { /* Register current for next step */
prev->next = curr;
- if(prev->next != NULL && curr->nodeState != lci_MULTILINE){ //Csak, ha lett új felvéve
+ if(prev->next && curr->nodeState != lci_MULTILINE){ /* Step only, when current is not multiline */
prev = prev->next;
}
}
- if(curr != NULL && curr->nodeState == lci_ERROR){
- //return list;
+ if(curr && curr->nodeState == lci_ERROR){ /* Stop on first ERROR */
+ /* return list; */
}
pos = 0;
memset(buff, 0, linemax);
@@ -672,7 +670,7 @@ struct lci_data *iniReadOut(const char *filename){
free(buff);
}
- if(fp != NULL){
+ if(fp){
fclose(fp);
}
return list;
diff --git a/src/ini_rw.h b/src/ini_rw.h
index 0a594c7..7894eef 100644
--- a/src/ini_rw.h
+++ b/src/ini_rw.h
@@ -1,31 +1,32 @@
#ifndef INI_READ_H_INCLUDED
#define INI_READ_H_INCLUDED
-// #include "deftypes.h"
+/* #include "deftypes.h" */
#include <stdint.h> /* int64_t*/
-
+
typedef struct lci_data {
enum nodeState {lci_EMPTY, lci_READY, lci_CONTINUE, lci_MULTILINE, lci_ERROR } nodeState;
- int64_t lineNum;
- int64_t lineLen;
+ int32_t lineNum;
+ int32_t lineLen;
char *section;
- int64_t sectionLen;
- int64_t sectionStartPos;
+ int32_t sectionLen;
+ int32_t sectionStartPos;
char *param;
- int64_t paramLen;
- int64_t paramStartPos;
+ int32_t paramLen;
+ int32_t paramStartPos;
char *value;
- int64_t valueLen;
- int64_t valueStartPos;
+ int32_t valueLen;
+ int32_t valueStartPos;
enum valueDraw {lci_EMPTYVAL, lci_SIMPLEVAL, lci_MULTILINEVAL, lci_DQUOTEDVAL} valueDraw;
char *comment;
- int64_t commentLen;
- int64_t commentStartPos;
+ int32_t commentLen;
+ int32_t commentStartPos;
+ char commentSign;
char *errorMsg;
- int64_t errorMsgLen;
+ int32_t errorMsgLen;
struct lci_data *next;
} lci_data;
@@ -33,31 +34,31 @@ typedef struct lci_data {
struct lci_data *iniReadOut(const char *filename);
-//int64_t getFileMaxLineLen(FILE *tfd);
+/* int64_t getFileMaxLineLen(FILE *tfd); */
char *strResize(char *ptr, size_t oldsize, size_t newsize);
lci_data *destroyNodes( lci_data *head);
lci_data *createNode( lci_data *head, int64_t lineLen );
-int64_t getFileMaxLineLen(FILE *tfd);
+size_t getFileMaxLineLen(FILE *tfd);
#if defined(ini_read_c) || defined(ini_write_c)
enum ini_states {Start, BgnSp, CommEndW, SectEndW, SectEndD, EqW1, EqW2, ValPSP, ValW, ValFSP, DqmW, Bslsh, Error, Stop };
size_t strNullLen(const char *str);
-struct lci_data *iniFSM(struct lci_data *data, const char *in, int64_t len);
+struct lci_data *iniFSM(struct lci_data *data, const int *in, int32_t len);
char eescape(char c);
#ifdef ini_read_c
char unescape(char c);
-#endif // ini_read_c
+#endif /* ini_read_c */
#ifdef ini_write_c
//static const char* komment = ";#";
-#endif //ini_write_c
-#endif // ini_read_c, ini_write_c
+#endif /*ini_write_c*/
+#endif /* ini_read_c, ini_write_c*/
char *lciGETtoStr( const char *section, const char *param, char *dest, size_t dstlen );
-//int lciGETtoStrlen(const char *section, const char *param, ...);
+/*int lciGETtoStrlen(const char *section, const char *param, ...); */
int8_t lciGETtoInt8( const char *filename, const char *section, const char *param);
int16_t lciGETtoInt16(const char *filename, const char *section, const char *param);
int32_t lciGETtoInt32(const char *filename, const char *section, const char *param);
@@ -70,5 +71,5 @@ long int lciGETtoLng(const char *filename, const char *section, const char *para
-#endif // INI_READ_H_INCLUDED
+#endif /* INI_READ_H_INCLUDED */
diff --git a/src/main.c b/src/main.c
index 0617d91..0906321 100644
--- a/src/main.c
+++ b/src/main.c
@@ -7,7 +7,7 @@
#include "ini_rw.h"
#define main_c
-
+
int main(int argc, char* argv[]){
@@ -19,7 +19,8 @@ int main(int argc, char* argv[]){
if(argc > 1){
memset(filename, 0, 4096);
- snprintf(filename, 4096, "%s", argv[1]);
+ /* snprintf(filename, 4096, "%s", argv[1]); */
+ sprintf(filename, "%s", argv[1]);
}
@@ -27,18 +28,18 @@ int main(int argc, char* argv[]){
len = getFileMaxLineLen(fp)+1;
if(fp != NULL) { fclose(fp);}
- len = 24000; //Debug
+ /* len = 24000; */ /*Debug*/
lens=16;
lenp=16;
lenv=16;
lenc=44;
- buff1 = calloc((len+3), sizeof(char));
- buff2 = calloc((len+3), sizeof(char));
- buff3 = calloc((len+3), sizeof(char));
- buff4 = calloc((len+3), sizeof(char));
- buff5 = calloc((elen+3),sizeof(char));
+ buff1 = calloc((len+100), sizeof(char));
+ buff2 = calloc((len+100), sizeof(char));
+ buff3 = calloc((len+100), sizeof(char));
+ buff4 = calloc((len+100), sizeof(char));
+ buff5 = calloc((elen+100),sizeof(char));
printf("\nLineMax: %d\n\n",len);
@@ -49,14 +50,21 @@ int main(int argc, char* argv[]){
tmp = ini;
while(tmp != NULL){
- snprintf(buff1, len+3, "'%s' %3ld",tmp->section, tmp->sectionLen);
+
+ /* snprintf(buff1, len+3, "'%s' %3ld",tmp->section, tmp->sectionLen);
snprintf(buff2, len+3, "'%s' %3ld",tmp->param, tmp->paramLen);
snprintf(buff3, len+3, "'%s' %3ld",tmp->value, tmp->valueLen);
snprintf(buff4, len+3, "'%s' %3ld",tmp->comment, tmp->commentLen);
- snprintf(buff5, elen+3, "'%s' %3ld",tmp->errorMsg, tmp->errorMsgLen);
+ snprintf(buff5, elen+3, "'%s' %3ld",tmp->errorMsg, tmp->errorMsgLen); */
+
+ sprintf(buff1, "'%s' %3d",tmp->section, tmp->sectionLen);
+ sprintf(buff2, "'%s' %3d",tmp->param, tmp->paramLen);
+ sprintf(buff3, "'%s' %3d",tmp->value, tmp->valueLen);
+ sprintf(buff4, "'%s' %3d",tmp->comment, tmp->commentLen);
+ sprintf(buff5, "'%s' %3d",tmp->errorMsg, tmp->errorMsgLen);
- printf("LN: %ld,\tLL: %ld,\tSE: %*s,%2ld P: %*s,%2ld V: %*s,%2ld C: %*s,%2ld ER: %*s \n", tmp->lineNum, tmp->lineLen, lens, buff1,tmp->sectionStartPos,
+ printf("LN: %d,\tLL: %d,\tSC: %*s,%2d P: %*s,%2d V: %*s,%2d C: %*s,%2d ER: %*s \n", tmp->lineNum, tmp->lineLen, lens, buff1,tmp->sectionStartPos,
lenp, buff2, tmp->paramStartPos, lenv, buff3, tmp->valueStartPos, lenc, buff4, tmp->commentStartPos, elen, buff5);
tmp=tmp->next;
diff --git a/tests/bom.ini b/tests/bom.ini
new file mode 100644
index 0000000..0e91694
--- /dev/null
+++ b/tests/bom.ini
@@ -0,0 +1,4 @@
+[bom_section] ;OK
+bom_name=bom_value ;OK
+key“ = value“ ;ERROR
+key="value" ;OK \ No newline at end of file
diff --git a/tests/results/boom.txt b/tests/results/boom.txt
new file mode 100644
index 0000000..36cf8fe
--- /dev/null
+++ b/tests/results/boom.txt
@@ -0,0 +1,8 @@
+./bin/lightconfini tests/bom.ini
+
+LineMax: 32
+
+LN: 1, LL: 27, SC: 'bom_section' 12, 3 P: '(null)' 0,-1 V: '(null)' 0,-1 C: 'OK' 3,23 ER: '(null)' 0
+LN: 2, LL: 24, SC: 'bom_section' 12,-1 P: 'bom_name' 9, 0 V: 'bom_value' 10, 9 C: 'OK' 3,20 ER: '(null)' 0
+LN: 3, LL: 31, SC: 'bom_section' 12,-1 P: 'key' 32, 0 V: '(null)' 0,-1 C: '(null)' 0,-1 ER: 'Illegal character at PARAMETER! (line: 3, pos: 4)' 50
+LN: 4, LL: 24, SC: 'bom_section' 12,-1 P: 'key' 4, 0 V: 'value' 6, 4 C: 'OK' 3,20 ER: '(null)' 0
diff --git a/tests/results/test.txt b/tests/results/test.txt
new file mode 100644
index 0000000..6ec28f9
--- /dev/null
+++ b/tests/results/test.txt
@@ -0,0 +1,69 @@
+./bin/lightconfini tests/test.ini
+
+LineMax: 136
+
+LN: 3, LL: 38, SC: '(null)' 0,-1 P: '(null)' 0,-1 V: '(null)' 0,-1 C: 'Comments are started with '#' or ';'' 37, 0 ER: '(null)' 0
+LN: 4, LL: 31, SC: '(null)' 0,-1 P: '(null)' 0,-1 V: '(null)' 0,-1 C: ' Inline comments are allowed.' 30, 0 ER: '(null)' 0
+LN: 5, LL: 39, SC: '(null)' 0,-1 P: '(null)' 0,-1 V: '(null)' 0,-1 C: ' EMPTY/BLANK lines are not processed!' 38, 0 ER: '(null)' 0
+LN: 7, LL: 30, SC: '(null)' 0,-1 P: '(null)' 0,-1 V: '(null)' 0,-1 C: 'Global variables are allowed' 29, 0 ER: '(null)' 0
+LN: 8, LL: 51, SC: '(null)' 0,-1 P: '(null)' 0,-1 V: '(null)' 0,-1 C: ' Parameters without section are global variables.' 50, 0 ER: '(null)' 0
+LN: 9, LL: 13, SC: '(null)' 0,-1 P: 'global1' 8, 0 V: '11' 3,10 C: '(null)' 0,-1 ER: '(null)' 0
+LN: 10, LL: 14, SC: '(null)' 0,-1 P: 'global2' 8, 0 V: 'aaa' 4,10 C: '(null)' 0,-1 ER: '(null)' 0
+LN: 12, LL: 68, SC: '(null)' 0,-1 P: '(null)' 0,-1 V: '(null)' 0,-1 C: ' The First character of Section name should be alphanumerical, but' 67, 0 ER: '(null)' 0
+LN: 13, LL: 90, SC: '(null)' 0,-1 P: '(null)' 0,-1 V: '(null)' 0,-1 C: ' another caharacters can be Alphanumerical or dot(.)/underscore(_)/hyphen(-)/space(' ')' 89, 0 ER: '(null)' 0
+LN: 14, LL: 40, SC: 'Sections.are_ASCII-alnum characters' 36, 0 P: '(null)' 0,-1 V: '(null)' 0,-1 C: '(null)' 0,-1 ER: '(null)' 0
+LN: 16, LL: 29, SC: 'Sections.are_ASCII-alnum characters' 36,-1 P: '(null)' 0,-1 V: '(null)' 0,-1 C: 'Parameter values in itself:' 28, 0 ER: '(null)' 0
+LN: 17, LL: 73, SC: 'Sections.are_ASCII-alnum characters' 36,-1 P: '(null)' 0,-1 V: '(null)' 0,-1 C: ' can be ASCII Alphanumerical only, without any SPACE or TAB character.' 72, 0 ER: '(null)' 0
+LN: 18, LL: 67, SC: 'Sections.are_ASCII-alnum characters' 36,-1 P: '(null)' 0,-1 V: '(null)' 0,-1 C: ' Should start with alphanumerical, and from the second character,' 66, 0 ER: '(null)' 0
+LN: 19, LL: 59, SC: 'Sections.are_ASCII-alnum characters' 36,-1 P: '(null)' 0,-1 V: '(null)' 0,-1 C: ' can contain (with dot(.) or underscore(_) or hyphen(-))' 58, 0 ER: '(null)' 0
+LN: 20, LL: 106, SC: 'Sections.are_ASCII-alnum characters' 36,-1 P: '(null)' 0,-1 V: '(null)' 0,-1 C: ' If you want to use other characters, you should enclose them between two double-quotation-mark(") sign.' 105, 0 ER: '(null)' 0
+LN: 21, LL: 44, SC: 'Sections.are_ASCII-alnum characters' 36,-1 P: 'parameter' 10, 0 V: 'value-in_itself-are-Alnum.ascii' 32,12 C: '(null)' 0,-1 ER: '(null)' 0
+LN: 23, LL: 135, SC: 'Sections.are_ASCII-alnum characters' 36,-1 P: '(null)' 0,-1 V: '(null)' 0,-1 C: 'Parameter names are ASCII alphanumerical only, with additional dot(.) or underscore(_) or hyphen(-) or suare-bracket([/]) characters.' 134, 0 ER: '(null)' 0
+LN: 24, LL: 47, SC: 'Sections.are_ASCII-alnum characters' 36,-1 P: '(null)' 0,-1 V: '(null)' 0,-1 C: ' Square-brackets([/]) are allowed for arrays.' 46, 0 ER: '(null)' 0
+LN: 25, LL: 35, SC: 'Sections.are_ASCII-alnum characters' 36,-1 P: 'parameter_names.also-ASCII' 27, 0 V: 'value' 6,29 C: '(null)' 0,-1 ER: '(null)' 0
+LN: 27, LL: 12, SC: 'Section 2' 10, 0 P: '(null)' 0,-1 V: '(null)' 0,-1 C: '(null)' 0,-1 ER: '(null)' 0
+LN: 28, LL: 29, SC: 'Section 2' 10,-1 P: '(null)' 0,-1 V: '(null)' 0,-1 C: 'For other value characters:' 28, 0 ER: '(null)' 0
+LN: 29, LL: 103, SC: 'Section 2' 10,-1 P: '(null)' 0,-1 V: '(null)' 0,-1 C: ' The Space, or any other special characters are allowed only between two double-quotation-mark sign. ' 102, 0 ER: '(null)' 0
+LN: 30, LL: 115, SC: 'Section 2' 10,-1 P: '(null)' 0,-1 V: '(null)' 0,-1 C: ' Escaped characters, (\n, \t, etc.) or multi-byte characters (é, €, カ, ⠋, ঘঃ, 😍) are allowed here. ' 114, 0 ER: '(null)' 0
+LN: 31, LL: 73, SC: 'Section 2' 10,-1 P: 'parameter2' 11, 0 V: 'I like emojis 😍 but, don't like mosquitoes カ ! :)' 57,13 C: '(null)' 0,-1 ER: '(null)' 0
+LN: 33, LL: 45, SC: 'Section 2' 10,-1 P: '(null)' 0,-1 V: '(null)' 0,-1 C: ' Even! Multiline Parameters are supported: ' 44, 0 ER: '(null)' 0
+LN: 36, LL: 45, SC: 'Section 2' 10,-1 P: 'parameter3' 11, 0 V: 'With double quotation mark
+I can write multiline values, but I should
+escapse the trailing newline with '' sign!' 115,13 C: '(null)' 0,-1 ER: '(null)' 0
+LN: 41, LL: 43, SC: 'E X A M P L E S' 16, 0 P: '(null)' 0,-1 V: '(null)' 0,-1 C: 'comment #OK' 24,18 ER: '(null)' 0
+LN: 43, LL: 46, SC: 'E X A M P L E S' 16,-1 P: 'abcdefgh' 9, 0 V: '(null)' 0,-1 C: '(null)' 0,-1 ER: 'Illegal character at PARAMETER! (line: 43, pos: 40)' 52
+LN: 44, LL: 48, SC: 'E X A M P L E S' 16,-1 P: 'abcdefgh' 9, 0 V: '(null)' 0,-1 C: 'CORRECT' 8,39 ER: '(null)' 0
+LN: 45, LL: 46, SC: 'E X A M P L E S' 16,-1 P: 'abcdefgh' 9, 0 V: '(null)' 0,-1 C: '(null)' 0,-1 ER: 'Illegal character at VALUE! (line: 45, pos: 11)' 48
+LN: 46, LL: 48, SC: 'E X A M P L E S' 16,-1 P: 'abcdefgh' 9, 0 V: '==' 3,11 C: 'CORRECT' 8,39 ER: '(null)' 0
+LN: 47, LL: 46, SC: 'E X A M P L E S' 16,-1 P: '(null)' 0,-1 V: '(null)' 0,-1 C: '(null)' 0,-1 ER: 'Illegal character! (line: 47, pos: 1)' 38
+LN: 48, LL: 46, SC: 'E X A M P L E S' 16,-1 P: '(null)' 0,-1 V: '(null)' 0,-1 C: '(null)' 0,-1 ER: 'Illegal character! (line: 48, pos: 1)' 38
+LN: 50, LL: 41, SC: 'E X A M P L E S' 16,-1 P: 'param' 6, 0 V: 'value' 6, 6 C: 'inline_comment #OK' 29,11 ER: '(null)' 0
+LN: 51, LL: 43, SC: 'E X A M P L E S' 16,-1 P: 'param' 6, 3 V: 'value' 6,19 C: 'OK' 3,39 ER: '(null)' 0
+LN: 52, LL: 46, SC: 'E X A M P L E S' 16,-1 P: 'param' 6, 0 V: 'value1' 7, 8 C: '(null)' 0,-1 ER: 'Illegal character at VALUE! (line: 52, pos: 16)' 48
+LN: 53, LL: 46, SC: 'E X A M P L E S' 16,-1 P: 'param' 6, 0 V: 'value1' 136, 8 C: '(null)' 0,-1 ER: 'Illegal character at VALUE! (line: 53, pos: 15)' 48
+LN: 54, LL: 55, SC: 'E X A M P L E S' 16,-1 P: 'param' 136, 0 V: '(null)' 0,-1 C: '(null)' 0,-1 ER: 'Illegal character at PARAMETER! (line: 54, pos: 6)' 51
+LN: 56, LL: 46, SC: 'example ' 9, 1 P: '(null)' 0,-1 V: '(null)' 0,-1 C: '(null)' 0,-1 ER: 'Illegal character or EMPTY SECTION! (line: 56, pos: 11)' 56
+LN: 57, LL: 46, SC: 'example ' 9, 0 P: '(null)' 0,-1 V: '(null)' 0,-1 C: '(null)' 0,-1 ER: 'Illegal character or EMPTY SECTION! (line: 57, pos: 10)' 56
+LN: 59, LL: 48, SC: 'example ' 9,-1 P: 'param' 6, 1 V: 'qwerty "qwerty" abcdefh ' 25, 9 C: 'CORRECT' 8,39 ER: '(null)' 0
+LN: 60, LL: 46, SC: 'example ' 9,-1 P: 'param' 6, 1 V: 'qwerty' 7, 9 C: '(null)' 0,-1 ER: 'Illegal character at VALUE! (line: 60, pos: 18)' 48
+LN: 61, LL: 43, SC: 'example ' 9,-1 P: 'param' 6, 1 V: 'qwerty' 7, 9 C: 'OK' 3,39 ER: '(null)' 0
+LN: 63, LL: 43, SC: 'example ' 9,-1 P: 'array[0123]' 12, 1 V: 'asdasd' 7,15 C: 'OK' 3,39 ER: '(null)' 0
+LN: 64, LL: 46, SC: 'example ' 9,-1 P: 'array' 6, 1 V: '(null)' 0,-1 C: '(null)' 0,-1 ER: 'Illegal character at PARAMETER! (line: 64, pos: 8)' 51
+LN: 65, LL: 43, SC: 'example ' 9,-1 P: 'array[_]' 9, 1 V: 'jkljkl' 7,15 C: 'OK' 3,39 ER: '(null)' 0
+LN: 66, LL: 43, SC: 'example ' 9,-1 P: 'array[abc]' 11, 1 V: 'aaaa' 5,14 C: 'OK' 3,39 ER: '(null)' 0
+LN: 67, LL: 43, SC: 'example ' 9,-1 P: 'array.abc' 10, 1 V: 'aaaa' 5,14 C: 'OK' 3,39 ER: '(null)' 0
+LN: 68, LL: 46, SC: 'example ' 9,-1 P: 'array[abc]' 11, 1 V: '(null)' 0,14 C: 'OK' 3,42 ER: '(null)' 0
+LN: 70, LL: 46, SC: 'example ' 9,-1 P: '(null)' 0,-1 V: '(null)' 0,-1 C: '### qwerty $ۧ qwerty #### ;OK' 45, 0 ER: '(null)' 0
+LN: 72, LL: 43, SC: 'example ' 9,-1 P: 'test' 5, 0 V: '-1.1' 5, 9 C: 'OK' 3,39 ER: '(null)' 0
+LN: 73, LL: 43, SC: 'example ' 9,-1 P: 'test2' 6, 0 V: '-1.1' 5, 8 C: 'OK' 3,39 ER: '(null)' 0
+LN: 74, LL: 46, SC: 'example ' 9,-1 P: 'test3' 6, 0 V: '(null)' 0,-1 C: '(null)' 0,-1 ER: 'Illegal character at VALUE! (line: 74, pos: 9)' 47
+LN: 75, LL: 43, SC: 'example ' 9,-1 P: 'test4' 6, 0 V: 'aaa_' 5, 8 C: 'OK' 3,39 ER: '(null)' 0
+LN: 76, LL: 46, SC: 'example ' 9,-1 P: 'test5' 6, 0 V: '(null)' 0,-1 C: '(null)' 0,-1 ER: 'Illegal character at VALUE! (line: 76, pos: 9)' 47
+LN: 77, LL: 43, SC: 'example ' 9,-1 P: 'test6' 6, 0 V: 'aaa.' 5, 8 C: 'OK' 3,39 ER: '(null)' 0
+LN: 78, LL: 43, SC: 'example ' 9,-1 P: 'test6' 6, 0 V: 'aa.a' 5, 8 C: 'OK' 3,39 ER: '(null)' 0
+LN: 81, LL: 43, SC: 'server_options' 15, 0 P: '(null)' 0,-1 V: '(null)' 0,-1 C: 'OK' 3,39 ER: '(null)' 0
+LN: 82, LL: 43, SC: 'server_options' 15,-1 P: 'server_' 8, 0 V: '(null)' 0,-1 C: 'xxxx ;OK' 32,10 ER: '(null)' 0
+LN: 83, LL: 43, SC: 'server_options' 15,-1 P: 'server_' 8, 0 V: 'server.example.com' 19,10 C: 'OK' 3,39 ER: '(null)' 0
+LN: 84, LL: 46, SC: 'server_options' 15,-1 P: '(null)' 0,-1 V: '(null)' 0,-1 C: '(null)' 0,-1 ER: 'Illegal character! (line: 84, pos: 1)' 38
+LN: 85, LL: 43, SC: 'server_options' 15,-1 P: 'ip' 3, 0 V: '127.0.0.1' 10, 7 C: 'OK' 3,39 ER: '(null)' 0
+LN: 86, LL: 43, SC: 'server_options' 15,-1 P: 'ip' 3, 0 V: '127.0.0.1' 10, 6 C: 'OK' 3,39 ER: '(null)' 0