dialog_util.h revision 302408
1205821Sedwin/*- 2205821Sedwin * Copyright (c) 2013-2014 Devin Teske <dteske@FreeBSD.org> 3205821Sedwin * All rights reserved. 4205821Sedwin * 5205821Sedwin * Redistribution and use in source and binary forms, with or without 6205821Sedwin * modification, are permitted provided that the following conditions 7205821Sedwin * are met: 8205821Sedwin * 1. Redistributions of source code must retain the above copyright 9205821Sedwin * notice, this list of conditions and the following disclaimer. 10205821Sedwin * 2. Redistributions in binary form must reproduce the above copyright 11205821Sedwin * notice, this list of conditions and the following disclaimer in the 12205821Sedwin * documentation and/or other materials provided with the distribution. 13205821Sedwin * 14205821Sedwin * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15205821Sedwin * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16205821Sedwin * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17205821Sedwin * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18205821Sedwin * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19205821Sedwin * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20205821Sedwin * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21205821Sedwin * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22205821Sedwin * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23205821Sedwin * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24205821Sedwin * SUCH DAMAGE. 25205821Sedwin * 26205821Sedwin * $FreeBSD: stable/11/lib/libdpv/dialog_util.h 294892 2016-01-27 06:16:53Z dteske $ 27205821Sedwin */ 28205821Sedwin 29205821Sedwin#ifndef _DIALOG_UTIL_H_ 30205821Sedwin#define _DIALOG_UTIL_H_ 31205821Sedwin 32205821Sedwin#include <sys/types.h> 33205821Sedwin 34205821Sedwin#include "dialogrc.h" 35205821Sedwin 36205821Sedwin#define DIALOG_SPAWN_DEBUG 0 /* Debug spawning of [X]dialog(1) */ 37205821Sedwin 38205821Sedwin/* dialog(3) and [X]dialog(1) characteristics */ 39205821Sedwin#define DIALOG "dialog" 40205821Sedwin#define XDIALOG "Xdialog" 41205821Sedwin#define PROMPT_MAX 16384 42205821Sedwin#define ENV_DIALOG "DIALOG" 43205821Sedwin#define ENV_USE_COLOR "USE_COLOR" 44205821Sedwin#define ENV_XDIALOG_HIGH_DIALOG_COMPAT "XDIALOG_HIGH_DIALOG_COMPAT" 45205821Sedwinextern uint8_t dialog_test; 46205821Sedwinextern uint8_t use_libdialog; 47205821Sedwinextern uint8_t use_dialog; 48205821Sedwinextern uint8_t use_xdialog; 49205821Sedwinextern uint8_t use_color; 50205821Sedwinextern char dialog[]; 51205821Sedwin 52205821Sedwin/* dialog(3) and [X]dialog(1) functionality */ 53205821Sedwinextern char *title, *backtitle; 54205821Sedwinextern int dheight, dwidth; 55205821Sedwin 56205821Sedwin__BEGIN_DECLS 57205821Sedwinuint8_t dialog_prompt_nlstate(const char *_prompt); 58205821Sedwinvoid dialog_maxsize_free(void); 59205821Sedwinchar *dialog_prompt_lastline(char *_prompt, uint8_t _nlstate); 60205821Sedwinint dialog_maxcols(void); 61205821Sedwinint dialog_maxrows(void); 62205821Sedwinint dialog_prompt_wrappedlines(char *_prompt, int _ncols, 63205821Sedwin uint8_t _nlstate); 64205821Sedwinint dialog_spawn_gauge(char *_init_prompt, pid_t *_pid); 65205821Sedwinint tty_maxcols(void); 66205821Sedwin#define tty_maxrows() dialog_maxrows() 67205821Sedwinunsigned int dialog_prompt_longestline(const char *_prompt, 68205821Sedwin uint8_t _nlstate); 69205821Sedwinunsigned int dialog_prompt_numlines(const char *_prompt, uint8_t _nlstate); 70205821Sedwin__END_DECLS 71205821Sedwin 72205821Sedwin#endif /* !_DIALOG_UTIL_H_ */ 73205821Sedwin