aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--makefile95
-rw-r--r--src/ini_read.c94
-rw-r--r--src/ini_rw.h1
-rw-r--r--src/main.c68
-rw-r--r--tests/test.ini166
-rw-r--r--tests/test0.ini17
-rw-r--r--tests/test2.ini99
-rw-r--r--tests/test3.ini91
-rw-r--r--tests/test4.ini56
9 files changed, 314 insertions, 373 deletions
diff --git a/makefile b/makefile
index 0b36be9..a01a0dd 100644
--- a/makefile
+++ b/makefile
@@ -1,91 +1,66 @@
-
.PHONY: all clean debug distclean
-#LDLIBS= -lm -lpulse-simple -lpulse -lavformat -lavcodec -lswscale -lavutil -lavfilter -lswresample -lavdevice -lpostproc -lz -lx264 -lva -lrt
-
-LDLIBS=
-
-# gcc a fordításhoz
+# buid & link with gcc
CC = gcc
-# gcc-vel is linkelje
LD = gcc
-# fordító flagek
-debug: CFLAGS = -g -Wall -g3 -ggdb -O0 -fmessage-length=0 -lefence # CodeBlocks-nak
-#debug: CFLAGS = -O0 -g3 -Wall -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)"
-# -fmessage-length=0 -> "N" karakter hibaüzenet, N=0 akkor minden üzenet új sorba
-# -g3 -> Level 3 debug info
-# -MT"$(@)" -> Target
-# -c nyelvvel kapcsolatos
-
-# fordíto flagek
-CFLAGS = -Wall -ggdb -lefence
-# Linker flagek
-LDFLAGS = -lefence
-
-# tisztára törlés
-RM = /bin/rm -rf
+# néhány apróság:
MKD = /bin/mkdir -p
+RM = /bin/rm
+
+
+# fordíto általános flagek
+CFLAGS = -Wall
+LDFLAGS =
+LDLIBS =
-# OBJECT mappa
-OBJDIR = bin
-DEBUGDIR = bin/debug
+
+BINDIR = bin
+OBJDIR = build
# .o fájlok
-OBJ = main.o ini_read.o
+OBJ = main.o ini_read.o
+PROG = $(BINDIR)/lightconfini
OBJS = $(addprefix $(OBJDIR)/,$(OBJ))
-# program neve
-#PROG = maxini
-PROG = $(OBJDIR)/lightconfini
-PROG_D = $(DEBUGDIR)/lightconfini
-
-# make elég, nem szükséges a program neve
+# ALL kell legyen legelőször!
all: $(PROG)
+# debug-hoz felüldefiniálva
+debug: CFLAGS = -Wall -g -g3 -ggdb -Wpedantic -Wmissing-prototypes
+debug: LDFLAGS =
+debug: LDLIBS = -lefence
+# nem mindegy, hogy mellette van, vagy alatta egy sorral!
+debug: clean all
+
+# Ha még nem létezik az obj könyvtár, létrehozza
+$(OBJS): | $(OBJDIR)
+$(PROG): | $(BINDIR)
-# Az elkészül object fájlok összepakolása a prgramba
+# Fordított sorrend: először a főprogram
$(PROG): $(OBJS)
-# @echo 'Linking target: $@'
-# @echo 'Invoking: $(LD) C Linker'
$(LD) $(LDFLAGS) $(OBJS) -o $(PROG) $(LDLIBS)
-# @echo 'Finished building target: $@'
@echo ' '
-# Ha még nem létezik az obj könyvtár, létrehozza
-$(OBJS): | $(OBJDIR)
-
-# A forrásfájlok fordítása egyesével
-$(OBJS): $(OBJDIR)/%.o: ./src/%.c
-# @echo 'Building file: '$<'
+# Utána: A forrásfájlok fordítása egyesével
+$(OBJS): $(OBJDIR)/%.o: ./src/%.c
$(CC) $(CFLAGS) -c -o "$@" "$<"
-# @echo 'Finished building: $<'
-# @echo ' '
-# Az object könyvtár létrehozása
-$(OBJDIR):
+# OBJ létrehozáshoz
+$(BINDIR):
+ $(MKD) $(BINDIR)
+$(OBJDIR):
$(MKD) $(OBJDIR)
+rebuild: clean all
-#Debugoláshoz
-debug: $(PROG_D)
-
-$(PROG_D): $(OBJS)
- $(MKD) $(DEBUGDIR)
- $(LD) $(LDFLAGS) $(OBJS) -o $(PROG_D) $(LDLIBS)
-
-
-
-# Kis takarítás
clean:
- $(RM) $(PROG) $(OBJS) $(PROG_D)
-
+ $(RM) $(PROG) $(OBJS)
-# Teljes takarítás
distclean:
- $(RM) $(PROG) $(OBJS) $(PROG_D) $(OBJDIR) $(DEBUGDIR)
+ $(RM) -r $(PROG) $(OBJS) bin/ build/
diff --git a/src/ini_read.c b/src/ini_read.c
index 28b7e18..7f7a252 100644
--- a/src/ini_read.c
+++ b/src/ini_read.c
@@ -28,7 +28,7 @@ char *strResize(char *ptr, size_t oldsize, size_t newsize){
//return ptr;
char *tmp;
- if(newsize == 0){ //pucol
+ if(newsize <= 0){ //pucol
free(ptr);
return NULL;
@@ -40,19 +40,20 @@ char *strResize(char *ptr, size_t oldsize, size_t newsize){
return ptr;
} else if(ptr == NULL) {
return tmp;
- } else if(newsize > oldsize) { // FEL
- //strncpy(tmp, ptr, oldsize); // old < new
- snprintf(tmp, newsize, "%s", ptr);
+ /*} 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
+ return tmp;
+ */
+ } else /*if(newsize < oldsize)*/ { //LE
//strncpy(tmp, ptr, newsize); // new < old
snprintf(tmp, newsize, "%s", ptr);
free(ptr);
return tmp;
- } else { //Ide sosem jutunk
+ } /*else { //Ide sosem jutunk
return ptr;
- }
+ }*/
} else {
return ptr;
}
@@ -75,7 +76,7 @@ char unescape(char c){
return '\v';
} else if(c == 'e'){
return 0x1B;
- /*} else if(c < 0x20){
+ /*} else if(c < 0x20){ // debug
return '~'; */
} else { // jó az eredeti
return c;
@@ -83,27 +84,25 @@ char unescape(char 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 == '\\'){ //Backslash
- return '\\';
- } else if(c == '\''){ //Apostrophe
- return '\'';
- } else if(c == '\"'){ //Double quotation mark
- return '\"';
- /*} else if(c < 0x20){
+ //} else if(c == '\''){ //Apostrophe
+ // return '\'';
+ //} else if(c == '"'){ //Double quotation mark
+ // return '\"';
+ /*} else if(c < 0x20){ //debug
return '~';*/
} else { // jó az eredeti
return c;
@@ -190,6 +189,7 @@ struct lci_data *iniFSM(struct lci_data *data, const char *in, int64_t len){
i--;
}
data->nodeState = EMPTY;
+ data->valueDraw = EMPTYVAL;
pstate = Start;
break;
@@ -323,6 +323,7 @@ struct lci_data *iniFSM(struct lci_data *data, const char *in, int64_t len){
if(in[i] == '\n' || in[i] == '\r' /*|| in[i] == '\0'*/ ){ //ekkor üres változó
state = Stop;
data->nodeState = READY;
+ data->valueDraw = SIMPLEVAL;
i--;
} else if(in[i] == ';' || in[i] == '#'){ //komment jön
j = -1;
@@ -331,6 +332,7 @@ struct lci_data *iniFSM(struct lci_data *data, const char *in, int64_t len){
memset(data->comment, 0, len);
data->commentStartPos = i;
data->nodeState = CONTINUE;
+ data->valueDraw = SIMPLEVAL;
} else if( pstate != Bslsh && in[i] == '\"' ){ //Macskaköröm jött
j = -1;
@@ -339,6 +341,7 @@ struct lci_data *iniFSM(struct lci_data *data, const char *in, int64_t len){
memset(data->value, 0, len);
data->valueStartPos = i;
data->nodeState = CONTINUE;
+ data->valueDraw = DQUOTEDVAL;
} else if(isspace(in[i])){ //SPACE jött -> marad helyben
state = ValPSP;
} else if(isalnum(in[i]) || in[i]=='-') { //Változó macskaköröm nélkül
@@ -348,6 +351,7 @@ struct lci_data *iniFSM(struct lci_data *data, const char *in, int64_t len){
memset(data->value, 0, len);
data->valueStartPos = i;
data->nodeState = CONTINUE;
+ data->valueDraw = SIMPLEVAL;
i--;
} else {
state = Error;
@@ -413,9 +417,9 @@ struct lci_data *iniFSM(struct lci_data *data, const char *in, int64_t len){
state = Error;
i--;
}
- if(0x00 < in[i] && in[i] < 0x20){ //láthatatlan: pl \\n (escapelt sorvége)
- //j--;
- }
+ //if(0x00 < in[i] && in[i] < 0x20){ //láthatatlan: pl \\n (escapelt sorvége)
+ // j--;
+ //}
pstate = Bslsh;
break;
@@ -454,6 +458,7 @@ struct lci_data *iniFSM(struct lci_data *data, const char *in, int64_t len){
data->value[j] = '\0'; // '\\n' => '\n\0'
data->valueLen = j+1;
data->nodeState = MULTILINE;
+ data->valueDraw = MULTILINE;
state = Stop;
i--;
} else if( in[i] == '\n' && in[i-1] == '\r' && in[i-2] == '\\'){ //WINDOWS style
@@ -461,6 +466,7 @@ struct lci_data *iniFSM(struct lci_data *data, const char *in, int64_t len){
data->value[j+1] = '\0';
data->valueLen = j+2;
data->nodeState = MULTILINE;
+ data->valueDraw = MULTILINE;
state = Stop;
i--;
} else if( pstate != Bslsh && ( in[i] == '\r' || in[i] == '\n' || in[i] == '\0')){ //túl korai sorvége
@@ -475,18 +481,18 @@ 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) ;
+ //memset(data->errorMsg, 0, 256) ;
if(pstate == SectEndW || pstate == SectEndD){
- data->errorMsgLen = snprintf(data->errorMsg, 256, "Illegal character or EMPTY SECTION! (line: %ld, pos: %ld)", data->lineNum, i+1);
+ data->errorMsgLen = snprintf(data->errorMsg, 256, "Illegal character or EMPTY SECTION! (line: %ld, pos: %ld)", 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);
+ data->errorMsgLen = snprintf(data->errorMsg, 256, "Illegal character at PARAMETER! (line: %ld, pos: %ld)", 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);
+ data->errorMsgLen = snprintf(data->errorMsg, 256, "Illegal character at VALUE! (line: %ld, pos: %ld)", 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);
+ 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)\0", data->lineNum, i+1)+1;
+ data->errorMsgLen = snprintf(data->errorMsg, 256, "Illegal character! (line: %ld, pos: %ld)", data->lineNum, i+1) +1;
}
i--;
@@ -494,7 +500,7 @@ struct lci_data *iniFSM(struct lci_data *data, const char *in, int64_t len){
data->nodeState = ERROR;
pstate = Error;
break;
-
+
case Stop:
if(in[i] == '\n' || in[i] == '\r' || in[i] == '\0' || pstate == Error){ //Sorvége, maradunk
state = Stop;
@@ -533,29 +539,25 @@ 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 *curr;
- curr = (lci_data *) malloc(1*sizeof(lci_data));
+ curr = (lci_data *) calloc(1, sizeof(lci_data));
curr->nodeState = EMPTY;
curr->lineNum = 0;
curr->lineLen = lineLen;
- curr->section = (char *) malloc(lineLen*sizeof(char));
- curr->param = (char *) malloc(lineLen*sizeof(char));
- curr->value = (char *) malloc(lineLen*sizeof(char));
- curr->comment = (char *) malloc(lineLen*sizeof(char));
- curr->errorMsg = (char *) malloc(lineLen*sizeof(char));
+ curr->section = (char *) calloc(lineLen, sizeof(char));
+ curr->param = (char *) calloc(lineLen, sizeof(char));
+ curr->value = (char *) calloc(lineLen, sizeof(char));
+ curr->comment = (char *) calloc(lineLen, sizeof(char));
+ curr->errorMsg = (char *) calloc(lineLen, sizeof(char));
- memset(curr->section, 0, lineLen);
curr->sectionLen = lineLen;
curr->sectionStartPos = -1;
- memset(curr->param, 0, lineLen);
curr->paramLen = lineLen;
curr->paramStartPos = -1;
- memset(curr->value, 0, lineLen);
curr->valueLen = lineLen;
curr->valueStartPos = -1;
- memset(curr->comment, 0, lineLen);
+ curr->valueDraw = EMPTYVAL;
curr->commentLen = lineLen;
curr->commentStartPos = -1;
- memset(curr->errorMsg, 0, lineLen);
curr->errorMsgLen=lineLen;
curr->next = NULL;
@@ -580,6 +582,8 @@ lci_data *destroyNodes( lci_data *head){
return NULL;
}
+
+
struct lci_data *iniReadOut(const char *filename){
int c=0;
@@ -595,7 +599,7 @@ struct lci_data *iniReadOut(const char *filename){
list->nodeState = ERROR;
//return list;
} else {
- linemax = getFileMaxLineLen(fp);
+ linemax = getFileMaxLineLen(fp) +1;
//list = createNode(NULL, linemax);
buff = (char *) malloc(linemax*sizeof(char));
memset(buff, 0, linemax);
diff --git a/src/ini_rw.h b/src/ini_rw.h
index b424efb..a3808bc 100644
--- a/src/ini_rw.h
+++ b/src/ini_rw.h
@@ -20,6 +20,7 @@ typedef struct lci_data {
char *value;
int64_t valueLen;
int64_t valueStartPos;
+ enum valueDraw {EMPTYVAL, SIMPLEVAL, MULTILINEVAL, DQUOTEDVAL} valueDraw;
char *comment;
int64_t commentLen;
int64_t commentStartPos;
diff --git a/src/main.c b/src/main.c
index 9b03cf2..a003c66 100644
--- a/src/main.c
+++ b/src/main.c
@@ -4,48 +4,47 @@
#include <ctype.h>
#include <stdbool.h>
-#include <linux/limits.h> /* PATH_MAX*/
#include "ini_rw.h"
#define main_c
-
+
-int main()
-{
- char filename[] = "tests/test.ini", *buff1, *buff2, *buff3, *buff4, *buff5;
+int main(int argc, char* argv[]){
+
+
+ char filename[4096] = "tests/test.ini", *buff1, *buff2, *buff3, *buff4, *buff5;
lci_data *ini=NULL, *tmp=NULL;
- int len=0, elen=64, lens=0, lenp=0, lenv=0, lenc=0;
+ int len=0, elen=54, lens=0, lenp=0, lenv=0, lenc=0;
FILE *fp;
+ if(argc > 1){
+ memset(filename, 0, 4096);
+ snprintf(filename, 4096, "%s", argv[1]);
+ }
+
+
fp = fopen(filename, "rb");
- len = getFileMaxLineLen(fp);
- fclose(fp);
+ len = getFileMaxLineLen(fp)+0;
+ if(fp != NULL) { fclose(fp);}
-//len = 24000;
+ len = 24000; //Debug
+ lens=16;
+ lenp=16;
+ lenv=16;
+ lenc=44;
- buff1 = malloc((len+3)*sizeof(char));
- buff2 = malloc((len+3)*sizeof(char));
- buff3 = malloc((len+3)*sizeof(char));
- buff4 = malloc((len+3)*sizeof(char));
- buff5 = malloc((elen+3)*sizeof(char));
-memset(buff1, 0, (len+3)*sizeof(char));
-memset(buff2, 0, (len+3)*sizeof(char));
-memset(buff3, 0, (len+3)*sizeof(char));
-memset(buff4, 0, (len+3)*sizeof(char));
-memset(buff5, 0, (elen+3)*sizeof(char));
+ 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));
-
printf("\nLineMax: %d\n\n",len);
ini = iniReadOut(filename);
- lens=16;
- lenp=16;
- lenv=16;
- lenc=44;
-
tmp = ini;
while(tmp != NULL){
@@ -54,21 +53,22 @@ memset(buff5, 0, (elen+3)*sizeof(char));
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, "'%s' %3ld",tmp->errorMsg, tmp->errorMsgLen);
+ snprintf(buff5, elen+3, "'%s' %3ld",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,
- // lenp, buff2, tmp->paramStartPos, lenv, buff3, tmp->valueStartPos, lenc, buff4, tmp->commentStartPos, elen, buff5);
+ 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,
+ lenp, buff2, tmp->paramStartPos, lenv, buff3, tmp->valueStartPos, lenc, buff4, tmp->commentStartPos, elen, buff5);
tmp=tmp->next;
}
-free(buff1);
-free(buff2);
-free(buff3);
-free(buff4);
-free(buff5);
- destroyNodes( ini);
+ free(buff1);
+ free(buff2);
+ free(buff3);
+ free(buff4);
+ free(buff5);
+
+ destroyNodes( ini);
return 0;
diff --git a/tests/test.ini b/tests/test.ini
index a7706c3..af1da51 100644
--- a/tests/test.ini
+++ b/tests/test.ini
@@ -1,79 +1,87 @@
-
-
-;Comments are started with '#' or ';'
-; Inline comments are allowed.
-; EMPTY/BLANK lines are not processed!
-
-;Global variables are allowed
-# Parameters without section are global variables.
-global1 = 11
-global2 = aaa
-
-; The First character of Section name should be alphanumerical, but
-# another caharacters can be Alphanumerical or dot(.)/underscore(_)/hyphen(-)/space(' ')
-[Sections.are_ASCII-alnum characters]
-
-;Parameter values in itself:
-# can be ASCII Alphanumerical only, without any SPACE or TAB character.
-# Should start with alphanumerical, and from the second character,
-# can contain (with dot(.) or underscore(_) or hyphen(-))
-# If you want to use other characters, you should enclose them between two double-quotation-mark(") sign.
-parameter = value-in_itself-are-Alnum.ascii
-
-;Parameter names are ASCII alphanumerical only, with additional dot(.) or underscore(_) or hyphen(-) or suare-bracket([/]) characters.
-# Square-brackets([/]) are allowed for arrays.
-parameter_names.also-ASCII = value
-
-[Section 2]
-;For other value characters:
-# The Space, or any other special characters are allowed only between two double-quotation-mark sign.
-# Escaped characters, (\n, \t, etc.) or multi-byte characters (é, €, カ, ⠋, ঘঃ, 😍) are allowed here.
-parameter2 = "I like \t emojis 😍 but, don't like mosquitoes カ ! :)"
-
-; Even! Multiline Parameters are supported:
-parameter3 = "With double quotation mark \
-I can write multiline values, but I shoud \
-escapse the trailing newline with '\' sign!"
-
-
-
-
-[E X A M P L E S] ;comment #OK
-
-abcdefgh ;WRONG
-abcdefgh = ;CORRECT
-abcdefgh == ;WRONG
-abcdefgh = "==" ;CORRECT
-=abcd ;ERROR
-= ;xxxx ;ERROR
-
-param=value;inline_comment #OK
- param = value #OK
-param = value1 value2 #ERROR
-param = value1\ value2 #ERROR
-paramß = value1_value2 #ERROR
-
- [example ;section] #WRONG
-[example \;section] #WRONG
-
- param = "qwerty \"qwerty\" abcdefh " ;CORRECT
- param = "qwerty"qwerty ;WRONG
- param = "qwerty" ;OK
-
- array[0123] = "asdasd" #OK
- array [1234] = dfgdfg #WRONG
- array[_] = "jkljkl" #OK
- array[abc] = aaaa #OK
- array.abc = aaaa #OK
- array[abc] = "" #OK
-
-#### qwerty $ۧ qwerty #### ;OK
-
-test = -1.1 #OK
-test2 = "-1.1" #OK
-test3 = _aaa #WRONG
-test4 = .aaa #WRONG
-test5 = aa.a #OK
-ip = 127.0.0.1 #OK
-ip = "127.0.0.1" #OK
-
+
+
+;Comments are started with '#' or ';'
+; Inline comments are allowed.
+; EMPTY/BLANK lines are not processed!
+
+;Global variables are allowed
+# Parameters without section are global variables.
+global1 = 11
+global2 = aaa
+
+; The First character of Section name should be alphanumerical, but
+# another caharacters can be Alphanumerical or dot(.)/underscore(_)/hyphen(-)/space(' ')
+[Sections.are_ASCII-alnum characters]
+
+;Parameter values in itself:
+# can be ASCII Alphanumerical only, without any SPACE or TAB character.
+# Should start with alphanumerical, and from the second character,
+# can contain (with dot(.) or underscore(_) or hyphen(-))
+# If you want to use other characters, you should enclose them between two double-quotation-mark(") sign.
+parameter = value-in_itself-are-Alnum.ascii
+
+;Parameter names are ASCII alphanumerical only, with additional dot(.) or underscore(_) or hyphen(-) or suare-bracket([/]) characters.
+# Square-brackets([/]) are allowed for arrays.
+parameter_names.also-ASCII = value
+
+[Section 2]
+;For other value characters:
+# The Space, or any other special characters are allowed only between two double-quotation-mark sign.
+# Escaped characters, (\n, \t, etc.) or multi-byte characters (é, €, カ, ⠋, ঘঃ, 😍) are allowed here.
+parameter2 = "I like \t emojis 😍 but, don't like mosquitoes カ ! :)"
+
+; Even! Multiline Parameters are supported:
+parameter3 = "With double quotation mark \
+I can write multiline values, but I shoud \
+escapse the trailing newline with '\' sign!"
+
+
+
+
+[E X A M P L E S] ;comment #OK
+
+abcdefgh ;WRONG
+abcdefgh = ;CORRECT
+abcdefgh == ;WRONG
+abcdefgh = "==" ;CORRECT
+=abcd ;ERROR
+= ;xxxx ;ERROR
+
+param=value;inline_comment #OK
+ param = value #OK
+param = value1 value2 #ERROR
+param = value1\ value2 #ERROR
+paramß = value1_value2 #ERROR
+
+ [example ;section] #WRONG
+[example \;section] #WRONG
+
+ param = "qwerty \"qwerty\" abcdefh " ;CORRECT
+ param = "qwerty"qwerty ;WRONG
+ param = "qwerty" ;OK
+
+ array[0123] = "asdasd" #OK
+ array [1234] = dfgdfg #WRONG
+ array[_] = "jkljkl" #OK
+ array[abc] = aaaa #OK
+ array.abc = aaaa #OK
+ array[abc] = "" #OK
+
+#### qwerty $ۧ qwerty #### ;OK
+
+test = -1.1 #OK
+test2 = "-1.1" #OK
+test3 = _aaa #WRONG
+test4 = aaa_ #OK
+test5 = .aaa #WRONG
+test6 = aaa. #OK
+test6 = aa.a #OK
+
+
+[server_options] ;OK
+server_ = ;xxxx ;OK
+server_ = server.example.com ;OK
+_server_= server.example.com ;ERROR
+ip = 127.0.0.1 ;OK
+ip = "127.0.0.1" ;OK
+
diff --git a/tests/test0.ini b/tests/test0.ini
index be4520a..20a7822 100644
--- a/tests/test0.ini
+++ b/tests/test0.ini
@@ -35,3 +35,20 @@ ggg = aaa #commnta
;wqeweq \
;aabcd=efgh "
+
+
+ ; last modified 1 April 2001 by John Doe
+ [owner] ;_name_;_J_organization_;_A
+ [database] ; ; use IP address i
+server_ = ;_1s Inc._port_;_1]_file_;
+
+
+ [database] ;
+_komment2_;_"ied 1 April 2001 by John Doe
+
+ [database] ;ezzel mi legyen?
+ [database] ; [database] ; [ez_jobb] ;;
+ [ez_jobb] ;] #hiba
+
+ [ez_jobb] ; = valami # ez is hiba (duplán)
+ [ez_jobb] ### hiba
diff --git a/tests/test2.ini b/tests/test2.ini
deleted file mode 100644
index ac861fc..0000000
--- a/tests/test2.ini
+++ /dev/null
@@ -1,99 +0,0 @@
-
- [client] ;đdfsdf ;
-
-
-kell = "kell kell \nasdasd "
-valami = "valami : valami"カガ \;
-ৌ⠓⠋
-éáéűáéőőüöüöüöüöüöü = ゲ dfgdfklčkćčžčćžpšđgl\;⠋⠋éé
-
-ini = mini
-
-;hjkhjkhkj
-
- array[012012] = "asdasd" ;jhjklhk
- arr ay [1234] = dfgdfg ;;HIBA
- aray[_] = "jkjlj" ;opőoő
-kelll
-kééél = valami ;;HIBA
-
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxjkl
-
-
-
-aaa
-b
-hib\;a
-ittnasd[21n3] = ni\;\n\;\;#\;;\nsdf
-ঘঃ
-test = ;test
-test2 =
-test3 =
-=012012
- = ;sdfs
-
-
-asdasdasd[sdf] = "";
- ;fghfgh
-#####;
-;abcdefghijklmnopqrst
-;;;;
-### Test confi\ng
-abc
- .
-
-
-
- #valami
- port = "945444"গléáléáléáléáléá
- +++
- [server] . ; ghgjhg ;;HIBA
- ;
- ;
-
- host = "hoszt.my.ip";
-port = "945444"গ
-name = "valami"
-
- ;
- ;.
-
-
-
-
- [client] ;đdfsdf ;
-
-
-kell = "kell kell \nasdasd "
-valami = "valami : valami"カガ \;
-ৌ⠓⠋
-éáéűáéőőüöüöüöüöüöü = ゲ dfgdfklčkćčžčćžpšđgl\;⠋⠋éé
-
-ini = mini
-
-;hjkhjkhkj
-
- array[012012] = "asdasd" ;jhjklhk
- arr ay [1234] = dfgdfg ;;HIBA
- aray[_] = "jkjlj" ;opőoő
-kelll
-kééél = valami ;;HIBA
-
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxjkl
-
-
-
-aaa
-b
-hib\;a
-ittnasd[21n3] = ni\;\n\;\;#\;;\nsdf
-ঘঃ
-test = ;test
-test2 =
-test3 =
-=012012
- = ;sdfs
-
-
-asdasdasd[sdf] = "";
-v
diff --git a/tests/test3.ini b/tests/test3.ini
index 1fde0c3..15684e2 100644
--- a/tests/test3.ini
+++ b/tests/test3.ini
@@ -1,4 +1,35 @@
+ ; last modified 1 April 2001 by John Doe
+ [owner] ;_name_;_J_organization_;_A
+ [database] ; ; use IP address in case network name resolution is not working
+_server_;_1s Inc._port_;_1]_file_;_"2_komment_;_"" [database] ; [database] ; [database] ; [database] ; [database] ; [database] ;
+
+
+ [database] ;
+_komment2_;_"ied 1 April 2001 by John Doe
+
+ [database] ;ezzel mi legyen?
+ [database] ; [database] ; [ez_jobb] ;;
+ [ez_jobb] ;] #hiba
+
+ [ez_jobb] ; = valami # ez is hiba (duplán)
+ [ez_jobb] ### hiba
+
+
+_ezzzelmivan_#_
+
+
+
+ #sdf df
+ [elso] # ghj ;h
+
+_var1_;_lé
+_var2_;_mok
+
+ [nulladik] ;lé
+
+_test_;_"_test_;_"]_array[1234]_;_"iba
+
global=aaa
@@ -58,3 +89,63 @@ test = "abcd"
test = 1233.1234
abbc = cde
+ [client] ;đdfsdf ;
+
+
+kell = "kell kell \nasdasd "
+valami = "valami : valami"カガ \;
+ৌ⠓⠋
+éáéűáéőőüöüöüöüöüöü = ゲ dfgdfklčkćčžčćžpšđgl\;⠋⠋éé
+
+ini = mini
+
+;hjkhjkhkj
+
+ array[012012] = "asdasd" ;jhjklhk
+ arr ay [1234] = dfgdfg ;;HIBA
+ aray[_] = "jkjlj" ;opőoő
+kelll
+kééél = valami ;;HIBA
+
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxjkl
+
+
+
+aaa
+b
+hib\;a
+ittnasd[21n3] = ni\;\n\;\;#\;;\nsdf
+ঘঃ
+test = ;test
+test2 =
+test3 =
+=012012
+ = ;sdfs
+
+
+asdasdasd[sdf] = "";
+ ;fghfgh
+#####;
+;abcdefghijklmnopqrst
+;;;;
+### Test confi\ng
+abc
+ .
+
+
+
+ #valami
+ port = "945444"গléáléáléáléáléá
+ +++
+ [server] . ; ghgjhg ;;HIBA
+ ;
+ ;
+
+ host = "hoszt.my.ip";
+port = "945444"গ
+name = "valami"
+
+ ;
+ ;.
+
+ \ No newline at end of file
diff --git a/tests/test4.ini b/tests/test4.ini
deleted file mode 100644
index 13277d4..0000000
--- a/tests/test4.ini
+++ /dev/null
@@ -1,56 +0,0 @@
-
- ;fghfgh
-;;;
-#####;
-;abcdefghijklmnopqrst
-
-;;;;
-### Test confi\ng
-abc
- .
-
-
- #valami
- port = "945444"গléáléáléáléáléá
- +++
- [server] . ; ghgjhg ;;HIBA
- ;
- ;
-
- host = "hoszt.my.ip";
-port = "945444"গ
-name = "valami"
-
- ;
-
-
- [client] ;đdfsdf ;
-
-kell = "kell kell \nasdasd "
-valami = "valami : valami"カガ \;
-ৌ⠓⠋
-éáéűáéőőüöüöüöüöüöü = ゲ dfgdfklčkćčžčćžpšđgl\;⠋⠋éé
-
-ini = mini
-;hjkhjkhkj
-
- array[012012] = "asdasd" ;jhjklhk
- arr ay [1234] = dfgdfg ;;HIBA
- aray[_] = "jkjlj" ;opőoő
-kelll
-kééél = valami ;;HIBA
-
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxjkl
-
-
-hib\;a
-ittnasd[21n3] = ni\;\n\;\;#\;;\nsdf
-ঘঃ
-test = ;test
-test2 =
-test3 =
-=012012
- = ;sdfs
-
-
-asdasdasd[sdf] = "";