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