xref: /freebsd/contrib/dialog/help.c (revision d1d015864103b253b3fcb2f72a0da5b0cfeb31b6)
1682c9e0fSNathan Whitehorn /*
2*2a3e3873SBaptiste Daroussin  *  $Id: help.c,v 1.3 2012/12/04 02:01:10 tom Exp $
3682c9e0fSNathan Whitehorn  *
4682c9e0fSNathan Whitehorn  *  help.c -- implements the help dialog
5682c9e0fSNathan Whitehorn  *
6*2a3e3873SBaptiste Daroussin  *  Copyright 2011,2012	Thomas E. Dickey
7682c9e0fSNathan Whitehorn  *
8682c9e0fSNathan Whitehorn  *  This program is free software; you can redistribute it and/or modify
9682c9e0fSNathan Whitehorn  *  it under the terms of the GNU Lesser General Public License, version 2.1
10682c9e0fSNathan Whitehorn  *  as published by the Free Software Foundation.
11682c9e0fSNathan Whitehorn  *
12682c9e0fSNathan Whitehorn  *  This program is distributed in the hope that it will be useful, but
13682c9e0fSNathan Whitehorn  *  WITHOUT ANY WARRANTY; without even the implied warranty of
14682c9e0fSNathan Whitehorn  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15682c9e0fSNathan Whitehorn  *  Lesser General Public License for more details.
16682c9e0fSNathan Whitehorn  *
17682c9e0fSNathan Whitehorn  *  You should have received a copy of the GNU Lesser General Public
18682c9e0fSNathan Whitehorn  *  License along with this program; if not, write to
19682c9e0fSNathan Whitehorn  *	Free Software Foundation, Inc.
20682c9e0fSNathan Whitehorn  *	51 Franklin St., Fifth Floor
21682c9e0fSNathan Whitehorn  *	Boston, MA 02110, USA.
22682c9e0fSNathan Whitehorn  */
23682c9e0fSNathan Whitehorn 
24682c9e0fSNathan Whitehorn #include <dialog.h>
25682c9e0fSNathan Whitehorn 
26682c9e0fSNathan Whitehorn /*
27682c9e0fSNathan Whitehorn  * Display a help-file as a textbox widget.
28682c9e0fSNathan Whitehorn  */
29682c9e0fSNathan Whitehorn int
dialog_helpfile(const char * title,const char * file,int height,int width)30682c9e0fSNathan Whitehorn dialog_helpfile(const char *title,
31682c9e0fSNathan Whitehorn 		const char *file,
32682c9e0fSNathan Whitehorn 		int height,
33682c9e0fSNathan Whitehorn 		int width)
34682c9e0fSNathan Whitehorn {
35682c9e0fSNathan Whitehorn     int result = DLG_EXIT_ERROR;
36*2a3e3873SBaptiste Daroussin     DIALOG_VARS save;
37682c9e0fSNathan Whitehorn 
38682c9e0fSNathan Whitehorn     if (!dialog_vars.in_helpfile && file != 0 && *file != '\0') {
39*2a3e3873SBaptiste Daroussin 	dlg_save_vars(&save);
40*2a3e3873SBaptiste Daroussin 
41*2a3e3873SBaptiste Daroussin 	dialog_vars.no_label = NULL;
42*2a3e3873SBaptiste Daroussin 	dialog_vars.ok_label = NULL;
43*2a3e3873SBaptiste Daroussin 	dialog_vars.help_button = FALSE;
44*2a3e3873SBaptiste Daroussin 	dialog_vars.extra_button = FALSE;
45*2a3e3873SBaptiste Daroussin 	dialog_vars.nook = FALSE;
46*2a3e3873SBaptiste Daroussin 
47682c9e0fSNathan Whitehorn 	dialog_vars.in_helpfile = TRUE;
48*2a3e3873SBaptiste Daroussin 
49682c9e0fSNathan Whitehorn 	result = dialog_textbox(title, file, height, width);
50*2a3e3873SBaptiste Daroussin 
51*2a3e3873SBaptiste Daroussin 	dlg_restore_vars(&save);
52682c9e0fSNathan Whitehorn     }
53682c9e0fSNathan Whitehorn     return (result);
54682c9e0fSNathan Whitehorn }
55