2121
2222'' fbdoc headers
2323#include once "CWikiConUrl.bi"
24+ #include once "CWikiConDir.bi"
2425
2526'' fbchkdoc headers
2627#include once "fbchkdoc.bi"
3435using fb
3536using fbdoc
3637
37- #include "crt/stdlib.bi"
38- #include "crt/string.bi"
3938
4039const def_index_file = hardcoded.default_index_file
4140
42- '' --------------------------------------------------------
43-
44- #ifdef __FB_LINUX__
45- extern "c"
46- declare function strcasecmp( byval as const zstring ptr, byval as const zstring ptr) as long
47- end extern
48- #define _stricmp strcasecmp
49- # endif
50-
51- ''
52- function cmpPageName cdecl ( byval x as any ptr, byval y as any ptr ) as long
53- function = _stricmp( *cast(zstring ptr ptr,x), *cast(zstring ptr ptr,y) )
54- end function
55-
56- ''
57- sub ScanCacheDir _
58- ( _
59- byref p as string _
60- )
61-
62- dim as string d, pages( 1 to 2000 )
63- dim as integer i, h, n = 0
64- dim as zstring ptr zpage( 1 to 2000 )
65-
66- d = dir( p & "*.wakka" )
67- while ( d > "" )
68- i = instrrev( d, "." )
69- if ( i > 0 ) then
70- d = left( d, i- 1 )
71- if ( len(d) > 0 ) then
72- n += 1
73- pages(n) = d
74- zpage(n) = strptr(pages(n))
75- end if
76- end if
77- d = dir( )
78- wend
79-
80- '' Sort
81- qsort( @zpage( 1 ), n, sizeof(zstring ptr), procptr(cmpPageName) )
82-
83- h = freefile
84- open def_index_file for output as #h
85- for i = 1 to n
86- print #h, *zpage(i)
87- next
88- close #h
89-
90- end sub
91-
9241'' --------------------------------------------------------
9342'' MAIN
9443'' --------------------------------------------------------
@@ -150,9 +99,19 @@ dim sBody as string
15099
151100sPage = "PageIndex"
152101
102+ dim as CWikiCon ptr wikicon = NULL
103+
104+ '' connect to the wiki and get PageIndex as HTML
105+
153106if ( blocal ) then
154107
155- ScanCacheDir( app_opt.cache_dir )
108+ wikicon = new CWikiConDir( app_opt.cache_dir )
109+ if wikicon = NULL then
110+ print "Unable to create connection " + app_opt.cache_dir
111+ end 1
112+ end if
113+
114+ print "cache: " ; app_opt.cache_dir
156115
157116else
158117
@@ -161,41 +120,36 @@ else
161120 end 1
162121 end if
163122
164- '' connect to the wiki and get PageIndex as HTML
165- scope
166- dim as CWikiConUrl ptr wikicon = NULL
167-
168- wikicon = new CWikiConUrl( app_opt.wiki_url, app_opt.ca_file )
169- if wikicon = NULL then
170- print "Unable to create connection " + app_opt.wiki_url
171- end 1
172- end if
173-
174- print "URL: " ; app_opt.wiki_url
123+ print "URL: " ; app_opt.wiki_url
175124
176- if ( app_opt.ca_file > "" ) then
177- print "Certificate: " ; app_opt.ca_file
178- else
179- print "Certificate: none"
180- end if
125+ wikicon = new CWikiConUrl ( app_opt.wiki_url, app_opt. ca_file )
126+ if wikicon = NULL then
127+ print "Unable to create connection " + app_opt.wiki_url
128+ end 1
129+ end if
181130
182- print "Loading '" + sPage + "': " ;
183- if ( wikicon->LoadIndex( sPage, sBody ) = FALSE ) then
184- print "Error"
185- else
186- print "OK"
187- print "Writing '" & def_index_file & "'"
131+ if ( app_opt.ca_file > "" ) then
132+ print "Certificate: " ; app_opt.ca_file
133+ else
134+ print "Certificate: none"
135+ end if
188136
189- dim as integer h = freefile
190- open def_index_file for output as #h
191- print #h, sBody ;
192- close #h
137+ end if
193138
194- end if
139+ print "Loading '" + sPage + "': " ;
140+ if ( wikicon->LoadIndex( sPage, sBody ) = FALSE ) then
141+ print "Error"
142+ else
143+ print "OK"
144+ print "Writing '" & def_index_file & "'"
195145
196- delete wikicon
197- end scope
146+ dim as integer h = freefile
147+ open def_index_file for output as #h
148+ print #h, sBody ;
149+ close #h
198150
199151end if
200152
153+ delete wikicon
154+
201155print "Done."
0 commit comments