1 | /********************************************************************************** |
---|---|
2 | * iniPropertySeek |
3 | * |
4 | * |
5 | ************************************************** |
6 | * This code was created by Peter Harvey @ CodeByDesign. |
7 | * Released under LGPL 28.JAN.99 |
8 | * |
9 | * Contributions from... |
10 | * ----------------------------------------------- |
11 | * Peter Harvey - pharvey@codebydesign.com |
12 | **************************************************/ |
13 | |
14 | #include <config.h> |
15 | #include "ini.h" |
16 | |
17 | int iniPropertySeek( HINI hIni, char *pszObject, char *pszProperty, char *pszValue ) |
18 | { |
19 | /* SANITY CHECKS */ |
20 | if ( hIni == NULL ) |
21 | return INI_ERROR; |
22 | |
23 | /* Ok */ |
24 | iniObjectFirst( hIni ); |
25 | while ( iniObjectEOL( hIni ) != TRUE ) |
26 | { |
27 | if ( pszObject[0] == '\0' || strcasecmp( pszObject, hIni->hCurObject->szName ) == 0 ) |
28 | { |
29 | /* EITHER THE OBJECT HAS BEEN FOUND OR THE OBJECT DOES NOT MATTER */ |
30 | /* IN ANYCASE LETS SCAN FOR PROPERTY */ |
31 | iniPropertyFirst( hIni ); |
32 | while ( iniPropertyEOL( hIni ) != TRUE ) |
33 | { |
34 | if ( pszProperty[0] == '\0' || strcasecmp( pszProperty, hIni->hCurProperty->szName ) == 0 ) |
35 | { |
36 | if ( pszValue[0] == '\0' || strcasecmp( pszValue, hIni->hCurProperty->szValue ) == 0 ) |
37 | { |
38 | /* FOUND IT !! */ |
39 | return INI_SUCCESS; |
40 | } |
41 | } |
42 | iniPropertyNext( hIni ); |
43 | } |
44 | if ( pszObject[0] != '\0' ) |
45 | { |
46 | hIni->hCurObject = NULL; |
47 | return INI_NO_DATA; |
48 | } |
49 | } |
50 | iniObjectNext( hIni ); |
51 | } |
52 | |
53 | return INI_NO_DATA; |
54 | } |
55 | |
56 | |
57 |