1/**********************************************************************************
2 * iniElementCount
3 *
4 **************************************************
5 * This code was created by Peter Harvey @ CodeByDesign.
6 * Released under LGPL 05.APR.99
7 *
8 * Contributions from...
9 * -----------------------------------------------
10 * Peter Harvey - pharvey@codebydesign.com
11 **************************************************/
12
13#include <config.h>
14#include "ini.h"
15
16int iniElementCount( char *pszData, char cSeperator, char cTerminator )
17{
18 int nToManyElements = 30000;
19 int nCurElement = 0;
20 int nChar = 0;
21
22 for ( ; nCurElement <= nToManyElements; nChar++ )
23 {
24 /* check for end of data */
25 if ( cSeperator != cTerminator && pszData[nChar] == cTerminator )
26 break;
27
28 if ( cSeperator == cTerminator && pszData[nChar] == cSeperator && pszData[nChar+1] == cTerminator )
29 break;
30
31 /* check for end of element */
32 if ( pszData[nChar] == cSeperator )
33 nCurElement++;
34 }
35
36 return nCurElement;
37}
38
39