2 * Copyright 1996 Ulrich Schmid
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
33 const char *first_paragraph;
35 const char *next_paragraph;
36 const char *special_char;
37 const char *begin_italic;
38 const char *end_italic;
39 const char *begin_boldface;
40 const char *end_boldface;
41 const char *begin_typewriter;
42 const char *end_typewriter;
55 "<!doctype linuxdoc system>\n"
79 CHARMAP_ENTRY charmap[] =
177 /***********************************************************************
182 static void print_text(const char *p)
188 for (i = 0; charmap[i].ch; i++)
189 if (*p == charmap[i].ch)
191 printf(format.special_char, charmap[i].subst);
199 /***********************************************************************
204 int main(int argc, char **argv)
208 HLPFILE_PARAGRAPH *paragraph;
213 hlpfile = HLPFILE_ReadHlpFile(argc > 1 ? argv[1] : "");
215 if (!hlpfile) return 2;
218 strftime(date, sizeof(date), "%x", localtime(&t));
219 filename = strrchr(hlpfile->lpszPath, '/');
220 if (filename) filename++;
221 else filename = hlpfile->lpszPath;
224 printf(format.header1);
225 print_text(hlpfile->lpszTitle);
226 printf(format.header2, filename, date);
228 for (page = hlpfile->first_page; page; page = page->next)
230 paragraph = page->first_paragraph;
231 if (!paragraph) continue;
234 printf(format.section);
235 for (; paragraph && !paragraph->u.text.wVSpace; paragraph = paragraph->next)
236 print_text(paragraph->u.text.lpszText);
237 printf(format.first_paragraph);
239 for (; paragraph; paragraph = paragraph->next)
241 switch (paragraph->cookie)
243 case para_normal_text:
244 case para_debug_text:
245 /* New line; new paragraph */
246 if (paragraph->u.text.wVSpace == 1)
247 printf(format.newline);
248 else if (paragraph->u.text.wVSpace > 1)
249 printf(format.next_paragraph);
251 if (paragraph->u.text.wFont)
252 printf(format.begin_boldface);
254 print_text(paragraph->u.text.lpszText);
256 if (paragraph->u.text.wFont)
257 printf(format.end_boldface);
271 /***********************************************************************
273 * Substitutions for some WINELIB functions
276 static FILE *file = 0;
278 HFILE WINAPI OpenFile( LPCSTR path, OFSTRUCT *ofs, UINT mode )
280 file = *path ? fopen(path, "r") : stdin;
281 return file ? (HFILE)1 : HFILE_ERROR;
284 HFILE WINAPI _lclose( HFILE hFile )
290 LONG WINAPI _hread( HFILE hFile, LPVOID buffer, LONG count )
292 return fread(buffer, 1, count, file);
295 HANDLE WINAPI GetProcessHeap(void)
300 void* WINAPI HeapAlloc( HANDLE heap, DWORD flags, SIZE_T size )
306 void* WINAPI HeapReAlloc( HANDLE heap, DWORD flags, void* ptr, SIZE_T size)
309 return realloc(ptr, size);
312 BOOL WINAPI HeapFree( HGLOBAL handle, DWORD flags, void* ptr )
318 char __wine_dbch_winhelp[] = "\003winhelp";
320 int wine_dbg_log( int cls, const char *channel, const char *func, const char *format, ... )
325 const char *wine_dbgstr_a( const char *s )
330 HBITMAP WINAPI CreateDIBitmap(HDC hdc, CONST BITMAPINFOHEADER* bih, DWORD a, CONST void* ptr, CONST BITMAPINFO* bi, UINT c)
335 HMETAFILE WINAPI SetMetaFileBitsEx(UINT cbBuffer, CONST BYTE *lpbBuffer)
340 BOOL WINAPI DeleteMetaFile(HMETAFILE h)
345 HDC WINAPI GetDC(HWND h)
350 int WINAPI ReleaseDC(HWND h, HDC hdc)
355 BOOL WINAPI DeleteObject(HGDIOBJ h)
362 * Copyright 1993 Yngvi Sigurjonsson (yngvi@hafro.is)
365 INT WINAPI lstrcmp( LPCSTR str1, LPCSTR str2 )
367 return strcmp( str1, str2 );
370 INT WINAPI lstrcmpi( LPCSTR str1, LPCSTR str2 )
376 if ((res = toupper(*str1) - toupper(*str2)) != 0) return res;
380 return toupper(*str1) - toupper(*str2);
383 INT WINAPI lstrlen( LPCSTR str )
388 LPSTR WINAPI lstrcpyA( LPSTR dst, LPCSTR src )
390 if (!src || !dst) return NULL;
395 LPSTR WINAPI lstrcpynA( LPSTR dst, LPCSTR src, INT n )
401 while ((count > 1) && *s)