xref: /dflybsd-src/contrib/dialog/help.c (revision b2dabe2e739bd72461a68ac543307c2dedfb048c)
15382d832SPeter Avalos /*
2*a8e38dc0SAntonio Huete Jimenez  *  $Id: help.c,v 1.4 2022/04/03 22:38:16 tom Exp $
35382d832SPeter Avalos  *
45382d832SPeter Avalos  *  help.c -- implements the help dialog
55382d832SPeter Avalos  *
6*a8e38dc0SAntonio Huete Jimenez  *  Copyright 2011-2012,2022	Thomas E. Dickey
75382d832SPeter Avalos  *
85382d832SPeter Avalos  *  This program is free software; you can redistribute it and/or modify
95382d832SPeter Avalos  *  it under the terms of the GNU Lesser General Public License, version 2.1
105382d832SPeter Avalos  *  as published by the Free Software Foundation.
115382d832SPeter Avalos  *
125382d832SPeter Avalos  *  This program is distributed in the hope that it will be useful, but
135382d832SPeter Avalos  *  WITHOUT ANY WARRANTY; without even the implied warranty of
145382d832SPeter Avalos  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
155382d832SPeter Avalos  *  Lesser General Public License for more details.
165382d832SPeter Avalos  *
175382d832SPeter Avalos  *  You should have received a copy of the GNU Lesser General Public
185382d832SPeter Avalos  *  License along with this program; if not, write to
195382d832SPeter Avalos  *	Free Software Foundation, Inc.
205382d832SPeter Avalos  *	51 Franklin St., Fifth Floor
215382d832SPeter Avalos  *	Boston, MA 02110, USA.
225382d832SPeter Avalos  */
235382d832SPeter Avalos 
24*a8e38dc0SAntonio Huete Jimenez #include <dlg_internals.h>
255382d832SPeter Avalos 
265382d832SPeter Avalos /*
275382d832SPeter Avalos  * Display a help-file as a textbox widget.
285382d832SPeter Avalos  */
295382d832SPeter Avalos int
dialog_helpfile(const char * title,const char * file,int height,int width)305382d832SPeter Avalos dialog_helpfile(const char *title,
315382d832SPeter Avalos 		const char *file,
325382d832SPeter Avalos 		int height,
335382d832SPeter Avalos 		int width)
345382d832SPeter Avalos {
355382d832SPeter Avalos     int result = DLG_EXIT_ERROR;
365382d832SPeter Avalos     DIALOG_VARS save;
375382d832SPeter Avalos 
385382d832SPeter Avalos     if (!dialog_vars.in_helpfile && file != 0 && *file != '\0') {
395382d832SPeter Avalos 	dlg_save_vars(&save);
405382d832SPeter Avalos 
415382d832SPeter Avalos 	dialog_vars.no_label = NULL;
425382d832SPeter Avalos 	dialog_vars.ok_label = NULL;
435382d832SPeter Avalos 	dialog_vars.help_button = FALSE;
445382d832SPeter Avalos 	dialog_vars.extra_button = FALSE;
455382d832SPeter Avalos 	dialog_vars.nook = FALSE;
465382d832SPeter Avalos 
475382d832SPeter Avalos 	dialog_vars.in_helpfile = TRUE;
485382d832SPeter Avalos 
495382d832SPeter Avalos 	result = dialog_textbox(title, file, height, width);
505382d832SPeter Avalos 
515382d832SPeter Avalos 	dlg_restore_vars(&save);
525382d832SPeter Avalos     }
535382d832SPeter Avalos     return (result);
545382d832SPeter Avalos }
55