1/**********************************************************************************
2 * _iniDump
3 *
4 * Dump contents to hStream.
5 *
6 * - iniCommit calls this. You can bypass iniCommit restrictions to get some debugging information by calling directly.
7 * - Make sure the stream is open before calling.
8 * - leaves list position at iniObjectFirst()
9 * - always returns true
10 *
11 **************************************************
12 * This code was created by Peter Harvey @ CodeByDesign.
13 * Released under LGPL 28.JAN.99
14 *
15 * Contributions from...
16 * -----------------------------------------------
17 * Peter Harvey - pharvey@codebydesign.com
18 **************************************************/
19
20#include <config.h>
21#include "ini.h"
22
23int __iniDebug( HINI hIni )
24{
25 /* SANITY CHECK */
26 if ( hIni == NULL )
27 return INI_ERROR;
28
29 /* SCAN OBJECTS */
30 iniObjectFirst( hIni );
31 while ( iniObjectEOL( hIni ) == FALSE )
32 {
33 printf( "%c%s%c\n", hIni->cLeftBracket, hIni->hCurObject->szName, hIni->cRightBracket );
34
35 iniPropertyFirst( hIni );
36 while ( iniPropertyEOL( hIni ) == FALSE )
37 {
38 printf( "%s%c%s\n", hIni->hCurProperty->szName, hIni->cEqual, hIni->hCurProperty->szValue );
39 iniPropertyNext( hIni );
40 }
41 printf( "\n" );
42 iniPropertyFirst( hIni );
43 iniObjectNext( hIni );
44 }
45 iniObjectFirst( hIni );
46
47 return INI_SUCCESS;
48}
49
50int _iniDump( HINI hIni, FILE *hStream )
51{
52 /* SANITY CHECK */
53 if ( hIni == NULL )
54 return INI_ERROR;
55
56 if ( !hStream )
57 return INI_ERROR;
58
59 /* SCAN OBJECTS */
60 iniObjectFirst( hIni );
61 while ( iniObjectEOL( hIni ) == FALSE )
62 {
63#ifdef __OS2__
64 if ( hIni->iniFileType == 0 )
65#endif
66 uo_fprintf( hStream, "%c%s%c\n", hIni->cLeftBracket, hIni->hCurObject->szName, hIni->cRightBracket );
67 iniPropertyFirst( hIni );
68 while ( iniPropertyEOL( hIni ) == FALSE )
69 {
70#ifdef __OS2__
71 if ( hIni->iniFileType == 0 )
72 {
73#endif
74 uo_fprintf( hStream, "%s%c%s\n", hIni->hCurProperty->szName, hIni->cEqual, hIni->hCurProperty->szValue );
75#ifdef __OS2__
76 }
77 else
78 {
79 iniOS2Write( hStream, hIni->hCurObject->szName, hIni->hCurProperty->szName, hIni->hCurProperty->szValue);
80 }
81#endif
82 iniPropertyNext( hIni );
83 }
84#ifdef __OS2__
85 if ( hIni->iniFileType == 0 )
86#endif
87 uo_fprintf( hStream, "\n" );
88
89 iniPropertyFirst( hIni );
90 iniObjectNext( hIni );
91 }
92 iniObjectFirst( hIni );
93
94 return INI_SUCCESS;
95}
96
97
98