1 | /********************************************************************************** |
2 | * _iniScanUntilObject |
3 | * |
4 | ************************************************** |
5 | * This code was created by Peter Harvey @ CodeByDesign. |
6 | * Released under LGPL 28.JAN.99 |
7 | * |
8 | * Contributions from... |
9 | * ----------------------------------------------- |
10 | * Peter Harvey - pharvey@codebydesign.com |
11 | **************************************************/ |
12 | |
13 | #include <config.h> |
14 | #include "ini.h" |
15 | |
16 | int _iniScanUntilObject( HINI hIni, FILE *hFile, char *pszLine ) |
17 | { |
18 | /* SCAN UNTIL WE GET TO AN OBJECT NAME OR EOF */ |
19 | pszLine[0] = '\0'; |
20 | while ( 1 ) |
21 | { |
22 | if ( uo_fgets( pszLine, INI_MAX_LINE, hFile ) == NULL ) |
23 | { |
24 | return INI_NO_DATA; |
25 | } |
26 | /* |
27 | printf( "[PAH][%s][%d] Line=[%s]\n", __FILE__, __LINE__, pszLine ); |
28 | */ |
29 | if ( pszLine[0] == hIni->cLeftBracket ) |
30 | { |
31 | return INI_SUCCESS; |
32 | } |
33 | iniAllTrim( pszLine ); |
34 | if ( pszLine[0] == '\0' ) |
35 | { |
36 | continue; |
37 | } |
38 | if ( strchr( hIni->cComment, pszLine[0] ) == NULL ) |
39 | { |
40 | return INI_ERROR; |
41 | } |
42 | } |
43 | |
44 | return INI_SUCCESS; |
45 | } |
46 | |
47 | int _iniScanUntilNextObject( HINI hIni, FILE *hFile, char *pszLine ) |
48 | { |
49 | /* SCAN UNTIL WE GET TO AN OBJECT NAME OR EOF, SKIPPING BODY */ |
50 | pszLine[0] = '\0'; |
51 | while ( 1 ) |
52 | { |
53 | if ( uo_fgets( pszLine, INI_MAX_LINE, hFile ) == NULL ) |
54 | { |
55 | return INI_NO_DATA; |
56 | } |
57 | |
58 | if ( pszLine[0] == hIni->cLeftBracket ) |
59 | { |
60 | return INI_SUCCESS; |
61 | } |
62 | } |
63 | |
64 | return INI_SUCCESS; |
65 | } |
66 | |
67 | |
68 | |
69 | |