1 /*- 2 * Copyright (c) 2013-2014 Devin Teske <dteske@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 * $FreeBSD$ 27 */ 28 29 #ifndef _DIALOG_UTIL_H_ 30 #define _DIALOG_UTIL_H_ 31 32 #include <sys/types.h> 33 34 #include "dialogrc.h" 35 36 #define DIALOG_SPAWN_DEBUG 0 /* Debug spawning of [X]dialog(1) */ 37 38 /* dialog(3) and [X]dialog(1) characteristics */ 39 #define DIALOG "dialog" 40 #define XDIALOG "Xdialog" 41 #define PROMPT_MAX 16384 42 #define ENV_DIALOG "DIALOG" 43 #define ENV_USE_COLOR "USE_COLOR" 44 #define ENV_XDIALOG_HIGH_DIALOG_COMPAT "XDIALOG_HIGH_DIALOG_COMPAT" 45 extern uint8_t dialog_test; 46 extern uint8_t use_libdialog; 47 extern uint8_t use_dialog; 48 extern uint8_t use_xdialog; 49 extern uint8_t use_color; 50 extern char dialog[]; 51 52 /* dialog(3) and [X]dialog(1) functionality */ 53 extern char *title, *backtitle; 54 extern int dheight, dwidth; 55 56 __BEGIN_DECLS 57 uint8_t dialog_prompt_nlstate(const char *_prompt); 58 void dialog_gauge_free(void); 59 void dialog_maxsize_free(void); 60 char *dialog_prompt_lastline(char *_prompt, uint8_t _nlstate); 61 int dialog_maxcols(void); 62 int dialog_maxrows(void); 63 int dialog_prompt_wrappedlines(char *_prompt, int _ncols, 64 uint8_t _nlstate); 65 int dialog_spawn_gauge(char *_init_prompt, pid_t *_pid); 66 int tty_maxcols(void); 67 #define tty_maxrows() dialog_maxrows() 68 unsigned int dialog_prompt_longestline(const char *_prompt, 69 uint8_t _nlstate); 70 unsigned int dialog_prompt_numlines(const char *_prompt, uint8_t _nlstate); 71 __END_DECLS 72 73 #endif /* !_DIALOG_UTIL_H_ */ 74