File: _iniObjectRead.c

package info (click to toggle)
unixodbc 2.3.14-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,888 kB
  • sloc: ansic: 87,605; makefile: 1,127; sh: 1,060; yacc: 974; sql: 1
file content (48 lines) | stat: -rw-r--r-- 1,146 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/**********************************************************************************
 * _iniObjectRead
 *
 *
 **************************************************
 * This code was created by Peter Harvey @ CodeByDesign.
 * Released under LGPL 28.JAN.99
 *
 * Contributions from...
 * -----------------------------------------------
 * Peter Harvey		- pharvey@codebydesign.com
 **************************************************/

#include <config.h>
#include "ini.h"

int _iniObjectRead( HINI hIni, char *szLine, char *pszObjectName )
{
    int     	nChar;

    /* SANITY CHECK */
    if ( hIni == NULL )
        return INI_ERROR;

    /* SCAN LINE TO EXTRACT OBJECT NAME WITH NO BRACKETS	*/
    nChar = 1;
    while ( 1 )
    {
        if ( (szLine[nChar] == '\0') || (nChar == INI_MAX_OBJECT_NAME) )
        {
            pszObjectName[nChar-1] = '\0';
            break;
        }

        if ( szLine[nChar] == hIni->cRightBracket )
        {
            pszObjectName[nChar-1] = '\0';
            break;
        }
        pszObjectName[nChar-1] = szLine[nChar];
        nChar++;
    }
	iniAllTrim( pszObjectName );

    return INI_SUCCESS;
}