| 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 | * PAH 06.MAR.99 Added this func |
| 15 | **************************************************/ |
| 16 | |
| 17 | #include <config.h> |
| 18 | #include "ini.h" |
| 19 | |
| 20 | int iniPropertySeekSure( HINI hIni, char *pszObject, char *pszProperty, char *pszValue ) |
| 21 | { |
| 22 | int nReturn; |
| 23 | |
| 24 | /* SANITY CHECKS */ |
| 25 | if ( hIni == NULL ) |
| 26 | return INI_ERROR; |
| 27 | if ( !pszObject ) |
| 28 | return INI_ERROR; |
| 29 | if ( !pszProperty ) |
| 30 | return INI_ERROR; |
| 31 | if ( !pszValue ) |
| 32 | return INI_ERROR; |
| 33 | |
| 34 | /* OK */ |
| 35 | if ( (nReturn = iniPropertySeek( hIni, pszObject, pszProperty, "" )) == INI_NO_DATA ) |
| 36 | { |
| 37 | iniObjectSeekSure( hIni, pszObject ); |
| 38 | return iniPropertyInsert( hIni, pszProperty, pszValue ); |
| 39 | } |
| 40 | else if ( nReturn == INI_SUCCESS ) |
| 41 | return iniValue( hIni, pszValue ); |
| 42 | |
| 43 | return nReturn; |
| 44 | } |
| 45 | |
| 46 | |
| 47 | |