(2006-08-06) rescue-bootcd
This commit is contained in:
1093
extra/dialog-1.0-20050306/CHANGES
Normal file
1093
extra/dialog-1.0-20050306/CHANGES
Normal file
File diff suppressed because it is too large
Load Diff
340
extra/dialog-1.0-20050306/COPYING
Normal file
340
extra/dialog-1.0-20050306/COPYING
Normal file
@@ -0,0 +1,340 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
||||
61
extra/dialog-1.0-20050306/README
Normal file
61
extra/dialog-1.0-20050306/README
Normal file
@@ -0,0 +1,61 @@
|
||||
-(1999-12-25)-------------------------------------------------------------------
|
||||
This version of dialog, formerly known as cdialog is based on the Debian
|
||||
package for dialog 0.9a (see CHANGES for recent modifications)
|
||||
- T.Dickey <dickey@invisible-island.net>
|
||||
|
||||
-(1996-01-15)-------------------------------------------------------------------
|
||||
I have uploaded cdialog-0.9a.tar.gz to sunsite. It should be moved
|
||||
to pub/Linux/utils/shell, I think.
|
||||
|
||||
Starting point for cdialog v.0.9a was dialog-0.6c. Many new features
|
||||
like as Resolution-independence, Auto-sizing, Maximizing, more widget
|
||||
on the same screen (multi-widget), etc. were added. New widget are
|
||||
tailbox and tailbox-in-background. Here are the options:
|
||||
|
||||
Usage: dialog <Common options> <Box options>
|
||||
{ --and-widget <Common options> <Box options> }
|
||||
|
||||
Common options: <Global options>
|
||||
[--backtitle <backtitle>] [--sleep <secs>] [--beep] [--beep-after]
|
||||
[--clear] [--begin <y> <x>] [--aspect <ratio>] [--print-size]
|
||||
[--print-maxsize] [--size-err] [--separate-output] [--cr-wrap]
|
||||
[--tab-len <n>] [--tab-correct] [--print-version] [--no-kill]
|
||||
[--title <title>]
|
||||
|
||||
Global options: [--shadow] [--no-shadow] [--separate-widget "<str>"]
|
||||
|
||||
At the moment, mouse support with libgpm can't be added because it
|
||||
does't implement the wtimeout() function of ncurses. Wtimeout() is
|
||||
needed to have more widgets (es.tailbox) cooperating on the same
|
||||
screen... I don't know if with newer versions of libgpm it's possible.
|
||||
|
||||
I have no more time to write docs for this new version...Is there
|
||||
anyone, that looking at the code, can do it??? Ouch! :-)
|
||||
Don't flame me!
|
||||
|
||||
For the future, if any volunteer want, the way to evolve cdialog is to
|
||||
1) make a daemon for a better support of multi-tasking or implementing
|
||||
multithreading.
|
||||
2) add an option that could permit to read commands (--options) from a
|
||||
file, like as in a normal programming language, but maintaining
|
||||
compatiblity with older version of dialog.
|
||||
|
||||
I no longer could maintain cdialog...
|
||||
Executable and library name of cdialog are the same of dialog, for
|
||||
compatiblity.
|
||||
|
||||
I think that only one directive should be follow: don't use a resource
|
||||
like stdin, stdout when you'll write new options for cdialog; these
|
||||
resources have to be shared from all widgets on the command line.
|
||||
Guage uses stdin :-/ so that can't be mixed for example with an inputbox,
|
||||
but it was made before of multi-widget. However this is not a big problem!
|
||||
|
||||
THERE ARE NO *KNOWN* BUGS. If anyone has much time and can find the way
|
||||
to add wtimeout() support to libgpm, also mouse could be supported.
|
||||
|
||||
Please use ncurses-1.9.4 or newer.
|
||||
|
||||
| __ | demarco_p@abramo.it:~$ make Linux | more > UserFriendly;
|
||||
| /__) | /~~ _ _ _ _ /~\ _ / . _ |
|
||||
|/ ako | (___ (_) | ) ) (-' (__/ | ) /__ | | ) (_| >< . coordinator.
|
||||
|
||||
1
extra/dialog-1.0-20050306/VERSION
Normal file
1
extra/dialog-1.0-20050306/VERSION
Normal file
@@ -0,0 +1 @@
|
||||
1:3:0 1.0 20050306
|
||||
2783
extra/dialog-1.0-20050306/aclocal.m4
vendored
Normal file
2783
extra/dialog-1.0-20050306/aclocal.m4
vendored
Normal file
File diff suppressed because it is too large
Load Diff
110
extra/dialog-1.0-20050306/arrows.c
Normal file
110
extra/dialog-1.0-20050306/arrows.c
Normal file
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* $Id: arrows.c,v 1.13 2004/12/20 20:42:58 tom Exp $
|
||||
*
|
||||
* arrows.c -- draw arrows to indicate end-of-range for lists
|
||||
*
|
||||
* Copyright 2000-2003,2004 Thomas E. Dickey
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include "dialog.h"
|
||||
|
||||
#ifdef USE_WIDE_CURSES
|
||||
#define add_acs(win, code) wadd_wch(win, W ## code)
|
||||
#else
|
||||
#define add_acs(win, code) waddch(win, code)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_COLOR
|
||||
static chtype
|
||||
merge_colors(chtype foreground, chtype background)
|
||||
{
|
||||
chtype result = foreground;
|
||||
if ((foreground & A_COLOR) != (background & A_COLOR)) {
|
||||
short fg_f, bg_f;
|
||||
short fg_b, bg_b;
|
||||
if (pair_content(PAIR_NUMBER(foreground), &fg_f, &bg_f) != ERR
|
||||
&& pair_content(PAIR_NUMBER(background), &fg_b, &bg_b) != ERR) {
|
||||
result &= ~A_COLOR;
|
||||
result |= dlg_color_pair(fg_f, bg_b);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#else
|
||||
#define merge_colors(f,b) (f)
|
||||
#endif
|
||||
|
||||
void
|
||||
dlg_draw_arrows2(WINDOW *dialog,
|
||||
int top_arrow,
|
||||
int bottom_arrow,
|
||||
int x,
|
||||
int top,
|
||||
int bottom,
|
||||
chtype attr,
|
||||
chtype borderattr)
|
||||
{
|
||||
chtype save = getattrs(dialog);
|
||||
int cur_x, cur_y;
|
||||
|
||||
getyx(dialog, cur_y, cur_x);
|
||||
|
||||
(void) wmove(dialog, top, x);
|
||||
if (top_arrow) {
|
||||
wattrset(dialog, merge_colors(uarrow_attr, attr));
|
||||
(void) add_acs(dialog, ACS_UARROW);
|
||||
(void) waddstr(dialog, "(+)");
|
||||
} else {
|
||||
wattrset(dialog, attr);
|
||||
(void) whline(dialog, ACS_HLINE, 4);
|
||||
}
|
||||
mouse_mkbutton(top, x - 1, 6, KEY_PPAGE);
|
||||
|
||||
(void) wmove(dialog, bottom, x);
|
||||
if (bottom_arrow) {
|
||||
wattrset(dialog, merge_colors(darrow_attr, attr));
|
||||
(void) add_acs(dialog, ACS_DARROW);
|
||||
(void) waddstr(dialog, "(+)");
|
||||
} else {
|
||||
wattrset(dialog, borderattr);
|
||||
(void) whline(dialog, ACS_HLINE, 4);
|
||||
}
|
||||
mouse_mkbutton(bottom, x - 1, 6, KEY_NPAGE);
|
||||
|
||||
(void) wmove(dialog, cur_y, cur_x);
|
||||
wrefresh(dialog);
|
||||
|
||||
wattrset(dialog, save);
|
||||
}
|
||||
|
||||
void
|
||||
dlg_draw_arrows(WINDOW *dialog,
|
||||
int top_arrow,
|
||||
int bottom_arrow,
|
||||
int x,
|
||||
int top,
|
||||
int bottom)
|
||||
{
|
||||
dlg_draw_arrows2(dialog,
|
||||
top_arrow,
|
||||
bottom_arrow,
|
||||
x,
|
||||
top,
|
||||
bottom,
|
||||
menubox_attr,
|
||||
menubox_border_attr);
|
||||
}
|
||||
BIN
extra/dialog-1.0-20050306/arrows.o
Normal file
BIN
extra/dialog-1.0-20050306/arrows.o
Normal file
Binary file not shown.
566
extra/dialog-1.0-20050306/buttons.c
Normal file
566
extra/dialog-1.0-20050306/buttons.c
Normal file
@@ -0,0 +1,566 @@
|
||||
/*
|
||||
* $Id: buttons.c,v 1.56 2004/12/20 20:42:58 tom Exp $
|
||||
*
|
||||
* buttons.c -- draw buttons, e.g., OK/Cancel
|
||||
*
|
||||
* Copyright 2000-2003,2004 Thomas E. Dickey
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include "dialog.h"
|
||||
|
||||
#ifdef USE_WIDE_CURSES
|
||||
#include <wctype.h>
|
||||
#define dlg_toupper(ch) towupper(ch)
|
||||
#define dlg_isupper(ch) iswupper(ch)
|
||||
#else
|
||||
#define dlg_toupper(ch) toupper(ch)
|
||||
#define dlg_isupper(ch) (isalpha(ch) && isupper(ch))
|
||||
#endif
|
||||
|
||||
#define MIN_BUTTON (dialog_state.visit_items ? -1 : 0)
|
||||
|
||||
static void
|
||||
center_label(char *buffer, int longest, const char *label)
|
||||
{
|
||||
int len = strlen(label);
|
||||
|
||||
if (len < longest) {
|
||||
if ((len = (longest - len) / 2) > 0) {
|
||||
longest -= len;
|
||||
sprintf(buffer, "%*s", len, " ");
|
||||
buffer += strlen(buffer);
|
||||
}
|
||||
}
|
||||
sprintf(buffer, "%-*s", longest, label);
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse a multibyte character out of the string, set it past the parsed
|
||||
* character.
|
||||
*/
|
||||
static int
|
||||
string_to_char(const char **stringp)
|
||||
{
|
||||
int result;
|
||||
#ifdef USE_WIDE_CURSES
|
||||
const char *string = *stringp;
|
||||
int have = strlen(string);
|
||||
int check;
|
||||
int len;
|
||||
wchar_t cmp2;
|
||||
mbstate_t state;
|
||||
|
||||
memset(&state, 0, sizeof(state));
|
||||
len = mbrlen(string, have, &state);
|
||||
if (len > 0 && len <= have) {
|
||||
memset(&state, 0, sizeof(state));
|
||||
check = mbrtowc(&cmp2, string, len, &state);
|
||||
if (check <= 0)
|
||||
cmp2 = 0;
|
||||
*stringp += len;
|
||||
} else {
|
||||
cmp2 = UCH(*string);
|
||||
*stringp += 1;
|
||||
}
|
||||
result = cmp2;
|
||||
#else
|
||||
const char *string = *stringp;
|
||||
result = UCH(*string);
|
||||
*stringp += 1;
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Print a button
|
||||
*/
|
||||
static void
|
||||
print_button(WINDOW *win, const char *label, int y, int x, int selected)
|
||||
{
|
||||
int i, j;
|
||||
int state = 0;
|
||||
const int *indx = dlg_index_wchars(label);
|
||||
int limit = dlg_count_wchars(label);
|
||||
chtype key_attr = (selected
|
||||
? button_key_active_attr
|
||||
: button_key_inactive_attr);
|
||||
chtype label_attr = (selected
|
||||
? button_label_active_attr
|
||||
: button_label_inactive_attr);
|
||||
|
||||
(void) wmove(win, y, x);
|
||||
wattrset(win, selected
|
||||
? button_active_attr
|
||||
: button_inactive_attr);
|
||||
(void) waddstr(win, "<");
|
||||
wattrset(win, label_attr);
|
||||
for (i = 0; i < limit; ++i) {
|
||||
int first = indx[i];
|
||||
int last = indx[i + 1];
|
||||
|
||||
switch (state) {
|
||||
case 0:
|
||||
#ifdef USE_WIDE_CURSES
|
||||
if ((last - first) != 1) {
|
||||
const char *temp = (label + first);
|
||||
int cmp = string_to_char(&temp);
|
||||
if (dlg_isupper(cmp)) {
|
||||
wattrset(win, key_attr);
|
||||
state = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
if (dlg_isupper(UCH(label[first]))) {
|
||||
wattrset(win, key_attr);
|
||||
state = 1;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
wattrset(win, label_attr);
|
||||
state = 2;
|
||||
break;
|
||||
}
|
||||
for (j = first; j < last; ++j)
|
||||
(void) waddch(win, CharOf(label[j]));
|
||||
}
|
||||
wattrset(win, selected
|
||||
? button_active_attr
|
||||
: button_inactive_attr);
|
||||
(void) waddstr(win, ">");
|
||||
(void) wmove(win, y, x + strspn(label, " ") + 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Count the buttons in the list.
|
||||
*/
|
||||
int
|
||||
dlg_button_count(const char **labels)
|
||||
{
|
||||
int result = 0;
|
||||
while (*labels++ != 0)
|
||||
++result;
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Compute the size of the button array.
|
||||
*/
|
||||
void
|
||||
dlg_button_sizes(const char **labels,
|
||||
int vertical,
|
||||
int *longest,
|
||||
int *length)
|
||||
{
|
||||
int n;
|
||||
|
||||
*length = 0;
|
||||
*longest = 0;
|
||||
for (n = 0; labels[n] != 0; n++) {
|
||||
if (vertical) {
|
||||
*length += 1;
|
||||
*longest = 1;
|
||||
} else {
|
||||
int len = strlen(labels[n]);
|
||||
if (len > *longest)
|
||||
*longest = len;
|
||||
*length += len;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* If we can, make all of the buttons the same size. This is only optional
|
||||
* for buttons laid out horizontally.
|
||||
*/
|
||||
if (*longest < 6 - (*longest & 1))
|
||||
*longest = 6 - (*longest & 1);
|
||||
if (!vertical)
|
||||
*length = *longest * n;
|
||||
}
|
||||
|
||||
/*
|
||||
* Compute the size of the button array.
|
||||
*/
|
||||
int
|
||||
dlg_button_x_step(const char **labels, int limit, int *gap, int *margin, int *step)
|
||||
{
|
||||
int count = dlg_button_count(labels);
|
||||
int longest;
|
||||
int length;
|
||||
int unused;
|
||||
int used;
|
||||
|
||||
dlg_button_sizes(labels, FALSE, &longest, &length);
|
||||
used = (length + (count * 2));
|
||||
unused = limit - used;
|
||||
|
||||
if ((*gap = unused / (count + 3)) <= 0) {
|
||||
if ((*gap = unused / (count + 1)) <= 0)
|
||||
*gap = 1;
|
||||
*margin = *gap;
|
||||
} else {
|
||||
*margin = *gap * 2;
|
||||
}
|
||||
*step = *gap + (used + count - 1) / count;
|
||||
return (*gap > 0) && (unused >= 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Make sure there is enough space for the buttons
|
||||
*/
|
||||
void
|
||||
dlg_button_layout(const char **labels, int *limit)
|
||||
{
|
||||
int width = 1;
|
||||
int gap, margin, step;
|
||||
|
||||
while (!dlg_button_x_step(labels, width, &gap, &margin, &step))
|
||||
++width;
|
||||
width += (4 * MARGIN);
|
||||
if (width > COLS)
|
||||
width = COLS;
|
||||
if (width > *limit)
|
||||
*limit = width;
|
||||
}
|
||||
|
||||
/*
|
||||
* Print a list of buttons at the given position.
|
||||
*/
|
||||
void
|
||||
dlg_draw_buttons(WINDOW *win,
|
||||
int y, int x,
|
||||
const char **labels,
|
||||
int selected,
|
||||
int vertical,
|
||||
int limit)
|
||||
{
|
||||
chtype save = getattrs(win);
|
||||
int n;
|
||||
int step = 0;
|
||||
int length;
|
||||
int longest;
|
||||
int final_x;
|
||||
int final_y;
|
||||
int gap;
|
||||
int margin;
|
||||
char *buffer;
|
||||
|
||||
dlg_mouse_setbase(getbegx(win), getbegy(win));
|
||||
|
||||
getyx(win, final_y, final_x);
|
||||
|
||||
dlg_button_sizes(labels, vertical, &longest, &length);
|
||||
|
||||
if (vertical) {
|
||||
y += 1;
|
||||
step = 1;
|
||||
} else {
|
||||
dlg_button_x_step(labels, limit, &gap, &margin, &step);
|
||||
x += margin;
|
||||
}
|
||||
|
||||
buffer = malloc((unsigned) longest + 1);
|
||||
assert_ptr(buffer, "dlg_draw_buttons");
|
||||
|
||||
for (n = 0; labels[n] != 0; n++) {
|
||||
center_label(buffer, longest, labels[n]);
|
||||
mouse_mkbutton(y, x, strlen(buffer), n);
|
||||
print_button(win, buffer, y, x,
|
||||
(selected == n) || (n == 0 && selected < 0));
|
||||
if (selected == n)
|
||||
getyx(win, final_y, final_x);
|
||||
|
||||
if (vertical) {
|
||||
if ((y += step) > limit)
|
||||
break;
|
||||
} else {
|
||||
if ((x += step) > limit)
|
||||
break;
|
||||
}
|
||||
}
|
||||
(void) wmove(win, final_y, final_x);
|
||||
wrefresh(win);
|
||||
free(buffer);
|
||||
wattrset(win, save);
|
||||
}
|
||||
|
||||
/*
|
||||
* Match a given character against the beginning of the string, ignoring case
|
||||
* of the given character. The matching string must begin with an uppercase
|
||||
* character.
|
||||
*/
|
||||
int
|
||||
dlg_match_char(int ch, const char *string)
|
||||
{
|
||||
if (string != 0) {
|
||||
int cmp2 = string_to_char(&string);
|
||||
#ifdef USE_WIDE_CURSES
|
||||
wint_t cmp1 = dlg_toupper(ch);
|
||||
if (cmp2 != 0 && (wchar_t) cmp1 == (wchar_t) dlg_toupper(cmp2)) {
|
||||
return TRUE;
|
||||
}
|
||||
#else
|
||||
if (ch > 0 && ch < 256) {
|
||||
if (dlg_toupper(ch) == dlg_toupper(cmp2))
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Given a list of button labels, and a character which may be the abbreviation
|
||||
* for one, find it, if it exists. An abbreviation will be the first character
|
||||
* which happens to be capitalized in the label.
|
||||
*/
|
||||
int
|
||||
dlg_char_to_button(int ch, const char **labels)
|
||||
{
|
||||
if (labels != 0) {
|
||||
int j;
|
||||
const char *label;
|
||||
|
||||
ch = dlg_toupper(dlg_last_getc());
|
||||
for (j = 0; labels[j] != 0; ++j) {
|
||||
label = labels[j];
|
||||
while (*label != 0) {
|
||||
int cmp = string_to_char(&label);
|
||||
if (ch == cmp) {
|
||||
dlg_flush_getc();
|
||||
return j;
|
||||
} else if (dlg_isupper(cmp)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return DLG_EXIT_UNKNOWN;
|
||||
}
|
||||
|
||||
static const char *
|
||||
my_yes_label(void)
|
||||
{
|
||||
return (dialog_vars.yes_label != NULL)
|
||||
? dialog_vars.yes_label
|
||||
: _("Yes");
|
||||
}
|
||||
|
||||
static const char *
|
||||
my_no_label(void)
|
||||
{
|
||||
return (dialog_vars.no_label != NULL)
|
||||
? dialog_vars.no_label
|
||||
: _("No");
|
||||
}
|
||||
|
||||
static const char *
|
||||
my_ok_label(void)
|
||||
{
|
||||
return (dialog_vars.ok_label != NULL)
|
||||
? dialog_vars.ok_label
|
||||
: _("OK");
|
||||
}
|
||||
|
||||
static const char *
|
||||
my_cancel_label(void)
|
||||
{
|
||||
return (dialog_vars.cancel_label != NULL)
|
||||
? dialog_vars.cancel_label
|
||||
: _("Cancel");
|
||||
}
|
||||
|
||||
static const char *
|
||||
my_exit_label(void)
|
||||
{
|
||||
return (dialog_vars.exit_label != NULL)
|
||||
? dialog_vars.exit_label
|
||||
: _("EXIT");
|
||||
}
|
||||
|
||||
static const char *
|
||||
my_extra_label(void)
|
||||
{
|
||||
return (dialog_vars.extra_label != NULL)
|
||||
? dialog_vars.extra_label
|
||||
: _("Extra");
|
||||
}
|
||||
|
||||
static const char *
|
||||
my_help_label(void)
|
||||
{
|
||||
return (dialog_vars.help_label != NULL)
|
||||
? dialog_vars.help_label
|
||||
: _("Help");
|
||||
}
|
||||
|
||||
/*
|
||||
* These functions return a list of button labels.
|
||||
*/
|
||||
const char **
|
||||
dlg_exit_label(void)
|
||||
{
|
||||
static const char *labels[3];
|
||||
int n = 0;
|
||||
|
||||
labels[n++] = my_exit_label();
|
||||
labels[n] = 0;
|
||||
return labels;
|
||||
}
|
||||
|
||||
const char **
|
||||
dlg_ok_label(void)
|
||||
{
|
||||
static const char *labels[3];
|
||||
int n = 0;
|
||||
|
||||
labels[n++] = my_ok_label();
|
||||
labels[n] = 0;
|
||||
return labels;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return a list of button labels for the OK/Cancel group.
|
||||
*/
|
||||
const char **
|
||||
dlg_ok_labels(void)
|
||||
{
|
||||
static const char *labels[5];
|
||||
int n = 0;
|
||||
|
||||
labels[n++] = my_ok_label();
|
||||
if (dialog_vars.extra_button)
|
||||
labels[n++] = my_extra_label();
|
||||
if (!dialog_vars.nocancel)
|
||||
labels[n++] = my_cancel_label();
|
||||
if (dialog_vars.help_button)
|
||||
labels[n++] = my_help_label();
|
||||
labels[n] = 0;
|
||||
return labels;
|
||||
}
|
||||
|
||||
/*
|
||||
* Map the given button index for dlg_ok_labels() into our exit-code
|
||||
*/
|
||||
int
|
||||
dlg_ok_buttoncode(int button)
|
||||
{
|
||||
int result = DLG_EXIT_ERROR;
|
||||
int n = 1;
|
||||
|
||||
if (button <= 0) {
|
||||
result = DLG_EXIT_OK;
|
||||
} else if (dialog_vars.extra_button && (button == n++)) {
|
||||
result = DLG_EXIT_EXTRA;
|
||||
} else if (!dialog_vars.nocancel && (button == n++)) {
|
||||
result = DLG_EXIT_CANCEL;
|
||||
} else if (dialog_vars.help_button && (button == n)) {
|
||||
result = DLG_EXIT_HELP;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Given that we're using dlg_ok_labels() to list buttons, find the next index
|
||||
* in the list of buttons. The 'extra' parameter if negative provides a way to
|
||||
* enumerate extra active areas on the widget.
|
||||
*/
|
||||
int
|
||||
dlg_next_ok_buttonindex(int current, int extra)
|
||||
{
|
||||
int result = current + 1;
|
||||
|
||||
if (current >= 0
|
||||
&& dlg_ok_buttoncode(result) < 0)
|
||||
result = extra;
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Similarly, find the previous button index.
|
||||
*/
|
||||
int
|
||||
dlg_prev_ok_buttonindex(int current, int extra)
|
||||
{
|
||||
int result = current - 1;
|
||||
|
||||
if (result < extra) {
|
||||
for (result = 0; dlg_ok_buttoncode(result + 1) >= 0; ++result) {
|
||||
;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Find the button-index for the "OK" or "Cancel" button, according to
|
||||
* whether --defaultno is given. If --nocancel was given, we always return
|
||||
* the index for "OK".
|
||||
*/
|
||||
int
|
||||
dlg_defaultno_button(void)
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
if (dialog_vars.defaultno && !dialog_vars.nocancel) {
|
||||
while (dlg_ok_buttoncode(result) != DLG_EXIT_CANCEL)
|
||||
++result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return a list of buttons for Yes/No labels.
|
||||
*/
|
||||
const char **
|
||||
dlg_yes_labels(void)
|
||||
{
|
||||
static const char *labels[3];
|
||||
int n = 0;
|
||||
|
||||
labels[n++] = my_yes_label();
|
||||
labels[n++] = my_no_label();
|
||||
labels[n] = 0;
|
||||
return labels;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the next index in labels[];
|
||||
*/
|
||||
int
|
||||
dlg_next_button(const char **labels, int button)
|
||||
{
|
||||
if (labels[button + 1] != 0)
|
||||
++button;
|
||||
else
|
||||
button = MIN_BUTTON;
|
||||
return button;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the previous index in labels[];
|
||||
*/
|
||||
int
|
||||
dlg_prev_button(const char **labels, int button)
|
||||
{
|
||||
if (button > MIN_BUTTON)
|
||||
--button;
|
||||
else {
|
||||
while (labels[button + 1] != 0)
|
||||
++button;
|
||||
}
|
||||
return button;
|
||||
}
|
||||
BIN
extra/dialog-1.0-20050306/buttons.o
Normal file
BIN
extra/dialog-1.0-20050306/buttons.o
Normal file
Binary file not shown.
628
extra/dialog-1.0-20050306/calendar.c
Normal file
628
extra/dialog-1.0-20050306/calendar.c
Normal file
@@ -0,0 +1,628 @@
|
||||
/*
|
||||
* $Id: calendar.c,v 1.38 2004/09/18 16:40:42 tom Exp $
|
||||
*
|
||||
* calendar.c -- implements the calendar box
|
||||
*
|
||||
* Copyright 2001-2003,2004 Thomas E. Dickey
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include "dialog.h"
|
||||
#include <time.h>
|
||||
|
||||
#define ONE_DAY (60 * 60 * 24)
|
||||
|
||||
#define MON_WIDE 4 /* width of a month-name */
|
||||
#define DAY_HIGH 6 /* maximum lines in day-grid */
|
||||
#define DAY_WIDE (8 * MON_WIDE) /* width of the day-grid */
|
||||
#define HDR_HIGH 1 /* height of cells with month/year */
|
||||
#define BTN_HIGH 1 /* height of button-row excluding margin */
|
||||
|
||||
/* two more lines: titles for day-of-week and month/year boxes */
|
||||
#define MIN_HIGH (DAY_HIGH + 2 + HDR_HIGH + BTN_HIGH + (7 * MARGIN))
|
||||
#define MIN_WIDE (DAY_WIDE + (4 * MARGIN))
|
||||
|
||||
typedef enum {
|
||||
sMONTH = -3
|
||||
,sYEAR = -2
|
||||
,sDAY = -1
|
||||
} STATES;
|
||||
|
||||
struct _box;
|
||||
|
||||
typedef int (*BOX_DRAW) (struct _box *, struct tm *);
|
||||
|
||||
typedef struct _box {
|
||||
WINDOW *parent;
|
||||
WINDOW *window;
|
||||
int x;
|
||||
int y;
|
||||
int width;
|
||||
int height;
|
||||
BOX_DRAW box_draw;
|
||||
} BOX;
|
||||
|
||||
static int
|
||||
days_in_month(struct tm *current, int offset /* -1, 0, 1 */ )
|
||||
{
|
||||
static const int nominal[] =
|
||||
{
|
||||
31, 28, 31, 30, 31, 30,
|
||||
31, 31, 30, 31, 30, 31
|
||||
};
|
||||
int year = current->tm_year;
|
||||
int month = current->tm_mon + offset;
|
||||
int result;
|
||||
|
||||
while (month < 0) {
|
||||
month += 12;
|
||||
year -= 1;
|
||||
}
|
||||
while (month >= 12) {
|
||||
month -= 12;
|
||||
year += 1;
|
||||
}
|
||||
result = nominal[month];
|
||||
if (month == 1)
|
||||
result += ((year % 4) == 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
static int
|
||||
days_in_year(struct tm *current, int offset /* -1, 0, 1 */ )
|
||||
{
|
||||
int year = current->tm_year + 1900 + offset;
|
||||
|
||||
return ((year % 4) == 0) ? 366 : 365;
|
||||
}
|
||||
|
||||
static int
|
||||
day_cell_number(struct tm *current)
|
||||
{
|
||||
int cell;
|
||||
cell = current->tm_mday - ((6 + current->tm_mday - current->tm_wday) % 7);
|
||||
if ((current->tm_mday - 1) % 7 != current->tm_wday)
|
||||
cell += 6;
|
||||
else
|
||||
cell--;
|
||||
return cell;
|
||||
}
|
||||
|
||||
static int
|
||||
next_or_previous(int key, int two_d)
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
switch (key) {
|
||||
case M_EVENT + KEY_PPAGE:
|
||||
case KEY_PPAGE:
|
||||
case KEY_PREVIOUS:
|
||||
case KEY_UP:
|
||||
result = two_d ? -7 : -1;
|
||||
break;
|
||||
case KEY_LEFT:
|
||||
case CHR_PREVIOUS:
|
||||
case CHR_BACKSPACE:
|
||||
result = -1;
|
||||
break;
|
||||
case M_EVENT + KEY_NPAGE:
|
||||
case KEY_NPAGE:
|
||||
case KEY_DOWN:
|
||||
result = two_d ? 7 : 1;
|
||||
break;
|
||||
case KEY_RIGHT:
|
||||
case CHR_NEXT:
|
||||
case KEY_NEXT:
|
||||
result = 1;
|
||||
break;
|
||||
default:
|
||||
/*
|
||||
* We're already using the left/right arrow keys for traversal. Use
|
||||
* vi-style for navigating around the days of the month.
|
||||
*/
|
||||
if (two_d) {
|
||||
switch (key) {
|
||||
case 'h':
|
||||
result = -1;
|
||||
break;
|
||||
case 'j':
|
||||
result = 7;
|
||||
break;
|
||||
case 'k':
|
||||
result = -7;
|
||||
break;
|
||||
case 'l':
|
||||
result = 1;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
beep();
|
||||
}
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/*
|
||||
* Draw the day-of-month selection box
|
||||
*/
|
||||
static int
|
||||
draw_day(BOX * data, struct tm *current)
|
||||
{
|
||||
#ifdef ENABLE_NLS
|
||||
char *of_week[] =
|
||||
{
|
||||
nl_langinfo(ABDAY_1),
|
||||
nl_langinfo(ABDAY_2),
|
||||
nl_langinfo(ABDAY_3),
|
||||
nl_langinfo(ABDAY_4),
|
||||
nl_langinfo(ABDAY_5),
|
||||
nl_langinfo(ABDAY_6),
|
||||
nl_langinfo(ABDAY_7)
|
||||
};
|
||||
#else
|
||||
static const char *const of_week[] =
|
||||
{
|
||||
"Sunday",
|
||||
"Monday",
|
||||
"Tuesday",
|
||||
"Wednesday",
|
||||
"Thursday",
|
||||
"Friday",
|
||||
"Saturday"
|
||||
};
|
||||
#endif
|
||||
int cell_wide = MON_WIDE;
|
||||
int y, x, this_x = 0;
|
||||
int save_y = 0, save_x = 0;
|
||||
int day = current->tm_mday;
|
||||
int mday;
|
||||
int week;
|
||||
int last = days_in_month(current, 0);
|
||||
int prev = days_in_month(current, -1);
|
||||
|
||||
werase(data->window);
|
||||
dlg_draw_box(data->parent,
|
||||
data->y - MARGIN, data->x - MARGIN,
|
||||
data->height + (2 * MARGIN), data->width + (2 * MARGIN),
|
||||
menubox_border_attr, menubox_attr); /* border of daybox */
|
||||
|
||||
wattrset(data->window, menubox_attr); /* daynames headline */
|
||||
for (x = 0; x < 7; x++) {
|
||||
mvwprintw(data->window,
|
||||
0, (x + 1) * cell_wide, "%*.*s ",
|
||||
cell_wide - 1,
|
||||
cell_wide - 1,
|
||||
of_week[x]);
|
||||
}
|
||||
|
||||
mday = ((6 + current->tm_mday - current->tm_wday) % 7) - 7;
|
||||
if (mday <= -7)
|
||||
mday += 7;
|
||||
/* mday is now in the range -6 to 0. */
|
||||
week = (current->tm_yday + 6 + mday - current->tm_mday) / 7;
|
||||
|
||||
for (y = 1; mday < last; y++) {
|
||||
wattrset(data->window, menubox_attr); /* weeknumbers headline */
|
||||
mvwprintw(data->window,
|
||||
y, 0,
|
||||
"%*d ",
|
||||
cell_wide - 1,
|
||||
++week);
|
||||
for (x = 0; x < 7; x++) {
|
||||
this_x = 1 + (x + 1) * cell_wide;
|
||||
++mday;
|
||||
if (wmove(data->window, y, this_x) == ERR)
|
||||
continue;
|
||||
wattrset(data->window, item_attr); /* not selected days */
|
||||
if (mday == day) {
|
||||
wattrset(data->window, item_selected_attr); /* selected day */
|
||||
save_y = y;
|
||||
save_x = this_x;
|
||||
}
|
||||
if (mday > 0) {
|
||||
if (mday <= last) {
|
||||
wprintw(data->window, "%*d", cell_wide - 2, mday);
|
||||
} else if (mday == day) {
|
||||
wprintw(data->window, "%*d", cell_wide - 2, mday - last);
|
||||
}
|
||||
} else if (mday == day) {
|
||||
wprintw(data->window, "%*d", cell_wide - 2, mday + prev);
|
||||
}
|
||||
}
|
||||
wmove(data->window, save_y, save_x);
|
||||
}
|
||||
dlg_draw_arrows(data->parent, TRUE, TRUE,
|
||||
data->x + 5,
|
||||
data->y - 1,
|
||||
data->y + data->height);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Draw the month-of-year selection box
|
||||
*/
|
||||
static int
|
||||
draw_month(BOX * data, struct tm *current)
|
||||
{
|
||||
#ifdef ENABLE_NLS
|
||||
char *months[] =
|
||||
{
|
||||
nl_langinfo(MON_1),
|
||||
nl_langinfo(MON_2),
|
||||
nl_langinfo(MON_3),
|
||||
nl_langinfo(MON_4),
|
||||
nl_langinfo(MON_5),
|
||||
nl_langinfo(MON_6),
|
||||
nl_langinfo(MON_7),
|
||||
nl_langinfo(MON_8),
|
||||
nl_langinfo(MON_9),
|
||||
nl_langinfo(MON_10),
|
||||
nl_langinfo(MON_11),
|
||||
nl_langinfo(MON_12)
|
||||
};
|
||||
#else
|
||||
static const char *const months[] =
|
||||
{
|
||||
"January",
|
||||
"February",
|
||||
"March",
|
||||
"April",
|
||||
"May",
|
||||
"June",
|
||||
"July",
|
||||
"August",
|
||||
"September",
|
||||
"October",
|
||||
"November",
|
||||
"December"
|
||||
};
|
||||
#endif
|
||||
int month;
|
||||
|
||||
month = current->tm_mon + 1;
|
||||
|
||||
wattrset(data->parent, dialog_attr); /* Headline "Month" */
|
||||
(void) mvwprintw(data->parent, data->y - 2, data->x - 1, _("Month"));
|
||||
dlg_draw_box(data->parent,
|
||||
data->y - 1, data->x - 1,
|
||||
data->height + 2, data->width + 2,
|
||||
menubox_border_attr, menubox_attr); /* borders of monthbox */
|
||||
wattrset(data->window, item_attr); /* color the month selection */
|
||||
mvwprintw(data->window, 0, 0, "%s", months[month - 1]);
|
||||
wmove(data->window, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Draw the year selection box
|
||||
*/
|
||||
static int
|
||||
draw_year(BOX * data, struct tm *current)
|
||||
{
|
||||
int year = current->tm_year + 1900;
|
||||
|
||||
wattrset(data->parent, dialog_attr); /* Headline "Year" */
|
||||
(void) mvwprintw(data->parent, data->y - 2, data->x - 1, _("Year"));
|
||||
dlg_draw_box(data->parent,
|
||||
data->y - 1, data->x - 1,
|
||||
data->height + 2, data->width + 2,
|
||||
menubox_border_attr, menubox_attr); /* borders of yearbox */
|
||||
wattrset(data->window, item_attr); /* color the year selection */
|
||||
mvwprintw(data->window, 0, 0, "%4d", year);
|
||||
wmove(data->window, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
init_object(BOX * data,
|
||||
WINDOW *parent,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
BOX_DRAW box_draw,
|
||||
int code)
|
||||
{
|
||||
data->parent = parent;
|
||||
data->x = x;
|
||||
data->y = y;
|
||||
data->width = width;
|
||||
data->height = height;
|
||||
data->box_draw = box_draw;
|
||||
|
||||
data->window = derwin(data->parent,
|
||||
data->height, data->width,
|
||||
data->y, data->x);
|
||||
if (data->window == 0)
|
||||
return -1;
|
||||
(void) keypad(data->window, TRUE);
|
||||
|
||||
dlg_mouse_setbase(getbegx(parent), getbegy(parent));
|
||||
if (code == 'D') {
|
||||
dlg_mouse_mkbigregion(y + 1, x + MON_WIDE, height - 1, width - MON_WIDE,
|
||||
KEY_MAX, 1, MON_WIDE, 3);
|
||||
} else {
|
||||
dlg_mouse_mkregion(y, x, height, width, code);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define DrawObject(data) (data)->box_draw(data, ¤t)
|
||||
|
||||
/*
|
||||
* Display a dialog box for entering a date
|
||||
*/
|
||||
int
|
||||
dialog_calendar(const char *title,
|
||||
const char *subtitle,
|
||||
int height,
|
||||
int width,
|
||||
int day,
|
||||
int month,
|
||||
int year)
|
||||
{
|
||||
BOX dy_box, mn_box, yr_box;
|
||||
int fkey;
|
||||
int key = 0;
|
||||
int key2;
|
||||
int step;
|
||||
int button;
|
||||
int result = DLG_EXIT_UNKNOWN;
|
||||
WINDOW *dialog;
|
||||
time_t now_time = time((time_t *) 0);
|
||||
struct tm current;
|
||||
STATES state = dlg_defaultno_button();
|
||||
const char **buttons = dlg_ok_labels();
|
||||
char *prompt = dlg_strclone(subtitle);
|
||||
int longest;
|
||||
int mincols;
|
||||
|
||||
dlg_does_output();
|
||||
|
||||
now_time = time((time_t *) 0);
|
||||
current = *localtime(&now_time);
|
||||
if (day < 0)
|
||||
day = current.tm_mday;
|
||||
if (month < 0)
|
||||
month = current.tm_mon + 1;
|
||||
if (year < 0)
|
||||
year = current.tm_year + 1900;
|
||||
|
||||
/* compute a struct tm that matches the day/month/year parameters */
|
||||
if (((year -= 1900) > 0) && (year < 200)) {
|
||||
/* ugly, but I'd like to run this on older machines w/o mktime -TD */
|
||||
for (;;) {
|
||||
if (year > current.tm_year) {
|
||||
now_time += ONE_DAY * days_in_year(¤t, 0);
|
||||
} else if (year < current.tm_year) {
|
||||
now_time -= ONE_DAY * days_in_year(¤t, -1);
|
||||
} else if (month > current.tm_mon + 1) {
|
||||
now_time += ONE_DAY * days_in_month(¤t, 0);
|
||||
} else if (month < current.tm_mon + 1) {
|
||||
now_time -= ONE_DAY * days_in_month(¤t, -1);
|
||||
} else if (day > current.tm_mday) {
|
||||
now_time += ONE_DAY;
|
||||
} else if (day < current.tm_mday) {
|
||||
now_time -= ONE_DAY;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
current = *localtime(&now_time);
|
||||
}
|
||||
}
|
||||
|
||||
dlg_button_sizes(buttons, FALSE, &longest, &mincols);
|
||||
mincols += (0 * MARGIN) + (dlg_button_count(buttons) * 3) - 1;
|
||||
if (mincols < MIN_WIDE)
|
||||
mincols = MIN_WIDE;
|
||||
dlg_auto_size(title, prompt, &height, &width, 0, mincols);
|
||||
height += MIN_HIGH - 1;
|
||||
if (width < MIN_WIDE)
|
||||
width = MIN_WIDE;
|
||||
dlg_print_size(height, width);
|
||||
dlg_ctl_size(height, width);
|
||||
|
||||
/* FIXME: how to make this resizable? */
|
||||
dialog = dlg_new_window(height, width,
|
||||
dlg_box_y_ordinate(height),
|
||||
dlg_box_x_ordinate(width));
|
||||
|
||||
dlg_draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); /* mainbox */
|
||||
dlg_draw_bottom_box(dialog);
|
||||
dlg_draw_title(dialog, title);
|
||||
|
||||
wattrset(dialog, dialog_attr); /* text mainbox */
|
||||
dlg_print_autowrap(dialog, prompt, height, width);
|
||||
|
||||
/* compute positions of day, month and year boxes */
|
||||
memset(&dy_box, 0, sizeof(dy_box));
|
||||
memset(&mn_box, 0, sizeof(mn_box));
|
||||
memset(&yr_box, 0, sizeof(yr_box));
|
||||
|
||||
if (init_object(&dy_box,
|
||||
dialog,
|
||||
(width - DAY_WIDE) / 2,
|
||||
1 + (height - (DAY_HIGH + BTN_HIGH + (5 * MARGIN))),
|
||||
DAY_WIDE,
|
||||
DAY_HIGH + 1,
|
||||
draw_day,
|
||||
'D') < 0
|
||||
|| DrawObject(&dy_box) < 0)
|
||||
return DLG_EXIT_ERROR;
|
||||
|
||||
if (init_object(&mn_box,
|
||||
dialog,
|
||||
dy_box.x,
|
||||
dy_box.y - (HDR_HIGH + 2 * MARGIN),
|
||||
(DAY_WIDE / 2) - MARGIN,
|
||||
HDR_HIGH,
|
||||
draw_month,
|
||||
'M') < 0
|
||||
|| DrawObject(&mn_box) < 0)
|
||||
return DLG_EXIT_ERROR;
|
||||
|
||||
if (init_object(&yr_box,
|
||||
dialog,
|
||||
dy_box.x + mn_box.width + 2,
|
||||
mn_box.y,
|
||||
mn_box.width,
|
||||
mn_box.height,
|
||||
draw_year,
|
||||
'Y') < 0
|
||||
|| DrawObject(&yr_box) < 0)
|
||||
return DLG_EXIT_ERROR;
|
||||
|
||||
while (result == DLG_EXIT_UNKNOWN) {
|
||||
BOX *obj = (state == sDAY ? &dy_box
|
||||
: (state == sMONTH ? &mn_box :
|
||||
(state == sYEAR ? &yr_box : 0)));
|
||||
|
||||
button = (state < 0) ? 0 : state;
|
||||
dlg_draw_buttons(dialog, height - 2, 0, buttons, button, FALSE, width);
|
||||
if (obj != 0)
|
||||
dlg_set_focus(dialog, obj->window);
|
||||
|
||||
key = dlg_mouse_wgetch(dialog, &fkey);
|
||||
|
||||
if ((key2 = dlg_char_to_button(key, buttons)) >= 0) {
|
||||
result = key2;
|
||||
} else {
|
||||
/* handle non-functionkeys */
|
||||
if (!fkey) {
|
||||
fkey = TRUE;
|
||||
switch (key) {
|
||||
case ' ':
|
||||
case '\n':
|
||||
case '\r':
|
||||
key = KEY_ENTER;
|
||||
break;
|
||||
case TAB:
|
||||
key = DLGK_NEXT_FIELD;
|
||||
break;
|
||||
case CHR_PREVIOUS:
|
||||
case CHR_NEXT:
|
||||
case CHR_BACKSPACE:
|
||||
case 'h':
|
||||
case 'j':
|
||||
case 'k':
|
||||
case 'l':
|
||||
/* treat these as function-keys */
|
||||
break;
|
||||
case ESC:
|
||||
result = DLG_EXIT_ESC;
|
||||
fkey = FALSE;
|
||||
break;
|
||||
default:
|
||||
fkey = FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* handle functionkeys */
|
||||
if (fkey) {
|
||||
switch (key) {
|
||||
case M_EVENT + 'D':
|
||||
state = sDAY;
|
||||
break;
|
||||
case M_EVENT + 'M':
|
||||
state = sMONTH;
|
||||
break;
|
||||
case M_EVENT + 'Y':
|
||||
state = sYEAR;
|
||||
break;
|
||||
case KEY_ENTER:
|
||||
result = dlg_ok_buttoncode(button);
|
||||
break;
|
||||
case DLGK_PREV_FIELD:
|
||||
case KEY_BTAB:
|
||||
state = dlg_prev_ok_buttonindex(state, sMONTH);
|
||||
break;
|
||||
case DLGK_NEXT_FIELD:
|
||||
state = dlg_next_ok_buttonindex(state, sMONTH);
|
||||
break;
|
||||
default:
|
||||
step = 0;
|
||||
key2 = -1;
|
||||
if (key >= M_EVENT) {
|
||||
if ((key2 = dlg_ok_buttoncode(key - M_EVENT)) >= 0) {
|
||||
result = key2;
|
||||
break;
|
||||
} else if (key >= (M_EVENT + KEY_MAX)) {
|
||||
state = sDAY;
|
||||
obj = &dy_box;
|
||||
key2 = 1;
|
||||
step = (key
|
||||
- (M_EVENT + KEY_MAX)
|
||||
- day_cell_number(¤t));
|
||||
}
|
||||
}
|
||||
if (obj != 0) {
|
||||
if (key2 < 0)
|
||||
step = next_or_previous(key, (obj == &dy_box));
|
||||
if (step != 0) {
|
||||
struct tm old = current;
|
||||
|
||||
/* see comment regarding mktime -TD */
|
||||
if (obj == &dy_box) {
|
||||
now_time += ONE_DAY * step;
|
||||
} else if (obj == &mn_box) {
|
||||
if (step > 0)
|
||||
now_time += ONE_DAY *
|
||||
days_in_month(¤t, 0);
|
||||
else
|
||||
now_time -= ONE_DAY *
|
||||
days_in_month(¤t, -1);
|
||||
} else if (obj == &yr_box) {
|
||||
if (step > 0)
|
||||
now_time += (ONE_DAY
|
||||
* days_in_year(¤t, 0));
|
||||
else
|
||||
now_time -= (ONE_DAY
|
||||
* days_in_year(¤t, -1));
|
||||
}
|
||||
|
||||
current = *localtime(&now_time);
|
||||
|
||||
if (obj != &dy_box
|
||||
&& (current.tm_mday != old.tm_mday
|
||||
|| current.tm_mon != old.tm_mon
|
||||
|| current.tm_year != old.tm_year))
|
||||
DrawObject(&dy_box);
|
||||
if (obj != &mn_box && current.tm_mon != old.tm_mon)
|
||||
DrawObject(&mn_box);
|
||||
if (obj != &yr_box && current.tm_year != old.tm_year)
|
||||
DrawObject(&yr_box);
|
||||
(void) DrawObject(obj);
|
||||
}
|
||||
} else if (state >= 0) {
|
||||
if (next_or_previous(key, FALSE) < 0)
|
||||
state = dlg_prev_ok_buttonindex(state, sMONTH);
|
||||
else if (next_or_previous(key, FALSE) > 0)
|
||||
state = dlg_next_ok_buttonindex(state, sMONTH);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dlg_del_window(dialog);
|
||||
sprintf(dialog_vars.input_result, "%02d/%02d/%0d\n",
|
||||
current.tm_mday, current.tm_mon + 1, current.tm_year + 1900);
|
||||
dlg_mouse_free_regions();
|
||||
free(prompt);
|
||||
return result;
|
||||
}
|
||||
BIN
extra/dialog-1.0-20050306/calendar.o
Normal file
BIN
extra/dialog-1.0-20050306/calendar.o
Normal file
Binary file not shown.
575
extra/dialog-1.0-20050306/checklist.c
Normal file
575
extra/dialog-1.0-20050306/checklist.c
Normal file
@@ -0,0 +1,575 @@
|
||||
/*
|
||||
* $Id: checklist.c,v 1.83 2004/12/20 20:42:58 tom Exp $
|
||||
*
|
||||
* checklist.c -- implements the checklist box
|
||||
*
|
||||
* AUTHOR: Savio Lam (lam836@cs.cuhk.hk)
|
||||
* Stuart Herbert - S.Herbert@sheffield.ac.uk: radiolist extension
|
||||
* Alessandro Rubini - rubini@ipvvis.unipv.it: merged the two
|
||||
* Thomas E. Dickey - rewrote...
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include "dialog.h"
|
||||
|
||||
static int list_width, check_x, item_x, checkflag;
|
||||
|
||||
#define LLEN(n) ((n) * CHECKBOX_TAGS)
|
||||
#define ItemData(i) &items[LLEN(i)]
|
||||
#define ItemName(i) items[LLEN(i)]
|
||||
#define ItemText(i) items[LLEN(i) + 1]
|
||||
#define ItemStatus(i) items[LLEN(i) + 2]
|
||||
#define ItemHelp(i) items[LLEN(i) + 3]
|
||||
|
||||
static void
|
||||
print_arrows(WINDOW *win,
|
||||
int box_x,
|
||||
int box_y,
|
||||
int scrollamt,
|
||||
int choice,
|
||||
int item_no,
|
||||
int list_height)
|
||||
{
|
||||
dlg_draw_arrows2(win, scrollamt,
|
||||
scrollamt + choice < item_no - 1,
|
||||
box_x + check_x + 5,
|
||||
box_y,
|
||||
box_y + list_height + 1,
|
||||
menubox_attr,
|
||||
menubox_border_attr);
|
||||
}
|
||||
|
||||
/*
|
||||
* Print list item
|
||||
*/
|
||||
static void
|
||||
print_item(WINDOW *win, char **items, int status,
|
||||
int choice, int selected)
|
||||
{
|
||||
chtype save = getattrs(win);
|
||||
int i;
|
||||
chtype attr = A_NORMAL;
|
||||
const int *indx;
|
||||
int limit;
|
||||
|
||||
/* Clear 'residue' of last item */
|
||||
wattrset(win, menubox_attr);
|
||||
(void) wmove(win, choice, 0);
|
||||
for (i = 0; i < list_width; i++)
|
||||
(void) waddch(win, ' ');
|
||||
|
||||
(void) wmove(win, choice, check_x);
|
||||
wattrset(win, selected ? check_selected_attr : check_attr);
|
||||
(void) wprintw(win,
|
||||
(checkflag == FLAG_CHECK) ? "[%c]" : "(%c)",
|
||||
status ? 'X' : ' ');
|
||||
wattrset(win, menubox_attr);
|
||||
(void) waddch(win, ' ');
|
||||
|
||||
if (strlen(ItemName(0)) != 0) {
|
||||
|
||||
indx = dlg_index_wchars(ItemName(0));
|
||||
limit = dlg_count_wchars(ItemName(0));
|
||||
|
||||
wattrset(win, selected ? tag_key_selected_attr : tag_key_attr);
|
||||
(void) waddnstr(win, ItemName(0), indx[1]);
|
||||
|
||||
if ((int) strlen(ItemName(0)) > indx[1]) {
|
||||
limit = dlg_limit_columns(ItemName(0), (item_x - check_x - 6), 1);
|
||||
if (limit > 1) {
|
||||
wattrset(win, selected ? tag_selected_attr : tag_attr);
|
||||
(void) waddnstr(win,
|
||||
ItemName(0) + indx[1],
|
||||
indx[limit] - indx[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (strlen(ItemText(0)) != 0) {
|
||||
indx = dlg_index_wchars(ItemText(0));
|
||||
limit = dlg_limit_columns(ItemText(0), (getmaxx(win) - item_x - 1), 0);
|
||||
|
||||
if (limit > 0) {
|
||||
(void) wmove(win, choice, item_x);
|
||||
wattrset(win, selected ? item_selected_attr : item_attr);
|
||||
dlg_print_text(win, ItemText(0), indx[limit], &attr);
|
||||
}
|
||||
}
|
||||
|
||||
if (selected) {
|
||||
dlg_item_help(ItemHelp(0));
|
||||
}
|
||||
wattrset(win, save);
|
||||
}
|
||||
|
||||
/*
|
||||
* Display a dialog box with a list of options that can be turned on or off
|
||||
* The `flag' parameter is used to select between radiolist and checklist.
|
||||
*/
|
||||
int
|
||||
dialog_checklist(const char *title, const char *cprompt, int height, int width,
|
||||
int list_height, int item_no, char **items, int flag)
|
||||
{
|
||||
bool show_status = FALSE;
|
||||
bool separate_output = ((flag == FLAG_CHECK)
|
||||
&& (dialog_vars.separate_output));
|
||||
int i, j, key2, found, x, y, cur_x, cur_y, box_x, box_y;
|
||||
int key = 0, fkey;
|
||||
int button = dialog_state.visit_items ? -1 : dlg_defaultno_button();
|
||||
int choice = dlg_default_item(items, CHECKBOX_TAGS);
|
||||
int scrollamt = 0;
|
||||
int max_choice, *status;
|
||||
int use_width, name_width, text_width;
|
||||
int result = DLG_EXIT_UNKNOWN;
|
||||
WINDOW *dialog, *list;
|
||||
char *prompt = dlg_strclone(cprompt);
|
||||
const char **buttons = dlg_ok_labels();
|
||||
|
||||
dlg_tab_correct_str(prompt);
|
||||
if (list_height == 0) {
|
||||
use_width = dlg_calc_listw(item_no, items, CHECKBOX_TAGS) + 10;
|
||||
/* calculate height without items (4) */
|
||||
dlg_auto_size(title, prompt, &height, &width, 4, MAX(26, use_width));
|
||||
dlg_calc_listh(&height, &list_height, item_no);
|
||||
} else {
|
||||
dlg_auto_size(title, prompt, &height, &width, 4 + list_height, 26);
|
||||
}
|
||||
dlg_print_size(height, width);
|
||||
dlg_ctl_size(height, width);
|
||||
|
||||
checkflag = flag;
|
||||
|
||||
/* Allocate space for storing item on/off status */
|
||||
status = malloc(sizeof(int) * item_no);
|
||||
assert_ptr(status, "dialog_checklist");
|
||||
|
||||
/* Initializes status */
|
||||
for (i = 0; i < item_no; i++)
|
||||
status[i] = !dlg_strcmp(ItemStatus(i), "on");
|
||||
|
||||
max_choice = MIN(list_height, item_no);
|
||||
|
||||
x = dlg_box_x_ordinate(width);
|
||||
y = dlg_box_y_ordinate(height);
|
||||
|
||||
dialog = dlg_new_window(height, width, y, x);
|
||||
|
||||
dlg_mouse_setbase(x, y);
|
||||
|
||||
dlg_draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr);
|
||||
dlg_draw_bottom_box(dialog);
|
||||
dlg_draw_title(dialog, title);
|
||||
|
||||
wattrset(dialog, dialog_attr);
|
||||
dlg_print_autowrap(dialog, prompt, height, width);
|
||||
|
||||
list_width = width - 6;
|
||||
getyx(dialog, cur_y, cur_x);
|
||||
box_y = cur_y + 1;
|
||||
box_x = (width - list_width) / 2 - 1;
|
||||
|
||||
/* create new window for the list */
|
||||
list = dlg_sub_window(dialog, list_height, list_width,
|
||||
y + box_y + 1, x + box_x + 1);
|
||||
|
||||
/* draw a box around the list items */
|
||||
dlg_draw_box(dialog, box_y, box_x,
|
||||
list_height + 2 * MARGIN,
|
||||
list_width + 2 * MARGIN,
|
||||
menubox_border_attr, menubox_attr);
|
||||
|
||||
text_width = 0;
|
||||
name_width = 0;
|
||||
/* Find length of longest item to center checklist */
|
||||
for (i = 0; i < item_no; i++) {
|
||||
text_width = MAX(text_width, (int) strlen(ItemText(i)));
|
||||
name_width = MAX(name_width, (int) strlen(ItemName(i)));
|
||||
}
|
||||
|
||||
/* If the name+text is wider than the list is allowed, then truncate
|
||||
* one or both of them. If the name is no wider than 1/4 of the list,
|
||||
* leave it intact.
|
||||
*/
|
||||
use_width = (list_width - 6);
|
||||
if (text_width + name_width > use_width) {
|
||||
int need = 0.25 * use_width;
|
||||
if (name_width > need) {
|
||||
int want = use_width * ((double) name_width) / (text_width + name_width);
|
||||
name_width = (want > need) ? want : need;
|
||||
}
|
||||
text_width = use_width - name_width;
|
||||
}
|
||||
|
||||
check_x = (use_width - (text_width + name_width)) / 2;
|
||||
item_x = name_width + check_x + 6;
|
||||
|
||||
/* Print the list */
|
||||
if (choice >= (max_choice + scrollamt)) {
|
||||
scrollamt = choice - max_choice + 1;
|
||||
choice = max_choice - 1;
|
||||
}
|
||||
for (i = 0; i < max_choice; i++)
|
||||
print_item(list,
|
||||
ItemData(i + scrollamt),
|
||||
status[i + scrollamt], i, i == choice);
|
||||
(void) wnoutrefresh(list);
|
||||
|
||||
/* register the new window, along with its borders */
|
||||
dlg_mouse_mkbigregion(box_y + 1, box_x, list_height, list_width + 2,
|
||||
KEY_MAX, 1, 1, 1 /* by lines */ );
|
||||
|
||||
print_arrows(dialog,
|
||||
box_x, box_y,
|
||||
scrollamt, choice, item_no, list_height);
|
||||
|
||||
dlg_draw_buttons(dialog, height - 2, 0, buttons, button, FALSE, width);
|
||||
|
||||
while (result == DLG_EXIT_UNKNOWN) {
|
||||
if (button < 0) /* --visit-items */
|
||||
wmove(dialog, box_y + choice + 1, box_x + check_x + 2);
|
||||
|
||||
key = dlg_mouse_wgetch(dialog, &fkey);
|
||||
|
||||
if (fkey && (key >= (M_EVENT + KEY_MAX))) {
|
||||
getyx(dialog, cur_y, cur_x);
|
||||
i = (key - (M_EVENT + KEY_MAX));
|
||||
if (scrollamt + i < max_choice) {
|
||||
/* De-highlight current item */
|
||||
print_item(list,
|
||||
ItemData(scrollamt + choice),
|
||||
status[scrollamt + choice], choice, FALSE);
|
||||
/* Highlight new item */
|
||||
choice = (key - (M_EVENT + KEY_MAX));
|
||||
print_item(list,
|
||||
ItemData(scrollamt + choice),
|
||||
status[scrollamt + choice], choice, TRUE);
|
||||
(void) wnoutrefresh(list);
|
||||
(void) wmove(dialog, cur_y, cur_x);
|
||||
|
||||
key = ' '; /* force the selected item to toggle */
|
||||
} else {
|
||||
beep();
|
||||
continue;
|
||||
}
|
||||
fkey = FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* A space toggles the item status. We handle either a checklist
|
||||
* (any number of items can be selected) or radio list (zero or one
|
||||
* items can be selected).
|
||||
*/
|
||||
if (key == ' ') {
|
||||
getyx(dialog, cur_y, cur_x);
|
||||
if (flag == FLAG_CHECK) { /* checklist? */
|
||||
status[scrollamt + choice] = !status[scrollamt + choice];
|
||||
print_item(list,
|
||||
ItemData(scrollamt + choice),
|
||||
status[scrollamt + choice], choice, TRUE);
|
||||
} else { /* radiolist */
|
||||
if (!status[scrollamt + choice]) {
|
||||
for (i = 0; i < item_no; i++)
|
||||
status[i] = FALSE;
|
||||
status[scrollamt + choice] = TRUE;
|
||||
for (i = 0; i < max_choice; i++)
|
||||
print_item(list,
|
||||
ItemData(scrollamt + i),
|
||||
status[scrollamt + i], i, i == choice);
|
||||
}
|
||||
}
|
||||
(void) wnoutrefresh(list);
|
||||
(void) wmove(dialog, cur_y, cur_x);
|
||||
wrefresh(dialog);
|
||||
continue; /* wait for another key press */
|
||||
} else if (key == ESC) {
|
||||
result = DLG_EXIT_ESC;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!fkey) {
|
||||
fkey = TRUE;
|
||||
switch (key) {
|
||||
case '\n':
|
||||
case '\r':
|
||||
key = KEY_ENTER;
|
||||
break;
|
||||
case '-':
|
||||
key = KEY_UP;
|
||||
break;
|
||||
case '+':
|
||||
key = KEY_DOWN;
|
||||
break;
|
||||
case TAB:
|
||||
key = KEY_RIGHT;
|
||||
break;
|
||||
default:
|
||||
fkey = FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if key pressed matches first character of any item tag in
|
||||
* list. If there is more than one match, we will cycle through
|
||||
* each one as the same key is pressed repeatedly.
|
||||
*/
|
||||
found = FALSE;
|
||||
if (!fkey) {
|
||||
if (button < 0 || !dialog_state.visit_items) {
|
||||
for (j = scrollamt + choice + 1; j < item_no; j++) {
|
||||
if (dlg_match_char(dlg_last_getc(), ItemName(j))) {
|
||||
found = TRUE;
|
||||
i = j - scrollamt;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
for (j = 0; j <= scrollamt + choice; j++) {
|
||||
if (dlg_match_char(dlg_last_getc(), ItemName(j))) {
|
||||
found = TRUE;
|
||||
i = j - scrollamt;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
dlg_flush_getc();
|
||||
} else if ((j = dlg_char_to_button(key, buttons)) >= 0) {
|
||||
button = j;
|
||||
ungetch('\n');
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* A single digit (1-9) positions the selection to that line in the
|
||||
* current screen.
|
||||
*/
|
||||
if (!found
|
||||
&& (key <= '9')
|
||||
&& (key > '0')
|
||||
&& (key - '1' < max_choice)) {
|
||||
found = TRUE;
|
||||
i = key - '1';
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
if (fkey) {
|
||||
found = TRUE;
|
||||
switch (key) {
|
||||
case KEY_HOME:
|
||||
i = -scrollamt;
|
||||
break;
|
||||
case KEY_LL:
|
||||
case KEY_END:
|
||||
i = item_no - 1 - scrollamt;
|
||||
break;
|
||||
case M_EVENT + KEY_PPAGE:
|
||||
case KEY_PPAGE:
|
||||
if (choice)
|
||||
i = 0;
|
||||
else if (scrollamt != 0)
|
||||
i = -MIN(scrollamt, max_choice);
|
||||
else
|
||||
continue;
|
||||
break;
|
||||
case M_EVENT + KEY_NPAGE:
|
||||
case KEY_NPAGE:
|
||||
i = MIN(choice + max_choice, item_no - scrollamt - 1);
|
||||
break;
|
||||
case KEY_UP:
|
||||
i = choice - 1;
|
||||
if (choice == 0 && scrollamt == 0)
|
||||
continue;
|
||||
break;
|
||||
case KEY_DOWN:
|
||||
i = choice + 1;
|
||||
if (scrollamt + choice >= item_no - 1)
|
||||
continue;
|
||||
break;
|
||||
default:
|
||||
found = FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (found) {
|
||||
if (i != choice) {
|
||||
getyx(dialog, cur_y, cur_x);
|
||||
if (i < 0 || i >= max_choice) {
|
||||
#if defined(NCURSES_VERSION_MAJOR) && NCURSES_VERSION_MAJOR < 5
|
||||
/*
|
||||
* Using wscrl to assist ncurses scrolling is not needed
|
||||
* in version 5.x
|
||||
*/
|
||||
if (i == -1) {
|
||||
if (list_height > 1) {
|
||||
/* De-highlight current first item */
|
||||
print_item(list,
|
||||
ItemData(scrollamt),
|
||||
status[scrollamt], 0, FALSE);
|
||||
scrollok(list, TRUE);
|
||||
wscrl(list, -1);
|
||||
scrollok(list, FALSE);
|
||||
}
|
||||
scrollamt--;
|
||||
print_item(list,
|
||||
ItemData(scrollamt),
|
||||
status[scrollamt], 0, TRUE);
|
||||
} else if (i == max_choice) {
|
||||
if (list_height > 1) {
|
||||
/* De-highlight current last item before scrolling up */
|
||||
print_item(list,
|
||||
ItemData(scrollamt + max_choice - 1),
|
||||
status[scrollamt + max_choice - 1],
|
||||
max_choice - 1, FALSE);
|
||||
scrollok(list, TRUE);
|
||||
wscrl(list, 1);
|
||||
scrollok(list, FALSE);
|
||||
}
|
||||
scrollamt++;
|
||||
print_item(list,
|
||||
ItemData(scrollamt + max_choice - 1),
|
||||
status[scrollamt + max_choice - 1],
|
||||
max_choice - 1, TRUE);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
if (i < 0) {
|
||||
scrollamt += i;
|
||||
choice = 0;
|
||||
} else {
|
||||
choice = max_choice - 1;
|
||||
scrollamt += (i - max_choice + 1);
|
||||
}
|
||||
for (i = 0; i < max_choice; i++) {
|
||||
print_item(list,
|
||||
ItemData(scrollamt + i),
|
||||
status[scrollamt + i], i, i == choice);
|
||||
}
|
||||
}
|
||||
(void) wnoutrefresh(list);
|
||||
print_arrows(dialog,
|
||||
box_x, box_y,
|
||||
scrollamt, choice, item_no, list_height);
|
||||
} else {
|
||||
/* De-highlight current item */
|
||||
print_item(list,
|
||||
ItemData(scrollamt + choice),
|
||||
status[scrollamt + choice], choice, FALSE);
|
||||
/* Highlight new item */
|
||||
choice = i;
|
||||
print_item(list,
|
||||
ItemData(scrollamt + choice),
|
||||
status[scrollamt + choice], choice, TRUE);
|
||||
(void) wnoutrefresh(list);
|
||||
(void) wmove(dialog, cur_y, cur_x);
|
||||
wrefresh(dialog);
|
||||
}
|
||||
}
|
||||
continue; /* wait for another key press */
|
||||
}
|
||||
|
||||
if (fkey) {
|
||||
switch (key) {
|
||||
case KEY_ENTER:
|
||||
result = dlg_ok_buttoncode(button);
|
||||
break;
|
||||
case KEY_BTAB:
|
||||
case KEY_LEFT:
|
||||
button = dlg_prev_button(buttons, button);
|
||||
dlg_draw_buttons(dialog, height - 2, 0, buttons, button,
|
||||
FALSE, width);
|
||||
break;
|
||||
case KEY_RIGHT:
|
||||
button = dlg_next_button(buttons, button);
|
||||
dlg_draw_buttons(dialog, height - 2, 0, buttons, button,
|
||||
FALSE, width);
|
||||
break;
|
||||
default:
|
||||
if (key >= M_EVENT) {
|
||||
if ((key2 = dlg_ok_buttoncode(key - M_EVENT)) >= 0) {
|
||||
result = key2;
|
||||
break;
|
||||
}
|
||||
beep();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
beep();
|
||||
}
|
||||
}
|
||||
|
||||
dlg_del_window(dialog);
|
||||
switch (result) {
|
||||
case DLG_EXIT_OK: /* FALLTHRU */
|
||||
case DLG_EXIT_EXTRA:
|
||||
show_status = TRUE;
|
||||
break;
|
||||
case DLG_EXIT_HELP:
|
||||
dlg_add_result("HELP ");
|
||||
show_status = dialog_vars.help_status;
|
||||
if (USE_ITEM_HELP(ItemHelp(scrollamt + choice))) {
|
||||
if (show_status) {
|
||||
if (separate_output) {
|
||||
dlg_add_result(ItemHelp(scrollamt + choice));
|
||||
dlg_add_result("\n");
|
||||
} else {
|
||||
dlg_add_quoted(ItemHelp(scrollamt + choice));
|
||||
}
|
||||
} else {
|
||||
dlg_add_result(ItemHelp(scrollamt + choice));
|
||||
}
|
||||
result = DLG_EXIT_ITEM_HELP;
|
||||
} else {
|
||||
if (show_status) {
|
||||
if (separate_output) {
|
||||
dlg_add_result(ItemName(scrollamt + choice));
|
||||
dlg_add_result("\n");
|
||||
} else {
|
||||
dlg_add_quoted(ItemName(scrollamt + choice));
|
||||
}
|
||||
} else {
|
||||
dlg_add_result(ItemName(scrollamt + choice));
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (show_status) {
|
||||
for (i = 0; i < item_no; i++) {
|
||||
if (status[i]) {
|
||||
if (separate_output) {
|
||||
dlg_add_result(ItemName(i));
|
||||
dlg_add_result("\n");
|
||||
} else {
|
||||
if (*(dialog_vars.input_result))
|
||||
dlg_add_result(" ");
|
||||
if (flag == FLAG_CHECK) {
|
||||
dlg_add_quoted(ItemName(i));
|
||||
} else {
|
||||
dlg_add_result(ItemName(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
dlg_mouse_free_regions();
|
||||
free(status);
|
||||
free(prompt);
|
||||
return result;
|
||||
}
|
||||
BIN
extra/dialog-1.0-20050306/checklist.o
Normal file
BIN
extra/dialog-1.0-20050306/checklist.o
Normal file
Binary file not shown.
1453
extra/dialog-1.0-20050306/config.guess
vendored
Executable file
1453
extra/dialog-1.0-20050306/config.guess
vendored
Executable file
File diff suppressed because it is too large
Load Diff
4
extra/dialog-1.0-20050306/config.hin
Normal file
4
extra/dialog-1.0-20050306/config.hin
Normal file
@@ -0,0 +1,4 @@
|
||||
/*
|
||||
* The configure script expands this as a set of definitions
|
||||
*/
|
||||
@DEFS@
|
||||
1142
extra/dialog-1.0-20050306/config.log
Normal file
1142
extra/dialog-1.0-20050306/config.log
Normal file
File diff suppressed because it is too large
Load Diff
797
extra/dialog-1.0-20050306/config.status
Executable file
797
extra/dialog-1.0-20050306/config.status
Executable file
@@ -0,0 +1,797 @@
|
||||
#! /bin/sh
|
||||
# Generated automatically by configure.
|
||||
# Run this file to recreate the current configuration.
|
||||
# Compiler output produced by configure, useful for debugging
|
||||
# configure, is in config.log if it exists.
|
||||
|
||||
debug=false
|
||||
SHELL=${CONFIG_SHELL-/bin/sh}
|
||||
ac_cs_invocation="$0 $@"
|
||||
|
||||
# Be Bourne compatible
|
||||
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
|
||||
emulate sh
|
||||
NULLCMD=:
|
||||
elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
|
||||
set -o posix
|
||||
fi
|
||||
|
||||
# Name of the executable.
|
||||
as_me=`echo "$0" |sed 's,.*[\\/],,'`
|
||||
|
||||
if expr a : '\(a\)' >/dev/null 2>&1; then
|
||||
as_expr=expr
|
||||
else
|
||||
as_expr=false
|
||||
fi
|
||||
|
||||
rm -f conf$$ conf$$.exe conf$$.file
|
||||
echo >conf$$.file
|
||||
if ln -s conf$$.file conf$$ 2>/dev/null; then
|
||||
# We could just check for DJGPP; but this test a) works b) is more generic
|
||||
# and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
|
||||
if test -f conf$$.exe; then
|
||||
# Don't use ln at all; we don't have any links
|
||||
as_ln_s='cp -p'
|
||||
else
|
||||
as_ln_s='ln -s'
|
||||
fi
|
||||
elif ln conf$$.file conf$$ 2>/dev/null; then
|
||||
as_ln_s=ln
|
||||
else
|
||||
as_ln_s='cp -p'
|
||||
fi
|
||||
rm -f conf$$ conf$$.exe conf$$.file
|
||||
|
||||
as_executable_p="test -f"
|
||||
|
||||
# Support unset when possible.
|
||||
if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
|
||||
as_unset=unset
|
||||
else
|
||||
as_unset=false
|
||||
fi
|
||||
|
||||
# NLS nuisances.
|
||||
$as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; }
|
||||
$as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; }
|
||||
$as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; }
|
||||
$as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; }
|
||||
$as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; }
|
||||
$as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; }
|
||||
$as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; }
|
||||
$as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; }
|
||||
|
||||
# IFS
|
||||
# We need space, tab and new line, in precisely that order.
|
||||
as_nl='
|
||||
'
|
||||
IFS=" $as_nl"
|
||||
|
||||
# CDPATH.
|
||||
$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; }
|
||||
|
||||
exec 6>&1
|
||||
|
||||
config_files=" makefile samples/install/makefile"
|
||||
config_headers=" dlg_config.h:config.hin"
|
||||
config_commands=" default-1 default"
|
||||
|
||||
ac_cs_usage="\
|
||||
\`$as_me' instantiates files from templates according to the
|
||||
current configuration.
|
||||
|
||||
Usage: $0 [OPTIONS] [FILE]...
|
||||
|
||||
-h, --help print this help, then exit
|
||||
-V, --version print version number, then exit
|
||||
-d, --debug don't remove temporary files
|
||||
--recheck update $as_me by reconfiguring in the same conditions
|
||||
--file=FILE[:TEMPLATE]
|
||||
instantiate the configuration file FILE
|
||||
--header=FILE[:TEMPLATE]
|
||||
instantiate the configuration header FILE
|
||||
|
||||
Configuration files:
|
||||
$config_files
|
||||
|
||||
Configuration headers:
|
||||
$config_headers
|
||||
|
||||
Configuration commands:
|
||||
$config_commands
|
||||
|
||||
Report bugs to <bug-autoconf@gnu.org>."
|
||||
ac_cs_version="\
|
||||
config.status
|
||||
configured by ./configure, generated by GNU Autoconf 2.52.20030208,
|
||||
with options \"\"
|
||||
|
||||
Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
|
||||
Free Software Foundation, Inc.
|
||||
This config.status script is free software; the Free Software Foundation
|
||||
gives unlimited permission to copy, distribute and modify it."
|
||||
srcdir=.
|
||||
INSTALL="/bin/install -c"
|
||||
# If no file are specified by the user, then we need to provide default
|
||||
# value. By we need to know if files were specified by the user.
|
||||
ac_need_defaults=:
|
||||
while test $# != 0
|
||||
do
|
||||
case $1 in
|
||||
--*=*)
|
||||
ac_option=`expr "x$1" : 'x\([^=]*\)='`
|
||||
ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
|
||||
shift
|
||||
set dummy "$ac_option" "$ac_optarg" ${1+"$@"}
|
||||
shift
|
||||
;;
|
||||
-*);;
|
||||
*) # This is not an option, so the user has probably given explicit
|
||||
# arguments.
|
||||
ac_need_defaults=false;;
|
||||
esac
|
||||
|
||||
case $1 in
|
||||
# Handling of the options.
|
||||
-recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
|
||||
echo "running /bin/sh ./configure " " --no-create --no-recursion"
|
||||
exec /bin/sh ./configure --no-create --no-recursion ;;
|
||||
--version | --vers* | -V )
|
||||
echo "$ac_cs_version"; exit 0 ;;
|
||||
--he | --h)
|
||||
# Conflict between --help and --header
|
||||
{ { echo "$as_me:9448: error: ambiguous option: $1
|
||||
Try \`$0 --help' for more information." >&5
|
||||
echo "$as_me: error: ambiguous option: $1
|
||||
Try \`$0 --help' for more information." >&2;}
|
||||
{ (exit 1); exit 1; }; };;
|
||||
--help | --hel | -h )
|
||||
echo "$ac_cs_usage"; exit 0 ;;
|
||||
--debug | --d* | -d )
|
||||
debug=: ;;
|
||||
--file | --fil | --fi | --f )
|
||||
shift
|
||||
CONFIG_FILES="$CONFIG_FILES $1"
|
||||
ac_need_defaults=false;;
|
||||
--header | --heade | --head | --hea )
|
||||
shift
|
||||
CONFIG_HEADERS="$CONFIG_HEADERS $1"
|
||||
ac_need_defaults=false;;
|
||||
|
||||
# This is an error.
|
||||
-*) { { echo "$as_me:9467: error: unrecognized option: $1
|
||||
Try \`$0 --help' for more information." >&5
|
||||
echo "$as_me: error: unrecognized option: $1
|
||||
Try \`$0 --help' for more information." >&2;}
|
||||
{ (exit 1); exit 1; }; } ;;
|
||||
|
||||
*) ac_config_targets="$ac_config_targets $1" ;;
|
||||
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
exec 5>>config.log
|
||||
cat >&5 << _ACEOF
|
||||
|
||||
## ----------------------- ##
|
||||
## Running config.status. ##
|
||||
## ----------------------- ##
|
||||
|
||||
This file was extended by $as_me 2.52.20030208, executed with
|
||||
CONFIG_FILES = $CONFIG_FILES
|
||||
CONFIG_HEADERS = $CONFIG_HEADERS
|
||||
CONFIG_LINKS = $CONFIG_LINKS
|
||||
CONFIG_COMMANDS = $CONFIG_COMMANDS
|
||||
> $ac_cs_invocation
|
||||
on `(hostname || uname -n) 2>/dev/null | sed 1q`
|
||||
|
||||
_ACEOF
|
||||
#
|
||||
# INIT-COMMANDS section.
|
||||
#
|
||||
|
||||
for ac_config_target in $ac_config_targets
|
||||
do
|
||||
case "$ac_config_target" in
|
||||
# Handling of arguments.
|
||||
"makefile" ) CONFIG_FILES="$CONFIG_FILES makefile" ;;
|
||||
"$SUB_MAKEFILE" ) CONFIG_FILES="$CONFIG_FILES $SUB_MAKEFILE" ;;
|
||||
"samples/install/makefile" ) CONFIG_FILES="$CONFIG_FILES samples/install/makefile" ;;
|
||||
"default-1" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
|
||||
"default" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;;
|
||||
"dlg_config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS dlg_config.h:config.hin" ;;
|
||||
*) { { echo "$as_me:9515: error: invalid argument: $ac_config_target" >&5
|
||||
echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
|
||||
{ (exit 1); exit 1; }; };;
|
||||
esac
|
||||
done
|
||||
|
||||
# If the user did not use the arguments to specify the items to instantiate,
|
||||
# then the envvar interface is used. Set only those that are not.
|
||||
# We use the long form for the default assignment because of an extremely
|
||||
# bizarre bug on SunOS 4.1.3.
|
||||
if $ac_need_defaults; then
|
||||
test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
|
||||
test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
|
||||
test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
|
||||
fi
|
||||
|
||||
# Create a temporary directory, and hook for its removal unless debugging.
|
||||
$debug ||
|
||||
{
|
||||
trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
|
||||
trap '{ (exit 1); exit 1; }' 1 2 13 15
|
||||
}
|
||||
|
||||
# Create a (secure) tmp directory for tmp files.
|
||||
: ${TMPDIR=/tmp}
|
||||
{
|
||||
tmp=`(umask 077 && mktemp -d -q "$TMPDIR/csXXXXXX") 2>/dev/null` &&
|
||||
test -n "$tmp" && test -d "$tmp"
|
||||
} ||
|
||||
{
|
||||
tmp=$TMPDIR/cs$$-$RANDOM
|
||||
(umask 077 && mkdir $tmp)
|
||||
} ||
|
||||
{
|
||||
echo "$me: cannot create a temporary directory in $TMPDIR" >&2
|
||||
{ (exit 1); exit 1; }
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# CONFIG_FILES section.
|
||||
#
|
||||
|
||||
# No need to generate the scripts if there are no CONFIG_FILES.
|
||||
# This happens for instance when ./config.status config.h
|
||||
if test -n "$CONFIG_FILES"; then
|
||||
# Protect against being on the right side of a sed subst in config.status.
|
||||
sed 's/,@/@@/; s/@,/@@/; s/,;t t$/@;t t/; /@;t t$/s/[\\&,]/\\&/g;
|
||||
s/@@/,@/; s/@@/@,/; s/@;t t$/,;t t/' >$tmp/subs.sed <<\CEOF
|
||||
s,@SHELL@,/bin/sh,;t t
|
||||
s,@exec_prefix@,${prefix},;t t
|
||||
s,@prefix@,/usr/local,;t t
|
||||
s,@program_transform_name@,s,x,x,,;t t
|
||||
s,@bindir@,${exec_prefix}/bin,;t t
|
||||
s,@sbindir@,${exec_prefix}/sbin,;t t
|
||||
s,@libexecdir@,${exec_prefix}/libexec,;t t
|
||||
s,@datadir@,${prefix}/share,;t t
|
||||
s,@sysconfdir@,${prefix}/etc,;t t
|
||||
s,@sharedstatedir@,${prefix}/com,;t t
|
||||
s,@localstatedir@,${prefix}/var,;t t
|
||||
s,@libdir@,${exec_prefix}/lib,;t t
|
||||
s,@includedir@,${prefix}/include,;t t
|
||||
s,@oldincludedir@,/usr/include,;t t
|
||||
s,@infodir@,${prefix}/info,;t t
|
||||
s,@mandir@,${prefix}/man,;t t
|
||||
s,@PACKAGE_NAME@,,;t t
|
||||
s,@PACKAGE_TARNAME@,,;t t
|
||||
s,@PACKAGE_VERSION@,,;t t
|
||||
s,@PACKAGE_STRING@,,;t t
|
||||
s,@PACKAGE_BUGREPORT@,,;t t
|
||||
s,@build_alias@,,;t t
|
||||
s,@host_alias@,,;t t
|
||||
s,@target_alias@,,;t t
|
||||
s,@ECHO_C@,,;t t
|
||||
s,@ECHO_N@,-n,;t t
|
||||
s,@ECHO_T@,,;t t
|
||||
s,@PATH_SEPARATOR@,:,;t t
|
||||
s,@DEFS@,-DHAVE_CONFIG_H,;t t
|
||||
s,@LIBS@,-lncurses -lm -L/lib,;t t
|
||||
s,@VERSION@,1:3:0,;t t
|
||||
s,@VERSION_MAJOR@,1,;t t
|
||||
s,@VERSION_MINOR@,0,;t t
|
||||
s,@VERSION_PATCH@,20050306,;t t
|
||||
s,@PACKAGE@,dialog,;t t
|
||||
s,@DESTDIR@,,;t t
|
||||
s,@CC@,gcc,;t t
|
||||
s,@CFLAGS@,-g -O2,;t t
|
||||
s,@LDFLAGS@,,;t t
|
||||
s,@CPPFLAGS@, -D_GNU_SOURCE,;t t
|
||||
s,@ac_ct_CC@,gcc,;t t
|
||||
s,@EXEEXT@,,;t t
|
||||
s,@OBJEXT@,o,;t t
|
||||
s,@CPP@,gcc -E,;t t
|
||||
s,@SET_MAKE@,,;t t
|
||||
s,@RANLIB@,ranlib,;t t
|
||||
s,@ac_ct_RANLIB@,ranlib,;t t
|
||||
s,@INSTALL_PROGRAM@,${INSTALL},;t t
|
||||
s,@INSTALL_SCRIPT@,${INSTALL},;t t
|
||||
s,@INSTALL_DATA@,${INSTALL} -m 644,;t t
|
||||
s,@AR@,ar,;t t
|
||||
s,@ac_ct_AR@,ar,;t t
|
||||
s,@cf_cv_makeflags@,,;t t
|
||||
s,@MAKE_LOWER_TAGS@,#,;t t
|
||||
s,@MAKE_UPPER_TAGS@,#,;t t
|
||||
s,@ECHO_LT@,,;t t
|
||||
s,@ECHO_LD@,,;t t
|
||||
s,@RULE_CC@,# compiling,;t t
|
||||
s,@SHOW_CC@,# compiling,;t t
|
||||
s,@ECHO_CC@,,;t t
|
||||
s,@build@,i686-pc-linux-gnu,;t t
|
||||
s,@build_cpu@,i686,;t t
|
||||
s,@build_vendor@,pc,;t t
|
||||
s,@build_os@,linux-gnu,;t t
|
||||
s,@host@,i686-pc-linux-gnu,;t t
|
||||
s,@host_cpu@,i686,;t t
|
||||
s,@host_vendor@,pc,;t t
|
||||
s,@host_os@,linux-gnu,;t t
|
||||
s,@PROG_EXT@,,;t t
|
||||
s,@LIB_PREFIX@,lib,;t t
|
||||
s,@EXTRA_CFLAGS@,,;t t
|
||||
s,@CONFIG_H@,config.h,;t t
|
||||
s,@ALLOCA@,,;t t
|
||||
s,@GLIBC21@,yes,;t t
|
||||
s,@LIBICONV@,,;t t
|
||||
s,@USE_NLS@,no,;t t
|
||||
s,@PATHSEP@,:,;t t
|
||||
s,@MSGFMT@,,;t t
|
||||
s,@GMSGFMT@,,;t t
|
||||
s,@XGETTEXT@,,;t t
|
||||
s,@INTLBISON@,,;t t
|
||||
s,@BUILD_INCLUDED_LIBINTL@,no,;t t
|
||||
s,@USE_INCLUDED_LIBINTL@,no,;t t
|
||||
s,@CATALOGS@,,;t t
|
||||
s,@CATOBJEXT@,,;t t
|
||||
s,@GMOFILES@, ar.gmo bg.gmo ca.gmo cs.gmo cy.gmo da.gmo de.gmo el.gmo es.gmo et.gmo eu.gmo fr.gmo ga.gmo gl.gmo hi.gmo hr.gmo hu.gmo it.gmo ja.gmo mg.gmo mk.gmo nl.gmo pl.gmo pt_BR.gmo pt.gmo rm.gmo ro.gmo ru.gmo sq.gmo uk.gmo vi.gmo zh_TW.gmo,;t t
|
||||
s,@INTLLIBS@,,;t t
|
||||
s,@INTLOBJS@,,;t t
|
||||
s,@POFILES@, ar.po bg.po ca.po cs.po cy.po da.po de.po el.po es.po et.po eu.po fr.po ga.po gl.po hi.po hr.po hu.po it.po ja.po mg.po mk.po nl.po pl.po pt_BR.po pt.po rm.po ro.po ru.po sq.po uk.po vi.po zh_TW.po,;t t
|
||||
s,@POSUB@,,;t t
|
||||
s,@DATADIRNAME@,share,;t t
|
||||
s,@INSTOBJEXT@,.mo,;t t
|
||||
s,@GENCAT@,gencat,;t t
|
||||
s,@MKINSTALLDIRS@,./mkdirs.sh,;t t
|
||||
s,@INTL_LIBTOOL_SUFFIX_PREFIX@,,;t t
|
||||
s,@MSG_DIR_MAKE@,#,;t t
|
||||
s,@SUB_MAKEFILE@,,;t t
|
||||
s,@INTLDIR_MAKE@,#,;t t
|
||||
s,@GT_YES@,,;t t
|
||||
s,@GT_NO@,#,;t t
|
||||
s,@LIBTOOL@,,;t t
|
||||
s,@LIBTOOL_CXX@,,;t t
|
||||
s,@LIB_CREATE@,$(AR) -cr,;t t
|
||||
s,@LIB_OBJECT@,$(OBJECTS),;t t
|
||||
s,@LIB_SUFFIX@,.a,;t t
|
||||
s,@LIB_PREP@,ranlib,;t t
|
||||
s,@LIB_CLEAN@,,;t t
|
||||
s,@LIB_COMPILE@,,;t t
|
||||
s,@LIB_LINK@,,;t t
|
||||
s,@LIB_INSTALL@,,;t t
|
||||
s,@LIB_UNINSTALL@,,;t t
|
||||
s,@LIBTOOL_MAKE@,#,;t t
|
||||
s,@EXTRAOBJS@, rc$o calendar$o fselect$o timebox$o formbox$o guage$o tailbox$o,;t t
|
||||
CEOF
|
||||
|
||||
# Split the substitutions into bite-sized pieces for seds with
|
||||
# small command number limits, like on Digital OSF/1 and HP-UX.
|
||||
ac_max_sed_lines=48
|
||||
ac_sed_frag=1 # Number of current file.
|
||||
ac_beg=1 # First line for current file.
|
||||
ac_end=$ac_max_sed_lines # Line after last line for current file.
|
||||
ac_more_lines=:
|
||||
ac_sed_cmds=
|
||||
while $ac_more_lines; do
|
||||
if test $ac_beg -gt 1; then
|
||||
sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
|
||||
else
|
||||
sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
|
||||
fi
|
||||
if test ! -s $tmp/subs.frag; then
|
||||
ac_more_lines=false
|
||||
else
|
||||
# The purpose of the label and of the branching condition is to
|
||||
# speed up the sed processing (if there are no `@' at all, there
|
||||
# is no need to browse any of the substitutions).
|
||||
# These are the two extra sed commands mentioned above.
|
||||
(echo ':t
|
||||
/@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
|
||||
if test -z "$ac_sed_cmds"; then
|
||||
ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
|
||||
else
|
||||
ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
|
||||
fi
|
||||
ac_sed_frag=`expr $ac_sed_frag + 1`
|
||||
ac_beg=$ac_end
|
||||
ac_end=`expr $ac_end + $ac_max_sed_lines`
|
||||
fi
|
||||
done
|
||||
if test -z "$ac_sed_cmds"; then
|
||||
ac_sed_cmds=cat
|
||||
fi
|
||||
fi # test -n "$CONFIG_FILES"
|
||||
|
||||
for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
|
||||
# Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
|
||||
case $ac_file in
|
||||
- | *:- | *:-:* ) # input from stdin
|
||||
cat >$tmp/stdin
|
||||
ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
|
||||
ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
|
||||
*:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
|
||||
ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
|
||||
* ) ac_file_in=$ac_file.in ;;
|
||||
esac
|
||||
|
||||
# Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
|
||||
ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
|
||||
X"$ac_file" : 'X\(//\)[^/]' \| \
|
||||
X"$ac_file" : 'X\(//\)$' \| \
|
||||
X"$ac_file" : 'X\(/\)' \| \
|
||||
. : '\(.\)' 2>/dev/null ||
|
||||
echo X"$ac_file" |
|
||||
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
|
||||
/^X\(\/\/\)[^/].*/{ s//\1/; q; }
|
||||
/^X\(\/\/\)$/{ s//\1/; q; }
|
||||
/^X\(\/\).*/{ s//\1/; q; }
|
||||
s/.*/./; q'`
|
||||
if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
|
||||
{ case "$ac_dir" in
|
||||
[\\/]* | ?:[\\/]* ) as_incr_dir=;;
|
||||
*) as_incr_dir=.;;
|
||||
esac
|
||||
as_dummy="$ac_dir"
|
||||
for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do
|
||||
case $as_mkdir_dir in
|
||||
# Skip DOS drivespec
|
||||
?:) as_incr_dir=$as_mkdir_dir ;;
|
||||
*)
|
||||
as_incr_dir=$as_incr_dir/$as_mkdir_dir
|
||||
test -d "$as_incr_dir" || mkdir "$as_incr_dir"
|
||||
;;
|
||||
esac
|
||||
done; }
|
||||
|
||||
ac_dir_suffix="/`echo $ac_dir|sed 's,^\./,,'`"
|
||||
# A "../" for each directory in $ac_dir_suffix.
|
||||
ac_dots=`echo "$ac_dir_suffix" | sed 's,/[^/]*,../,g'`
|
||||
else
|
||||
ac_dir_suffix= ac_dots=
|
||||
fi
|
||||
|
||||
case $srcdir in
|
||||
.) ac_srcdir=.
|
||||
if test -z "$ac_dots"; then
|
||||
ac_top_srcdir=.
|
||||
else
|
||||
ac_top_srcdir=`echo $ac_dots | sed 's,/$,,'`
|
||||
fi ;;
|
||||
[\\/]* | ?:[\\/]* )
|
||||
ac_srcdir=$srcdir$ac_dir_suffix;
|
||||
ac_top_srcdir=$srcdir ;;
|
||||
*) # Relative path.
|
||||
ac_srcdir=$ac_dots$srcdir$ac_dir_suffix
|
||||
ac_top_srcdir=$ac_dots$srcdir ;;
|
||||
esac
|
||||
|
||||
case $INSTALL in
|
||||
[\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
|
||||
*) ac_INSTALL=$ac_dots$INSTALL ;;
|
||||
esac
|
||||
|
||||
if test x"$ac_file" != x-; then
|
||||
{ echo "$as_me:9794: creating $ac_file" >&5
|
||||
echo "$as_me: creating $ac_file" >&6;}
|
||||
rm -f "$ac_file"
|
||||
fi
|
||||
# Let's still pretend it is `configure' which instantiates (i.e., don't
|
||||
# use $as_me), people would be surprised to read:
|
||||
# /* config.h. Generated automatically by config.status. */
|
||||
configure_input="Generated automatically from `echo $ac_file_in |
|
||||
sed 's,.*/,,'` by configure."
|
||||
|
||||
# First look for the input files in the build tree, otherwise in the
|
||||
# src tree.
|
||||
ac_file_inputs=`IFS=:
|
||||
for f in $ac_file_in; do
|
||||
case $f in
|
||||
-) echo $tmp/stdin ;;
|
||||
[\\/$]*)
|
||||
# Absolute (can't be DOS-style, as IFS=:)
|
||||
test -f "$f" || { { echo "$as_me:9812: error: cannot find input file: $f" >&5
|
||||
echo "$as_me: error: cannot find input file: $f" >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
echo $f;;
|
||||
*) # Relative
|
||||
if test -f "$f"; then
|
||||
# Build tree
|
||||
echo $f
|
||||
elif test -f "$srcdir/$f"; then
|
||||
# Source tree
|
||||
echo $srcdir/$f
|
||||
else
|
||||
# /dev/null tree
|
||||
{ { echo "$as_me:9825: error: cannot find input file: $f" >&5
|
||||
echo "$as_me: error: cannot find input file: $f" >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
fi;;
|
||||
esac
|
||||
done` || { (exit 1); exit 1; }
|
||||
sed "/^[ ]*VPATH[ ]*=/{
|
||||
s/:*\$(srcdir):*/:/;
|
||||
s/:*\${srcdir}:*/:/;
|
||||
s/:*@srcdir@:*/:/;
|
||||
s/^\([^=]*=[ ]*\):*/\1/;
|
||||
s/:*$//;
|
||||
s/^[^=]*=[ ]*$//;
|
||||
}
|
||||
|
||||
:t
|
||||
/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
|
||||
s,@configure_input@,$configure_input,;t t
|
||||
s,@srcdir@,$ac_srcdir,;t t
|
||||
s,@top_srcdir@,$ac_top_srcdir,;t t
|
||||
s,@INSTALL@,$ac_INSTALL,;t t
|
||||
" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
|
||||
rm -f $tmp/stdin
|
||||
if test x"$ac_file" != x-; then
|
||||
mv $tmp/out $ac_file
|
||||
else
|
||||
cat $tmp/out
|
||||
rm -f $tmp/out
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
#
|
||||
# CONFIG_HEADER section.
|
||||
#
|
||||
|
||||
# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
|
||||
# NAME is the cpp macro being defined and VALUE is the value it is being given.
|
||||
#
|
||||
# ac_d sets the value in "#define NAME VALUE" lines.
|
||||
ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)'
|
||||
ac_dB='[ ].*$,\1#\2'
|
||||
ac_dC=' '
|
||||
ac_dD=',;t'
|
||||
# ac_i turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
|
||||
ac_iA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
|
||||
ac_iB='\([ ]\),\1#\2define\3'
|
||||
ac_iC=' '
|
||||
ac_iD='\4,;t'
|
||||
# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
|
||||
ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
|
||||
ac_uB='$,\1#\2define\3'
|
||||
ac_uC=' '
|
||||
ac_uD=',;t'
|
||||
|
||||
for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue
|
||||
# Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
|
||||
case $ac_file in
|
||||
- | *:- | *:-:* ) # input from stdin
|
||||
cat >$tmp/stdin
|
||||
ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
|
||||
ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
|
||||
*:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
|
||||
ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
|
||||
* ) ac_file_in=$ac_file.in ;;
|
||||
esac
|
||||
|
||||
test x"$ac_file" != x- && { echo "$as_me:9891: creating $ac_file" >&5
|
||||
echo "$as_me: creating $ac_file" >&6;}
|
||||
|
||||
# First look for the input files in the build tree, otherwise in the
|
||||
# src tree.
|
||||
ac_file_inputs=`IFS=:
|
||||
for f in $ac_file_in; do
|
||||
case $f in
|
||||
-) echo $tmp/stdin ;;
|
||||
[\\/$]*)
|
||||
# Absolute (can't be DOS-style, as IFS=:)
|
||||
test -f "$f" || { { echo "$as_me:9902: error: cannot find input file: $f" >&5
|
||||
echo "$as_me: error: cannot find input file: $f" >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
echo $f;;
|
||||
*) # Relative
|
||||
if test -f "$f"; then
|
||||
# Build tree
|
||||
echo $f
|
||||
elif test -f "$srcdir/$f"; then
|
||||
# Source tree
|
||||
echo $srcdir/$f
|
||||
else
|
||||
# /dev/null tree
|
||||
{ { echo "$as_me:9915: error: cannot find input file: $f" >&5
|
||||
echo "$as_me: error: cannot find input file: $f" >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
fi;;
|
||||
esac
|
||||
done` || { (exit 1); exit 1; }
|
||||
# Remove the trailing spaces.
|
||||
sed 's/[ ]*$//' $ac_file_inputs >$tmp/in
|
||||
|
||||
rm -f conftest.frag
|
||||
cat >> conftest.frag <<CEOF
|
||||
|
||||
#define DIALOG_PATCHDATE 20050306
|
||||
#define DIALOG_VERSION "1.0"
|
||||
#define HAVE_ALLOCA 1
|
||||
#define HAVE_ALLOCA_H 1
|
||||
#define HAVE_ARGZ_H 1
|
||||
#define HAVE_COLOR 1
|
||||
#define HAVE_CURSES_H 1
|
||||
#define HAVE_DIRENT_H 1
|
||||
#define HAVE_FEOF_UNLOCKED 1
|
||||
#define HAVE_FGETS_UNLOCKED 1
|
||||
#define HAVE_FLUSHINP 1
|
||||
#define HAVE_FORMBOX 1
|
||||
#define HAVE_GAUGE 1
|
||||
#define HAVE_GETBEGX 1
|
||||
#define HAVE_GETBEGY 1
|
||||
#define HAVE_GETBEGYX 1
|
||||
#define HAVE_GETCURX 1
|
||||
#define HAVE_GETCURY 1
|
||||
#define HAVE_GETCWD 1
|
||||
#define HAVE_GETEGID 1
|
||||
#define HAVE_GETEUID 1
|
||||
#define HAVE_GETGID 1
|
||||
#define HAVE_GETMAXX 1
|
||||
#define HAVE_GETMAXY 1
|
||||
#define HAVE_GETMAXYX 1
|
||||
#define HAVE_GETPAGESIZE 1
|
||||
#define HAVE_GETPARX 1
|
||||
#define HAVE_GETPARY 1
|
||||
#define HAVE_GETPARYX 1
|
||||
#define HAVE_GETUID 1
|
||||
#define HAVE_ICONV 1
|
||||
#define HAVE_INTTYPES_H 1
|
||||
#define HAVE_LANGINFO_CODESET 1
|
||||
#define HAVE_LC_MESSAGES 1
|
||||
#define HAVE_LIMITS_H 1
|
||||
#define HAVE_LOCALE_H 1
|
||||
#define HAVE_MALLOC_H 1
|
||||
CEOF
|
||||
cat >> conftest.frag <<CEOF
|
||||
#define HAVE_MEMORY_H 1
|
||||
#define HAVE_MEMPCPY 1
|
||||
#define HAVE_MMAP 1
|
||||
#define HAVE_MUNMAP 1
|
||||
#define HAVE_NL_TYPES_H 1
|
||||
#define HAVE_PUTENV 1
|
||||
#define HAVE_RC_FILE 1
|
||||
#define HAVE_SETENV 1
|
||||
#define HAVE_SETLOCALE 1
|
||||
#define HAVE_STDDEF_H 1
|
||||
#define HAVE_STDINT_H 1
|
||||
#define HAVE_STDLIB_H 1
|
||||
#define HAVE_STPCPY 1
|
||||
#define HAVE_STRCASECMP 1
|
||||
#define HAVE_STRCHR 1
|
||||
#define HAVE_STRDUP 1
|
||||
#define HAVE_STRINGS_H 1
|
||||
#define HAVE_STRING_H 1
|
||||
#define HAVE_STRTOUL 1
|
||||
#define HAVE_SYS_PARAM_H 1
|
||||
#define HAVE_SYS_STAT_H 1
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
#define HAVE_SYS_WAIT_H 1
|
||||
#define HAVE_TAILBOX 1
|
||||
#define HAVE_TERM_H 1
|
||||
#define HAVE_TSEARCH 1
|
||||
#define HAVE_TYPE_CHTYPE 1
|
||||
#define HAVE_UNISTD_H 1
|
||||
#define HAVE_WAITPID 1
|
||||
#define HAVE_XDIALOG 1
|
||||
#define HAVE___ARGZ_COUNT 1
|
||||
#define HAVE___ARGZ_NEXT 1
|
||||
#define HAVE___ARGZ_STRINGIFY 1
|
||||
#define ICONV_CONST
|
||||
#define MIXEDCASE_FILENAMES 1
|
||||
#define NCURSES 1
|
||||
#define PACKAGE "dialog"
|
||||
#define RETSIGTYPE void
|
||||
CEOF
|
||||
cat >> conftest.frag <<CEOF
|
||||
#define STDC_HEADERS 1
|
||||
#define SYSTEM_NAME "linux-gnu"
|
||||
#define TIME_WITH_SYS_TIME 1
|
||||
#define TYPE_CHTYPE_IS_SCALAR 1
|
||||
CEOF
|
||||
cat >> conftest.edit <<CEOF
|
||||
/@DEFS@/r conftest.frag
|
||||
/@DEFS@/d
|
||||
CEOF
|
||||
sed -f conftest.edit $tmp/in > $tmp/out
|
||||
rm -f $tmp/in
|
||||
mv $tmp/out $tmp/in
|
||||
rm -f conftest.edit conftest.frag
|
||||
|
||||
# Let's still pretend it is `configure' which instantiates (i.e., don't
|
||||
# use $as_me), people would be surprised to read:
|
||||
# /* config.h. Generated automatically by config.status. */
|
||||
if test x"$ac_file" = x-; then
|
||||
echo "/* Generated automatically by configure. */" >$tmp/config.h
|
||||
else
|
||||
echo "/* $ac_file. Generated automatically by configure. */" >$tmp/config.h
|
||||
fi
|
||||
cat $tmp/in >>$tmp/config.h
|
||||
rm -f $tmp/in
|
||||
if test x"$ac_file" != x-; then
|
||||
if cmp -s $ac_file $tmp/config.h 2>/dev/null; then
|
||||
{ echo "$as_me:9973: $ac_file is unchanged" >&5
|
||||
echo "$as_me: $ac_file is unchanged" >&6;}
|
||||
else
|
||||
ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
|
||||
X"$ac_file" : 'X\(//\)[^/]' \| \
|
||||
X"$ac_file" : 'X\(//\)$' \| \
|
||||
X"$ac_file" : 'X\(/\)' \| \
|
||||
. : '\(.\)' 2>/dev/null ||
|
||||
echo X"$ac_file" |
|
||||
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
|
||||
/^X\(\/\/\)[^/].*/{ s//\1/; q; }
|
||||
/^X\(\/\/\)$/{ s//\1/; q; }
|
||||
/^X\(\/\).*/{ s//\1/; q; }
|
||||
s/.*/./; q'`
|
||||
if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
|
||||
{ case "$ac_dir" in
|
||||
[\\/]* | ?:[\\/]* ) as_incr_dir=;;
|
||||
*) as_incr_dir=.;;
|
||||
esac
|
||||
as_dummy="$ac_dir"
|
||||
for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do
|
||||
case $as_mkdir_dir in
|
||||
# Skip DOS drivespec
|
||||
?:) as_incr_dir=$as_mkdir_dir ;;
|
||||
*)
|
||||
as_incr_dir=$as_incr_dir/$as_mkdir_dir
|
||||
test -d "$as_incr_dir" || mkdir "$as_incr_dir"
|
||||
;;
|
||||
esac
|
||||
done; }
|
||||
|
||||
fi
|
||||
rm -f $ac_file
|
||||
mv $tmp/config.h $ac_file
|
||||
fi
|
||||
else
|
||||
cat $tmp/config.h
|
||||
rm -f $tmp/config.h
|
||||
fi
|
||||
done
|
||||
|
||||
#
|
||||
# CONFIG_COMMANDS section.
|
||||
#
|
||||
for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue
|
||||
ac_dest=`echo "$ac_file" | sed 's,:.*,,'`
|
||||
ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'`
|
||||
|
||||
case $ac_dest in
|
||||
default-1 ) for ac_file in $CONFIG_FILES; do
|
||||
# Support "outfile[:infile[:infile...]]"
|
||||
case "$ac_file" in
|
||||
*:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
|
||||
esac
|
||||
# PO directories have a Makefile.in generated from Makefile.inn.
|
||||
case "$ac_file" in */[Mm]akefile.in)
|
||||
# Adjust a relative srcdir.
|
||||
ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
|
||||
ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
|
||||
ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
|
||||
ac_base=`basename $ac_file .in`
|
||||
# In autoconf-2.13 it is called $ac_given_srcdir.
|
||||
# In autoconf-2.50 it is called $srcdir.
|
||||
test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
|
||||
case "$ac_given_srcdir" in
|
||||
.) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
|
||||
/*) top_srcdir="$ac_given_srcdir" ;;
|
||||
*) top_srcdir="$ac_dots$ac_given_srcdir" ;;
|
||||
esac
|
||||
if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
|
||||
rm -f "$ac_dir/POTFILES"
|
||||
test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
|
||||
sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," -e "\$s/\(.*\) \\\\/\1/" < "$ac_given_srcdir/$ac_dir/POTFILES.in" > "$ac_dir/POTFILES"
|
||||
test -n "$as_me" && echo "$as_me: creating $ac_dir/$ac_base" || echo "creating $ac_dir/$ac_base"
|
||||
sed -e "/POTFILES =/r $ac_dir/POTFILES" "$ac_dir/$ac_base.in" > "$ac_dir/$ac_base"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done ;;
|
||||
esac
|
||||
done
|
||||
|
||||
{ (exit 0); exit 0; }
|
||||
1566
extra/dialog-1.0-20050306/config.sub
vendored
Executable file
1566
extra/dialog-1.0-20050306/config.sub
vendored
Executable file
File diff suppressed because it is too large
Load Diff
10082
extra/dialog-1.0-20050306/configure
vendored
Executable file
10082
extra/dialog-1.0-20050306/configure
vendored
Executable file
File diff suppressed because it is too large
Load Diff
160
extra/dialog-1.0-20050306/configure.in
Normal file
160
extra/dialog-1.0-20050306/configure.in
Normal file
@@ -0,0 +1,160 @@
|
||||
dnl $Id: configure.in,v 1.37 2004/04/22 00:17:38 tom Exp $
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
dnl
|
||||
AC_PREREQ(2.13.20020210)
|
||||
AC_INIT(dialog.h)
|
||||
AC_CONFIG_HEADER(dlg_config.h:config.hin)
|
||||
|
||||
CF_VERSION_INFO(dialog)
|
||||
|
||||
DESTDIR=
|
||||
AC_SUBST(DESTDIR)
|
||||
|
||||
dnl
|
||||
dnl Checks for programs.
|
||||
dnl
|
||||
AC_PROG_CC
|
||||
AC_PROG_CPP
|
||||
AC_PROG_GCC_TRADITIONAL
|
||||
AC_PROG_MAKE_SET
|
||||
AC_PROG_RANLIB
|
||||
AC_PROG_INSTALL
|
||||
|
||||
dnl needed for CF_WITH_LIBTOOL
|
||||
AC_CHECK_TOOL(AR, ar, ar)
|
||||
|
||||
AC_ISC_POSIX
|
||||
AC_C_CONST
|
||||
|
||||
CF_MAKEFLAGS
|
||||
CF_MAKE_TAGS
|
||||
CF_DISABLE_ECHO
|
||||
CF_PROG_EXT
|
||||
CF_LIB_PREFIX
|
||||
CF_XOPEN_SOURCE
|
||||
|
||||
AC_ARG_WITH(warnings,
|
||||
[ --with-warnings turn on gcc warnings, for debugging],[
|
||||
CF_GCC_ATTRIBUTES
|
||||
CF_GCC_WARNINGS
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl Checks for libraries.
|
||||
dnl
|
||||
CF_BUNDLED_INTL(makefile,enable)
|
||||
CF_MATH_LIB(,sqrt(x))
|
||||
|
||||
CF_WITH_DBMALLOC
|
||||
CF_WITH_DMALLOC
|
||||
|
||||
LIBTOOL_MAKE="#"
|
||||
CF_WITH_LIBTOOL
|
||||
if test "$with_libtool" = "yes" ; then
|
||||
OBJEXT="lo"
|
||||
LIBTOOL_MAKE=
|
||||
fi
|
||||
AC_SUBST(LIBTOOL_MAKE)
|
||||
|
||||
use_ncurses=no
|
||||
AC_ARG_WITH(ncurses,
|
||||
[ --with-ncurses compile/link with ncurses library],
|
||||
[use_ncurses=ncurses])
|
||||
AC_ARG_WITH(ncursesw,
|
||||
[ --with-ncursesw compile/link with wide-char ncurses library],
|
||||
[use_ncurses=ncursesw])
|
||||
if test $use_ncurses != no ; then
|
||||
cf_wide_curses=yes
|
||||
if test $use_ncurses = ncursesw ; then
|
||||
CF_UTF8_LIB
|
||||
fi
|
||||
CF_NCURSES_CPPFLAGS($use_ncurses)
|
||||
CF_NCURSES_LIBS($use_ncurses)
|
||||
else
|
||||
cf_wide_curses=no
|
||||
CF_CURSES_CPPFLAGS
|
||||
CF_NCURSES_VERSION
|
||||
CF_CURSES_LIBS
|
||||
fi
|
||||
|
||||
EXTRAOBJS=""
|
||||
cf_all_widgets=yes
|
||||
|
||||
CF_ARG_MSG_ENABLE([if you want config-file support],
|
||||
rc-file,
|
||||
[ --disable-rc-file do not include config-file support],
|
||||
[EXTRAOBJS="$EXTRAOBJS rc\$o"
|
||||
AC_DEFINE(HAVE_RC_FILE)],,$cf_all_widgets)
|
||||
|
||||
CF_ARG_MSG_ENABLE([if you want Xdialog-style dialogs],
|
||||
Xdialog,
|
||||
[ --disable-Xdialog do not include Xdialog-style dialogs],
|
||||
[EXTRAOBJS="$EXTRAOBJS calendar\$o fselect\$o timebox\$o"
|
||||
AC_DEFINE(HAVE_XDIALOG)],,$cf_all_widgets)
|
||||
|
||||
CF_ARG_MSG_ENABLE([if you want the form dialog],
|
||||
form,
|
||||
[ --disable-form do not include the form dialog],
|
||||
[EXTRAOBJS="$EXTRAOBJS formbox\$o"
|
||||
AC_DEFINE(HAVE_FORMBOX)],,$cf_all_widgets)
|
||||
|
||||
CF_ARG_MSG_ENABLE([if you want the gauge dialog],
|
||||
gauge,
|
||||
[ --disable-gauge do not include the gauge dialog],
|
||||
[EXTRAOBJS="$EXTRAOBJS guage\$o"
|
||||
AC_DEFINE(HAVE_GAUGE)],,$cf_all_widgets)
|
||||
|
||||
CF_ARG_MSG_ENABLE([if you want the tailbox dialog],
|
||||
tailbox,
|
||||
[ --disable-tailbox do not include the tailbox dialog],
|
||||
[EXTRAOBJS="$EXTRAOBJS tailbox\$o"
|
||||
AC_DEFINE(HAVE_TAILBOX)],,$cf_all_widgets)
|
||||
|
||||
CF_ARG_MSG_ENABLE([if you want the wide-curses features],
|
||||
widec,
|
||||
[ --enable-widec enable wide-curses features],
|
||||
[AC_DEFINE(USE_WIDE_CURSES)],,$cf_wide_curses)
|
||||
|
||||
AC_SUBST(EXTRAOBJS)
|
||||
|
||||
dnl
|
||||
dnl Checks for header files.
|
||||
dnl
|
||||
AC_HEADER_STDC
|
||||
AC_HEADER_TIME
|
||||
AC_HEADER_DIRENT
|
||||
AC_CHECK_HEADERS(unistd.h)
|
||||
CF_CURSES_TERM_H
|
||||
|
||||
dnl
|
||||
dnl Checks for library functions.
|
||||
dnl
|
||||
AC_TYPE_SIGNAL
|
||||
AC_CHECK_FUNCS(\
|
||||
strcasecmp \
|
||||
waitpid \
|
||||
)
|
||||
|
||||
CF_CURSES_FUNCS(\
|
||||
flushinp \
|
||||
getbegx \
|
||||
getbegy \
|
||||
getbegyx \
|
||||
getcurx \
|
||||
getcury \
|
||||
getmaxx \
|
||||
getmaxy \
|
||||
getmaxyx \
|
||||
getparx \
|
||||
getpary \
|
||||
getparyx \
|
||||
wget_wch \
|
||||
)
|
||||
|
||||
AC_CHECK_FUNC(start_color,[AC_DEFINE(HAVE_COLOR)])
|
||||
CF_CURSES_CHTYPE
|
||||
CF_FUNC_WAIT
|
||||
|
||||
AC_TRY_LINK([#include <locale.h>],[setlocale(LC_ALL, "")],[AC_DEFINE(HAVE_SETLOCALE)])
|
||||
|
||||
AC_OUTPUT(makefile $SUB_MAKEFILE samples/install/makefile,,,sort -u)
|
||||
BIN
extra/dialog-1.0-20050306/dialog
Executable file
BIN
extra/dialog-1.0-20050306/dialog
Executable file
Binary file not shown.
948
extra/dialog-1.0-20050306/dialog.1
Normal file
948
extra/dialog-1.0-20050306/dialog.1
Normal file
@@ -0,0 +1,948 @@
|
||||
.\" $Id: dialog.1,v 1.84 2005/02/07 00:33:50 tom Exp $
|
||||
.\" Copyright 2005 Thomas E. Dickey
|
||||
.\"
|
||||
.\" This program is free software; you can redistribute it and/or
|
||||
.\" modify it under the terms of the GNU General Public License
|
||||
.\" as published by the Free Software Foundation; either version 2
|
||||
.\" of the License, or (at your option) any later version.
|
||||
.\"
|
||||
.\" This program is distributed in the hope that it will be useful,
|
||||
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
.\" GNU General Public License for more details.
|
||||
.\"
|
||||
.\" You should have received a copy of the GNU General Public License
|
||||
.\" along with this program; if not, write to the Free Software
|
||||
.\" Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
.de EX
|
||||
.ne 8
|
||||
.IP
|
||||
..
|
||||
.de ES
|
||||
.RS +10
|
||||
.nf
|
||||
..
|
||||
.de EE
|
||||
.fi
|
||||
.RE
|
||||
..
|
||||
.
|
||||
.TH DIALOG 1 "" "$Date: 2005/02/07 00:33:50 $"
|
||||
.SH NAME
|
||||
dialog \- display dialog boxes from shell scripts
|
||||
.SH SYNOPSIS
|
||||
\fBdialog --clear\fP
|
||||
.br
|
||||
.BI "dialog --create-rc " file
|
||||
.br
|
||||
\fBdialog --print-maxsize\fP
|
||||
.br
|
||||
\fBdialog\fP
|
||||
\fIcommon-options\fP
|
||||
\fIbox-options\fP
|
||||
.SH DESCRIPTION
|
||||
\fBDialog\fP
|
||||
is a program that will let you to present a variety of questions or
|
||||
display messages using dialog boxes from a shell script.
|
||||
These types of dialog boxes are implemented
|
||||
(though not all are necessarily compiled into \fBdialog\fR):
|
||||
.RS
|
||||
.LP
|
||||
.BR calendar ", "
|
||||
.BR checklist ", "
|
||||
.BR form ", "
|
||||
.BR fselect ", "
|
||||
.BR gauge ", "
|
||||
.BR infobox ", "
|
||||
.BR inputbox ", "
|
||||
.BR inputmenu ", "
|
||||
.BR menu ", "
|
||||
.BR msgbox " (message), "
|
||||
.BR password ", "
|
||||
.BR pause ", "
|
||||
.BR radiolist ", "
|
||||
.BR tailbox ", "
|
||||
.BR tailboxbg ", "
|
||||
.BR textbox ", "
|
||||
.BR timebox ", and "
|
||||
.BR yesno " (yes/no)."
|
||||
.RE
|
||||
.PP
|
||||
You can put more than one dialog box into a script:
|
||||
.TP 5
|
||||
-
|
||||
Use the "\fB--and-widget\fP" token to force Dialog to proceed to the next
|
||||
dialog unless you have pressed ESC to cancel, or
|
||||
.TP 5
|
||||
-
|
||||
Simply add the tokens for the next dialog box, making a chain.
|
||||
Dialog stops chaining when the return code from a dialog is nonzero,
|
||||
e.g., Cancel or No (see DIAGNOSTICS).
|
||||
.PP
|
||||
Some widgets, e.g., checklist, will write text to \fBdialog\fP's output.
|
||||
Normally that is the standard error, but there are options for
|
||||
changing this: "\fB--output-fd\fP", "\fB--stderr\fP" and "\fB--stdout\fP".
|
||||
No text is written if the Cancel button (or ESC) is pressed;
|
||||
\fBdialog\fP exits immediately in that case.
|
||||
.
|
||||
.\" ************************************************************************
|
||||
.SH OPTIONS
|
||||
All options begin with "\fB--\fP"
|
||||
(two ASCII hyphens,
|
||||
for the benefit of those using systems with deranged locale support).
|
||||
.PP
|
||||
A "\fB--\fP" by itself is used as an escape,
|
||||
i.e., the next token on the command-line is not treated as an option.
|
||||
.RS
|
||||
.B dialog --title -- --Not an option
|
||||
.RE
|
||||
.PP
|
||||
The "\fB--args\fP" option tells \fBdialog\fP to list the command-line
|
||||
parameters to the standard error.
|
||||
This is useful when debugging complex scripts using
|
||||
the "\fB--\fP" and "\fB--file\fP",
|
||||
since the command-line may be rewritten as these are expanded.
|
||||
.PP
|
||||
The "\fB--file\fP" option tells \fBdialog\fP to read parameters from
|
||||
the file named as its value.
|
||||
.RS
|
||||
.B dialog --file parameterfile
|
||||
.RE
|
||||
Blanks not within double-quotes are discarded
|
||||
(use backslashes to quote single characters).
|
||||
The result is inserted into the command-line,
|
||||
replacing "\fB--file\fP" and its option value.
|
||||
Interpretation of the command-line resumes from that point.
|
||||
.
|
||||
.SS \fBCommon Options\fP
|
||||
.
|
||||
.IP "\fB--aspect \fIratio"
|
||||
This gives you some control over the box dimensions when using auto
|
||||
sizing (specifying 0 for height and width).
|
||||
It represents width / height.
|
||||
The default is 9, which means 9 characters wide to every 1 line high.
|
||||
.
|
||||
.IP "\fB--backtitle \fIbacktitle"
|
||||
Specifies a
|
||||
\fIbacktitle\fP
|
||||
string to be displayed on the backdrop, at the top of the screen.
|
||||
.
|
||||
.IP "\fB--begin \fIy x"
|
||||
Specify the position of the upper left corner of a dialog box on the screen.
|
||||
.
|
||||
.IP "\fB--cancel-label \fIstring"
|
||||
Override the label used for "Cancel" buttons.
|
||||
.
|
||||
.IP "\fB--clear"
|
||||
Clears the widget screen, keeping only the screen_color background.
|
||||
Use this when you combine widgets with "\fB--and-widget\fR" to erase the
|
||||
contents of a previous widget on the screen, so it won't be seen
|
||||
under the contents of a following widget.
|
||||
Understand this as the complement of "\fB--keep-window\fR".
|
||||
To compare the effects, use these:
|
||||
.
|
||||
.EX
|
||||
All three widgets visible, staircase effect, ordered 1,2,3:
|
||||
.ES
|
||||
dialog --begin 2 2 --yesno "" 0 0 \\
|
||||
--and-widget --begin 4 4 --yesno "" 0 0 \\
|
||||
--and-widget --begin 6 6 --yesno "" 0 0
|
||||
.EE
|
||||
.
|
||||
.EX
|
||||
Only the last widget is left visible:
|
||||
.ES
|
||||
dialog --clear --begin 2 2 --yesno "" 0 0 \\
|
||||
--and-widget --clear --begin 4 4 --yesno "" 0 0 \\
|
||||
--and-widget --begin 6 6 --yesno "" 0 0
|
||||
.EE
|
||||
.
|
||||
.EX
|
||||
All three widgets visible, staircase effect, ordered 3,2,1:
|
||||
.ES
|
||||
dialog --keep-window --begin 2 2 --yesno "" 0 0 \\
|
||||
--and-widget --keep-window --begin 4 4 --yesno "" 0 0 \\
|
||||
--and-widget --begin 6 6 --yesno "" 0 0
|
||||
.EE
|
||||
.
|
||||
.EX
|
||||
First and third widget visible, staircase effect, ordered 3,1:
|
||||
.ES
|
||||
dialog --keep-window --begin 2 2 --yesno "" 0 0 \\
|
||||
--and-widget --clear --begin 4 4 --yesno "" 0 0 \\
|
||||
--and-widget --begin 6 6 --yesno "" 0 0
|
||||
.EE
|
||||
.IP
|
||||
Note, if you want to restore original console colors and send your
|
||||
cursor home after the dialog program has exited, use the \fBclear\fR\ (1)
|
||||
command.
|
||||
.
|
||||
.IP "\fB--colors"
|
||||
Interpret embedded "\\Z" sequences in the dialog text
|
||||
by the following character,
|
||||
which tells \fBdialog\fP to set colors or video attributes:
|
||||
0 through 7 are the ANSI used in curses:
|
||||
black,
|
||||
red,
|
||||
green,
|
||||
yellow,
|
||||
blue,
|
||||
magenta,
|
||||
cyan and
|
||||
white respectively.
|
||||
Bold is set by 'b', reset by 'B'.
|
||||
Reverse is set by 'r', reset by 'R'.
|
||||
Underline is set by 'u', reset by 'U'.
|
||||
The settings are cumulative, e.g., "\\Zb\\Z1" makes the following text
|
||||
bold (perhaps bright) red.
|
||||
Restore normal settings with "\\Zn".
|
||||
.
|
||||
.IP "\fB--cr-wrap"
|
||||
Interpret embedded newlines in the dialog text as a newline on the screen.
|
||||
Otherwise, \fBdialog\fR will only wrap lines where needed to fit inside the text box.
|
||||
Even though you can control line breaks with this,
|
||||
\fBdialog\fR will still wrap any lines that are too long for the width of the box.
|
||||
Without cr-wrap, the layout of your text may be formatted to look nice
|
||||
in the source code of your script without affecting the way it will
|
||||
look in the dialog.
|
||||
.IP
|
||||
See also the "\fB--no-collapse\fP" and "\fB--trim\fP" options.
|
||||
.
|
||||
.IP "\fB--create-rc \fIfile"
|
||||
When
|
||||
\fBdialog\fP
|
||||
supports run-time configuration,
|
||||
this can be used to dump a sample configuration file to the file specified
|
||||
by
|
||||
.IR file "."
|
||||
.
|
||||
.IP "\fB--defaultno"
|
||||
Make the default value of the
|
||||
\fByes/no\fP
|
||||
box a
|
||||
.BR No .
|
||||
Likewise, make the default button of widgets that provide "OK" and "Cancel"
|
||||
a \fBCancel\fP.
|
||||
If "\fB--nocancel\fP" or "\fB--visit-items\fP" are given
|
||||
those options overrides this,
|
||||
making the default button always "Yes" (internally the same as "OK").
|
||||
.
|
||||
.IP "\fB--default-item \fIstring"
|
||||
Set the default item in a checklist, form or menu box.
|
||||
Normally the first item in the box is the default.
|
||||
.
|
||||
.IP "\fB--exit-label \fIstring"
|
||||
Override the label used for "EXIT" buttons.
|
||||
.
|
||||
.IP "\fB--extra-button"
|
||||
Show an extra button, between "OK" and "Cancel" buttons.
|
||||
.
|
||||
.IP "\fB--extra-label \fIstring"
|
||||
Override the label used for "Extra" buttons.
|
||||
Note: for inputmenu widgets, this defaults to "Rename".
|
||||
.
|
||||
.IP "\fB--help"
|
||||
Prints the help message to \fBdialog\fP's output.
|
||||
The help message is printed if no options are given.
|
||||
.
|
||||
.IP "\fB--help-button"
|
||||
Show a help-button after "OK" and "Cancel" buttons,
|
||||
i.e., in checklist, radiolist and menu boxes.
|
||||
If "\fB--item-help\fR" is also given, on exit
|
||||
the return status will be the same as for the "OK" button,
|
||||
and the item-help text will be written to \fBdialog\fP's output after the token "HELP".
|
||||
Otherwise, the return status will indicate that the Help button was pressed,
|
||||
and no message printed.
|
||||
.
|
||||
.IP "\fB--help-label \fIstring"
|
||||
Override the label used for "Help" buttons.
|
||||
.
|
||||
.IP "\fB--help-status"
|
||||
If the help-button is selected,
|
||||
writes the checklist, radiolist or form information
|
||||
after the item-help "HELP" information.
|
||||
This can be used to reconstruct the state of a checklist after processing
|
||||
the help request.
|
||||
.
|
||||
.IP "\fB--ignore"
|
||||
Ignore options that \fBdialog\fP does not recognize.
|
||||
Some well-known ones such as "\fB--icon\fP" are ignored anyway,
|
||||
but this is a better choice for compatibility with other implementations.
|
||||
.
|
||||
.IP "\fB--input-fd \fIfd"
|
||||
Read keyboard input from the given file descriptor.
|
||||
Most \fBdialog\fR scripts read from the standard input,
|
||||
but the gauge widget reads a pipe (which is always standard input).
|
||||
Some configurations do not work properly when
|
||||
\fBdialog\fP tries to reopen the terminal.
|
||||
Use this option (with appropriate juggling of file-descriptors)
|
||||
if your script must work in that type of environment.
|
||||
.
|
||||
.IP "\fB--insecure"
|
||||
Makes the password widget friendlier but less secure,
|
||||
by echoing asterisks for each character.
|
||||
.
|
||||
.IP "\fB--item-help"
|
||||
Interpret the tags data for checklist, radiolist and menu boxes
|
||||
adding a column which is displayed in the bottom line of the
|
||||
screen, for the currently selected item.
|
||||
.
|
||||
.IP "\fB--keep-window"
|
||||
Normally when \fBdialog\fR performs several \fBtailboxbg\fR widgets
|
||||
connected by "\fB--and-widget\fR",
|
||||
it clears the old widget from the screen by painting over it.
|
||||
Use this option to suppress that repainting.
|
||||
.IP
|
||||
At exit, \fBdialog\fR repaints all of the widgets which have been
|
||||
marked with "\fB--keep-window\fR", even if they are not \fBtailboxbg\fR widgets.
|
||||
That causes them to be repainted in reverse order.
|
||||
See the discussion of the "\fB--clear\fR" option for examples.
|
||||
.
|
||||
.IP "\fB--max-input \fIsize"
|
||||
Limit input strings to the given size.
|
||||
If not specified, the limit is 2048.
|
||||
.
|
||||
.IP "\fB--no-cancel"
|
||||
.IP "\fB--nocancel"
|
||||
Suppress the "Cancel" button in checklist, inputbox and menu box modes.
|
||||
A script can still test if the user pressed the ESC key to cancel to quit.
|
||||
.
|
||||
.IP "\fB--no-collapse"
|
||||
Normally \fBdialog\fR converts tabs to spaces and reduces multiple
|
||||
spaces to a single space for text which is displayed in a message boxes, etc.
|
||||
Use this option to disable that feature.
|
||||
Note that \fBdialog\fR will still wrap text,
|
||||
subject to the "\fB--cr-wrap\fR" and "\fB--trim\fR" options.
|
||||
.
|
||||
.IP "\fB--no-kill"
|
||||
Tells
|
||||
\fBdialog\fP
|
||||
to put the
|
||||
\fBtailboxbg\fP
|
||||
box in the background,
|
||||
printing its process id to \fBdialog\fP's output.
|
||||
SIGHUP is disabled for the background process.
|
||||
.
|
||||
.IP "\fB--no-label \fIstring"
|
||||
Override the label used for "No" buttons.
|
||||
.
|
||||
.IP "\fB--no-shadow"
|
||||
Suppress shadows that would be drawn to the right and bottom of each dialog box.
|
||||
.
|
||||
.IP "\fB--ok-label \fIstring"
|
||||
Override the label used for "OK" buttons.
|
||||
.
|
||||
.IP "\fB--output-fd \fIfd"
|
||||
Direct output to the given file descriptor.
|
||||
Most \fBdialog\fR scripts write to the standard error,
|
||||
but error messages may also be written there, depending on your script.
|
||||
.
|
||||
.IP "\fB--print-maxsize"
|
||||
Print the maximum size of dialog boxes, i.e., the screen size,
|
||||
to \fBdialog\fP's output.
|
||||
This may be used alone, without other options.
|
||||
.
|
||||
.IP "\fB--print-size"
|
||||
Prints the size of each dialog box to \fBdialog\fP's output.
|
||||
.
|
||||
.IP "\fB--print-version"
|
||||
Prints \fBdialog\fR's version to \fBdialog\fP's output.
|
||||
This may be used alone, without other options.
|
||||
.
|
||||
.IP "\fB--separate-output"
|
||||
For checklist widgets, output result one line at a time, with no quoting.
|
||||
This facilitates parsing by another program.
|
||||
.
|
||||
.IP "\fB--separator \fIstring"
|
||||
.IP "\fB--separate-widget \fIstring"
|
||||
Specify a string that will separate the output on \fBdialog\fP's output from
|
||||
each widget.
|
||||
This is used to simplify parsing the result of a dialog with several widgets.
|
||||
If this option is not given,
|
||||
the default separator string is a tab character.
|
||||
.
|
||||
.IP "\fB--shadow"
|
||||
Draw a shadow to the right and bottom of each dialog box.
|
||||
.
|
||||
.IP "\fB--single-quoted"
|
||||
Use single-quoting as needed (and no quotes if unneeded) for the
|
||||
output of checklist's as well as the item-help text.
|
||||
If this option is not set, \fBdialog\fP uses double quotes around each item.
|
||||
That requires occasional use of backslashes to make the output useful in
|
||||
shell scripts.
|
||||
.
|
||||
.IP "\fB--size-err"
|
||||
Check the resulting size of a dialog box before trying to use it,
|
||||
printing the resulting size if it is larger than the screen.
|
||||
(This option is obsolete, since all new-window calls are checked).
|
||||
.
|
||||
.IP "\fB--sleep \fIsecs"
|
||||
Sleep (delay) for the given number of seconds after processing a dialog box.
|
||||
.
|
||||
.IP "\fB--stderr"
|
||||
Direct output to the standard error.
|
||||
This is the default, since curses normally writes screen updates to
|
||||
the standard output.
|
||||
.
|
||||
.IP "\fB--stdout"
|
||||
Direct output to the standard output.
|
||||
This option is provided for compatibility with Xdialog,
|
||||
however using it in portable scripts is not recommended,
|
||||
since curses normally writes its screen updates to the standard output.
|
||||
If you use this option, \fBdialog\fR attempts to reopen the terminal
|
||||
so it can write to the display.
|
||||
Depending on the platform and your environment, that may fail.
|
||||
.
|
||||
.IP "\fB--tab-correct"
|
||||
Convert each tab character to one or more spaces.
|
||||
Otherwise, tabs are rendered according to the curses library's interpretation.
|
||||
.
|
||||
.IP "\fB--tab-len \fIn"
|
||||
Specify the number of spaces that a tab character occupies if the
|
||||
"\fB--tab-correct\fP"
|
||||
option is given.
|
||||
The default is 8.
|
||||
.
|
||||
.IP "\fB--timeout \fIsecs"
|
||||
Timeout (exit with error code)
|
||||
if no user response within the given number of seconds.
|
||||
This is overridden if the background "\fB--tailboxbg\fP is used.
|
||||
A timeout of zero seconds is ignored.
|
||||
.
|
||||
.IP "\fB--title \fItitle"
|
||||
Specifies a
|
||||
\fItitle\fP
|
||||
string to be displayed at the top of the dialog box.
|
||||
.
|
||||
.IP "\fB--trim"
|
||||
eliminate leading blanks,
|
||||
trim literal newlines and repeated blanks from message text.
|
||||
.
|
||||
.IP
|
||||
See also the "\fB--cr-wrap\fR" and "\fB--no-collapse\fR" options.
|
||||
.
|
||||
.IP "\fB--version"
|
||||
Same as "\fB--print-version\fP".
|
||||
.
|
||||
.IP "\fB--visit-items"
|
||||
Modify the tab-traversal of checklist, radiobox, menubox and inputmenu
|
||||
to include the list of items as one of the states.
|
||||
This is useful as a visual aid,
|
||||
i.e., the cursor position helps some users.
|
||||
.IP
|
||||
When this option is given, the cursor is initially placed on the list.
|
||||
Abbreviations (the first letter of the tag) apply to the list items.
|
||||
If you tab to the button row, abbreviations apply to the buttons.
|
||||
.
|
||||
.IP "\fB--yes-label \fIstring"
|
||||
Override the label used for "Yes" buttons.
|
||||
.
|
||||
.\" ************************************************************************
|
||||
.SS Box Options
|
||||
All dialog boxes have at least three parameters:
|
||||
.TP 5
|
||||
\fItext\fP
|
||||
the caption or contents of the box.
|
||||
.TP 5
|
||||
\fIheight\fP
|
||||
the height of the dialog box.
|
||||
.TP 5
|
||||
\fIwidth\fP
|
||||
the width of the dialog box.
|
||||
.PP
|
||||
Other parameters depend on the box type.
|
||||
.
|
||||
.
|
||||
.IP "\fB--calendar \fItext height width day month year"
|
||||
A \fBcalendar\fP box displays
|
||||
month, day and year in separately adjustable windows.
|
||||
If the values for day, month or year are missing or negative,
|
||||
the current date's corresponding values are used.
|
||||
You can increment or decrement any of those using the
|
||||
left-, up-, right- and down-arrows.
|
||||
Use vi-style h, j, k and l for moving around the array of days in a month.
|
||||
Use tab or backtab to move between windows.
|
||||
If the year is given as zero, the current date is used as an initial value.
|
||||
.IP
|
||||
On exit, the date is printed in the form day/month/year.
|
||||
.
|
||||
.
|
||||
.IP "\fB--checklist \fItext height width list-height \fR[ \fItag item status \fR] \fI..."
|
||||
A
|
||||
\fBchecklist\fP
|
||||
box is similar to a
|
||||
\fBmenu\fP
|
||||
box; there are
|
||||
multiple entries presented in the form of a menu.
|
||||
Instead of choosing
|
||||
one entry among the entries, each entry can be turned on or off by the user.
|
||||
The initial on/off state of each entry is specified by
|
||||
.IR status "."
|
||||
.IP
|
||||
On exit, a list of the \fItag\fP
|
||||
strings of those entries that are turned on
|
||||
will be printed on \fBdialog\fP's output.
|
||||
If the "\fB--separate-output\fP" option is not given,
|
||||
the strings will be quoted to make it simple for scripts to separate them.
|
||||
See the "\fB--single-quoted\fP" option, which modifies the quoting behavior.
|
||||
.
|
||||
.
|
||||
.nf
|
||||
.IP "\fB--form \fItext height width formheight \fR[ \fIlabel y x item y x flen ilen \fR] \fI..."
|
||||
.fi
|
||||
The form \fBdialog\fP displays a form consisting of labels and fields,
|
||||
which are positioned on a scrollable window by coordinates given in the script.
|
||||
The field length \fIflen\fR and input-length \fIilen\fR tell how long
|
||||
the field can be.
|
||||
The former defines the length shown for a selected field,
|
||||
while the latter defines the permissible length of the data entered in the
|
||||
field.
|
||||
.RS
|
||||
.TP 3
|
||||
-
|
||||
If \fIflen\fR is zero, the corresponding field cannot be altered.
|
||||
and the contents of the field determine the displayed-length.
|
||||
.TP 3
|
||||
-
|
||||
If \fIflen\fR is negative, the corresponding field cannot be altered,
|
||||
and the negated value of \fIflen\fR is used as the displayed-length.
|
||||
.TP 3
|
||||
-
|
||||
If \fIilen\fR is zero, it is set to \fIflen\fR.
|
||||
.RE
|
||||
.IP
|
||||
Use up/down arrows (or control/N, control/P) to move between fields.
|
||||
Use tab to move between windows.
|
||||
.IP
|
||||
On exit, the contents of the form-fields are written to \fBdialog\fP's output,
|
||||
each field separated by a newline.
|
||||
The text used to fill non-editable fields
|
||||
(\fIflen\fR is zero or negative)
|
||||
is not written out.
|
||||
.
|
||||
.
|
||||
.IP "\fB--fselect \fIfilepath height width\fR"
|
||||
The file-selection dialog displays a text-entry window in which you can type
|
||||
a filename (or directory), and above that two windows with directory
|
||||
names and filenames.
|
||||
.IP
|
||||
Here
|
||||
\fBfilepath\fP
|
||||
can be a filepath in which case the file and directory windows
|
||||
will display the contents of the path and the text-entry window will contain
|
||||
the preselected filename.
|
||||
.IP
|
||||
Use tab or arrow keys to move between the windows.
|
||||
Within the directory or filename windows, use the up/down arrow keys
|
||||
to scroll the current selection.
|
||||
Use the space-bar to copy the current selection into the text-entry
|
||||
window.
|
||||
.IP
|
||||
Typing any printable characters switches focus to the text-entry window,
|
||||
entering that character as well as scrolling the directory and filename
|
||||
windows to the closest match.
|
||||
.IP
|
||||
Use a carriage return or the "OK" button to accept the current value
|
||||
in the text-entry window and exit.
|
||||
.IP
|
||||
On exit, the contents of the text-entry window are written to \fBdialog\fP's output.
|
||||
.
|
||||
.
|
||||
.IP "\fB--gauge \fItext height width [percent]\fR"
|
||||
A
|
||||
\fBgauge\fP
|
||||
box displays a meter along the bottom of the box.
|
||||
The meter indicates the percentage.
|
||||
New percentages are read from
|
||||
standard input, one integer per line.
|
||||
The meter is updated
|
||||
to reflect each new percentage.
|
||||
If the standard input reads the string "XXX",
|
||||
then subsequent lines up to another "XXX" are used for a new prompt.
|
||||
The gauge exits when EOF is reached on the standard input.
|
||||
.IP
|
||||
The \fIpercent\fR value denotes the initial percentage shown in the meter.
|
||||
If not specified, it is zero.
|
||||
.IP
|
||||
On exit, no text is written to \fBdialog\fP's output.
|
||||
The widget accepts no input, so the exit status is always OK.
|
||||
.
|
||||
.
|
||||
.IP "\fB--infobox \fItext height width"
|
||||
An \fBinfo\fP box is basically a \fBmessage\fP box.
|
||||
However, in this case, \fBdialog\fP
|
||||
will exit immediately after displaying the message to the user.
|
||||
The screen is not cleared when \fBdialog\fP
|
||||
exits, so that the message will remain on the screen until the calling
|
||||
shell script clears it later.
|
||||
This is useful when you want to inform
|
||||
the user that some operations are carrying on that may require some
|
||||
time to finish.
|
||||
.IP
|
||||
On exit, no text is written to \fBdialog\fP's output.
|
||||
Only an "OK" button is provided for input,
|
||||
but an ESC exit status may be returned.
|
||||
.
|
||||
.
|
||||
.IP "\fB--inputbox \fItext height width [init]"
|
||||
An
|
||||
\fBinput\fP
|
||||
box is useful when you want to ask questions that
|
||||
require the user to input a string as the answer.
|
||||
If init is supplied
|
||||
it is used to initialize the input string.
|
||||
When entering the string,
|
||||
the \fIbackspace\fP, \fIdelete\fP and cursor keys
|
||||
can be used to correct typing errors.
|
||||
If the input string is longer than
|
||||
can fit in the dialog box, the input field will be scrolled.
|
||||
.IP
|
||||
On exit, the input string will be printed on \fBdialog\fP's output.
|
||||
.
|
||||
.
|
||||
.IP "\fB--inputmenu \fItext height width menu-height \fR[ \fItag item \fR] \fI..."
|
||||
An \fBinputmenu\fP box is very similar to an ordinary \fBmenu\fP box.
|
||||
There are only a few differences between them:
|
||||
.RS
|
||||
.TP 4
|
||||
1.
|
||||
The entries are not automatically centered but left adjusted.
|
||||
.TP
|
||||
2.
|
||||
An extra button (called \fIRename\fP) is implied to rename
|
||||
the current item when it is pressed.
|
||||
.TP
|
||||
3.
|
||||
It is possible to rename the current entry by pressing the
|
||||
\fIRename\fP
|
||||
button.
|
||||
Then \fBdialog\fP will write the following on \fBdialog\fP's output.
|
||||
.IP
|
||||
RENAMED <tag> <item>
|
||||
.RE
|
||||
.
|
||||
.
|
||||
.IP "\fB--menu \fItext height width menu-height \fR[ \fItag item \fR] \fI..."
|
||||
As its name suggests, a
|
||||
\fBmenu\fP
|
||||
box is a dialog box that can be used to present a list of choices in
|
||||
the form of a menu for the user to choose.
|
||||
Choices are displayed in the order given.
|
||||
Each menu entry consists of a \fItag\fP string and an \fIitem\fP string.
|
||||
The \fItag\fP
|
||||
gives the entry a name to distinguish it from the other entries in the
|
||||
menu.
|
||||
The \fIitem\fP is a short description of the option that the entry represents.
|
||||
The user can move between the menu entries by pressing the
|
||||
cursor keys, the first letter of the \fItag\fP
|
||||
as a hot-key, or the number keys
|
||||
.IR 1-9 ". There are"
|
||||
\fImenu-height\fP
|
||||
entries displayed in the menu at one time, but the menu will be
|
||||
scrolled if there are more entries than that.
|
||||
.IP
|
||||
On exit the \fItag\fP
|
||||
of the chosen menu entry will be printed on \fBdialog\fP's output.
|
||||
If the "\fB--help-button\fR" option is given, the corresponding help
|
||||
text will be printed if the user selects the help button.
|
||||
.
|
||||
.IP "\fB--msgbox \fItext height width"
|
||||
A \fBmessage\fP box is very similar to a \fByes/no\fP box.
|
||||
The only difference between a \fBmessage\fP box and a \fByes/no\fP
|
||||
box is that a \fBmessage\fP box has only a single \fBOK\fP button.
|
||||
You can use this dialog box to display any message you like.
|
||||
After reading the message, the user can press the \fIENTER\fP key so that
|
||||
\fBdialog\fP will exit and the calling shell script can continue its operation.
|
||||
.IP
|
||||
On exit, no text is written to \fBdialog\fP's output.
|
||||
Only an "OK" button is provided for input,
|
||||
but an ESC exit status may be returned.
|
||||
.
|
||||
.IP "\fB\-\-pause \fItext height width seconds\fR"
|
||||
A
|
||||
\fBpause\fP
|
||||
box displays a meter along the bottom of the box.
|
||||
The meter indicates how many seconds remain until the end of the pause.
|
||||
The pause exits when timeout is reached (status OK)
|
||||
or the user presses the Exit button
|
||||
(status CANCEL).
|
||||
.
|
||||
.IP "\fB--passwordbox \fItext height width [init]"
|
||||
A \fBpassword\fP box is similar to an input box,
|
||||
except that the text the user enters is not displayed.
|
||||
This is useful when prompting for passwords or other
|
||||
sensitive information.
|
||||
Be aware that if anything is passed in "init", it
|
||||
will be visible in the system's process table to casual snoopers.
|
||||
Also, it
|
||||
is very confusing to the user to provide them with a default password they
|
||||
cannot see.
|
||||
For these reasons, using "init" is highly discouraged.
|
||||
See "\fB--insecure\fP" if you do not care about your password.
|
||||
.IP
|
||||
On exit, the input string will be printed on \fBdialog\fP's output.
|
||||
.
|
||||
.
|
||||
.IP "\fB--radiolist \fItext height width list-height \fR [ \fItag item status \fR] \fI..."
|
||||
A
|
||||
\fBradiolist\fP
|
||||
box is similar to a
|
||||
\fBmenu\fP
|
||||
box.
|
||||
The only difference is
|
||||
that you can indicate which entry is currently selected, by setting its
|
||||
.IR status " to " on "."
|
||||
.IP
|
||||
On exit, the name of the selected item is written to \fBdialog\fP's output.
|
||||
.
|
||||
.
|
||||
.IP "\fB--tailbox file height width"
|
||||
Display text from a file in a dialog box, as in a "tail -f" command.
|
||||
Scroll left/right using vi-style 'h' and 'l', or arrow-keys.
|
||||
A '0' resets the scrolling.
|
||||
.IP
|
||||
On exit, no text is written to \fBdialog\fP's output.
|
||||
Only an "OK" button is provided for input,
|
||||
but an ESC exit status may be returned.
|
||||
.
|
||||
.
|
||||
.IP "\fB--tailboxbg file height width"
|
||||
Display text from a file in a dialog box as a background task,
|
||||
as in a "tail -f &" command.
|
||||
Scroll left/right using vi-style 'h' and 'l', or arrow-keys.
|
||||
A '0' resets the scrolling.
|
||||
.IP
|
||||
Dialog treats the background task specially if there are other
|
||||
widgets (\fB--and-widget\fP) on the screen concurrently.
|
||||
Until those widgets are closed (e.g., an "OK"),
|
||||
\fBdialog\fP will perform all of the tailboxbg widgets in the same process,
|
||||
polling for updates.
|
||||
You may use a tab to traverse between the widgets on the screen,
|
||||
and close them individually, e.g., by pressing \fIENTER\fP.
|
||||
Once the non-tailboxbg widgets are closed, \fBdialog\fP forks a copy of itself
|
||||
into the background, and prints its process id if the "\fB--no-kill\fP" option
|
||||
is given.
|
||||
.IP
|
||||
On exit, no text is written to \fBdialog\fP's output.
|
||||
Only an "EXIT" button is provided for input,
|
||||
but an ESC exit status may be returned.
|
||||
.IP
|
||||
NOTE:
|
||||
Older versions of \fBdialog\fP forked immediately and attempted to
|
||||
update the screen individually.
|
||||
Besides being bad for performance,
|
||||
it was unworkable.
|
||||
Some older scripts may not work properly with the polled scheme.
|
||||
.
|
||||
.
|
||||
.IP "\fB--textbox file height width"
|
||||
A
|
||||
\fBtext\fP
|
||||
box lets you display the contents of a text file in a dialog box.
|
||||
It is like a simple text file viewer.
|
||||
The user can move through the file by using the
|
||||
cursor, page-up, page-down
|
||||
and \fIHOME/END\fR keys available on most keyboards.
|
||||
If the lines are too long to be displayed in the box,
|
||||
the \fILEFT/RIGHT\fP
|
||||
keys can be used to scroll the text region horizontally.
|
||||
You may also use vi-style keys h, j, k, l in place of the cursor keys,
|
||||
and B or N in place of the page-up and page-down keys.
|
||||
Scroll up/down using vi-style 'k' and 'j', or arrow-keys.
|
||||
Scroll left/right using vi-style 'h' and 'l', or arrow-keys.
|
||||
A '0' resets the left/right scrolling.
|
||||
For more convenience,
|
||||
vi-style forward and backward searching functions are also provided.
|
||||
.IP
|
||||
On exit, no text is written to \fBdialog\fP's output.
|
||||
Only an "EXIT" button is provided for input,
|
||||
but an ESC exit status may be returned.
|
||||
.
|
||||
.
|
||||
.IP "\fB--timebox \fItext height [width hour minute second]"
|
||||
A dialog is displayed which allows you to select hour, minute and second.
|
||||
If the values for hour, minute or second are missing or negative,
|
||||
the current date's corresponding values are used.
|
||||
You can increment or decrement any of those using the
|
||||
left-, up-, right- and down-arrows.
|
||||
Use tab or backtab to move between windows.
|
||||
.IP
|
||||
On exit, the result is printed in the form hour:minute:second.
|
||||
.
|
||||
.
|
||||
.IP "\fB--yesno \fItext height width"
|
||||
A \fByes/no\fP dialog box of
|
||||
size \fIheight\fP rows by \fIwidth\fP columns will be displayed.
|
||||
The string specified by
|
||||
\fItext\fP
|
||||
is displayed inside the dialog box.
|
||||
If this string is too long to fit
|
||||
in one line, it will be automatically divided into multiple lines at
|
||||
appropriate places.
|
||||
The
|
||||
\fItext\fP
|
||||
string can also contain the sub-string
|
||||
.I
|
||||
"\en"
|
||||
or newline characters
|
||||
\fI`\en'\fP
|
||||
to control line breaking explicitly.
|
||||
This dialog box is useful for
|
||||
asking questions that require the user to answer either yes or no.
|
||||
The dialog box has a
|
||||
\fBYes\fP
|
||||
button and a
|
||||
\fBNo\fP
|
||||
button, in which the user can switch between by pressing the
|
||||
.IR TAB " key."
|
||||
.IP
|
||||
On exit, no text is written to \fBdialog\fP's output.
|
||||
In addition to the "Yes" and "No" exit codes (see DIAGNOSTICS)
|
||||
an ESC exit status may be returned.
|
||||
.IP
|
||||
The codes used for "Yes" and "No" match those used for "OK" and "Cancel",
|
||||
internally no distinction is made.
|
||||
.
|
||||
.\" ************************************************************************
|
||||
.SS "Obsolete Options"
|
||||
.\" from cdialog 0.9a (Pako)
|
||||
.IP "\fB--beep"
|
||||
This was used to tell the original cdialog that it should make a beep
|
||||
when the separate processes of the tailboxbg widget would repaint the screen.
|
||||
.
|
||||
.\" from cdialog 0.9a (Pako)
|
||||
.IP "\fB--beep-after"
|
||||
Beep after a user has completed a widget by pressing one of the buttons.
|
||||
.
|
||||
.\" ************************************************************************
|
||||
.SH "RUN-TIME CONFIGURATION"
|
||||
.TP 4
|
||||
1.
|
||||
Create a sample configuration file by typing:
|
||||
.LP
|
||||
.in +1i
|
||||
"dialog --create-rc <file>"
|
||||
.TP 4
|
||||
2.
|
||||
At start,
|
||||
\fBdialog\fP
|
||||
determines the settings to use as follows:
|
||||
.RS
|
||||
.TP 4
|
||||
a)
|
||||
if environment variable
|
||||
\fBDIALOGRC\fP
|
||||
is set, its value determines the name of the configuration file.
|
||||
.TP 4
|
||||
b)
|
||||
if the file in (a) is not found, use the file
|
||||
\fI$HOME/.dialogrc\fP
|
||||
as the configuration file.
|
||||
.TP 4
|
||||
c)
|
||||
if the file in (b) is not found, try using the GLOBALRC file determined at
|
||||
compile-time, i.e., \fI/etc/dialogrc\fP.
|
||||
.TP 4
|
||||
d)
|
||||
if the file in (c) is not found, use compiled in defaults.
|
||||
.RE
|
||||
.TP 4
|
||||
3.
|
||||
Edit the sample configuration file and copy it to some place that
|
||||
\fBdialog\fP
|
||||
can find, as stated in step 2 above.
|
||||
.
|
||||
.\" ************************************************************************
|
||||
.SH ENVIRONMENT
|
||||
.TP 15
|
||||
\fBDIALOGOPTS\fP
|
||||
Define this variable to apply any of the common options to each widget.
|
||||
Most of the common options are reset before processing each widget.
|
||||
If you set the options in this environment variable,
|
||||
they are applied to \fBdialog\fP's state after the reset.
|
||||
As in the "\fB--file\fP" option,
|
||||
double-quotes and backslashes are interpreted.
|
||||
.IP
|
||||
The "\fB--file\fP" option is not considered a common option
|
||||
(so you cannot embed it within this environment variable).
|
||||
.TP 15
|
||||
\fBDIALOGRC\fP
|
||||
Define this variable if you want to specify the name of the configuration file
|
||||
to use.
|
||||
.TP 15
|
||||
\fBDIALOG_CANCEL\fP
|
||||
.TP 15
|
||||
\fBDIALOG_ERROR\fP
|
||||
.TP 15
|
||||
\fBDIALOG_ESC\fP
|
||||
.TP 15
|
||||
\fBDIALOG_EXTRA\fP
|
||||
.TP 15
|
||||
\fBDIALOG_HELP\fP
|
||||
.TP 15
|
||||
\fBDIALOG_ITEM_HELP\fP
|
||||
.TP 15
|
||||
\fBDIALOG_OK\fP
|
||||
Define any of these variables to change the exit code on
|
||||
Cancel (1),
|
||||
error (-1),
|
||||
ESC (255),
|
||||
Extra (3),
|
||||
Help (2),
|
||||
Help with --item-help (2),
|
||||
or OK (0).
|
||||
Normally shell scripts cannot distinguish between -1 and 255.
|
||||
.TP 15
|
||||
\fBDIALOG_TTY\fP
|
||||
Set this variable to "1" to provide compatibility with older versions
|
||||
of \fBdialog\fP which assumed that if the script redirects the standard output,
|
||||
that the "\fB--stdout\fP" option was given.
|
||||
.SH FILES
|
||||
.TP 20
|
||||
\fI$HOME/.dialogrc\fP
|
||||
default configuration file
|
||||
.SH EXAMPLES
|
||||
The \fBdialog\fP sources contain several samples
|
||||
of how to use the different box options and how they look.
|
||||
Just take a look into the directory \fBsamples/\fP of the source.
|
||||
.SH DIAGNOSTICS
|
||||
Exit status is subject to being overridden by environment variables.
|
||||
Normally they are:
|
||||
.TP 5
|
||||
0
|
||||
if
|
||||
.BR dialog " is exited by pressing the " Yes " or " OK
|
||||
button.
|
||||
.TP 5
|
||||
1
|
||||
if the
|
||||
.BR No " or " Cancel
|
||||
button is pressed.
|
||||
.TP 5
|
||||
2
|
||||
if the
|
||||
.BR Help
|
||||
button is pressed.
|
||||
.TP 5
|
||||
3
|
||||
if the
|
||||
.BR Extra
|
||||
button is pressed.
|
||||
.TP 5
|
||||
-1
|
||||
if errors occur inside \fBdialog\fP
|
||||
or \fBdialog\fP is exited by pressing the \fIESC\fP key.
|
||||
.
|
||||
.\" ************************************************************************
|
||||
.SH BUGS
|
||||
Perhaps.
|
||||
.SH AUTHOR
|
||||
Savio Lam (lam836@cs.cuhk.hk) - version 0.3, "dialog"
|
||||
.LP
|
||||
Stuart Herbert (S.Herbert@sheffield.ac.uk) - patch for version 0.4
|
||||
.LP
|
||||
Pako (demarco_p@abramo.it) - version 0.9a, "cdialog",
|
||||
.LP
|
||||
Thomas Dickey (updates for 0.9b and beyond)
|
||||
.SH CONTRIBUTORS
|
||||
Tobias C. Rittweiler (tobrit@freebits.de)
|
||||
849
extra/dialog-1.0-20050306/dialog.3
Normal file
849
extra/dialog-1.0-20050306/dialog.3
Normal file
@@ -0,0 +1,849 @@
|
||||
.\" $Id: dialog.3,v 1.12 2005/01/16 16:59:48 tom Exp $
|
||||
.\" Copyright 2005 Thomas E. Dickey
|
||||
.\"
|
||||
.\" This program is free software; you can redistribute it and/or
|
||||
.\" modify it under the terms of the GNU General Public License
|
||||
.\" as published by the Free Software Foundation; either version 2
|
||||
.\" of the License, or (at your option) any later version.
|
||||
.\"
|
||||
.\" This program is distributed in the hope that it will be useful,
|
||||
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
.\" GNU General Public License for more details.
|
||||
.\"
|
||||
.\" You should have received a copy of the GNU General Public License
|
||||
.\" along with this program; if not, write to the Free Software
|
||||
.\" Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
.TH DIALOG 3 "" "$Date: 2005/01/16 16:59:48 $"
|
||||
.SH NAME
|
||||
dialog \- widgets and utilities for the dialog program
|
||||
.SH SYNOPSIS
|
||||
.B cc [ flag ... ] file ... -ldialog [ library ... ]
|
||||
|
||||
.B #include <dialog.h>
|
||||
.PP
|
||||
\fBDialog\fP
|
||||
is a program that will let you to present a variety of questions or
|
||||
display messages using dialog boxes from a shell script.
|
||||
It is built from the \fBdialog\fP library,
|
||||
which consists of several widgets
|
||||
as well as utility functions that are used by the widgets
|
||||
or the main program.
|
||||
.
|
||||
.SH DESCRIPTION
|
||||
This manpage documents the features from \fI<dialog.h>\fP which
|
||||
are likely to be important to developers using the widgets directly.
|
||||
Some hints are also given for developing new widgets.
|
||||
.
|
||||
.\" ************************************************************************
|
||||
.SS DEFINITIONS
|
||||
Exit codes (passed back to the main program for its use)
|
||||
are defined with a "\fIDLG_EXIT_\fP prefix.
|
||||
The defined constants can be mapped using environment variables
|
||||
as described in \fBdialog\fP(1),
|
||||
e.g., \fIDLG_EXIT_OK\fP corresponds to \fI$DIALOG_OK\fP.
|
||||
.PP
|
||||
Useful character constants which correspond to user input
|
||||
are named with the "\fICHR_\fP" prefix, e.g.,
|
||||
\fICHR_BACKSPACE\fP.
|
||||
.PP
|
||||
Colors and video attributes are categorized and associated with
|
||||
settings in the configuration file
|
||||
(see the discussion of \fI$DIALOGRC\fP in \fBdialog\fP(1)).
|
||||
The \fIDIALOG_ATR(n)\fP macro is used for defining the references
|
||||
to the combined color and attribute table \fIdlg_color_table[]\fP.
|
||||
.PP
|
||||
The \fBdialog\fP application passes its command-line parameters
|
||||
to the widget functions. Some of those parameters are single values,
|
||||
but some of the widgets accept data as an array of values.
|
||||
Those include checklist/radiobox, menubox and formbox.
|
||||
When the \fB--item-help\fP option is given, an extra column
|
||||
of data is expected.
|
||||
The USE_ITEM_HELP(), CHECKBOX_TAGS, MENUBOX_TAGS and FORMBOX_TAGS
|
||||
macros are used to hide this difference from the calling application.
|
||||
.PP
|
||||
Most of the other definitions found in \fI<dialog.h>\fP
|
||||
are used for convenience in building the library or main program.
|
||||
These include definitions based on the generated \fI<dlg_config.h>\fP header.
|
||||
|
||||
.\" ************************************************************************
|
||||
.SS DATA STRUCTURES
|
||||
All of the global data for the \fBdialog\fP library is stored in
|
||||
a few structures: \fIDIALOG_STATE\fP, \fIDIALOG_VARS\fP and \fIDIALOG_COLORS\fP.
|
||||
The corresponding \fIdialog_state\fP, \fIdialog_vars\fP and \fIdlg_color_table\fP
|
||||
global variables should be initialized to zeros,
|
||||
and then populated with the data to use.
|
||||
A few of these must be nonzero for the corresponding widgets to function.
|
||||
As as the case with function names,
|
||||
variables beginning with "\fIdialog_\fP"
|
||||
are designed for use by the calling application
|
||||
while variables beginning with "\fIdlg_\fP"
|
||||
are intended for lower levels, e.g., by the \fBdialog\fP library.
|
||||
.
|
||||
.IP \fIDIALOG_STATE.all_windows
|
||||
This is a linked list of all windows created by the library.
|
||||
The \fBdlg_del_window\fP function uses this to locate windows which
|
||||
may be redrawn after deleting a window.
|
||||
.
|
||||
.IP \fIDIALOG_STATE.aspect_ratio
|
||||
This corresponds to the command-line option "\fB--aspect-ratio\fP".
|
||||
The value gives the application
|
||||
some control over the box dimensions when using auto
|
||||
sizing (specifying 0 for height and width).
|
||||
It represents width / height.
|
||||
The default is 9, which means 9 characters wide to every 1 line high.
|
||||
.
|
||||
.IP \fIDIALOG_STATE.getc_callbacks
|
||||
This is setup in \fIui_getc.c\fP to record windows which must be polled
|
||||
for input, e.g,. to handle the background tailbox widget.
|
||||
One window is designated as the foreground or control window.
|
||||
.
|
||||
.IP \fIDIALOG_STATE.getc_redirect
|
||||
If the control window for \fIDIALOG_STATE.getc_callbacks\fP is
|
||||
closed, the list is transferred to this variable.
|
||||
Closing all windows causes the application to exit.
|
||||
.
|
||||
.IP \fIDIALOG_STATE.output
|
||||
This is set in the \fBdialog\fP application to the stream on
|
||||
which the application and library functions may write text results.
|
||||
Normally that is the standard error,
|
||||
since the curses library prefers to write its data to the standard output.
|
||||
Some scripts, trading portability for convenience,
|
||||
prefer to write results to the standard output,
|
||||
e.g., by using the "\fB--stdout\fP" option.
|
||||
.
|
||||
.IP \fIDIALOG_STATE.output_count
|
||||
This is incremented by \fIdlg_does_output\fP,
|
||||
which is called by each widget that writes text to the output.
|
||||
The \fBdialog\fP application uses that to decide if it should
|
||||
also write a separator, i.e.,
|
||||
\fIDIALOG_STATE.separate_str\fP,
|
||||
between calls to each widget.
|
||||
.
|
||||
.IP \fIDIALOG_STATE.pipe_input
|
||||
This is set in \fIinit_dialog\fP to a stream which can be used by the
|
||||
\fBgauge\fP widget, which must be the application's standard input.
|
||||
The \fBdialog\fP application calls \fIinit_dialog\fP normally with
|
||||
\fIinput\fP set to the standard input, but optionally based on the
|
||||
"\fB--input-fd\fP" option.
|
||||
Since the application cannot read from
|
||||
a pipe (standard input) and at the same time read
|
||||
the curses input from the standard input,
|
||||
it must allow for reopening the latter from either
|
||||
a specific file descriptor,
|
||||
or directly from the terminal.
|
||||
The adjusted pipe stream value is stored in this variable.
|
||||
.
|
||||
.IP \fIDIALOG_STATE.screen_initialized
|
||||
This is set in \fIinit_dialog\fP and
|
||||
reset in \fIend_dialog\fP.
|
||||
It is used to check if curses has been initialized,
|
||||
and if the \fIendwin\fP function must be called on exit.
|
||||
.
|
||||
.IP \fIDIALOG_STATE.screen_output
|
||||
This is set in \fIinit_dialog\fP to the output stream used
|
||||
by the curses library.
|
||||
Normally that is the standard output,
|
||||
unless that happens to not be a terminal (and if \fIinit_dialog\fP can
|
||||
successfully open the terminal directly).
|
||||
.
|
||||
.IP \fIDIALOG_STATE.separate_str
|
||||
This corresponds to the command-line option "\fB--separate-widget\fP".
|
||||
The given string
|
||||
specifies a string that will separate the output on \fBdialog\fP's output from
|
||||
each widget.
|
||||
This is used to simplify parsing the result of a dialog with several widgets.
|
||||
If this option is not given,
|
||||
the default separator string is a tab character.
|
||||
.
|
||||
.IP \fIDIALOG_STATE.tab_len
|
||||
This corresponds to the command-line option "\fB--tab-len\fP \fInumber\fP".
|
||||
Specify the number of spaces that a tab character occupies if the
|
||||
"\fB--tab-correct\fP"
|
||||
option is given.
|
||||
The default is 8.
|
||||
.
|
||||
.IP \fIDIALOG_STATE.use_colors
|
||||
This is set in \fIinit_dialog\fP if the curses implementation supports color.
|
||||
.
|
||||
.IP \fIDIALOG_STATE.use_shadow
|
||||
This corresponds to the command-line option "\fB--no-shadow\fP".
|
||||
This is set in \fIinit_dialog\fP if the curses implementation supports color.
|
||||
If true,
|
||||
suppress shadows that would be drawn to the right and bottom of each dialog box.
|
||||
.
|
||||
.\" not implemented
|
||||
.\" .IP \fIDIALOG_STATE.visit_items
|
||||
.\" This corresponds to the command-line option "\fB--visit-items\fP".
|
||||
.
|
||||
.PP
|
||||
The \fBdialog\fP application resets the \fIdialog_vars\fP data before
|
||||
accepting options to invoke each widget.
|
||||
Most of the \fIDIALOG_VARS\fP members are set directly from \fBdialog\fP's
|
||||
command-line options:
|
||||
.
|
||||
.IP \fIDIALOG_VARS.backtitle
|
||||
This corresponds to the command-line option "\fB--backtitle\fP \fIbacktitle\fP".
|
||||
It specifies a
|
||||
\fIbacktitle\fP
|
||||
string to be displayed on the backdrop, at the top of the screen.
|
||||
.
|
||||
.IP \fIDIALOG_VARS.beep_after_signal
|
||||
This corresponds to the command-line option "\fB--beep-after\fP".
|
||||
If true, beep after a user has completed a widget by pressing one of the buttons.
|
||||
.
|
||||
.IP \fIDIALOG_VARS.beep_signal
|
||||
This corresponds to the command-line option "\fB--beep\fP".
|
||||
It is obsolete.
|
||||
.
|
||||
.IP \fIDIALOG_VARS.begin_set
|
||||
This is true if the command-line option "\fB--begin y x\fP" was used.
|
||||
It specifies the position of the upper left corner of a dialog box on the screen.
|
||||
.
|
||||
.IP \fIDIALOG_VARS.begin_x
|
||||
This corresponds to the \fIx\fP value from
|
||||
the command-line option "\fB--begin\fP \fIy x\fP" (second value).
|
||||
.
|
||||
.IP \fIDIALOG_VARS.begin_y
|
||||
This corresponds to the \fIy\fP value from
|
||||
the command-line option "\fB--begin\fP \fIy x\fP" (first value).
|
||||
.
|
||||
.IP \fIDIALOG_VARS.cancel_label
|
||||
This corresponds to the command-line option "\fB--cancel-label\fP \fIstring\fP".
|
||||
The given \fIstring\fP overrides the label used for "Cancel" buttons.
|
||||
.
|
||||
.IP \fIDIALOG_VARS.cant_kill
|
||||
This corresponds to the command-line option "\fB--no-kill\fP".
|
||||
If true, this tells
|
||||
\fBdialog\fP
|
||||
to put the
|
||||
\fBtailboxbg\fP
|
||||
box in the background,
|
||||
printing its process id to \fBdialog\fP's output.
|
||||
SIGHUP is disabled for the background process.
|
||||
.
|
||||
.IP \fIDIALOG_VARS.colors
|
||||
This corresponds to the command-line option "\fB--colors\fP".
|
||||
If true, interpret embedded "\\Z" sequences in the dialog text
|
||||
by the following character,
|
||||
which tells dialog to set colors or video attributes:
|
||||
0 through 7 are the ANSI used in curses:
|
||||
black,
|
||||
red,
|
||||
green,
|
||||
yellow,
|
||||
blue,
|
||||
magenta,
|
||||
cyan and
|
||||
white respectively.
|
||||
Bold is set by 'b', reset by 'B'.
|
||||
Reverse is set by 'r', reset by 'R'.
|
||||
Underline is set by 'u', reset by 'U'.
|
||||
The settings are cumulative, e.g., "\\Zb\\Z1" makes the following text
|
||||
bright red.
|
||||
Restore normal settings with "\\Zn".
|
||||
.
|
||||
.IP \fIDIALOG_VARS.cr_wrap
|
||||
This corresponds to the command-line option "\fB--cr-wrap\fP".
|
||||
If true,
|
||||
interpret embedded newlines in the dialog text as a newline on the screen.
|
||||
Otherwise, \fBdialog\fR will only wrap lines where needed to fit inside the text box.
|
||||
Even though you can control line breaks with this,
|
||||
\fBdialog\fR will still wrap any lines that are too long for the width of the box.
|
||||
Without cr-wrap, the layout of your text may be formatted to look nice
|
||||
in the source code of your script without affecting the way it will
|
||||
look in the dialog.
|
||||
.
|
||||
.IP \fIDIALOG_VARS.default_item
|
||||
This corresponds to the command-line option "\fB--default-item\fP \fIstring\fP".
|
||||
The given string is used as
|
||||
the default item in a checklist, form or menu box.
|
||||
Normally the first item in the box is the default.
|
||||
.IP \fIDIALOG_VARS.defaultno
|
||||
This corresponds to the command-line option "\fB--defaultno\fP".
|
||||
If true,
|
||||
make the default value of the
|
||||
\fByes/no\fP
|
||||
box a
|
||||
.BR No .
|
||||
Likewise, make the default button of widgets that provide "OK" and "Cancel"
|
||||
a \fBCancel\fP.
|
||||
If \fB--nocancel\fP was given that option overrides this,
|
||||
making the default button always "Yes" (internally the same as "OK").
|
||||
.
|
||||
.IP \fIDIALOG_VARS.dlg_clear_screen
|
||||
This corresponds to the command-line option "\fB--clear\fP".
|
||||
This option is implemented in the main program, not the library.
|
||||
If true,
|
||||
the screen will be cleared on exit.
|
||||
This may be used alone, without other options.
|
||||
.
|
||||
.IP \fIDIALOG_VARS.exit_label
|
||||
This corresponds to the command-line option "\fB--exit-label string\fP".
|
||||
The given string overrides the label used for "EXIT" buttons.
|
||||
.
|
||||
.IP \fIDIALOG_VARS.extra_button
|
||||
This corresponds to the command-line option "\fB--extra-button\fP".
|
||||
If true, some widgets show an extra button,
|
||||
between "OK" and "Cancel" buttons.
|
||||
.
|
||||
.IP \fIDIALOG_VARS.extra_label
|
||||
This corresponds to the command-line option "\fB--extra-label\fP \fIstring\fP".
|
||||
The given string overrides the label used for "Extra" buttons.
|
||||
Note: for inputmenu widgets, this defaults to "Rename".
|
||||
.
|
||||
.IP \fIDIALOG_VARS.help_button
|
||||
This corresponds to the command-line option "\fB--help-button\fP".
|
||||
If true, some widgets show a help-button after "OK" and "Cancel" buttons,
|
||||
i.e., in checklist, radiolist and menu boxes.
|
||||
If \fB--item-help\fR is also given, on exit
|
||||
the return status will be the same as for the "OK" button,
|
||||
and the item-help text will be written to \fBdialog\fP's output after the token "HELP".
|
||||
Otherwise, the return status will indicate that the Help button was pressed,
|
||||
and no message printed.
|
||||
.
|
||||
.IP \fIDIALOG_VARS.help_label
|
||||
This corresponds to the command-line option "\fB--help-label\fP \fIstring\fP".
|
||||
The given string overrides the label used for "Help" buttons.
|
||||
.
|
||||
.IP \fIDIALOG_VARS.help_status
|
||||
This corresponds to the command-line option "\fB--help-status\fP".
|
||||
If true, and the the help-button is selected,
|
||||
writes the checklist or radiolist information
|
||||
after the item-help "HELP" information.
|
||||
This can be used to reconstruct the state of a checklist after processing
|
||||
the help request.
|
||||
.
|
||||
.IP \fIDIALOG_VARS.input_length
|
||||
This is nonzero if \fIDIALOG_VARS.input_result\fP is allocated,
|
||||
versus being a pointer to the user's local variables.
|
||||
.
|
||||
.IP \fIDIALOG_VARS.input_menu
|
||||
This flag is set to denote whether the menubox widget
|
||||
implements a menu versus a inputmenu widget.
|
||||
.
|
||||
.IP \fIDIALOG_VARS.input_result
|
||||
This is a dynamically-allocated buffer used by the widgets to return
|
||||
printable results to the calling application.
|
||||
.
|
||||
.IP \fIDIALOG_VARS.insecure
|
||||
This corresponds to the command-line option "\fB--insecure\fP".
|
||||
If true, make the password widget friendlier but less secure,
|
||||
by echoing asterisks for each character.
|
||||
.
|
||||
.IP \fIDIALOG_VARS.item_help
|
||||
This corresponds to the command-line option "\fB--item-help\fP".
|
||||
If true,
|
||||
interpret the tags data for checklist, radiolist and menu boxes
|
||||
adding a column whose text is displayed in the bottom line of the
|
||||
screen, for the currently selected item.
|
||||
.
|
||||
.IP \fIDIALOG_VARS.keep_window
|
||||
This corresponds to the command-line option "\fB--keep-window\fP".
|
||||
If true, do not remove/repaint the window on exit.
|
||||
This is useful for keeping the window contents visible when several
|
||||
widgets are run in the same process.
|
||||
Note that curses will clear the screen when starting a new process.
|
||||
.
|
||||
.IP \fIDIALOG_VARS.max_input
|
||||
This corresponds to the command-line option "\fB--max-input\fP \fIsize\fP".
|
||||
Limit input strings to the given size.
|
||||
If not specified, the limit is 2048.
|
||||
.
|
||||
.IP \fIDIALOG_VARS.no_label
|
||||
This corresponds to the command-line option "\fB--no-label\fP \fIstring\fP".
|
||||
The given string overrides the label used for "No" buttons.
|
||||
.
|
||||
.IP \fIDIALOG_VARS.nocancel
|
||||
This corresponds to the command-line option "\fB--no-cancel\fP".
|
||||
If true,
|
||||
suppress the "Cancel" button in checklist, inputbox and menu box modes.
|
||||
A script can still test if the user pressed the ESC key to cancel to quit.
|
||||
.
|
||||
.IP \fIDIALOG_VARS.nocollapse
|
||||
This corresponds to the command-line option "\fB--no-collapse\fP".
|
||||
Normally \fBdialog\fR converts tabs to spaces and reduces multiple
|
||||
spaces to a single space for text which is displayed in a message boxes, etc.
|
||||
It true, that feature is disabled.
|
||||
Note that \fBdialog\fR will still wrap text, subject to the \fB--cr-wrap\fR
|
||||
option.
|
||||
.
|
||||
.IP \fIDIALOG_VARS.ok_label
|
||||
This corresponds to the command-line option "\fB--ok-label\fP \fIstring\fP".
|
||||
The given string overrides the label used for "OK" buttons.
|
||||
.
|
||||
.IP \fIDIALOG_VARS.print_siz
|
||||
This corresponds to the command-line option "\fB--print-size\fP".
|
||||
If true,
|
||||
each widget prints its size to \fBdialog\fP's output when it is invoked.
|
||||
.
|
||||
.IP \fIDIALOG_VARS.separate_output
|
||||
This corresponds to the command-line option "\fB--separate-output\fP".
|
||||
If true,
|
||||
checklist widgets output result one line at a time, with no quoting.
|
||||
This facilitates parsing by another program.
|
||||
.
|
||||
.IP \fIDIALOG_VARS.single_quoted
|
||||
This corresponds to the command-line option "\fB--single-quoted\fP".
|
||||
If true,
|
||||
Use single-quoting as needed (and no quotes if unneeded) for the
|
||||
output of checklist's as well as the item-help text.
|
||||
If this option is not set, \fBdialog\fP uses double quotes around each item.
|
||||
That requires occasional use of backslashes to make the output useful in
|
||||
shell scripts.
|
||||
.IP \fIDIALOG_VARS.size_err
|
||||
This corresponds to the command-line option "\fB--size-err\fP".
|
||||
If true,
|
||||
check the resulting size of a dialog box before trying to use it,
|
||||
printing the resulting size if it is larger than the screen.
|
||||
(This option is obsolete, since all new-window calls are checked).
|
||||
.
|
||||
.IP \fIDIALOG_VARS.sleep_secs
|
||||
This corresponds to the command-line option "\fB--sleep\fP \fIsecs\fP".
|
||||
This option is implemented in the main program, not the library.
|
||||
If nonzero, this is the number of seconds after to delay after processing a dialog box.
|
||||
.
|
||||
.IP \fIDIALOG_VARS.tab_correct
|
||||
This corresponds to the command-line option "\fB--tab-correct\fP".
|
||||
If true, convert each tab character of the text to one or more spaces.
|
||||
Otherwise, tabs are rendered according to the curses library's interpretation.
|
||||
.
|
||||
.IP \fIDIALOG_VARS.timeout_secs
|
||||
This corresponds to the command-line option "\fB--timeout\fP \fIsecs\fP".
|
||||
If nonzero, timeout input requests (exit with error code)
|
||||
if no user response within the given number of seconds.
|
||||
.
|
||||
.IP \fIDIALOG_VARS.title
|
||||
This corresponds to the command-line option "\fB--title\fP \fItitle\fP".
|
||||
Specifies a
|
||||
\fItitle\fP
|
||||
string to be displayed at the top of the dialog box.
|
||||
.
|
||||
.IP \fIDIALOG_VARS.trim_whitespace
|
||||
This corresponds to the command-line option "\fB--trim\fP".
|
||||
If true, eliminate leading blanks,
|
||||
trim literal newlines and repeated blanks from message text.
|
||||
.
|
||||
.IP \fIDIALOG_VARS.visit_items
|
||||
This corresponds to the command-line option "\fB--visit-items\fP".
|
||||
Modify the tab-traversal of checklist, radiobox, menubox and inputmenu
|
||||
to include the list of items as one of the states.
|
||||
This is useful as a visual aid,
|
||||
i.e., the cursor position helps some users.
|
||||
.
|
||||
.IP \fIDIALOG_VARS.yes_label
|
||||
This corresponds to the command-line option "\fB--yes-label\fP \fIstring\fP".
|
||||
The given string overrides the label used for "Yes" buttons.
|
||||
.
|
||||
.\" ************************************************************************
|
||||
.\" ************************************************************************
|
||||
.SS WIDGETS
|
||||
Functions that implement major functionality for the command-line \fBdialog\fP
|
||||
program, e.g., widgets, have names beginning "\fIdialog_\fP".
|
||||
|
||||
All dialog boxes have at least three parameters:
|
||||
.TP 5
|
||||
\fItitle\fP
|
||||
the caption for the box, shown on its top border.
|
||||
.TP 5
|
||||
\fIheight\fP
|
||||
the height of the dialog box.
|
||||
.TP 5
|
||||
\fIwidth\fP
|
||||
the width of the dialog box.
|
||||
.PP
|
||||
Other parameters depend on the box type.
|
||||
.
|
||||
.\" ************************************************************************
|
||||
.IP dialog_calendar
|
||||
implements the "\fB--calendar\fP option.
|
||||
.RS
|
||||
.IP title
|
||||
is the title on the top of the widget.
|
||||
.IP subtitle
|
||||
is the prompt text shown within the widget.
|
||||
.IP height
|
||||
is the height excluding the fixed-height calendar grid.
|
||||
.IP width
|
||||
is the overall width of the box,
|
||||
which is adjusted up to the calendar grid's minimum width if needed.
|
||||
.IP day
|
||||
is the initial day of the week shown,
|
||||
counting zero as Sunday.
|
||||
If the value is negative,
|
||||
the current day of the week is used.
|
||||
.IP month
|
||||
is the initial month of the year shown,
|
||||
counting one as January.
|
||||
If the value is negative,
|
||||
the current month of the year is used.
|
||||
.IP year
|
||||
is the initial year shown.
|
||||
If the value is negative,
|
||||
the current year is used.
|
||||
.RE
|
||||
.\" ************************************************************************
|
||||
.IP dialog_checklist
|
||||
implements the "\fB--checklist\fP and "\fB--radiolist\fP options
|
||||
depending on the \fIflag\fP parameter.
|
||||
.RS
|
||||
.IP title
|
||||
is the title on the top of the widget.
|
||||
.IP cprompt
|
||||
is the prompt text shown within the widget.
|
||||
.IP height
|
||||
is the desired height of the box.
|
||||
If zero, the height is adjusted to use the available screen size.
|
||||
.IP width
|
||||
is the desired width of the box.
|
||||
If zero, the height is adjusted to use the available screen size.
|
||||
.IP list_height
|
||||
is the minimum height to reserve for displaying the list.
|
||||
If zero, it is computed based on the given \fIheight\fP and \fIwidth\fP.
|
||||
.IP item_no
|
||||
is the number of rows in \fIitems\fP.
|
||||
.IP items
|
||||
is an array of strings which is viewed either as a list of rows
|
||||
.RS
|
||||
\fItag item status \fR
|
||||
.RE
|
||||
.IP
|
||||
or
|
||||
.RS
|
||||
\fItag item status help\fR
|
||||
.RE
|
||||
.IP
|
||||
depending on whether \fIdialog_vars.item_help\fP is set.
|
||||
.IP flag
|
||||
is either \fIFLAG_CHECK\fP, for checklists,
|
||||
or \fIFLAG_RADIO\fP for radiolists.
|
||||
.RE
|
||||
.\" ************************************************************************
|
||||
.IP dialog_form
|
||||
implements the "\fB--form\fP option.
|
||||
.RS
|
||||
.IP title
|
||||
is the title on the top of the widget.
|
||||
.IP cprompt
|
||||
is the prompt text shown within the widget.
|
||||
.IP height
|
||||
is the desired height of the box.
|
||||
If zero, the height is adjusted to use the available screen size.
|
||||
.IP width
|
||||
is the desired width of the box.
|
||||
If zero, the height is adjusted to use the available screen size.
|
||||
.IP form_height
|
||||
is the minimum height to reserve for displaying the list.
|
||||
If zero, it is computed based on the given \fIheight\fP and \fIwidth\fP.
|
||||
.IP item_no
|
||||
is the number of rows in \fIitems\fP.
|
||||
.IP items
|
||||
is an array of strings which is viewed either as a list of rows
|
||||
.RS
|
||||
\fIName NameY NameX Text TextY TextX FLen ILen\fR
|
||||
.RE
|
||||
.IP
|
||||
or
|
||||
.RS
|
||||
\fIName NameY NameX Text TextY TextX FLen ILen Help\fR
|
||||
.RE
|
||||
.IP
|
||||
depending on whether \fIdialog_vars.item_help\fP is set.
|
||||
.RE
|
||||
.\" ************************************************************************
|
||||
.IP dialog_fselect
|
||||
implements the "\fB--fselect\fP option.
|
||||
.RS
|
||||
.IP title
|
||||
is the title on the top of the widget.
|
||||
.IP path
|
||||
is the preselected value to show in the input-box,
|
||||
which is used also to set the directory- and file-windows.
|
||||
.IP height
|
||||
is the height excluding the minimum needed to show the dialog box framework.
|
||||
If zero, the height is based on the screen size.
|
||||
.IP width
|
||||
is the desired width of the box.
|
||||
If zero, the height is based on the screen size.
|
||||
.RE
|
||||
.\" ************************************************************************
|
||||
.IP dialog_gauge
|
||||
implements the "\fB--gauge\fP option.
|
||||
.RS
|
||||
.IP title
|
||||
is the title on the top of the widget.
|
||||
.IP cprompt
|
||||
is the prompt text shown within the widget.
|
||||
.IP height
|
||||
is the desired height of the box.
|
||||
If zero, the height is based on the screen size.
|
||||
.IP width
|
||||
is the desired width of the box.
|
||||
If zero, the height is based on the screen size.
|
||||
.IP percent
|
||||
is the percentage to show in the progress bar.
|
||||
.RE
|
||||
.\" ************************************************************************
|
||||
.IP dialog_inputbox
|
||||
implements the "\fB--inputbox\fP or
|
||||
"\fB--password\fP option, depending on the value of \fIpassword\fP.
|
||||
.RS
|
||||
.IP title
|
||||
is the title on the top of the widget.
|
||||
.IP cprompt
|
||||
is the prompt text shown within the widget.
|
||||
.IP height
|
||||
is the desired height of the box.
|
||||
If zero, the height is based on the screen size.
|
||||
.IP width
|
||||
is the desired width of the box.
|
||||
If zero, the height is based on the screen size.
|
||||
.IP init
|
||||
is the initial value of the input box, whose length is taken into account
|
||||
when auto-sizing the width of the dialog box.
|
||||
.IP password
|
||||
if true, causes typed input to be echoed as asterisks.
|
||||
.RE
|
||||
.\" ************************************************************************
|
||||
.IP dialog_menu
|
||||
implements the "\fB--menu\fP or "\fB--inputmenu\fP option
|
||||
depending on whether \fIdialog_vars.input_menu\fP is set.
|
||||
.RS
|
||||
.IP title
|
||||
is the title on the top of the widget.
|
||||
.IP cprompt
|
||||
is the prompt text shown within the widget.
|
||||
.IP height
|
||||
is the desired height of the box.
|
||||
If zero, the height is based on the screen size.
|
||||
.IP width
|
||||
is the desired width of the box.
|
||||
If zero, the height is based on the screen size.
|
||||
.IP menu_height
|
||||
is the minimum height to reserve for displaying the list.
|
||||
If zero, it is computed based on the given \fIheight\fP and \fIwidth\fP.
|
||||
.IP item_no
|
||||
is the number of rows in \fIitems\fP.
|
||||
.IP items
|
||||
is an array of strings which is viewed either as a list of rows
|
||||
.RS
|
||||
\fItag item\fR
|
||||
.RE
|
||||
.IP
|
||||
or
|
||||
.RS
|
||||
\fItag item help\fR
|
||||
.RE
|
||||
.IP
|
||||
depending on whether \fIdialog_vars.item_help\fP is set.
|
||||
.RE
|
||||
.\" ************************************************************************
|
||||
.IP dialog_msgbox
|
||||
implements the "\fB--msgbox\fP or "\fB--infobox\fP option
|
||||
depending on whether \fIpauseopt\fP is set.
|
||||
.RS
|
||||
.IP title
|
||||
is the title on the top of the widget.
|
||||
.IP cprompt
|
||||
is the prompt text shown within the widget.
|
||||
.IP height
|
||||
is the desired height of the box.
|
||||
If zero, the height is based on the screen size.
|
||||
.IP width
|
||||
is the desired width of the box.
|
||||
If zero, the height is based on the screen size.
|
||||
.IP pauseopt
|
||||
if true, an "OK" button will be shown,
|
||||
and the dialog will wait for it to complete.
|
||||
With an "OK" button, it is denoted a "msgbox",
|
||||
without an "OK" button, it is denoted an "infobox".
|
||||
.RE
|
||||
.\" ************************************************************************
|
||||
.IP dialog_pause
|
||||
implements the "\fB--pause\fP option.
|
||||
.RS
|
||||
.IP title
|
||||
is the title on the top of the widget.
|
||||
.IP height
|
||||
is the desired height of the box.
|
||||
If zero, the height is based on the screen size.
|
||||
.IP width
|
||||
is the desired width of the box.
|
||||
If zero, the height is based on the screen size.
|
||||
.IP seconds
|
||||
is the timeout to use for the progress bar.
|
||||
.RE
|
||||
.\" ************************************************************************
|
||||
.IP dialog_tailbox
|
||||
implements the "\fB--tailbox\fP or "\fB--tailboxbg\fP option
|
||||
depending on whether \fIbg_task\fP is set.
|
||||
.RS
|
||||
.IP title
|
||||
is the title on the top of the widget.
|
||||
.IP file
|
||||
is the name of the file to display in the dialog.
|
||||
.IP height
|
||||
is the desired height of the box.
|
||||
If zero, the height is based on the screen size.
|
||||
.IP width
|
||||
is the desired width of the box.
|
||||
If zero, the height is based on the screen size.
|
||||
.IP bg_task
|
||||
if true,
|
||||
the window is added to the callback list in \fIdialog_state\fP,
|
||||
and the application will poll for the window to be updated.
|
||||
Otherwise an "OK" button is added to the window,
|
||||
and it will be closed when the button is activated.
|
||||
.RE
|
||||
.\" ************************************************************************
|
||||
.IP dialog_textbox
|
||||
implements the "\fB--textbox\fP option.
|
||||
.RS
|
||||
.IP title
|
||||
is the title on the top of the widget.
|
||||
.IP file
|
||||
is the name of the file to display in the dialog.
|
||||
.IP height
|
||||
is the desired height of the box.
|
||||
If zero, the height is based on the screen size.
|
||||
.IP width
|
||||
is the desired width of the box.
|
||||
If zero, the height is based on the screen size.
|
||||
.RE
|
||||
.\" ************************************************************************
|
||||
.IP dialog_timebox
|
||||
implements the "\fB--timebox\fP option.
|
||||
.RS
|
||||
.IP title
|
||||
is the title on the top of the widget.
|
||||
.IP subtitle
|
||||
is the prompt text shown within the widget.
|
||||
.IP height
|
||||
is the desired height of the box.
|
||||
If zero, the height is based on the screen size.
|
||||
.IP width
|
||||
is the desired width of the box.
|
||||
If zero, the height is based on the screen size.
|
||||
.IP hour
|
||||
is the initial hour shown.
|
||||
If the value is negative,
|
||||
the current hour is used.
|
||||
.IP minute
|
||||
is the initial minute shown.
|
||||
If the value is negative,
|
||||
the current minute is used.
|
||||
.IP second
|
||||
is the initial second shown.
|
||||
If the value is negative,
|
||||
the current second is used.
|
||||
.RE
|
||||
.\" ************************************************************************
|
||||
.IP dialog_yesno
|
||||
implements the "\fB--yesno\fP option.
|
||||
.RS
|
||||
.IP title
|
||||
is the title on the top of the widget.
|
||||
.IP cprompt
|
||||
is the prompt text shown within the widget.
|
||||
.IP height
|
||||
is the desired height of the box.
|
||||
If zero, the height is based on the screen size.
|
||||
.IP width
|
||||
is the desired width of the box.
|
||||
If zero, the height is based on the screen size.
|
||||
.RE
|
||||
.
|
||||
.\" ************************************************************************
|
||||
.SS UTILITY FUNCTIONS
|
||||
Most functions that implement lower-level
|
||||
functionality for the command-line \fBdialog\fP
|
||||
program or widgets, have names beginning "\fIdlg_\fP".
|
||||
Bowing to longstanding usage, the functions that initialize the
|
||||
display and end it are named \fIinit_dialog\fP and \fIend_dialog\fP.
|
||||
.PP
|
||||
The only non-widget function whose name begins with "\fIdialog_\fP"
|
||||
is \fIdialog_version\fP, which returns the version number of the
|
||||
library as a string.
|
||||
.
|
||||
.\" dlg_add_callback(DIALOG_CALLBACK *p);
|
||||
.\" dlg_add_quoted(char *string);
|
||||
.\" dlg_add_result(char *string);
|
||||
.\" dlg_attr_clear(WINDOW * win, int height, int width, chtype attr);
|
||||
.\" dlg_auto_size(const char * title, const char *prompt, int *height, int *width, int boxlines, int mincols);
|
||||
.\" dlg_auto_sizefile(const char * title, const char *file, int *height, int *width, int boxlines, int mincols);
|
||||
.\" dlg_beeping(void);
|
||||
.\" dlg_box_x_ordinate(int width);
|
||||
.\" dlg_box_y_ordinate(int height);
|
||||
.\" dlg_button_count(const char **labels);
|
||||
.\" dlg_button_layout(const char **labels, int *limit);
|
||||
.\" dlg_button_sizes(const char **labels, int vertical, int *longest, int *length);
|
||||
.\" dlg_button_x_step(const char **labels, int limit, int *gap, int *margin, int *step);
|
||||
.\" dlg_calc_listh(int *height, int *list_height, int item_no);
|
||||
.\" dlg_calc_listw(int item_no, char **items, int group);
|
||||
.\" dlg_char_to_button(int ch, const char **labels);
|
||||
.\" dlg_clear(void);
|
||||
.\" dlg_color_count(void);
|
||||
.\" dlg_color_setup(void);
|
||||
.\" dlg_count_columns(const char *string);
|
||||
.\" dlg_count_wchars(const char *string);
|
||||
.\" dlg_create_rc(const char *filename);
|
||||
.\" dlg_ctl_size(int height, int width);
|
||||
.\" dlg_default_item(char **items, int llen);
|
||||
.\" dlg_defaultno_button(void);
|
||||
.\" dlg_del_window(WINDOW *win);
|
||||
.\" dlg_does_output(void);
|
||||
.\" dlg_draw_arrows(WINDOW *dialog, int top_arrow, int bottom_arrow, int x, int top, int bottom);
|
||||
.\" dlg_draw_bottom_box(WINDOW *win);
|
||||
.\" dlg_draw_box(WINDOW * win, int y, int x, int height, int width, chtype boxchar, chtype borderchar);
|
||||
.\" dlg_draw_buttons(WINDOW *win, int y, int x, const char **labels, int selected, int vertical, int limit);
|
||||
.\" dlg_draw_shadow(WINDOW * win, int height, int width, int y, int x);
|
||||
.\" dlg_draw_title(WINDOW *win, const char *title);
|
||||
.\" dlg_edit_offset(char *string, int offset, int x_last);
|
||||
.\" dlg_edit_string(char *string, int *offset, int key, int fkey, bool force);
|
||||
.\" dlg_exit(int code) GCC_NORETURN;
|
||||
.\" dlg_exit_label(void);
|
||||
.\" dlg_exiterr(const char *, ...)
|
||||
.\" dlg_flush_getc(void);
|
||||
.\" dlg_getc(WINDOW *win, int *fkey);
|
||||
.\" dlg_getc_callbacks(int ch, int fkey, int *result);
|
||||
.\" dlg_index_columns(const char *string);
|
||||
.\" dlg_index_wchars(const char *string);
|
||||
.\" dlg_item_help(char *txt);
|
||||
.\" dlg_killall_bg(int *retval);
|
||||
.\" dlg_last_getc(void);
|
||||
.\" dlg_limit_columns(const char *string, int limit, int offset);
|
||||
.\" dlg_match_char(int ch, const char *string);
|
||||
.\" dlg_mouse_bigregion (int y, int x);
|
||||
.\" dlg_mouse_free_regions (void);
|
||||
.\" dlg_mouse_mkbigregion (int y, int x, int height, int width, int code, int step_x, int step_y, int mode);
|
||||
.\" dlg_mouse_mkregion (int y, int x, int height, int width, int code);
|
||||
.\" dlg_mouse_region (int y, int x);
|
||||
.\" dlg_mouse_setbase (int x, int y);
|
||||
.\" dlg_mouse_wgetch (WINDOW *, int *);
|
||||
.\" dlg_mouse_wgetch_nowait (WINDOW *, int *);
|
||||
.\" dlg_new_window(int height, int width, int y, int x);
|
||||
.\" dlg_next_button(const char **labels, int button);
|
||||
.\" dlg_next_ok_buttonindex(int current, int extra);
|
||||
.\" dlg_ok_buttoncode(int button);
|
||||
.\" dlg_ok_label(void);
|
||||
.\" dlg_ok_labels(void);
|
||||
.\" dlg_parse_rc(void);
|
||||
.\" dlg_prev_button(const char **labels, int button);
|
||||
.\" dlg_prev_ok_buttonindex(int current, int extra);
|
||||
.\" dlg_print_autowrap(WINDOW *win, const char *prompt, int height, int width);
|
||||
.\" dlg_print_size(int height, int width);
|
||||
.\" dlg_print_text(WINDOW *win, const char *txt, int len, chtype *attr);
|
||||
.\" dlg_put_backtitle(void);
|
||||
.\" dlg_remove_callback(DIALOG_CALLBACK *p);
|
||||
.\" dlg_set_focus(WINDOW *parent, WINDOW *win);
|
||||
.\" dlg_show_string(WINDOW *win, const char *string, int offset, chtype attr, int y_base, int x_base, int x_last, bool hidden, bool force);
|
||||
.\" dlg_strclone(const char *cprompt);
|
||||
.\" dlg_strcmp(const char *a, const char *b);
|
||||
.\" dlg_sub_window(WINDOW *win, int height, int width, int y, int x);
|
||||
.\" dlg_tab_correct_str(char *prompt);
|
||||
.\" dlg_trim_string(char *src);
|
||||
.\" dlg_yes_labels(void);
|
||||
.
|
||||
.\" ************************************************************************
|
||||
.SH AUTHOR
|
||||
Thomas E. Dickey
|
||||
1467
extra/dialog-1.0-20050306/dialog.c
Normal file
1467
extra/dialog-1.0-20050306/dialog.c
Normal file
File diff suppressed because it is too large
Load Diff
645
extra/dialog-1.0-20050306/dialog.h
Normal file
645
extra/dialog-1.0-20050306/dialog.h
Normal file
@@ -0,0 +1,645 @@
|
||||
/*
|
||||
* $Id: dialog.h,v 1.147 2004/12/20 00:01:11 Yura.Kalinichen Exp $
|
||||
*
|
||||
* dialog.h -- common declarations for all dialog modules
|
||||
*
|
||||
* AUTHOR: Savio Lam (lam836@cs.cuhk.hk)
|
||||
* and: Thomas E. Dickey
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef DIALOG_H_included
|
||||
#define DIALOG_H_included 1
|
||||
|
||||
#include <dlg_config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <signal.h> /* fork() etc. */
|
||||
#include <math.h> /* sqrt() */
|
||||
|
||||
#if defined(HAVE_NCURSESW_NCURSES_H)
|
||||
#include <ncursesw/ncurses.h>
|
||||
#elif defined(HAVE_NCURSES_NCURSES_H)
|
||||
#include <ncurses/ncurses.h>
|
||||
#elif defined(HAVE_NCURSES_CURSES_H)
|
||||
#include <ncurses/curses.h>
|
||||
#elif defined(HAVE_NCURSES_H)
|
||||
#include <ncurses.h>
|
||||
#elif defined(ultrix)
|
||||
#include <cursesX.h>
|
||||
#else
|
||||
#include <curses.h>
|
||||
#endif
|
||||
|
||||
/* possible conflicts with <term.h> which may be included in <curses.h> */
|
||||
#ifdef color_names
|
||||
#undef color_names
|
||||
#endif
|
||||
|
||||
#ifdef buttons
|
||||
#undef buttons
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
#include <libintl.h>
|
||||
#include <langinfo.h>
|
||||
#define _(s) gettext(s)
|
||||
#else
|
||||
#undef _
|
||||
#define _(s) s
|
||||
#endif
|
||||
|
||||
#ifndef GCC_NORETURN
|
||||
#define GCC_NORETURN /*nothing*/
|
||||
#endif
|
||||
|
||||
#ifndef GCC_UNUSED
|
||||
#define GCC_UNUSED /*nothing*/
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_WGET_WCH
|
||||
#undef USE_WIDE_CURSES
|
||||
#endif
|
||||
|
||||
/*
|
||||
* FIXME: a configure check would be useful
|
||||
*/
|
||||
#ifdef __hpux
|
||||
#undef ACS_UARROW
|
||||
#undef ACS_DARROW
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Change these if you want
|
||||
*/
|
||||
#define USE_SHADOW TRUE
|
||||
#define USE_COLORS TRUE
|
||||
|
||||
#ifdef HAVE_COLOR
|
||||
#define SCOLS (COLS - (dialog_state.use_shadow ? 2 : 0))
|
||||
#define SLINES (LINES - (dialog_state.use_shadow ? 1 : 0))
|
||||
#else
|
||||
#define SCOLS COLS
|
||||
#define SLINES LINES
|
||||
#endif
|
||||
|
||||
#define DLG_EXIT_ESC 255
|
||||
#define DLG_EXIT_UNKNOWN -2 /* never return this (internal use) */
|
||||
#define DLG_EXIT_ERROR -1 /* the shell sees this as 255 */
|
||||
#define DLG_EXIT_OK 0
|
||||
#define DLG_EXIT_CANCEL 1
|
||||
#define DLG_EXIT_HELP 2
|
||||
#define DLG_EXIT_EXTRA 3
|
||||
#define DLG_EXIT_ITEM_HELP 4 /* actually DLG_EXIT_HELP */
|
||||
|
||||
#define CHR_BACKSPACE 8
|
||||
#define CHR_REPAINT 12 /* control/L */
|
||||
#define CHR_DELETE 127
|
||||
#define CHR_NEXT ('n' & 0x1f)
|
||||
#define CHR_PREVIOUS ('p' & 0x1f)
|
||||
|
||||
#define ESC 27
|
||||
#define TAB 9
|
||||
|
||||
#define MARGIN 1
|
||||
#define GUTTER 2
|
||||
#define SHADOW_ROWS 1
|
||||
#define SHADOW_COLS 2
|
||||
|
||||
#define MAX_LEN 2048
|
||||
#define BUF_SIZE (10*1024)
|
||||
|
||||
#undef MIN
|
||||
#define MIN(x,y) ((x) < (y) ? (x) : (y))
|
||||
|
||||
#undef MAX
|
||||
#define MAX(x,y) ((x) > (y) ? (x) : (y))
|
||||
|
||||
#define DEFAULT_SEPARATE_STR "\t"
|
||||
#define DEFAULT_ASPECT_RATIO 9
|
||||
/* how many spaces is a tab long (default)? */
|
||||
#define TAB_LEN 8
|
||||
#define WTIMEOUT_VAL 10
|
||||
|
||||
#ifndef A_CHARTEXT
|
||||
#define A_CHARTEXT 0xff
|
||||
#endif
|
||||
|
||||
#define CharOf(ch) ((ch) & A_CHARTEXT)
|
||||
|
||||
#ifndef ACS_ULCORNER
|
||||
#define ACS_ULCORNER '+'
|
||||
#endif
|
||||
#ifndef ACS_LLCORNER
|
||||
#define ACS_LLCORNER '+'
|
||||
#endif
|
||||
#ifndef ACS_URCORNER
|
||||
#define ACS_URCORNER '+'
|
||||
#endif
|
||||
#ifndef ACS_LRCORNER
|
||||
#define ACS_LRCORNER '+'
|
||||
#endif
|
||||
#ifndef ACS_HLINE
|
||||
#define ACS_HLINE '-'
|
||||
#endif
|
||||
#ifndef ACS_VLINE
|
||||
#define ACS_VLINE '|'
|
||||
#endif
|
||||
#ifndef ACS_LTEE
|
||||
#define ACS_LTEE '+'
|
||||
#endif
|
||||
#ifndef ACS_RTEE
|
||||
#define ACS_RTEE '+'
|
||||
#endif
|
||||
#ifndef ACS_UARROW
|
||||
#define ACS_UARROW '^'
|
||||
#endif
|
||||
#ifndef ACS_DARROW
|
||||
#define ACS_DARROW 'v'
|
||||
#endif
|
||||
|
||||
/* these definitions may work for antique versions of curses */
|
||||
#ifndef HAVE_GETBEGYX
|
||||
#undef getbegyx
|
||||
#define getbegyx(win,y,x) (y = (win)?(win)->_begy:ERR, x = (win)?(win)->_begx:ERR)
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_GETMAXYX
|
||||
#undef getmaxyx
|
||||
#define getmaxyx(win,y,x) (y = (win)?(win)->_maxy:ERR, x = (win)?(win)->_maxx:ERR)
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_GETPARYX
|
||||
#undef getparyx
|
||||
#define getparyx(win,y,x) (y = (win)?(win)->_pary:ERR, x = (win)?(win)->_parx:ERR)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* these definitions may be needed for bleeding-edge curses implementations */
|
||||
#if !(defined(HAVE_GETBEGX) && defined(HAVE_GETBEGY))
|
||||
#undef getbegx
|
||||
#undef getbegy
|
||||
#define getbegx(win) dlg_getbegx(win)
|
||||
#define getbegy(win) dlg_getbegy(win)
|
||||
extern int dlg_getbegx(WINDOW *);
|
||||
extern int dlg_getbegy(WINDOW *);
|
||||
#endif
|
||||
|
||||
#if !(defined(HAVE_GETCURX) && defined(HAVE_GETCURY))
|
||||
#undef getcurx
|
||||
#undef getcury
|
||||
#define getcurx(win) dlg_getcurx(win)
|
||||
#define getcury(win) dlg_getcury(win)
|
||||
extern int dlg_getcurx(WINDOW *);
|
||||
extern int dlg_getcury(WINDOW *);
|
||||
#endif
|
||||
|
||||
#if !(defined(HAVE_GETMAXX) && defined(HAVE_GETMAXY))
|
||||
#undef getmaxx
|
||||
#undef getmaxy
|
||||
#define getmaxx(win) dlg_getmaxx(win)
|
||||
#define getmaxy(win) dlg_getmaxy(win)
|
||||
extern int dlg_getmaxx(WINDOW *);
|
||||
extern int dlg_getmaxy(WINDOW *);
|
||||
#endif
|
||||
|
||||
#if !(defined(HAVE_GETPARX) && defined(HAVE_GETPARY))
|
||||
#undef getparx
|
||||
#undef getpary
|
||||
#define getparx(win) dlg_getparx(win)
|
||||
#define getpary(win) dlg_getpary(win)
|
||||
extern int dlg_getparx(WINDOW *);
|
||||
extern int dlg_getpary(WINDOW *);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This is a list of "old" names, which should be helpful in updating
|
||||
* applications that use libdialog. Starting with 2003/11/26, all exported
|
||||
* symbols from libdialog have "dlg_" prefix, or "dialog_" prefix or "_dialog"
|
||||
* suffix.
|
||||
*/
|
||||
#ifdef __DIALOG_OLD_NAMES__
|
||||
#define color_table dlg_color_table
|
||||
#define attr_clear(win,h,w,a) dlg_attr_clear(win,h,w,a)
|
||||
#define auto_size(t,s,h,w,xl,mc) dlg_auto_size(t,s,h,w,xl,mc)
|
||||
#define auto_sizefile(t,f,h,w,xl,mc) dlg_auto_sizefile(t,f,h,w,xl,mc)
|
||||
#define beeping() dlg_beeping()
|
||||
#define box_x_ordinate(w) dlg_box_x_ordinate(w)
|
||||
#define box_y_ordinate(h) dlg_box_y_ordinate(h)
|
||||
#define calc_listh(h,lh,in) dlg_calc_listh(h,lh,in)
|
||||
#define calc_listw(in,items,group) dlg_calc_listw(in,items,group)
|
||||
#define color_setup() dlg_color_setup()
|
||||
#define create_rc(f) dlg_create_rc(f)
|
||||
#define ctl_size(h,w) dlg_ctl_size(h,w)
|
||||
#define del_window(win) dlg_del_window(win)
|
||||
#define dialog_clear() dlg_clear()
|
||||
#define draw_bottom_box(win) dlg_draw_bottom_box(win)
|
||||
#define draw_box(win,y,x,h,w,xc,bc) dlg_draw_box(win,y,x,h,w,xc,bc)
|
||||
#define draw_shadow(win,h,w,y,x) dlg_draw_shadow(win,h,w,y,x)
|
||||
#define draw_title(win,t) dlg_draw_title(win,t)
|
||||
#define exiterr dlg_exiterr
|
||||
#define killall_bg(n) dlg_killall_bg(n)
|
||||
#define mouse_bigregion(y,x) dlg_mouse_bigregion(y,x)
|
||||
#define mouse_free_regions() dlg_mouse_free_regions()
|
||||
#define mouse_mkbigregion(y,x,h,w,n,ix,iy,m) dlg_mouse_mkbigregion(y,x,h,w,n,ix,iy,m)
|
||||
#define mouse_mkregion(y,x,h,w,n) dlg_mouse_mkregion(y,x,h,w,n)
|
||||
#define mouse_region(y,x) dlg_mouse_region(y,x)
|
||||
#define mouse_setbase(x,y) dlg_mouse_setbase(x,y)
|
||||
#define mouse_wgetch(w,c) dlg_mouse_wgetch(w,c)
|
||||
#define new_window(h,w,y,x) dlg_new_window(h,w,y,x)
|
||||
#define parse_rc() dlg_parse_rc()
|
||||
#define print_autowrap(win,s,h,w) dlg_print_autowrap(win,s,h,w)
|
||||
#define print_size(h,w) dlg_print_size(h,w)
|
||||
#define put_backtitle() dlg_put_backtitle()
|
||||
#define strclone(cprompt) dlg_strclone(cprompt)
|
||||
#define sub_window(win,h,w,y,x) dlg_sub_window(win,h,w,y,x)
|
||||
#define tab_correct_str(s) dlg_tab_correct_str(s)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Attribute names
|
||||
*/
|
||||
#define DIALOG_ATR(n) dlg_color_table[n].atr
|
||||
|
||||
#define screen_attr DIALOG_ATR(0)
|
||||
#define shadow_attr DIALOG_ATR(1)
|
||||
#define dialog_attr DIALOG_ATR(2)
|
||||
#define title_attr DIALOG_ATR(3)
|
||||
#define border_attr DIALOG_ATR(4)
|
||||
#define button_active_attr DIALOG_ATR(5)
|
||||
#define button_inactive_attr DIALOG_ATR(6)
|
||||
#define button_key_active_attr DIALOG_ATR(7)
|
||||
#define button_key_inactive_attr DIALOG_ATR(8)
|
||||
#define button_label_active_attr DIALOG_ATR(9)
|
||||
#define button_label_inactive_attr DIALOG_ATR(10)
|
||||
#define inputbox_attr DIALOG_ATR(11)
|
||||
#define inputbox_border_attr DIALOG_ATR(12)
|
||||
#define searchbox_attr DIALOG_ATR(13)
|
||||
#define searchbox_title_attr DIALOG_ATR(14)
|
||||
#define searchbox_border_attr DIALOG_ATR(15)
|
||||
#define position_indicator_attr DIALOG_ATR(16)
|
||||
#define menubox_attr DIALOG_ATR(17)
|
||||
#define menubox_border_attr DIALOG_ATR(18)
|
||||
#define item_attr DIALOG_ATR(19)
|
||||
#define item_selected_attr DIALOG_ATR(20)
|
||||
#define tag_attr DIALOG_ATR(21)
|
||||
#define tag_selected_attr DIALOG_ATR(22)
|
||||
#define tag_key_attr DIALOG_ATR(23)
|
||||
#define tag_key_selected_attr DIALOG_ATR(24)
|
||||
#define check_attr DIALOG_ATR(25)
|
||||
#define check_selected_attr DIALOG_ATR(26)
|
||||
#define uarrow_attr DIALOG_ATR(27)
|
||||
#define darrow_attr DIALOG_ATR(28)
|
||||
#define itemhelp_attr DIALOG_ATR(29)
|
||||
#define form_active_text_attr DIALOG_ATR(30)
|
||||
#define form_text_attr DIALOG_ATR(31)
|
||||
|
||||
/*
|
||||
* Internal keycodes are used for commands.
|
||||
*/
|
||||
typedef enum {
|
||||
DLGK_min = KEY_MAX + 1
|
||||
, DLGK_NEXT_FIELD
|
||||
, DLGK_PREV_FIELD
|
||||
} DLGK_xxx;
|
||||
|
||||
#define DLGK_max (KEY_MAX + 256)
|
||||
|
||||
/*
|
||||
* Callbacks are used to implement the "background" tailbox.
|
||||
*/
|
||||
typedef struct _dlg_callback {
|
||||
struct _dlg_callback *next;
|
||||
FILE *input;
|
||||
WINDOW *win;
|
||||
bool keep_bg; /* keep in background, on exit */
|
||||
bool bg_task; /* true if this is background task */
|
||||
bool (*handle_getc)(struct _dlg_callback *p, int ch, int fkey, int *result);
|
||||
} DIALOG_CALLBACK;
|
||||
|
||||
typedef struct _dlg_windows {
|
||||
struct _dlg_windows *next;
|
||||
WINDOW *normal;
|
||||
WINDOW *shadow;
|
||||
} DIALOG_WINDOWS;
|
||||
|
||||
/*
|
||||
* Global variables, which are initialized as needed
|
||||
*/
|
||||
typedef struct {
|
||||
DIALOG_CALLBACK *getc_callbacks;
|
||||
DIALOG_CALLBACK *getc_redirect;
|
||||
DIALOG_WINDOWS *all_windows;
|
||||
FILE *output; /* option "--output-fd fd" */
|
||||
FILE *pipe_input; /* used for gauge widget */
|
||||
FILE *screen_output; /* newterm(), etc. */
|
||||
bool screen_initialized;
|
||||
bool use_colors; /* use colors by default? */
|
||||
bool use_scrollbar; /* RESERVED */
|
||||
bool use_shadow; /* shadow dialog boxes by default? */
|
||||
bool visit_items; /* option "--visit-items" */
|
||||
char *separate_str; /* option "--separate-widget string" */
|
||||
int aspect_ratio; /* option "--aspect ratio" */
|
||||
int output_count; /* # of widgets that may have done output */
|
||||
int tab_len; /* option "--tab-len n" */
|
||||
} DIALOG_STATE;
|
||||
|
||||
extern DIALOG_STATE dialog_state;
|
||||
|
||||
/*
|
||||
* Global variables, which dialog resets before each widget
|
||||
*/
|
||||
typedef struct {
|
||||
bool beep_after_signal; /* option "--beep-after" */
|
||||
bool beep_signal; /* option "--beep" */
|
||||
bool begin_set; /* option "--begin y x" was used */
|
||||
bool cant_kill; /* option "--no-kill" */
|
||||
bool colors; /* option "--colors" */
|
||||
bool cr_wrap; /* option "--cr-wrap" */
|
||||
bool defaultno; /* option "--defaultno" */
|
||||
bool dlg_clear_screen; /* option "--clear" */
|
||||
bool extra_button; /* option "--extra-button" */
|
||||
bool help_button; /* option "--help-button" */
|
||||
bool help_status; /* option "--help-status" */
|
||||
bool input_menu; /* menu vs inputmenu widget */
|
||||
bool insecure; /* option "--insecure" */
|
||||
bool item_help; /* option "--item-help" */
|
||||
bool keep_window; /* option "--keep-window" */
|
||||
bool nocancel; /* option "--no-cancel" */
|
||||
bool nocollapse; /* option "--no-collapse" */
|
||||
bool print_siz; /* option "--print-size" */
|
||||
bool separate_output; /* option "--separate-output" */
|
||||
bool single_quoted; /* option "--single-quoted" */
|
||||
bool size_err; /* option "--size-err" */
|
||||
bool tab_correct; /* option "--tab-correct" */
|
||||
bool trim_whitespace; /* option "--trim" */
|
||||
char *backtitle; /* option "--backtitle backtitle" */
|
||||
char *cancel_label; /* option "--cancel-label string" */
|
||||
char *default_item; /* option "--default-item string" */
|
||||
char *exit_label; /* option "--exit-label string" */
|
||||
char *extra_label; /* option "--extra-label string" */
|
||||
char *help_label; /* option "--help-label string" */
|
||||
char *input_result;
|
||||
char *no_label; /* option "--no-label string" */
|
||||
char *ok_label; /* option "--ok-label string" */
|
||||
char *title; /* option "--title title" */
|
||||
char *yes_label; /* option "--yes-label string" */
|
||||
int begin_x; /* option "--begin y x" (second value) */
|
||||
int begin_y; /* option "--begin y x" (first value) */
|
||||
int max_input; /* option "--max-input size" */
|
||||
int scale_factor; /* RESERVED */
|
||||
int sleep_secs; /* option "--sleep secs" */
|
||||
int timeout_secs; /* option "--timeout secs" */
|
||||
unsigned input_length; /* nonzero if input_result is allocated */
|
||||
} DIALOG_VARS;
|
||||
|
||||
#define USE_ITEM_HELP(s) (dialog_vars.item_help && (s) != 0)
|
||||
#define CHECKBOX_TAGS (dialog_vars.item_help ? 4 : 3)
|
||||
#define MENUBOX_TAGS (dialog_vars.item_help ? 3 : 2)
|
||||
#define FORMBOX_TAGS (dialog_vars.item_help ? 9 : 8)
|
||||
|
||||
extern DIALOG_VARS dialog_vars;
|
||||
|
||||
#ifndef HAVE_TYPE_CHTYPE
|
||||
#define chtype long
|
||||
#endif
|
||||
|
||||
#define UCH(ch) ((unsigned char)(ch))
|
||||
|
||||
#define assert_ptr(ptr,msg) if ((ptr) == 0) dlg_exiterr("cannot allocate memory in " msg)
|
||||
|
||||
/*
|
||||
* Table for attribute- and color-values.
|
||||
*/
|
||||
typedef struct {
|
||||
chtype atr;
|
||||
#ifdef HAVE_COLOR
|
||||
int fg;
|
||||
int bg;
|
||||
int hilite;
|
||||
#endif
|
||||
#ifdef HAVE_RC_FILE
|
||||
char *name;
|
||||
char *comment;
|
||||
#endif
|
||||
} DIALOG_COLORS;
|
||||
|
||||
extern DIALOG_COLORS dlg_color_table[];
|
||||
|
||||
/*
|
||||
* Function prototypes
|
||||
*/
|
||||
extern char *dialog_version(void);
|
||||
|
||||
/* widgets, each in separate files */
|
||||
extern int dialog_calendar(const char *title, const char *subtitle, int height, int width, int day, int month, int year);
|
||||
extern int dialog_checklist(const char *title, const char *cprompt, int height, int width, int list_height, int item_no, char ** items, int flag);
|
||||
extern int dialog_form(const char *title, const char *cprompt, int height, int width, int form_height, int item_no, char **items);
|
||||
extern int dialog_fselect(const char *title, const char *path, int height, int width);
|
||||
extern int dialog_gauge(const char *title, const char *cprompt, int height, int width, int percent);
|
||||
extern int dialog_pause(const char *title, const char *cprompt, int height, int width, int seconds);
|
||||
extern int dialog_inputbox(const char *title, const char *cprompt, int height, int width, const char *init, const int password);
|
||||
extern int dialog_menu(const char *title, const char *cprompt, int height, int width, int menu_height, int item_no, char **items);
|
||||
extern int dialog_msgbox(const char *title, const char *cprompt, int height, int width, int pauseopt);
|
||||
extern int dialog_tailbox(const char *title, const char *file, int height, int width, int bg_task);
|
||||
extern int dialog_textbox(const char *title, const char *file, int height, int width);
|
||||
extern int dialog_timebox(const char *title, const char *subtitle, int height, int width, int hour, int minute, int second);
|
||||
extern int dialog_yesno(const char *title, const char *cprompt, int height, int width);
|
||||
|
||||
/* arrows.c */
|
||||
extern void dlg_draw_arrows(WINDOW *dialog, int top_arrow, int bottom_arrow, int x, int top, int bottom);
|
||||
extern void dlg_draw_arrows2(WINDOW *dialog, int top_arrow, int bottom_arrow, int x, int top, int bottom, chtype attr, chtype borderattr);
|
||||
|
||||
/* buttons.c */
|
||||
extern const char ** dlg_exit_label(void);
|
||||
extern const char ** dlg_ok_label(void);
|
||||
extern const char ** dlg_ok_labels(void);
|
||||
extern const char ** dlg_yes_labels(void);
|
||||
extern int dlg_button_count(const char **labels);
|
||||
extern int dlg_button_x_step(const char **labels, int limit, int *gap, int *margin, int *step);
|
||||
extern int dlg_char_to_button(int ch, const char **labels);
|
||||
extern int dlg_match_char(int ch, const char *string);
|
||||
extern int dlg_next_button(const char **labels, int button);
|
||||
extern int dlg_next_ok_buttonindex(int current, int extra);
|
||||
extern int dlg_ok_buttoncode(int button);
|
||||
extern int dlg_prev_button(const char **labels, int button);
|
||||
extern int dlg_prev_ok_buttonindex(int current, int extra);
|
||||
extern void dlg_button_layout(const char **labels, int *limit);
|
||||
extern void dlg_button_sizes(const char **labels, int vertical, int *longest, int *length);
|
||||
extern void dlg_draw_buttons(WINDOW *win, int y, int x, const char **labels, int selected, int vertical, int limit);
|
||||
|
||||
/* inputstr.c */
|
||||
extern bool dlg_edit_string(char *string, int *offset, int key, int fkey, bool force);
|
||||
extern const int * dlg_index_columns(const char *string);
|
||||
extern const int * dlg_index_wchars(const char *string);
|
||||
extern int dlg_count_columns(const char *string);
|
||||
extern int dlg_count_wchars(const char *string);
|
||||
extern int dlg_edit_offset(char *string, int offset, int x_last);
|
||||
extern int dlg_limit_columns(const char *string, int limit, int offset);
|
||||
extern void dlg_show_string(WINDOW *win, const char *string, int offset, chtype attr, int y_base, int x_base, int x_last, bool hidden, bool force);
|
||||
|
||||
/* rc.c */
|
||||
#ifdef HAVE_RC_FILE
|
||||
extern int dlg_parse_rc(void);
|
||||
extern void dlg_create_rc(const char *filename);
|
||||
#endif
|
||||
|
||||
/* ui_getc.c */
|
||||
extern int dlg_getc(WINDOW *win, int *fkey);
|
||||
extern int dlg_getc_callbacks(int ch, int fkey, int *result);
|
||||
extern int dlg_last_getc(void);
|
||||
extern void dlg_add_callback(DIALOG_CALLBACK *p);
|
||||
extern void dlg_flush_getc(void);
|
||||
extern void dlg_remove_callback(DIALOG_CALLBACK *p);
|
||||
extern void dlg_killall_bg(int *retval);
|
||||
|
||||
/* util.c */
|
||||
extern WINDOW * dlg_new_window(int height, int width, int y, int x);
|
||||
extern WINDOW * dlg_sub_window(WINDOW *win, int height, int width, int y, int x);
|
||||
extern char * dlg_strclone(const char *cprompt);
|
||||
extern int dlg_box_x_ordinate(int width);
|
||||
extern int dlg_box_y_ordinate(int height);
|
||||
extern int dlg_calc_listw(int item_no, char **items, int group);
|
||||
extern int dlg_default_item(char **items, int llen);
|
||||
extern int dlg_defaultno_button(void);
|
||||
extern void dlg_add_quoted(char *string);
|
||||
extern void dlg_add_result(char *string);
|
||||
extern void dlg_attr_clear(WINDOW * win, int height, int width, chtype attr);
|
||||
extern void dlg_auto_size(const char * title, const char *prompt, int *height, int *width, int boxlines, int mincols);
|
||||
extern void dlg_auto_sizefile(const char * title, const char *file, int *height, int *width, int boxlines, int mincols);
|
||||
extern void dlg_beeping(void);
|
||||
extern void dlg_calc_listh(int *height, int *list_height, int item_no);
|
||||
extern void dlg_clear(void);
|
||||
extern void dlg_ctl_size(int height, int width);
|
||||
extern void dlg_del_window(WINDOW *win);
|
||||
extern void dlg_does_output(void);
|
||||
extern void dlg_draw_bottom_box(WINDOW *win);
|
||||
extern void dlg_draw_box(WINDOW * win, int y, int x, int height, int width, chtype boxchar, chtype borderchar);
|
||||
extern void dlg_draw_title(WINDOW *win, const char *title);
|
||||
extern void dlg_exit(int code) GCC_NORETURN;
|
||||
extern void dlg_item_help(char *txt);
|
||||
extern void dlg_print_autowrap(WINDOW *win, const char *prompt, int height, int width);
|
||||
extern void dlg_print_size(int height, int width);
|
||||
extern void dlg_print_text(WINDOW *win, const char *txt, int len, chtype *attr);
|
||||
extern void dlg_put_backtitle(void);
|
||||
extern void dlg_set_focus(WINDOW *parent, WINDOW *win);
|
||||
extern void dlg_tab_correct_str(char *prompt);
|
||||
extern void dlg_trim_string(char *src);
|
||||
extern void end_dialog(void);
|
||||
extern void init_dialog(FILE *input, FILE * output);
|
||||
|
||||
extern void dlg_exiterr(const char *, ...)
|
||||
#if defined(__GNUC__) && !defined(printf)
|
||||
__attribute__((format(printf,1,2)))
|
||||
#endif
|
||||
;
|
||||
|
||||
#ifdef HAVE_COLOR
|
||||
extern chtype dlg_color_pair(int foreground, int background);
|
||||
extern int dlg_color_count(void);
|
||||
extern void dlg_color_setup(void);
|
||||
extern void dlg_draw_shadow(WINDOW * win, int height, int width, int y, int x);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRCASECMP
|
||||
#define dlg_strcmp(a,b) strcasecmp(a,b)
|
||||
#else
|
||||
extern int dlg_strcmp(const char *a, const char *b);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The following stuff is needed for mouse support
|
||||
*/
|
||||
typedef struct mseRegion {
|
||||
int x, y, X, Y, code;
|
||||
int mode, step_x, step_y;
|
||||
struct mseRegion *next;
|
||||
} mseRegion;
|
||||
|
||||
#if defined(NCURSES_MOUSE_VERSION)
|
||||
|
||||
#define mouse_open() mousemask(BUTTON1_CLICKED, (mmask_t *) 0)
|
||||
#define mouse_close() mousemask(0, (mmask_t *) 0)
|
||||
|
||||
extern mseRegion * dlg_mouse_mkregion (int y, int x, int height, int width, int code);
|
||||
extern void dlg_mouse_free_regions (void);
|
||||
extern void dlg_mouse_mkbigregion (int y, int x, int height, int width, int code, int step_x, int step_y, int mode);
|
||||
extern void dlg_mouse_setbase (int x, int y);
|
||||
|
||||
#define USE_MOUSE 1
|
||||
|
||||
#else
|
||||
|
||||
#define mouse_open() /*nothing*/
|
||||
#define mouse_close() /*nothing*/
|
||||
#define dlg_mouse_free_regions() /* nothing */
|
||||
#define dlg_mouse_mkregion(y, x, height, width, code) /*nothing*/
|
||||
#define dlg_mouse_mkbigregion(y, x, height, width, code, step_x, step_y, mode) /*nothing*/
|
||||
#define dlg_mouse_setbase(x, y) /*nothing*/
|
||||
|
||||
#define USE_MOUSE 0
|
||||
|
||||
#endif
|
||||
|
||||
extern mseRegion *dlg_mouse_region (int y, int x);
|
||||
extern mseRegion *dlg_mouse_bigregion (int y, int x);
|
||||
extern int dlg_mouse_wgetch (WINDOW *, int *);
|
||||
extern int dlg_mouse_wgetch_nowait (WINDOW *, int *);
|
||||
|
||||
#define mouse_mkbutton(y,x,len,code) dlg_mouse_mkregion(y,x,1,len,code);
|
||||
|
||||
/*
|
||||
* This is the base for fictitious keys, which activate
|
||||
* the buttons.
|
||||
*
|
||||
* Mouse-generated keys are the following:
|
||||
* -- the first 32 are used as numbers, in addition to '0'-'9'
|
||||
* -- the lowercase are used to signal mouse-enter events (M_EVENT + 'o')
|
||||
* -- uppercase chars are used to invoke the button (M_EVENT + 'O')
|
||||
*/
|
||||
#define M_EVENT (DLGK_max + 1)
|
||||
|
||||
/*
|
||||
* The `flag' parameter in checklist is used to select between
|
||||
* radiolist and checklist
|
||||
*/
|
||||
#define FLAG_CHECK 1
|
||||
#define FLAG_RADIO 0
|
||||
|
||||
/*
|
||||
* This is used only for debugging (FIXME: should have a separate header).
|
||||
*/
|
||||
#ifdef NO_LEAKS
|
||||
extern void _dlg_inputstr_leaks(void);
|
||||
#ifdef NCURSES_VERSION
|
||||
extern void _nc_free_and_exit(int); /* nc_alloc.h normally not installed */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* DIALOG_H_included */
|
||||
23
extra/dialog-1.0-20050306/dialog.lsm
Normal file
23
extra/dialog-1.0-20050306/dialog.lsm
Normal file
@@ -0,0 +1,23 @@
|
||||
Begin3
|
||||
Title: dialog - Display dialog boxes in scripts
|
||||
Version: 1.0-20050306
|
||||
Entered-date: 06MAR05
|
||||
Description: Dialog is a program that will let you present a variety
|
||||
of questions or display messages in nice looking color
|
||||
non-graphical dialog boxes from a shell or perl script.
|
||||
Various dialog boxes can be presented such as yes/no, menu,
|
||||
input, message, checklist, radiolist, and more.
|
||||
|
||||
This program is based on the no longer maintained cdialog, but
|
||||
contains bug fixes and more features.
|
||||
Keywords: dialog, cdialog, shell, script, window
|
||||
Author: Originally Savio Lam for the ancient version
|
||||
Maintained-by: Vila, Santiago <sanvila@debian.org>
|
||||
T.E.Dickey <dickey@invisible-island.net>
|
||||
Primary-site: http://invisible-island.net/dialog/
|
||||
http://packages.debian.org/
|
||||
Alternate-site: ftp://ftp.us.debian.org/debian/pool/main/d/dialog/
|
||||
Original-site: ftp://sunsite.unc.edu/pub/Linux/utils/shell
|
||||
Platforms: Linux *nix, OS/2 EMX
|
||||
Copying-policy: GPL
|
||||
End
|
||||
BIN
extra/dialog-1.0-20050306/dialog.o
Normal file
BIN
extra/dialog-1.0-20050306/dialog.o
Normal file
Binary file not shown.
454
extra/dialog-1.0-20050306/dialog.pl
Normal file
454
extra/dialog-1.0-20050306/dialog.pl
Normal file
@@ -0,0 +1,454 @@
|
||||
# Functions that handle calling dialog(1) -*-perl-*-
|
||||
# $Id: dialog.pl,v 1.4 2001/10/13 00:40:22 tom Exp $
|
||||
|
||||
# Return values are 1 for success and 0 for failure (or cancel)
|
||||
# Resultant text (if any) is in dialog_result
|
||||
|
||||
# Unfortunately, the gauge requires use of /bin/sh to get going.
|
||||
# I didn't bother to make the others shell-free, although it
|
||||
# would be simple to do.
|
||||
|
||||
# Note that dialog generally returns 0 for success, so I invert the
|
||||
# sense of the return code for more readable boolean expressions.
|
||||
|
||||
$scr_lines = 24;
|
||||
|
||||
require "flush.pl";
|
||||
|
||||
sub rhs_clear {
|
||||
return system("dialog --clear");
|
||||
}
|
||||
|
||||
sub rhs_textbox {
|
||||
local ( $title, $file, $width, $height ) = @_;
|
||||
|
||||
system("dialog --title \"$title\" --textbox $file $height $width");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
sub rhs_msgbox {
|
||||
local ( $title, $message, $width ) = @_;
|
||||
local ( $tmp, $height, $message_len );
|
||||
|
||||
$message = &rhs_wordwrap($message, $width);
|
||||
$message_len = split(/^/, $message);
|
||||
$tmp = $message;
|
||||
if (chop($tmp) eq "\n") {
|
||||
$message_len++;
|
||||
}
|
||||
$height = 4 + $message_len;
|
||||
|
||||
$tmp = system("dialog --title \"$title\" --msgbox \"$message\" $height $width");
|
||||
if ($tmp) {
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
sub rhs_infobox {
|
||||
local ( $title, $message, $width ) = @_;
|
||||
local ( $tmp, $height, $message_len );
|
||||
|
||||
$message = &rhs_wordwrap($message, $width);
|
||||
$message_len = split(/^/, $message);
|
||||
$tmp = $message;
|
||||
if (chop($tmp) eq "\n") {
|
||||
$message_len++;
|
||||
}
|
||||
$height = 2 + $message_len;
|
||||
|
||||
return system("dialog --title \"$title\" --infobox \"$message\" $height $width");
|
||||
}
|
||||
|
||||
sub rhs_yesno {
|
||||
local ( $title, $message, $width ) = @_;
|
||||
local ( $tmp, $height, $message_len );
|
||||
|
||||
$message = &rhs_wordwrap($message, $width);
|
||||
$message_len = split(/^/, $message);
|
||||
$tmp = $message;
|
||||
if (chop($tmp) eq "\n") {
|
||||
$message_len++;
|
||||
}
|
||||
$height = 4 + $message_len;
|
||||
|
||||
$tmp = system("dialog --title \"$title\" --yesno \"$message\" $height $width");
|
||||
# Dumb: dialog returns 0 for "yes" and 1 for "no"
|
||||
if (! $tmp) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
sub rhs_gauge {
|
||||
local ( $title, $message, $width, $percent ) = @_;
|
||||
local ( $tmp, $height, $message_len );
|
||||
|
||||
$gauge_width = $width;
|
||||
|
||||
$message = &rhs_wordwrap($message, $width);
|
||||
$message_len = split(/^/, $message);
|
||||
$tmp = $message;
|
||||
if (chop($tmp) eq "\n") {
|
||||
$message_len++;
|
||||
}
|
||||
$height = 5 + $message_len;
|
||||
|
||||
open(GAUGE, "|dialog --title \"$title\" --gauge \"$message\" $height $width $percent");
|
||||
}
|
||||
|
||||
sub rhs_update_gauge {
|
||||
local ( $percent ) = @_;
|
||||
|
||||
&printflush(GAUGE, "$percent\n");
|
||||
}
|
||||
|
||||
sub rhs_update_gauge_and_message {
|
||||
local ( $message, $percent ) = @_;
|
||||
|
||||
$message = &rhs_wordwrap($message, $gauge_width);
|
||||
$message =~ s/\n/\\n/g;
|
||||
&printflush(GAUGE, "XXX\n$percent\n$message\nXXX\n");
|
||||
}
|
||||
|
||||
sub rhs_stop_gauge {
|
||||
close GAUGE;
|
||||
}
|
||||
|
||||
sub rhs_inputbox {
|
||||
local ( $title, $message, $width, $instr ) = @_;
|
||||
local ( $tmp, $height, $message_len );
|
||||
|
||||
$message = &rhs_wordwrap($message, $width);
|
||||
$message_len = split(/^/, $message);
|
||||
$tmp = $message;
|
||||
if (chop($tmp) eq "\n") {
|
||||
$message_len++;
|
||||
}
|
||||
$height = 7 + $message_len;
|
||||
|
||||
return &return_output(0, "dialog --title \"$title\" --inputbox \"$message\" $height $width \"$instr\"");
|
||||
}
|
||||
|
||||
sub rhs_menu {
|
||||
local ( $title, $message, $width, $numitems ) = @_;
|
||||
local ( $i, $tmp, $ent, $height, $menuheight, @list, $message_len );
|
||||
|
||||
shift; shift; shift; shift;
|
||||
|
||||
@list = ();
|
||||
for ($i = 0; $i < $numitems; $i++) {
|
||||
$ent = shift;
|
||||
$list[@list] = "\"$ent\"";
|
||||
$ent = shift;
|
||||
$list[@list] = "\"$ent\"";
|
||||
}
|
||||
|
||||
$message = &rhs_wordwrap($message, $width);
|
||||
|
||||
$message_len = split(/^/, $message);
|
||||
$tmp = $message;
|
||||
if (chop($tmp) eq "\n") {
|
||||
$message_len++;
|
||||
}
|
||||
|
||||
$height = $message_len + 6 + $numitems;
|
||||
if ($height <= $scr_lines) {
|
||||
$menuheight = $numitems;
|
||||
} else {
|
||||
$height = $scr_lines;
|
||||
$menuheight = $scr_lines - $message_len - 6;
|
||||
}
|
||||
|
||||
return &return_output(0, "dialog --title \"$title\" --menu \"$message\" $height $width $menuheight @list");
|
||||
}
|
||||
|
||||
sub rhs_menul {
|
||||
local ( $title, $message, $width, $numitems ) = @_;
|
||||
local ( $i, $tmp, $ent, $height, $menuheight, @list, $message_len );
|
||||
|
||||
shift; shift; shift; shift;
|
||||
|
||||
@list = ();
|
||||
for ($i = 0; $i < $numitems; $i++) {
|
||||
$ent = shift;
|
||||
$list[@list] = "\"$ent\"";
|
||||
$list[@list] = "\"\"";
|
||||
}
|
||||
|
||||
$message = &rhs_wordwrap($message, $width);
|
||||
|
||||
$message_len = split(/^/, $message);
|
||||
$tmp = $message;
|
||||
if (chop($tmp) eq "\n") {
|
||||
$message_len++;
|
||||
}
|
||||
|
||||
$height = $message_len + 6 + $numitems;
|
||||
if ($height <= $scr_lines) {
|
||||
$menuheight = $numitems;
|
||||
} else {
|
||||
$height = $scr_lines;
|
||||
$menuheight = $scr_lines - $message_len - 6;
|
||||
}
|
||||
|
||||
return &return_output(0, "dialog --title \"$title\" --menu \"$message\" $height $width $menuheight @list");
|
||||
}
|
||||
|
||||
sub rhs_menua {
|
||||
local ( $title, $message, $width, %items ) = @_;
|
||||
local ( $tmp, $ent, $height, $menuheight, @list, $message_len );
|
||||
|
||||
@list = ();
|
||||
foreach $ent (sort keys (%items)) {
|
||||
$list[@list] = "\"$ent\"";
|
||||
$list[@list] = "\"$items{$ent}\"";
|
||||
}
|
||||
|
||||
$message = &rhs_wordwrap($message, $width);
|
||||
|
||||
$message_len = split(/^/, $message);
|
||||
$tmp = $message;
|
||||
if (chop($tmp) eq "\n") {
|
||||
$message_len++;
|
||||
}
|
||||
|
||||
$numitems = keys(%items);
|
||||
$height = $message_len + 6 + $numitems;
|
||||
if ($height <= $scr_lines) {
|
||||
$menuheight = $numitems;
|
||||
} else {
|
||||
$height = $scr_lines;
|
||||
$menuheight = $scr_lines - $message_len - 6;
|
||||
}
|
||||
|
||||
return &return_output(0, "dialog --title \"$title\" --menu \"$message\" $height $width $menuheight @list");
|
||||
}
|
||||
|
||||
sub rhs_checklist {
|
||||
local ( $title, $message, $width, $numitems ) = @_;
|
||||
local ( $i, $tmp, $ent, $height, $menuheight, @list, $message_len );
|
||||
|
||||
shift; shift; shift; shift;
|
||||
|
||||
@list = ();
|
||||
for ($i = 0; $i < $numitems; $i++) {
|
||||
$ent = shift;
|
||||
$list[@list] = "\"$ent\"";
|
||||
$ent = shift;
|
||||
$list[@list] = "\"$ent\"";
|
||||
$ent = shift;
|
||||
if ($ent) {
|
||||
$list[@list] = "ON";
|
||||
} else {
|
||||
$list[@list] = "OFF";
|
||||
}
|
||||
}
|
||||
|
||||
$message = &rhs_wordwrap($message, $width);
|
||||
|
||||
$message_len = split(/^/, $message);
|
||||
$tmp = $message;
|
||||
if (chop($tmp) eq "\n") {
|
||||
$message_len++;
|
||||
}
|
||||
|
||||
$height = $message_len + 6 + $numitems;
|
||||
if ($height <= $scr_lines) {
|
||||
$menuheight = $numitems;
|
||||
} else {
|
||||
$height = $scr_lines;
|
||||
$menuheight = $scr_lines - $message_len - 6;
|
||||
}
|
||||
|
||||
return &return_output("list", "dialog --title \"$title\" --separate-output --checklist \"$message\" $height $width $menuheight @list");
|
||||
}
|
||||
|
||||
sub rhs_checklistl {
|
||||
local ( $title, $message, $width, $numitems ) = @_;
|
||||
local ( $i, $tmp, $ent, $height, $menuheight, @list, $message_len );
|
||||
|
||||
shift; shift; shift; shift;
|
||||
|
||||
@list = ();
|
||||
for ($i = 0; $i < $numitems; $i++) {
|
||||
$ent = shift;
|
||||
$list[@list] = "\"$ent\"";
|
||||
$list[@list] = "\"\"";
|
||||
$list[@list] = "OFF";
|
||||
}
|
||||
|
||||
$message = &rhs_wordwrap($message, $width);
|
||||
|
||||
$message_len = split(/^/, $message);
|
||||
$tmp = $message;
|
||||
if (chop($tmp) eq "\n") {
|
||||
$message_len++;
|
||||
}
|
||||
|
||||
$height = $message_len + 6 + $numitems;
|
||||
if ($height <= $scr_lines) {
|
||||
$menuheight = $numitems;
|
||||
} else {
|
||||
$height = $scr_lines;
|
||||
$menuheight = $scr_lines - $message_len - 6;
|
||||
}
|
||||
return &return_output("list", "dialog --title \"$title\" --separate-output --checklist \"$message\" $height $width $menuheight @list");
|
||||
}
|
||||
|
||||
sub rhs_checklista {
|
||||
local ( $title, $message, $width, %items ) = @_;
|
||||
local ( $tmp, $ent, $height, $menuheight, @list, $message_len );
|
||||
|
||||
shift; shift; shift; shift;
|
||||
|
||||
@list = ();
|
||||
foreach $ent (sort keys (%items)) {
|
||||
$list[@list] = "\"$ent\"";
|
||||
$list[@list] = "\"$items{$ent}\"";
|
||||
$list[@list] = "OFF";
|
||||
}
|
||||
|
||||
$message = &rhs_wordwrap($message, $width);
|
||||
|
||||
$message_len = split(/^/, $message);
|
||||
$tmp = $message;
|
||||
if (chop($tmp) eq "\n") {
|
||||
$message_len++;
|
||||
}
|
||||
|
||||
$numitems = keys(%items);
|
||||
$height = $message_len + 6 + $numitems;
|
||||
if ($height <= $scr_lines) {
|
||||
$menuheight = $numitems;
|
||||
} else {
|
||||
$height = $scr_lines;
|
||||
$menuheight = $scr_lines - $message_len - 6;
|
||||
}
|
||||
|
||||
return &return_output("list", "dialog --title \"$title\" --separate-output --checklist \"$message\" $height $width $menuheight @list");
|
||||
}
|
||||
|
||||
sub rhs_radiolist {
|
||||
local ( $title, $message, $width, $numitems ) = @_;
|
||||
local ( $i, $tmp, $ent, $height, $menuheight, @list, $message_len );
|
||||
|
||||
shift; shift; shift; shift;
|
||||
|
||||
@list = ();
|
||||
for ($i = 0; $i < $numitems; $i++) {
|
||||
$ent = shift;
|
||||
$list[@list] = "\"$ent\"";
|
||||
$ent = shift;
|
||||
$list[@list] = "\"$ent\"";
|
||||
$ent = shift;
|
||||
if ($ent) {
|
||||
$list[@list] = "ON";
|
||||
} else {
|
||||
$list[@list] = "OFF";
|
||||
}
|
||||
}
|
||||
|
||||
$message = &rhs_wordwrap($message, $width);
|
||||
|
||||
$message_len = split(/^/, $message);
|
||||
$tmp = $message;
|
||||
if (chop($tmp) eq "\n") {
|
||||
$message_len++;
|
||||
}
|
||||
|
||||
$height = $message_len + 6 + $numitems;
|
||||
if ($height <= $scr_lines) {
|
||||
$menuheight = $numitems;
|
||||
} else {
|
||||
$height = $scr_lines;
|
||||
$menuheight = $scr_lines - $message_len - 6;
|
||||
}
|
||||
|
||||
return &return_output(0 , "dialog --title \"$title\" --radiolist \"$message\" $height $width $menuheight @list");
|
||||
}
|
||||
|
||||
sub return_output {
|
||||
local ( $listp, $command ) = @_;
|
||||
local ( $res ) = 1;
|
||||
|
||||
pipe(PARENT_READER, CHILD_WRITER);
|
||||
# We have to fork (as opposed to using "system") so that the parent
|
||||
# process can read from the pipe to avoid deadlock.
|
||||
my ($pid) = fork;
|
||||
if ($pid == 0) { # child
|
||||
close(PARENT_READER);
|
||||
open(STDERR, ">&CHILD_WRITER");
|
||||
exec($command);
|
||||
die("no exec");
|
||||
}
|
||||
if ($pid > 0) { # parent
|
||||
close( CHILD_WRITER );
|
||||
if ($listp) {
|
||||
@dialog_result = ();
|
||||
while (<PARENT_READER>) {
|
||||
chop;
|
||||
$dialog_result[@dialog_result] = $_;
|
||||
}
|
||||
}
|
||||
else { $dialog_result = <PARENT_READER>; }
|
||||
close(PARENT_READER);
|
||||
waitpid($pid,0);
|
||||
$res = $?;
|
||||
}
|
||||
|
||||
# Again, dialog returns results backwards
|
||||
if (! $res) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
sub rhs_wordwrap {
|
||||
local ( $intext, $width ) = @_;
|
||||
local ( $outtext, $i, $j, @lines, $wrap, @words, $pos, $pad );
|
||||
|
||||
$outtext = "";
|
||||
$pad = 3; # leave 3 spaces around each line
|
||||
$pos = $pad; # current insert position
|
||||
$wrap = 0; # 1 if we have been auto wraping
|
||||
$insert_nl = 0; # 1 if we just did an absolute
|
||||
# and we should preface any new text
|
||||
# with a new line
|
||||
@lines = split(/\n/, $intext);
|
||||
for ($i = 0; $i <= $#lines; $i++) {
|
||||
if ($lines[$i] =~ /^>/) {
|
||||
$outtext .= "\n" if ($insert_nl);
|
||||
$outtext .= "\n" if ($wrap);
|
||||
$lines[$i] =~ /^>(.*)$/;
|
||||
$outtext .= $1;
|
||||
$insert_nl = 1;
|
||||
$wrap = 0;
|
||||
$pos = $pad;
|
||||
} else {
|
||||
$wrap = 1;
|
||||
@words = split(/\s+/,$lines[$i]);
|
||||
for ($j = 0; $j <= $#words; $j++) {
|
||||
if ($insert_nl) {
|
||||
$outtext .= "\n";
|
||||
$insert_nl = 0;
|
||||
}
|
||||
if ((length($words[$j]) + $pos) > $width - $pad) {
|
||||
$outtext .= "\n";
|
||||
$pos = $pad;
|
||||
}
|
||||
$outtext .= $words[$j] . " ";
|
||||
$pos += length($words[$j]) + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $outtext;
|
||||
}
|
||||
|
||||
############
|
||||
1;
|
||||
177
extra/dialog-1.0-20050306/dlg_colors.h
Normal file
177
extra/dialog-1.0-20050306/dlg_colors.h
Normal file
@@ -0,0 +1,177 @@
|
||||
/*
|
||||
* $Id: dlg_colors.h,v 1.10 2004/09/18 11:36:55 tom Exp $
|
||||
*
|
||||
* colors.h -- color attribute definitions
|
||||
*
|
||||
* AUTHOR: Savio Lam (lam836@cs.cuhk.hk)
|
||||
* and: Thomas E. Dickey
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef COLORS_H_included
|
||||
#define COLORS_H_included 1
|
||||
|
||||
#include <dialog.h>
|
||||
|
||||
/*
|
||||
* Default color definitions
|
||||
*
|
||||
* *_FG = foreground
|
||||
* *_BG = background
|
||||
* *_HL = highlight?
|
||||
*/
|
||||
#define SCREEN_FG COLOR_CYAN
|
||||
#define SCREEN_BG COLOR_BLUE
|
||||
#define SCREEN_HL TRUE
|
||||
|
||||
#define SHADOW_FG COLOR_BLACK
|
||||
#define SHADOW_BG COLOR_BLACK
|
||||
#define SHADOW_HL TRUE
|
||||
|
||||
#define DIALOG_FG COLOR_BLACK
|
||||
#define DIALOG_BG COLOR_WHITE
|
||||
#define DIALOG_HL FALSE
|
||||
|
||||
#define TITLE_FG COLOR_BLUE
|
||||
#define TITLE_BG COLOR_WHITE
|
||||
#define TITLE_HL TRUE
|
||||
|
||||
#define BORDER_FG COLOR_WHITE
|
||||
#define BORDER_BG COLOR_WHITE
|
||||
#define BORDER_HL TRUE
|
||||
|
||||
#define BUTTON_ACTIVE_FG COLOR_WHITE
|
||||
#define BUTTON_ACTIVE_BG COLOR_BLUE
|
||||
#define BUTTON_ACTIVE_HL TRUE
|
||||
|
||||
#define BUTTON_INACTIVE_FG COLOR_BLACK
|
||||
#define BUTTON_INACTIVE_BG COLOR_WHITE
|
||||
#define BUTTON_INACTIVE_HL FALSE
|
||||
|
||||
#define BUTTON_KEY_ACTIVE_FG COLOR_WHITE
|
||||
#define BUTTON_KEY_ACTIVE_BG COLOR_BLUE
|
||||
#define BUTTON_KEY_ACTIVE_HL TRUE
|
||||
|
||||
#define BUTTON_KEY_INACTIVE_FG COLOR_RED
|
||||
#define BUTTON_KEY_INACTIVE_BG COLOR_WHITE
|
||||
#define BUTTON_KEY_INACTIVE_HL FALSE
|
||||
|
||||
#define BUTTON_LABEL_ACTIVE_FG COLOR_YELLOW
|
||||
#define BUTTON_LABEL_ACTIVE_BG COLOR_BLUE
|
||||
#define BUTTON_LABEL_ACTIVE_HL TRUE
|
||||
|
||||
#define BUTTON_LABEL_INACTIVE_FG COLOR_BLACK
|
||||
#define BUTTON_LABEL_INACTIVE_BG COLOR_WHITE
|
||||
#define BUTTON_LABEL_INACTIVE_HL TRUE
|
||||
|
||||
#define INPUTBOX_FG COLOR_BLACK
|
||||
#define INPUTBOX_BG COLOR_WHITE
|
||||
#define INPUTBOX_HL FALSE
|
||||
|
||||
#define INPUTBOX_BORDER_FG COLOR_BLACK
|
||||
#define INPUTBOX_BORDER_BG COLOR_WHITE
|
||||
#define INPUTBOX_BORDER_HL FALSE
|
||||
|
||||
#define SEARCHBOX_FG COLOR_BLACK
|
||||
#define SEARCHBOX_BG COLOR_WHITE
|
||||
#define SEARCHBOX_HL FALSE
|
||||
|
||||
#define SEARCHBOX_TITLE_FG COLOR_BLUE
|
||||
#define SEARCHBOX_TITLE_BG COLOR_WHITE
|
||||
#define SEARCHBOX_TITLE_HL TRUE
|
||||
|
||||
#define SEARCHBOX_BORDER_FG COLOR_WHITE
|
||||
#define SEARCHBOX_BORDER_BG COLOR_WHITE
|
||||
#define SEARCHBOX_BORDER_HL TRUE
|
||||
|
||||
#define POSITION_INDICATOR_FG COLOR_BLUE
|
||||
#define POSITION_INDICATOR_BG COLOR_WHITE
|
||||
#define POSITION_INDICATOR_HL TRUE
|
||||
|
||||
#define MENUBOX_FG COLOR_BLACK
|
||||
#define MENUBOX_BG COLOR_WHITE
|
||||
#define MENUBOX_HL FALSE
|
||||
|
||||
#define MENUBOX_BORDER_FG COLOR_WHITE
|
||||
#define MENUBOX_BORDER_BG COLOR_WHITE
|
||||
#define MENUBOX_BORDER_HL TRUE
|
||||
|
||||
#define ITEM_FG COLOR_BLACK
|
||||
#define ITEM_BG COLOR_WHITE
|
||||
#define ITEM_HL FALSE
|
||||
|
||||
#define ITEM_SELECTED_FG COLOR_WHITE
|
||||
#define ITEM_SELECTED_BG COLOR_BLUE
|
||||
#define ITEM_SELECTED_HL TRUE
|
||||
|
||||
#define TAG_FG COLOR_BLUE
|
||||
#define TAG_BG COLOR_WHITE
|
||||
#define TAG_HL TRUE
|
||||
|
||||
#define TAG_SELECTED_FG COLOR_YELLOW
|
||||
#define TAG_SELECTED_BG COLOR_BLUE
|
||||
#define TAG_SELECTED_HL TRUE
|
||||
|
||||
#define TAG_KEY_FG COLOR_RED
|
||||
#define TAG_KEY_BG COLOR_WHITE
|
||||
#define TAG_KEY_HL FALSE
|
||||
|
||||
#define TAG_KEY_SELECTED_FG COLOR_RED
|
||||
#define TAG_KEY_SELECTED_BG COLOR_BLUE
|
||||
#define TAG_KEY_SELECTED_HL TRUE
|
||||
|
||||
#define CHECK_FG COLOR_BLACK
|
||||
#define CHECK_BG COLOR_WHITE
|
||||
#define CHECK_HL FALSE
|
||||
|
||||
#define CHECK_SELECTED_FG COLOR_WHITE
|
||||
#define CHECK_SELECTED_BG COLOR_BLUE
|
||||
#define CHECK_SELECTED_HL TRUE
|
||||
|
||||
#define UARROW_FG COLOR_GREEN
|
||||
#define UARROW_BG COLOR_WHITE
|
||||
#define UARROW_HL TRUE
|
||||
|
||||
#define DARROW_FG COLOR_GREEN
|
||||
#define DARROW_BG COLOR_WHITE
|
||||
#define DARROW_HL TRUE
|
||||
|
||||
#define ITEMHELP_FG COLOR_WHITE
|
||||
#define ITEMHELP_BG COLOR_BLACK
|
||||
#define ITEMHELP_HL FALSE
|
||||
|
||||
#define FORM_ACTIVE_TEXT_FG COLOR_WHITE
|
||||
#define FORM_ACTIVE_TEXT_BG COLOR_BLUE
|
||||
#define FORM_ACTIVE_TEXT_HL TRUE
|
||||
|
||||
#define FORM_TEXT_FG COLOR_WHITE
|
||||
#define FORM_TEXT_BG COLOR_CYAN
|
||||
#define FORM_TEXT_HL TRUE
|
||||
|
||||
/* End of default color definitions */
|
||||
|
||||
#define COLOR_COUNT 8
|
||||
|
||||
/*
|
||||
* Global variables
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
int value;
|
||||
} color_names_st;
|
||||
|
||||
#endif /* COLORS_H_included */
|
||||
84
extra/dialog-1.0-20050306/dlg_config.h
Normal file
84
extra/dialog-1.0-20050306/dlg_config.h
Normal file
@@ -0,0 +1,84 @@
|
||||
/* dlg_config.h. Generated automatically by configure. */
|
||||
/*
|
||||
* The configure script expands this as a set of definitions
|
||||
*/
|
||||
|
||||
#define DIALOG_PATCHDATE 20050306
|
||||
#define DIALOG_VERSION "1.0"
|
||||
#define HAVE_ALLOCA 1
|
||||
#define HAVE_ALLOCA_H 1
|
||||
#define HAVE_ARGZ_H 1
|
||||
#define HAVE_COLOR 1
|
||||
#define HAVE_CURSES_H 1
|
||||
#define HAVE_DIRENT_H 1
|
||||
#define HAVE_FEOF_UNLOCKED 1
|
||||
#define HAVE_FGETS_UNLOCKED 1
|
||||
#define HAVE_FLUSHINP 1
|
||||
#define HAVE_FORMBOX 1
|
||||
#define HAVE_GAUGE 1
|
||||
#define HAVE_GETBEGX 1
|
||||
#define HAVE_GETBEGY 1
|
||||
#define HAVE_GETBEGYX 1
|
||||
#define HAVE_GETCURX 1
|
||||
#define HAVE_GETCURY 1
|
||||
#define HAVE_GETCWD 1
|
||||
#define HAVE_GETEGID 1
|
||||
#define HAVE_GETEUID 1
|
||||
#define HAVE_GETGID 1
|
||||
#define HAVE_GETMAXX 1
|
||||
#define HAVE_GETMAXY 1
|
||||
#define HAVE_GETMAXYX 1
|
||||
#define HAVE_GETPAGESIZE 1
|
||||
#define HAVE_GETPARX 1
|
||||
#define HAVE_GETPARY 1
|
||||
#define HAVE_GETPARYX 1
|
||||
#define HAVE_GETUID 1
|
||||
#define HAVE_ICONV 1
|
||||
#define HAVE_INTTYPES_H 1
|
||||
#define HAVE_LANGINFO_CODESET 1
|
||||
#define HAVE_LC_MESSAGES 1
|
||||
#define HAVE_LIMITS_H 1
|
||||
#define HAVE_LOCALE_H 1
|
||||
#define HAVE_MALLOC_H 1
|
||||
#define HAVE_MEMORY_H 1
|
||||
#define HAVE_MEMPCPY 1
|
||||
#define HAVE_MMAP 1
|
||||
#define HAVE_MUNMAP 1
|
||||
#define HAVE_NL_TYPES_H 1
|
||||
#define HAVE_PUTENV 1
|
||||
#define HAVE_RC_FILE 1
|
||||
#define HAVE_SETENV 1
|
||||
#define HAVE_SETLOCALE 1
|
||||
#define HAVE_STDDEF_H 1
|
||||
#define HAVE_STDINT_H 1
|
||||
#define HAVE_STDLIB_H 1
|
||||
#define HAVE_STPCPY 1
|
||||
#define HAVE_STRCASECMP 1
|
||||
#define HAVE_STRCHR 1
|
||||
#define HAVE_STRDUP 1
|
||||
#define HAVE_STRINGS_H 1
|
||||
#define HAVE_STRING_H 1
|
||||
#define HAVE_STRTOUL 1
|
||||
#define HAVE_SYS_PARAM_H 1
|
||||
#define HAVE_SYS_STAT_H 1
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
#define HAVE_SYS_WAIT_H 1
|
||||
#define HAVE_TAILBOX 1
|
||||
#define HAVE_TERM_H 1
|
||||
#define HAVE_TSEARCH 1
|
||||
#define HAVE_TYPE_CHTYPE 1
|
||||
#define HAVE_UNISTD_H 1
|
||||
#define HAVE_WAITPID 1
|
||||
#define HAVE_XDIALOG 1
|
||||
#define HAVE___ARGZ_COUNT 1
|
||||
#define HAVE___ARGZ_NEXT 1
|
||||
#define HAVE___ARGZ_STRINGIFY 1
|
||||
#define ICONV_CONST
|
||||
#define MIXEDCASE_FILENAMES 1
|
||||
#define NCURSES 1
|
||||
#define PACKAGE "dialog"
|
||||
#define RETSIGTYPE void
|
||||
#define STDC_HEADERS 1
|
||||
#define SYSTEM_NAME "linux-gnu"
|
||||
#define TIME_WITH_SYS_TIME 1
|
||||
#define TYPE_CHTYPE_IS_SCALAR 1
|
||||
706
extra/dialog-1.0-20050306/formbox.c
Normal file
706
extra/dialog-1.0-20050306/formbox.c
Normal file
@@ -0,0 +1,706 @@
|
||||
/*
|
||||
* $Id: formbox.c,v 1.32 2005/02/07 00:10:37 tom Exp $
|
||||
*
|
||||
* formbox.c -- implements the form (i.e, some pairs label/editbox)
|
||||
*
|
||||
* AUTHOR: Valery Reznic (valery_reznic@users.sourceforge.net)
|
||||
* and: Thomas E. Dickey
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include "dialog.h"
|
||||
|
||||
#define LLEN(n) ((n) * FORMBOX_TAGS)
|
||||
|
||||
#define ItemName(i) items[LLEN(i) + 0]
|
||||
#define ItemNameY(i) items[LLEN(i) + 1]
|
||||
#define ItemNameX(i) items[LLEN(i) + 2]
|
||||
#define ItemText(i) items[LLEN(i) + 3]
|
||||
#define ItemTextY(i) items[LLEN(i) + 4]
|
||||
#define ItemTextX(i) items[LLEN(i) + 5]
|
||||
#define ItemTextFLen(i) items[LLEN(i) + 6]
|
||||
#define ItemTextILen(i) items[LLEN(i) + 7]
|
||||
#define ItemHelp(i) (dialog_vars.item_help ? items[LLEN(i) + 8] : "")
|
||||
|
||||
typedef struct {
|
||||
char *name; /* the field label */
|
||||
int name_len; /* ...its length */
|
||||
int name_y; /* ...its y-ordinate */
|
||||
int name_x; /* ...its x-ordinate */
|
||||
char *text; /* the field contents */
|
||||
int text_len; /* ...its length on the screen */
|
||||
int text_y; /* ...its y-ordinate */
|
||||
int text_x; /* ...its x-ordinate */
|
||||
int text_flen; /* ...its length on screen, or 0 if no input allowed */
|
||||
int text_ilen; /* ...its limit on amount to be entered */
|
||||
char *help; /* help-message, if any */
|
||||
} FORM_ELT;
|
||||
|
||||
static bool
|
||||
in_window(WINDOW *win, int scrollamt, int y)
|
||||
{
|
||||
return (y >= scrollamt && y - scrollamt < getmaxy(win));
|
||||
}
|
||||
|
||||
static bool
|
||||
ok_move(WINDOW *win, int scrollamt, int y, int x)
|
||||
{
|
||||
return in_window(win, scrollamt, y)
|
||||
&& (wmove(win, y - scrollamt, x) != ERR);
|
||||
}
|
||||
|
||||
static void
|
||||
move_past(WINDOW *win, int y, int x)
|
||||
{
|
||||
if (wmove(win, y, x) == ERR)
|
||||
wmove(win, y, getmaxx(win) - 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Print form item
|
||||
*/
|
||||
static int
|
||||
print_item(WINDOW *win, FORM_ELT * elt, int scrollamt, bool choice)
|
||||
{
|
||||
int count = 0;
|
||||
int len;
|
||||
|
||||
if (ok_move(win, scrollamt, elt->name_y, elt->name_x)) {
|
||||
len = elt->name_len;
|
||||
len = MIN(len, getmaxx(win) - elt->name_x);
|
||||
if (len > 0) {
|
||||
dlg_show_string(win,
|
||||
elt->name,
|
||||
0,
|
||||
menubox_attr,
|
||||
elt->name_y,
|
||||
elt->name_x,
|
||||
len,
|
||||
FALSE,
|
||||
FALSE);
|
||||
move_past(win, elt->name_y, elt->name_x + len);
|
||||
count = 1;
|
||||
}
|
||||
}
|
||||
if (elt->text_len && ok_move(win, scrollamt, elt->text_y, elt->text_x)) {
|
||||
len = elt->text_len;
|
||||
len = MIN(len, getmaxx(win) - elt->text_x);
|
||||
if (len > 0) {
|
||||
dlg_show_string(win,
|
||||
elt->text,
|
||||
0,
|
||||
choice ? form_active_text_attr : form_text_attr,
|
||||
elt->text_y,
|
||||
elt->text_x,
|
||||
len,
|
||||
FALSE,
|
||||
FALSE);
|
||||
move_past(win, elt->text_y, elt->text_x + len);
|
||||
count = 1;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
/*
|
||||
* Print the entire form.
|
||||
*/
|
||||
static void
|
||||
print_form(WINDOW *win, FORM_ELT * elt, int total, int scrollamt, int choice)
|
||||
{
|
||||
int n;
|
||||
int count = 0;
|
||||
|
||||
for (n = 0; n < total; ++n) {
|
||||
count += print_item(win, elt + n, scrollamt, n == choice);
|
||||
}
|
||||
if (count) {
|
||||
wbkgdset(win, menubox_attr | ' ');
|
||||
wclrtobot(win);
|
||||
(void) wnoutrefresh(win);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
set_choice(FORM_ELT elt[], int choice, int item_no)
|
||||
{
|
||||
int i;
|
||||
if (elt[choice].text_flen > 0)
|
||||
return choice;
|
||||
for (i = 0; i < item_no; i++) {
|
||||
if (elt[i].text_flen > 0)
|
||||
return i;
|
||||
}
|
||||
dlg_exiterr("No field has flen > 0\n");
|
||||
return -1; /* Dummy, to make compiler happy */
|
||||
}
|
||||
|
||||
/*
|
||||
* Find the last y-value in the form.
|
||||
*/
|
||||
static int
|
||||
form_limit(FORM_ELT elt[])
|
||||
{
|
||||
int n;
|
||||
int limit = 0;
|
||||
for (n = 0; elt[n].name != 0; ++n) {
|
||||
if (limit < elt[n].name_y)
|
||||
limit = elt[n].name_y;
|
||||
if (limit < elt[n].text_y)
|
||||
limit = elt[n].text_y;
|
||||
}
|
||||
return limit;
|
||||
}
|
||||
|
||||
/*
|
||||
* Tab to the next field.
|
||||
*/
|
||||
static bool
|
||||
tab_next(WINDOW *win,
|
||||
FORM_ELT elt[],
|
||||
int item_no,
|
||||
int stepsize,
|
||||
int *choice,
|
||||
int *scrollamt)
|
||||
{
|
||||
int old_choice = *choice;
|
||||
int old_scroll = *scrollamt;
|
||||
bool wrapped = FALSE;
|
||||
|
||||
do {
|
||||
*choice += stepsize;
|
||||
if (*choice < 0) {
|
||||
*choice = item_no - 1;
|
||||
wrapped = TRUE;
|
||||
}
|
||||
if (*choice >= item_no) {
|
||||
*choice = 0;
|
||||
wrapped = TRUE;
|
||||
}
|
||||
if (elt[*choice].text_flen > 0) {
|
||||
int lo = MIN(elt[*choice].name_y, elt[*choice].text_y);
|
||||
int hi = MAX(elt[*choice].name_y, elt[*choice].text_y);
|
||||
|
||||
if (old_choice == *choice)
|
||||
break;
|
||||
print_item(win, elt + old_choice, *scrollamt, FALSE);
|
||||
|
||||
if (*scrollamt < lo + 1 - getmaxy(win))
|
||||
*scrollamt = lo + 1 - getmaxy(win);
|
||||
if (*scrollamt > hi)
|
||||
*scrollamt = hi;
|
||||
/*
|
||||
* If we have to scroll to show a wrap-around, it does get
|
||||
* confusing. Just give up rather than scroll. Tab'ing to the
|
||||
* next field in a multi-column form is a different matter. Scroll
|
||||
* for that.
|
||||
*/
|
||||
if (*scrollamt != old_scroll) {
|
||||
if (wrapped) {
|
||||
beep();
|
||||
*scrollamt = old_scroll;
|
||||
*choice = old_choice;
|
||||
} else {
|
||||
scrollok(win, TRUE);
|
||||
wscrl(win, *scrollamt - old_scroll);
|
||||
scrollok(win, FALSE);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
} while (*choice != old_choice);
|
||||
|
||||
return (old_choice != *choice) || (old_scroll != *scrollamt);
|
||||
}
|
||||
|
||||
/*
|
||||
* Scroll to the next page, putting the choice at the first editable field
|
||||
* in that page. Note that fields are not necessarily in top-to-bottom order,
|
||||
* nor is there necessarily a field on each row of the window.
|
||||
*/
|
||||
static bool
|
||||
scroll_next(WINDOW *win, FORM_ELT elt[], int stepsize, int *choice, int *scrollamt)
|
||||
{
|
||||
int old_choice = *choice;
|
||||
int old_scroll = *scrollamt;
|
||||
int old_row = MIN(elt[old_choice].text_y, elt[old_choice].name_y);
|
||||
int target = old_scroll + stepsize;
|
||||
int n;
|
||||
|
||||
if (stepsize < 0) {
|
||||
if (old_row != old_scroll)
|
||||
target = old_scroll;
|
||||
else
|
||||
target = old_scroll + stepsize;
|
||||
if (target < 0)
|
||||
target = 0;
|
||||
} else {
|
||||
int limit = form_limit(elt);
|
||||
if (target > limit)
|
||||
target = limit;
|
||||
}
|
||||
|
||||
for (n = 0; elt[n].name != 0; ++n) {
|
||||
if (elt[n].text_flen > 0) {
|
||||
int new_row = MIN(elt[n].text_y, elt[n].name_y);
|
||||
if (abs(new_row - target) < abs(old_row - target)) {
|
||||
old_row = new_row;
|
||||
*choice = n;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (old_choice != *choice)
|
||||
print_item(win, elt + old_choice, *scrollamt, FALSE);
|
||||
|
||||
*scrollamt = *choice;
|
||||
if (*scrollamt != old_scroll) {
|
||||
scrollok(win, TRUE);
|
||||
wscrl(win, *scrollamt - old_scroll);
|
||||
scrollok(win, FALSE);
|
||||
}
|
||||
return (old_choice != *choice) || (old_scroll != *scrollamt);
|
||||
}
|
||||
|
||||
static FORM_ELT *
|
||||
init_fe(char **items,
|
||||
int item_no,
|
||||
int *min_height,
|
||||
int *min_width)
|
||||
{
|
||||
FORM_ELT *elt;
|
||||
int i;
|
||||
int min_w = 0;
|
||||
int min_h = 0;
|
||||
|
||||
/*
|
||||
* Note that elt[item_no].name is null, since we allocate an extra item.
|
||||
*/
|
||||
elt = (FORM_ELT *) calloc(item_no + 1, sizeof(FORM_ELT));
|
||||
assert_ptr(elt, "dialog_form");
|
||||
|
||||
for (i = 0; i < item_no; ++i) {
|
||||
int name_y = atoi(ItemNameY(i));
|
||||
int name_x = atoi(ItemNameX(i));
|
||||
int name_len = strlen(ItemName(i));
|
||||
int text_y = atoi(ItemTextY(i));
|
||||
int text_x = atoi(ItemTextX(i));
|
||||
int text_flen = atoi(ItemTextFLen(i));
|
||||
int text_ilen = atoi(ItemTextILen(i));
|
||||
int text_len = (text_flen > 0
|
||||
? text_flen
|
||||
: (text_flen < 0
|
||||
? -text_flen
|
||||
: (int) strlen(ItemText(i))));
|
||||
|
||||
/*
|
||||
* Special value '0' for text_flen: no input allowed
|
||||
* Special value '0' for text_ilen: 'be as text_flen'
|
||||
*/
|
||||
if (text_ilen == 0)
|
||||
text_ilen = text_len;
|
||||
|
||||
min_h = MAX(min_h, name_y);
|
||||
min_h = MAX(min_h, text_y);
|
||||
min_w = MAX(min_w, name_x + name_len);
|
||||
min_w = MAX(min_w, text_x + text_len);
|
||||
|
||||
elt[i].name = ItemName(i);
|
||||
elt[i].name_len = strlen(elt[i].name);
|
||||
elt[i].name_y = name_y - 1;
|
||||
elt[i].name_x = name_x - 1;
|
||||
elt[i].text = ItemText(i);
|
||||
elt[i].text_len = text_len;
|
||||
elt[i].text_y = text_y - 1;
|
||||
elt[i].text_x = text_x - 1;
|
||||
elt[i].text_flen = text_flen;
|
||||
elt[i].text_ilen = text_ilen;
|
||||
elt[i].help = ItemHelp(i);
|
||||
|
||||
if (text_flen > 0) {
|
||||
int max_len = MAX_LEN;
|
||||
if (dialog_vars.max_input != 0 && dialog_vars.max_input < MAX_LEN)
|
||||
max_len = dialog_vars.max_input;
|
||||
elt[i].text = malloc(max_len + 1);
|
||||
assert_ptr(elt[i].text, "dialog_form");
|
||||
sprintf(elt[i].text, "%.*s", text_ilen, ItemText(i));
|
||||
}
|
||||
}
|
||||
|
||||
*min_height = min_h;
|
||||
*min_width = min_w;
|
||||
|
||||
return elt;
|
||||
}
|
||||
|
||||
/*
|
||||
* Display a form for fulfill a number of fields
|
||||
*/
|
||||
int
|
||||
dialog_form(const char *title, const char *cprompt, int height, int width,
|
||||
int form_height, int item_no, char **items)
|
||||
{
|
||||
#define sTEXT -1
|
||||
bool show_status = FALSE;
|
||||
int form_width;
|
||||
int first = TRUE;
|
||||
int chr_offset = 0;
|
||||
int state = dialog_vars.defaultno ? dlg_defaultno_button() : sTEXT;
|
||||
const int password = 0;
|
||||
int i, x, y, cur_x, cur_y, box_x, box_y;
|
||||
int code;
|
||||
int key = 0;
|
||||
int fkey;
|
||||
int choice = dlg_default_item(items, FORMBOX_TAGS);
|
||||
int new_choice, new_scroll;
|
||||
int scrollamt = 0;
|
||||
int result = DLG_EXIT_UNKNOWN;
|
||||
int min_width = 0, min_height = 0;
|
||||
bool was_autosize = (height == 0 || width == 0);
|
||||
bool show_buttons = FALSE;
|
||||
bool scroll_changed = FALSE;
|
||||
bool field_changed = FALSE;
|
||||
WINDOW *dialog, *form;
|
||||
char *prompt = dlg_strclone(cprompt);
|
||||
const char **buttons = dlg_ok_labels();
|
||||
FORM_ELT *elt, *current;
|
||||
|
||||
elt = init_fe(items, item_no, &min_height, &min_width);
|
||||
dlg_tab_correct_str(prompt);
|
||||
dlg_auto_size(title, prompt, &height, &width,
|
||||
1 + 3 * MARGIN,
|
||||
MAX(26, 2 + min_width));
|
||||
|
||||
if (form_height == 0)
|
||||
form_height = min_height;
|
||||
|
||||
if (was_autosize) {
|
||||
form_height = MIN(SLINES - height, form_height);
|
||||
height += form_height;
|
||||
} else {
|
||||
int thigh = 0;
|
||||
int twide = 0;
|
||||
dlg_auto_size(title, prompt, &thigh, &twide, 0, width);
|
||||
thigh = SLINES - (height - (thigh + 1 + 3 * MARGIN));
|
||||
form_height = MIN(thigh, form_height);
|
||||
}
|
||||
|
||||
dlg_print_size(height, width);
|
||||
dlg_ctl_size(height, width);
|
||||
|
||||
x = dlg_box_x_ordinate(width);
|
||||
y = dlg_box_y_ordinate(height);
|
||||
|
||||
dialog = dlg_new_window(height, width, y, x);
|
||||
|
||||
dlg_mouse_setbase(x, y);
|
||||
|
||||
dlg_draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr);
|
||||
dlg_draw_bottom_box(dialog);
|
||||
dlg_draw_title(dialog, title);
|
||||
|
||||
wattrset(dialog, dialog_attr);
|
||||
dlg_print_autowrap(dialog, prompt, height, width);
|
||||
|
||||
form_width = width - 6;
|
||||
getyx(dialog, cur_y, cur_x);
|
||||
box_y = cur_y + 1;
|
||||
box_x = (width - form_width) / 2 - 1;
|
||||
|
||||
/* create new window for the form */
|
||||
form = dlg_sub_window(dialog, form_height, form_width, y + box_y + 1,
|
||||
x + box_x + 1);
|
||||
|
||||
/* draw a box around the form items */
|
||||
dlg_draw_box(dialog, box_y, box_x, form_height + 2, form_width + 2,
|
||||
menubox_border_attr, menubox_attr);
|
||||
|
||||
/* register the new window, along with its borders */
|
||||
dlg_mouse_mkbigregion(getbegy(form) - getbegy(dialog),
|
||||
getbegx(form) - getbegx(dialog),
|
||||
getmaxy(form),
|
||||
getmaxx(form),
|
||||
KEY_MAX, 1, 1, 3 /* by cells */ );
|
||||
|
||||
show_buttons = TRUE;
|
||||
scroll_changed = TRUE;
|
||||
field_changed = TRUE;
|
||||
|
||||
choice = set_choice(elt, choice, item_no);
|
||||
current = &elt[choice];
|
||||
|
||||
while (result == DLG_EXIT_UNKNOWN) {
|
||||
int edit = FALSE;
|
||||
|
||||
if (scroll_changed) {
|
||||
print_form(form, elt, item_no, scrollamt, choice);
|
||||
dlg_draw_arrows(dialog, scrollamt,
|
||||
scrollamt + form_height < item_no,
|
||||
box_x + 1,
|
||||
box_y,
|
||||
box_y + form_height + 1);
|
||||
scroll_changed = FALSE;
|
||||
}
|
||||
|
||||
if (show_buttons) {
|
||||
dlg_item_help("");
|
||||
dlg_draw_buttons(dialog, height - 2, 0, buttons,
|
||||
((state < 0)
|
||||
? 1000 /* no such button, not highlighted */
|
||||
: state),
|
||||
FALSE, width);
|
||||
show_buttons = FALSE;
|
||||
}
|
||||
|
||||
if (field_changed || state == sTEXT) {
|
||||
if (field_changed)
|
||||
chr_offset = 0;
|
||||
current = &elt[choice];
|
||||
dialog_vars.max_input = current->text_ilen;
|
||||
dlg_item_help(current->help);
|
||||
dlg_show_string(form, current->text, chr_offset,
|
||||
form_active_text_attr,
|
||||
current->text_y - scrollamt,
|
||||
current->text_x,
|
||||
current->text_len, password, first);
|
||||
field_changed = FALSE;
|
||||
}
|
||||
|
||||
key = dlg_mouse_wgetch(dialog, &fkey);
|
||||
|
||||
/* handle non-functionkeys */
|
||||
if (!fkey) {
|
||||
if (state != sTEXT) {
|
||||
code = dlg_char_to_button(key, buttons);
|
||||
if (code >= 0) {
|
||||
dlg_del_window(dialog);
|
||||
result = code;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
fkey = TRUE;
|
||||
switch (key) {
|
||||
case ESC:
|
||||
result = DLG_EXIT_ESC;
|
||||
continue;
|
||||
case CHR_NEXT:
|
||||
key = KEY_NEXT;
|
||||
break;
|
||||
case CHR_PREVIOUS:
|
||||
key = KEY_PREVIOUS;
|
||||
break;
|
||||
case ' ':
|
||||
if (state == sTEXT) {
|
||||
fkey = FALSE;
|
||||
break;
|
||||
}
|
||||
/* FALLTHRU */
|
||||
case '\n':
|
||||
case '\r':
|
||||
key = KEY_ENTER;
|
||||
break;
|
||||
case TAB:
|
||||
state = dlg_next_ok_buttonindex(state, sTEXT);
|
||||
show_buttons = TRUE;
|
||||
continue;
|
||||
default:
|
||||
fkey = FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* handle functionkeys */
|
||||
if (fkey) {
|
||||
bool do_scroll = FALSE;
|
||||
bool do_tab = FALSE;
|
||||
int move_by = 0;
|
||||
|
||||
switch (key) {
|
||||
case M_EVENT + KEY_PPAGE:
|
||||
case KEY_PPAGE:
|
||||
do_scroll = TRUE;
|
||||
move_by = -form_height;
|
||||
break;
|
||||
|
||||
case M_EVENT + KEY_NPAGE:
|
||||
case KEY_NPAGE:
|
||||
do_scroll = TRUE;
|
||||
move_by = form_height;
|
||||
break;
|
||||
|
||||
case KEY_ENTER:
|
||||
dlg_del_window(dialog);
|
||||
result = (state >= 0) ? dlg_ok_buttoncode(state) : DLG_EXIT_OK;
|
||||
continue;
|
||||
|
||||
case KEY_LEFT:
|
||||
if (state == sTEXT)
|
||||
break;
|
||||
/* FALLTHRU */
|
||||
case KEY_UP:
|
||||
case KEY_PREVIOUS:
|
||||
if (state == sTEXT) {
|
||||
do_tab = TRUE;
|
||||
move_by = -1;
|
||||
break;
|
||||
} else {
|
||||
state = dlg_prev_ok_buttonindex(state, 0);
|
||||
show_buttons = TRUE;
|
||||
continue;
|
||||
}
|
||||
|
||||
case KEY_BTAB:
|
||||
state = dlg_prev_ok_buttonindex(state, sTEXT);
|
||||
show_buttons = TRUE;
|
||||
continue;
|
||||
|
||||
case KEY_RIGHT:
|
||||
if (state == sTEXT)
|
||||
break;
|
||||
/* FALLTHRU */
|
||||
|
||||
case KEY_DOWN:
|
||||
case KEY_NEXT:
|
||||
if (state == sTEXT) {
|
||||
do_tab = TRUE;
|
||||
move_by = 1;
|
||||
break;
|
||||
} else {
|
||||
state = dlg_next_ok_buttonindex(state, 0);
|
||||
show_buttons = TRUE;
|
||||
continue;
|
||||
}
|
||||
|
||||
default:
|
||||
#if USE_MOUSE
|
||||
if (key >= M_EVENT) {
|
||||
if (key >= M_EVENT + KEY_MAX) {
|
||||
int cell = key - (M_EVENT + KEY_MAX);
|
||||
int row = (cell / getmaxx(form)) + scrollamt;
|
||||
int col = (cell % getmaxx(form));
|
||||
int n;
|
||||
|
||||
for (n = 0; n < item_no; ++n) {
|
||||
if (elt[n].name_y == row
|
||||
&& elt[n].name_x <= col
|
||||
&& (elt[n].name_x + elt[n].name_len > col
|
||||
|| (elt[n].name_y == elt[n].text_y
|
||||
&& elt[n].text_x > col))) {
|
||||
field_changed = TRUE;
|
||||
break;
|
||||
}
|
||||
if (elt[n].text_y == row
|
||||
&& elt[n].text_x <= col
|
||||
&& elt[n].text_x + elt[n].text_ilen > col) {
|
||||
field_changed = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (field_changed) {
|
||||
print_item(form, elt + choice, scrollamt, FALSE);
|
||||
choice = n;
|
||||
continue;
|
||||
}
|
||||
beep();
|
||||
} else if ((code = dlg_ok_buttoncode(key - M_EVENT)) >= 0) {
|
||||
result = code;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
new_scroll = scrollamt;
|
||||
new_choice = choice;
|
||||
if (do_scroll) {
|
||||
if (scroll_next(form, elt, move_by, &new_choice, &new_scroll)) {
|
||||
if (choice != new_choice) {
|
||||
choice = new_choice;
|
||||
field_changed = TRUE;
|
||||
}
|
||||
if (scrollamt != new_scroll) {
|
||||
scrollamt = new_scroll;
|
||||
scroll_changed = TRUE;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (do_tab) {
|
||||
if (tab_next(form, elt, item_no, move_by, &new_choice, &new_scroll)) {
|
||||
if (choice != new_choice) {
|
||||
choice = new_choice;
|
||||
field_changed = TRUE;
|
||||
}
|
||||
if (scrollamt != new_scroll) {
|
||||
scrollamt = new_scroll;
|
||||
scroll_changed = TRUE;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (state == sTEXT) { /* Input box selected */
|
||||
edit = dlg_edit_string(current->text, &chr_offset, key, fkey, first);
|
||||
if (edit) {
|
||||
dlg_show_string(form, current->text, chr_offset,
|
||||
form_active_text_attr,
|
||||
current->text_y - scrollamt,
|
||||
current->text_x,
|
||||
current->text_len, password, first);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
switch (result) {
|
||||
case DLG_EXIT_OK: /* FALLTHRU */
|
||||
case DLG_EXIT_EXTRA:
|
||||
show_status = TRUE;
|
||||
break;
|
||||
case DLG_EXIT_HELP:
|
||||
dlg_add_result("HELP ");
|
||||
show_status = dialog_vars.help_status;
|
||||
if (USE_ITEM_HELP(ItemHelp(scrollamt + choice))) {
|
||||
dlg_add_result(ItemHelp(scrollamt + choice));
|
||||
result = DLG_EXIT_ITEM_HELP;
|
||||
} else {
|
||||
dlg_add_result(ItemName(scrollamt + choice));
|
||||
}
|
||||
if (show_status)
|
||||
dlg_add_result("\n");
|
||||
break;
|
||||
}
|
||||
if (show_status) {
|
||||
for (i = 0; i < item_no; i++) {
|
||||
if (elt[i].text_flen > 0) {
|
||||
dlg_add_result(elt[i].text);
|
||||
dlg_add_result("\n");
|
||||
free(elt[i].text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
free(elt);
|
||||
|
||||
dlg_mouse_free_regions();
|
||||
dlg_del_window(dialog);
|
||||
free(prompt);
|
||||
return result;
|
||||
}
|
||||
BIN
extra/dialog-1.0-20050306/formbox.o
Normal file
BIN
extra/dialog-1.0-20050306/formbox.o
Normal file
Binary file not shown.
686
extra/dialog-1.0-20050306/fselect.c
Normal file
686
extra/dialog-1.0-20050306/fselect.c
Normal file
@@ -0,0 +1,686 @@
|
||||
/*
|
||||
* $Id: fselect.c,v 1.44 2004/09/18 16:36:40 tom Exp $
|
||||
*
|
||||
* fselect.c -- implements the file-selector box
|
||||
*
|
||||
* Copyright 2000-2003,2004 Thomas E. Dickey
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include "dialog.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#if HAVE_DIRENT_H
|
||||
# include <dirent.h>
|
||||
# define NAMLEN(dirent) strlen((dirent)->d_name)
|
||||
#else
|
||||
# define dirent direct
|
||||
# define NAMLEN(dirent) (dirent)->d_namlen
|
||||
# if HAVE_SYS_NDIR_H
|
||||
# include <sys/ndir.h>
|
||||
# endif
|
||||
# if HAVE_SYS_DIR_H
|
||||
# include <sys/dir.h>
|
||||
# endif
|
||||
# if HAVE_NDIR_H
|
||||
# include <ndir.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define EXT_WIDE 1
|
||||
#define HDR_HIGH 1
|
||||
#define BTN_HIGH (1 + 2 * MARGIN) /* Ok/Cancel, also input-box */
|
||||
#define MIN_HIGH (HDR_HIGH - MARGIN + (BTN_HIGH * 2) + 4 * MARGIN)
|
||||
#define MIN_WIDE (2 * MAX(strlen(d_label), strlen(f_label)) + 6 * MARGIN + 2 * EXT_WIDE)
|
||||
|
||||
#define MOUSE_D (KEY_MAX + 0)
|
||||
#define MOUSE_F (KEY_MAX + 10000)
|
||||
#define MOUSE_T (KEY_MAX + 20000)
|
||||
|
||||
typedef enum {
|
||||
sDIRS = -3
|
||||
,sFILES = -2
|
||||
,sTEXT = -1
|
||||
} STATES;
|
||||
|
||||
typedef struct {
|
||||
WINDOW *par; /* parent window */
|
||||
WINDOW *win; /* this window */
|
||||
int length; /* length of the data[] array */
|
||||
int offset; /* index of first item on screen */
|
||||
int choice; /* index of the selection */
|
||||
int mousex; /* base of mouse-code return-values */
|
||||
unsigned allocd;
|
||||
char **data;
|
||||
} LIST;
|
||||
|
||||
static void
|
||||
init_list(LIST * list, WINDOW *par, WINDOW *win, int mousex)
|
||||
{
|
||||
list->par = par;
|
||||
list->win = win;
|
||||
list->length = 0;
|
||||
list->offset = 0;
|
||||
list->choice = 0;
|
||||
list->mousex = mousex;
|
||||
list->allocd = 0;
|
||||
list->data = 0;
|
||||
dlg_mouse_mkbigregion(getbegy(win), getbegx(win),
|
||||
getmaxy(win), getmaxx(win),
|
||||
mousex, 1, 1, 1 /* by lines */ );
|
||||
}
|
||||
|
||||
static char *
|
||||
leaf_of(char *path)
|
||||
{
|
||||
char *leaf = strrchr(path, '/');
|
||||
if (leaf != 0)
|
||||
leaf++;
|
||||
else
|
||||
leaf = path;
|
||||
return leaf;
|
||||
}
|
||||
|
||||
static char *
|
||||
data_of(LIST * list)
|
||||
{
|
||||
if (list != 0
|
||||
&& list->data != 0)
|
||||
return list->data[list->choice];
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
free_list(LIST * list, int reinit)
|
||||
{
|
||||
int n;
|
||||
|
||||
if (list->data != 0) {
|
||||
for (n = 0; list->data[n] != 0; n++)
|
||||
free(list->data[n]);
|
||||
free(list->data);
|
||||
list->data = 0;
|
||||
}
|
||||
if (reinit)
|
||||
init_list(list, list->par, list->win, list->mousex);
|
||||
}
|
||||
|
||||
static void
|
||||
add_to_list(LIST * list, char *text)
|
||||
{
|
||||
unsigned need;
|
||||
|
||||
need = list->length + 1;
|
||||
if (need + 1 > list->allocd) {
|
||||
list->allocd = 2 * (need + 1);
|
||||
if (list->data == 0) {
|
||||
list->data = (char **) malloc(sizeof(char *) * list->allocd);
|
||||
} else {
|
||||
list->data = (char **) realloc(list->data, sizeof(char *) * list->allocd);
|
||||
}
|
||||
assert_ptr(list->data, "add_to_list");
|
||||
}
|
||||
list->data[list->length++] = dlg_strclone(text);
|
||||
list->data[list->length] = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
keep_visible(LIST * list)
|
||||
{
|
||||
int high = getmaxy(list->win);
|
||||
|
||||
if (list->choice < list->offset) {
|
||||
list->offset = list->choice;
|
||||
}
|
||||
if (list->choice - list->offset >= high)
|
||||
list->offset = list->choice - high + 1;
|
||||
}
|
||||
|
||||
#define Value(c) (int)((c) & 0xff)
|
||||
|
||||
static int
|
||||
find_choice(char *target, LIST * list)
|
||||
{
|
||||
int n;
|
||||
int choice = list->choice;
|
||||
int len_1, len_2, cmp_1, cmp_2;
|
||||
|
||||
if (*target == 0) {
|
||||
list->choice = 0;
|
||||
} else {
|
||||
/* find the match with the longest length. If more than one has the
|
||||
* same length, choose the one with the closest match of the final
|
||||
* character.
|
||||
*/
|
||||
len_1 = 0;
|
||||
cmp_1 = 256;
|
||||
for (n = 0; n < list->length; n++) {
|
||||
char *a = target;
|
||||
char *b = list->data[n];
|
||||
|
||||
len_2 = 0;
|
||||
while ((*a != 0) && (*b != 0) && (*a == *b)) {
|
||||
a++;
|
||||
b++;
|
||||
len_2++;
|
||||
}
|
||||
cmp_2 = Value(*a) - Value(*b);
|
||||
if (cmp_2 < 0)
|
||||
cmp_2 = -cmp_2;
|
||||
if ((len_2 > len_1)
|
||||
|| (len_1 == len_2 && cmp_2 < cmp_1)) {
|
||||
len_1 = len_2;
|
||||
cmp_1 = cmp_2;
|
||||
list->choice = n;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (choice != list->choice) {
|
||||
keep_visible(list);
|
||||
}
|
||||
return (choice != list->choice);
|
||||
}
|
||||
|
||||
static void
|
||||
display_list(LIST * list)
|
||||
{
|
||||
int n;
|
||||
int x;
|
||||
int y;
|
||||
int top;
|
||||
int bottom;
|
||||
|
||||
dlg_attr_clear(list->win, getmaxy(list->win), getmaxx(list->win), item_attr);
|
||||
for (n = list->offset; n < list->length && list->data[n]; n++) {
|
||||
y = n - list->offset;
|
||||
if (y >= getmaxy(list->win))
|
||||
break;
|
||||
(void) wmove(list->win, y, 0);
|
||||
if (n == list->choice)
|
||||
wattrset(list->win, item_selected_attr);
|
||||
(void) waddstr(list->win, list->data[n]);
|
||||
wattrset(list->win, item_attr);
|
||||
}
|
||||
wattrset(list->win, item_attr);
|
||||
|
||||
getparyx(list->win, y, x);
|
||||
|
||||
top = y - 1;
|
||||
bottom = y + getmaxy(list->win);
|
||||
dlg_draw_arrows(list->par, list->offset,
|
||||
list->length - list->offset > getmaxy(list->win),
|
||||
x + 1,
|
||||
top,
|
||||
bottom);
|
||||
|
||||
(void) wmove(list->win, list->choice - list->offset, 0);
|
||||
(void) wnoutrefresh(list->win);
|
||||
}
|
||||
|
||||
/* FIXME: see arrows.c
|
||||
* This workaround is used to allow two lists to have scroll-tabs at the same
|
||||
* time, by reassigning their return-values to be different. Just for
|
||||
* readability, we use the names of keys with similar connotations, though all
|
||||
* that is really required is that they're distinct, so we can put them in a
|
||||
* switch statement.
|
||||
*/
|
||||
static void
|
||||
fix_arrows(LIST * list)
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
int top;
|
||||
int bottom;
|
||||
|
||||
getparyx(list->win, y, x);
|
||||
top = y - 1;
|
||||
bottom = y + getmaxy(list->win);
|
||||
|
||||
mouse_mkbutton(top, x, 6,
|
||||
((list->mousex == MOUSE_D)
|
||||
? KEY_PREVIOUS
|
||||
: KEY_PPAGE));
|
||||
mouse_mkbutton(bottom, x, 6,
|
||||
((list->mousex == MOUSE_D)
|
||||
? KEY_NEXT
|
||||
: KEY_NPAGE));
|
||||
}
|
||||
|
||||
static int
|
||||
show_list(char *target, LIST * list, bool keep)
|
||||
{
|
||||
int changed = keep || find_choice(target, list);
|
||||
display_list(list);
|
||||
return changed;
|
||||
}
|
||||
|
||||
/*
|
||||
* Highlight the closest match to 'target' in the given list, setting offset
|
||||
* to match.
|
||||
*/
|
||||
static int
|
||||
show_both_lists(char *input, LIST * d_list, LIST * f_list, bool keep)
|
||||
{
|
||||
char *leaf = leaf_of(input);
|
||||
|
||||
return show_list(leaf, d_list, keep) | show_list(leaf, f_list, keep);
|
||||
}
|
||||
|
||||
/*
|
||||
* Move up/down in the given list
|
||||
*/
|
||||
static bool
|
||||
change_list(int choice, LIST * list)
|
||||
{
|
||||
if (data_of(list) != 0) {
|
||||
int last = list->length - 1;
|
||||
|
||||
choice += list->choice;
|
||||
if (choice < 0)
|
||||
choice = 0;
|
||||
if (choice > last)
|
||||
choice = last;
|
||||
list->choice = choice;
|
||||
keep_visible(list);
|
||||
display_list(list);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
scroll_list(int direction, LIST * list)
|
||||
{
|
||||
if (data_of(list) != 0) {
|
||||
int length = getmaxy(list->win);
|
||||
if (change_list(direction * length, list))
|
||||
return;
|
||||
}
|
||||
beep();
|
||||
}
|
||||
|
||||
static int
|
||||
compar(const void *a, const void *b)
|
||||
{
|
||||
return strcmp(*(const char *const *) a, *(const char *const *) b);
|
||||
}
|
||||
|
||||
static bool
|
||||
fill_lists(char *current, char *input, LIST * d_list, LIST * f_list, bool keep)
|
||||
{
|
||||
DIR *dp;
|
||||
struct dirent *de;
|
||||
struct stat sb;
|
||||
int n;
|
||||
char path[MAX_LEN + 1];
|
||||
char *leaf;
|
||||
|
||||
/* check if we've updated the lists */
|
||||
for (n = 0; current[n] && input[n]; n++) {
|
||||
if (current[n] != input[n])
|
||||
break;
|
||||
}
|
||||
if (current[n] == input[n])
|
||||
return FALSE;
|
||||
if (strchr(current + n, '/') == 0
|
||||
&& strchr(input + n, '/') == 0) {
|
||||
return show_both_lists(input, d_list, f_list, keep);
|
||||
}
|
||||
|
||||
strcpy(current, input);
|
||||
|
||||
/* refill the lists */
|
||||
free_list(d_list, TRUE);
|
||||
free_list(f_list, TRUE);
|
||||
strcpy(path, current);
|
||||
if ((leaf = strrchr(path, '/')) != 0) {
|
||||
*++leaf = 0;
|
||||
} else {
|
||||
strcpy(path, "./");
|
||||
leaf = path + strlen(path);
|
||||
}
|
||||
if ((dp = opendir(path)) != 0) {
|
||||
while ((de = readdir(dp)) != 0) {
|
||||
strncpy(leaf, de->d_name, NAMLEN(de))[NAMLEN(de)] = 0;
|
||||
if (stat(path, &sb) == 0) {
|
||||
if ((sb.st_mode & S_IFMT) == S_IFDIR)
|
||||
add_to_list(d_list, leaf);
|
||||
else
|
||||
add_to_list(f_list, leaf);
|
||||
}
|
||||
}
|
||||
(void) closedir(dp);
|
||||
/* sort the lists */
|
||||
qsort(d_list->data, d_list->length, sizeof(d_list->data[0]), compar);
|
||||
qsort(f_list->data, f_list->length, sizeof(f_list->data[0]), compar);
|
||||
}
|
||||
|
||||
(void) show_both_lists(input, d_list, f_list, FALSE);
|
||||
d_list->offset = d_list->choice;
|
||||
f_list->offset = f_list->choice;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static bool
|
||||
usable_state(STATES state, LIST * dirs, LIST * files)
|
||||
{
|
||||
bool result;
|
||||
|
||||
switch (state) {
|
||||
case sDIRS:
|
||||
result = (data_of(dirs) != 0);
|
||||
break;
|
||||
case sFILES:
|
||||
result = (data_of(files) != 0);
|
||||
break;
|
||||
default:
|
||||
result = TRUE;
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#define which_list() ((state == sFILES) \
|
||||
? &f_list \
|
||||
: ((state == sDIRS) \
|
||||
? &d_list \
|
||||
: 0))
|
||||
/*
|
||||
* Display a dialog box for entering a filename
|
||||
*/
|
||||
int
|
||||
dialog_fselect(const char *title, const char *path, int height, int width)
|
||||
{
|
||||
int tbox_y, tbox_x, tbox_width, tbox_height;
|
||||
int dbox_y, dbox_x, dbox_width, dbox_height;
|
||||
int fbox_y, fbox_x, fbox_width, fbox_height;
|
||||
int show_buttons = TRUE;
|
||||
int offset = 0;
|
||||
int key = 0;
|
||||
int fkey = FALSE;
|
||||
int code;
|
||||
int result = DLG_EXIT_UNKNOWN;
|
||||
int state = dialog_vars.defaultno ? dlg_defaultno_button() : sTEXT;
|
||||
int button = state;
|
||||
int first = (state == sTEXT);
|
||||
char *input = dialog_vars.input_result;
|
||||
char *completed;
|
||||
char current[MAX_LEN + 1];
|
||||
WINDOW *dialog, *w_text, *w_dir, *w_file;
|
||||
const char **buttons = dlg_ok_labels();
|
||||
char *d_label = _("Directories");
|
||||
char *f_label = _("Files");
|
||||
int min_wide = MIN_WIDE;
|
||||
int min_items = height ? 0 : 4;
|
||||
LIST d_list, f_list;
|
||||
|
||||
dlg_does_output();
|
||||
|
||||
dlg_auto_size(title, (char *) 0, &height, &width, 6, 25);
|
||||
height += MIN_HIGH + min_items;
|
||||
if (width < min_wide)
|
||||
width = min_wide;
|
||||
dlg_print_size(height, width);
|
||||
dlg_ctl_size(height, width);
|
||||
|
||||
dialog = dlg_new_window(height, width,
|
||||
dlg_box_y_ordinate(height),
|
||||
dlg_box_x_ordinate(width));
|
||||
dlg_mouse_setbase(0, 0);
|
||||
|
||||
dlg_draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr);
|
||||
dlg_draw_bottom_box(dialog);
|
||||
dlg_draw_title(dialog, title);
|
||||
|
||||
wattrset(dialog, dialog_attr);
|
||||
|
||||
/* Draw the input field box */
|
||||
tbox_height = 1;
|
||||
tbox_width = width - (4 * MARGIN + 2);
|
||||
tbox_y = height - (BTN_HIGH * 2) + MARGIN;
|
||||
tbox_x = (width - tbox_width) / 2;
|
||||
|
||||
w_text = derwin(dialog, tbox_height, tbox_width, tbox_y, tbox_x);
|
||||
if (w_text == 0)
|
||||
return DLG_EXIT_ERROR;
|
||||
|
||||
(void) keypad(w_text, TRUE);
|
||||
dlg_draw_box(dialog, tbox_y - MARGIN, tbox_x - MARGIN,
|
||||
(2 * MARGIN + 1), tbox_width + (MARGIN + EXT_WIDE),
|
||||
menubox_border_attr, menubox_attr);
|
||||
dlg_mouse_mkbigregion(getbegy(dialog) + tbox_y - MARGIN,
|
||||
getbegx(dialog) + tbox_x - MARGIN,
|
||||
1 + (2 * MARGIN),
|
||||
tbox_width + (MARGIN + EXT_WIDE),
|
||||
MOUSE_T, 1, 1, 3 /* doesn't matter */ );
|
||||
|
||||
/* Draw the directory listing box */
|
||||
dbox_height = height - MIN_HIGH;
|
||||
dbox_width = (width - (6 * MARGIN + 2 * EXT_WIDE)) / 2;
|
||||
dbox_y = (2 * MARGIN + 1);
|
||||
dbox_x = tbox_x;
|
||||
|
||||
w_dir = derwin(dialog, dbox_height, dbox_width, dbox_y, dbox_x);
|
||||
if (w_dir == 0)
|
||||
return DLG_EXIT_ERROR;
|
||||
|
||||
(void) keypad(w_dir, TRUE);
|
||||
(void) mvwprintw(dialog, dbox_y - (MARGIN + 1), dbox_x - MARGIN, d_label);
|
||||
dlg_draw_box(dialog,
|
||||
dbox_y - MARGIN, dbox_x - MARGIN,
|
||||
dbox_height + (MARGIN + 1), dbox_width + (MARGIN + 1),
|
||||
menubox_border_attr, menubox_attr);
|
||||
init_list(&d_list, dialog, w_dir, MOUSE_D);
|
||||
|
||||
/* Draw the filename listing box */
|
||||
fbox_height = dbox_height;
|
||||
fbox_width = dbox_width;
|
||||
fbox_y = dbox_y;
|
||||
fbox_x = tbox_x + dbox_width + (2 * MARGIN);
|
||||
|
||||
w_file = derwin(dialog, fbox_height, fbox_width, fbox_y, fbox_x);
|
||||
if (w_file == 0)
|
||||
return DLG_EXIT_ERROR;
|
||||
|
||||
(void) keypad(w_file, TRUE);
|
||||
(void) mvwprintw(dialog, fbox_y - (MARGIN + 1), fbox_x - MARGIN, f_label);
|
||||
dlg_draw_box(dialog,
|
||||
fbox_y - MARGIN, fbox_x - MARGIN,
|
||||
fbox_height + (MARGIN + 1), fbox_width + (MARGIN + 1),
|
||||
menubox_border_attr, menubox_attr);
|
||||
init_list(&f_list, dialog, w_file, MOUSE_F);
|
||||
|
||||
/* Set up the initial value */
|
||||
strcpy(input, path);
|
||||
offset = strlen(input);
|
||||
*current = 0;
|
||||
|
||||
while (result == DLG_EXIT_UNKNOWN) {
|
||||
int edit = 0;
|
||||
|
||||
if (fill_lists(current, input, &d_list, &f_list, state < sTEXT))
|
||||
show_buttons = TRUE;
|
||||
|
||||
/*
|
||||
* The last field drawn determines where the cursor is shown:
|
||||
*/
|
||||
if (show_buttons) {
|
||||
show_buttons = FALSE;
|
||||
button = (state < 0) ? 0 : state;
|
||||
dlg_draw_buttons(dialog, height - 2, 0, buttons, button, FALSE, width);
|
||||
}
|
||||
if (state < 0) {
|
||||
switch (state) {
|
||||
case sTEXT:
|
||||
dlg_set_focus(dialog, w_text);
|
||||
break;
|
||||
case sFILES:
|
||||
dlg_set_focus(dialog, w_file);
|
||||
break;
|
||||
case sDIRS:
|
||||
dlg_set_focus(dialog, w_dir);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (first) {
|
||||
(void) wrefresh(dialog);
|
||||
} else {
|
||||
fix_arrows(&d_list);
|
||||
fix_arrows(&f_list);
|
||||
key = dlg_mouse_wgetch(dialog, &fkey);
|
||||
}
|
||||
|
||||
if (!fkey) {
|
||||
fkey = TRUE;
|
||||
switch (key) {
|
||||
case ESC:
|
||||
result = DLG_EXIT_ESC;
|
||||
fkey = FALSE;
|
||||
break;
|
||||
case '\n':
|
||||
case '\r':
|
||||
key = KEY_ENTER;
|
||||
break;
|
||||
case ' ':
|
||||
key = KEY_SELECT;
|
||||
break;
|
||||
case TAB:
|
||||
key = KEY_RIGHT;
|
||||
break;
|
||||
case 0:
|
||||
break;
|
||||
default:
|
||||
fkey = FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (fkey) {
|
||||
switch (key) {
|
||||
case M_EVENT + KEY_PREVIOUS:
|
||||
state = sDIRS;
|
||||
scroll_list(-1, which_list());
|
||||
continue;
|
||||
case M_EVENT + KEY_NEXT:
|
||||
state = sDIRS;
|
||||
scroll_list(1, which_list());
|
||||
continue;
|
||||
case M_EVENT + KEY_PPAGE:
|
||||
state = sFILES;
|
||||
scroll_list(-1, which_list());
|
||||
continue;
|
||||
case M_EVENT + KEY_NPAGE:
|
||||
state = sFILES;
|
||||
scroll_list(1, which_list());
|
||||
continue;
|
||||
case KEY_PPAGE:
|
||||
scroll_list(-1, which_list());
|
||||
continue;
|
||||
case KEY_NPAGE:
|
||||
scroll_list(1, which_list());
|
||||
continue;
|
||||
case KEY_UP:
|
||||
if (change_list(-1, which_list()))
|
||||
continue;
|
||||
/* FALLTHRU */
|
||||
case KEY_LEFT:
|
||||
case KEY_BTAB:
|
||||
show_buttons = TRUE;
|
||||
do {
|
||||
state = dlg_prev_ok_buttonindex(state, sDIRS);
|
||||
} while (!usable_state(state, &d_list, &f_list));
|
||||
continue;
|
||||
case KEY_DOWN:
|
||||
if (change_list(1, which_list()))
|
||||
continue;
|
||||
/* FALLTHRU */
|
||||
case KEY_RIGHT:
|
||||
show_buttons = TRUE;
|
||||
do {
|
||||
state = dlg_next_ok_buttonindex(state, sDIRS);
|
||||
} while (!usable_state(state, &d_list, &f_list));
|
||||
continue;
|
||||
case KEY_SELECT:
|
||||
completed = 0;
|
||||
if (state == sFILES) {
|
||||
completed = data_of(&f_list);
|
||||
} else if (state == sDIRS) {
|
||||
completed = data_of(&d_list);
|
||||
}
|
||||
if (completed != 0) {
|
||||
state = sTEXT;
|
||||
show_buttons = TRUE;
|
||||
strcpy(leaf_of(input), completed);
|
||||
offset = strlen(input);
|
||||
dlg_show_string(w_text, input, offset, inputbox_attr,
|
||||
0, 0, tbox_width, 0, first);
|
||||
continue;
|
||||
} else if (state < sTEXT) {
|
||||
(void) beep();
|
||||
continue;
|
||||
}
|
||||
/* FALLTHRU */
|
||||
case KEY_ENTER:
|
||||
result = (state > 0) ? dlg_ok_buttoncode(state) : DLG_EXIT_OK;
|
||||
continue;
|
||||
default:
|
||||
if (key >= M_EVENT + MOUSE_T) {
|
||||
state = sTEXT;
|
||||
continue;
|
||||
} else if (key >= M_EVENT + MOUSE_F) {
|
||||
state = sFILES;
|
||||
f_list.choice = (key - (M_EVENT + MOUSE_F)) + f_list.offset;
|
||||
display_list(&f_list);
|
||||
continue;
|
||||
} else if (key >= M_EVENT + MOUSE_D) {
|
||||
state = sDIRS;
|
||||
d_list.choice = (key - (M_EVENT + MOUSE_D)) + d_list.offset;
|
||||
display_list(&d_list);
|
||||
continue;
|
||||
} else if (key >= M_EVENT
|
||||
&& (code = dlg_ok_buttoncode(key - M_EVENT)) >= 0) {
|
||||
result = code;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (state < 0) { /* Input box selected if we're editing */
|
||||
edit = dlg_edit_string(input, &offset, key, fkey, first);
|
||||
|
||||
if (edit) {
|
||||
dlg_show_string(w_text, input, offset, inputbox_attr,
|
||||
0, 0, tbox_width, 0, first);
|
||||
first = FALSE;
|
||||
state = sTEXT;
|
||||
}
|
||||
} else if (state >= 0 &&
|
||||
(code = dlg_char_to_button(key, buttons)) >= 0) {
|
||||
result = code;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
dlg_del_window(dialog);
|
||||
dlg_mouse_free_regions();
|
||||
free_list(&d_list, FALSE);
|
||||
free_list(&f_list, FALSE);
|
||||
return result;
|
||||
}
|
||||
BIN
extra/dialog-1.0-20050306/fselect.o
Normal file
BIN
extra/dialog-1.0-20050306/fselect.o
Normal file
Binary file not shown.
171
extra/dialog-1.0-20050306/guage.c
Normal file
171
extra/dialog-1.0-20050306/guage.c
Normal file
@@ -0,0 +1,171 @@
|
||||
/*
|
||||
* $Id: guage.c,v 1.26 2004/12/20 23:42:40 tom Exp $
|
||||
*
|
||||
* guage.c -- implements the gauge dialog
|
||||
*
|
||||
* AUTHOR: Marc Ewing, Red Hat Software
|
||||
* and: Thomas E. Dickey
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include "dialog.h"
|
||||
|
||||
#define MY_LEN (MAX_LEN)/2
|
||||
|
||||
#define MIN_HIGH (4)
|
||||
#define MIN_WIDE (10 + 2 * (2 + MARGIN))
|
||||
|
||||
#define isMarker(buf) !strncmp(buf, "XXX", 3)
|
||||
|
||||
static char *
|
||||
read_data(char *buffer, FILE *fp)
|
||||
{
|
||||
char *result;
|
||||
if (feof(fp)) {
|
||||
result = 0;
|
||||
} else if ((result = fgets(buffer, MY_LEN, fp)) != 0) {
|
||||
dlg_trim_string(result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static int
|
||||
decode_percent(char *buffer)
|
||||
{
|
||||
char *tmp = 0;
|
||||
long value = strtol(buffer, &tmp, 10);
|
||||
|
||||
if (tmp != 0 && (*tmp == 0 || isspace(UCH(*tmp))) && value >= 0) {
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Display a gauge, or progress meter. Starts at percent% and reads stdin. If
|
||||
* stdin is not XXX, then it is interpreted as a percentage, and the display is
|
||||
* updated accordingly. Otherwise the next line is the percentage, and
|
||||
* subsequent lines up to another XXX are used for the new prompt. Note that
|
||||
* the size of the window never changes, so the prompt can not get any larger
|
||||
* than the height and width specified.
|
||||
*/
|
||||
int
|
||||
dialog_gauge(const char *title,
|
||||
const char *prompt,
|
||||
int height,
|
||||
int width,
|
||||
int percent)
|
||||
{
|
||||
int i, x, y;
|
||||
char buf[MY_LEN];
|
||||
char prompt_buf[MY_LEN];
|
||||
WINDOW *dialog;
|
||||
|
||||
dlg_auto_size(title, prompt, &height, &width, MIN_HIGH, MIN_WIDE);
|
||||
dlg_print_size(height, width);
|
||||
dlg_ctl_size(height, width);
|
||||
|
||||
/* center dialog box on screen */
|
||||
x = dlg_box_x_ordinate(width);
|
||||
y = dlg_box_y_ordinate(height);
|
||||
|
||||
dialog = dlg_new_window(height, width, y, x);
|
||||
|
||||
curs_set(0);
|
||||
do {
|
||||
(void) werase(dialog);
|
||||
dlg_draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr);
|
||||
|
||||
dlg_draw_title(dialog, title);
|
||||
|
||||
wattrset(dialog, dialog_attr);
|
||||
dlg_print_autowrap(dialog, prompt, height, width - (2 * MARGIN));
|
||||
|
||||
dlg_draw_box(dialog,
|
||||
height - 4, 2 + MARGIN,
|
||||
2 + MARGIN, width - 2 * (2 + MARGIN),
|
||||
dialog_attr,
|
||||
border_attr);
|
||||
|
||||
/*
|
||||
* Clear the area for the progress bar by filling it with spaces
|
||||
* in the title-attribute, and write the percentage with that
|
||||
* attribute.
|
||||
*/
|
||||
(void) wmove(dialog, height - 3, 4);
|
||||
wattrset(dialog, title_attr);
|
||||
|
||||
for (i = 0; i < (width - 2 * (3 + MARGIN)); i++)
|
||||
(void) waddch(dialog, ' ');
|
||||
|
||||
(void) wmove(dialog, height - 3, (width / 2) - 2);
|
||||
(void) wprintw(dialog, "%3d%%", percent);
|
||||
|
||||
/*
|
||||
* Now draw a bar in reverse, relative to the background.
|
||||
* The window attribute was useful for painting the background,
|
||||
* but requires some tweaks to reverse it.
|
||||
*/
|
||||
x = (percent * (width - 2 * (3 + MARGIN))) / 100;
|
||||
if ((title_attr & A_REVERSE) != 0) {
|
||||
wattroff(dialog, A_REVERSE);
|
||||
} else {
|
||||
wattrset(dialog, A_REVERSE);
|
||||
}
|
||||
(void) wmove(dialog, height - 3, 4);
|
||||
for (i = 0; i < x; i++) {
|
||||
chtype ch = winch(dialog);
|
||||
if (title_attr & A_REVERSE) {
|
||||
ch &= ~A_REVERSE;
|
||||
}
|
||||
(void) waddch(dialog, ch);
|
||||
}
|
||||
|
||||
(void) wrefresh(dialog);
|
||||
|
||||
if (read_data(buf, dialog_state.pipe_input) == 0)
|
||||
break;
|
||||
if (isMarker(buf)) {
|
||||
/*
|
||||
* Historically, next line should be percentage, but one of the
|
||||
* worse-written clones of 'dialog' assumes the number is missing.
|
||||
* (Gresham's Law applied to software).
|
||||
*/
|
||||
if (read_data(buf, dialog_state.pipe_input) == 0)
|
||||
break;
|
||||
prompt_buf[0] = '\0';
|
||||
if (decode_percent(buf))
|
||||
percent = atoi(buf);
|
||||
else
|
||||
strcpy(prompt_buf, buf);
|
||||
|
||||
/* Rest is message text */
|
||||
while (read_data(buf, dialog_state.pipe_input) != 0
|
||||
&& !isMarker(buf)) {
|
||||
if (strlen(prompt_buf) + strlen(buf) < sizeof(prompt_buf) - 1) {
|
||||
strcat(prompt_buf, buf);
|
||||
}
|
||||
}
|
||||
prompt = prompt_buf;
|
||||
} else if (decode_percent(buf)) {
|
||||
percent = atoi(buf);
|
||||
}
|
||||
} while (1);
|
||||
|
||||
curs_set(1);
|
||||
dlg_del_window(dialog);
|
||||
return (DLG_EXIT_OK);
|
||||
}
|
||||
BIN
extra/dialog-1.0-20050306/guage.o
Normal file
BIN
extra/dialog-1.0-20050306/guage.o
Normal file
Binary file not shown.
77
extra/dialog-1.0-20050306/headers.sh
Executable file
77
extra/dialog-1.0-20050306/headers.sh
Executable file
@@ -0,0 +1,77 @@
|
||||
#! /bin/sh
|
||||
# $Id: headers.sh,v 1.1 2004/09/20 22:35:18 tom Exp $
|
||||
#
|
||||
# Adjust includes for header files that reside in a subdirectory of
|
||||
# /usr/include, etc.
|
||||
#
|
||||
# Parameters (the first case creates the sed script):
|
||||
# $1 is the target directory
|
||||
# $2 is the source directory
|
||||
# or (the second case does the install, using the sed script):
|
||||
# $1 is the script to use for installing
|
||||
# $2 is the target directory
|
||||
# $3 is the source directory
|
||||
# $4 is the file to install, editing source/target/etc.
|
||||
|
||||
PACKAGE=DIALOG
|
||||
PKGNAME=DLG
|
||||
CONFIGH=dlg_config.h
|
||||
|
||||
TMPSED=headers.sed
|
||||
|
||||
if test $# = 2 ; then
|
||||
rm -f $TMPSED
|
||||
DST=$1
|
||||
REF=$2
|
||||
LEAF=`basename $DST`
|
||||
case $DST in
|
||||
/*/include/$LEAF)
|
||||
END=`basename $DST`
|
||||
for i in $REF/*.h
|
||||
do
|
||||
NAME=`basename $i`
|
||||
echo "s/<$NAME>/<$END\/$NAME>/g" >> $TMPSED
|
||||
done
|
||||
;;
|
||||
*)
|
||||
echo "" >> $TMPSED
|
||||
;;
|
||||
esac
|
||||
for name in `
|
||||
egrep "#define[ ][ ]*[A-Z]" $REF/$CONFIGH \
|
||||
| sed -e 's/^#define[ ][ ]*//' \
|
||||
-e 's/[ ].*//' \
|
||||
| egrep -v "^GCC_" \
|
||||
| egrep -v "^${PACKAGE}_" \
|
||||
| sort -u \
|
||||
| egrep -v "^${PKGNAME}_"`
|
||||
do
|
||||
echo "s/\\<$name\\>/${PKGNAME}_$name/g" >>$TMPSED
|
||||
done
|
||||
else
|
||||
PRG=""
|
||||
while test $# != 3
|
||||
do
|
||||
PRG="$PRG $1"; shift
|
||||
done
|
||||
|
||||
DST=$1
|
||||
REF=$2
|
||||
SRC=$3
|
||||
|
||||
SHOW=`basename $SRC`
|
||||
TMPSRC=${TMPDIR-/tmp}/${SHOW}$$
|
||||
|
||||
echo " ... $SHOW"
|
||||
test -f $REF/$SRC && SRC="$REF/$SRC"
|
||||
|
||||
rm -f $TMPSRC
|
||||
sed -f $TMPSED $SRC > $TMPSRC
|
||||
NAME=`basename $SRC`
|
||||
|
||||
# Just in case someone gzip'd manpages, remove the conflicting copy.
|
||||
test -f $DST/$NAME.gz && rm -f $DST/$NAME.gz
|
||||
|
||||
eval $PRG $TMPSRC $DST/$NAME
|
||||
rm -f $TMPSRC
|
||||
fi
|
||||
189
extra/dialog-1.0-20050306/inputbox.c
Normal file
189
extra/dialog-1.0-20050306/inputbox.c
Normal file
@@ -0,0 +1,189 @@
|
||||
/*
|
||||
* $Id: inputbox.c,v 1.43 2004/09/19 22:09:50 tom Exp $
|
||||
*
|
||||
* inputbox.c -- implements the input box
|
||||
*
|
||||
* AUTHOR: Savio Lam (lam836@cs.cuhk.hk)
|
||||
* and: Thomas E. Dickey
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include "dialog.h"
|
||||
|
||||
#define sTEXT -1
|
||||
|
||||
/*
|
||||
* Display a dialog box for entering a string
|
||||
*/
|
||||
int
|
||||
dialog_inputbox(const char *title, const char *cprompt, int height, int width,
|
||||
const char *init, const int password)
|
||||
{
|
||||
int x, y, box_y, box_x, box_width;
|
||||
int show_buttons = TRUE;
|
||||
int col_offset = 0;
|
||||
int chr_offset = 0;
|
||||
int key = 0, fkey = 0, code;
|
||||
int result = DLG_EXIT_UNKNOWN;
|
||||
int state = dialog_vars.defaultno ? dlg_defaultno_button() : sTEXT;
|
||||
int first = (state == sTEXT);
|
||||
char *input = dialog_vars.input_result;
|
||||
WINDOW *dialog;
|
||||
char *prompt = dlg_strclone(cprompt);
|
||||
const char **buttons = dlg_ok_labels();
|
||||
|
||||
dlg_does_output();
|
||||
|
||||
dlg_tab_correct_str(prompt);
|
||||
if (init != NULL) {
|
||||
dlg_auto_size(title, prompt, &height, &width, 5,
|
||||
MIN(MAX((int) strlen(init) + 7, 26),
|
||||
SCOLS - (dialog_vars.begin_set ?
|
||||
dialog_vars.begin_x : 0)));
|
||||
} else {
|
||||
dlg_auto_size(title, prompt, &height, &width, 5, 26);
|
||||
}
|
||||
dlg_print_size(height, width);
|
||||
dlg_ctl_size(height, width);
|
||||
|
||||
x = dlg_box_x_ordinate(width);
|
||||
y = dlg_box_y_ordinate(height);
|
||||
|
||||
dialog = dlg_new_window(height, width, y, x);
|
||||
|
||||
dlg_mouse_setbase(x, y);
|
||||
|
||||
dlg_draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr);
|
||||
dlg_draw_bottom_box(dialog);
|
||||
dlg_draw_title(dialog, title);
|
||||
|
||||
wattrset(dialog, dialog_attr);
|
||||
dlg_print_autowrap(dialog, prompt, height, width);
|
||||
|
||||
/* Draw the input field box */
|
||||
box_width = width - 6;
|
||||
getyx(dialog, y, x);
|
||||
box_y = y + 2;
|
||||
box_x = (width - box_width) / 2;
|
||||
dlg_mouse_mkregion(y + 1, box_x - 1, 3, box_width + 2, 'i');
|
||||
dlg_draw_box(dialog, y + 1, box_x - 1, 3, box_width + 2,
|
||||
border_attr, dialog_attr);
|
||||
|
||||
/* Set up the initial value */
|
||||
if (!init)
|
||||
input[0] = '\0';
|
||||
else
|
||||
strcpy((char *) input, init);
|
||||
|
||||
while (result == DLG_EXIT_UNKNOWN) {
|
||||
int edit = 0;
|
||||
|
||||
/*
|
||||
* The last field drawn determines where the cursor is shown:
|
||||
*/
|
||||
if (show_buttons) {
|
||||
show_buttons = FALSE;
|
||||
col_offset = dlg_edit_offset(input, chr_offset, box_width);
|
||||
(void) wmove(dialog, box_y, box_x + col_offset);
|
||||
dlg_draw_buttons(dialog, height - 2, 0, buttons, state, FALSE, width);
|
||||
}
|
||||
|
||||
if (!first)
|
||||
key = dlg_mouse_wgetch(dialog, &fkey);
|
||||
|
||||
/*
|
||||
* Handle mouse clicks first, since we want to know if this is a button,
|
||||
* or something that dlg_edit_string() should handle.
|
||||
*/
|
||||
if (fkey
|
||||
&& key >= M_EVENT
|
||||
&& (code = dlg_ok_buttoncode(key - M_EVENT)) >= 0) {
|
||||
result = code;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (state == sTEXT) { /* Input box selected */
|
||||
edit = dlg_edit_string(input, &chr_offset, key, fkey, first);
|
||||
|
||||
if (edit) {
|
||||
dlg_show_string(dialog, input, chr_offset, inputbox_attr,
|
||||
box_y, box_x, box_width, password, first);
|
||||
first = FALSE;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/* handle non-functionkeys */
|
||||
if (!fkey) {
|
||||
|
||||
if ((code = dlg_char_to_button(key, buttons)) >= 0) {
|
||||
dlg_del_window(dialog);
|
||||
result = code;
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (key) {
|
||||
case ESC:
|
||||
result = DLG_EXIT_ESC;
|
||||
break;
|
||||
case TAB:
|
||||
key = KEY_RIGHT;
|
||||
fkey = TRUE;
|
||||
break;
|
||||
case ' ':
|
||||
case '\n':
|
||||
case '\r':
|
||||
key = KEY_ENTER;
|
||||
fkey = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* handle functionkeys */
|
||||
if (fkey) {
|
||||
switch (key) {
|
||||
case M_EVENT + 'i': /* mouse enter events */
|
||||
state = 0;
|
||||
/* FALLTHRU */
|
||||
case KEY_BTAB:
|
||||
case KEY_UP:
|
||||
case KEY_LEFT:
|
||||
show_buttons = TRUE;
|
||||
state = dlg_prev_ok_buttonindex(state, sTEXT);
|
||||
break;
|
||||
case KEY_DOWN:
|
||||
case KEY_RIGHT:
|
||||
show_buttons = TRUE;
|
||||
state = dlg_next_ok_buttonindex(state, sTEXT);
|
||||
break;
|
||||
case KEY_ENTER:
|
||||
dlg_del_window(dialog);
|
||||
result = (state >= 0) ? dlg_ok_buttoncode(state) : DLG_EXIT_OK;
|
||||
break;
|
||||
default:
|
||||
beep();
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
beep();
|
||||
}
|
||||
}
|
||||
|
||||
dlg_del_window(dialog);
|
||||
dlg_mouse_free_regions();
|
||||
free(prompt);
|
||||
return result;
|
||||
}
|
||||
BIN
extra/dialog-1.0-20050306/inputbox.o
Normal file
BIN
extra/dialog-1.0-20050306/inputbox.o
Normal file
Binary file not shown.
659
extra/dialog-1.0-20050306/inputstr.c
Normal file
659
extra/dialog-1.0-20050306/inputstr.c
Normal file
@@ -0,0 +1,659 @@
|
||||
/*
|
||||
* $Id: inputstr.c,v 1.40 2004/12/23 00:46:15 tom Exp $
|
||||
*
|
||||
* inputstr.c -- functions for input/display of a string
|
||||
*
|
||||
* Copyright 2000-2003,2004 Thomas E. Dickey
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include "dialog.h"
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef HAVE_SETLOCALE
|
||||
#include <locale.h>
|
||||
#endif
|
||||
|
||||
typedef struct _cache {
|
||||
struct _cache *next;
|
||||
#ifdef USE_WIDE_CURSES
|
||||
struct _cache *cache_at; /* unique: associate caches by CACHE */
|
||||
const char *string_at; /* unique: associate caches by char* */
|
||||
#endif
|
||||
unsigned s_len; /* strlen(string) - we add 1 for EOS */
|
||||
unsigned i_len; /* length(list) - we add 1 for EOS */
|
||||
char *string; /* a copy of the last-processed string */
|
||||
int *list; /* indices into the string */
|
||||
} CACHE;
|
||||
|
||||
#ifdef USE_WIDE_CURSES
|
||||
#define SAME_CACHE(c,s,l) (c->string != 0 && memcmp(c->string,s,l) == 0)
|
||||
|
||||
static CACHE *cache_list;
|
||||
|
||||
#ifdef USE_WIDE_CURSES
|
||||
static int
|
||||
have_locale(void)
|
||||
{
|
||||
static int result = -1;
|
||||
if (result < 0) {
|
||||
char *test = setlocale(LC_ALL, 0);
|
||||
if (test == 0 || *test == 0) {
|
||||
result = FALSE;
|
||||
} else if (strcmp(test, "C") && strcmp(test, "POSIX")) {
|
||||
result = TRUE;
|
||||
} else {
|
||||
result = FALSE;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
make_cache(CACHE * cache, const char *string)
|
||||
{
|
||||
CACHE *p;
|
||||
|
||||
p = (CACHE *) calloc(1, sizeof(CACHE));
|
||||
assert_ptr(p, "load_cache");
|
||||
p->next = cache_list;
|
||||
cache_list = p;
|
||||
|
||||
p->cache_at = cache;
|
||||
p->string_at = string;
|
||||
|
||||
*cache = *p;
|
||||
}
|
||||
|
||||
static void
|
||||
load_cache(CACHE * cache, const char *string)
|
||||
{
|
||||
CACHE *p;
|
||||
|
||||
for (p = cache_list; p != 0; p = p->next) {
|
||||
if (p->cache_at == cache
|
||||
&& p->string_at == string) {
|
||||
*cache = *p;
|
||||
return;
|
||||
}
|
||||
}
|
||||
make_cache(cache, string);
|
||||
}
|
||||
|
||||
static void
|
||||
save_cache(CACHE * cache, const char *string)
|
||||
{
|
||||
CACHE *p;
|
||||
|
||||
for (p = cache_list; p != 0; p = p->next) {
|
||||
if (p->cache_at == cache
|
||||
&& p->string_at == string) {
|
||||
CACHE *q = p->next;
|
||||
*p = *cache;
|
||||
p->next = q;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
#define SAME_CACHE(c,s,l) (c->string != 0)
|
||||
#define load_cache(cache, string) /* nothing */
|
||||
#define save_cache(cache, string) /* nothing */
|
||||
#endif /* USE_WIDE_CURSES */
|
||||
|
||||
/*
|
||||
* If the given string has not changed, we do not need to update the index.
|
||||
* If we need to update the index, allocate enough memory for it.
|
||||
*/
|
||||
static bool
|
||||
same_cache2(CACHE * cache, const char *string, unsigned i_len)
|
||||
{
|
||||
unsigned need;
|
||||
unsigned s_len = strlen(string);
|
||||
|
||||
if (cache->s_len != 0
|
||||
&& cache->s_len >= s_len
|
||||
&& cache->list != 0
|
||||
&& SAME_CACHE(cache, string, s_len)) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
need = sizeof(int *) * (i_len + 1);
|
||||
if (cache->list == 0) {
|
||||
cache->list = malloc(need);
|
||||
} else if (cache->i_len < i_len) {
|
||||
cache->list = realloc(cache->list, need);
|
||||
}
|
||||
cache->i_len = i_len;
|
||||
|
||||
if (cache->s_len >= s_len && cache->string != 0) {
|
||||
strcpy(cache->string, string);
|
||||
} else {
|
||||
if (cache->string != 0)
|
||||
free(cache->string);
|
||||
cache->string = dlg_strclone(string);
|
||||
}
|
||||
cache->s_len = s_len;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#ifdef USE_WIDE_CURSES
|
||||
/*
|
||||
* Like same_cache2(), but we are only concerned about caching a copy of the
|
||||
* string and its associated length.
|
||||
*/
|
||||
static bool
|
||||
same_cache1(CACHE * cache, const char *string, unsigned i_len)
|
||||
{
|
||||
unsigned s_len = strlen(string);
|
||||
|
||||
if (cache->s_len == s_len
|
||||
&& SAME_CACHE(cache, string, s_len)) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (cache->s_len >= s_len && cache->string != 0) {
|
||||
strcpy(cache->string, string);
|
||||
} else {
|
||||
if (cache->string != 0)
|
||||
free(cache->string);
|
||||
cache->string = dlg_strclone(string);
|
||||
}
|
||||
cache->s_len = s_len;
|
||||
cache->i_len = i_len;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
#endif /* USE_WIDE_CURSES */
|
||||
|
||||
/*
|
||||
* Counts the number of bytes that make up complete wide-characters, up to byte
|
||||
* 'len'. If there is no locale set, simply return the original length.
|
||||
*/
|
||||
#ifdef USE_WIDE_CURSES
|
||||
static int
|
||||
dlg_count_wcbytes(const char *string, size_t len)
|
||||
{
|
||||
int result;
|
||||
|
||||
if (have_locale()) {
|
||||
static CACHE cache;
|
||||
|
||||
load_cache(&cache, string);
|
||||
if (!same_cache1(&cache, string, len)) {
|
||||
while (len != 0) {
|
||||
int part = 0;
|
||||
int code = 0;
|
||||
const char *src = cache.string;
|
||||
mbstate_t state;
|
||||
int save = cache.string[len];
|
||||
|
||||
cache.string[len] = '\0';
|
||||
memset(&state, 0, sizeof(state));
|
||||
code = mbsrtowcs((wchar_t *) 0, &src, len, &state);
|
||||
cache.string[len] = save;
|
||||
if (code >= 0) {
|
||||
break;
|
||||
}
|
||||
++part;
|
||||
--len;
|
||||
}
|
||||
cache.i_len = len;
|
||||
}
|
||||
save_cache(&cache, string);
|
||||
result = cache.i_len;
|
||||
} else {
|
||||
result = len;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif /* USE_WIDE_CURSES */
|
||||
|
||||
/*
|
||||
* Counts the number of wide-characters in the string.
|
||||
*/
|
||||
int
|
||||
dlg_count_wchars(const char *string)
|
||||
{
|
||||
int result;
|
||||
|
||||
#ifdef USE_WIDE_CURSES
|
||||
if (have_locale()) {
|
||||
static CACHE cache;
|
||||
size_t len = strlen(string);
|
||||
|
||||
load_cache(&cache, string);
|
||||
if (!same_cache1(&cache, string, len)) {
|
||||
const char *src = cache.string;
|
||||
mbstate_t state;
|
||||
int part = dlg_count_wcbytes(cache.string, len);
|
||||
int save = cache.string[part];
|
||||
int code;
|
||||
wchar_t *temp = calloc(sizeof(wchar_t), len + 1);
|
||||
|
||||
cache.string[part] = '\0';
|
||||
memset(&state, 0, sizeof(state));
|
||||
code = mbsrtowcs(temp, &src, part, &state);
|
||||
cache.i_len = (code >= 0) ? wcslen(temp) : 0;
|
||||
cache.string[part] = save;
|
||||
free(temp);
|
||||
}
|
||||
save_cache(&cache, string);
|
||||
result = cache.i_len;
|
||||
} else
|
||||
#endif /* USE_WIDE_CURSES */
|
||||
{
|
||||
result = strlen(string);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Build an index of the wide-characters in the string, so we can easily tell
|
||||
* which byte-offset begins a given wide-character.
|
||||
*/
|
||||
const int *
|
||||
dlg_index_wchars(const char *string)
|
||||
{
|
||||
static CACHE cache;
|
||||
unsigned len = dlg_count_wchars(string);
|
||||
unsigned inx;
|
||||
|
||||
load_cache(&cache, string);
|
||||
if (!same_cache2(&cache, string, len)) {
|
||||
const char *current = string;
|
||||
|
||||
cache.list[0] = 0;
|
||||
for (inx = 1; inx <= len; ++inx) {
|
||||
#ifdef USE_WIDE_CURSES
|
||||
if (have_locale()) {
|
||||
mbstate_t state;
|
||||
int width;
|
||||
memset(&state, 0, sizeof(state));
|
||||
width = mbrlen(current, strlen(current), &state);
|
||||
if (width <= 0)
|
||||
width = 1; /* FIXME: what if we have a control-char? */
|
||||
current += width;
|
||||
cache.list[inx] = cache.list[inx - 1] + width;
|
||||
} else
|
||||
#endif /* USE_WIDE_CURSES */
|
||||
{
|
||||
(void) current;
|
||||
cache.list[inx] = inx;
|
||||
}
|
||||
}
|
||||
}
|
||||
save_cache(&cache, string);
|
||||
return cache.list;
|
||||
}
|
||||
|
||||
/*
|
||||
* Given the character-offset to find in the list, return the corresponding
|
||||
* array index.
|
||||
*/
|
||||
static int
|
||||
dlg_find_index(const int *list, int limit, int to_find)
|
||||
{
|
||||
int result;
|
||||
for (result = 0; result <= limit; ++result) {
|
||||
if (to_find == list[result]
|
||||
|| result == limit
|
||||
|| to_find < list[result + 1])
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Build a list of the display-columns for the given string's characters.
|
||||
*/
|
||||
const int *
|
||||
dlg_index_columns(const char *string)
|
||||
{
|
||||
static CACHE cache;
|
||||
unsigned len = dlg_count_wchars(string);
|
||||
unsigned inx;
|
||||
|
||||
load_cache(&cache, string);
|
||||
if (!same_cache2(&cache, string, len)) {
|
||||
cache.list[0] = 0;
|
||||
#ifdef USE_WIDE_CURSES
|
||||
if (have_locale()) {
|
||||
size_t num_bytes = strlen(string);
|
||||
const int *inx_wchars = dlg_index_wchars(string);
|
||||
mbstate_t state;
|
||||
|
||||
for (inx = 0; inx < len; ++inx) {
|
||||
wchar_t temp;
|
||||
int check;
|
||||
int result;
|
||||
|
||||
memset(&state, 0, sizeof(state));
|
||||
check = mbrtowc(&temp, string + inx_wchars[inx], num_bytes -
|
||||
inx_wchars[inx], &state);
|
||||
if (check <= 0)
|
||||
result = 1;
|
||||
else
|
||||
result = wcwidth(temp);
|
||||
if (result < 0) {
|
||||
cchar_t temp2;
|
||||
setcchar(&temp2, &temp, 0, 0, 0);
|
||||
result = wcslen(wunctrl(&temp2));
|
||||
}
|
||||
cache.list[inx + 1] = result;
|
||||
if (inx > 0)
|
||||
cache.list[inx + 1] += cache.list[inx];
|
||||
}
|
||||
} else
|
||||
#endif /* USE_WIDE_CURSES */
|
||||
{
|
||||
for (inx = 0; inx < len; ++inx) {
|
||||
cache.list[inx + 1] = (isprint(UCH(string[inx]))
|
||||
? 1
|
||||
: strlen(unctrl(UCH(string[inx]))));
|
||||
if (string[inx] == '\n')
|
||||
cache.list[inx + 1] = 1;
|
||||
if (inx != 0)
|
||||
cache.list[inx + 1] += cache.list[inx];
|
||||
}
|
||||
}
|
||||
}
|
||||
save_cache(&cache, string);
|
||||
return cache.list;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the number of columns used for a string. That happens to be the
|
||||
* end-value of the cols[] array.
|
||||
*/
|
||||
int
|
||||
dlg_count_columns(const char *string)
|
||||
{
|
||||
int result = 0;
|
||||
int limit = dlg_count_wchars(string);
|
||||
if (limit > 0) {
|
||||
const int *cols = dlg_index_columns(string);
|
||||
result = cols[limit];
|
||||
} else {
|
||||
result = strlen(string);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Given a column limit, count the number of wide characters that can fit
|
||||
* into that limit. The offset is used to skip over a leading character
|
||||
* that was already written.
|
||||
*/
|
||||
int
|
||||
dlg_limit_columns(const char *string, int limit, int offset)
|
||||
{
|
||||
const int *cols = dlg_index_columns(string);
|
||||
int result = dlg_count_wchars(string);
|
||||
|
||||
while (result > 0 && (cols[result] - cols[offset]) > limit)
|
||||
--result;
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Updates the string and character-offset, given various editing characters
|
||||
* or literal characters which are inserted at the character-offset.
|
||||
*/
|
||||
bool
|
||||
dlg_edit_string(char *string, int *chr_offset, int key, int fkey, bool force)
|
||||
{
|
||||
int i;
|
||||
int len = strlen(string);
|
||||
int limit = dlg_count_wchars(string);
|
||||
const int *indx = dlg_index_wchars(string);
|
||||
int offset = dlg_find_index(indx, limit, *chr_offset);
|
||||
int max_len = MAX_LEN;
|
||||
bool edit = TRUE;
|
||||
|
||||
if (dialog_vars.max_input != 0 && dialog_vars.max_input < MAX_LEN)
|
||||
max_len = dialog_vars.max_input;
|
||||
|
||||
/* transform editing characters into equivalent function-keys */
|
||||
if (!fkey) {
|
||||
fkey = TRUE; /* assume we transform */
|
||||
switch (key) {
|
||||
case 0:
|
||||
break;
|
||||
case CHR_BACKSPACE:
|
||||
key = KEY_BACKSPACE;
|
||||
break;
|
||||
case 21: /* ^U */
|
||||
key = KEY_DL;
|
||||
break;
|
||||
case CHR_DELETE:
|
||||
key = KEY_DC;
|
||||
break;
|
||||
case '\n':
|
||||
case '\r':
|
||||
key = KEY_ENTER;
|
||||
break;
|
||||
case ESC:
|
||||
case TAB:
|
||||
fkey = FALSE; /* this is used for navigation */
|
||||
break;
|
||||
default:
|
||||
fkey = FALSE; /* ...no, we did not transform */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (fkey) {
|
||||
switch (key) {
|
||||
case 0: /* special case for loop entry */
|
||||
edit = force;
|
||||
break;
|
||||
case KEY_LEFT:
|
||||
if (*chr_offset)
|
||||
*chr_offset = indx[offset - 1];
|
||||
break;
|
||||
case KEY_RIGHT:
|
||||
if (offset < limit)
|
||||
*chr_offset = indx[offset + 1];
|
||||
break;
|
||||
case KEY_HOME:
|
||||
if (*chr_offset)
|
||||
*chr_offset = 0;
|
||||
break;
|
||||
case KEY_END:
|
||||
if (offset < limit)
|
||||
*chr_offset = indx[limit];
|
||||
break;
|
||||
case KEY_BACKSPACE:
|
||||
if (offset) {
|
||||
int gap = indx[offset] - indx[offset - 1];
|
||||
*chr_offset = indx[offset - 1];
|
||||
if (gap > 0) {
|
||||
for (i = *chr_offset;
|
||||
(string[i] = string[i + gap]) != '\0';
|
||||
i++) {
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case KEY_DC:
|
||||
if (limit) {
|
||||
if (--limit == 0) {
|
||||
string[*chr_offset = 0] = '\0';
|
||||
} else {
|
||||
int gap = ((offset <= limit)
|
||||
? (indx[offset + 1] - indx[offset])
|
||||
: 0);
|
||||
if (gap > 0) {
|
||||
for (i = indx[offset];
|
||||
(string[i] = string[i + gap]) != '\0';
|
||||
i++) {
|
||||
;
|
||||
}
|
||||
} else if (offset > 0) {
|
||||
string[indx[offset - 1]] = '\0';
|
||||
}
|
||||
if (*chr_offset > indx[limit])
|
||||
*chr_offset = indx[limit];
|
||||
}
|
||||
}
|
||||
break;
|
||||
case KEY_DL:
|
||||
string[*chr_offset = 0] = '\0';
|
||||
break;
|
||||
case KEY_ENTER:
|
||||
edit = 0;
|
||||
break;
|
||||
default:
|
||||
beep();
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (key == ESC || key == TAB) {
|
||||
edit = 0;
|
||||
} else {
|
||||
if (len < max_len) {
|
||||
for (i = ++len; i > *chr_offset; i--)
|
||||
string[i] = string[i - 1];
|
||||
string[*chr_offset] = key;
|
||||
*chr_offset += 1;
|
||||
} else {
|
||||
(void) beep();
|
||||
}
|
||||
}
|
||||
}
|
||||
return edit;
|
||||
}
|
||||
|
||||
static void
|
||||
compute_edit_offset(const char *string,
|
||||
int chr_offset,
|
||||
int x_last,
|
||||
int *p_dpy_column,
|
||||
int *p_scroll_amt)
|
||||
{
|
||||
const int *cols = dlg_index_columns(string);
|
||||
const int *indx = dlg_index_wchars(string);
|
||||
int limit = dlg_count_wchars(string);
|
||||
int offset = dlg_find_index(indx, limit, chr_offset);
|
||||
int offset2;
|
||||
int dpy_column;
|
||||
int n;
|
||||
|
||||
for (n = offset2 = 0; n <= offset; ++n) {
|
||||
if ((cols[offset] - cols[n]) < x_last
|
||||
&& (offset == limit || (cols[offset + 1] - cols[n]) < x_last)) {
|
||||
offset2 = n;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
dpy_column = cols[offset] - cols[offset2];
|
||||
|
||||
if (p_dpy_column != 0)
|
||||
*p_dpy_column = dpy_column;
|
||||
if (p_scroll_amt != 0)
|
||||
*p_scroll_amt = offset2;
|
||||
}
|
||||
|
||||
/*
|
||||
* Given the character-offset in the string, returns the display-offset where
|
||||
* we will position the cursor.
|
||||
*/
|
||||
int
|
||||
dlg_edit_offset(char *string, int chr_offset, int x_last)
|
||||
{
|
||||
int result;
|
||||
|
||||
compute_edit_offset(string, chr_offset, x_last, &result, 0);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Displays the string, shifted as necessary, to fit within the box and show
|
||||
* the current character-offset.
|
||||
*/
|
||||
void
|
||||
dlg_show_string(WINDOW *win,
|
||||
const char *string, /* string to display (may be multibyte) */
|
||||
int chr_offset, /* character (not bytes) offset */
|
||||
chtype attr, /* window-attributes */
|
||||
int y_base, /* beginning row on screen */
|
||||
int x_base, /* beginning column on screen */
|
||||
int x_last, /* number of columns on screen */
|
||||
bool hidden, /* if true, do not echo */
|
||||
bool force) /* if true, force repaint */
|
||||
{
|
||||
x_last = MIN(x_last + x_base, getmaxx(win)) - x_base;
|
||||
|
||||
if (hidden && !dialog_vars.insecure) {
|
||||
if (force) {
|
||||
(void) wmove(win, y_base, x_base);
|
||||
wrefresh(win);
|
||||
}
|
||||
} else {
|
||||
const int *cols = dlg_index_columns(string);
|
||||
const int *indx = dlg_index_wchars(string);
|
||||
int limit = dlg_count_wchars(string);
|
||||
|
||||
int i, j, k;
|
||||
int input_x;
|
||||
int scrollamt;
|
||||
|
||||
compute_edit_offset(string, chr_offset, x_last, &input_x, &scrollamt);
|
||||
|
||||
wattrset(win, attr);
|
||||
(void) wmove(win, y_base, x_base);
|
||||
for (i = scrollamt, k = 0; i < limit && k < x_last; ++i) {
|
||||
int check = cols[i + 1] - cols[scrollamt];
|
||||
if (check <= x_last) {
|
||||
for (j = indx[i]; j < indx[i + 1]; ++j) {
|
||||
if (hidden && dialog_vars.insecure)
|
||||
waddch(win, '*');
|
||||
else
|
||||
waddch(win, CharOf(string[j]));
|
||||
}
|
||||
k = check;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (k++ < x_last)
|
||||
waddch(win, ' ');
|
||||
(void) wmove(win, y_base, x_base + input_x);
|
||||
wrefresh(win);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NO_LEAKS
|
||||
void
|
||||
_dlg_inputstr_leaks(void)
|
||||
{
|
||||
while (cache_list != 0) {
|
||||
CACHE *next = cache_list->next;
|
||||
if (cache_list->string != 0)
|
||||
free(cache_list->string);
|
||||
if (cache_list->list != 0)
|
||||
free(cache_list->list);
|
||||
free(cache_list);
|
||||
cache_list = next;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
BIN
extra/dialog-1.0-20050306/inputstr.o
Normal file
BIN
extra/dialog-1.0-20050306/inputstr.o
Normal file
Binary file not shown.
251
extra/dialog-1.0-20050306/install-sh
Executable file
251
extra/dialog-1.0-20050306/install-sh
Executable file
@@ -0,0 +1,251 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# install - install a program, script, or datafile
|
||||
# This comes from X11R5 (mit/util/scripts/install.sh).
|
||||
#
|
||||
# Copyright 1991 by the Massachusetts Institute of Technology
|
||||
#
|
||||
# Permission to use, copy, modify, distribute, and sell this software and its
|
||||
# documentation for any purpose is hereby granted without fee, provided that
|
||||
# the above copyright notice appear in all copies and that both that
|
||||
# copyright notice and this permission notice appear in supporting
|
||||
# documentation, and that the name of M.I.T. not be used in advertising or
|
||||
# publicity pertaining to distribution of the software without specific,
|
||||
# written prior permission. M.I.T. makes no representations about the
|
||||
# suitability of this software for any purpose. It is provided "as is"
|
||||
# without express or implied warranty.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# `make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch. It can only install one file at a time, a restriction
|
||||
# shared with many OS's install programs.
|
||||
|
||||
|
||||
# set DOITPROG to echo to test this script
|
||||
|
||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||
doit="${DOITPROG-}"
|
||||
|
||||
|
||||
# put in absolute paths if you don't have them in your path; or use env. vars.
|
||||
|
||||
mvprog="${MVPROG-mv}"
|
||||
cpprog="${CPPROG-cp}"
|
||||
chmodprog="${CHMODPROG-chmod}"
|
||||
chownprog="${CHOWNPROG-chown}"
|
||||
chgrpprog="${CHGRPPROG-chgrp}"
|
||||
stripprog="${STRIPPROG-strip}"
|
||||
rmprog="${RMPROG-rm}"
|
||||
mkdirprog="${MKDIRPROG-mkdir}"
|
||||
|
||||
transformbasename=""
|
||||
transform_arg=""
|
||||
instcmd="$mvprog"
|
||||
chmodcmd="$chmodprog 0755"
|
||||
chowncmd=""
|
||||
chgrpcmd=""
|
||||
stripcmd=""
|
||||
rmcmd="$rmprog -f"
|
||||
mvcmd="$mvprog"
|
||||
src=""
|
||||
dst=""
|
||||
dir_arg=""
|
||||
|
||||
while [ x"$1" != x ]; do
|
||||
case $1 in
|
||||
-c) instcmd="$cpprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-d) dir_arg=true
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-m) chmodcmd="$chmodprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-s) stripcmd="$stripprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
*) if [ x"$src" = x ]
|
||||
then
|
||||
src=$1
|
||||
else
|
||||
# this colon is to work around a 386BSD /bin/sh bug
|
||||
:
|
||||
dst=$1
|
||||
fi
|
||||
shift
|
||||
continue;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ x"$src" = x ]
|
||||
then
|
||||
echo "install: no input file specified"
|
||||
exit 1
|
||||
else
|
||||
:
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]; then
|
||||
dst=$src
|
||||
src=""
|
||||
|
||||
if [ -d $dst ]; then
|
||||
instcmd=:
|
||||
chmodcmd=""
|
||||
else
|
||||
instcmd=$mkdirprog
|
||||
fi
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
|
||||
if [ -f $src -o -d $src ]
|
||||
then
|
||||
:
|
||||
else
|
||||
echo "install: $src does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ x"$dst" = x ]
|
||||
then
|
||||
echo "install: no destination specified"
|
||||
exit 1
|
||||
else
|
||||
:
|
||||
fi
|
||||
|
||||
# If destination is a directory, append the input filename; if your system
|
||||
# does not like double slashes in filenames, you may need to add some logic
|
||||
|
||||
if [ -d $dst ]
|
||||
then
|
||||
dst="$dst"/`basename $src`
|
||||
else
|
||||
:
|
||||
fi
|
||||
fi
|
||||
|
||||
## this sed command emulates the dirname command
|
||||
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
||||
|
||||
# Make sure that the destination directory exists.
|
||||
# this part is taken from Noah Friedman's mkinstalldirs script
|
||||
|
||||
# Skip lots of stat calls in the usual case.
|
||||
if [ ! -d "$dstdir" ]; then
|
||||
defaultIFS='
|
||||
'
|
||||
IFS="${IFS-${defaultIFS}}"
|
||||
|
||||
oIFS="${IFS}"
|
||||
# Some sh's can't handle IFS=/ for some reason.
|
||||
IFS='%'
|
||||
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
|
||||
IFS="${oIFS}"
|
||||
|
||||
pathcomp=''
|
||||
|
||||
while [ $# -ne 0 ] ; do
|
||||
pathcomp="${pathcomp}${1}"
|
||||
shift
|
||||
|
||||
if [ ! -d "${pathcomp}" ] ;
|
||||
then
|
||||
$mkdirprog "${pathcomp}"
|
||||
else
|
||||
:
|
||||
fi
|
||||
|
||||
pathcomp="${pathcomp}/"
|
||||
done
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]
|
||||
then
|
||||
$doit $instcmd $dst &&
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else : ; fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else : ; fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else : ; fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else : ; fi
|
||||
else
|
||||
|
||||
# If we're going to rename the final executable, determine the name now.
|
||||
|
||||
if [ x"$transformarg" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
dstfile=`basename $dst $transformbasename |
|
||||
sed $transformarg`$transformbasename
|
||||
fi
|
||||
|
||||
# don't allow the sed command to completely eliminate the filename
|
||||
|
||||
if [ x"$dstfile" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
:
|
||||
fi
|
||||
|
||||
# Make a temp file name in the proper directory.
|
||||
|
||||
dsttmp=$dstdir/#inst.$$#
|
||||
|
||||
# Move or copy the file name to the temp name
|
||||
|
||||
$doit $instcmd $src $dsttmp &&
|
||||
|
||||
trap "rm -f ${dsttmp}" 0 &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits
|
||||
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $instcmd $src $dsttmp" command.
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else :;fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else :;fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else :;fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else :;fi &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
|
||||
$doit $rmcmd -f $dstdir/$dstfile &&
|
||||
$doit $mvcmd $dsttmp $dstdir/$dstfile
|
||||
|
||||
fi &&
|
||||
|
||||
|
||||
exit 0
|
||||
BIN
extra/dialog-1.0-20050306/libdialog.a
Normal file
BIN
extra/dialog-1.0-20050306/libdialog.a
Normal file
Binary file not shown.
184
extra/dialog-1.0-20050306/makefile
Normal file
184
extra/dialog-1.0-20050306/makefile
Normal file
@@ -0,0 +1,184 @@
|
||||
# $Id: makefile.in,v 1.41 2005/03/06 16:54:14 tom Exp $
|
||||
# template makefile for DIALOG
|
||||
#
|
||||
SHELL = /bin/sh
|
||||
|
||||
srcdir = .
|
||||
|
||||
|
||||
prefix = /usr/local
|
||||
exec_prefix = ${prefix}
|
||||
|
||||
top_builddir = .
|
||||
|
||||
x =
|
||||
o = .o
|
||||
a = .a
|
||||
|
||||
DESTDIR =
|
||||
bindir = $(DESTDIR)${exec_prefix}/bin
|
||||
includedir = $(DESTDIR)${prefix}/include
|
||||
libdir = $(DESTDIR)${exec_prefix}/lib
|
||||
mandir = $(DESTDIR)${prefix}/man
|
||||
MAN1DIR = $(mandir)/man1
|
||||
MAN3DIR = $(mandir)/man3
|
||||
|
||||
# see po/makefile
|
||||
localedir = $(prefix)/share/locale
|
||||
|
||||
CFLAGS = -g -O2 -static
|
||||
CPPFLAGS = -D_GNU_SOURCE -DHAVE_CONFIG_H -I. -I$(srcdir) -DLOCALEDIR=\"$(localedir)\"
|
||||
EXTRA_CFLAGS =
|
||||
CC = gcc
|
||||
AR = ar
|
||||
LDFLAGS = -static
|
||||
LIBS = -lncurses -lm -L/lib #
|
||||
RANLIB = ranlib
|
||||
|
||||
RM = rm -f
|
||||
LINT = lint
|
||||
|
||||
LIBTOOL =
|
||||
LIBTOOL_CLEAN =
|
||||
LIBTOOL_COMPILE =
|
||||
LIBTOOL_CREATE = $(AR) -cr
|
||||
LIBTOOL_LINK =
|
||||
LIBTOOL_INSTALL =
|
||||
LIBTOOL_UNINSTALL =
|
||||
|
||||
INSTALL = /bin/install -c
|
||||
INSTALL_PROGRAM = $(LIBTOOL_INSTALL) ${INSTALL}
|
||||
INSTALL_DATA = ${INSTALL} -m 644
|
||||
|
||||
LINK = $(LIBTOOL_LINK) $(CC)
|
||||
|
||||
#
|
||||
# Standard .c to .o compile line.
|
||||
#
|
||||
.SUFFIXES: .c $o
|
||||
.c$o :
|
||||
# compiling
|
||||
$(LIBTOOL_COMPILE) $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CPPFLAGS) -c $<
|
||||
|
||||
EXTRAOBJS = rc$o calendar$o fselect$o timebox$o formbox$o guage$o tailbox$o
|
||||
OBJECTS = $(EXTRAOBJS) \
|
||||
arrows$o \
|
||||
buttons$o \
|
||||
checklist$o \
|
||||
inputbox$o \
|
||||
inputstr$o \
|
||||
menubox$o \
|
||||
mouse$o \
|
||||
mousewget$o \
|
||||
msgbox$o \
|
||||
pause$o \
|
||||
textbox$o \
|
||||
ui_getc$o \
|
||||
util$o \
|
||||
version$o \
|
||||
yesno$o
|
||||
|
||||
LIB_OBJECT = $(OBJECTS)
|
||||
|
||||
SRCS = $(OBJECTS:$o=.c)
|
||||
HDRS = \
|
||||
dialog.h \
|
||||
dlg_colors.h \
|
||||
dlg_config.h
|
||||
|
||||
LIB = libdialog$a
|
||||
PROG = dialog$x
|
||||
ALL = $(LIB) $(PROG)
|
||||
|
||||
BIN_DIRS = $(bindir) $(MAN1DIR)
|
||||
LIB_DIRS = $(libdir) $(includedir) $(MAN3DIR)
|
||||
|
||||
all :: $(ALL)
|
||||
|
||||
#install :: install-lib
|
||||
#uninstall :: uninstall-lib
|
||||
|
||||
# :
|
||||
# @echo "Building GNU gettext library..."
|
||||
# @cd intl && $(MAKE)
|
||||
|
||||
dialog$o \
|
||||
$(OBJECTS) : $(srcdir)/dialog.h dlg_config.h VERSION
|
||||
|
||||
$(LIB) : $(LIB_OBJECT)
|
||||
$(LIBTOOL_CREATE) $(LIB) $(LIB_OBJECT)
|
||||
$(RANLIB) $@
|
||||
|
||||
dialog$x : $(LIB) dialog$o #
|
||||
$(LINK) -o $@ dialog$o -L. -ldialog $(LDFLAGS) $(LIBS)
|
||||
|
||||
clean \
|
||||
distclean \
|
||||
install \
|
||||
install-strip \
|
||||
uninstall ::
|
||||
@echo making $@
|
||||
# @-test -f intl/makefile && cd intl && $(MAKE) $@
|
||||
# @-test -f po/makefile && cd po && $(MAKE) $@
|
||||
|
||||
clean ::
|
||||
@- $(RM) -r autom4te.cache
|
||||
- $(RM) *.*cov *.da *.bb *.bbg
|
||||
- $(LIBTOOL_CLEAN) $(RM) *$o $(ALL)
|
||||
- $(RM) headers.sed
|
||||
- $(RM) core *~ tags TAGS
|
||||
|
||||
distclean :: clean
|
||||
$(RM) intl/libintl.h intl/po2tbl.sed
|
||||
$(RM) makefile dlg_config.h config.cache config.log config.status
|
||||
$(RM) samples/install/makefile
|
||||
|
||||
install :: $(PROG) $(bindir)
|
||||
$(INSTALL_PROGRAM) $(PROG) $(bindir)
|
||||
|
||||
install-strip :: $(PROG) $(bindir)
|
||||
$(INSTALL_PROGRAM) -s $(PROG) $(bindir)
|
||||
|
||||
install-strip \
|
||||
install :: $(MAN1DIR)
|
||||
$(INSTALL_DATA) $(srcdir)/dialog.1 $(MAN1DIR)
|
||||
|
||||
uninstall ::
|
||||
$(RM) $(bindir)/$(PROG)
|
||||
$(RM) $(MAN1DIR)/dialog.1
|
||||
|
||||
# most users do not want/need the library, so the install rules are distinct.
|
||||
install-lib :: $(LIB_DIRS) headers.sed
|
||||
@ echo "** installing library in $(libdir)"
|
||||
$(LIBTOOL_INSTALL) $(INSTALL_DATA) $(LIB) $(libdir)
|
||||
@ echo "** installing headers in $(includedir)"
|
||||
@ $(SHELL) $(srcdir)/headers.sh $(INSTALL_DATA) $(includedir) $(srcdir) dialog.h
|
||||
@ $(SHELL) $(srcdir)/headers.sh $(INSTALL_DATA) $(includedir) $(srcdir) dlg_colors.h
|
||||
@ $(SHELL) $(srcdir)/headers.sh $(INSTALL_DATA) $(includedir) . dlg_config.h
|
||||
@ echo "** installing manpage"
|
||||
$(INSTALL_DATA) $(srcdir)/dialog.3 $(MAN3DIR)
|
||||
|
||||
uninstall-lib :: $(LIB_DIRS)
|
||||
- $(LIBTOOL_UNINSTALL) $(RM) $(libdir)/$(LIB)
|
||||
$(RM) $(includedir)/dialog.h
|
||||
$(RM) $(includedir)/dlg_colors.h
|
||||
$(RM) $(includedir)/dlg_config.h
|
||||
$(RM) $(MAN3DIR)/dialog.3
|
||||
|
||||
headers.sed : $(srcdir)/headers.sh
|
||||
$(SHELL) $(srcdir)/headers.sh $(includedir) $(srcdir)
|
||||
|
||||
$(MAN1DIR) \
|
||||
$(MAN3DIR) \
|
||||
$(bindir) \
|
||||
$(includedir) \
|
||||
$(libdir) : ; $(srcdir)/mkdirs.sh $@
|
||||
|
||||
#tags :
|
||||
# ctags $(SRCS) $(HDRS)
|
||||
|
||||
#TAGS :
|
||||
# etags $(SRCS) $(HDRS)
|
||||
|
||||
lint:
|
||||
$(LINT) $(CPPFLAGS) *.c
|
||||
184
extra/dialog-1.0-20050306/makefile.in
Normal file
184
extra/dialog-1.0-20050306/makefile.in
Normal file
@@ -0,0 +1,184 @@
|
||||
# $Id: makefile.in,v 1.41 2005/03/06 16:54:14 tom Exp $
|
||||
# template makefile for DIALOG
|
||||
#
|
||||
SHELL = /bin/sh
|
||||
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
top_builddir = .
|
||||
|
||||
x = @EXEEXT@
|
||||
o = .@OBJEXT@
|
||||
a = @LIB_SUFFIX@
|
||||
|
||||
DESTDIR =
|
||||
bindir = $(DESTDIR)@bindir@
|
||||
includedir = $(DESTDIR)@includedir@
|
||||
libdir = $(DESTDIR)@libdir@
|
||||
mandir = $(DESTDIR)@mandir@
|
||||
MAN1DIR = $(mandir)/man1
|
||||
MAN3DIR = $(mandir)/man3
|
||||
|
||||
# see po/makefile
|
||||
localedir = $(prefix)/@DATADIRNAME@/locale
|
||||
|
||||
CFLAGS = @CFLAGS@
|
||||
CPPFLAGS = @CPPFLAGS@ @DEFS@ -I. -I$(srcdir) -DLOCALEDIR=\"$(localedir)\"
|
||||
EXTRA_CFLAGS = @EXTRA_CFLAGS@
|
||||
CC = @CC@
|
||||
AR = @AR@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBS = @LIBS@ @INTLDIR_MAKE@ @INTLLIBS@
|
||||
RANLIB = @LIB_PREP@
|
||||
|
||||
RM = rm -f
|
||||
LINT = lint
|
||||
|
||||
LIBTOOL = @LIBTOOL@ @ECHO_LT@
|
||||
LIBTOOL_CLEAN = @LIB_CLEAN@
|
||||
LIBTOOL_COMPILE = @LIB_COMPILE@
|
||||
LIBTOOL_CREATE = @LIB_CREATE@
|
||||
LIBTOOL_LINK = @LIB_LINK@
|
||||
LIBTOOL_INSTALL = @LIB_INSTALL@
|
||||
LIBTOOL_UNINSTALL = @LIB_UNINSTALL@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = $(LIBTOOL_INSTALL) @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
|
||||
LINK = $(LIBTOOL_LINK) $(CC)
|
||||
|
||||
#
|
||||
# Standard .c to .o compile line.
|
||||
#
|
||||
.SUFFIXES: .c $o
|
||||
.c$o :
|
||||
@RULE_CC@
|
||||
@ECHO_CC@$(LIBTOOL_COMPILE) $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CPPFLAGS) -c $<
|
||||
|
||||
EXTRAOBJS = @EXTRAOBJS@
|
||||
OBJECTS = $(EXTRAOBJS) \
|
||||
arrows$o \
|
||||
buttons$o \
|
||||
checklist$o \
|
||||
inputbox$o \
|
||||
inputstr$o \
|
||||
menubox$o \
|
||||
mouse$o \
|
||||
mousewget$o \
|
||||
msgbox$o \
|
||||
pause$o \
|
||||
textbox$o \
|
||||
ui_getc$o \
|
||||
util$o \
|
||||
version$o \
|
||||
yesno$o
|
||||
|
||||
LIB_OBJECT = @LIB_OBJECT@
|
||||
|
||||
SRCS = $(OBJECTS:$o=.c)
|
||||
HDRS = \
|
||||
dialog.h \
|
||||
dlg_colors.h \
|
||||
dlg_config.h
|
||||
|
||||
LIB = @LIB_PREFIX@dialog$a
|
||||
PROG = dialog$x
|
||||
ALL = $(LIB) $(PROG)
|
||||
|
||||
BIN_DIRS = $(bindir) $(MAN1DIR)
|
||||
LIB_DIRS = $(libdir) $(includedir) $(MAN3DIR)
|
||||
|
||||
all :: $(ALL)
|
||||
|
||||
@LIBTOOL_MAKE@install :: install-lib
|
||||
@LIBTOOL_MAKE@uninstall :: uninstall-lib
|
||||
|
||||
@INTLDIR_MAKE@@INTLLIBS@ :
|
||||
@INTLDIR_MAKE@ @echo "Building GNU gettext library..."
|
||||
@INTLDIR_MAKE@ @cd intl && $(MAKE) @cf_cv_makeflags@
|
||||
|
||||
dialog$o \
|
||||
$(OBJECTS) : $(srcdir)/dialog.h dlg_config.h VERSION
|
||||
|
||||
$(LIB) : $(LIB_OBJECT)
|
||||
$(LIBTOOL_CREATE) $(LIB) $(LIB_OBJECT)
|
||||
$(RANLIB) $@
|
||||
|
||||
dialog$x : $(LIB) dialog$o @INTLDIR_MAKE@ @INTLLIBS@
|
||||
$(LINK) -o $@ dialog$o -L. -ldialog $(LDFLAGS) $(LIBS)
|
||||
|
||||
clean \
|
||||
distclean \
|
||||
install \
|
||||
install-strip \
|
||||
uninstall ::
|
||||
@echo making $@
|
||||
@INTLDIR_MAKE@ @-test -f intl/makefile && cd intl && $(MAKE) @cf_cv_makeflags@ $@
|
||||
@MSG_DIR_MAKE@ @-test -f po/makefile && cd po && $(MAKE) @cf_cv_makeflags@ $@
|
||||
|
||||
clean ::
|
||||
@- $(RM) -r autom4te.cache
|
||||
- $(RM) *.*cov *.da *.bb *.bbg
|
||||
- $(LIBTOOL_CLEAN) $(RM) *$o $(ALL)
|
||||
- $(RM) headers.sed
|
||||
- $(RM) core *~ tags TAGS
|
||||
|
||||
distclean :: clean
|
||||
$(RM) intl/libintl.h intl/po2tbl.sed
|
||||
$(RM) makefile dlg_config.h config.cache config.log config.status
|
||||
$(RM) samples/install/makefile
|
||||
|
||||
install :: $(PROG) $(bindir)
|
||||
$(INSTALL_PROGRAM) $(PROG) $(bindir)
|
||||
|
||||
install-strip :: $(PROG) $(bindir)
|
||||
$(INSTALL_PROGRAM) -s $(PROG) $(bindir)
|
||||
|
||||
install-strip \
|
||||
install :: $(MAN1DIR)
|
||||
$(INSTALL_DATA) $(srcdir)/dialog.1 $(MAN1DIR)
|
||||
|
||||
uninstall ::
|
||||
$(RM) $(bindir)/$(PROG)
|
||||
$(RM) $(MAN1DIR)/dialog.1
|
||||
|
||||
# most users do not want/need the library, so the install rules are distinct.
|
||||
install-lib :: $(LIB_DIRS) headers.sed
|
||||
@ echo "** installing library in $(libdir)"
|
||||
$(LIBTOOL_INSTALL) $(INSTALL_DATA) $(LIB) $(libdir)
|
||||
@ echo "** installing headers in $(includedir)"
|
||||
@ $(SHELL) $(srcdir)/headers.sh $(INSTALL_DATA) $(includedir) $(srcdir) dialog.h
|
||||
@ $(SHELL) $(srcdir)/headers.sh $(INSTALL_DATA) $(includedir) $(srcdir) dlg_colors.h
|
||||
@ $(SHELL) $(srcdir)/headers.sh $(INSTALL_DATA) $(includedir) . dlg_config.h
|
||||
@ echo "** installing manpage"
|
||||
$(INSTALL_DATA) $(srcdir)/dialog.3 $(MAN3DIR)
|
||||
|
||||
uninstall-lib :: $(LIB_DIRS)
|
||||
- $(LIBTOOL_UNINSTALL) $(RM) $(libdir)/$(LIB)
|
||||
$(RM) $(includedir)/dialog.h
|
||||
$(RM) $(includedir)/dlg_colors.h
|
||||
$(RM) $(includedir)/dlg_config.h
|
||||
$(RM) $(MAN3DIR)/dialog.3
|
||||
|
||||
headers.sed : $(srcdir)/headers.sh
|
||||
$(SHELL) $(srcdir)/headers.sh $(includedir) $(srcdir)
|
||||
|
||||
$(MAN1DIR) \
|
||||
$(MAN3DIR) \
|
||||
$(bindir) \
|
||||
$(includedir) \
|
||||
$(libdir) : ; $(srcdir)/mkdirs.sh $@
|
||||
|
||||
@MAKE_LOWER_TAGS@tags :
|
||||
@MAKE_LOWER_TAGS@ ctags $(SRCS) $(HDRS)
|
||||
|
||||
@MAKE_LOWER_TAGS@TAGS :
|
||||
@MAKE_LOWER_TAGS@ etags $(SRCS) $(HDRS)
|
||||
|
||||
lint:
|
||||
$(LINT) $(CPPFLAGS) *.c
|
||||
651
extra/dialog-1.0-20050306/menubox.c
Normal file
651
extra/dialog-1.0-20050306/menubox.c
Normal file
@@ -0,0 +1,651 @@
|
||||
/*
|
||||
* $Id: menubox.c,v 1.79 2004/12/20 20:42:58 tom Exp $
|
||||
*
|
||||
* menubox.c -- implements the menu box
|
||||
*
|
||||
* AUTHOR: Savio Lam (lam836@cs.cuhk.hk)
|
||||
* and: Thomas E. Dickey
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include "dialog.h"
|
||||
|
||||
static int menu_width, tag_x, item_x;
|
||||
|
||||
typedef enum {
|
||||
Unselected = 0,
|
||||
Selected,
|
||||
Editing
|
||||
} Mode;
|
||||
|
||||
#define INPUT_ROWS 3 /* rows per inputmenu entry */
|
||||
|
||||
#define LLEN(n) ((n) * MENUBOX_TAGS)
|
||||
#define ItemData(i) &items[LLEN(i)]
|
||||
#define ItemName(i) items[LLEN(i)]
|
||||
#define ItemText(i) items[LLEN(i) + 1]
|
||||
#define ItemHelp(i) items[LLEN(i) + 2]
|
||||
|
||||
#define RowHeight(i) (dialog_vars.input_menu ? ((i) * INPUT_ROWS) : ((i) * 1))
|
||||
#define ItemToRow(i) (dialog_vars.input_menu ? ((i) * INPUT_ROWS + 1) : (i))
|
||||
#define RowToItem(i) (dialog_vars.input_menu ? ((i) / INPUT_ROWS + 0) : (i))
|
||||
|
||||
static void
|
||||
print_arrows(WINDOW *win,
|
||||
int box_x,
|
||||
int box_y,
|
||||
int scrollamt,
|
||||
int max_choice,
|
||||
int item_no,
|
||||
int menu_height)
|
||||
{
|
||||
dlg_draw_arrows(win, scrollamt,
|
||||
scrollamt + max_choice < item_no,
|
||||
box_x + tag_x + 1,
|
||||
box_y,
|
||||
box_y + menu_height + 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Print the tag of a menu-item
|
||||
*/
|
||||
static void
|
||||
print_tag(WINDOW *win,
|
||||
char **items,
|
||||
int choice,
|
||||
Mode selected)
|
||||
{
|
||||
int my_x = item_x;
|
||||
int my_y = ItemToRow(choice);
|
||||
int tag_width = (my_x - tag_x - GUTTER);
|
||||
const int *cols;
|
||||
const int *indx;
|
||||
int limit;
|
||||
unsigned prefix;
|
||||
|
||||
cols = dlg_index_columns(ItemName(0));
|
||||
indx = dlg_index_wchars(ItemName(0));
|
||||
limit = dlg_count_wchars(ItemName(0));
|
||||
prefix = indx[1] - indx[0];
|
||||
|
||||
/* highlight first char of the tag to be special */
|
||||
(void) wmove(win, my_y, tag_x);
|
||||
wattrset(win, selected ? tag_key_selected_attr : tag_key_attr);
|
||||
if (strlen(ItemName(0)) != 0)
|
||||
(void) waddnstr(win, ItemName(0), prefix);
|
||||
/* print rest of the string */
|
||||
wattrset(win, selected ? tag_selected_attr : tag_attr);
|
||||
if (strlen(ItemName(0)) > prefix) {
|
||||
limit = dlg_limit_columns(ItemName(0), tag_width, 1);
|
||||
if (limit > 0)
|
||||
(void) waddnstr(win, ItemName(0) + indx[1], indx[limit] - indx[1]);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Print menu item
|
||||
*/
|
||||
static void
|
||||
print_item(WINDOW *win,
|
||||
char **items,
|
||||
int choice,
|
||||
Mode selected)
|
||||
{
|
||||
chtype save = getattrs(win);
|
||||
int n;
|
||||
int my_width = menu_width;
|
||||
int my_x = item_x;
|
||||
int my_y = ItemToRow(choice);
|
||||
chtype attr = A_NORMAL;
|
||||
chtype textchar;
|
||||
chtype bordchar;
|
||||
|
||||
if (items == 0)
|
||||
return;
|
||||
|
||||
switch (selected) {
|
||||
default:
|
||||
case Unselected:
|
||||
textchar = item_attr;
|
||||
bordchar = item_attr;
|
||||
break;
|
||||
case Selected:
|
||||
textchar = item_selected_attr;
|
||||
bordchar = item_selected_attr;
|
||||
break;
|
||||
case Editing:
|
||||
textchar = inputbox_attr;
|
||||
bordchar = dialog_attr;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Clear 'residue' of last item and mark current current item */
|
||||
if (dialog_vars.input_menu) {
|
||||
wattrset(win, (selected != Unselected) ? item_selected_attr : item_attr);
|
||||
for (n = my_y - 1; n < my_y + INPUT_ROWS - 1; n++) {
|
||||
wmove(win, n, 0);
|
||||
wprintw(win, "%*s", my_width, " ");
|
||||
}
|
||||
} else {
|
||||
wattrset(win, menubox_attr);
|
||||
wmove(win, my_y, 0);
|
||||
wprintw(win, "%*s", my_width, " ");
|
||||
}
|
||||
|
||||
print_tag(win, items, choice, selected);
|
||||
|
||||
/* Draw the input field box (only for inputmenu) */
|
||||
(void) wmove(win, my_y, my_x);
|
||||
if (dialog_vars.input_menu) {
|
||||
my_width -= 1;
|
||||
dlg_draw_box(win, my_y - 1, my_x, INPUT_ROWS, my_width - my_x - tag_x,
|
||||
bordchar,
|
||||
bordchar);
|
||||
my_width -= 1;
|
||||
++my_x;
|
||||
}
|
||||
|
||||
/* print actual item */
|
||||
wmove(win, my_y, my_x);
|
||||
wattrset(win, textchar);
|
||||
dlg_print_text(win, ItemText(0), my_width - my_x, &attr);
|
||||
|
||||
if (selected) {
|
||||
dlg_item_help(ItemHelp(0));
|
||||
}
|
||||
wattrset(win, save);
|
||||
}
|
||||
|
||||
/*
|
||||
* Allow the user to edit the text of a menu entry.
|
||||
*/
|
||||
static int
|
||||
input_menu_edit(WINDOW *win, char **items, int choice, char **resultp)
|
||||
{
|
||||
chtype save = getattrs(win);
|
||||
char *result;
|
||||
int offset = 0;
|
||||
int key = 0, fkey = 0;
|
||||
int first = TRUE;
|
||||
/* see above */
|
||||
int y = ItemToRow(choice);
|
||||
int code = TRUE;
|
||||
|
||||
result = malloc(dialog_vars.max_input);
|
||||
assert_ptr(result, "input_menu_edit");
|
||||
|
||||
/* original item is used to initialize the input string. */
|
||||
result[0] = '\0';
|
||||
strcpy(result, ItemText(0));
|
||||
|
||||
print_item(win, items, choice, Editing);
|
||||
|
||||
/* taken out of inputbox.c - but somewhat modified */
|
||||
for (;;) {
|
||||
if (!first)
|
||||
key = dlg_mouse_wgetch(win, &fkey);
|
||||
if (dlg_edit_string(result, &offset, key, fkey, first)) {
|
||||
/*
|
||||
* menu_width - 2 ..... it's the actual number of maximal
|
||||
* possible characters could be written
|
||||
* to the screen.
|
||||
*
|
||||
* item_x - tag_x - 2 . same as "name_width"
|
||||
* ( see in dialog_menu() )
|
||||
*/
|
||||
dlg_show_string(win, result, offset, inputbox_attr,
|
||||
y, item_x + 1, menu_width - item_x - 3,
|
||||
FALSE, first);
|
||||
first = FALSE;
|
||||
} else if (key == ESC || key == TAB) {
|
||||
code = FALSE;
|
||||
break;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
print_item(win, items, choice, Selected);
|
||||
wattrset(win, save);
|
||||
|
||||
*resultp = result;
|
||||
return code;
|
||||
}
|
||||
|
||||
static int
|
||||
handle_button(int code, char **items, int choice)
|
||||
{
|
||||
switch (code) {
|
||||
case DLG_EXIT_OK: /* FALLTHRU */
|
||||
case DLG_EXIT_EXTRA:
|
||||
dlg_add_result(ItemName(choice));
|
||||
break;
|
||||
case DLG_EXIT_HELP:
|
||||
dlg_add_result("HELP ");
|
||||
if (USE_ITEM_HELP(ItemHelp(choice))) {
|
||||
dlg_add_result(ItemHelp(choice));
|
||||
code = DLG_EXIT_ITEM_HELP;
|
||||
} else {
|
||||
dlg_add_result(ItemName(choice));
|
||||
}
|
||||
break;
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
/*
|
||||
* Display a menu for choosing among a number of options
|
||||
*/
|
||||
int
|
||||
dialog_menu(const char *title, const char *cprompt, int height, int width,
|
||||
int menu_height, int item_no, char **items)
|
||||
{
|
||||
int i, j, x, y, cur_x, cur_y, box_x, box_y;
|
||||
int key = 0, fkey;
|
||||
int button = dialog_state.visit_items ? -1 : dlg_defaultno_button();
|
||||
int choice = dlg_default_item(items, MENUBOX_TAGS);
|
||||
int result = DLG_EXIT_UNKNOWN;
|
||||
int scrollamt = 0;
|
||||
int max_choice, min_width;
|
||||
int found;
|
||||
int use_width, name_width, text_width;
|
||||
WINDOW *dialog, *menu;
|
||||
char *prompt = dlg_strclone(cprompt);
|
||||
const char **buttons = dlg_ok_labels();
|
||||
|
||||
dlg_tab_correct_str(prompt);
|
||||
if (menu_height == 0) {
|
||||
min_width = dlg_calc_listw(item_no, items, MENUBOX_TAGS) + 10;
|
||||
/* calculate height without items (4) */
|
||||
dlg_auto_size(title, prompt, &height, &width, 4, MAX(26, min_width));
|
||||
dlg_calc_listh(&height, &menu_height, item_no);
|
||||
} else {
|
||||
dlg_auto_size(title, prompt, &height, &width, 4 + menu_height, 26);
|
||||
}
|
||||
dlg_print_size(height, width);
|
||||
dlg_ctl_size(height, width);
|
||||
|
||||
/* Find out maximal number of displayable items at once. */
|
||||
max_choice = MIN(menu_height,
|
||||
RowHeight(item_no));
|
||||
if (dialog_vars.input_menu)
|
||||
max_choice /= INPUT_ROWS;
|
||||
|
||||
x = dlg_box_x_ordinate(width);
|
||||
y = dlg_box_y_ordinate(height);
|
||||
|
||||
dialog = dlg_new_window(height, width, y, x);
|
||||
|
||||
dlg_mouse_setbase(x, y);
|
||||
|
||||
dlg_draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr);
|
||||
dlg_draw_bottom_box(dialog);
|
||||
dlg_draw_title(dialog, title);
|
||||
|
||||
wattrset(dialog, dialog_attr);
|
||||
dlg_print_autowrap(dialog, prompt, height, width);
|
||||
|
||||
menu_width = width - 6;
|
||||
getyx(dialog, cur_y, cur_x);
|
||||
box_y = cur_y + 1;
|
||||
box_x = (width - menu_width) / 2 - 1;
|
||||
|
||||
/* create new window for the menu */
|
||||
menu = dlg_sub_window(dialog, menu_height, menu_width,
|
||||
y + box_y + 1,
|
||||
x + box_x + 1);
|
||||
|
||||
/* draw a box around the menu items */
|
||||
dlg_draw_box(dialog, box_y, box_x, menu_height + 2, menu_width + 2,
|
||||
menubox_border_attr, menubox_attr);
|
||||
|
||||
name_width = 0;
|
||||
text_width = 0;
|
||||
|
||||
/* Find length of longest item to center menu *
|
||||
* only if --menu was given, using --inputmenu *
|
||||
* won't be centered. */
|
||||
for (i = 0; i < item_no; i++) {
|
||||
name_width = MAX(name_width, dlg_count_columns(ItemName(i)));
|
||||
text_width = MAX(text_width, dlg_count_columns(ItemText(i)));
|
||||
}
|
||||
|
||||
/* If the name+text is wider than the list is allowed, then truncate
|
||||
* one or both of them. If the name is no wider than 30% of the list,
|
||||
* leave it intact.
|
||||
*
|
||||
* FIXME: the gutter width and name/list ratio should be configurable.
|
||||
*/
|
||||
use_width = (menu_width - GUTTER);
|
||||
if (text_width + name_width > use_width) {
|
||||
int need = (int) (0.30 * use_width);
|
||||
if (name_width > need) {
|
||||
int want = (int) (use_width
|
||||
* ((double) name_width)
|
||||
/ (text_width + name_width));
|
||||
name_width = (want > need) ? want : need;
|
||||
}
|
||||
text_width = use_width - name_width;
|
||||
}
|
||||
|
||||
tag_x = (dialog_vars.input_menu
|
||||
? 0
|
||||
: (use_width - text_width - name_width) / 2);
|
||||
item_x = name_width + tag_x + GUTTER;
|
||||
|
||||
if (choice - scrollamt >= max_choice) {
|
||||
scrollamt = choice - (max_choice - 1);
|
||||
choice = max_choice - 1;
|
||||
}
|
||||
|
||||
/* Print the menu */
|
||||
for (i = 0; i < max_choice; i++) {
|
||||
print_item(menu,
|
||||
ItemData(i + scrollamt),
|
||||
i,
|
||||
(i == choice) ? Selected : Unselected);
|
||||
}
|
||||
(void) wnoutrefresh(menu);
|
||||
|
||||
/* register the new window, along with its borders */
|
||||
dlg_mouse_mkbigregion(box_y + 1, box_x, menu_height + 2, menu_width + 2,
|
||||
KEY_MAX, 1, 1, 1 /* by lines */ );
|
||||
|
||||
print_arrows(dialog, box_x, box_y, scrollamt, max_choice, item_no, menu_height);
|
||||
|
||||
dlg_draw_buttons(dialog, height - 2, 0, buttons, button, FALSE, width);
|
||||
|
||||
while (result == DLG_EXIT_UNKNOWN) {
|
||||
if (button < 0) /* --visit-items */
|
||||
wmove(dialog, box_y + ItemToRow(choice) + 1, box_x + tag_x + 1);
|
||||
|
||||
key = dlg_mouse_wgetch(dialog, &fkey);
|
||||
|
||||
if (!fkey) {
|
||||
fkey = TRUE;
|
||||
switch (key) {
|
||||
case '\n':
|
||||
case '\r':
|
||||
key = KEY_ENTER;
|
||||
break;
|
||||
case '-':
|
||||
key = KEY_UP;
|
||||
break;
|
||||
case '+':
|
||||
key = KEY_DOWN;
|
||||
break;
|
||||
case ' ':
|
||||
case TAB:
|
||||
key = KEY_RIGHT;
|
||||
break;
|
||||
case ESC:
|
||||
result = DLG_EXIT_ESC;
|
||||
continue;
|
||||
default:
|
||||
fkey = FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
found = FALSE;
|
||||
if (fkey) {
|
||||
/*
|
||||
* Allow a mouse-click on a box to switch selection to that box.
|
||||
* Handling a button click is a little more complicated, since we
|
||||
* push a KEY_ENTER back onto the input stream so we'll put the
|
||||
* cursor at the right place before handling the "keypress".
|
||||
*/
|
||||
if (key >= (M_EVENT + KEY_MAX)) {
|
||||
key -= (M_EVENT + KEY_MAX);
|
||||
i = RowToItem(key);
|
||||
if (scrollamt + i < max_choice) {
|
||||
found = TRUE;
|
||||
} else {
|
||||
beep();
|
||||
continue;
|
||||
}
|
||||
} else if (key >= M_EVENT
|
||||
&& dlg_ok_buttoncode(key - M_EVENT) >= 0) {
|
||||
button = (key - M_EVENT);
|
||||
ungetch('\n');
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* Check if key pressed matches first character of any item tag in
|
||||
* list. If there is more than one match, we will cycle through
|
||||
* each one as the same key is pressed repeatedly.
|
||||
*/
|
||||
if (button < 0 || !dialog_state.visit_items) {
|
||||
for (j = scrollamt + choice + 1; j < item_no; j++) {
|
||||
if (dlg_match_char(dlg_last_getc(), ItemName(j))) {
|
||||
found = TRUE;
|
||||
i = j - scrollamt;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
for (j = 0; j <= scrollamt + choice; j++) {
|
||||
if (dlg_match_char(dlg_last_getc(), ItemName(j))) {
|
||||
found = TRUE;
|
||||
i = j - scrollamt;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
dlg_flush_getc();
|
||||
} else if ((j = dlg_char_to_button(key, buttons)) >= 0) {
|
||||
button = j;
|
||||
ungetch('\n');
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* A single digit (1-9) positions the selection to that line in the
|
||||
* current screen.
|
||||
*/
|
||||
if (!found
|
||||
&& (key <= '9')
|
||||
&& (key > '0')
|
||||
&& (key - '1' < max_choice)) {
|
||||
found = TRUE;
|
||||
i = key - '1';
|
||||
}
|
||||
}
|
||||
|
||||
if (!found && fkey) {
|
||||
found = TRUE;
|
||||
switch (key) {
|
||||
case KEY_HOME:
|
||||
i = -scrollamt;
|
||||
break;
|
||||
case KEY_LL:
|
||||
case KEY_END:
|
||||
i = item_no - 1 - scrollamt;
|
||||
break;
|
||||
case M_EVENT + KEY_PPAGE:
|
||||
case KEY_PPAGE:
|
||||
if (choice)
|
||||
i = 0;
|
||||
else if (scrollamt != 0)
|
||||
i = -MIN(scrollamt, max_choice);
|
||||
else
|
||||
continue;
|
||||
break;
|
||||
case M_EVENT + KEY_NPAGE:
|
||||
case KEY_NPAGE:
|
||||
i = MIN(choice + max_choice, item_no - scrollamt - 1);
|
||||
break;
|
||||
case KEY_UP:
|
||||
i = choice - 1;
|
||||
if (choice == 0 && scrollamt == 0)
|
||||
continue;
|
||||
break;
|
||||
case KEY_DOWN:
|
||||
i = choice + 1;
|
||||
if (scrollamt + choice >= item_no - 1)
|
||||
continue;
|
||||
break;
|
||||
default:
|
||||
found = FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (found) {
|
||||
if (i != choice) {
|
||||
getyx(dialog, cur_y, cur_x);
|
||||
if (i < 0 || i >= max_choice) {
|
||||
#if defined(NCURSES_VERSION_MAJOR) && NCURSES_VERSION_MAJOR < 5
|
||||
/*
|
||||
* Using wscrl to assist ncurses scrolling is not needed
|
||||
* in version 5.x
|
||||
*/
|
||||
if (i == -1) {
|
||||
if (menu_height > 1) {
|
||||
/* De-highlight current first item */
|
||||
print_item(menu, ItemData(scrollamt), 0, Unselected);
|
||||
scrollok(menu, TRUE);
|
||||
wscrl(menu, -RowHeight(1));
|
||||
scrollok(menu, FALSE);
|
||||
}
|
||||
scrollamt--;
|
||||
print_item(menu, ItemData(scrollamt), 0, Selected);
|
||||
} else if (i == max_choice) {
|
||||
if (menu_height > 1) {
|
||||
/* De-highlight current last item before scrolling up */
|
||||
print_item(menu,
|
||||
ItemData(scrollamt + max_choice - 1),
|
||||
max_choice - 1,
|
||||
Unselected);
|
||||
scrollok(menu, TRUE);
|
||||
wscrl(menu, RowHeight(1));
|
||||
scrollok(menu, FALSE);
|
||||
}
|
||||
scrollamt++;
|
||||
print_item(menu,
|
||||
ItemData(scrollamt + max_choice - 1),
|
||||
max_choice - 1, TRUE);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
if (i < 0) {
|
||||
scrollamt += i;
|
||||
choice = 0;
|
||||
} else {
|
||||
choice = max_choice - 1;
|
||||
scrollamt += (i - max_choice + 1);
|
||||
}
|
||||
for (i = 0; i < max_choice; i++) {
|
||||
print_item(menu,
|
||||
ItemData(scrollamt + i),
|
||||
i,
|
||||
(i == choice) ? Selected : Unselected);
|
||||
}
|
||||
}
|
||||
/* Clean bottom lines */
|
||||
if (dialog_vars.input_menu) {
|
||||
int spare_lines, x_count;
|
||||
spare_lines = menu_height % INPUT_ROWS;
|
||||
wattrset(menu, menubox_attr);
|
||||
for (; spare_lines; spare_lines--) {
|
||||
wmove(menu, menu_height - spare_lines, 0);
|
||||
for (x_count = 0; x_count < menu_width;
|
||||
x_count++) {
|
||||
waddch(menu, ' ');
|
||||
}
|
||||
}
|
||||
}
|
||||
(void) wnoutrefresh(menu);
|
||||
print_arrows(dialog,
|
||||
box_x, box_y,
|
||||
scrollamt, max_choice, item_no, menu_height);
|
||||
} else {
|
||||
/* De-highlight current item */
|
||||
print_item(menu,
|
||||
ItemData(scrollamt + choice),
|
||||
choice,
|
||||
Unselected);
|
||||
/* Highlight new item */
|
||||
choice = i;
|
||||
print_item(menu,
|
||||
ItemData(scrollamt + choice),
|
||||
choice,
|
||||
Selected);
|
||||
(void) wnoutrefresh(menu);
|
||||
(void) wmove(dialog, cur_y, cur_x);
|
||||
wrefresh(dialog);
|
||||
}
|
||||
}
|
||||
continue; /* wait for another key press */
|
||||
}
|
||||
|
||||
if (fkey) {
|
||||
switch (key) {
|
||||
case KEY_BTAB:
|
||||
case KEY_LEFT:
|
||||
button = dlg_prev_button(buttons, button);
|
||||
dlg_draw_buttons(dialog, height - 2, 0, buttons, button,
|
||||
FALSE, width);
|
||||
break;
|
||||
case KEY_RIGHT:
|
||||
button = dlg_next_button(buttons, button);
|
||||
dlg_draw_buttons(dialog, height - 2, 0, buttons, button,
|
||||
FALSE, width);
|
||||
break;
|
||||
case KEY_ENTER:
|
||||
result = handle_button(dlg_ok_buttoncode(button),
|
||||
items,
|
||||
scrollamt + choice);
|
||||
|
||||
if (dialog_vars.input_menu && result == DLG_EXIT_EXTRA) {
|
||||
char *tmp;
|
||||
|
||||
if (input_menu_edit(menu,
|
||||
ItemData(scrollamt + choice),
|
||||
choice,
|
||||
&tmp)) {
|
||||
dialog_vars.input_result[0] = '\0';
|
||||
dlg_add_result("RENAMED ");
|
||||
dlg_add_result(ItemName(scrollamt + choice));
|
||||
dlg_add_result(" ");
|
||||
dlg_add_result(tmp);
|
||||
} else {
|
||||
result = DLG_EXIT_UNKNOWN;
|
||||
print_item(menu,
|
||||
ItemData(scrollamt + choice),
|
||||
choice,
|
||||
Selected);
|
||||
(void) wnoutrefresh(menu);
|
||||
}
|
||||
free(tmp);
|
||||
|
||||
dlg_draw_buttons(dialog, height - 2, 0,
|
||||
buttons, button, FALSE, width);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
flash();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dlg_mouse_free_regions();
|
||||
dlg_del_window(dialog);
|
||||
free(prompt);
|
||||
return result;
|
||||
}
|
||||
BIN
extra/dialog-1.0-20050306/menubox.o
Normal file
BIN
extra/dialog-1.0-20050306/menubox.o
Normal file
Binary file not shown.
37
extra/dialog-1.0-20050306/mkdirs.sh
Executable file
37
extra/dialog-1.0-20050306/mkdirs.sh
Executable file
@@ -0,0 +1,37 @@
|
||||
#! /bin/sh
|
||||
# mkinstalldirs --- make directory hierarchy
|
||||
# Author: Noah Friedman <friedman@prep.ai.mit.edu>
|
||||
# Created: 1993-05-16
|
||||
# Last modified: 1994-03-25
|
||||
# Public domain
|
||||
#
|
||||
|
||||
errstatus=0
|
||||
umask 022
|
||||
|
||||
for file in ${1+"$@"} ; do
|
||||
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
|
||||
shift
|
||||
|
||||
pathcomp=
|
||||
for d in ${1+"$@"} ; do
|
||||
pathcomp="$pathcomp$d"
|
||||
case "$pathcomp" in
|
||||
-* ) pathcomp=./$pathcomp ;;
|
||||
esac
|
||||
|
||||
if test ! -d "$pathcomp"; then
|
||||
echo "mkdir $pathcomp" 1>&2
|
||||
case "$pathcomp" in
|
||||
[a-zA-Z]: ) ;; # DOSISH systems
|
||||
* ) mkdir "$pathcomp" || errstatus=$? ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
pathcomp="$pathcomp/"
|
||||
done
|
||||
done
|
||||
|
||||
exit $errstatus
|
||||
|
||||
# mkinstalldirs ends here
|
||||
137
extra/dialog-1.0-20050306/mouse.c
Normal file
137
extra/dialog-1.0-20050306/mouse.c
Normal file
@@ -0,0 +1,137 @@
|
||||
/*
|
||||
* $Id: mouse.c,v 1.12 2003/11/26 17:31:38 tom Exp $
|
||||
*
|
||||
* mouse.c -- mouse support for dialog
|
||||
*
|
||||
* Copyright 2002,2003 Thomas E. Dickey
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
********/
|
||||
|
||||
#include "dialog.h"
|
||||
|
||||
#if USE_MOUSE
|
||||
|
||||
static int basex, basey;
|
||||
|
||||
static mseRegion *regionList = NULL;
|
||||
|
||||
/*=========== region related functions =============*/
|
||||
|
||||
static mseRegion *
|
||||
find_region_by_code(int code)
|
||||
{
|
||||
mseRegion *butPtr;
|
||||
|
||||
for (butPtr = regionList; butPtr; butPtr = butPtr->next) {
|
||||
if (code == butPtr->code)
|
||||
break;
|
||||
}
|
||||
return butPtr;
|
||||
}
|
||||
|
||||
void
|
||||
dlg_mouse_setbase(int x, int y)
|
||||
{
|
||||
basex = x;
|
||||
basey = y;
|
||||
}
|
||||
|
||||
void
|
||||
dlg_mouse_mkbigregion(int y, int x,
|
||||
int height, int width,
|
||||
int code,
|
||||
int step_y, int step_x,
|
||||
int mode)
|
||||
{
|
||||
mseRegion *butPtr = dlg_mouse_mkregion(y, x, height, width, -(M_EVENT + code));
|
||||
butPtr->mode = mode;
|
||||
butPtr->step_x = MAX(1, step_x);
|
||||
butPtr->step_y = MAX(1, step_y);
|
||||
}
|
||||
|
||||
void
|
||||
dlg_mouse_free_regions(void)
|
||||
{
|
||||
while (regionList != 0) {
|
||||
mseRegion *butPtr = regionList->next;
|
||||
free(regionList);
|
||||
regionList = butPtr;
|
||||
}
|
||||
}
|
||||
|
||||
mseRegion *
|
||||
dlg_mouse_mkregion(int y, int x, int height, int width, int code)
|
||||
{
|
||||
mseRegion *butPtr;
|
||||
|
||||
if ((butPtr = find_region_by_code(code)) == 0) {
|
||||
butPtr = malloc(sizeof(mseRegion));
|
||||
assert_ptr(butPtr, "dlg_mouse_mkregion");
|
||||
butPtr->next = regionList;
|
||||
regionList = butPtr;
|
||||
}
|
||||
if (butPtr != 0) {
|
||||
butPtr->mode = -1;
|
||||
butPtr->step_x = 0;
|
||||
butPtr->step_y = 0;
|
||||
butPtr->y = basey + y;
|
||||
butPtr->Y = basey + y + height;
|
||||
butPtr->x = basex + x;
|
||||
butPtr->X = basex + x + width;
|
||||
butPtr->code = code;
|
||||
}
|
||||
return butPtr;
|
||||
}
|
||||
|
||||
/* retrieve the frame under the pointer */
|
||||
static mseRegion *
|
||||
any_mouse_region(int y, int x, int small)
|
||||
{
|
||||
mseRegion *butPtr;
|
||||
|
||||
for (butPtr = regionList; butPtr; butPtr = butPtr->next) {
|
||||
if (small ^ (butPtr->code >= 0))
|
||||
continue;
|
||||
if (y < butPtr->y || y >= butPtr->Y)
|
||||
continue;
|
||||
if (x < butPtr->x || x >= butPtr->X)
|
||||
continue;
|
||||
break; /* found */
|
||||
}
|
||||
return butPtr;
|
||||
}
|
||||
|
||||
/* retrieve the frame under the pointer */
|
||||
mseRegion *
|
||||
dlg_mouse_region(int y, int x)
|
||||
{
|
||||
return any_mouse_region(y, x, TRUE);
|
||||
}
|
||||
|
||||
/* retrieve the bigframe under the pointer */
|
||||
mseRegion *
|
||||
dlg_mouse_bigregion(int y, int x)
|
||||
{
|
||||
return any_mouse_region(y, x, FALSE);
|
||||
}
|
||||
|
||||
#else
|
||||
void mouse_dummy(void);
|
||||
void
|
||||
mouse_dummy(void)
|
||||
{
|
||||
}
|
||||
#endif /* USE_MOUSE */
|
||||
BIN
extra/dialog-1.0-20050306/mouse.o
Normal file
BIN
extra/dialog-1.0-20050306/mouse.o
Normal file
Binary file not shown.
93
extra/dialog-1.0-20050306/mousewget.c
Normal file
93
extra/dialog-1.0-20050306/mousewget.c
Normal file
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* $Id: mousewget.c,v 1.16 2004/12/20 00:48:20 tom Exp $
|
||||
*
|
||||
* mousewget.c -- mouse/wgetch support for dialog
|
||||
*
|
||||
* Copyright 2000-2002,2003 Thomas E. Dickey
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
********/
|
||||
|
||||
#include "dialog.h"
|
||||
|
||||
static int
|
||||
mouse_wgetch(WINDOW *win, int *fkey, bool ignore_errs)
|
||||
{
|
||||
int key;
|
||||
|
||||
#if USE_MOUSE
|
||||
|
||||
do {
|
||||
|
||||
key = dlg_getc(win, fkey);
|
||||
if (fkey && (key == KEY_MOUSE)) {
|
||||
MEVENT event;
|
||||
mseRegion *p;
|
||||
|
||||
if (getmouse(&event) != ERR) {
|
||||
if ((p = dlg_mouse_region(event.y, event.x)) != 0) {
|
||||
key = M_EVENT + p->code;
|
||||
} else if ((p = dlg_mouse_bigregion(event.y, event.x)) != 0) {
|
||||
int x = event.x - p->x;
|
||||
int y = event.y - p->y;
|
||||
int row = (p->X - p->x) / p->step_x;
|
||||
|
||||
key = -(p->code);
|
||||
switch (p->mode) {
|
||||
case 1: /* index by lines */
|
||||
key += y;
|
||||
break;
|
||||
case 2: /* index by columns */
|
||||
key += (x / p->step_x);
|
||||
break;
|
||||
default:
|
||||
case 3: /* index by cells */
|
||||
key += (x / p->step_x) + (y * row);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
(void) beep();
|
||||
key = ERR;
|
||||
}
|
||||
} else {
|
||||
(void) beep();
|
||||
key = ERR;
|
||||
}
|
||||
}
|
||||
|
||||
} while (ignore_errs && (key == ERR));
|
||||
|
||||
#else
|
||||
|
||||
do {
|
||||
key = dlg_getc(win, fkey);
|
||||
} while (ignore_errs && (key == ERR));
|
||||
|
||||
#endif
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
int
|
||||
dlg_mouse_wgetch(WINDOW *win, int *fkey)
|
||||
{
|
||||
return mouse_wgetch(win, fkey, TRUE);
|
||||
}
|
||||
|
||||
int
|
||||
dlg_mouse_wgetch_nowait(WINDOW *win, int *fkey)
|
||||
{
|
||||
return mouse_wgetch(win, fkey, FALSE);
|
||||
}
|
||||
BIN
extra/dialog-1.0-20050306/mousewget.o
Normal file
BIN
extra/dialog-1.0-20050306/mousewget.o
Normal file
Binary file not shown.
286
extra/dialog-1.0-20050306/msgbox.c
Normal file
286
extra/dialog-1.0-20050306/msgbox.c
Normal file
@@ -0,0 +1,286 @@
|
||||
/*
|
||||
* $Id: msgbox.c,v 1.38 2004/11/18 21:57:00 tom Exp $
|
||||
*
|
||||
* msgbox.c -- implements the message box and info box
|
||||
*
|
||||
* AUTHOR: Savio Lam (lam836@cs.cuhk.hk)
|
||||
* and: Thomas E. Dickey
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include "dialog.h"
|
||||
|
||||
/*
|
||||
* Display the message in a scrollable window. Actually the way it works is
|
||||
* that we create a "tall" window of the proper width, let the text wrap within
|
||||
* that, and copy a slice of the result to the dialog.
|
||||
*
|
||||
* It works for ncurses. Other curses implementations show only blanks (Tru64)
|
||||
* or garbage (NetBSD).
|
||||
*/
|
||||
static int
|
||||
show_message(WINDOW *dialog,
|
||||
const char *prompt,
|
||||
int offset,
|
||||
int page,
|
||||
int width,
|
||||
int pauseopt)
|
||||
{
|
||||
#ifdef NCURSES_VERSION
|
||||
if (pauseopt) {
|
||||
int wide = width - (2 * MARGIN);
|
||||
int high = LINES;
|
||||
int y, x;
|
||||
int len;
|
||||
int percent;
|
||||
WINDOW *dummy;
|
||||
char buffer[5];
|
||||
|
||||
#if defined(NCURSES_VERSION_PATCH) && NCURSES_VERSION_PATCH >= 20040417
|
||||
/*
|
||||
* If we're not limited by the screensize, allow text to possibly be
|
||||
* one character per line.
|
||||
*/
|
||||
if ((len = strlen(prompt)) > high)
|
||||
high = len;
|
||||
#endif
|
||||
dummy = newwin(high, width, 0, 0);
|
||||
wbkgdset(dummy, dialog_attr | ' ');
|
||||
wattrset(dummy, dialog_attr);
|
||||
werase(dummy);
|
||||
dlg_print_autowrap(dummy, prompt, high, wide);
|
||||
getyx(dummy, y, x);
|
||||
|
||||
copywin(dummy, /* srcwin */
|
||||
dialog, /* dstwin */
|
||||
offset + MARGIN, /* sminrow */
|
||||
MARGIN, /* smincol */
|
||||
MARGIN, /* dminrow */
|
||||
MARGIN, /* dmincol */
|
||||
page, /* dmaxrow */
|
||||
wide, /* dmaxcol */
|
||||
FALSE);
|
||||
|
||||
delwin(dummy);
|
||||
|
||||
/* if the text is incomplete, or we have scrolled, show the percentage */
|
||||
if (y > 0 && wide > 4) {
|
||||
percent = ((page + offset) * 100.0 / y);
|
||||
if (percent < 0)
|
||||
percent = 0;
|
||||
if (percent > 100)
|
||||
percent = 100;
|
||||
if (offset != 0 || percent != 100) {
|
||||
(void) wattrset(dialog, position_indicator_attr);
|
||||
(void) wmove(dialog, MARGIN + page, wide - 4);
|
||||
(void) sprintf(buffer, "%d%%", percent);
|
||||
(void) waddstr(dialog, buffer);
|
||||
if ((len = strlen(buffer)) < 4) {
|
||||
wattrset(dialog, border_attr);
|
||||
whline(dialog, ACS_HLINE, 4 - len);
|
||||
}
|
||||
}
|
||||
}
|
||||
return (y - page);
|
||||
}
|
||||
#endif
|
||||
(void) offset;
|
||||
wattrset(dialog, dialog_attr);
|
||||
dlg_print_autowrap(dialog, prompt, page + 1 + (3 * MARGIN), width);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Display a message box. Program will pause and display an "OK" button
|
||||
* if the parameter 'pauseopt' is non-zero.
|
||||
*/
|
||||
int
|
||||
dialog_msgbox(const char *title, const char *cprompt, int height, int width,
|
||||
int pauseopt)
|
||||
{
|
||||
int x, y, last = 0, page;
|
||||
int key = 0, fkey;
|
||||
WINDOW *dialog = 0;
|
||||
char *prompt = dlg_strclone(cprompt);
|
||||
const char **buttons = dlg_ok_label();
|
||||
int offset = 0;
|
||||
bool show = TRUE;
|
||||
|
||||
#ifdef KEY_RESIZE
|
||||
int req_high = height;
|
||||
int req_wide = width;
|
||||
restart:
|
||||
#endif
|
||||
|
||||
dlg_tab_correct_str(prompt);
|
||||
dlg_auto_size(title, prompt, &height, &width,
|
||||
(pauseopt == 1 ? 2 : 0),
|
||||
(pauseopt == 1 ? 12 : 0));
|
||||
dlg_print_size(height, width);
|
||||
dlg_ctl_size(height, width);
|
||||
|
||||
x = dlg_box_x_ordinate(width);
|
||||
y = dlg_box_y_ordinate(height);
|
||||
|
||||
#ifdef KEY_RESIZE
|
||||
if (dialog != 0) {
|
||||
(void) wresize(dialog, height, width);
|
||||
(void) mvwin(dialog, y, x);
|
||||
(void) refresh();
|
||||
} else
|
||||
#endif
|
||||
dialog = dlg_new_window(height, width, y, x);
|
||||
page = height - (1 + 3 * MARGIN);
|
||||
|
||||
dlg_mouse_setbase(x, y);
|
||||
|
||||
dlg_draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr);
|
||||
dlg_draw_title(dialog, title);
|
||||
|
||||
wattrset(dialog, dialog_attr);
|
||||
|
||||
if (pauseopt) {
|
||||
bool done = FALSE;
|
||||
|
||||
dlg_draw_bottom_box(dialog);
|
||||
mouse_mkbutton(height - 2, width / 2 - 4, 6, '\n');
|
||||
dlg_draw_buttons(dialog, height - 2, 0, buttons, FALSE, FALSE, width);
|
||||
|
||||
while (!done) {
|
||||
if (show) {
|
||||
getyx(dialog, y, x);
|
||||
last = show_message(dialog, prompt, offset, page, width, pauseopt);
|
||||
wmove(dialog, y, x);
|
||||
wrefresh(dialog);
|
||||
show = FALSE;
|
||||
}
|
||||
key = dlg_mouse_wgetch(dialog, &fkey);
|
||||
if (!fkey) {
|
||||
fkey = TRUE;
|
||||
switch (key) {
|
||||
case ESC:
|
||||
done = TRUE;
|
||||
continue;
|
||||
case ' ':
|
||||
case '\n':
|
||||
case '\r':
|
||||
key = KEY_ENTER;
|
||||
break;
|
||||
case 'F':
|
||||
case 'f':
|
||||
key = KEY_NPAGE;
|
||||
break;
|
||||
case 'B':
|
||||
case 'b':
|
||||
key = KEY_PPAGE;
|
||||
break;
|
||||
case 'g':
|
||||
key = KEY_HOME;
|
||||
break;
|
||||
case 'G':
|
||||
key = KEY_END;
|
||||
break;
|
||||
case 'K':
|
||||
case 'k':
|
||||
key = KEY_UP;
|
||||
break;
|
||||
case 'J':
|
||||
case 'j':
|
||||
key = KEY_DOWN;
|
||||
break;
|
||||
default:
|
||||
if (dlg_char_to_button(key, buttons) == 0) {
|
||||
key = KEY_ENTER;
|
||||
} else {
|
||||
fkey = FALSE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (fkey) {
|
||||
switch (key) {
|
||||
#ifdef KEY_RESIZE
|
||||
case KEY_RESIZE:
|
||||
dlg_clear();
|
||||
height = req_high;
|
||||
width = req_wide;
|
||||
goto restart;
|
||||
#endif
|
||||
case KEY_ENTER:
|
||||
done = TRUE;
|
||||
break;
|
||||
case KEY_HOME:
|
||||
if (offset > 0) {
|
||||
offset = 0;
|
||||
show = TRUE;
|
||||
}
|
||||
break;
|
||||
case KEY_END:
|
||||
if (offset < last) {
|
||||
offset = last;
|
||||
show = TRUE;
|
||||
}
|
||||
break;
|
||||
case KEY_UP:
|
||||
if (offset > 0) {
|
||||
--offset;
|
||||
show = TRUE;
|
||||
}
|
||||
break;
|
||||
case KEY_DOWN:
|
||||
if (offset < last) {
|
||||
++offset;
|
||||
show = TRUE;
|
||||
}
|
||||
break;
|
||||
case KEY_PPAGE:
|
||||
if (offset > 0) {
|
||||
offset -= page;
|
||||
if (offset < 0)
|
||||
offset = 0;
|
||||
show = TRUE;
|
||||
}
|
||||
break;
|
||||
case KEY_NPAGE:
|
||||
if (offset < last) {
|
||||
offset += page;
|
||||
if (offset > last)
|
||||
offset = last;
|
||||
show = TRUE;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (key >= M_EVENT)
|
||||
done = TRUE;
|
||||
else
|
||||
beep();
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
beep();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
show_message(dialog, prompt, offset, page, width, pauseopt);
|
||||
key = '\n';
|
||||
wrefresh(dialog);
|
||||
}
|
||||
|
||||
dlg_del_window(dialog);
|
||||
dlg_mouse_free_regions();
|
||||
free(prompt);
|
||||
return (key == ESC) ? DLG_EXIT_ESC : DLG_EXIT_OK;
|
||||
}
|
||||
BIN
extra/dialog-1.0-20050306/msgbox.o
Normal file
BIN
extra/dialog-1.0-20050306/msgbox.o
Normal file
Binary file not shown.
125
extra/dialog-1.0-20050306/pause.c
Normal file
125
extra/dialog-1.0-20050306/pause.c
Normal file
@@ -0,0 +1,125 @@
|
||||
/*
|
||||
* $Id: pause.c,v 1.3 2004/12/20 23:42:34 tom Exp $
|
||||
*
|
||||
* pause.c -- implements the pause dialog
|
||||
*
|
||||
* AUTHOR: Yura Kalinichenko
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include "dialog.h"
|
||||
|
||||
/*
|
||||
* Display a gauge, or progress meter. Starts at percent% and reads stdin. If
|
||||
* stdin is not XXX, then it is interpreted as a percentage, and the display is
|
||||
* updated accordingly. Otherwise the next line is the percentage, and
|
||||
* subsequent lines up to another XXX are used for the new prompt. Note that
|
||||
* the size of the window never changes, so the prompt can not get any larger
|
||||
* than the height and width specified.
|
||||
*/
|
||||
int
|
||||
dialog_pause(const char *title,
|
||||
const char *prompt,
|
||||
int height,
|
||||
int width,
|
||||
int seconds)
|
||||
{
|
||||
int i, x, y;
|
||||
int seconds_orig;
|
||||
WINDOW *dialog;
|
||||
const char **buttons = dlg_exit_label();
|
||||
int key = 0, fkey;
|
||||
int status = DLG_EXIT_OK;
|
||||
|
||||
seconds_orig = (seconds > 0) ? seconds : 1;
|
||||
dlg_auto_size(title, prompt, &height, &width, 0, 0);
|
||||
dlg_print_size(height, width);
|
||||
dlg_ctl_size(height, width);
|
||||
|
||||
/* center dialog box on screen */
|
||||
x = dlg_box_x_ordinate(width);
|
||||
y = dlg_box_y_ordinate(height);
|
||||
|
||||
dialog = dlg_new_window(height, width, y, x);
|
||||
dlg_mouse_setbase(x, y);
|
||||
nodelay(dialog, TRUE);
|
||||
|
||||
curs_set(0);
|
||||
do {
|
||||
(void) werase(dialog);
|
||||
dlg_draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr);
|
||||
|
||||
dlg_draw_title(dialog, title);
|
||||
|
||||
wattrset(dialog, dialog_attr);
|
||||
dlg_print_autowrap(dialog, prompt, height, width - (2 * MARGIN));
|
||||
|
||||
dlg_draw_box(dialog,
|
||||
height - 6, 2 + MARGIN,
|
||||
2 + MARGIN, width - 2 * (2 + MARGIN),
|
||||
dialog_attr,
|
||||
border_attr);
|
||||
|
||||
/*
|
||||
* Clear the area for the progress bar by filling it with spaces
|
||||
* in the title-attribute, and write the percentage with that
|
||||
* attribute.
|
||||
*/
|
||||
(void) wmove(dialog, height - 5, 4);
|
||||
wattrset(dialog, title_attr);
|
||||
|
||||
for (i = 0; i < (width - 2 * (3 + MARGIN)); i++)
|
||||
(void) waddch(dialog, ' ');
|
||||
|
||||
(void) wmove(dialog, height - 5, (width / 2) - 2);
|
||||
(void) wprintw(dialog, "%3d", seconds);
|
||||
|
||||
/*
|
||||
* Now draw a bar in reverse, relative to the background.
|
||||
* The window attribute was useful for painting the background,
|
||||
* but requires some tweaks to reverse it.
|
||||
*/
|
||||
x = (seconds * (width - 2 * (3 + MARGIN))) / seconds_orig;
|
||||
if ((title_attr & A_REVERSE) != 0) {
|
||||
wattroff(dialog, A_REVERSE);
|
||||
} else {
|
||||
wattrset(dialog, A_REVERSE);
|
||||
}
|
||||
(void) wmove(dialog, height - 5, 4);
|
||||
for (i = 0; i < x; i++) {
|
||||
chtype ch = winch(dialog);
|
||||
if (title_attr & A_REVERSE) {
|
||||
ch &= ~A_REVERSE;
|
||||
}
|
||||
(void) waddch(dialog, ch);
|
||||
}
|
||||
|
||||
dlg_draw_bottom_box(dialog);
|
||||
mouse_mkbutton(height - 2, width / 2 - 4, 6, '\n');
|
||||
dlg_draw_buttons(dialog, height - 2, 0, buttons, FALSE, FALSE, width);
|
||||
(void) wrefresh(dialog);
|
||||
napms(1000);
|
||||
key = dlg_mouse_wgetch_nowait(dialog, &fkey);
|
||||
if (key != ERR) {
|
||||
status = DLG_EXIT_CANCEL;
|
||||
break;
|
||||
}
|
||||
} while (seconds-- > 0);
|
||||
|
||||
curs_set(1);
|
||||
dlg_del_window(dialog);
|
||||
return (status);
|
||||
}
|
||||
BIN
extra/dialog-1.0-20050306/pause.o
Normal file
BIN
extra/dialog-1.0-20050306/pause.o
Normal file
Binary file not shown.
22
extra/dialog-1.0-20050306/po/POTFILES.in
Normal file
22
extra/dialog-1.0-20050306/po/POTFILES.in
Normal file
@@ -0,0 +1,22 @@
|
||||
arrows.c
|
||||
buttons.c
|
||||
calendar.c
|
||||
checklist.c
|
||||
dialog.c
|
||||
dialog.h
|
||||
dlg_colors.h
|
||||
fselect.c
|
||||
guage.c
|
||||
inputbox.c
|
||||
inputstr.c
|
||||
menubox.c
|
||||
mouse.c
|
||||
mousewget.c
|
||||
msgbox.c
|
||||
pause.c
|
||||
rc.c
|
||||
tailbox.c
|
||||
textbox.c
|
||||
timebox.c
|
||||
util.c
|
||||
yesno.c
|
||||
71
extra/dialog-1.0-20050306/po/ar.po
Normal file
71
extra/dialog-1.0-20050306/po/ar.po
Normal file
@@ -0,0 +1,71 @@
|
||||
# Arabic translation of Dialog.
|
||||
# This file is distributed under the same license as the dialog package.
|
||||
# Copyright (C) 2005 Thomas Dickey.
|
||||
# Abdulaziz Al-Arfaj <alarfaj0@yahoo.com>, 2004.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Dialog 1.0-20050116\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2005-01-16 10:51-0500\n"
|
||||
"PO-Revision-Date: 2004-07-21 00:22+0300\n"
|
||||
"Last-Translator: Abdulaziz Al-Arfaj <alarfaj0@yahoo.com>\n"
|
||||
"Language-Team: Arabic <support@arabeyes.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: KBabel 1.3\n"
|
||||
|
||||
#: buttons.c:359
|
||||
msgid "Yes"
|
||||
msgstr "نعم"
|
||||
|
||||
#: buttons.c:367
|
||||
msgid "No"
|
||||
msgstr "لا"
|
||||
|
||||
#: buttons.c:375
|
||||
msgid "OK"
|
||||
msgstr "موافق"
|
||||
|
||||
#: buttons.c:383
|
||||
msgid "Cancel"
|
||||
msgstr "إلغاء"
|
||||
|
||||
#: buttons.c:391
|
||||
msgid "EXIT"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:399
|
||||
msgid "Extra"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:407
|
||||
msgid "Help"
|
||||
msgstr ""
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:299
|
||||
msgid "Month"
|
||||
msgstr ""
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:319
|
||||
msgid "Year"
|
||||
msgstr ""
|
||||
|
||||
#: dialog.c:672
|
||||
msgid "Rename"
|
||||
msgstr ""
|
||||
|
||||
#: fselect.c:426
|
||||
msgid "Directories"
|
||||
msgstr ""
|
||||
|
||||
#: fselect.c:427
|
||||
msgid "Files"
|
||||
msgstr ""
|
||||
|
||||
#: textbox.c:437
|
||||
msgid "Search"
|
||||
msgstr ""
|
||||
71
extra/dialog-1.0-20050306/po/bg.po
Normal file
71
extra/dialog-1.0-20050306/po/bg.po
Normal file
@@ -0,0 +1,71 @@
|
||||
# Bulgarian translation of Dialog.
|
||||
# This file is distributed under the same license as the dialog package.
|
||||
# Copyright (C) 2005 Thomas Dickey.
|
||||
# Ognyan Kulev <ogi@fmi.uni-sofia.bg>, 2004.
|
||||
#
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Dialog 1.0-20050116\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2005-01-16 10:51-0500\n"
|
||||
"PO-Revision-Date: 2004-09-13 09:02+0300\n"
|
||||
"Last-Translator: Ognyan Kulev <ogi@fmi.uni-sofia.bg>\n"
|
||||
"Language-Team: Bulgarian <dict@linux.zonebg.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: buttons.c:359
|
||||
msgid "Yes"
|
||||
msgstr "Да"
|
||||
|
||||
#: buttons.c:367
|
||||
msgid "No"
|
||||
msgstr "Не"
|
||||
|
||||
#: buttons.c:375
|
||||
msgid "OK"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:383
|
||||
msgid "Cancel"
|
||||
msgstr "Отказ"
|
||||
|
||||
#: buttons.c:391
|
||||
msgid "EXIT"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:399
|
||||
msgid "Extra"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:407
|
||||
msgid "Help"
|
||||
msgstr ""
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:299
|
||||
msgid "Month"
|
||||
msgstr ""
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:319
|
||||
msgid "Year"
|
||||
msgstr ""
|
||||
|
||||
#: dialog.c:672
|
||||
msgid "Rename"
|
||||
msgstr ""
|
||||
|
||||
#: fselect.c:426
|
||||
msgid "Directories"
|
||||
msgstr ""
|
||||
|
||||
#: fselect.c:427
|
||||
msgid "Files"
|
||||
msgstr ""
|
||||
|
||||
#: textbox.c:437
|
||||
msgid "Search"
|
||||
msgstr ""
|
||||
70
extra/dialog-1.0-20050306/po/ca.po
Normal file
70
extra/dialog-1.0-20050306/po/ca.po
Normal file
@@ -0,0 +1,70 @@
|
||||
# Catalan translation of Dialog.
|
||||
# Copyright © 2004, 2005 Free Software Foundation, Inc.
|
||||
# This file is distributed under the same licence as the dialog package.
|
||||
# Jordi Mallach <jordi@debian.org>, 2004, 2005.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog 1.0-rel20041222\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2004-12-19 20:14-0500\n"
|
||||
"PO-Revision-Date: 2005-01-19 12:20+0200\n"
|
||||
"Last-Translator: Jordi Mallach <jordi@gnu.org>\n"
|
||||
"Language-Team: Catalan <ca@dodds.net>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: buttons.c:359
|
||||
msgid "Yes"
|
||||
msgstr "Sí"
|
||||
|
||||
#: buttons.c:367
|
||||
msgid "No"
|
||||
msgstr "No"
|
||||
|
||||
#: buttons.c:375
|
||||
msgid "OK"
|
||||
msgstr "D'acord"
|
||||
|
||||
#: buttons.c:383
|
||||
msgid "Cancel"
|
||||
msgstr "Cancel·la"
|
||||
|
||||
#: buttons.c:391
|
||||
msgid "EXIT"
|
||||
msgstr "SURT"
|
||||
|
||||
#: buttons.c:399
|
||||
msgid "Extra"
|
||||
msgstr "Extra"
|
||||
|
||||
#: buttons.c:407
|
||||
msgid "Help"
|
||||
msgstr "Ajuda"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:299
|
||||
msgid "Month"
|
||||
msgstr "Mes"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:319
|
||||
msgid "Year"
|
||||
msgstr "Any"
|
||||
|
||||
#: dialog.c:672
|
||||
msgid "Rename"
|
||||
msgstr "Reanomena"
|
||||
|
||||
#: fselect.c:426
|
||||
msgid "Directories"
|
||||
msgstr "Directoris"
|
||||
|
||||
#: fselect.c:427
|
||||
msgid "Files"
|
||||
msgstr "Fitxers"
|
||||
|
||||
#: textbox.c:437
|
||||
msgid "Search"
|
||||
msgstr "Cerca"
|
||||
67
extra/dialog-1.0-20050306/po/cs.po
Normal file
67
extra/dialog-1.0-20050306/po/cs.po
Normal file
@@ -0,0 +1,67 @@
|
||||
# From: Martin Povolny <martin@solnet.cz>
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog 0.9a-20010527\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2004-12-19 20:14-0500\n"
|
||||
"PO-Revision-Date: 2004-12-19 20:14-0500\n"
|
||||
"Last-Translator: Martin Povolny <martin@solnet.cz>\n"
|
||||
"Language-Team:\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=ISO-8859-2\n"
|
||||
"Content-Transfer-Encoding: 8-bit\n"
|
||||
|
||||
#: buttons.c:359
|
||||
msgid "Yes"
|
||||
msgstr "Ano"
|
||||
|
||||
#: buttons.c:367
|
||||
msgid "No"
|
||||
msgstr "Ne"
|
||||
|
||||
#: buttons.c:375
|
||||
msgid "OK"
|
||||
msgstr "OK"
|
||||
|
||||
#: buttons.c:383
|
||||
msgid "Cancel"
|
||||
msgstr "Storno"
|
||||
|
||||
#: buttons.c:391
|
||||
msgid "EXIT"
|
||||
msgstr "Konec"
|
||||
|
||||
#: buttons.c:399
|
||||
msgid "Extra"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:407
|
||||
msgid "Help"
|
||||
msgstr ""
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:299
|
||||
msgid "Month"
|
||||
msgstr "Mìsíc"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:319
|
||||
msgid "Year"
|
||||
msgstr "Rok"
|
||||
|
||||
#: dialog.c:672
|
||||
msgid "Rename"
|
||||
msgstr ""
|
||||
|
||||
#: fselect.c:426
|
||||
msgid "Directories"
|
||||
msgstr "Adresáøe"
|
||||
|
||||
#: fselect.c:427
|
||||
msgid "Files"
|
||||
msgstr "Soubory"
|
||||
|
||||
#: textbox.c:437
|
||||
#, fuzzy
|
||||
msgid "Search"
|
||||
msgstr "Search"
|
||||
69
extra/dialog-1.0-20050306/po/cy.po
Normal file
69
extra/dialog-1.0-20050306/po/cy.po
Normal file
@@ -0,0 +1,69 @@
|
||||
# Dialog
|
||||
# Copyright 2003,2004 # Thomas Dickey
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Dialog\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2004-12-19 20:14-0500\n"
|
||||
"PO-Revision-Date: 2004-03-30 23:00+0100\n"
|
||||
"Last-Translator: Dafydd Harries <daf@muse.19inch.net>\n"
|
||||
"Language-Team: Welsh <cy@pengwyn.linux.org.uk>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: buttons.c:359
|
||||
msgid "Yes"
|
||||
msgstr "Ie"
|
||||
|
||||
#: buttons.c:367
|
||||
msgid "No"
|
||||
msgstr "Na"
|
||||
|
||||
#: buttons.c:375
|
||||
msgid "OK"
|
||||
msgstr "Iawn"
|
||||
|
||||
#: buttons.c:383
|
||||
msgid "Cancel"
|
||||
msgstr "Diddymu"
|
||||
|
||||
#: buttons.c:391
|
||||
msgid "EXIT"
|
||||
msgstr "GADAEL"
|
||||
|
||||
#: buttons.c:399
|
||||
msgid "Extra"
|
||||
msgstr "Ychwanegol"
|
||||
|
||||
#: buttons.c:407
|
||||
msgid "Help"
|
||||
msgstr "Cymorth"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:299
|
||||
msgid "Month"
|
||||
msgstr "Mis"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:319
|
||||
msgid "Year"
|
||||
msgstr "Blwyddyn"
|
||||
|
||||
#: dialog.c:672
|
||||
msgid "Rename"
|
||||
msgstr "Ailenwy"
|
||||
|
||||
#: fselect.c:426
|
||||
msgid "Directories"
|
||||
msgstr "Cyfeiriaduron"
|
||||
|
||||
#: fselect.c:427
|
||||
msgid "Files"
|
||||
msgstr "Ffeiliau"
|
||||
|
||||
#: textbox.c:437
|
||||
#, fuzzy
|
||||
msgid "Search"
|
||||
msgstr "Search"
|
||||
68
extra/dialog-1.0-20050306/po/da.po
Normal file
68
extra/dialog-1.0-20050306/po/da.po
Normal file
@@ -0,0 +1,68 @@
|
||||
# Dialog
|
||||
# Copyright 2001, # Thomas Dickey
|
||||
# Morten Brix Pedersen <morten@wtf.dk>, 2001-2005.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Dialog\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2004-12-19 20:14-0500\n"
|
||||
"PO-Revision-Date: 2005-01-07 21:02+0200\n"
|
||||
"Last-Translator: Morten Brix Pedersen <morten@wtf.dk>\n"
|
||||
"Language-Team: Danish <dansk@klid.dk>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8-bit\n"
|
||||
|
||||
#: buttons.c:359
|
||||
msgid "Yes"
|
||||
msgstr "Ja"
|
||||
|
||||
#: buttons.c:367
|
||||
msgid "No"
|
||||
msgstr "Nej"
|
||||
|
||||
#: buttons.c:375
|
||||
msgid "OK"
|
||||
msgstr "O.K."
|
||||
|
||||
#: buttons.c:383
|
||||
msgid "Cancel"
|
||||
msgstr "Anullér"
|
||||
|
||||
#: buttons.c:391
|
||||
msgid "EXIT"
|
||||
msgstr "AFSLUT"
|
||||
|
||||
#: buttons.c:399
|
||||
msgid "Extra"
|
||||
msgstr "Ekstra"
|
||||
|
||||
#: buttons.c:407
|
||||
msgid "Help"
|
||||
msgstr "Hjælp"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:299
|
||||
msgid "Month"
|
||||
msgstr "Måned"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:319
|
||||
msgid "Year"
|
||||
msgstr "År"
|
||||
|
||||
#: dialog.c:672
|
||||
msgid "Rename"
|
||||
msgstr "Omdøb"
|
||||
|
||||
#: fselect.c:426
|
||||
msgid "Directories"
|
||||
msgstr "Mapper"
|
||||
|
||||
#: fselect.c:427
|
||||
msgid "Files"
|
||||
msgstr "Filer"
|
||||
|
||||
#: textbox.c:437
|
||||
msgid "Search"
|
||||
msgstr "Søg"
|
||||
70
extra/dialog-1.0-20050306/po/de.po
Normal file
70
extra/dialog-1.0-20050306/po/de.po
Normal file
@@ -0,0 +1,70 @@
|
||||
# Dialog
|
||||
# Copyright 2001, # Thomas Dickey
|
||||
#
|
||||
# Michael Piefel <piefel@informatik.hu-berlin.de>, 2002.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Dialog\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2004-12-19 20:14-0500\n"
|
||||
"PO-Revision-Date: 2002-05-09 17:56+0200\n"
|
||||
"Last-Translator: Michael Piefel <piefel@informatik.hu-berlin.de>\n"
|
||||
"Language-Team: German <de@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=ISO-8859-15\n"
|
||||
"Content-Transfer-Encoding: 8-bit\n"
|
||||
|
||||
#: buttons.c:359
|
||||
msgid "Yes"
|
||||
msgstr "Ja"
|
||||
|
||||
#: buttons.c:367
|
||||
msgid "No"
|
||||
msgstr "Nein"
|
||||
|
||||
#: buttons.c:375
|
||||
msgid "OK"
|
||||
msgstr "OK"
|
||||
|
||||
#: buttons.c:383
|
||||
msgid "Cancel"
|
||||
msgstr "Abbrechen"
|
||||
|
||||
#: buttons.c:391
|
||||
msgid "EXIT"
|
||||
msgstr "VERLASSEN"
|
||||
|
||||
#: buttons.c:399
|
||||
msgid "Extra"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:407
|
||||
msgid "Help"
|
||||
msgstr "Hilfe"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:299
|
||||
msgid "Month"
|
||||
msgstr "Monat"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:319
|
||||
msgid "Year"
|
||||
msgstr "Jahr"
|
||||
|
||||
#: dialog.c:672
|
||||
msgid "Rename"
|
||||
msgstr "Bearbeiten"
|
||||
|
||||
#: fselect.c:426
|
||||
msgid "Directories"
|
||||
msgstr "Verzeichnisse"
|
||||
|
||||
#: fselect.c:427
|
||||
msgid "Files"
|
||||
msgstr "Dateien"
|
||||
|
||||
#: textbox.c:437
|
||||
#, fuzzy
|
||||
msgid "Search"
|
||||
msgstr "Suche"
|
||||
69
extra/dialog-1.0-20050306/po/dialog.pot
Normal file
69
extra/dialog-1.0-20050306/po/dialog.pot
Normal file
@@ -0,0 +1,69 @@
|
||||
# Dialog
|
||||
# Copyright 2003,2004 # Thomas Dickey
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Dialog\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2004-12-19 20:14-0500\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=CHARSET\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: buttons.c:359
|
||||
msgid "Yes"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:367
|
||||
msgid "No"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:375
|
||||
msgid "OK"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:383
|
||||
msgid "Cancel"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:391
|
||||
msgid "EXIT"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:399
|
||||
msgid "Extra"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:407
|
||||
msgid "Help"
|
||||
msgstr ""
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:299
|
||||
msgid "Month"
|
||||
msgstr ""
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:319
|
||||
msgid "Year"
|
||||
msgstr ""
|
||||
|
||||
#: dialog.c:672
|
||||
msgid "Rename"
|
||||
msgstr ""
|
||||
|
||||
#: fselect.c:426
|
||||
msgid "Directories"
|
||||
msgstr ""
|
||||
|
||||
#: fselect.c:427
|
||||
msgid "Files"
|
||||
msgstr ""
|
||||
|
||||
#: textbox.c:437
|
||||
msgid "Search"
|
||||
msgstr ""
|
||||
66
extra/dialog-1.0-20050306/po/el.po
Normal file
66
extra/dialog-1.0-20050306/po/el.po
Normal file
@@ -0,0 +1,66 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Dialog\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2004-12-19 20:14-0500\n"
|
||||
"PO-Revision-Date: 2002-06-05 10:00GMT+2\n"
|
||||
"Last-Translator: kromJx <kromJx@crosswinds.net>\n"
|
||||
"Language-Team: <i18ngr@hellug.gr>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=ISO-8859-7\n"
|
||||
"Content-Transfer-Encoding: 8-bit\n"
|
||||
|
||||
#: buttons.c:359
|
||||
msgid "Yes"
|
||||
msgstr "Íáé"
|
||||
|
||||
#: buttons.c:367
|
||||
msgid "No"
|
||||
msgstr "¼÷é"
|
||||
|
||||
#: buttons.c:375
|
||||
msgid "OK"
|
||||
msgstr "OK"
|
||||
|
||||
#: buttons.c:383
|
||||
msgid "Cancel"
|
||||
msgstr "¶êõñï"
|
||||
|
||||
#: buttons.c:391
|
||||
msgid "EXIT"
|
||||
msgstr "¸îïäïò"
|
||||
|
||||
#: buttons.c:399
|
||||
msgid "Extra"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:407
|
||||
msgid "Help"
|
||||
msgstr "ÂïÞèåéá"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:299
|
||||
msgid "Month"
|
||||
msgstr "ÌÞíáò"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:319
|
||||
msgid "Year"
|
||||
msgstr "¸ôïò"
|
||||
|
||||
#: dialog.c:672
|
||||
msgid "Rename"
|
||||
msgstr ""
|
||||
|
||||
#: fselect.c:426
|
||||
msgid "Directories"
|
||||
msgstr "ÖÜêåëïé"
|
||||
|
||||
#: fselect.c:427
|
||||
msgid "Files"
|
||||
msgstr "Áñ÷åßá"
|
||||
|
||||
#: textbox.c:437
|
||||
#, fuzzy
|
||||
msgid "Search"
|
||||
msgstr "Search"
|
||||
69
extra/dialog-1.0-20050306/po/es.po
Normal file
69
extra/dialog-1.0-20050306/po/es.po
Normal file
@@ -0,0 +1,69 @@
|
||||
# Mensajes en español para dialog.
|
||||
# Copyright (C) 2001, 2003, 2004 Thomas Dickey.
|
||||
# Santiago Vila Doncel <sanvila@unex.es>, 2001, 2003, 2004.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog 1.0-20041219\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2004-12-19 20:14-0500\n"
|
||||
"PO-Revision-Date: 2004-12-21 17:06+0100\n"
|
||||
"Last-Translator: Santiago Vila Doncel <sanvila@unex.es>\n"
|
||||
"Language-Team: Spanish <es@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=ISO-8859-1\n"
|
||||
"Content-Transfer-Encoding: 8-bit\n"
|
||||
|
||||
#: buttons.c:359
|
||||
msgid "Yes"
|
||||
msgstr "Sí"
|
||||
|
||||
#: buttons.c:367
|
||||
msgid "No"
|
||||
msgstr "No"
|
||||
|
||||
#: buttons.c:375
|
||||
msgid "OK"
|
||||
msgstr "Aceptar"
|
||||
|
||||
#: buttons.c:383
|
||||
msgid "Cancel"
|
||||
msgstr "Cancelar"
|
||||
|
||||
#: buttons.c:391
|
||||
msgid "EXIT"
|
||||
msgstr "Salir"
|
||||
|
||||
#: buttons.c:399
|
||||
msgid "Extra"
|
||||
msgstr "Extra"
|
||||
|
||||
#: buttons.c:407
|
||||
msgid "Help"
|
||||
msgstr "Ayuda"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:299
|
||||
msgid "Month"
|
||||
msgstr "Mes"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:319
|
||||
msgid "Year"
|
||||
msgstr "Año"
|
||||
|
||||
#: dialog.c:672
|
||||
msgid "Rename"
|
||||
msgstr "Renombrar"
|
||||
|
||||
#: fselect.c:426
|
||||
msgid "Directories"
|
||||
msgstr "Directorios"
|
||||
|
||||
#: fselect.c:427
|
||||
msgid "Files"
|
||||
msgstr "Ficheros"
|
||||
|
||||
#: textbox.c:437
|
||||
msgid "Search"
|
||||
msgstr "Buscar"
|
||||
69
extra/dialog-1.0-20050306/po/et.po
Normal file
69
extra/dialog-1.0-20050306/po/et.po
Normal file
@@ -0,0 +1,69 @@
|
||||
# Dialog
|
||||
# Copyright 2001, Thomas Dickey
|
||||
# Copyright 2001, Ivar Smolin
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Dialog\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2004-12-19 20:14-0500\n"
|
||||
"PO-Revision-Date: 2001-09-08 00:05+0200\n"
|
||||
"Last-Translator: Ivar Smolin <okul@linux.ee>\n"
|
||||
"Language-Team: Estonian <et@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=ISO-8859-15\n"
|
||||
"Content-Transfer-Encoding: 8-bit\n"
|
||||
|
||||
#: buttons.c:359
|
||||
msgid "Yes"
|
||||
msgstr "Jah"
|
||||
|
||||
#: buttons.c:367
|
||||
msgid "No"
|
||||
msgstr "Ei"
|
||||
|
||||
#: buttons.c:375
|
||||
msgid "OK"
|
||||
msgstr "OK"
|
||||
|
||||
#: buttons.c:383
|
||||
msgid "Cancel"
|
||||
msgstr "Tühista"
|
||||
|
||||
#: buttons.c:391
|
||||
msgid "EXIT"
|
||||
msgstr "Lõpeta"
|
||||
|
||||
#: buttons.c:399
|
||||
msgid "Extra"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:407
|
||||
msgid "Help"
|
||||
msgstr ""
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:299
|
||||
msgid "Month"
|
||||
msgstr "Kuu"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:319
|
||||
msgid "Year"
|
||||
msgstr "Aasta"
|
||||
|
||||
#: dialog.c:672
|
||||
msgid "Rename"
|
||||
msgstr ""
|
||||
|
||||
#: fselect.c:426
|
||||
msgid "Directories"
|
||||
msgstr "Kataloogid"
|
||||
|
||||
#: fselect.c:427
|
||||
msgid "Files"
|
||||
msgstr "Failid"
|
||||
|
||||
#: textbox.c:437
|
||||
#, fuzzy
|
||||
msgid "Search"
|
||||
msgstr "Otsingu"
|
||||
71
extra/dialog-1.0-20050306/po/eu.po
Normal file
71
extra/dialog-1.0-20050306/po/eu.po
Normal file
@@ -0,0 +1,71 @@
|
||||
# Dialog
|
||||
# Copyright 2003,2004 # Thomas Dickey
|
||||
# Piarres Beobide Egaña <pi@beobide.net>, 2004.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Dialog\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2004-12-19 20:14-0500\n"
|
||||
"PO-Revision-Date: 2004-05-04 22:04+0200\n"
|
||||
"Last-Translator: Piarres Beobide Egaña <pi@beobide.net>\n"
|
||||
"Language-Team: Euskara <librezale@librezale.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: KBabel 1.3.1\n"
|
||||
|
||||
#: buttons.c:359
|
||||
msgid "Yes"
|
||||
msgstr "Bai"
|
||||
|
||||
#: buttons.c:367
|
||||
msgid "No"
|
||||
msgstr "Ez"
|
||||
|
||||
#: buttons.c:375
|
||||
msgid "OK"
|
||||
msgstr "Ados"
|
||||
|
||||
#: buttons.c:383
|
||||
msgid "Cancel"
|
||||
msgstr "Utzi"
|
||||
|
||||
#: buttons.c:391
|
||||
msgid "EXIT"
|
||||
msgstr "IRTEN"
|
||||
|
||||
#: buttons.c:399
|
||||
msgid "Extra"
|
||||
msgstr "Gehigarria"
|
||||
|
||||
#: buttons.c:407
|
||||
msgid "Help"
|
||||
msgstr "Laguntza"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:299
|
||||
msgid "Month"
|
||||
msgstr "Hilabetea"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:319
|
||||
msgid "Year"
|
||||
msgstr "Urtea"
|
||||
|
||||
#: dialog.c:672
|
||||
msgid "Rename"
|
||||
msgstr "Izena aldatu"
|
||||
|
||||
#: fselect.c:426
|
||||
msgid "Directories"
|
||||
msgstr "Direktorioak"
|
||||
|
||||
#: fselect.c:427
|
||||
msgid "Files"
|
||||
msgstr "Fitxategiak"
|
||||
|
||||
#: textbox.c:437
|
||||
#, fuzzy
|
||||
msgid "Search"
|
||||
msgstr "Search"
|
||||
70
extra/dialog-1.0-20050306/po/fr.po
Normal file
70
extra/dialog-1.0-20050306/po/fr.po
Normal file
@@ -0,0 +1,70 @@
|
||||
# French translation of Dialog.
|
||||
# Copyright (C) 2001 Thomas Dickey.
|
||||
# Frédéric L. W. Meunier <0 @ pervalidus.net>, 2001.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Dialog 0.9a-20020814\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2004-12-19 20:14-0500\n"
|
||||
"PO-Revision-Date: 2002-09-04 19:12-0300\n"
|
||||
"Last-Translator: Frédéric L. W. Meunier <0 @ pervalidus.net>\n"
|
||||
"Language-Team: French <traduc @ traduc.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=ISO-8859-1\n"
|
||||
"Content-Transfer-Encoding: 8-bit\n"
|
||||
|
||||
#: buttons.c:359
|
||||
msgid "Yes"
|
||||
msgstr "Oui"
|
||||
|
||||
#: buttons.c:367
|
||||
msgid "No"
|
||||
msgstr "Non"
|
||||
|
||||
#: buttons.c:375
|
||||
msgid "OK"
|
||||
msgstr "Accepter"
|
||||
|
||||
#: buttons.c:383
|
||||
msgid "Cancel"
|
||||
msgstr "Annuler"
|
||||
|
||||
#: buttons.c:391
|
||||
msgid "EXIT"
|
||||
msgstr "Sortir"
|
||||
|
||||
#: buttons.c:399
|
||||
msgid "Extra"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:407
|
||||
msgid "Help"
|
||||
msgstr "Aide"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:299
|
||||
msgid "Month"
|
||||
msgstr "Mois"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:319
|
||||
msgid "Year"
|
||||
msgstr "Année"
|
||||
|
||||
#: dialog.c:672
|
||||
msgid "Rename"
|
||||
msgstr ""
|
||||
|
||||
#: fselect.c:426
|
||||
msgid "Directories"
|
||||
msgstr "Répertoires"
|
||||
|
||||
#: fselect.c:427
|
||||
msgid "Files"
|
||||
msgstr "Fichiers"
|
||||
|
||||
#: textbox.c:437
|
||||
#, fuzzy
|
||||
msgid "Search"
|
||||
msgstr "Recherche"
|
||||
68
extra/dialog-1.0-20050306/po/ga.po
Normal file
68
extra/dialog-1.0-20050306/po/ga.po
Normal file
@@ -0,0 +1,68 @@
|
||||
# Dialog
|
||||
# Copyright 2003,2004 # Thomas Dickey
|
||||
# Kevin Patrick Scannell <scannell@SLU.EDU>, 2005.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog 1.0-rel20041222\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2004-12-19 20:14-0500\n"
|
||||
"PO-Revision-Date: 2005-02-07 11:57-0500\n"
|
||||
"Last-Translator: Kevin Patrick Scannell <scannell@SLU.EDU>\n"
|
||||
"Language-Team: Irish <ga@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=ISO-8859-1\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: buttons.c:359
|
||||
msgid "Yes"
|
||||
msgstr "Tá"
|
||||
|
||||
#: buttons.c:367
|
||||
msgid "No"
|
||||
msgstr "Níl"
|
||||
|
||||
#: buttons.c:375
|
||||
msgid "OK"
|
||||
msgstr "OK"
|
||||
|
||||
#: buttons.c:383
|
||||
msgid "Cancel"
|
||||
msgstr "Cealaigh"
|
||||
|
||||
#: buttons.c:391
|
||||
msgid "EXIT"
|
||||
msgstr "SCOIR"
|
||||
|
||||
#: buttons.c:399
|
||||
msgid "Extra"
|
||||
msgstr "Breise"
|
||||
|
||||
#: buttons.c:407
|
||||
msgid "Help"
|
||||
msgstr "Cabhair"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:299
|
||||
msgid "Month"
|
||||
msgstr "Mí"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:319
|
||||
msgid "Year"
|
||||
msgstr "Bliain"
|
||||
|
||||
#: dialog.c:672
|
||||
msgid "Rename"
|
||||
msgstr "Athainmnigh"
|
||||
|
||||
#: fselect.c:426
|
||||
msgid "Directories"
|
||||
msgstr "Comhadlanna"
|
||||
|
||||
#: fselect.c:427
|
||||
msgid "Files"
|
||||
msgstr "Comhaid"
|
||||
|
||||
#: textbox.c:437
|
||||
msgid "Search"
|
||||
msgstr "Cuardaigh"
|
||||
69
extra/dialog-1.0-20050306/po/gl.po
Normal file
69
extra/dialog-1.0-20050306/po/gl.po
Normal file
@@ -0,0 +1,69 @@
|
||||
# Galician translation of Dialog.
|
||||
# This file is distributed under the same license as the dialog package.
|
||||
# Copyright (C) 2005 Thomas Dickey.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Dialog 1.0-20050116\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2005-01-16 10:51-0500\n"
|
||||
"PO-Revision-Date: 2004-11-20 17:21+0100\n"
|
||||
"Last-Translator: Jacobo Tarrio <jtarrio@trasno.net>\n"
|
||||
"Language-Team: Galician <trasno@ceu.fi.udc.es>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: buttons.c:359
|
||||
msgid "Yes"
|
||||
msgstr "Si"
|
||||
|
||||
#: buttons.c:367
|
||||
msgid "No"
|
||||
msgstr "Non"
|
||||
|
||||
#: buttons.c:375
|
||||
msgid "OK"
|
||||
msgstr "Aceptar"
|
||||
|
||||
#: buttons.c:383
|
||||
msgid "Cancel"
|
||||
msgstr "Cancelar"
|
||||
|
||||
#: buttons.c:391
|
||||
msgid "EXIT"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:399
|
||||
msgid "Extra"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:407
|
||||
msgid "Help"
|
||||
msgstr ""
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:299
|
||||
msgid "Month"
|
||||
msgstr ""
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:319
|
||||
msgid "Year"
|
||||
msgstr ""
|
||||
|
||||
#: dialog.c:672
|
||||
msgid "Rename"
|
||||
msgstr ""
|
||||
|
||||
#: fselect.c:426
|
||||
msgid "Directories"
|
||||
msgstr ""
|
||||
|
||||
#: fselect.c:427
|
||||
msgid "Files"
|
||||
msgstr ""
|
||||
|
||||
#: textbox.c:437
|
||||
msgid "Search"
|
||||
msgstr ""
|
||||
72
extra/dialog-1.0-20050306/po/hi.po
Normal file
72
extra/dialog-1.0-20050306/po/hi.po
Normal file
@@ -0,0 +1,72 @@
|
||||
# Hindi translation of Dialog.
|
||||
# This file is distributed under the same license as the dialog package.
|
||||
# Copyright (C) 2005 Thomas Dickey.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Dialog 1.0-20050116\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2005-01-16 10:51-0500\n"
|
||||
"PO-Revision-Date: 2004-11-21 12:23+0530\n"
|
||||
"Last-Translator: Ravishankar Shrivastava <raviratlami@gmail.com>\n"
|
||||
"Language-Team: Ravishankar Shrivastava <raviratlami@yahoo.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: 2\n"
|
||||
"X-Poedit-Language: Hindi\n"
|
||||
"X-Poedit-Country: INDIA\n"
|
||||
|
||||
#: buttons.c:359
|
||||
msgid "Yes"
|
||||
msgstr "हाàA"
|
||||
|
||||
#: buttons.c:367
|
||||
msgid "No"
|
||||
msgstr "नहà@àB"
|
||||
|
||||
#: buttons.c:375
|
||||
msgid "OK"
|
||||
msgstr "à à@àU"
|
||||
|
||||
#: buttons.c:383
|
||||
msgid "Cancel"
|
||||
msgstr "रदàMद"
|
||||
|
||||
#: buttons.c:391
|
||||
msgid "EXIT"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:399
|
||||
msgid "Extra"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:407
|
||||
msgid "Help"
|
||||
msgstr ""
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:299
|
||||
msgid "Month"
|
||||
msgstr ""
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:319
|
||||
msgid "Year"
|
||||
msgstr ""
|
||||
|
||||
#: dialog.c:672
|
||||
msgid "Rename"
|
||||
msgstr ""
|
||||
|
||||
#: fselect.c:426
|
||||
msgid "Directories"
|
||||
msgstr ""
|
||||
|
||||
#: fselect.c:427
|
||||
msgid "Files"
|
||||
msgstr ""
|
||||
|
||||
#: textbox.c:437
|
||||
msgid "Search"
|
||||
msgstr ""
|
||||
69
extra/dialog-1.0-20050306/po/hr.po
Normal file
69
extra/dialog-1.0-20050306/po/hr.po
Normal file
@@ -0,0 +1,69 @@
|
||||
# Croatian translation of Dialog.
|
||||
# This file is distributed under the same license as the dialog package.
|
||||
# Copyright (C) 2005 Thomas Dickey.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Dialog 1.0-20050116\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2005-01-16 10:51-0500\n"
|
||||
"PO-Revision-Date: 2004-07-25 14:52+0200\n"
|
||||
"Last-Translator: Krunoslav Gernhard <kruno@linux.hr>\n"
|
||||
"Language-Team: Croatian <lokalizacija@linux.hr>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=iso-8859-2\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: buttons.c:359
|
||||
msgid "Yes"
|
||||
msgstr "Da"
|
||||
|
||||
#: buttons.c:367
|
||||
msgid "No"
|
||||
msgstr "Ne"
|
||||
|
||||
#: buttons.c:375
|
||||
msgid "OK"
|
||||
msgstr "U redu"
|
||||
|
||||
#: buttons.c:383
|
||||
msgid "Cancel"
|
||||
msgstr "Otka¾i"
|
||||
|
||||
#: buttons.c:391
|
||||
msgid "EXIT"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:399
|
||||
msgid "Extra"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:407
|
||||
msgid "Help"
|
||||
msgstr ""
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:299
|
||||
msgid "Month"
|
||||
msgstr ""
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:319
|
||||
msgid "Year"
|
||||
msgstr ""
|
||||
|
||||
#: dialog.c:672
|
||||
msgid "Rename"
|
||||
msgstr ""
|
||||
|
||||
#: fselect.c:426
|
||||
msgid "Directories"
|
||||
msgstr ""
|
||||
|
||||
#: fselect.c:427
|
||||
msgid "Files"
|
||||
msgstr ""
|
||||
|
||||
#: textbox.c:437
|
||||
msgid "Search"
|
||||
msgstr ""
|
||||
70
extra/dialog-1.0-20050306/po/hu.po
Normal file
70
extra/dialog-1.0-20050306/po/hu.po
Normal file
@@ -0,0 +1,70 @@
|
||||
# Dialog
|
||||
# Copyright 2003, # Thomas Dickey
|
||||
# Arpad Biro <biro_arpad@yahoo.com>, 2003
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog 1.0-rel20041222\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2004-12-19 20:14-0500\n"
|
||||
"PO-Revision-Date: 2005-02-02 08:21+0100\n"
|
||||
"Last-Translator: Németh Csaba <csaba@sopron.hu>\n"
|
||||
"Language-Team: Hungarian <translation-team-hu@lists.sourceforge.net>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=ISO-8859-2\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: KBabel 1.0.1\n"
|
||||
|
||||
#: buttons.c:359
|
||||
msgid "Yes"
|
||||
msgstr "Igen"
|
||||
|
||||
#: buttons.c:367
|
||||
msgid "No"
|
||||
msgstr "Nem"
|
||||
|
||||
#: buttons.c:375
|
||||
msgid "OK"
|
||||
msgstr "OK"
|
||||
|
||||
#: buttons.c:383
|
||||
msgid "Cancel"
|
||||
msgstr "Mégsem"
|
||||
|
||||
#: buttons.c:391
|
||||
msgid "EXIT"
|
||||
msgstr "KILÉPÉS"
|
||||
|
||||
#: buttons.c:399
|
||||
msgid "Extra"
|
||||
msgstr "Extra"
|
||||
|
||||
#: buttons.c:407
|
||||
msgid "Help"
|
||||
msgstr "Súgó"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:299
|
||||
msgid "Month"
|
||||
msgstr "Hónap"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:319
|
||||
msgid "Year"
|
||||
msgstr "Év"
|
||||
|
||||
#: dialog.c:672
|
||||
msgid "Rename"
|
||||
msgstr "Átnevezés"
|
||||
|
||||
#: fselect.c:426
|
||||
msgid "Directories"
|
||||
msgstr "Könyvtárak"
|
||||
|
||||
#: fselect.c:427
|
||||
msgid "Files"
|
||||
msgstr "Fájlok"
|
||||
|
||||
#: textbox.c:437
|
||||
msgid "Search"
|
||||
msgstr "Keresés"
|
||||
71
extra/dialog-1.0-20050306/po/it.po
Normal file
71
extra/dialog-1.0-20050306/po/it.po
Normal file
@@ -0,0 +1,71 @@
|
||||
# Italian messages for dialog.
|
||||
# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
|
||||
# This file is distributed under the same license as the dialog package.
|
||||
# Marco Colombo <m.colombo@ed.ac.uk>, 2005.
|
||||
# Marco Mariani <marcom@sferacarta.com>, 2004.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog 1.0-rel20041222\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2004-12-19 20:14-0500\n"
|
||||
"PO-Revision-Date: 2005-02-09 17:23+0000\n"
|
||||
"Last-Translator: Marco Colombo <m.colombo@ed.ac.uk>\n"
|
||||
"Language-Team: Italian <tp@lists.linux.it>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8-bit\n"
|
||||
|
||||
#: buttons.c:359
|
||||
msgid "Yes"
|
||||
msgstr "Sì"
|
||||
|
||||
#: buttons.c:367
|
||||
msgid "No"
|
||||
msgstr "No"
|
||||
|
||||
#: buttons.c:375
|
||||
msgid "OK"
|
||||
msgstr "OK"
|
||||
|
||||
#: buttons.c:383
|
||||
msgid "Cancel"
|
||||
msgstr "Annulla"
|
||||
|
||||
#: buttons.c:391
|
||||
msgid "EXIT"
|
||||
msgstr "Esci"
|
||||
|
||||
#: buttons.c:399
|
||||
msgid "Extra"
|
||||
msgstr "Extra"
|
||||
|
||||
#: buttons.c:407
|
||||
msgid "Help"
|
||||
msgstr "Aiuto"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:299
|
||||
msgid "Month"
|
||||
msgstr "Mese"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:319
|
||||
msgid "Year"
|
||||
msgstr "Anno"
|
||||
|
||||
#: dialog.c:672
|
||||
msgid "Rename"
|
||||
msgstr "Rinomina"
|
||||
|
||||
#: fselect.c:426
|
||||
msgid "Directories"
|
||||
msgstr "Cartelle"
|
||||
|
||||
#: fselect.c:427
|
||||
msgid "Files"
|
||||
msgstr "File"
|
||||
|
||||
#: textbox.c:437
|
||||
msgid "Search"
|
||||
msgstr "Ricerca"
|
||||
69
extra/dialog-1.0-20050306/po/ja.po
Normal file
69
extra/dialog-1.0-20050306/po/ja.po
Normal file
@@ -0,0 +1,69 @@
|
||||
# dialog Japanese po file.
|
||||
# Copyright 2000, Thomas Dickey
|
||||
# Hirofumi Takeda <takepin@turbolinux.co.jp>, 2000.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog 0.9a\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2004-12-19 20:14-0500\n"
|
||||
"PO-Revision-Date: 2000-10-06 18:02+09:00\n"
|
||||
"Last-Translator: Hirofumi Takeda <takepin@turbolinux.co.jp>\n"
|
||||
"Language-Team: Japanese <ja@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=EUC-JP\n"
|
||||
"Content-Transfer-Encoding: 8-bit\n"
|
||||
|
||||
#: buttons.c:359
|
||||
msgid "Yes"
|
||||
msgstr "はい"
|
||||
|
||||
#: buttons.c:367
|
||||
msgid "No"
|
||||
msgstr "いいえ"
|
||||
|
||||
#: buttons.c:375
|
||||
msgid "OK"
|
||||
msgstr "了解"
|
||||
|
||||
#: buttons.c:383
|
||||
msgid "Cancel"
|
||||
msgstr "取消"
|
||||
|
||||
#: buttons.c:391
|
||||
msgid "EXIT"
|
||||
msgstr "終了"
|
||||
|
||||
#: buttons.c:399
|
||||
msgid "Extra"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:407
|
||||
msgid "Help"
|
||||
msgstr "ヘルプ"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:299
|
||||
msgid "Month"
|
||||
msgstr ""
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:319
|
||||
msgid "Year"
|
||||
msgstr ""
|
||||
|
||||
#: dialog.c:672
|
||||
msgid "Rename"
|
||||
msgstr ""
|
||||
|
||||
#: fselect.c:426
|
||||
msgid "Directories"
|
||||
msgstr ""
|
||||
|
||||
#: fselect.c:427
|
||||
msgid "Files"
|
||||
msgstr ""
|
||||
|
||||
#: textbox.c:437
|
||||
msgid "Search"
|
||||
msgstr "調査"
|
||||
250
extra/dialog-1.0-20050306/po/makefile.inn
Normal file
250
extra/dialog-1.0-20050306/po/makefile.inn
Normal file
@@ -0,0 +1,250 @@
|
||||
# Makefile for program source directory in GNU NLS utilities package.
|
||||
# Copyright (C) 1995, 1996, 1997 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
|
||||
#
|
||||
# This file may be copied and used freely without restrictions. It can
|
||||
# be used in projects which are not available under the GNU Public License
|
||||
# but which still want to provide support for the GNU gettext functionality.
|
||||
# Please note that the actual code is *not* freely available.
|
||||
|
||||
PACKAGE = @PACKAGE@
|
||||
VERSION = @VERSION@
|
||||
|
||||
SHELL = /bin/sh
|
||||
@SET_MAKE@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
datadir = $(prefix)/@DATADIRNAME@
|
||||
localedir = $(datadir)/locale
|
||||
gnulocaledir = $(prefix)/share/locale
|
||||
gettextsrcdir = $(prefix)/share/gettext/po
|
||||
subdir = po
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
DESTDIR = @DESTDIR@
|
||||
|
||||
CC = @CC@
|
||||
GENCAT = @GENCAT@
|
||||
GMSGFMT = PATH=../src:$$PATH @GMSGFMT@
|
||||
MSGFMT = @MSGFMT@
|
||||
XGETTEXT = PATH=../src:$$PATH @XGETTEXT@
|
||||
MSGMERGE = PATH=../src:$$PATH msgmerge
|
||||
|
||||
DEFS = @DEFS@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
|
||||
INCLUDES = -I.. -I$(top_srcdir)/intl
|
||||
|
||||
COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
|
||||
|
||||
SOURCES = cat-id-tbl.c
|
||||
POFILES = @POFILES@
|
||||
GMOFILES = @GMOFILES@
|
||||
DISTFILES = ChangeLog makefile.inn POTFILES.in $(PACKAGE).pot \
|
||||
stamp-cat-id $(POFILES) $(GMOFILES) $(SOURCES)
|
||||
|
||||
POTFILES = \
|
||||
|
||||
CATALOGS = @CATALOGS@
|
||||
CATOBJEXT = @CATOBJEXT@
|
||||
INSTOBJEXT = @INSTOBJEXT@
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat
|
||||
|
||||
.c.o:
|
||||
$(COMPILE) $<
|
||||
|
||||
.po.pox:
|
||||
$(MAKE) $(PACKAGE).pot
|
||||
$(MSGMERGE) $< $(srcdir)/$(PACKAGE).pot -o $*.pox
|
||||
|
||||
.po.mo:
|
||||
$(MSGFMT) -o $@ $<
|
||||
|
||||
.po.gmo:
|
||||
file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \
|
||||
&& rm -f $$file && $(GMSGFMT) -o $$file $<
|
||||
|
||||
.po.cat:
|
||||
sed -f ../intl/po2msg.sed < $< > $*.msg \
|
||||
&& rm -f $@ && $(GENCAT) $@ $*.msg
|
||||
|
||||
|
||||
all: all-@USE_NLS@
|
||||
|
||||
all-yes: $(SOURCES) $(CATALOGS)
|
||||
all-no:
|
||||
|
||||
$(srcdir)/$(PACKAGE).pot: $(POTFILES)
|
||||
$(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \
|
||||
--add-comments --keyword=_ --keyword=N_ \
|
||||
--files-from=$(srcdir)/POTFILES.in \
|
||||
&& test ! -f $(PACKAGE).po \
|
||||
|| ( rm -f $(srcdir)/$(PACKAGE).pot \
|
||||
&& mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot )
|
||||
|
||||
$(srcdir)/cat-id-tbl.c: stamp-cat-id; @:
|
||||
$(srcdir)/stamp-cat-id: $(PACKAGE).pot
|
||||
rm -f cat-id-tbl.tmp
|
||||
sed -f ../intl/po2tbl.sed $(srcdir)/$(PACKAGE).pot \
|
||||
| sed -e "s/@PACKAGE NAME@/$(PACKAGE)/" > cat-id-tbl.tmp
|
||||
if cmp -s cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; then \
|
||||
rm cat-id-tbl.tmp; \
|
||||
else \
|
||||
echo cat-id-tbl.c changed; \
|
||||
rm -f $(srcdir)/cat-id-tbl.c; \
|
||||
mv cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; \
|
||||
fi
|
||||
cd $(srcdir) && rm -f stamp-cat-id && echo timestamp > stamp-cat-id
|
||||
|
||||
|
||||
install: install-exec install-data
|
||||
install-exec:
|
||||
install-data: install-data-@USE_NLS@
|
||||
install-data-no: all
|
||||
install-data-yes: all
|
||||
if test -r "$(MKINSTALLDIRS)"; then \
|
||||
$(MKINSTALLDIRS) $(DESTDIR)$(datadir); \
|
||||
else \
|
||||
$(SHELL) $(top_srcdir)/mkdirs.sh $(DESTDIR)$(datadir); \
|
||||
fi
|
||||
@catalogs='$(CATALOGS)'; \
|
||||
for cat in $$catalogs; do \
|
||||
cat=`basename $$cat`; \
|
||||
case "$$cat" in \
|
||||
*.gmo) destdir=$(gnulocaledir);; \
|
||||
*) destdir=$(localedir);; \
|
||||
esac; \
|
||||
lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
|
||||
dir=$(DESTDIR)$$destdir/$$lang/LC_MESSAGES; \
|
||||
if test -r "$(MKINSTALLDIRS)"; then \
|
||||
$(MKINSTALLDIRS) $$dir; \
|
||||
else \
|
||||
$(SHELL) $(top_srcdir)/mkdirs.sh $$dir; \
|
||||
fi; \
|
||||
if test -r $$cat; then \
|
||||
$(INSTALL_DATA) $$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
|
||||
echo "installing $$cat as $$dir/$(PACKAGE)$(INSTOBJEXT)"; \
|
||||
else \
|
||||
$(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
|
||||
echo "installing $(srcdir)/$$cat as" \
|
||||
"$$dir/$(PACKAGE)$(INSTOBJEXT)"; \
|
||||
fi; \
|
||||
if test -r $$cat.m; then \
|
||||
$(INSTALL_DATA) $$cat.m $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
|
||||
echo "installing $$cat.m as $$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
|
||||
else \
|
||||
if test -r $(srcdir)/$$cat.m ; then \
|
||||
$(INSTALL_DATA) $(srcdir)/$$cat.m \
|
||||
$$dir/$(PACKAGE)$(INSTOBJEXT).m; \
|
||||
echo "installing $(srcdir)/$$cat as" \
|
||||
"$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
|
||||
else \
|
||||
true; \
|
||||
fi; \
|
||||
fi; \
|
||||
done
|
||||
if test "$(PACKAGE)" = "gettext"; then \
|
||||
if test -r "$(MKINSTALLDIRS)"; then \
|
||||
$(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \
|
||||
else \
|
||||
$(SHELL) $(top_srcdir)/mkdirs.sh $(DESTDIR)$(gettextsrcdir); \
|
||||
fi; \
|
||||
$(INSTALL_DATA) $(srcdir)/makefile.inn \
|
||||
$(DESTDIR)$(gettextsrcdir)/makefile.inn; \
|
||||
else \
|
||||
: ; \
|
||||
fi
|
||||
|
||||
# Define this as empty until I find a useful application.
|
||||
installcheck:
|
||||
|
||||
uninstall:
|
||||
catalogs='$(CATALOGS)'; \
|
||||
for cat in $$catalogs; do \
|
||||
cat=`basename $$cat`; \
|
||||
lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
|
||||
rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
|
||||
rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
|
||||
rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
|
||||
rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
|
||||
done
|
||||
rm -f $(gettextsrcdir)/po-makefile.inn
|
||||
|
||||
check: all
|
||||
|
||||
cat-id-tbl.o: ../intl/libgettext.h
|
||||
|
||||
dvi info tags TAGS ID:
|
||||
|
||||
mostlyclean:
|
||||
rm -f core core.* *.pox $(PACKAGE).po *.old.po cat-id-tbl.tmp
|
||||
rm -fr *.o
|
||||
|
||||
clean: mostlyclean
|
||||
|
||||
distclean: clean
|
||||
rm -f cat-id-tbl.c stamp-cat-id *.gmo
|
||||
rm -f makefile makefile.in POTFILES *.mo *.msg *.cat *.cat.m
|
||||
|
||||
maintainer-clean: distclean
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
rm -f $(GMOFILES)
|
||||
|
||||
distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
dist distdir: update-po $(DISTFILES)
|
||||
dists="$(DISTFILES)"; \
|
||||
for file in $$dists; do \
|
||||
ln $(srcdir)/$$file $(distdir) 2> /dev/null \
|
||||
|| cp -p $(srcdir)/$$file $(distdir); \
|
||||
done
|
||||
|
||||
update-po: makefile
|
||||
$(MAKE) $(PACKAGE).pot
|
||||
PATH=`pwd`/../src:$$PATH; \
|
||||
cd $(srcdir); \
|
||||
catalogs='$(CATALOGS)'; \
|
||||
for cat in $$catalogs; do \
|
||||
cat=`basename $$cat`; \
|
||||
lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
|
||||
mv $$lang.po $$lang.old.po; \
|
||||
echo "$$lang:"; \
|
||||
if $(MSGMERGE) $$lang.old.po $(PACKAGE).pot -o $$lang.po; then \
|
||||
rm -f $$lang.old.po; \
|
||||
else \
|
||||
echo "msgmerge for $$cat failed!"; \
|
||||
rm -f $$lang.po; \
|
||||
mv $$lang.old.po $$lang.po; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
POTFILES: POTFILES.in
|
||||
( if test 'x$(srcdir)' != 'x.'; then \
|
||||
posrcprefix='$(top_srcdir)/'; \
|
||||
else \
|
||||
posrcprefix="../"; \
|
||||
fi; \
|
||||
rm -f $@-t $@ \
|
||||
&& (sed -e '/^#/d' -e '/^[ ]*$$/d' \
|
||||
-e "s@.*@ $$posrcprefix& \\\\@" < $(srcdir)/$@.in \
|
||||
| sed -e '$$s/\\$$//') > $@-t \
|
||||
&& chmod a-w $@-t \
|
||||
&& mv $@-t $@ )
|
||||
|
||||
makefile: makefile.inn ../config.status POTFILES
|
||||
cd .. \
|
||||
&& CONFIG_FILES=$(subdir)/$@.in:$(subdir)/$@.inn CONFIG_HEADERS= \
|
||||
$(SHELL) ./config.status
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make not to export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
70
extra/dialog-1.0-20050306/po/mg.po
Normal file
70
extra/dialog-1.0-20050306/po/mg.po
Normal file
@@ -0,0 +1,70 @@
|
||||
# Malagasy translation of Dialog.
|
||||
# This file is distributed under the same license as the dialog package.
|
||||
# Copyright (C) 2005 Thomas Dickey.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Dialog 1.0-20050116\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2005-01-16 10:51-0500\n"
|
||||
"PO-Revision-Date: 2004-11-21 17:33+0100\n"
|
||||
"Last-Translator: Jaonary Rabarisoa <jaonary@ifrance.fr>\n"
|
||||
"Language-Team: <en@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: KBabel 1.9.1\n"
|
||||
|
||||
#: buttons.c:359
|
||||
msgid "Yes"
|
||||
msgstr "Eny"
|
||||
|
||||
#: buttons.c:367
|
||||
msgid "No"
|
||||
msgstr "Tsia"
|
||||
|
||||
#: buttons.c:375
|
||||
msgid "OK"
|
||||
msgstr "Ekena"
|
||||
|
||||
#: buttons.c:383
|
||||
msgid "Cancel"
|
||||
msgstr "Ajanony"
|
||||
|
||||
#: buttons.c:391
|
||||
msgid "EXIT"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:399
|
||||
msgid "Extra"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:407
|
||||
msgid "Help"
|
||||
msgstr ""
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:299
|
||||
msgid "Month"
|
||||
msgstr ""
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:319
|
||||
msgid "Year"
|
||||
msgstr ""
|
||||
|
||||
#: dialog.c:672
|
||||
msgid "Rename"
|
||||
msgstr ""
|
||||
|
||||
#: fselect.c:426
|
||||
msgid "Directories"
|
||||
msgstr ""
|
||||
|
||||
#: fselect.c:427
|
||||
msgid "Files"
|
||||
msgstr ""
|
||||
|
||||
#: textbox.c:437
|
||||
msgid "Search"
|
||||
msgstr ""
|
||||
71
extra/dialog-1.0-20050306/po/mk.po
Normal file
71
extra/dialog-1.0-20050306/po/mk.po
Normal file
@@ -0,0 +1,71 @@
|
||||
# Macedonian translation of Dialog.
|
||||
# This file is distributed under the same license as the dialog package.
|
||||
# Copyright (C) 2005 Thomas Dickey.
|
||||
# Georgi Stanojevski <glisha@gmail.com>, 2004.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Dialog 1.0-20050116\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2005-01-16 10:51-0500\n"
|
||||
"PO-Revision-Date: 2004-10-10 00:18+0200\n"
|
||||
"Last-Translator: Georgi Stanojevski <glisha@gmail.com>\n"
|
||||
"Language-Team: <ossm-members@hedona.on.net.mk>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: KBabel 1.3.1\n"
|
||||
|
||||
#: buttons.c:359
|
||||
msgid "Yes"
|
||||
msgstr "Да"
|
||||
|
||||
#: buttons.c:367
|
||||
msgid "No"
|
||||
msgstr "Не"
|
||||
|
||||
#: buttons.c:375
|
||||
msgid "OK"
|
||||
msgstr "Во ред"
|
||||
|
||||
#: buttons.c:383
|
||||
msgid "Cancel"
|
||||
msgstr "Откажи"
|
||||
|
||||
#: buttons.c:391
|
||||
msgid "EXIT"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:399
|
||||
msgid "Extra"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:407
|
||||
msgid "Help"
|
||||
msgstr ""
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:299
|
||||
msgid "Month"
|
||||
msgstr ""
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:319
|
||||
msgid "Year"
|
||||
msgstr ""
|
||||
|
||||
#: dialog.c:672
|
||||
msgid "Rename"
|
||||
msgstr ""
|
||||
|
||||
#: fselect.c:426
|
||||
msgid "Directories"
|
||||
msgstr ""
|
||||
|
||||
#: fselect.c:427
|
||||
msgid "Files"
|
||||
msgstr ""
|
||||
|
||||
#: textbox.c:437
|
||||
msgid "Search"
|
||||
msgstr ""
|
||||
72
extra/dialog-1.0-20050306/po/nl.po
Normal file
72
extra/dialog-1.0-20050306/po/nl.po
Normal file
@@ -0,0 +1,72 @@
|
||||
# Dutch translation of Dialog.
|
||||
# This file is distributed under the same license as the dialog package.
|
||||
# Copyright 2004, # Jacques Weewer
|
||||
#
|
||||
# Jacques Weewer <j.weewer_at_chello.nl>, 2004.
|
||||
# Luk Claes <luk.claes@ugent.be>, 2005.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog 1.0-rel20041222\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2004-12-19 20:14-0500\n"
|
||||
"PO-Revision-Date: 2005-01-24 20:08+0100\n"
|
||||
"Last-Translator: Luk Claes <luk.claes@ugent.be>\n"
|
||||
"Language-Team: Dutch <vertaling@vrijschrift.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: buttons.c:359
|
||||
msgid "Yes"
|
||||
msgstr "Ja"
|
||||
|
||||
#: buttons.c:367
|
||||
msgid "No"
|
||||
msgstr "Nee"
|
||||
|
||||
#: buttons.c:375
|
||||
msgid "OK"
|
||||
msgstr "OK"
|
||||
|
||||
#: buttons.c:383
|
||||
msgid "Cancel"
|
||||
msgstr "Afbreken"
|
||||
|
||||
#: buttons.c:391
|
||||
msgid "EXIT"
|
||||
msgstr "Afsluiten"
|
||||
|
||||
#: buttons.c:399
|
||||
msgid "Extra"
|
||||
msgstr "Extra"
|
||||
|
||||
#: buttons.c:407
|
||||
msgid "Help"
|
||||
msgstr "Help"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:299
|
||||
msgid "Month"
|
||||
msgstr "Maand"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:319
|
||||
msgid "Year"
|
||||
msgstr "Jaar"
|
||||
|
||||
#: dialog.c:672
|
||||
msgid "Rename"
|
||||
msgstr "Hernoemen"
|
||||
|
||||
#: fselect.c:426
|
||||
msgid "Directories"
|
||||
msgstr "Mappen"
|
||||
|
||||
#: fselect.c:427
|
||||
msgid "Files"
|
||||
msgstr "Bestanden"
|
||||
|
||||
#: textbox.c:437
|
||||
msgid "Search"
|
||||
msgstr "Zoeken"
|
||||
70
extra/dialog-1.0-20050306/po/pl.po
Normal file
70
extra/dialog-1.0-20050306/po/pl.po
Normal file
@@ -0,0 +1,70 @@
|
||||
# translation of dialog.po to Polish
|
||||
# Jaroslaw Swierczynski <swiergot@intersec.pl>, 2003
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2004-12-19 20:14-0500\n"
|
||||
"PO-Revision-Date: 2003-06-21 17:07+0200\n"
|
||||
"Last-Translator: Jaroslaw Swierczynski <swiergot@intersec.pl>\n"
|
||||
"Language-Team: Polish <po@lists.intersec.pl>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=ISO-8859-2\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: KBabel 1.0.1\n"
|
||||
|
||||
#: buttons.c:359
|
||||
msgid "Yes"
|
||||
msgstr "Tak"
|
||||
|
||||
#: buttons.c:367
|
||||
msgid "No"
|
||||
msgstr "Nie"
|
||||
|
||||
#: buttons.c:375
|
||||
msgid "OK"
|
||||
msgstr "OK"
|
||||
|
||||
#: buttons.c:383
|
||||
msgid "Cancel"
|
||||
msgstr "Anuluj"
|
||||
|
||||
#: buttons.c:391
|
||||
msgid "EXIT"
|
||||
msgstr "WYJD¬"
|
||||
|
||||
#: buttons.c:399
|
||||
msgid "Extra"
|
||||
msgstr "Ekstra"
|
||||
|
||||
#: buttons.c:407
|
||||
msgid "Help"
|
||||
msgstr "Pomoc"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:299
|
||||
msgid "Month"
|
||||
msgstr "Miesi±c"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:319
|
||||
msgid "Year"
|
||||
msgstr "Rok"
|
||||
|
||||
#: dialog.c:672
|
||||
msgid "Rename"
|
||||
msgstr "Zmieñ nazwê"
|
||||
|
||||
#: fselect.c:426
|
||||
msgid "Directories"
|
||||
msgstr "Katalogi"
|
||||
|
||||
#: fselect.c:427
|
||||
msgid "Files"
|
||||
msgstr "Pliki"
|
||||
|
||||
#: textbox.c:437
|
||||
#, fuzzy
|
||||
msgid "Search"
|
||||
msgstr "Search"
|
||||
70
extra/dialog-1.0-20050306/po/pt.po
Normal file
70
extra/dialog-1.0-20050306/po/pt.po
Normal file
@@ -0,0 +1,70 @@
|
||||
# Portuguese translation of Dialog.
|
||||
# Copyright (C) 2001 Thomas Dickey.
|
||||
# Frédéric L. W. Meunier <0 @ pervalidus.net>, 2001.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Dialog 0.9a-20020814\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2004-12-19 20:14-0500\n"
|
||||
"PO-Revision-Date: 2002-09-04 19:12-0300\n"
|
||||
"Last-Translator: Frédéric L. W. Meunier <0 @ pervalidus.net>\n"
|
||||
"Language-Team: Portuguese <pt @ li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=ISO-8859-1\n"
|
||||
"Content-Transfer-Encoding: 8-bit\n"
|
||||
|
||||
#: buttons.c:359
|
||||
msgid "Yes"
|
||||
msgstr "Sim"
|
||||
|
||||
#: buttons.c:367
|
||||
msgid "No"
|
||||
msgstr "Não"
|
||||
|
||||
#: buttons.c:375
|
||||
msgid "OK"
|
||||
msgstr "Aceitar"
|
||||
|
||||
#: buttons.c:383
|
||||
msgid "Cancel"
|
||||
msgstr "Cancelar"
|
||||
|
||||
#: buttons.c:391
|
||||
msgid "EXIT"
|
||||
msgstr "Sair"
|
||||
|
||||
#: buttons.c:399
|
||||
msgid "Extra"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:407
|
||||
msgid "Help"
|
||||
msgstr "Ajuda"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:299
|
||||
msgid "Month"
|
||||
msgstr "Mês"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:319
|
||||
msgid "Year"
|
||||
msgstr "Ano"
|
||||
|
||||
#: dialog.c:672
|
||||
msgid "Rename"
|
||||
msgstr ""
|
||||
|
||||
#: fselect.c:426
|
||||
msgid "Directories"
|
||||
msgstr "Directorias"
|
||||
|
||||
#: fselect.c:427
|
||||
msgid "Files"
|
||||
msgstr "Ficheiros"
|
||||
|
||||
#: textbox.c:437
|
||||
#, fuzzy
|
||||
msgid "Search"
|
||||
msgstr "Busca"
|
||||
70
extra/dialog-1.0-20050306/po/pt_BR.po
Normal file
70
extra/dialog-1.0-20050306/po/pt_BR.po
Normal file
@@ -0,0 +1,70 @@
|
||||
# Brazilian Portuguese translation of Dialog.
|
||||
# Copyright (C) 2001 Thomas Dickey.
|
||||
# Frédéric L. W. Meunier <0 @ pervalidus.net>, 2001.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Dialog 0.9a-20020814\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2004-12-19 20:14-0500\n"
|
||||
"PO-Revision-Date: 2002-09-04 19:12-0300\n"
|
||||
"Last-Translator: Frédéric L. W. Meunier <0 @ pervalidus.net>\n"
|
||||
"Language-Team: Brazilian Portuguese <ldp-br @ bazar.conectiva.com.br>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=ISO-8859-1\n"
|
||||
"Content-Transfer-Encoding: 8-bit\n"
|
||||
|
||||
#: buttons.c:359
|
||||
msgid "Yes"
|
||||
msgstr "Sim"
|
||||
|
||||
#: buttons.c:367
|
||||
msgid "No"
|
||||
msgstr "Não"
|
||||
|
||||
#: buttons.c:375
|
||||
msgid "OK"
|
||||
msgstr "Aceitar"
|
||||
|
||||
#: buttons.c:383
|
||||
msgid "Cancel"
|
||||
msgstr "Cancelar"
|
||||
|
||||
#: buttons.c:391
|
||||
msgid "EXIT"
|
||||
msgstr "Sair"
|
||||
|
||||
#: buttons.c:399
|
||||
msgid "Extra"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:407
|
||||
msgid "Help"
|
||||
msgstr "Ajuda"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:299
|
||||
msgid "Month"
|
||||
msgstr "Mês"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:319
|
||||
msgid "Year"
|
||||
msgstr "Ano"
|
||||
|
||||
#: dialog.c:672
|
||||
msgid "Rename"
|
||||
msgstr ""
|
||||
|
||||
#: fselect.c:426
|
||||
msgid "Directories"
|
||||
msgstr "Diretórios"
|
||||
|
||||
#: fselect.c:427
|
||||
msgid "Files"
|
||||
msgstr "Arquivos"
|
||||
|
||||
#: textbox.c:437
|
||||
#, fuzzy
|
||||
msgid "Search"
|
||||
msgstr "Busca"
|
||||
72
extra/dialog-1.0-20050306/po/rm.po
Normal file
72
extra/dialog-1.0-20050306/po/rm.po
Normal file
@@ -0,0 +1,72 @@
|
||||
# Rumantsch (Rhaeto-Romance) [rm] translation of Dialog.
|
||||
# This file is distributed under the same license as the dialog package.
|
||||
# Copyright (C) 2003-2004,2005 Thomas Dickey.
|
||||
# Florian Verdet _goto <fvgoto@linuxbourg.ch>, 2005.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog 1.0-rel20041222\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2004-12-19 20:14-0500\n"
|
||||
"PO-Revision-Date: 2005-02-06 13:22+0100\n"
|
||||
"Last-Translator: Florian Verdet _goto <fvgoto@linuxbourg.ch>\n"
|
||||
"Language-Team: Rhaeto-Romance <gnu-rumantsch@guglielmtux.ch>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: KBabel 1.2\n"
|
||||
|
||||
#: buttons.c:359
|
||||
msgid "Yes"
|
||||
msgstr "Schi"
|
||||
|
||||
#: buttons.c:367
|
||||
msgid "No"
|
||||
msgstr "Na"
|
||||
|
||||
#: buttons.c:375
|
||||
msgid "OK"
|
||||
msgstr "OK"
|
||||
|
||||
#: buttons.c:383
|
||||
msgid "Cancel"
|
||||
msgstr "Laschar star"
|
||||
|
||||
#: buttons.c:391
|
||||
msgid "EXIT"
|
||||
msgstr "SORTIR"
|
||||
|
||||
#: buttons.c:399
|
||||
msgid "Extra"
|
||||
msgstr "Extra"
|
||||
|
||||
#: buttons.c:407
|
||||
msgid "Help"
|
||||
msgstr "Agüd"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:299
|
||||
msgid "Month"
|
||||
msgstr "Mais"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:319
|
||||
msgid "Year"
|
||||
msgstr "On"
|
||||
|
||||
#: dialog.c:672
|
||||
msgid "Rename"
|
||||
msgstr "Müdar nom"
|
||||
|
||||
#: fselect.c:426
|
||||
#, fuzzy
|
||||
msgid "Directories"
|
||||
msgstr "Registers"
|
||||
|
||||
#: fselect.c:427
|
||||
msgid "Files"
|
||||
msgstr "Datotecas"
|
||||
|
||||
#: textbox.c:437
|
||||
msgid "Search"
|
||||
msgstr "Tscherchar"
|
||||
75
extra/dialog-1.0-20050306/po/ro.po
Normal file
75
extra/dialog-1.0-20050306/po/ro.po
Normal file
@@ -0,0 +1,75 @@
|
||||
# Romanian translation of Dialog.
|
||||
# This file is distributed under the same license as the dialog package.
|
||||
# Copyright (C) 2005 Thomas Dickey.
|
||||
#
|
||||
# Mesajele în limba română pentru dialog.
|
||||
# Acest fişier este distribuit sub aceeaşi licenţă ca şi pachetul dialog.
|
||||
# Laurentiu Buzdugan <lbuz@rolix.org>, 2005.
|
||||
#
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog 1.0-rel20041222\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2004-12-19 20:14-0500\n"
|
||||
"PO-Revision-Date: 2005-01-20 12:00-0500\n"
|
||||
"Last-Translator: Laurentiu Buzdugan <lbuz@rolix.org>\n"
|
||||
"Language-Team: Romanian <translation-team-ro@lists.sourceforge.net>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=ISO-8859-2\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#: buttons.c:359
|
||||
msgid "Yes"
|
||||
msgstr "Da"
|
||||
|
||||
#: buttons.c:367
|
||||
msgid "No"
|
||||
msgstr "Nu"
|
||||
|
||||
#: buttons.c:375
|
||||
msgid "OK"
|
||||
msgstr "OK"
|
||||
|
||||
#: buttons.c:383
|
||||
msgid "Cancel"
|
||||
msgstr "Renunţă"
|
||||
|
||||
#: buttons.c:391
|
||||
msgid "EXIT"
|
||||
msgstr "TERMINĂ"
|
||||
|
||||
#: buttons.c:399
|
||||
msgid "Extra"
|
||||
msgstr "Extra"
|
||||
|
||||
#: buttons.c:407
|
||||
msgid "Help"
|
||||
msgstr "Ajutor"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:299
|
||||
msgid "Month"
|
||||
msgstr "Luna"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:319
|
||||
msgid "Year"
|
||||
msgstr "An"
|
||||
|
||||
#: dialog.c:672
|
||||
msgid "Rename"
|
||||
msgstr "Redenumeşte"
|
||||
|
||||
#: fselect.c:426
|
||||
msgid "Directories"
|
||||
msgstr "Directoare"
|
||||
|
||||
#: fselect.c:427
|
||||
msgid "Files"
|
||||
msgstr "Fişiere"
|
||||
|
||||
#: textbox.c:437
|
||||
msgid "Search"
|
||||
msgstr "Căutare"
|
||||
74
extra/dialog-1.0-20050306/po/ru.po
Normal file
74
extra/dialog-1.0-20050306/po/ru.po
Normal file
@@ -0,0 +1,74 @@
|
||||
# translation of ru.po to Russian
|
||||
# Dialog
|
||||
# Copyright 2003, # Thomas Dickey
|
||||
# Leonid Kanter <leon@asplinux.ru>, 2004.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: ru\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2004-12-19 20:14-0500\n"
|
||||
"PO-Revision-Date: 2004-03-26 11:39+0200\n"
|
||||
"Last-Translator: Leonid Kanter <leon@asplinux.ru>\n"
|
||||
"Language-Team: Russian <ru@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: KBabel 1.3.1\n"
|
||||
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%"
|
||||
"10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
|
||||
|
||||
#: buttons.c:359
|
||||
msgid "Yes"
|
||||
msgstr "Да"
|
||||
|
||||
#: buttons.c:367
|
||||
msgid "No"
|
||||
msgstr "Нет"
|
||||
|
||||
#: buttons.c:375
|
||||
msgid "OK"
|
||||
msgstr "OK"
|
||||
|
||||
#: buttons.c:383
|
||||
msgid "Cancel"
|
||||
msgstr "Отмена"
|
||||
|
||||
#: buttons.c:391
|
||||
msgid "EXIT"
|
||||
msgstr "Выход"
|
||||
|
||||
#: buttons.c:399
|
||||
msgid "Extra"
|
||||
msgstr "Дополнительно"
|
||||
|
||||
#: buttons.c:407
|
||||
msgid "Help"
|
||||
msgstr "Справка"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:299
|
||||
msgid "Month"
|
||||
msgstr "Месяц"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:319
|
||||
msgid "Year"
|
||||
msgstr "Год"
|
||||
|
||||
#: dialog.c:672
|
||||
msgid "Rename"
|
||||
msgstr "Переименовать"
|
||||
|
||||
#: fselect.c:426
|
||||
msgid "Directories"
|
||||
msgstr "Каталоги"
|
||||
|
||||
#: fselect.c:427
|
||||
msgid "Files"
|
||||
msgstr "Файлы"
|
||||
|
||||
#: textbox.c:437
|
||||
#, fuzzy
|
||||
msgid "Search"
|
||||
msgstr "Поиск"
|
||||
70
extra/dialog-1.0-20050306/po/sq.po
Normal file
70
extra/dialog-1.0-20050306/po/sq.po
Normal file
@@ -0,0 +1,70 @@
|
||||
# Albanian translation of Dialog.
|
||||
# This file is distributed under the same license as the dialog package.
|
||||
# Copyright (C) 2005 Thomas Dickey.
|
||||
# Elian Myftiu <elian@lycos.com>, 2004.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Dialog 1.0-20050116\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2005-01-16 10:51-0500\n"
|
||||
"PO-Revision-Date: 2004-11-18 02:28+0100\n"
|
||||
"Last-Translator: Elian Myftiu <elian@lycos.com>\n"
|
||||
"Language-Team: Albanian <gnome-albanian-perkthyesit@lists.sourceforge.net>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: buttons.c:359
|
||||
msgid "Yes"
|
||||
msgstr "Po"
|
||||
|
||||
#: buttons.c:367
|
||||
msgid "No"
|
||||
msgstr "Jo"
|
||||
|
||||
#: buttons.c:375
|
||||
msgid "OK"
|
||||
msgstr "mirë"
|
||||
|
||||
#: buttons.c:383
|
||||
msgid "Cancel"
|
||||
msgstr "Anullo"
|
||||
|
||||
#: buttons.c:391
|
||||
msgid "EXIT"
|
||||
msgstr "Dal"
|
||||
|
||||
#: buttons.c:399
|
||||
msgid "Extra"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:407
|
||||
msgid "Help"
|
||||
msgstr ""
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:299
|
||||
msgid "Month"
|
||||
msgstr ""
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:319
|
||||
msgid "Year"
|
||||
msgstr ""
|
||||
|
||||
#: dialog.c:672
|
||||
msgid "Rename"
|
||||
msgstr ""
|
||||
|
||||
#: fselect.c:426
|
||||
msgid "Directories"
|
||||
msgstr ""
|
||||
|
||||
#: fselect.c:427
|
||||
msgid "Files"
|
||||
msgstr ""
|
||||
|
||||
#: textbox.c:437
|
||||
msgid "Search"
|
||||
msgstr ""
|
||||
72
extra/dialog-1.0-20050306/po/uk.po
Normal file
72
extra/dialog-1.0-20050306/po/uk.po
Normal file
@@ -0,0 +1,72 @@
|
||||
# translation of uk.po to Ukrainian
|
||||
# Dialog
|
||||
# Copyright 2003, # Thomas Dickey
|
||||
# Eugeniy Meshcheryakov <eugen@univ.kiev.ua>, 2004.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: uk\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2004-12-19 20:14-0500\n"
|
||||
"PO-Revision-Date: 2004-02-12 20:17+0200\n"
|
||||
"Last-Translator: Eugeniy Meshcheryakov <eugen@univ.kiev.ua>\n"
|
||||
"Language-Team: Ukrainian\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: KBabel 1.0.2\n"
|
||||
|
||||
#: buttons.c:359
|
||||
msgid "Yes"
|
||||
msgstr "Так"
|
||||
|
||||
#: buttons.c:367
|
||||
msgid "No"
|
||||
msgstr "Ні"
|
||||
|
||||
#: buttons.c:375
|
||||
msgid "OK"
|
||||
msgstr "Гаразд"
|
||||
|
||||
#: buttons.c:383
|
||||
msgid "Cancel"
|
||||
msgstr "Скасувати"
|
||||
|
||||
#: buttons.c:391
|
||||
msgid "EXIT"
|
||||
msgstr "ВИЙТИ"
|
||||
|
||||
#: buttons.c:399
|
||||
msgid "Extra"
|
||||
msgstr "Додатково"
|
||||
|
||||
#: buttons.c:407
|
||||
msgid "Help"
|
||||
msgstr "Допомога"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:299
|
||||
msgid "Month"
|
||||
msgstr "Місяць"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:319
|
||||
msgid "Year"
|
||||
msgstr "Рік"
|
||||
|
||||
#: dialog.c:672
|
||||
msgid "Rename"
|
||||
msgstr "Перейменувати"
|
||||
|
||||
#: fselect.c:426
|
||||
msgid "Directories"
|
||||
msgstr "Каталоги"
|
||||
|
||||
#: fselect.c:427
|
||||
msgid "Files"
|
||||
msgstr "Файли"
|
||||
|
||||
#: textbox.c:437
|
||||
#, fuzzy
|
||||
msgid "Search"
|
||||
msgstr "Search"
|
||||
70
extra/dialog-1.0-20050306/po/vi.po
Normal file
70
extra/dialog-1.0-20050306/po/vi.po
Normal file
@@ -0,0 +1,70 @@
|
||||
# Vietnamese Translation for Dialog.
|
||||
# Copyright 2005 Thomas Dickey (msgid)
|
||||
# This file is distributed under the same license as the dialog package.
|
||||
# Clytie Siddall <clytie@riverland.net.au>, 2005.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog 1.0-rel20041222\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2004-12-19 20:14-0500\n"
|
||||
"PO-Revision-Date: 2005-01-21 20:15+0930\n"
|
||||
"Last-Translator: Clytie Siddall <clytie@riverland.net.au>\n"
|
||||
"Language-Team: Vietnamese <gnomevi-list@lists.sourceforge.net> \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: buttons.c:359
|
||||
msgid "Yes"
|
||||
msgstr "Có"
|
||||
|
||||
#: buttons.c:367
|
||||
msgid "No"
|
||||
msgstr "Không"
|
||||
|
||||
#: buttons.c:375
|
||||
msgid "OK"
|
||||
msgstr "Được"
|
||||
|
||||
#: buttons.c:383
|
||||
msgid "Cancel"
|
||||
msgstr "Thôi"
|
||||
|
||||
#: buttons.c:391
|
||||
msgid "EXIT"
|
||||
msgstr "THOÁT"
|
||||
|
||||
#: buttons.c:399
|
||||
msgid "Extra"
|
||||
msgstr "Thêm"
|
||||
|
||||
#: buttons.c:407
|
||||
msgid "Help"
|
||||
msgstr "Trợ giúp"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:299
|
||||
msgid "Month"
|
||||
msgstr "Tháng"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:319
|
||||
msgid "Year"
|
||||
msgstr "Năm"
|
||||
|
||||
#: dialog.c:672
|
||||
msgid "Rename"
|
||||
msgstr "Đổi tên"
|
||||
|
||||
#: fselect.c:426
|
||||
msgid "Directories"
|
||||
msgstr "Thư mục"
|
||||
|
||||
#: fselect.c:427
|
||||
msgid "Files"
|
||||
msgstr "Tập tin"
|
||||
|
||||
#: textbox.c:437
|
||||
msgid "Search"
|
||||
msgstr "Tìm kiếm"
|
||||
70
extra/dialog-1.0-20050306/po/zh_TW.po
Normal file
70
extra/dialog-1.0-20050306/po/zh_TW.po
Normal file
@@ -0,0 +1,70 @@
|
||||
# Traditional Chinese translation of Dialog.
|
||||
# This file is distributed under the same license as the dialog package.
|
||||
# Copyright (C) 2005 Thomas Dickey.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Dialog 1.0-20050116\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2005-01-16 10:51-0500\n"
|
||||
"PO-Revision-Date: 2004-09-21 09:56+0800\n"
|
||||
"Last-Translator: Tetralet <tetralet@pchome.com.tw>\n"
|
||||
"Language-Team: Debian-user in Chinese [Big5] <debian-chinese-big5@lists."
|
||||
"debian.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: buttons.c:359
|
||||
msgid "Yes"
|
||||
msgstr "是"
|
||||
|
||||
#: buttons.c:367
|
||||
msgid "No"
|
||||
msgstr "否"
|
||||
|
||||
#: buttons.c:375
|
||||
msgid "OK"
|
||||
msgstr "確定"
|
||||
|
||||
#: buttons.c:383
|
||||
msgid "Cancel"
|
||||
msgstr "取消"
|
||||
|
||||
#: buttons.c:391
|
||||
msgid "EXIT"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:399
|
||||
msgid "Extra"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:407
|
||||
msgid "Help"
|
||||
msgstr ""
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:299
|
||||
msgid "Month"
|
||||
msgstr ""
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:319
|
||||
msgid "Year"
|
||||
msgstr ""
|
||||
|
||||
#: dialog.c:672
|
||||
msgid "Rename"
|
||||
msgstr ""
|
||||
|
||||
#: fselect.c:426
|
||||
msgid "Directories"
|
||||
msgstr ""
|
||||
|
||||
#: fselect.c:427
|
||||
msgid "Files"
|
||||
msgstr ""
|
||||
|
||||
#: textbox.c:437
|
||||
msgid "Search"
|
||||
msgstr ""
|
||||
498
extra/dialog-1.0-20050306/rc.c
Normal file
498
extra/dialog-1.0-20050306/rc.c
Normal file
@@ -0,0 +1,498 @@
|
||||
/*
|
||||
* $Id: rc.c,v 1.21 2004/09/21 02:14:58 tom Exp $
|
||||
*
|
||||
* rc.c -- routines for processing the configuration file
|
||||
*
|
||||
* AUTHOR: Savio Lam (lam836@cs.cuhk.hk)
|
||||
* and: Thomas E. Dickey
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include "dialog.h"
|
||||
|
||||
#ifdef HAVE_COLOR
|
||||
#include <dlg_colors.h>
|
||||
/*
|
||||
* For matching color names with color values
|
||||
*/
|
||||
static const color_names_st color_names[] =
|
||||
{
|
||||
{"BLACK", COLOR_BLACK},
|
||||
{"RED", COLOR_RED},
|
||||
{"GREEN", COLOR_GREEN},
|
||||
{"YELLOW", COLOR_YELLOW},
|
||||
{"BLUE", COLOR_BLUE},
|
||||
{"MAGENTA", COLOR_MAGENTA},
|
||||
{"CYAN", COLOR_CYAN},
|
||||
{"WHITE", COLOR_WHITE},
|
||||
}; /* color names */
|
||||
|
||||
#define GLOBALRC "/etc/dialogrc"
|
||||
#define DIALOGRC ".dialogrc"
|
||||
|
||||
/* Types of values */
|
||||
#define VAL_INT 0
|
||||
#define VAL_STR 1
|
||||
#define VAL_BOOL 2
|
||||
|
||||
/* Type of line in configuration file */
|
||||
#define LINE_BLANK 2
|
||||
#define LINE_COMMENT 1
|
||||
#define LINE_OK 0
|
||||
#define LINE_ERROR -1
|
||||
|
||||
/* number of configuration variables */
|
||||
#define VAR_COUNT (sizeof(vars) / sizeof(vars_st))
|
||||
|
||||
/* check if character is white space */
|
||||
#define whitespace(c) (c == ' ' || c == '\t')
|
||||
|
||||
/* check if character is string quoting characters */
|
||||
#define isquote(c) (c == '"' || c == '\'')
|
||||
|
||||
/* get last character of string */
|
||||
#define lastch(str) str[strlen(str)-1]
|
||||
|
||||
/*
|
||||
* Configuration variables
|
||||
*/
|
||||
typedef struct {
|
||||
const char *name; /* name of configuration variable as in DIALOGRC */
|
||||
void *var; /* address of actual variable to change */
|
||||
int type; /* type of value */
|
||||
const char *comment; /* comment to put in "rc" file */
|
||||
} vars_st;
|
||||
|
||||
static const vars_st vars[] =
|
||||
{
|
||||
{"use_shadow",
|
||||
&dialog_state.use_shadow,
|
||||
VAL_BOOL,
|
||||
"Shadow dialog boxes? This also turns on color."},
|
||||
|
||||
{"use_colors",
|
||||
&dialog_state.use_colors,
|
||||
VAL_BOOL,
|
||||
"Turn color support ON or OFF"},
|
||||
|
||||
}; /* vars */
|
||||
|
||||
/*
|
||||
* Convert an attribute to a string representation like this:
|
||||
*
|
||||
* "(foreground,background,highlight)"
|
||||
*/
|
||||
static char *
|
||||
attr_to_str(char *str, int fg, int bg, int hl)
|
||||
{
|
||||
int i;
|
||||
|
||||
strcpy(str, "(");
|
||||
/* foreground */
|
||||
for (i = 0; fg != color_names[i].value; i++) ;
|
||||
strcat(str, color_names[i].name);
|
||||
strcat(str, ",");
|
||||
|
||||
/* background */
|
||||
for (i = 0; bg != color_names[i].value; i++) ;
|
||||
strcat(str, color_names[i].name);
|
||||
|
||||
/* highlight */
|
||||
strcat(str, hl ? ",ON)" : ",OFF)");
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
/*
|
||||
* Extract the foreground, background and highlight values from an attribute
|
||||
* represented as a string in this form:
|
||||
*
|
||||
* "(foreground,background,highlight)"
|
||||
*/
|
||||
static int
|
||||
str_to_attr(char *str, int *fg, int *bg, int *hl)
|
||||
{
|
||||
int i = 0, j, get_fg = 1;
|
||||
char tempstr[MAX_LEN + 1], *part;
|
||||
|
||||
if (str[0] != '(' || lastch(str) != ')')
|
||||
return -1; /* invalid representation */
|
||||
|
||||
/* remove the parenthesis */
|
||||
strcpy(tempstr, str + 1);
|
||||
lastch(tempstr) = '\0';
|
||||
|
||||
/* get foreground and background */
|
||||
|
||||
while (1) {
|
||||
/* skip white space before fg/bg string */
|
||||
while (whitespace(tempstr[i]) && tempstr[i] != '\0')
|
||||
i++;
|
||||
if (tempstr[i] == '\0')
|
||||
return -1; /* invalid representation */
|
||||
part = tempstr + i; /* set 'part' to start of fg/bg string */
|
||||
|
||||
/* find end of fg/bg string */
|
||||
while (!whitespace(tempstr[i]) && tempstr[i] != ','
|
||||
&& tempstr[i] != '\0')
|
||||
i++;
|
||||
|
||||
if (tempstr[i] == '\0')
|
||||
return -1; /* invalid representation */
|
||||
else if (whitespace(tempstr[i])) { /* not yet ',' */
|
||||
tempstr[i++] = '\0';
|
||||
|
||||
/* skip white space before ',' */
|
||||
while (whitespace(tempstr[i]) && tempstr[i] != '\0')
|
||||
i++;
|
||||
|
||||
if (tempstr[i] != ',')
|
||||
return -1; /* invalid representation */
|
||||
}
|
||||
tempstr[i++] = '\0'; /* skip the ',' */
|
||||
for (j = 0; j < COLOR_COUNT && dlg_strcmp(part, color_names[j].name);
|
||||
j++) ;
|
||||
if (j == COLOR_COUNT) /* invalid color name */
|
||||
return -1;
|
||||
if (get_fg) {
|
||||
*fg = color_names[j].value;
|
||||
get_fg = 0; /* next we have to get the background */
|
||||
} else {
|
||||
*bg = color_names[j].value;
|
||||
break;
|
||||
}
|
||||
} /* got foreground and background */
|
||||
|
||||
/* get highlight */
|
||||
|
||||
/* skip white space before highlight string */
|
||||
while (whitespace(tempstr[i]) && tempstr[i] != '\0')
|
||||
i++;
|
||||
if (tempstr[i] == '\0')
|
||||
return -1; /* invalid representation */
|
||||
part = tempstr + i; /* set 'part' to start of highlight string */
|
||||
|
||||
/* trim trailing white space from highlight string */
|
||||
i = strlen(part) - 1;
|
||||
while (whitespace(part[i]))
|
||||
i--;
|
||||
part[i + 1] = '\0';
|
||||
|
||||
if (!dlg_strcmp(part, "ON"))
|
||||
*hl = TRUE;
|
||||
else if (!dlg_strcmp(part, "OFF"))
|
||||
*hl = FALSE;
|
||||
else
|
||||
return -1; /* invalid highlight value */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse a line in the configuration file
|
||||
*
|
||||
* Each line is of the form: "variable = value". On exit, 'var' will contain
|
||||
* the variable name, and 'value' will contain the value string.
|
||||
*
|
||||
* Return values:
|
||||
*
|
||||
* LINE_BLANK - line is blank
|
||||
* LINE_COMMENT - line is comment
|
||||
* LINE_OK - line is ok
|
||||
* LINE_ERROR - syntax error in line
|
||||
*/
|
||||
static int
|
||||
parse_line(char *line, char **var, char **value)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
/* ignore white space at beginning of line */
|
||||
while (whitespace(line[i]) && line[i] != '\0')
|
||||
i++;
|
||||
|
||||
if (line[i] == '\0') /* line is blank */
|
||||
return LINE_BLANK;
|
||||
else if (line[i] == '#') /* line is comment */
|
||||
return LINE_COMMENT;
|
||||
else if (line[i] == '=') /* variables names can't start with a '=' */
|
||||
return LINE_ERROR;
|
||||
|
||||
/* set 'var' to variable name */
|
||||
*var = line + i++; /* skip to next character */
|
||||
|
||||
/* find end of variable name */
|
||||
while (!whitespace(line[i]) && line[i] != '=' && line[i] != '\0')
|
||||
i++;
|
||||
|
||||
if (line[i] == '\0') /* syntax error */
|
||||
return LINE_ERROR;
|
||||
else if (line[i] == '=')
|
||||
line[i++] = '\0';
|
||||
else {
|
||||
line[i++] = '\0';
|
||||
|
||||
/* skip white space before '=' */
|
||||
while (whitespace(line[i]) && line[i] != '\0')
|
||||
i++;
|
||||
|
||||
if (line[i] != '=') /* syntax error */
|
||||
return LINE_ERROR;
|
||||
else
|
||||
i++; /* skip the '=' */
|
||||
}
|
||||
|
||||
/* skip white space after '=' */
|
||||
while (whitespace(line[i]) && line[i] != '\0')
|
||||
i++;
|
||||
|
||||
if (line[i] == '\0')
|
||||
return LINE_ERROR;
|
||||
else
|
||||
*value = line + i; /* set 'value' to value string */
|
||||
|
||||
/* trim trailing white space from 'value' */
|
||||
i = strlen(*value) - 1;
|
||||
while (whitespace((*value)[i]))
|
||||
i--;
|
||||
(*value)[i + 1] = '\0';
|
||||
|
||||
return LINE_OK; /* no syntax error in line */
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Create the configuration file
|
||||
*/
|
||||
void
|
||||
dlg_create_rc(const char *filename)
|
||||
{
|
||||
#ifdef HAVE_COLOR
|
||||
char buffer[MAX_LEN + 1];
|
||||
unsigned i, limit;
|
||||
FILE *rc_file;
|
||||
|
||||
if ((rc_file = fopen(filename, "wt")) == NULL)
|
||||
dlg_exiterr("Error opening file for writing in dlg_create_rc().");
|
||||
|
||||
fprintf(rc_file, "#\
|
||||
\n# Run-time configuration file for dialog\
|
||||
\n#\
|
||||
\n# Automatically generated by \"dialog --create-rc <file>\"\
|
||||
\n#\
|
||||
\n#\
|
||||
\n# Types of values:\
|
||||
\n#\
|
||||
\n# Number - <number>\
|
||||
\n# String - \"string\"\
|
||||
\n# Boolean - <ON|OFF>\
|
||||
\n# Attribute - (foreground,background,highlight?)\
|
||||
\n#\n\n");
|
||||
|
||||
/* Print an entry for each configuration variable */
|
||||
for (i = 0; i < VAR_COUNT; i++) {
|
||||
fprintf(rc_file, "\n# %s\n", vars[i].comment);
|
||||
switch (vars[i].type) {
|
||||
case VAL_INT:
|
||||
fprintf(rc_file, "%s = %d\n", vars[i].name,
|
||||
*((int *) vars[i].var));
|
||||
break;
|
||||
case VAL_STR:
|
||||
fprintf(rc_file, "%s = \"%s\"\n", vars[i].name,
|
||||
(char *) vars[i].var);
|
||||
break;
|
||||
case VAL_BOOL:
|
||||
fprintf(rc_file, "%s = %s\n", vars[i].name,
|
||||
*((bool *) vars[i].var) ? "ON" : "OFF");
|
||||
break;
|
||||
}
|
||||
}
|
||||
limit = dlg_color_count();
|
||||
for (i = 0; i < limit; ++i) {
|
||||
fprintf(rc_file, "\n# %s\n", dlg_color_table[i].comment);
|
||||
fprintf(rc_file, "%s = %s\n", dlg_color_table[i].name,
|
||||
attr_to_str(buffer,
|
||||
dlg_color_table[i].fg,
|
||||
dlg_color_table[i].bg,
|
||||
dlg_color_table[i].hilite));
|
||||
}
|
||||
|
||||
(void) fclose(rc_file);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef HAVE_COLOR
|
||||
static int
|
||||
find_vars(char *name)
|
||||
{
|
||||
int result = -1;
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < VAR_COUNT; i++) {
|
||||
if (dlg_strcmp(vars[i].name, name) == 0) {
|
||||
result = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static int
|
||||
find_color(char *name)
|
||||
{
|
||||
int result = -1;
|
||||
int i;
|
||||
int limit = dlg_color_count();
|
||||
|
||||
for (i = 0; i < limit; i++) {
|
||||
if (dlg_strcmp(dlg_color_table[i].name, name) == 0) {
|
||||
result = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Parse the configuration file and set up variables
|
||||
*/
|
||||
int
|
||||
dlg_parse_rc(void)
|
||||
{
|
||||
#ifdef HAVE_COLOR
|
||||
int i;
|
||||
int l = 1, parse, fg, bg, hl;
|
||||
char str[MAX_LEN + 1], *var, *value, *tempptr;
|
||||
FILE *rc_file = 0;
|
||||
|
||||
/*
|
||||
* 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, try using the GLOBALRC file.
|
||||
* Usually this will be /etc/dialogrc.
|
||||
*
|
||||
* d) if the file in (c) can't be found, use compiled in defaults.
|
||||
*
|
||||
*/
|
||||
|
||||
/* try step (a) */
|
||||
if ((tempptr = getenv("DIALOGRC")) != NULL)
|
||||
rc_file = fopen(tempptr, "rt");
|
||||
|
||||
if (tempptr == NULL || rc_file == NULL) { /* step (a) failed? */
|
||||
/* try step (b) */
|
||||
if ((tempptr = getenv("HOME")) != NULL
|
||||
&& strlen(tempptr) < MAX_LEN - 20) {
|
||||
if (tempptr[0] == '\0' || lastch(tempptr) == '/')
|
||||
sprintf(str, "%s%s", tempptr, DIALOGRC);
|
||||
else
|
||||
sprintf(str, "%s/%s", tempptr, DIALOGRC);
|
||||
rc_file = fopen(str, "rt");
|
||||
}
|
||||
}
|
||||
|
||||
if (tempptr == NULL || rc_file == NULL) { /* step (b) failed? */
|
||||
/* try step (c) */
|
||||
sprintf(str, "%s", GLOBALRC);
|
||||
if ((rc_file = fopen(str, "rt")) == NULL)
|
||||
return 0; /* step (c) failed, use default values */
|
||||
}
|
||||
|
||||
/* Scan each line and set variables */
|
||||
while (fgets(str, MAX_LEN, rc_file) != NULL) {
|
||||
if (lastch(str) != '\n') {
|
||||
/* ignore rest of file if line too long */
|
||||
fprintf(stderr, "\nParse error: line %d of configuration"
|
||||
" file too long.\n", l);
|
||||
(void) fclose(rc_file);
|
||||
return -1; /* parse aborted */
|
||||
} else {
|
||||
lastch(str) = '\0';
|
||||
parse = parse_line(str, &var, &value); /* parse current line */
|
||||
|
||||
switch (parse) {
|
||||
case LINE_BLANK: /* ignore blank lines and comments */
|
||||
case LINE_COMMENT:
|
||||
break;
|
||||
case LINE_OK:
|
||||
/* search table for matching config variable name */
|
||||
if ((i = find_vars(var)) >= 0) {
|
||||
switch (vars[i].type) {
|
||||
case VAL_INT:
|
||||
*((int *) vars[i].var) = atoi(value);
|
||||
break;
|
||||
case VAL_STR:
|
||||
if (!isquote(value[0]) || !isquote(lastch(value))
|
||||
|| strlen(value) < 2) {
|
||||
fprintf(stderr, "\nParse error: string value "
|
||||
"expected at line %d of configuration "
|
||||
"file.\n", l);
|
||||
return -1; /* parse aborted */
|
||||
} else {
|
||||
/* remove the (") quotes */
|
||||
value++;
|
||||
lastch(value) = '\0';
|
||||
strcpy((char *) vars[i].var, value);
|
||||
}
|
||||
break;
|
||||
case VAL_BOOL:
|
||||
if (!dlg_strcmp(value, "ON"))
|
||||
*((bool *) vars[i].var) = TRUE;
|
||||
else if (!dlg_strcmp(value, "OFF"))
|
||||
*((bool *) vars[i].var) = FALSE;
|
||||
else {
|
||||
fprintf(stderr, "\nParse error: boolean value "
|
||||
"expected at line %d of configuration "
|
||||
"file (found %s).\n", l, value);
|
||||
return -1; /* parse aborted */
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else if ((i = find_color(var)) >= 0) {
|
||||
if (str_to_attr(value, &fg, &bg, &hl) == -1) {
|
||||
fprintf(stderr, "\nParse error: attribute "
|
||||
"value expected at line %d of configuration "
|
||||
"file.\n", l);
|
||||
return -1; /* parse aborted */
|
||||
}
|
||||
dlg_color_table[i].fg = fg;
|
||||
dlg_color_table[i].bg = bg;
|
||||
dlg_color_table[i].hilite = hl;
|
||||
} else {
|
||||
fprintf(stderr, "\nParse error: unknown variable "
|
||||
"at line %d of configuration file:\n\t%s\n", l, var);
|
||||
return -1; /* parse aborted */
|
||||
}
|
||||
break;
|
||||
case LINE_ERROR:
|
||||
fprintf(stderr, "\nParse error: syntax error at line %d of "
|
||||
"configuration file.\n", l);
|
||||
return -1; /* parse aborted */
|
||||
}
|
||||
}
|
||||
l++; /* next line */
|
||||
}
|
||||
|
||||
(void) fclose(rc_file);
|
||||
#endif
|
||||
return 0; /* parse successful */
|
||||
}
|
||||
BIN
extra/dialog-1.0-20050306/rc.o
Normal file
BIN
extra/dialog-1.0-20050306/rc.o
Normal file
Binary file not shown.
38
extra/dialog-1.0-20050306/samples/README
Normal file
38
extra/dialog-1.0-20050306/samples/README
Normal file
@@ -0,0 +1,38 @@
|
||||
You can set the environment-variable DIALOG to whatever program you
|
||||
want to check. Default is "dialog".
|
||||
|
||||
Use "export DIALOG=/usr/bin/dialog" for sh or "setenv DIALOG ../dialog" for csh
|
||||
to test the /usr/bin/dialog program.
|
||||
|
||||
--
|
||||
|
||||
There is no documentation at the moment for cdialog 0.9a, but here are a
|
||||
small installer (copismall) for 'points' fido-like, that uses cdialog 0.9a.
|
||||
It can demonstrate some of the new features... run "copismall" paying
|
||||
attention because after asking for some things, it then installs and/or
|
||||
configures programs like as Inn, Ifmail, Smail to make the 'point'.
|
||||
It's in Italian language only at moment, but the code is bash......
|
||||
If you want look at other much professional products FREE realized with
|
||||
cdialog and that use much of the other new characteristics, look for one of
|
||||
the ComeOn Point Suites v1.1+. Makers are a sub-group of the ComeOn Linux
|
||||
Development Team... ComeOn Linux! follows GNU philosophy.
|
||||
|
||||
Mail demarco_p@abramo.it to have the actual location of these Suites and
|
||||
of other free ComeOn Linux! software, or if you want more info about
|
||||
ComeOn Linux!
|
||||
|
||||
To run the "ComeOn Point Installer! v0.9a.small", type:
|
||||
$ copismall
|
||||
|
||||
Other external samples could be:
|
||||
|
||||
copa - ComeOn Point Administrator! v0.8
|
||||
copm - ComeOn Point Maintainer! v0.2
|
||||
copi - ComeOn Point Installer! v0.9 (system-wide version of copi)
|
||||
coepi - ComeOn Expert Point Installer! v1.3 (Professional)
|
||||
|
||||
cops - ComeOn Point Suite! v1.1
|
||||
copsp - ComeOn Point Suite Professional! v1.1
|
||||
|
||||
coui - ComeOn UUCP Installer! v0.1 (makes dialup networks in a moment)
|
||||
|
||||
17
extra/dialog-1.0-20050306/samples/calendar
Executable file
17
extra/dialog-1.0-20050306/samples/calendar
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
# $Id: calendar,v 1.4 2003/10/09 22:45:06 tom Exp $
|
||||
: ${DIALOG=dialog}
|
||||
|
||||
exec 3>&1
|
||||
USERDATE=`$DIALOG --title "CALENDAR" --calendar "Please choose a date..." 0 0 7 7 1981 2>&1 1>&3`
|
||||
code=$?
|
||||
exec 3>&-
|
||||
|
||||
case $code in
|
||||
0)
|
||||
echo "Date entered: $USERDATE.";;
|
||||
1)
|
||||
echo "Cancel pressed.";;
|
||||
255)
|
||||
echo "Box closed.";;
|
||||
esac
|
||||
14
extra/dialog-1.0-20050306/samples/calendar-stdout
Executable file
14
extra/dialog-1.0-20050306/samples/calendar-stdout
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
# $Id: calendar-stdout,v 1.1 2003/08/15 19:40:37 tom Exp $
|
||||
: ${DIALOG=dialog}
|
||||
|
||||
USERDATE=`$DIALOG --stdout --title "CALENDAR" --calendar "Please choose a date..." 0 0 7 7 1981`
|
||||
|
||||
case $? in
|
||||
0)
|
||||
echo "Date entered: $USERDATE.";;
|
||||
1)
|
||||
echo "Cancel pressed.";;
|
||||
255)
|
||||
echo "Box closed.";;
|
||||
esac
|
||||
17
extra/dialog-1.0-20050306/samples/calendar2
Executable file
17
extra/dialog-1.0-20050306/samples/calendar2
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
# $Id: calendar2,v 1.3 2003/10/09 22:45:06 tom Exp $
|
||||
: ${DIALOG=dialog}
|
||||
|
||||
exec 3>&1
|
||||
USERDATE=`$DIALOG --title "CALENDAR" --calendar "Please choose a date..." 0 0 2>&1 1>&3`
|
||||
code=$?
|
||||
exec 3>&-
|
||||
|
||||
case $code in
|
||||
0)
|
||||
echo "Date entered: $USERDATE.";;
|
||||
1)
|
||||
echo "Cancel pressed.";;
|
||||
255)
|
||||
echo "Box closed.";;
|
||||
esac
|
||||
14
extra/dialog-1.0-20050306/samples/calendar2-stdout
Executable file
14
extra/dialog-1.0-20050306/samples/calendar2-stdout
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
# $Id: calendar2-stdout,v 1.1 2003/08/15 19:40:37 tom Exp $
|
||||
: ${DIALOG=dialog}
|
||||
|
||||
USERDATE=`$DIALOG --stdout --title "CALENDAR" --calendar "Please choose a date..." 0 0`
|
||||
|
||||
case $? in
|
||||
0)
|
||||
echo "Date entered: $USERDATE.";;
|
||||
1)
|
||||
echo "Cancel pressed.";;
|
||||
255)
|
||||
echo "Box closed.";;
|
||||
esac
|
||||
21
extra/dialog-1.0-20050306/samples/calendar3
Executable file
21
extra/dialog-1.0-20050306/samples/calendar3
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
# $Id: calendar3,v 1.4 2003/10/09 22:45:06 tom Exp $
|
||||
: ${DIALOG=dialog}
|
||||
|
||||
exec 3>&1
|
||||
USERDATE=`$DIALOG --extra-button --extra-label "Hold" --help-button --title "CALENDAR" --calendar "Please choose a date..." 0 0 7 7 1981 2>&1 1>&3`
|
||||
code=$?
|
||||
exec 3>&-
|
||||
|
||||
case $code in
|
||||
0)
|
||||
echo "Date entered: $USERDATE.";;
|
||||
1)
|
||||
echo "Cancel pressed.";;
|
||||
2)
|
||||
echo "Help pressed.";;
|
||||
3)
|
||||
echo "Hold pressed.";;
|
||||
255)
|
||||
echo "Box closed.";;
|
||||
esac
|
||||
18
extra/dialog-1.0-20050306/samples/calendar3-stdout
Executable file
18
extra/dialog-1.0-20050306/samples/calendar3-stdout
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
# $Id: calendar3-stdout,v 1.1 2003/08/15 19:40:37 tom Exp $
|
||||
: ${DIALOG=dialog}
|
||||
|
||||
USERDATE=`$DIALOG --extra-button --extra-label "Hold" --help-button --stdout --title "CALENDAR" --calendar "Please choose a date..." 0 0 7 7 1981`
|
||||
|
||||
case $? in
|
||||
0)
|
||||
echo "Date entered: $USERDATE.";;
|
||||
1)
|
||||
echo "Cancel pressed.";;
|
||||
2)
|
||||
echo "Help pressed.";;
|
||||
3)
|
||||
echo "Hold pressed.";;
|
||||
255)
|
||||
echo "Box closed.";;
|
||||
esac
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user