| 1 | /********************************************************************************** |
| 2 | * _iniObjectRead |
| 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 _iniObjectRead( HINI hIni, char *szLine, char *pszObjectName ) |
| 18 | { |
| 19 | int nChar; |
| 20 | |
| 21 | /* SANITY CHECK */ |
| 22 | if ( hIni == NULL ) |
| 23 | return INI_ERROR; |
| 24 | |
| 25 | /* SCAN LINE TO EXTRACT OBJECT NAME WITH NO BRACKETS */ |
| 26 | nChar = 1; |
| 27 | while ( 1 ) |
| 28 | { |
| 29 | if ( (szLine[nChar] == '\0') || (nChar == INI_MAX_OBJECT_NAME) ) |
| 30 | { |
| 31 | pszObjectName[nChar-1] = '\0'; |
| 32 | break; |
| 33 | } |
| 34 | |
| 35 | if ( szLine[nChar] == hIni->cRightBracket ) |
| 36 | { |
| 37 | pszObjectName[nChar-1] = '\0'; |
| 38 | break; |
| 39 | } |
| 40 | pszObjectName[nChar-1] = szLine[nChar]; |
| 41 | nChar++; |
| 42 | } |
| 43 | iniAllTrim( pszObjectName ); |
| 44 | |
| 45 | return INI_SUCCESS; |
| 46 | } |
| 47 | |
| 48 | |
| 49 | |