diff options
author | M.Gergő | 2020-05-20 00:20:53 +0200 |
---|---|---|
committer | M.Gergő | 2020-05-20 00:20:53 +0200 |
commit | ee15e1da29eea49057ea3b87ac861e6a2f1fea96 (patch) | |
tree | b508bd3ac8a8143fa9a8d9c5e4ebc16358c9c021 | |
parent | 2ad766df8f2bd45b7c0feff2fe19fc5f67b80842 (diff) | |
download | lightconfini-ee15e1da29eea49057ea3b87ac861e6a2f1fea96.tar.gz lightconfini-ee15e1da29eea49057ea3b87ac861e6a2f1fea96.zip |
New function: lciniReadOutOwn() + Clarifying numeric types
-rw-r--r-- | .vscode/launch.json | 27 | ||||
-rw-r--r-- | src/ini_read.c | 199 | ||||
-rw-r--r-- | src/inirw_internal.h | 34 | ||||
-rw-r--r-- | src/lightconfini.h | 45 | ||||
-rw-r--r-- | src/main.c | 6 | ||||
-rw-r--r-- | tests/bom.ini | 2 |
6 files changed, 197 insertions, 116 deletions
diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..b2dcc1f --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,27 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "(gdb) Launch", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/bin/lightconfini", + "args": [], + "stopAtEntry": false, + "cwd": "${workspaceFolder}", + "environment": [], + "externalConsole": false, + "MIMode": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ] + } + ] +}
\ No newline at end of file diff --git a/src/ini_read.c b/src/ini_read.c index 8f57650..817aa15 100644 --- a/src/ini_read.c +++ b/src/ini_read.c @@ -13,32 +13,51 @@ -size_t strNullLen(const char *str){ +static size_t strNullLen(const uint8_t *str){ if(str == NULL){ return 0; } else { - return strlen(str); + return strlen((const char*)str); } } -char *lciniStrResize(char *ptr, size_t oldsize, size_t newsize){ - char *tmp; + +static size_t strLcpy(uint8_t *dst, size_t dstlen, const uint8_t *src, size_t srclen){ /* Safe strncpy() */ + uint8_t *tdst=dst; + const uint8_t *tsrc=src; + size_t i=dstlen, j=srclen; + + if(dst == NULL || src == NULL || dstlen == 0){ + return 0; + } else { + while(--i && j-- && *tsrc != '\0'){ /* [ --i => Strats from dstlen=2] [ j-- => Stops on n=srclen] */ + *(tdst++) = *(tsrc++); /* dst[n] = src[n]; n++; */ + } + *tdst = '\0'; /* Applies from dstlen=n=1 */ + return tdst-dst+1; /* full buffer (incl. '\0') */ + } +} + + +static uint8_t *lciniStrResize(uint8_t *ptr, size_t oldsize, size_t newsize){ + uint8_t *tmp=NULL; if(newsize <= 0){ /* deleting */ free(ptr); return NULL; } else if(newsize != oldsize){ /* If any changes needed */ - tmp = (char *) malloc(newsize*sizeof(char)); - memset(tmp, 0, newsize*sizeof(char)); + tmp = (uint8_t *) malloc(newsize*sizeof(uint8_t)); + memset(tmp, 0, newsize*sizeof(uint8_t)); if(tmp == NULL){ /* String is not changed at malloc error */ return ptr; } else if(ptr == NULL) { return tmp; } else { - strncpy(tmp, ptr, newsize); /* c89 */ + /*strncpy(tmp, ptr, newsize);*/ /* c89 */ /*snprintf(tmp, newsize, "%s", ptr);*/ /* c99 */ + strLcpy(tmp, newsize, ptr, oldsize); free(ptr); return tmp; } @@ -47,7 +66,8 @@ char *lciniStrResize(char *ptr, size_t oldsize, size_t newsize){ } } -int unescape(int c){ + +static uint8_t unescape(uint8_t c){ if(c == 'n'){ /* Newline */ return '\n'; } else if(c == 'a'){ /* Bell */ @@ -71,7 +91,8 @@ int unescape(int c){ } } -int eescape(int c){ +#ifdef ini_write_c +static uint8_t eescape(uint8_t c){ if(c == '\n'){ /* Newline */ return 'n'; } else if(c == '\a'){ /* Bell */ @@ -87,15 +108,14 @@ int eescape(int c){ } else if(c == '\v'){ /* Vertical tab */ return 'v'; /*} else if(c < 0x20){ //debug - return '~';*/ + return '~'; */ } else { /* Original is OK */ return c; } } +#endif - -int isascalnum(int c){ /* Check if input is ASCII Alpha-numeric */ - +static uint8_t isascalnum(uint8_t c){ /* Check if input is ASCII Alpha-numeric */ if( 0x30 <= c && c <= 0x39){ /* Numeric */ return 1; } else if (0x41 <= c && c <= 0x5a){ /* UPPER */ @@ -107,8 +127,7 @@ int isascalnum(int c){ /* Check if input is ASCII Alpha-numeric */ } } -int checkspace(int c){ /* Only for ASCII characters */ - +static uint8_t checkspace(uint8_t c){ /* Only for ASCII characters */ switch (c) { case 0x20: /* space (SPC) */ return 1; @@ -130,10 +149,8 @@ int checkspace(int c){ /* Only for ASCII characters */ size_t lciniFileMaxLineLen(FILE *tfd){ - - size_t c=0; + int c=0; size_t i=0, max=0; - if (tfd != NULL){ while( c != EOF){ c = fgetc(tfd); @@ -154,19 +171,17 @@ size_t lciniFileMaxLineLen(FILE *tfd){ } } -struct lcini_data *iniFSM(struct lcini_data *data, const char *in, int32_t len){ +static struct lcini_data *iniFSM(struct lcini_data *data, const uint8_t *in, int32_t len){ int32_t i,j, vallen=len; - enum ini_states pstate=Start, state=Start; + enum lcini_states pstate=Start, state=Start; /*char cc; */ - if(data == NULL){ return NULL; } else { for(i=0, j=0; i<len; i++, j++){ /*cc = in[i];*/ /*debug*/ - switch (state) { case Start: if(data->nodeState == lcini_MULTILINE){ /* Bypass to the DQM collection */ @@ -181,7 +196,7 @@ struct lcini_data *iniFSM(struct lcini_data *data, const char *in, int32_t len){ } else if(in[i] == '\n' || in[i] == '\r' /*|| in[i] == '\0'*/){ /* Line End */ state = Stop; i--; - }else if((unsigned char)in[i] == 0xEF || (unsigned char)in[i] == 0xBB || (unsigned char)in[i] == 0xBF || (unsigned char)in[i] == 0xFF || (unsigned char)in[i] == 0x00 ){ /* UTF8, UTF16, UTF32 BOM */ + }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(checkspace(in[i])){ /* ISSPACE, but not line end */ state = BgnSp; @@ -288,7 +303,7 @@ struct lcini_data *iniFSM(struct lcini_data *data, const char *in, int32_t len){ case SectEndD: /* Section collected, then: SP(), line_end, or comment */ - if(in[i] == '\n' || in[i] == '\r'){ + if(in[i]=='\n' || in[i]=='\r'){ state = Stop; data->nodeState = lcini_READY; i--; @@ -404,9 +419,11 @@ struct lcini_data *iniFSM(struct lcini_data *data, const char *in, int32_t len){ data->commentStartPos = i; data->commentSign = in[i]; data->nodeState = lcini_CONTINUE; - /* } else if( in[i] == '\\' ){ // Backslash support - // j--; //A '\' nem számít bele! - // state = Bslsh; */ + /* + } else if( in[i] == '\\' ){ // Backslash support + j--; //A '\' nem számít bele! + state = Bslsh; + */ } else if(isascalnum(in[i]) || in[i]=='_' || in[i]=='-' || in[i]=='.' ){ /* Regular characters without SP() */ data->value[j] = in[i]; } else if(checkspace(in[i])){ /* SPACE arrived -> line_end */ @@ -443,9 +460,9 @@ struct lcini_data *iniFSM(struct lcini_data *data, const char *in, int32_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) //Vagy inkább mégis kell? + j--; + } */ pstate = Bslsh; break; @@ -510,18 +527,17 @@ struct lcini_data *iniFSM(struct lcini_data *data, const char *in, int32_t len){ data->errorMsg = lciniStrResize(data->errorMsg, data->errorMsgLen, 256); /* Returns zero-filled string */ if(pstate == SectEndW || pstate == SectEndD){ - data->errorMsgLen = sprintf(data->errorMsg, "Illegal character or EMPTY SECTION! (line: %d, pos: %d)", data->lineNum, i+1) +1; + data->errorMsgLen = sprintf((char*)data->errorMsg, "Illegal character or EMPTY SECTION! (line: %d, pos: %d)", data->lineNum, i+1) +1; } else if(pstate == EqW1 || pstate == EqW2){ - data->errorMsgLen = sprintf(data->errorMsg, "Illegal character at PARAMETER! (line: %d, pos: %d)", data->lineNum, i+1) +1; + data->errorMsgLen = sprintf((char*)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 = sprintf(data->errorMsg, "Illegal character at VALUE! (line: %d, pos: %d)", data->lineNum, i+1) +1; + data->errorMsgLen = sprintf((char*)data->errorMsg, "Illegal character at VALUE! (line: %d, pos: %d)", data->lineNum, i+1) +1; } else if(pstate == DqmW){ - data->errorMsgLen = sprintf(data->errorMsg, "Double quotation mark needed! (line: %d, pos: %d)", data->lineNum, i+1) +1; + data->errorMsgLen = sprintf((char*)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; + data->errorMsgLen = sprintf((char*)data->errorMsg, "Illegal character! (line: %d, pos: %d)", data->lineNum, i+1) +1; } - i--; state = Stop; data->nodeState = lcini_ERROR; @@ -564,7 +580,7 @@ struct lcini_data *iniFSM(struct lcini_data *data, const char *in, int32_t len){ -lcini_data *lciniCreateNode( lcini_data *head, int64_t lineLen ){ /* Creates one Node */ +lcini_data *lciniCreateNode( lcini_data *head, int lineLen ){ /* Creates one Node */ lcini_data *curr; curr = (lcini_data *) calloc(1, sizeof(lcini_data)); @@ -573,11 +589,11 @@ lcini_data *lciniCreateNode( lcini_data *head, int64_t lineLen ){ /* Creates one curr->lineLen = lineLen; if(lineLen > 0){ - 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)); + curr->section = (uint8_t *) calloc(lineLen, sizeof(uint8_t)); + curr->param = (uint8_t *) calloc(lineLen, sizeof(uint8_t)); + curr->value = (uint8_t *) calloc(lineLen, sizeof(uint8_t)); + curr->comment = (uint8_t *) calloc(lineLen, sizeof(uint8_t)); + curr->errorMsg = (uint8_t *) calloc(lineLen, sizeof(uint8_t)); } else { lineLen = 0; } @@ -620,23 +636,23 @@ lcini_data *lciniDestroyNodes( lcini_data *head){ /* Destroys Nodes from HEAD to struct lcini_data *lciniReadOut(const char *filename){ /* Reads the entire file to a linked-list */ int c=0; - char *buff; + uint8_t *buff; FILE *fp=NULL; - int64_t linemax, line=0, pos=0; + int32_t linemax, line=0, pos=0; /*char cc;*/ - struct lcini_data *prev=NULL, *curr=NULL, *list = NULL; + struct lcini_data *prev=NULL, *curr=NULL, *list=NULL; fp = fopen(filename, "rb"); if(!fp ){ /* fp == NULL */ list = lciniCreateNode(NULL, 256); list->errorMsg = lciniStrResize(list->errorMsg, list->errorMsgLen, 256); - list->errorMsgLen = sprintf(list->errorMsg, "File opening error. Errno: %d (%s)", errno, strerror(errno) ); + list->errorMsgLen = sprintf((char*)list->errorMsg, "File opening error. Errno: %d (%s)", errno, strerror(errno) ); list->nodeState = lcini_ERROR; } else { linemax = lciniFileMaxLineLen(fp) +1; - buff = (char *) malloc(linemax*sizeof(char)); - memset(buff, 0, linemax*sizeof(char)); + buff = (uint8_t*)malloc(linemax*sizeof(uint8_t)); + memset(buff, 0, linemax*sizeof(uint8_t)); while( c != EOF){ c = fgetc(fp); @@ -683,7 +699,7 @@ struct lcini_data *lciniReadOut(const char *filename){ /* Reads the entire /* return list; */ } pos = 0; - memset(buff, 0, linemax*sizeof(char)); + memset(buff, 0, linemax*sizeof(uint8_t)); } else { buff[pos] = c; pos++; @@ -703,21 +719,20 @@ struct lcini_data *lciniReadOut(const char *filename){ /* Reads the entire int lciniReadOutOwn(const char *filename){ /* Reads the entire file to a linked-list */ int c=0; - char *buff=NULL; + uint8_t *buff=NULL; FILE *fp=NULL; int64_t linemax, line=0, pos=0; struct lcini_data *curr; - /* char cc;*/ curr = lciniCreateNode(NULL,256); - buff = (char *) malloc(256*sizeof(char)); - memset(buff, 0, 256*sizeof(char)); + buff = (uint8_t*) malloc(256*sizeof(uint8_t)); + memset(buff, 0, 256*sizeof(uint8_t)); fp = fopen(filename, "rb"); if(!fp){ /* fp == NULL */ if( mylciniReadOutFunct != NULL){ - sprintf(buff, "File opening error. Errno: %d (%s)", errno, strerror(errno) ); - (*mylciniReadOutFunct)(0,0, NULL,0, NULL,0, NULL,0, NULL,0, buff, 256); + sprintf((char*)buff, "File opening error. Errno: %d (%s)", errno, strerror(errno) ); + (*mylciniReadOutFunct)(0,0, NULL,0, NULL,0, NULL,0, NULL,0, (char*)buff, 256); } } else { @@ -726,24 +741,26 @@ int lciniReadOutOwn(const char *filename){ /* Reads the entire file to a li while( c != EOF){ c = fgetc(fp); - /*cc = c;*/ /* debug */ if( c == '\n' || c == EOF){ line++; buff[pos] = '\n'; - - if(1){ /* Call the Finite-State-Machine processor */ + if(curr){ /* Call the Finite-State-Machine processor */ curr->lineNum = line; curr->lineLen = pos + 1; iniFSM(curr, buff, linemax); } if(curr->nodeState != lcini_EMPTY && mylciniReadOutFunct != NULL ){ /* Call with function ptr */ - (*mylciniReadOutFunct)(line, pos+1, curr->section, curr->sectionLen, curr->param, curr->paramLen, curr->value, curr->valueLen, curr->comment, curr->commentLen, curr->errorMsg, curr->errorMsgLen); + (*mylciniReadOutFunct)(line, pos+1, (char*)curr->section, curr->sectionLen, (char*)curr->param, curr->paramLen, (char*)curr->value, curr->valueLen, (char*)curr->comment, curr->commentLen, (char*)curr->errorMsg, curr->errorMsgLen); } - + curr->paramLen = 0; + curr->valueLen = 0; + curr->commentLen = 0; + curr->errorMsgLen = 0; + pos = 0; - memset(buff, 0, linemax*sizeof(char)); + memset(buff, 0, linemax*sizeof(uint8_t)); } else { buff[pos] = c; pos++; @@ -761,3 +778,63 @@ int lciniReadOutOwn(const char *filename){ /* Reads the entire file to a li +/* +char *lciniGetFromFileStr(const char *filename, const char *section, const char *parameter, char *buff, int len){ + + int c=0; + uint8_t *buff=NULL; + char *value=NULL; + FILE *fp=NULL; + int64_t linemax, line=0, pos=0; + struct lcini_data *curr; + + fp = fopen(filename, "rb"); + + if(!fp){ + return NULL; + } else { + linemax = lciniFileMaxLineLen(fp) +1; + curr = lciniCreateNode(NULL,linemax); + buff = (uint8_t *) malloc(linemax*sizeof(uint8_t)); + memset(buff, 0, linemax*sizeof(uint8_t)); + value = malloc(1*sizeof(char)); + + while( c != EOF){ + c = fgetc(fp); + + if( c == '\n' || c == EOF){ + line++; + buff[pos] = '\n'; + + if(curr){ + curr->lineNum = line; + curr->lineLen = pos + 1; + iniFSM(curr, buff, linemax); + } + if(curr->nodeState != lcini_EMPTY && value && section && param){ + if(strcmp(curr->section, section) == 0 && strcmp(curr->param, param) == 0){ + value = lciniStrResize(value, 1, curr->valueLen); + } + } + curr->paramLen = 0; + curr->valueLen = 0; + curr->commentLen = 0; + curr->errorMsgLen = 0; + + pos = 0; + memset(buff, 0, linemax*sizeof(uint8_t)); + } else { + buff[pos] = c; + pos++; + } + } + lciniDestroyNodes(curr); + free(buff); + } + + if(fp){ + fclose(fp); + } + return value; +} +*/
\ No newline at end of file diff --git a/src/inirw_internal.h b/src/inirw_internal.h index c569fd7..f698f29 100644 --- a/src/inirw_internal.h +++ b/src/inirw_internal.h @@ -41,37 +41,23 @@ 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 lcini_data *iniFSM(struct lcini_data *data, const char *in, int32_t len); -int eescape(int c); -int isascalnum(int c); /* Check if input is ASCII Alpha-numeric */ -int checkspace(int c); /* Only for ASCII characters */ - + enum lcini_states {Start, BgnSp, CommEndW, SectEndW, SectEndD, EqW1, EqW2, ValPSP, ValW, ValFSP, DqmW, Bslsh, Error, Stop }; + static size_t strNullLen(const uint8_t *str); + static struct lcini_data *iniFSM(struct lcini_data *data, const uint8_t *in, int32_t len); + static uint8_t isascalnum(uint8_t c); /* Check if input is ASCII Alpha-numeric */ + static uint8_t checkspace(uint8_t c); /* Only for ASCII characters */ + static size_t strLcpy(uint8_t *dst, size_t dstlen, const uint8_t *src, size_t srclen); + static uint8_t *lciniStrResize(uint8_t *ptr, size_t oldsize, size_t newsize); + static uint8_t unescape(uint8_t c); #ifdef ini_read_c -int unescape(int c); +/* int unescape(int c); */ #endif /* ini_read_c */ #ifdef ini_write_c -//static const char* komment = ";#"; + static uint8_t eescape(uint8_t 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 ); -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); -int64_t lciGETtoInt64(const char *filename, const char *section, const char *param); - -double lciGETtoDlb(const char *filename, const char *section, const char *param); -float lciGETtoFlt(const char *filename, const char *section, const char *param); -long int lciGETtoLng(const char *filename, const char *section, const char *param); -*/ - - - #endif /* INI_READ_H_INCLUDED */ diff --git a/src/lightconfini.h b/src/lightconfini.h index 7bbe918..e2b4e2d 100644 --- a/src/lightconfini.h +++ b/src/lightconfini.h @@ -7,33 +7,32 @@ typedef struct lcini_data { int32_t lineNum; int32_t lineLen; - char *section; + uint8_t *section; int32_t sectionLen; int32_t sectionStartPos; - char *param; + uint8_t *param; int32_t paramLen; int32_t paramStartPos; - char *value; + uint8_t *value; int32_t valueLen; int32_t valueStartPos; enum valueDraw {lcini_EMPTYVAL, lcini_SIMPLEVAL, lcini_MULTILINEVAL, lcini_DQUOTEDVAL} valueDraw; - char *comment; + uint8_t *comment; int32_t commentLen; int32_t commentStartPos; - char commentSign; - char *errorMsg; + uint8_t commentSign; + uint8_t *errorMsg; int32_t errorMsgLen; struct lcini_data *next; } lcini_data; -typedef struct lcini_retdata{ - char *value; - int32_t vallen; - char *error; - int32_t errorlen; -} lcini_retdata; +typedef struct lcini_shortret{ + uint8_t *ret; + int32_t retlen; + enum retType{lcini_shortretOK, lcini_shortretERROR, lcini_shortretEMPTY} retType; +} lcini_shortret; /* Ha maga függvény van átpakolva, nevestül, testestül */ /* extern void (mylciniReadOutFunct)(int line, int linelen, char *section, int sectionlen, char *param, int paramlen, char *value, int valuelen, char *comment, int commentlen, char *error, int errorlen ) ; */ @@ -45,27 +44,17 @@ extern lcinimyReadFunc mylciniReadOutFunct; struct lcini_data *lciniReadOut(const char *filename); int lciniReadOutOwn(const char *filename); -char *lciniGet(const char *filename, const char *section, const char *parameter, int32_t bufflen); -lcini_retdata *lciniGet2(const char *filename, const char *section, const char *parameter); +lcini_data *lciniGet(lcini_data *head, const char *section, const char *parameter); /* FETCH requested value TO an lcini_data object, FROM lcini_data list*/ +char *lciniGetStr(lcini_data *head, const char *section, const char *parameter, char *dst, int dstlen); /* FETCH requested value TO null-terminated-string, FROM lcini_data list */ +lcini_shortret *lciniGetShort(lcini_data *head, const char *section, const char *parameter); /* FETCH requested value TO shortret object, FROM lcini_data list*/ +lcini_shortret *lciniGetFromFileShort(const char *filename, const char *section, const char *parameter); /* FETCH requested value TO shortret object FROM file */ +char *lciniGetFromFileStr(const char *filename, const char *section, const char *parameter, char *buff, int len); - -char *lciGETtoStr( const char *section, const char *param, char *dest, size_t dstlen ); -/*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); -int64_t lciGETtoInt64(const char *filename, const char *section, const char *param); - -double lciGETtoDlb(const char *filename, const char *section, const char *param); -float lciGETtoFlt(const char *filename, const char *section, const char *param); -long int lciGETtoLng(const char *filename, const char *section, const char *param); - -char *lciniStrResize(char *ptr, size_t oldsize, size_t newsize); lcini_data *lciniDestroyNodes( lcini_data *head); -lcini_data *lciniCreateNode( lcini_data *head, int64_t lineLen ); +lcini_data *lciniCreateNode( lcini_data *head, int lineLen ); size_t lciniFileMaxLineLen(FILE *tfd); #endif /* LIGHTCONFINI_H_INCLUDED */ @@ -17,10 +17,12 @@ lcinimyReadFunc mylciniReadOutFunct=myfunct; + + void myfunct(int line, int linelen, char *section, int sectionlen, char *param, int paramlen, char *value, int valuelen, char *comment, int commentlen, char *error, int errorlen ){ - printf("LN: %d,\tLL: %d,\tSC: %*s,%2d P: %*s,%2d V: %*s,%2d C: %*s,%2d ER: %*s \n", line, linelen, lens, section,sectionlen, - lenp, param, paramlen, lenv, value, valuelen, lenc, comment, commentlen, elen, error); + printf("LN: %d,\tLL: %d,\tSC: %*s,%2d P: %*s,%2d V: %*s,%2d C: %*s,%2d ER: %*s,%2d\n", line, linelen, lens, section,sectionlen, + lenp, param, paramlen, lenv, value, valuelen, lenc, comment, commentlen, elen, error, errorlen); } diff --git a/tests/bom.ini b/tests/bom.ini index 291abd8..2a403ad 100644 --- a/tests/bom.ini +++ b/tests/bom.ini @@ -1,5 +1,5 @@ [bom_section] ;OK bom_name=bom_value ;OK -key“ = value“ ;ER +key “= value“ ;ER key="value" ;OK 10= 10
\ No newline at end of file |