Add generic parser to cfg to struct.
This commit is contained in:
7
config.c
7
config.c
@@ -47,6 +47,10 @@ int checkSection(char *str,char delimiterLeft,char delimiterRight,char **section
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(state != ST_FOUND_LEFT_DELIMITER)
|
||||
{
|
||||
return ST_ERROR_NOT_FOUND_LEFT_DELIMITER;
|
||||
}
|
||||
break;
|
||||
case ST_FOUND_LEFT_DELIMITER:
|
||||
for(i=0;i<=len;i++) //find second (right) delimiter
|
||||
@@ -153,7 +157,7 @@ int getNameValuePair(char *str,char leftDelimiterPos,char rightDelimiterPos,char
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
int parseConfig(char *buffer,struct configEntry **entry,int configSizeCount)
|
||||
int parseConfig(char *buffer,struct configEntry **entry,int configSizeCount,int *returnedCount)
|
||||
{
|
||||
int state=ST_INIT;
|
||||
int ret=0;
|
||||
@@ -191,6 +195,7 @@ int parseConfig(char *buffer,struct configEntry **entry,int configSizeCount)
|
||||
if(i<configSizeCount-1)
|
||||
{
|
||||
i++;
|
||||
*returnedCount = i;
|
||||
}
|
||||
else {
|
||||
return ERROR_STR;
|
||||
|
||||
Reference in New Issue
Block a user