\doxysection{config.\+c} \hypertarget{config_8c_source}{}\label{config_8c_source}\mbox{\hyperlink{config_8c}{Go to the documentation of this file.}} \begin{DoxyCode}{0} \DoxyCodeLine{\Hypertarget{config_8c_source_l00001}00001\ \textcolor{preprocessor}{\#include"{}\mbox{\hyperlink{config_8h}{config.h}}"{}}} \DoxyCodeLine{\Hypertarget{config_8c_source_l00002}00002\ \textcolor{preprocessor}{\#include}} \DoxyCodeLine{\Hypertarget{config_8c_source_l00003}00003\ \textcolor{preprocessor}{\#include}} \DoxyCodeLine{\Hypertarget{config_8c_source_l00004}00004\ \textcolor{preprocessor}{\#include}} \DoxyCodeLine{\Hypertarget{config_8c_source_l00005}00005\ \textcolor{preprocessor}{\#include}} \DoxyCodeLine{\Hypertarget{config_8c_source_l00006}00006\ } \DoxyCodeLine{\Hypertarget{config_8c_source_l00024}\mbox{\hyperlink{config_8c_aae86bc3f3ebba4d6aba3ca1392c0126a}{00024}}\ \textcolor{keywordtype}{int}\ \mbox{\hyperlink{config_8c_aae86bc3f3ebba4d6aba3ca1392c0126a}{checkSection}}(\textcolor{keywordtype}{char}\ *str,\textcolor{keywordtype}{char}\ delimiterLeft,\textcolor{keywordtype}{char}\ delimiterRight,\textcolor{keywordtype}{char}\ **sectionName)} \DoxyCodeLine{\Hypertarget{config_8c_source_l00025}00025\ \{} \DoxyCodeLine{\Hypertarget{config_8c_source_l00026}00026\ \ \ \ \ \textcolor{keywordtype}{char}\ section[\mbox{\hyperlink{config_8h_aa454692b60895f7025f12b1e0065acea}{MAX\_LEN\_SECTIONNAME}}];} \DoxyCodeLine{\Hypertarget{config_8c_source_l00027}00027\ \ \ \ \ \textcolor{keywordtype}{int}\ i\ =\ 0;\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//most\ outer\ loop\ -\/>\ character\ of\ string}} \DoxyCodeLine{\Hypertarget{config_8c_source_l00028}00028\ \ \ \ \ \textcolor{keywordflow}{if}(str\ ==\ NULL)} \DoxyCodeLine{\Hypertarget{config_8c_source_l00029}00029\ \ \ \ \ \{} \DoxyCodeLine{\Hypertarget{config_8c_source_l00030}00030\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{config_8h_abc212059095802b47f10a6a49fd45abc}{ERROR\_STR}};} \DoxyCodeLine{\Hypertarget{config_8c_source_l00031}00031\ \ \ \ \ \}} \DoxyCodeLine{\Hypertarget{config_8c_source_l00032}00032\ \ \ \ \ \textcolor{keywordtype}{int}\ len\ =\ strlen(str);} \DoxyCodeLine{\Hypertarget{config_8c_source_l00033}00033\ \ \ \ \ \textcolor{keywordtype}{int}\ state\ =\ \mbox{\hyperlink{config_8h_a07c5dd6a63f85102afff94734b066db6}{ST\_INIT}};} \DoxyCodeLine{\Hypertarget{config_8c_source_l00034}00034\ \ \ \ \ \textcolor{keywordtype}{int}\ leftDelimiterPos=0;} \DoxyCodeLine{\Hypertarget{config_8c_source_l00035}00035\ \ \ \ \ \textcolor{keywordtype}{int}\ rightDelimiterPos=0;} \DoxyCodeLine{\Hypertarget{config_8c_source_l00036}00036\ \ \ \ \ \textcolor{keywordtype}{char}\ *sectionName2\ =\ NULL;} \DoxyCodeLine{\Hypertarget{config_8c_source_l00037}00037\ \ \ \ \ \textcolor{keywordflow}{while}(state\ !=\ \mbox{\hyperlink{config_8h_a587e636e48ca212f7c964a93ae005e03}{ST\_FINISH}})} \DoxyCodeLine{\Hypertarget{config_8c_source_l00038}00038\ \ \ \ \ \{} \DoxyCodeLine{\Hypertarget{config_8c_source_l00039}00039\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{switch}(state)\ } \DoxyCodeLine{\Hypertarget{config_8c_source_l00040}00040\ \ \ \ \ \ \ \ \ \{} \DoxyCodeLine{\Hypertarget{config_8c_source_l00041}00041\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{case}\ \mbox{\hyperlink{config_8h_a07c5dd6a63f85102afff94734b066db6}{ST\_INIT}}:} \DoxyCodeLine{\Hypertarget{config_8c_source_l00042}00042\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}(i=0;i<=len;i++)\ \ \ \ \ \ \ \ \textcolor{comment}{//find\ first\ (left)\ delimiter\ \ \ \ }} \DoxyCodeLine{\Hypertarget{config_8c_source_l00043}00043\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \{} \DoxyCodeLine{\Hypertarget{config_8c_source_l00044}00044\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(str[i]\ ==\ delimiterLeft)} \DoxyCodeLine{\Hypertarget{config_8c_source_l00045}00045\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \{} \DoxyCodeLine{\Hypertarget{config_8c_source_l00046}00046\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ state\ =\ \mbox{\hyperlink{config_8h_a4aa0fcd1d1c19c873711c0dbdf590f51}{ST\_FOUND\_LEFT\_DELIMITER}};} \DoxyCodeLine{\Hypertarget{config_8c_source_l00047}00047\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ leftDelimiterPos\ =\ i;} \DoxyCodeLine{\Hypertarget{config_8c_source_l00048}00048\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{break};} \DoxyCodeLine{\Hypertarget{config_8c_source_l00049}00049\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}} \DoxyCodeLine{\Hypertarget{config_8c_source_l00050}00050\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}} \DoxyCodeLine{\Hypertarget{config_8c_source_l00051}00051\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(state\ !=\ \mbox{\hyperlink{config_8h_a4aa0fcd1d1c19c873711c0dbdf590f51}{ST\_FOUND\_LEFT\_DELIMITER}})} \DoxyCodeLine{\Hypertarget{config_8c_source_l00052}00052\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \{} \DoxyCodeLine{\Hypertarget{config_8c_source_l00053}00053\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{config_8h_afae21c34cd1bfa910d95db50f151c81c}{ST\_ERROR\_NOT\_FOUND\_LEFT\_DELIMITER}};} \DoxyCodeLine{\Hypertarget{config_8c_source_l00054}00054\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}} \DoxyCodeLine{\Hypertarget{config_8c_source_l00055}00055\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{break};} \DoxyCodeLine{\Hypertarget{config_8c_source_l00056}00056\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{case}\ \mbox{\hyperlink{config_8h_a4aa0fcd1d1c19c873711c0dbdf590f51}{ST\_FOUND\_LEFT\_DELIMITER}}:} \DoxyCodeLine{\Hypertarget{config_8c_source_l00057}00057\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}(i=0;i<=len;i++)\ \ \ \ \ \ \ \ \textcolor{comment}{//find\ second\ (right)\ delimiter\ \ \ \ }} \DoxyCodeLine{\Hypertarget{config_8c_source_l00058}00058\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \{} \DoxyCodeLine{\Hypertarget{config_8c_source_l00059}00059\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(str[i]\ ==\ delimiterRight)} \DoxyCodeLine{\Hypertarget{config_8c_source_l00060}00060\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \{} \DoxyCodeLine{\Hypertarget{config_8c_source_l00061}00061\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ state\ =\ \mbox{\hyperlink{config_8h_a109ad3408cd20ac98f7063ad33ee151c}{ST\_FOUND\_RIGHT\_DELIMITER}};} \DoxyCodeLine{\Hypertarget{config_8c_source_l00062}00062\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ rightDelimiterPos\ =\ i;} \DoxyCodeLine{\Hypertarget{config_8c_source_l00063}00063\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{break};} \DoxyCodeLine{\Hypertarget{config_8c_source_l00064}00064\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}} \DoxyCodeLine{\Hypertarget{config_8c_source_l00065}00065\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}} \DoxyCodeLine{\Hypertarget{config_8c_source_l00066}00066\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(state\ !=\ \mbox{\hyperlink{config_8h_a109ad3408cd20ac98f7063ad33ee151c}{ST\_FOUND\_RIGHT\_DELIMITER}})} \DoxyCodeLine{\Hypertarget{config_8c_source_l00067}00067\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \{} \DoxyCodeLine{\Hypertarget{config_8c_source_l00068}00068\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{config_8h_aea1c2232d9f2837fbb565f13e5d7e8ea}{ST\_ERROR\_NOT\_FOUND\_RIGHT\_DELIMITER}};} \DoxyCodeLine{\Hypertarget{config_8c_source_l00069}00069\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}} \DoxyCodeLine{\Hypertarget{config_8c_source_l00070}00070\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{break};} \DoxyCodeLine{\Hypertarget{config_8c_source_l00071}00071\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{case}\ \mbox{\hyperlink{config_8h_a109ad3408cd20ac98f7063ad33ee151c}{ST\_FOUND\_RIGHT\_DELIMITER}}:} \DoxyCodeLine{\Hypertarget{config_8c_source_l00072}00072\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ ret=0;} \DoxyCodeLine{\Hypertarget{config_8c_source_l00073}00073\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}((ret=\mbox{\hyperlink{config_8c_a699e504c1ab9ceffb828dbf365a5e374}{getStrAtPos}}(str,leftDelimiterPos,rightDelimiterPos,sectionName,\mbox{\hyperlink{config_8h_aa454692b60895f7025f12b1e0065acea}{MAX\_LEN\_SECTIONNAME}}))\ ==\ \mbox{\hyperlink{config_8h_a258bb72419ef143530a2f8f55e7d57af}{NO\_ERROR}})} \DoxyCodeLine{\Hypertarget{config_8c_source_l00074}00074\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \{} \DoxyCodeLine{\Hypertarget{config_8c_source_l00075}00075\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ state\ =\ \mbox{\hyperlink{config_8h_a587e636e48ca212f7c964a93ae005e03}{ST\_FINISH}};\ \ \ \ } \DoxyCodeLine{\Hypertarget{config_8c_source_l00076}00076\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}\textcolor{keywordflow}{else}\{} \DoxyCodeLine{\Hypertarget{config_8c_source_l00077}00077\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ ret;} \DoxyCodeLine{\Hypertarget{config_8c_source_l00078}00078\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}} \DoxyCodeLine{\Hypertarget{config_8c_source_l00079}00079\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{case}\ \mbox{\hyperlink{config_8h_a587e636e48ca212f7c964a93ae005e03}{ST\_FINISH}}:} \DoxyCodeLine{\Hypertarget{config_8c_source_l00080}00080\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{config_8h_a02f5a0519bc0372946e64d593c0c58ce}{FOUND\_SECTION}};} \DoxyCodeLine{\Hypertarget{config_8c_source_l00081}00081\ \ \ \ \ \ \ \ \ \}} \DoxyCodeLine{\Hypertarget{config_8c_source_l00082}00082\ \ \ \ \ \}} \DoxyCodeLine{\Hypertarget{config_8c_source_l00083}00083\ \ \ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{config_8h_ac1a724419200e9f961dc787950aecd2b}{NO\_SECTION}};} \DoxyCodeLine{\Hypertarget{config_8c_source_l00084}00084\ \}} \DoxyCodeLine{\Hypertarget{config_8c_source_l00085}00085\ } \DoxyCodeLine{\Hypertarget{config_8c_source_l00098}\mbox{\hyperlink{config_8c_a699e504c1ab9ceffb828dbf365a5e374}{00098}}\ \textcolor{keywordtype}{int}\ \mbox{\hyperlink{config_8c_a699e504c1ab9ceffb828dbf365a5e374}{getStrAtPos}}(\textcolor{keywordtype}{char}\ *str,\textcolor{keywordtype}{int}\ fromPos,\textcolor{keywordtype}{int}\ toPos,\textcolor{keywordtype}{char}\ **name,\textcolor{keywordtype}{int}\ sizeName)} \DoxyCodeLine{\Hypertarget{config_8c_source_l00099}00099\ \{} \DoxyCodeLine{\Hypertarget{config_8c_source_l00100}00100\ \ \ \ \ \textcolor{keywordflow}{if}(*name\ ==\ NULL)} \DoxyCodeLine{\Hypertarget{config_8c_source_l00101}00101\ \ \ \ \ \{} \DoxyCodeLine{\Hypertarget{config_8c_source_l00102}00102\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ error\ =\ errno;} \DoxyCodeLine{\Hypertarget{config_8c_source_l00103}00103\ \ \ \ \ \ \ \ \ printf(\textcolor{stringliteral}{"{}Pointer\ NULL:\%d\(\backslash\)n"{}},error);} \DoxyCodeLine{\Hypertarget{config_8c_source_l00104}00104\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ error;} \DoxyCodeLine{\Hypertarget{config_8c_source_l00105}00105\ \ \ \ \ \}} \DoxyCodeLine{\Hypertarget{config_8c_source_l00106}00106\ \ \ \ \ \textcolor{keywordtype}{int}\ i=fromPos;\ \ \ \ \ \ \textcolor{comment}{//character\ iterator,\ which\ starts\ from\ specified\ pos}} \DoxyCodeLine{\Hypertarget{config_8c_source_l00107}00107\ \ \ \ \ \textcolor{keywordtype}{int}\ j=0;\ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//the\ character\ iterator\ for\ the\ target\ string}} \DoxyCodeLine{\Hypertarget{config_8c_source_l00108}00108\ \ \ \ \ \textcolor{keywordtype}{int}\ diffLen=toPos-\/fromPos;} \DoxyCodeLine{\Hypertarget{config_8c_source_l00109}00109\ \ \ \ \ \textcolor{keywordtype}{char}\ *ptr\_name=*name;} \DoxyCodeLine{\Hypertarget{config_8c_source_l00110}00110\ \ \ \ \ \textcolor{keywordflow}{if}(diffLen\ >\ \mbox{\hyperlink{config_8h_aa454692b60895f7025f12b1e0065acea}{MAX\_LEN\_SECTIONNAME}}\ ||\ diffLen>sizeName)} \DoxyCodeLine{\Hypertarget{config_8c_source_l00111}00111\ \ \ \ \ \{} \DoxyCodeLine{\Hypertarget{config_8c_source_l00112}00112\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{config_8h_a39de51bdb6918a63eac8b1bb474e2b84}{ERROR\_MAX\_LEN}};} \DoxyCodeLine{\Hypertarget{config_8c_source_l00113}00113\ \ \ \ \ \}} \DoxyCodeLine{\Hypertarget{config_8c_source_l00114}00114\ \ \ \ \ \textcolor{keywordflow}{for}(i=fromPos,j=0;i<=toPos;i++,j++)} \DoxyCodeLine{\Hypertarget{config_8c_source_l00115}00115\ \ \ \ \ \{} \DoxyCodeLine{\Hypertarget{config_8c_source_l00116}00116\ \ \ \ \ \ \ \ \ ptr\_name[j]\ \ =\ str[i];} \DoxyCodeLine{\Hypertarget{config_8c_source_l00117}00117\ \ \ \ \ \}} \DoxyCodeLine{\Hypertarget{config_8c_source_l00118}00118\ \ \ \ \ ptr\_name[j+1]=\textcolor{charliteral}{'\(\backslash\)0'};} \DoxyCodeLine{\Hypertarget{config_8c_source_l00119}00119\ \ \ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{config_8h_a258bb72419ef143530a2f8f55e7d57af}{NO\_ERROR}};} \DoxyCodeLine{\Hypertarget{config_8c_source_l00120}00120\ \}} \DoxyCodeLine{\Hypertarget{config_8c_source_l00121}00121\ } \DoxyCodeLine{\Hypertarget{config_8c_source_l00151}\mbox{\hyperlink{config_8c_ab0b547ee554d9b305adc1b2ad85080a3}{00151}}\ \textcolor{keywordtype}{int}\ \mbox{\hyperlink{config_8c_ab0b547ee554d9b305adc1b2ad85080a3}{getNameValuePair}}(\textcolor{keywordtype}{char}\ *str,\textcolor{keywordtype}{char}\ leftDelimiterPos,\textcolor{keywordtype}{char}\ rightDelimiterPos,\textcolor{keywordtype}{char}\ **name,\textcolor{keywordtype}{char}\ **value,\textcolor{keywordtype}{int}\ sizeName,\textcolor{keywordtype}{int}\ sizeValue)} \DoxyCodeLine{\Hypertarget{config_8c_source_l00152}00152\ \{} \DoxyCodeLine{\Hypertarget{config_8c_source_l00153}00153\ \ \ \ \ \textcolor{keywordflow}{if}(*name\ ==\ NULL\ ||\ *value\ ==\ NULL)} \DoxyCodeLine{\Hypertarget{config_8c_source_l00154}00154\ \ \ \ \ \{} \DoxyCodeLine{\Hypertarget{config_8c_source_l00155}00155\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ error\ =\ errno;} \DoxyCodeLine{\Hypertarget{config_8c_source_l00156}00156\ \ \ \ \ \ \ \ \ printf(\textcolor{stringliteral}{"{}Pointer\ NULL:\%d\(\backslash\)n"{}},error);} \DoxyCodeLine{\Hypertarget{config_8c_source_l00157}00157\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ error;} \DoxyCodeLine{\Hypertarget{config_8c_source_l00158}00158\ \ \ \ \ \}} \DoxyCodeLine{\Hypertarget{config_8c_source_l00159}00159\ \ \ \ \ \textcolor{keywordtype}{int}\ state=\mbox{\hyperlink{config_8h_a07c5dd6a63f85102afff94734b066db6}{ST\_INIT}};} \DoxyCodeLine{\Hypertarget{config_8c_source_l00160}00160\ \ \ \ \ \textcolor{keywordtype}{char}\ *ptr\_name=*name;} \DoxyCodeLine{\Hypertarget{config_8c_source_l00161}00161\ \ \ \ \ \textcolor{keywordtype}{char}\ *ptr\_value=*value;} \DoxyCodeLine{\Hypertarget{config_8c_source_l00162}00162\ \ \ \ \ \textcolor{keywordtype}{int}\ ret=0;} \DoxyCodeLine{\Hypertarget{config_8c_source_l00163}00163\ } \DoxyCodeLine{\Hypertarget{config_8c_source_l00164}00164\ \ \ \ \ \textcolor{keywordtype}{char}\ *ptrDelimiter=NULL;} \DoxyCodeLine{\Hypertarget{config_8c_source_l00165}00165\ \ \ \ \ \textcolor{keywordtype}{int}\ posDelimiter=0;} \DoxyCodeLine{\Hypertarget{config_8c_source_l00166}00166\ \ \ \ \ \textcolor{keywordtype}{int}\ posEnd=0;} \DoxyCodeLine{\Hypertarget{config_8c_source_l00167}00167\ } \DoxyCodeLine{\Hypertarget{config_8c_source_l00168}00168\ \ \ \ \ ptrDelimiter=strchr(str,leftDelimiterPos);} \DoxyCodeLine{\Hypertarget{config_8c_source_l00169}00169\ \ \ \ \ \textcolor{keywordflow}{if}(ptrDelimiter==NULL)} \DoxyCodeLine{\Hypertarget{config_8c_source_l00170}00170\ \ \ \ \ \{} \DoxyCodeLine{\Hypertarget{config_8c_source_l00171}00171\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{config_8h_a0000658c96c7c74c0904aafe03429a7d}{ERROR\_DELIMITER\_NOT\_FOUND}};} \DoxyCodeLine{\Hypertarget{config_8c_source_l00172}00172\ \ \ \ \ \}} \DoxyCodeLine{\Hypertarget{config_8c_source_l00173}00173\ \ \ \ \ posDelimiter\ =\ (ptrDelimiter\ -\/\ str);} \DoxyCodeLine{\Hypertarget{config_8c_source_l00174}00174\ \ \ \ \ printf(\textcolor{stringliteral}{"{}LenUntilDelimiter:\ \%d\(\backslash\)n"{}},posDelimiter);} \DoxyCodeLine{\Hypertarget{config_8c_source_l00175}00175\ \ \ \ \ \textcolor{keywordflow}{if}((ret=\mbox{\hyperlink{config_8c_a699e504c1ab9ceffb828dbf365a5e374}{getStrAtPos}}(str,0,posDelimiter-\/1,\&ptr\_name,sizeName))\ ==\ \mbox{\hyperlink{config_8h_a258bb72419ef143530a2f8f55e7d57af}{NO\_ERROR}})} \DoxyCodeLine{\Hypertarget{config_8c_source_l00176}00176\ \ \ \ \ \{} \DoxyCodeLine{\Hypertarget{config_8c_source_l00177}00177\ \ \ \ \ \ \ \ printf(\textcolor{stringliteral}{"{}ptr\_name:\%s\(\backslash\)n"{}},ptr\_name);\ } \DoxyCodeLine{\Hypertarget{config_8c_source_l00178}00178\ \ \ \ \ \}\textcolor{keywordflow}{else}\ \{} \DoxyCodeLine{\Hypertarget{config_8c_source_l00179}00179\ \ \ \ \ \ \ \ \ printf(\textcolor{stringliteral}{"{}Error\ at\ getStrAtPos:\%d\(\backslash\)n"{}},ret);} \DoxyCodeLine{\Hypertarget{config_8c_source_l00180}00180\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ ret;} \DoxyCodeLine{\Hypertarget{config_8c_source_l00181}00181\ \ \ \ \ \}} \DoxyCodeLine{\Hypertarget{config_8c_source_l00182}00182\ \ \ \ \ \textcolor{keywordflow}{if}(rightDelimiterPos\ ==\ 0)} \DoxyCodeLine{\Hypertarget{config_8c_source_l00183}00183\ \ \ \ \ \{} \DoxyCodeLine{\Hypertarget{config_8c_source_l00184}00184\ \ \ \ \ \ \ \ \ posEnd\ =\ strlen(str);} \DoxyCodeLine{\Hypertarget{config_8c_source_l00185}00185\ \ \ \ \ \}\textcolor{keywordflow}{else}\{} \DoxyCodeLine{\Hypertarget{config_8c_source_l00186}00186\ \ \ \ \ \ \ \ \ posEnd\ =\ rightDelimiterPos;} \DoxyCodeLine{\Hypertarget{config_8c_source_l00187}00187\ \ \ \ \ \}} \DoxyCodeLine{\Hypertarget{config_8c_source_l00188}00188\ } \DoxyCodeLine{\Hypertarget{config_8c_source_l00189}00189\ \ \ \ \ \textcolor{keywordflow}{if}((ret=\mbox{\hyperlink{config_8c_a699e504c1ab9ceffb828dbf365a5e374}{getStrAtPos}}(str,posDelimiter+1,posEnd,\&ptr\_value,sizeValue))\ ==\ \mbox{\hyperlink{config_8h_a258bb72419ef143530a2f8f55e7d57af}{NO\_ERROR}})} \DoxyCodeLine{\Hypertarget{config_8c_source_l00190}00190\ \ \ \ \ \{} \DoxyCodeLine{\Hypertarget{config_8c_source_l00191}00191\ \ \ \ \ \ \ \ printf(\textcolor{stringliteral}{"{}ptr\_name:\%s\(\backslash\)n"{}},ptr\_value);\ } \DoxyCodeLine{\Hypertarget{config_8c_source_l00192}00192\ \ \ \ \ \}\textcolor{keywordflow}{else}\ \{} \DoxyCodeLine{\Hypertarget{config_8c_source_l00193}00193\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ ret;} \DoxyCodeLine{\Hypertarget{config_8c_source_l00194}00194\ \ \ \ \ \}} \DoxyCodeLine{\Hypertarget{config_8c_source_l00195}00195\ \ \ \ } \DoxyCodeLine{\Hypertarget{config_8c_source_l00196}00196\ \ \ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{config_8h_a258bb72419ef143530a2f8f55e7d57af}{NO\_ERROR}};} \DoxyCodeLine{\Hypertarget{config_8c_source_l00197}00197\ \}} \DoxyCodeLine{\Hypertarget{config_8c_source_l00198}00198\ } \DoxyCodeLine{\Hypertarget{config_8c_source_l00215}\mbox{\hyperlink{config_8c_a15a5f64f830221feac0af723899208b2}{00215}}\ \textcolor{keywordtype}{int}\ \mbox{\hyperlink{config_8c_a15a5f64f830221feac0af723899208b2}{parseConfig}}(\textcolor{keywordtype}{char}\ *originalBuffer,\textcolor{keyword}{struct}\ \mbox{\hyperlink{structconfigEntry}{configEntry}}\ **entry,\textcolor{keywordtype}{int}\ configSizeCount,\textcolor{keywordtype}{int}\ *returnedCount)} \DoxyCodeLine{\Hypertarget{config_8c_source_l00216}00216\ \{} \DoxyCodeLine{\Hypertarget{config_8c_source_l00217}00217\ \ \ \ \ \textcolor{keywordtype}{int}\ state=\mbox{\hyperlink{config_8h_a07c5dd6a63f85102afff94734b066db6}{ST\_INIT}};} \DoxyCodeLine{\Hypertarget{config_8c_source_l00218}00218\ \ \ \ \ \textcolor{keywordtype}{int}\ ret=0;} \DoxyCodeLine{\Hypertarget{config_8c_source_l00219}00219\ \ \ \ \ \textcolor{keywordtype}{int}\ i=0;} \DoxyCodeLine{\Hypertarget{config_8c_source_l00220}00220\ \ \ \ \ *returnedCount=0;} \DoxyCodeLine{\Hypertarget{config_8c_source_l00221}00221\ \ \ \ \ \textcolor{keywordtype}{char}\ *sectionName=NULL;} \DoxyCodeLine{\Hypertarget{config_8c_source_l00222}00222\ \ \ \ \ \textcolor{keyword}{struct\ }\mbox{\hyperlink{structconfigEntry}{configEntry}}\ *ptr\_entry\ =\ *entry;} \DoxyCodeLine{\Hypertarget{config_8c_source_l00223}00223\ \ \ \ \ \textcolor{keywordtype}{char}\ *\mbox{\hyperlink{structconfigEntry_a6b96fdfa727658a18ab5a03d5e5a4572}{keyName}}=NULL;} \DoxyCodeLine{\Hypertarget{config_8c_source_l00224}00224\ \ \ \ \ \textcolor{keywordtype}{char}\ *\mbox{\hyperlink{structconfigEntry_a221f7ca4b687e6cfce063e332330d635}{keyValue}}=NULL;} \DoxyCodeLine{\Hypertarget{config_8c_source_l00225}00225\ \ \ \ \ \textcolor{keywordtype}{char}\ *buffer=NULL;} \DoxyCodeLine{\Hypertarget{config_8c_source_l00226}00226\ } \DoxyCodeLine{\Hypertarget{config_8c_source_l00227}00227\ \ \ \ \ buffer\ =\ malloc(strlen(originalBuffer)+1);} \DoxyCodeLine{\Hypertarget{config_8c_source_l00228}00228\ \ \ \ \ \textcolor{keywordflow}{if}(buffer\ ==\ NULL)} \DoxyCodeLine{\Hypertarget{config_8c_source_l00229}00229\ \ \ \ \ \{} \DoxyCodeLine{\Hypertarget{config_8c_source_l00230}00230\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ error\ =\ errno;} \DoxyCodeLine{\Hypertarget{config_8c_source_l00231}00231\ \ \ \ \ \ \ \ \ printf(\textcolor{stringliteral}{"{}ERROR\ MALLOC:\%d"{}},error);} \DoxyCodeLine{\Hypertarget{config_8c_source_l00232}00232\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{config_8h_ae0f18393ca3f7c151a4e58ae35b119f7}{ERR\_PARSECONFIG\_UNKNOWN}};} \DoxyCodeLine{\Hypertarget{config_8c_source_l00233}00233\ \ \ \ \ \}} \DoxyCodeLine{\Hypertarget{config_8c_source_l00234}00234\ \ \ \ \ memset(buffer,0,strlen(originalBuffer)+1);} \DoxyCodeLine{\Hypertarget{config_8c_source_l00235}00235\ \ \ \ \ strcpy(buffer,originalBuffer);} \DoxyCodeLine{\Hypertarget{config_8c_source_l00236}00236\ \ \ \ \ } \DoxyCodeLine{\Hypertarget{config_8c_source_l00237}00237\ \ \ \ \ \textcolor{comment}{//this\ step\ is\ necessary,\ because\ the\ strok\ function\ modifys\ the\ originalBuffer}} \DoxyCodeLine{\Hypertarget{config_8c_source_l00238}00238\ \ \ \ \ \textcolor{comment}{//so\ we\ make\ a\ copy\ of\ it}} \DoxyCodeLine{\Hypertarget{config_8c_source_l00239}00239\ \ \ \ \ strcpy(buffer,originalBuffer);} \DoxyCodeLine{\Hypertarget{config_8c_source_l00240}00240\ } \DoxyCodeLine{\Hypertarget{config_8c_source_l00241}00241\ \ \ \ \ printf(\textcolor{stringliteral}{"{}buffer:\%s\(\backslash\)n-\/-\/"{}},buffer);} \DoxyCodeLine{\Hypertarget{config_8c_source_l00242}00242\ } \DoxyCodeLine{\Hypertarget{config_8c_source_l00243}00243\ \ \ \ \ \mbox{\hyperlink{structconfigEntry_ad610b2d30e2432b3cb5f0d0e397f2043}{sectionName}}\ =\ malloc(\mbox{\hyperlink{config_8h_aa454692b60895f7025f12b1e0065acea}{MAX\_LEN\_SECTIONNAME}});} \DoxyCodeLine{\Hypertarget{config_8c_source_l00244}00244\ \ \ \ \ memset(\mbox{\hyperlink{structconfigEntry_ad610b2d30e2432b3cb5f0d0e397f2043}{sectionName}},0,\mbox{\hyperlink{config_8h_aa454692b60895f7025f12b1e0065acea}{MAX\_LEN\_SECTIONNAME}});} \DoxyCodeLine{\Hypertarget{config_8c_source_l00245}00245\ } \DoxyCodeLine{\Hypertarget{config_8c_source_l00246}00246\ \ \ \ \ \textcolor{comment}{//read\ buffer\ line\ by\ line}} \DoxyCodeLine{\Hypertarget{config_8c_source_l00247}00247\ \ \ \ \ \textcolor{keywordtype}{char}\ *token;} \DoxyCodeLine{\Hypertarget{config_8c_source_l00248}00248\ \ \ \ \ token\ =\ strtok(buffer,\textcolor{stringliteral}{"{}\(\backslash\)n"{}});} \DoxyCodeLine{\Hypertarget{config_8c_source_l00249}00249\ \ \ \ \ \textcolor{keywordflow}{while}(token\ !=\ NULL\ \&\&\ state\ !=\ \mbox{\hyperlink{config_8h_a587e636e48ca212f7c964a93ae005e03}{ST\_FINISH}})} \DoxyCodeLine{\Hypertarget{config_8c_source_l00250}00250\ \ \ \ \ \{} \DoxyCodeLine{\Hypertarget{config_8c_source_l00251}00251\ } \DoxyCodeLine{\Hypertarget{config_8c_source_l00252}00252\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{switch}(state)} \DoxyCodeLine{\Hypertarget{config_8c_source_l00253}00253\ \ \ \ \ \ \ \ \ \{} \DoxyCodeLine{\Hypertarget{config_8c_source_l00254}00254\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{case}\ \mbox{\hyperlink{config_8h_a07c5dd6a63f85102afff94734b066db6}{ST\_INIT}}:} \DoxyCodeLine{\Hypertarget{config_8c_source_l00255}00255\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}((ret=\mbox{\hyperlink{config_8c_aae86bc3f3ebba4d6aba3ca1392c0126a}{checkSection}}(token,\textcolor{charliteral}{'['},\textcolor{charliteral}{']'},\&\mbox{\hyperlink{structconfigEntry_ad610b2d30e2432b3cb5f0d0e397f2043}{sectionName}}))==\mbox{\hyperlink{config_8h_a02f5a0519bc0372946e64d593c0c58ce}{FOUND\_SECTION}})} \DoxyCodeLine{\Hypertarget{config_8c_source_l00256}00256\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \{} \DoxyCodeLine{\Hypertarget{config_8c_source_l00257}00257\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ state\ =\ \mbox{\hyperlink{config_8h_a50f0255611b79622dbca5cf9c27b7f43}{ST\_FOUND\_SECTION}};} \DoxyCodeLine{\Hypertarget{config_8c_source_l00258}00258\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ printf(\textcolor{stringliteral}{"{}FOUND\_SECTION:\%s\(\backslash\)n"{}},\mbox{\hyperlink{structconfigEntry_ad610b2d30e2432b3cb5f0d0e397f2043}{sectionName}});} \DoxyCodeLine{\Hypertarget{config_8c_source_l00259}00259\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}} \DoxyCodeLine{\Hypertarget{config_8c_source_l00260}00260\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{break};} \DoxyCodeLine{\Hypertarget{config_8c_source_l00261}00261\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{case}\ \mbox{\hyperlink{config_8h_a50f0255611b79622dbca5cf9c27b7f43}{ST\_FOUND\_SECTION}}:} \DoxyCodeLine{\Hypertarget{config_8c_source_l00262}00262\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{structconfigEntry_a6b96fdfa727658a18ab5a03d5e5a4572}{keyName}}\ =\ malloc(\mbox{\hyperlink{config_8h_aa454692b60895f7025f12b1e0065acea}{MAX\_LEN\_SECTIONNAME}});} \DoxyCodeLine{\Hypertarget{config_8c_source_l00263}00263\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{structconfigEntry_a221f7ca4b687e6cfce063e332330d635}{keyValue}}\ =\ malloc(\mbox{\hyperlink{config_8h_aa454692b60895f7025f12b1e0065acea}{MAX\_LEN\_SECTIONNAME}});} \DoxyCodeLine{\Hypertarget{config_8c_source_l00264}00264\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(\mbox{\hyperlink{structconfigEntry_a6b96fdfa727658a18ab5a03d5e5a4572}{keyName}}\ ==\ NULL\ ||\ \mbox{\hyperlink{structconfigEntry_a221f7ca4b687e6cfce063e332330d635}{keyValue}}\ ==\ NULL)} \DoxyCodeLine{\Hypertarget{config_8c_source_l00265}00265\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \{} \DoxyCodeLine{\Hypertarget{config_8c_source_l00266}00266\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ error\ =\ errno;} \DoxyCodeLine{\Hypertarget{config_8c_source_l00267}00267\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ printf(\textcolor{stringliteral}{"{}MALLOC:\%d\(\backslash\)n"{}},error);} \DoxyCodeLine{\Hypertarget{config_8c_source_l00268}00268\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ error;} \DoxyCodeLine{\Hypertarget{config_8c_source_l00269}00269\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}} \DoxyCodeLine{\Hypertarget{config_8c_source_l00270}00270\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ memset(\mbox{\hyperlink{structconfigEntry_a6b96fdfa727658a18ab5a03d5e5a4572}{keyName}},0,\mbox{\hyperlink{config_8h_aa454692b60895f7025f12b1e0065acea}{MAX\_LEN\_SECTIONNAME}});} \DoxyCodeLine{\Hypertarget{config_8c_source_l00271}00271\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ memset(\mbox{\hyperlink{structconfigEntry_a221f7ca4b687e6cfce063e332330d635}{keyValue}},0,\mbox{\hyperlink{config_8h_aa454692b60895f7025f12b1e0065acea}{MAX\_LEN\_SECTIONNAME}});} \DoxyCodeLine{\Hypertarget{config_8c_source_l00272}00272\ } \DoxyCodeLine{\Hypertarget{config_8c_source_l00273}00273\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ret=\mbox{\hyperlink{config_8c_ab0b547ee554d9b305adc1b2ad85080a3}{getNameValuePair}}(token,\textcolor{charliteral}{'='},0,\&\mbox{\hyperlink{structconfigEntry_a6b96fdfa727658a18ab5a03d5e5a4572}{keyName}},\&\mbox{\hyperlink{structconfigEntry_a221f7ca4b687e6cfce063e332330d635}{keyValue}},\mbox{\hyperlink{config_8h_aa454692b60895f7025f12b1e0065acea}{MAX\_LEN\_SECTIONNAME}},\mbox{\hyperlink{config_8h_aa454692b60895f7025f12b1e0065acea}{MAX\_LEN\_SECTIONNAME}});} \DoxyCodeLine{\Hypertarget{config_8c_source_l00274}00274\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(ret==\mbox{\hyperlink{config_8h_a258bb72419ef143530a2f8f55e7d57af}{NO\_ERROR}})\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ } \DoxyCodeLine{\Hypertarget{config_8c_source_l00275}00275\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \{} \DoxyCodeLine{\Hypertarget{config_8c_source_l00276}00276\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ printf(\textcolor{stringliteral}{"{}configSizeCount:\ \%d,\ i:\%d\(\backslash\)n"{}},configSizeCount,i);} \DoxyCodeLine{\Hypertarget{config_8c_source_l00277}00277\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(i