xref: /dragonfly/contrib/dialog/help.c (revision ec1c3f3a)
1 /*
2  *  $Id: help.c,v 1.4 2022/04/03 22:38:16 tom Exp $
3  *
4  *  help.c -- implements the help dialog
5  *
6  *  Copyright 2011-2012,2022	Thomas E. Dickey
7  *
8  *  This program is free software; you can redistribute it and/or modify
9  *  it under the terms of the GNU Lesser General Public License, version 2.1
10  *  as published by the Free Software Foundation.
11  *
12  *  This program is distributed in the hope that it will be useful, but
13  *  WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  *  Lesser General Public License for more details.
16  *
17  *  You should have received a copy of the GNU Lesser General Public
18  *  License along with this program; if not, write to
19  *	Free Software Foundation, Inc.
20  *	51 Franklin St., Fifth Floor
21  *	Boston, MA 02110, USA.
22  */
23 
24 #include <dlg_internals.h>
25 
26 /*
27  * Display a help-file as a textbox widget.
28  */
29 int
30 dialog_helpfile(const char *title,
31 		const char *file,
32 		int height,
33 		int width)
34 {
35     int result = DLG_EXIT_ERROR;
36     DIALOG_VARS save;
37 
38     if (!dialog_vars.in_helpfile && file != 0 && *file != '\0') {
39 	dlg_save_vars(&save);
40 
41 	dialog_vars.no_label = NULL;
42 	dialog_vars.ok_label = NULL;
43 	dialog_vars.help_button = FALSE;
44 	dialog_vars.extra_button = FALSE;
45 	dialog_vars.nook = FALSE;
46 
47 	dialog_vars.in_helpfile = TRUE;
48 
49 	result = dialog_textbox(title, file, height, width);
50 
51 	dlg_restore_vars(&save);
52     }
53     return (result);
54 }
55