mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-19 10:53:58 +00:00
c8389f985d
back tab key understanded now
162 lines
5.3 KiB
Plaintext
162 lines
5.3 KiB
Plaintext
|
|
dialog - Display dialog boxes in shell script (version 0.3)
|
|
===========================================================
|
|
|
|
This is a program that will enable you to present a variety of questions or
|
|
display messages using dialog boxes from a shell script. Currently, these
|
|
types of dialog boxes are implemented: yes/no box, menu box, input box,
|
|
message box, text box, info box, checklist box. The idea of writing this
|
|
program came from the fact that most questions asked in a shell script (and
|
|
many interactive programs as well) can be classified into these few types:
|
|
|
|
|
|
1) One that requires the user to answer either yes or no.
|
|
|
|
2) One that presents a number of options for the user to choose.
|
|
|
|
3) One that requires the user to input a string.
|
|
|
|
4) One that displays a message and optionally wait for a key press
|
|
before continuing.
|
|
|
|
5) One that presents a list of options that can be turned on or off.
|
|
|
|
|
|
The program 'dialog' can, say for example, be called in a shell script to
|
|
present the first type of questions like this:
|
|
|
|
|
|
if dialog --yesno <question text> <height> <width>
|
|
then
|
|
...
|
|
fi
|
|
|
|
|
|
e.g. if dialog --yesno "Do you want to continue?" 7 51
|
|
then
|
|
echo "Continuing..."
|
|
else
|
|
echo "Aborting..."
|
|
fi
|
|
|
|
|
|
I've included a sample shell script for each type of boxes in the directory
|
|
samples. The program requires ncurses to compile. Running 'dialog' without
|
|
arguments will display the usage.
|
|
|
|
|
|
|
|
FEATURES
|
|
--------
|
|
|
|
* Friendly dialog box interface with buttons, etc.
|
|
|
|
* Auto wrap around of question text if it's too long to fit on
|
|
one line.
|
|
|
|
* "\n" can be inserted in question text to control line breaking
|
|
explicitly. The real newline character '\n' can also be used.
|
|
|
|
* run-time configruation of color settings and other options using
|
|
a configuration file.
|
|
|
|
|
|
|
|
WHAT'S NEW SINCE VERSION 0.21?
|
|
------------------------------
|
|
|
|
* some changes for faster screen update.
|
|
|
|
* much more flexible color settings. Can use all 16 colors
|
|
(8 normal, 8 highlight) of the Linux console.
|
|
|
|
* added run-time configuration using configuration file.
|
|
|
|
* some minor bug fixes and cleanups for menubox, checklist and
|
|
textbox.
|
|
|
|
* added a man page.
|
|
|
|
* some changes for easier porting to other Unix systems (tested
|
|
on Ultrix, SunOS and HPUX)
|
|
|
|
|
|
|
|
INSTALLATION
|
|
------------
|
|
|
|
1. cd ./src
|
|
|
|
2. Go to step 3 if your system has ncurses (e.g. Linux).
|
|
Edit Makefile and remove -DHAVE_NCURSES from DEFS. Also
|
|
remove rc.c from SRCS and rc.o from OBJS. Change LIBS as
|
|
appropriate (Usually, it should be '-lcurses -ltermcap').
|
|
Go to step 6.
|
|
|
|
3. Edit Makefile and remove -DBROKEN_WSCRL from DEFS if you
|
|
are using ncurses 1.8.3 or newer. Menu scrolling should
|
|
be faster. DON'T REMOVE IT IF YOU ARE NOT USING AT LEAST
|
|
VERSION 1.8.3 OF NCURSES.
|
|
|
|
4. Edit dialog.h and change USE_SHADOW to FALSE if you don't
|
|
want shadowed dialog boxes. Also change USE_COLORS to
|
|
FALSE if you don't want colors. Note that 'dialog' will
|
|
check if the terminal supports colors, and will use mono
|
|
settings if it doesn't, so USE_COLORS won't do any harm
|
|
even if you have a mono display. Also note that USE_SHADOW
|
|
implies USE_COLORS. These two options can be changed at
|
|
run-time using the run-time configuration file (see below).
|
|
|
|
5. Edit colors.h to change default color definitions if you
|
|
don't like the defaults. These are only compiled in defaults,
|
|
you can change them at run-time using the run-time
|
|
configuration file.
|
|
|
|
6. 'make depend; make install' will compile and install the
|
|
binaries in /usr/local/bin (change BINDIR in Makefile if
|
|
you want to install elsewhere).
|
|
|
|
7. 'make install.man' will install the man page to
|
|
/usr/local/man (change MANDIR in Makefile if you want to
|
|
install elsewhere).
|
|
|
|
8. You can then try the sample shell scripts in the samples
|
|
directory (make sure the environment variable DIALOG is
|
|
not set, the scripts use it to find the dialog binary, if
|
|
it's not set, "../src/dialog" will be used).
|
|
|
|
9. Don't forget to mail me (mail address at end of this file)
|
|
if you find any bugs, have some good color settings to
|
|
contribute or just want to tell me that you like it, Don't
|
|
mail me if you don't like it :-)
|
|
|
|
|
|
|
|
RUN-TIME CONFIGURATION
|
|
----------------------
|
|
|
|
1. Create a sample configuration file by typing:
|
|
|
|
"dialog --create-rc <file>"
|
|
|
|
2. At start, 'dialog' determines the settings to use as follows:
|
|
|
|
a) if environment variable DIALOGRC is set, it's value
|
|
determines the name of the configuration file.
|
|
|
|
b) if the file in (a) can't be found, use the file
|
|
$HOME/.dialogrc as the configuration file.
|
|
|
|
c) if the file in (b) can't be found, use compiled in
|
|
defaults.
|
|
|
|
3. Edit the sample configuration file and copy it to some place
|
|
that 'dialog' can find, as stated in step 2 above.
|
|
|
|
|
|
|
|
|
|
Comments and bug reports welcome.
|
|
|
|
- Savio Lam (lam836@cs.cuhk.hk)
|