dialog_util.h revision 285830
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: releng/10.2/lib/libdpv/dialog_util.h 274116 2014-11-04 23:46:01Z dteske $ 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" 45extern uint8_t dialog_test; 46extern uint8_t use_libdialog; 47extern uint8_t use_dialog; 48extern uint8_t use_xdialog; 49extern uint8_t use_color; 50extern char dialog[]; 51 52/* dialog(3) and [X]dialog(1) functionality */ 53extern char *title, *backtitle; 54extern int dheight, dwidth; 55 56__BEGIN_DECLS 57uint8_t dialog_prompt_nlstate(const char *_prompt); 58void dialog_gauge_free(void); 59void dialog_maxsize_free(void); 60char *dialog_prompt_lastline(char *_prompt, uint8_t _nlstate); 61int dialog_maxcols(void); 62int dialog_maxrows(void); 63int dialog_prompt_wrappedlines(char *_prompt, int _ncols, 64 uint8_t _nlstate); 65int dialog_spawn_gauge(char *_init_prompt, pid_t *_pid); 66int tty_maxcols(void); 67#define tty_maxrows() dialog_maxrows() 68unsigned int dialog_prompt_longestline(const char *_prompt, 69 uint8_t _nlstate); 70unsigned int dialog_prompt_numlines(const char *_prompt, uint8_t _nlstate); 71__END_DECLS 72 73#endif /* !_DIALOG_UTIL_H_ */ 74