commit
22b2a193d3
|
@ -0,0 +1,17 @@
|
||||||
|
config.log
|
||||||
|
config.sub
|
||||||
|
config.cache
|
||||||
|
config.guess
|
||||||
|
configure
|
||||||
|
ltconfig
|
||||||
|
ltmain.sh
|
||||||
|
Makefile
|
||||||
|
Makefile.in
|
||||||
|
aclocal.m4
|
||||||
|
config.status
|
||||||
|
config.h
|
||||||
|
libtool
|
||||||
|
stamp-h
|
||||||
|
move-themes
|
||||||
|
Eterm.spec
|
||||||
|
config.h.in
|
|
@ -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
|
||||||
|
|
||||||
|
Appendix: 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) 19yy <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) 19yy 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.
|
|
@ -0,0 +1,11 @@
|
||||||
|
As of 31 August 1998, Eterm is now available via anonymous CVS from
|
||||||
|
anoncvs.gnome.org. If you don't know how to use CVS, don't use it.
|
||||||
|
The authors, of course, don't guarantee anything whatsoever about
|
||||||
|
Eterm being functional; we guarantee even less if you get it from
|
||||||
|
CVS. We will try to remember to test things before we commit them,
|
||||||
|
but we make no promises. :-)
|
||||||
|
|
||||||
|
Happy terming!
|
||||||
|
|
||||||
|
mej
|
||||||
|
|
|
@ -0,0 +1,79 @@
|
||||||
|
# Note that this is NOT a relocatable package
|
||||||
|
%define ver @VERSION@
|
||||||
|
%define rel SNAP
|
||||||
|
%define prefix /usr
|
||||||
|
|
||||||
|
Summary: Eterm Enlightened Terminal Emulator for X Windows
|
||||||
|
Name: Eterm
|
||||||
|
Version: %ver
|
||||||
|
Release: %rel
|
||||||
|
Copyright: GPL
|
||||||
|
Group: X11/Applications
|
||||||
|
Source: ftp://ftp.enlightenment.org/pub/Eterm/Eterm-%{ver}.tar.gz
|
||||||
|
BuildRoot: /tmp/Eterm-root
|
||||||
|
Packager: technoir <technoir@themes.org>
|
||||||
|
URL: http://e.themes.org/
|
||||||
|
Requires: imlib >= 1.8
|
||||||
|
|
||||||
|
Docdir: %{prefix}/doc
|
||||||
|
|
||||||
|
%description
|
||||||
|
Eterm is a color vt102 terminal emulator intended as an xterm replacement for users who want a term program integrated with Enlightenment, or simply want a little more "eye candy". Eterm uses Imlib for advanced graphic abilities.
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
|
||||||
|
* Wed Dec 30 1998 mej <mej@mw.3com.com>
|
||||||
|
|
||||||
|
- Added spec file. Created by techn0ir <technoir@themes.org>
|
||||||
|
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%setup
|
||||||
|
|
||||||
|
%build
|
||||||
|
# Optimize that damned code all the way
|
||||||
|
if [ ! -z "`echo -n ${RPM_OPT_FLAGS} | grep pentium`" ]; then
|
||||||
|
if [ ! -z `which egcs` ]; then
|
||||||
|
CC="egcs"
|
||||||
|
else
|
||||||
|
if [ ! -z `which pgcc` ]; then
|
||||||
|
CC="pgcc"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
CFLAGS="${RPM_OPT_FLAGS}"
|
||||||
|
else
|
||||||
|
CFLAGS="${RPM_OPT_FLAGS}"
|
||||||
|
fi
|
||||||
|
if [ ! -f configure ]; then
|
||||||
|
CFLAGS="$RPM_OPT_FLAGS" ./autogen.sh --prefix=%prefix
|
||||||
|
else
|
||||||
|
CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%prefix
|
||||||
|
fi
|
||||||
|
|
||||||
|
make
|
||||||
|
|
||||||
|
%install
|
||||||
|
rm -rf $RPM_BUILD_ROOT
|
||||||
|
|
||||||
|
make prefix=$RPM_BUILD_ROOT%{prefix} install
|
||||||
|
|
||||||
|
%clean
|
||||||
|
rm -rf $RPM_BUILD_ROOT
|
||||||
|
|
||||||
|
%post
|
||||||
|
|
||||||
|
%postun
|
||||||
|
|
||||||
|
%files
|
||||||
|
%defattr(-, root, root)
|
||||||
|
|
||||||
|
%{prefix}/bin/*
|
||||||
|
%(prefix)/doc/*
|
||||||
|
%{prefix}/lib/*
|
||||||
|
%{prefix}/share/*
|
||||||
|
%{prefix}/man/*
|
||||||
|
|
||||||
|
|
||||||
|
%doc COPYING
|
||||||
|
%doc ChangeLog
|
||||||
|
%doc README
|
|
@ -0,0 +1,7 @@
|
||||||
|
# $Id$
|
||||||
|
|
||||||
|
AUTOMAKE_OPTIONS = foreign
|
||||||
|
|
||||||
|
SUBDIRS = libmej src themes utils doc bg
|
||||||
|
|
||||||
|
EXTRA_DIST = README ReleaseNotes CVS-README COPYING ChangeLog autogen.sh
|
|
@ -0,0 +1,124 @@
|
||||||
|
Release notes for Eterm Development Release 0.8
|
||||||
|
-----------------------------------------------
|
||||||
|
|
||||||
|
Software Requirements
|
||||||
|
---------------------
|
||||||
|
- The usual X11R6 stuff
|
||||||
|
- Rasterman's Imlib and the libraries it needs. Visit
|
||||||
|
http://www.labs.redhat.com/imlib/ for more information.
|
||||||
|
- Even though Eterm works with any window manager, you just might get extra
|
||||||
|
fancies by using the Enlightenment window manager from Rasterman and
|
||||||
|
Mandrake - http://www.enlightenment.org/ for more information. Now go see
|
||||||
|
what your desktop can look like with E. :) -vendu
|
||||||
|
|
||||||
|
Documentation to read
|
||||||
|
---------------------
|
||||||
|
- The FAQ at http://www.eterm.org/
|
||||||
|
- Run "Eterm -h" - you'll see the command line options.
|
||||||
|
|
||||||
|
ATTENTION! Active Tags Warning!
|
||||||
|
--------------------------------
|
||||||
|
|
||||||
|
NOTE: It looks like the latest resize-crashes happen in the active tags
|
||||||
|
code. We'll try to get this fixed as soon as possible. Until then, if you
|
||||||
|
want to use tags, you may want to see the FIXME notes in screen.c for what
|
||||||
|
NULL pointer checks to remove.
|
||||||
|
|
||||||
|
Preliminary support for active tags by Nat Friedman has been added.
|
||||||
|
Thanks, Nat :) (http://dingus.mit.edu/ for more info)
|
||||||
|
|
||||||
|
This will definitely need more work :) Sorry if it's buggy (I'd expect it
|
||||||
|
to be >:). -vendu
|
||||||
|
|
||||||
|
Building Eterm 0.8
|
||||||
|
------------------
|
||||||
|
|
||||||
|
From the toplevel Eterm source tree directory:
|
||||||
|
./configure
|
||||||
|
make
|
||||||
|
|
||||||
|
With better optimization flags
|
||||||
|
|
||||||
|
- For gcc 2.7.2.1 and older: make "CFLAGS=-O2 -fno-strength-reduce"
|
||||||
|
- For Intel-based platforms with new gcc compilers: make "CFLAGS=-O2 -m486"
|
||||||
|
- For Intel-based platforms with new gcc compilers, more optimization:
|
||||||
|
make "CFLAGS=-O3 -m486 -malign-loops=2 -malign-jumps=2 -malign-functions=2"
|
||||||
|
- For Pentium machines with egcs or pgcc:
|
||||||
|
make "CFLAGS=-O6 -mpentium -malign-loops=2 -malign-jumps=2 -malign-functions=2"
|
||||||
|
- Eterm seems to compile OK with pgcc 1.0.1. DEFINITELY use the -malign
|
||||||
|
flags, they seem to speed things up quite considerably for Pentium
|
||||||
|
processors :)
|
||||||
|
|
||||||
|
Installing Eterm
|
||||||
|
----------------
|
||||||
|
|
||||||
|
After performing the build step above, run:
|
||||||
|
make install
|
||||||
|
|
||||||
|
Standard Disclaimer
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
The authors don't take any responsibility for any damage this program
|
||||||
|
may do. We are doing this in our spare time. If you don't like this
|
||||||
|
program, don't use it.
|
||||||
|
|
||||||
|
Eterm is based on rxvt 2.21. This development release of Eterm
|
||||||
|
has been hacked together by Tuomo Venalainen (vendu@cc.hut.fi)
|
||||||
|
and Michael Jennings (mej@tcserv.com). Thanks to Rasterman
|
||||||
|
(aka Carsten Haitzler) and Michael Kellen, as well as to all the
|
||||||
|
other people who have provided patches. Thanks to all regulars
|
||||||
|
from the #E IRC channel for helping us test Eterm.
|
||||||
|
|
||||||
|
The development of Eterm will be continued. The sources need to be
|
||||||
|
converted into human-readable format ;-). More features will be added
|
||||||
|
as well. We'll continue cleaning up and patching the sources to make
|
||||||
|
Eterm more robust, secure and portable.
|
||||||
|
|
||||||
|
NOTE: Support for libXpm was dropped off in DR 0.3. Imlib does a much
|
||||||
|
better job at loading and scaling the background pixmaps. And hey,
|
||||||
|
it's Eterm, ya know :-)
|
||||||
|
|
||||||
|
Future Plans
|
||||||
|
------------
|
||||||
|
|
||||||
|
There will be minimal further development on this incarnation of Eterm.
|
||||||
|
We have begun Project Resurrection, which is a complete rewrite of Eterm
|
||||||
|
with a completely different philosophy of design. Please visit
|
||||||
|
http://ganja.tky.hut.fi/Resurrection/ for more information.
|
||||||
|
|
||||||
|
Notes
|
||||||
|
-----
|
||||||
|
|
||||||
|
- In case you need utmp support, you'll have to run Eterm "setuid root"
|
||||||
|
As root, do: "chmod 4755 Eterm" Make SURE the Eterm binary is owned by
|
||||||
|
user=root, group=root (on BSD, i think it should be group=wheel):
|
||||||
|
|
||||||
|
1. chown root.root Eterm
|
||||||
|
2. (BSD) chown root.wheel Eterm
|
||||||
|
|
||||||
|
Note that in this version, utmp support will be turned on automagically
|
||||||
|
only on Linux and FreeBSD. If you want to try it on other platforms,
|
||||||
|
add -DUTMP_SUPPORT to your compilation flags. An example:
|
||||||
|
make "CFLAGS=-O -DUTMP_SUPPORT"
|
||||||
|
|
||||||
|
- The only fonts I know that will display ANSI art correctly are Raster's
|
||||||
|
nexus and vga;
|
||||||
|
- If you want to use colorful ANSI prompts (at least bash can show them),
|
||||||
|
make sure to make them end with a new line character ('\n')>
|
||||||
|
|
||||||
|
Development Notes
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
- ATTENTION! Ignore warnings like this:
|
||||||
|
options.c:1454: warning: unsigned int format, long unsigned int arg (arg 3)
|
||||||
|
- type casting or otherwise screwing around can break text colors bad :)
|
||||||
|
- The sources don't compile with the GCC profiling flag (-gp) yet;
|
||||||
|
|
||||||
|
Troubleshooting
|
||||||
|
---------------
|
||||||
|
|
||||||
|
- See feature.h;
|
||||||
|
- In case you have problems, try commenting out #define NDEBUG in feature.h:
|
||||||
|
/* #define NDEBUG */
|
||||||
|
|
||||||
|
E-n-Joy! ;-) -- vendu & mej
|
|
@ -0,0 +1,413 @@
|
||||||
|
Release Notes
|
||||||
|
=============
|
||||||
|
|
||||||
|
This document includes a summary of major changes for each revision of Eterm.
|
||||||
|
|
||||||
|
Changes made to rxvt 2.21 include
|
||||||
|
---------------------------------
|
||||||
|
|
||||||
|
- Better (read: working) implementation of utmp logging and added security;
|
||||||
|
needs to be tested on different platforms;
|
||||||
|
- Support for Rasterman's Imlib - used for loading and scaling the background
|
||||||
|
pixmaps;
|
||||||
|
- The command line option -pixmap now takes '@' as the delimiter between
|
||||||
|
the pixmap name and geometry. The old delimiter, ';', is NOT supported
|
||||||
|
any more. It was UGLY. Period. <g> ;
|
||||||
|
- A new command line option, --scale or -@, was added. It will scale the background
|
||||||
|
pixmap "to fit"; to fill the whole background of the Eterm window;
|
||||||
|
- The binary was renamed to Eterm;
|
||||||
|
- Several bug/annoyance fixes. For example, fixed a problem with DEBUG_UTMP
|
||||||
|
that printed garbage when running with the debugging messages enabled.
|
||||||
|
See also #define NDEBUG in feature.h;
|
||||||
|
- Minor speedups.
|
||||||
|
|
||||||
|
More changes for 0.3 (included in some 0.2 versions), as described by Michael:
|
||||||
|
|
||||||
|
- Installs signal handlers that, among other things, make core
|
||||||
|
dumps secure by revoking privs and changing its umask to 077.
|
||||||
|
It also prompts for whether or not it should dump core, timing
|
||||||
|
out after 10 seconds or if it gets a SIGT(STP|TIN|TOU)
|
||||||
|
- Changes stuff that said rxvt to Eterm (most places, but I probably
|
||||||
|
missed a few).
|
||||||
|
- Fixes SVR4/utmpx compile under HP-UX 10.X
|
||||||
|
|
||||||
|
Utmp logging support was fixed to work on FreeBSD (tested on 2.1.5 and 2.2.2)
|
||||||
|
for 0.3a. Thanks to Brian Gottlieb for doing it.
|
||||||
|
|
||||||
|
Changes made to 0.3b include a few portability additions and fixes (HP-UX,
|
||||||
|
OSF/1) and a few changed (commented out) #define's in feature.h.
|
||||||
|
|
||||||
|
Eterm DR-0.4x included a number of patches for bold fonts, security,
|
||||||
|
utmp logging, etc.
|
||||||
|
|
||||||
|
Several bugs were fixed for DR 0.5. Thanks to Michael Kellen for his
|
||||||
|
Solaris patch.
|
||||||
|
|
||||||
|
Thanks go to Steve <steve@rage.org> for his help with security.
|
||||||
|
|
||||||
|
Changes in DR-0.6:
|
||||||
|
------------------
|
||||||
|
|
||||||
|
- Finally got the distribution tree cleaned up to remove most all traces
|
||||||
|
of left-over rxvt SPAM(tm). For now, however, credit for most of the
|
||||||
|
docs still remains with the rxvt people.
|
||||||
|
- No more .Xdefaults support. The X Resource Manager (Xrm) code has
|
||||||
|
several known security holes which make any program making
|
||||||
|
XGetDefault() calls insecure. Since Eterm generally runs as root,
|
||||||
|
this is unacceptable. So too is reading .Xdefaults directly, which
|
||||||
|
it had been doing up until now. From DR-0.6 on, it will read (in
|
||||||
|
proper Enlightened fashion) ~/.Eterm/MAIN, which will be a very
|
||||||
|
E-like config file. See doc/MAIN.dist for a sample.
|
||||||
|
- The config files support $ variable expansion, ~ expansion, single/double
|
||||||
|
quotes, and (if #defined) backquotes. PLEASE read the accompanying
|
||||||
|
notes in src/feature.h before #defining ALLOW_BACKQUOTE_EXEC. Also
|
||||||
|
supported is the %include macro.
|
||||||
|
|
||||||
|
Changes in DR-0.6a:
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
- Lots of bug fixes:
|
||||||
|
- The font options now accept font names starting with '-'
|
||||||
|
- Intense colors are no longer off by one.
|
||||||
|
- Scrollbar and cursor color configuration options now work properly.
|
||||||
|
- Eterm now changes back to the original directory after searching for
|
||||||
|
a config file.
|
||||||
|
- Command line options now take precedence over config file options
|
||||||
|
- -h and --help now work properly, instead of asking for a string value
|
||||||
|
- MAIN.dist.in now contains a value for cut_chars that works right when
|
||||||
|
ALLOW_BACKQUOTE_EXEC is #defined.
|
||||||
|
- The "video reverse" in MAIN.dist.in is now "video normal", because I
|
||||||
|
got sick of people saying there was a bug in Eterm that caused their
|
||||||
|
foreground and background colors to be swapped. :^) More of a
|
||||||
|
cl00bie-didn't-read-the-comments fix than a bug fix.... ;)
|
||||||
|
|
||||||
|
- New features:
|
||||||
|
- A "magic number"-like identifier that will prevent Enlightenment config
|
||||||
|
files from being read by Eterm. See doc/MAIN.dist for details.
|
||||||
|
- Secure execution of backquote commands in config files, even if Eterm
|
||||||
|
runs setuid/setgid.
|
||||||
|
- Invalid contexts are skipped entirely with only one error message. For
|
||||||
|
example, if you don't compile in kanji support, you'll only get one
|
||||||
|
warning instead of 5 or 6.
|
||||||
|
- -H and --home-on-echo options, which will cause Eterm to jump to the
|
||||||
|
bottom of the screen when something is echoed there, if you're viewing
|
||||||
|
the scrollback buffer. There is also a new attribute "home_on_echo" in
|
||||||
|
the toggles context of the config file for this option. Thanks to Casey
|
||||||
|
<casey@netcomi.com> for his help with this. Just in time, Casey. :)
|
||||||
|
- There is now a script which randomly chooses a pixmap from ~/.Eterm/pix
|
||||||
|
that can be executed in your config file. This script requires the
|
||||||
|
dorand program (source provided) and can be found in doc/random_pixmap.sh
|
||||||
|
|
||||||
|
Changes in DR-0.7:
|
||||||
|
------------------
|
||||||
|
|
||||||
|
- Theme support. The options were changed to -t and --theme. Consult the FAQ for
|
||||||
|
more info on themes.
|
||||||
|
- Alternate config file option. This has been integrated into theme support, but
|
||||||
|
can also work independently thereof. If you don't like the name MAIN for your
|
||||||
|
config file, or want to run a certain Eterm with a different config file, use
|
||||||
|
the -X or --config-file option.
|
||||||
|
- Borderless Eterm windows. Use the -x or --borderless option to get a borderless
|
||||||
|
Eterm. Remember, you'll want to specify a geometry, since you won't be able to
|
||||||
|
move it, and something to exec. If your window manager supports it, it is
|
||||||
|
recommended that you use that functionality rather than Eterm's built-in option.
|
||||||
|
- Built-in functions. Several functions have been added to facilitate the building
|
||||||
|
of more robust config files. The currently-supported functions are:
|
||||||
|
- %appname() Returns the current application name. "Eterm-DR-0.7" as of
|
||||||
|
Eterm 0.7.
|
||||||
|
- %version() Returns the numeric version.
|
||||||
|
- %random(...) Randomly chooses one of its parameters and returns that.
|
||||||
|
- Other new options (consult the MAIN file and the --help screen for more info):
|
||||||
|
- -E and --home-on-refresh
|
||||||
|
- --pointer-color
|
||||||
|
- --scrollbar-right
|
||||||
|
- --scrollbar-floating
|
||||||
|
- -M and --menu (Menubar code is beta, so use it at your own risk)
|
||||||
|
- --term-name
|
||||||
|
- Config file support for all the above. Also:
|
||||||
|
- exec (context misc) For use with themes....
|
||||||
|
- Some major and minor bug fixes. Nobody noticed, so I won't go into details. :)
|
||||||
|
- Support for Window Maker's "docking", thanks to CmdrTaco (Rob Malda)
|
||||||
|
(http://slashdot.org/malda/)
|
||||||
|
|
||||||
|
Changes in DR-0.8:
|
||||||
|
------------------
|
||||||
|
|
||||||
|
- Several experimental features are in, like active tags, fake transparency,
|
||||||
|
and threads support. Use them at your own risk; they are unsupported and
|
||||||
|
known not to work right. We chose not to fix them since we're going to
|
||||||
|
rewrite the whole thing anyway (see http://ganja.tky.hut.fi/resurrection/)
|
||||||
|
- The FORCE_BACKSPACE feature introduce in 0.7 PL5 has been disabled for now;
|
||||||
|
you can't succesfully start Eterm as a background process with it
|
||||||
|
- The new fake transparency option, -O/trans, only works OK with a pixmap
|
||||||
|
the size of your root window / resolution. Test it with an exact image
|
||||||
|
of your root window for a neat effect :) Note that escape sequences for
|
||||||
|
changing the background pixmap will be ignored.
|
||||||
|
- Two new config file options, "trans" and "save_under", have been added.
|
||||||
|
Read themes/Eterm/MAIN for more information. The corresponding new
|
||||||
|
command line options are -O and --save-under.
|
||||||
|
- Fixed the pixmap handling code so that the menubar stuff works right now.
|
||||||
|
Thanks to Cliff Wright <cliff@vixen.itdl.ds.boeing.com> and keebler
|
||||||
|
<keebler@ncal.verio.com> for their help with finding and fixing this.
|
||||||
|
- The Xterm-style scrollbar feature (defined in src/feature.h) will actually
|
||||||
|
compile and run properly. The restriction on size to 15 pixels has
|
||||||
|
been removed as well. Thanks to Peter Norby <norby@inktomi.com> and
|
||||||
|
Hal Black <hal@hablack.bevc.blacksburg.va.us> for supplying patches for
|
||||||
|
this.
|
||||||
|
- Made several changes to the configure script so that hopefully it will
|
||||||
|
work for a larger percentage of the populace. :-) Some of the changes
|
||||||
|
were suggested by John Reese <jtr@pyro.ugcs.caltech.edu> and Hal Black
|
||||||
|
<hal@hablack.bevc.blacksburg.va.us>.
|
||||||
|
- Added MIN_ANCHOR_SIZE to src/feature.h which allows you to specify a minimum
|
||||||
|
size for the scrollbar anchor. Good for large scrollback buffers and/or
|
||||||
|
small windows. Still a mite flaky at the bottom of the scrollbar, but it
|
||||||
|
works. Credit for the idea goes to Stephen Farrell <stephen@farrell.org>,
|
||||||
|
though the actual code was largely rewritten.
|
||||||
|
- Added CHANGE_SCROLLCOLOR_ON_FOCUS to src/feature.h which makes the
|
||||||
|
scrollbar "disappear" (i.e., become the background color) when the window
|
||||||
|
loses focus. This feature was suggested by Scott Heavner
|
||||||
|
<sdh@falstaff.MAE.cwru.edu>.
|
||||||
|
- Added option --menu-text-color and config file attribute menu_text,
|
||||||
|
which allow you to change the color of the menubar text. This feature
|
||||||
|
was suggested by Scott Heavner <sdh@falstaff.MAE.cwru.edu>.
|
||||||
|
- Fixed a bug for FreeBSD that only allowed Eterm to open 16 tty's at
|
||||||
|
once. Thanks to Christopher Mann <r3cgm@cdrom.com> for finding this
|
||||||
|
one.
|
||||||
|
- PL1
|
||||||
|
- Fixed bug which caused scrollbar not to redraw properly
|
||||||
|
- PL2
|
||||||
|
- Rewrote the string functions in src/misc.c to be faster. Also, support
|
||||||
|
for "\C" and "C-" to represent the Ctrl-key modifier was added.
|
||||||
|
- Added MENU_TEXT_FLOATING to src/feature.h which puts the menubar text
|
||||||
|
in the middle of the menubar buttons (which is, IMHO, where it belongs,
|
||||||
|
but apparently someone disagrees :-) -- mej).
|
||||||
|
- The pre-release stuff in RELNOTES.Eterm has been removed.
|
||||||
|
- Added an "emacs" theme for GNU Emacs or XEmacs in a text window.
|
||||||
|
- Got rid of that damned annoying preedit type error. :-)
|
||||||
|
- Added call counting for the malloc routines in libmej/mem.* thanks to
|
||||||
|
Michael Wolf (Elessar) <mawolf@concentric.net>.
|
||||||
|
- PL3
|
||||||
|
- Changed themes/Makefile.in so that existing themes in
|
||||||
|
${prefix}/lib/Eterm/themes do not get overwritten by the "make install"
|
||||||
|
routine. Sorry, stupid oversight on my part. :( -- mej
|
||||||
|
- New "chooser" theme. Read the comments at the top of
|
||||||
|
themes/chooser/chooser.menu for more details. :)
|
||||||
|
- New extended command "echo" in the ESC ] 10 ; set. See the chooser
|
||||||
|
theme for implementation examples. Basically, it echoes its parameters
|
||||||
|
and tacks a carriage return on the end.
|
||||||
|
- Fixed the bug introduced in PL2 which caused a border width < the shadow
|
||||||
|
width to not properly display the menubar. This was only noticeable in
|
||||||
|
the mutt theme or to users who specifically set border_width to 0 or 1.
|
||||||
|
- Eterm now sets the environment variable ETERM_THEME_ROOT to point to the
|
||||||
|
root directory of the theme it is currently using.
|
||||||
|
- PL4
|
||||||
|
- Made several portability improvements in the configure script and its
|
||||||
|
associated files.
|
||||||
|
- Moved the active.tags file into the themes directory, which is the
|
||||||
|
location from which it is installed.
|
||||||
|
- The configure script now builds src/feature.h instead of the make process
|
||||||
|
so that it will be there before the make is done. If src/feature.h.in is
|
||||||
|
updated, however, src/feature.h will still be generated from it by a make.
|
||||||
|
- The installed Eterm binary will be Eterm-<version_number>, and Eterm will
|
||||||
|
be created as a soft-link to that file in the $bindir directory.
|
||||||
|
- Eterm will now guess the install prefix (${prefix}) based on where gcc is
|
||||||
|
located, unless you give a --prefix on the command line. This keeps me
|
||||||
|
from having to use it. If it makes you have to use it, tough break. =P
|
||||||
|
- Added the --with-imlib option to configure. If you specify
|
||||||
|
--with-imlib=/some/path, the compiler will look in /some/path/include
|
||||||
|
for Imlib's header files and in /some/path/lib for Imlib itself. You can
|
||||||
|
also specify --without-imlib, which will disable pixmap support entirely.
|
||||||
|
- PL5
|
||||||
|
- Fixed the problem with the Eterm -> Pixmap -> None menu item.
|
||||||
|
- IMPORTANT NOTE: One of the src/feature.h defines added in version 0.8 was
|
||||||
|
the MIN_ANCHOR_SIZE #define. There are KNOWN PROBLEMS with using this feature
|
||||||
|
and trying to scroll up from the bottom using Shift-Prior, the up arrow on the
|
||||||
|
scrollbar, etc. If this bothers you, COMMENT OUT that line in src/feature.h.
|
||||||
|
Fixing this problem will require a redesign of how Eterm looks at scrolling
|
||||||
|
and positioning the terminal window relative to the scrollbar and vice versa.
|
||||||
|
This may or may not happen in the current development cycle.
|
||||||
|
- Added the CTRL_CLICK_RAISE #define to src/feature.h which allows a mouse
|
||||||
|
click in the terminal window while holding the Ctrl key to raise the window
|
||||||
|
and steal keyboard focus. This is useful if you are stuck without a window
|
||||||
|
manager for one reason or another or for using Eterm as an X session manager.
|
||||||
|
- Also added an escape sequence, ESC ] 5 ; BEL, to perform the same task, and
|
||||||
|
added a menu item called "Steal Focus" to send that escape sequence.
|
||||||
|
- Fixed the "bug" that made command-line paths relative to the current theme
|
||||||
|
as well as paths in theme config files. Searching relative to the current
|
||||||
|
directory takes place after searching the directories in the "path" line
|
||||||
|
(from the config file). (I have "bug" in quotes because it wasn't really
|
||||||
|
a bug -- all paths were interpreted relative to the theme used -- but it
|
||||||
|
applied to command-line variables too, which was very confusing to some.)
|
||||||
|
|
||||||
|
Changes in 0.8.6:
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
- For starters, we changed the naming convention. No more "DR" and "PL" stuff.
|
||||||
|
We got asked too many stupid questions. ("What's the P 15 mean?") Starting
|
||||||
|
with this release, we'll be using numbers only. The third number will still
|
||||||
|
indicate the patch level, however.
|
||||||
|
- Added support for imlib-config script supplied with Imlib 1.8 and up. This
|
||||||
|
speeds and simplifies the calculation of CFLAGS and LDFLAGS for proper
|
||||||
|
linking with Imlib.
|
||||||
|
- Fixed problems with compilation on NetBSD thanks to Clifford Wright
|
||||||
|
<cliff@snipe444.org>.
|
||||||
|
- Redid the themes to support the new pixmap mechanism I'm working on. Once
|
||||||
|
the new pixmap archive comes out, you'll want to remove your themes
|
||||||
|
directory ($prefix/lib/Eterm/themes by default) and install the themes
|
||||||
|
contained in this distribution. Get the new Eterm Backgrounds Collection
|
||||||
|
at http://www.tcserv.com/archive/E/ or a mirror near you.
|
||||||
|
- Reworked the transparency mechanism thanks to Gerald Britton
|
||||||
|
<gbritton@mit.edu> and Nat Friedman <ndf@mit.edu>. It now takes a copy
|
||||||
|
of the root window's pixmap and uses that. It responds to all moves and
|
||||||
|
resizes by updating the pixmap. No requests for changing pixmap are
|
||||||
|
honored by a transparent Eterm (the -O or --trans options). Furthermore,
|
||||||
|
this will probably only work in Enlightenment. And for the full effect,
|
||||||
|
you'll want to run it without scrollbar/menubar and borderless (the
|
||||||
|
latter being done either through Enlightenment or with the -x option).
|
||||||
|
- Added the Esetroot program, which sets the root pixmap atom for those
|
||||||
|
who don't use Enlightenment as their window manager. There has been
|
||||||
|
mixed feedback on whether or not this program works. YMMV.
|
||||||
|
- Added a theme to demo some of the pseudo-transparency features. Use
|
||||||
|
"Eterm -t trans" to invoke it.
|
||||||
|
- Some pseudo-transparency toys are in too. The option --shade will darken
|
||||||
|
the portion of the desktop "showing through" the Eterm window. Results
|
||||||
|
in a "smoked glass" effect. This option can also be used with the
|
||||||
|
--tint option to provide a colored glass effect. See the man page for
|
||||||
|
more information. Also be sure to check out the effect of the
|
||||||
|
--scrollbar-floating option with transparency. :)
|
||||||
|
- Fixed compilation without pixmap and/or menubar support. The options
|
||||||
|
--disable-menus and --without-imlib can, when passed to the configure
|
||||||
|
script, be used to automatically disable menubar and pixmap support,
|
||||||
|
respectively.
|
||||||
|
- NEW MAN PAGE!! At long last, the man page has been updated with the new
|
||||||
|
options. Many thanks to Shaleh <shaleh@debian.org> for doing this.
|
||||||
|
- The values "yes" and "no" can now be used as boolean values in options
|
||||||
|
and config file entries, along with 0/1, true/false, and on/off.
|
||||||
|
- Eterm now changes the color of the scrollbar when losing focus. If no
|
||||||
|
unfocused scrollbar color is specified in the config file or on the
|
||||||
|
command line, you will not notice it. See the man page and the default
|
||||||
|
config files for more info.
|
||||||
|
|
||||||
|
Changes in 0.8.7:
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
- The old libmej is now built as a shared library as well as a static one.
|
||||||
|
Also, everything but the main() function has been moved into a library,
|
||||||
|
libEterm. Since most people use lots of Eterms at once, creating a shared
|
||||||
|
library will reduce the text segment of each Eterm significantly, saving
|
||||||
|
quite a bit of memory per Eterm.
|
||||||
|
- Removed MIN_ANCHOR_SIZE and added -a (--min-anchor-size) option. It is 0 by
|
||||||
|
default so ppl won't complain about the scroll-up "bug".
|
||||||
|
- Lots of fixes to Esetroot
|
||||||
|
- CygWin32 support. May take a little bit of effort, but it works.
|
||||||
|
- Escape sequences to toggle transparency and shading, as well as set tint,
|
||||||
|
are in. Toggling transparency works. The others don't yet.
|
||||||
|
- Newer Linux versions required a hack to open the display.
|
||||||
|
- Cleaned up privileges toggling.
|
||||||
|
- Changed the --watch-bg option to --watch-pixmap, which will hopefully make it
|
||||||
|
less tempting for people to think it has something to do with transparency.
|
||||||
|
- Added the --watch-desktop option which causes a pseudo-transparent Eterm to
|
||||||
|
monitor the desktop pixmap for changes and update accordingly.
|
||||||
|
- Several various parser cleanups.
|
||||||
|
- Transparency can now be done via Imlib rather than Xlib. It is markedly slower
|
||||||
|
but offers more configureability, like shading by percentage (--shade-pct) and
|
||||||
|
tinting masks (--tint <24-bit mask>).
|
||||||
|
- Shading now works for 8bpp pseudo-color displays. This formerly generated an
|
||||||
|
error message about the X server not setting the visual info properly. It is
|
||||||
|
not fast by any means, but that's what you get for having an 8bpp video card.
|
||||||
|
- Fixed the menubar code so that the menus aren't clipped by the window or screen
|
||||||
|
edge.
|
||||||
|
- Changed the shell_expand() function in options.c so that \' within single quotes
|
||||||
|
would insert a single quote. This differs from the shell behavior, but I prefer
|
||||||
|
it. :)
|
||||||
|
- More *BSD utmp fixes.
|
||||||
|
- Added debugging features configureable at configure-time. Also added stack
|
||||||
|
tracing on crash.
|
||||||
|
- Fixed the bug with dragging a transparent Eterm across E's desktop dragbar. It
|
||||||
|
reparents to the root window for a bit, but once you drop the window, it changes
|
||||||
|
backdrops right on cue. Also works when moving Eterm windows between desktops.
|
||||||
|
Note that this requires the use of the -W (--watch-desktop) option.
|
||||||
|
- \e[9n prints the pixmap filename in the title bar. In transparency mode, prints
|
||||||
|
transparency info to the title bar.
|
||||||
|
- New --home-on-input option which split off part of --home-on-echo
|
||||||
|
|
||||||
|
Changes in 0.8.8:
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
- Better, more detailed man page. Now if only people would read it....
|
||||||
|
- Shading is now done by percentage, and tinting by hex mask. See the man page for
|
||||||
|
more info.
|
||||||
|
- Lots of new options: --menubar-move, --anim, --pause, --viewport-mode,
|
||||||
|
--xterm-select, and --select-line. See man page for details.
|
||||||
|
- FORCE_BACKSPACE and FORCE_DELETE have been fixed.
|
||||||
|
- KS_DELETE (the strings associated with pressing the Delete key) is now set to ^?
|
||||||
|
by default. If you don't like that, you can set it back, or use the keysym
|
||||||
|
attribute in the config file, or whatever.
|
||||||
|
- --with-cc=prog argument to ./configure to specify an alternative compiler. The
|
||||||
|
default looks for egcs, then pgcc, then gcc, etc.
|
||||||
|
- Eterm-specific escape sequences:
|
||||||
|
Syntax: ESC ] 6 ; <op> ; <arg> BEL
|
||||||
|
|
||||||
|
where <op> is: 0 toggle transparency
|
||||||
|
1 set shade percentage
|
||||||
|
2 set tint mask
|
||||||
|
3 forced update of pseudo-transparent background
|
||||||
|
30 Do not use
|
||||||
|
40 Do not use
|
||||||
|
and <arg> is an optional argument, depending
|
||||||
|
on the particular sequence being used. It
|
||||||
|
(along with its preceeding semicolon) may or
|
||||||
|
may not be needed.
|
||||||
|
- X errors are handled more gracefully and with more helpful information.
|
||||||
|
- The --disable-stack-trace option to ./configure, whose use is obvious.
|
||||||
|
- Added an icon and associated option/attribute.
|
||||||
|
- As always, lots of bug fixes. See the ChangeLog for details.
|
||||||
|
- The -center option for Esetroot. Centers the pixmap.
|
||||||
|
- Eterm is now FHS compliant, meaning that the theme and image directories are
|
||||||
|
now under ${prefix}/share/Eterm instead of ${prefix}/lib/Eterm. See the
|
||||||
|
move-themes script included in the distribution.
|
||||||
|
|
||||||
|
Changes in 0.8.9:
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
- Support for scrolling with mouse wheels.
|
||||||
|
- New --version switch to display compile-time configuration.
|
||||||
|
- Tinting and shading have been sped up by about 30% thanks to Michael Pearson
|
||||||
|
<alcaron@ozemail.com.au>.
|
||||||
|
- Scrollbar type and width is now customizeable at compile-time *and* run-time.
|
||||||
|
Support for NeXT-style scrollbars has also been added.
|
||||||
|
- Three *major* bugs have been fixed. Tiled desktop images no longer cause
|
||||||
|
crashes when tinting or shading. The resize crash bug has also been squished.
|
||||||
|
The secure system() call replacement which was accidentally removed has been
|
||||||
|
added back.
|
||||||
|
- Ctrl-Button1 now grabs input focus. Ctrl-Button2 toggles the scrollbar on and
|
||||||
|
off. Ctrl-Button3 toggles the menubar on and off. NOTE: If you used to
|
||||||
|
disable the menubar by commenting out the loading of the menubar file, or
|
||||||
|
loading a fake one (e.g., '-Mx' or '-M /dev/null'), don't. Simply add "off" to
|
||||||
|
the end of the menu line (e.g., 'menu Eterm.menu off'), or use the new boolean
|
||||||
|
command-line option --menubar (e.g., '--menubar off'). Then you can toggle the
|
||||||
|
menubar using Ctrl-Button3 like you would expect.
|
||||||
|
- Popup scrollbar support has been added.
|
||||||
|
- New -D (--desktop) option for choosing a desktop to start on. Your window
|
||||||
|
manager must be GNOME-compliant for this to work. See the documentation at
|
||||||
|
http://www.gnome.org/devel/gnomewm/ for info on the _WIN_WORKSPACE property.
|
||||||
|
- The Eterm Technical Reference has been completely rewritten. It is now an HTML
|
||||||
|
document located in the doc/ directory.
|
||||||
|
- Lots and lots and lots of new escape sequences. See the Technical Reference for
|
||||||
|
details on them.
|
||||||
|
- Oodles of small bug fixes, as always. :-)
|
||||||
|
- Debugging output is now runtime configurable. Use the --debug option and supply
|
||||||
|
a number. 0 (the default) gives no debugging output. 1-5 give increasingly
|
||||||
|
more output, up to 5 (which I don't recommend using) which synchronizes X events
|
||||||
|
(and slows things down bigtime).
|
||||||
|
- You can now save your current Eterm settings from the menu.
|
||||||
|
- New --app-keypad and --app-cursor options to set the startup mode for
|
||||||
|
application/normal mode for the keypad and cursor keys.
|
||||||
|
- Three new utilities in addition to Esetroot, all of which are located in the
|
||||||
|
utils/ directory. Etbg is a tool for manipulating Eterm's background image on
|
||||||
|
the fly. Etcolors.sh demonstrates all the different combinations of your
|
||||||
|
current color settings. Etmenu.sh lets you send menu commands to Eterm's
|
||||||
|
menubar subsystem without having to type the escape codes yourself.
|
||||||
|
- Borderless Eterms now attempt to use the Window Manager to become borderless
|
||||||
|
instead of bypassing it altogether.
|
||||||
|
|
|
@ -0,0 +1,293 @@
|
||||||
|
/* acconfig.h
|
||||||
|
This file is in the public domain.
|
||||||
|
|
||||||
|
Descriptive text for the C preprocessor macros that
|
||||||
|
the distributed Autoconf macros can define.
|
||||||
|
No software package will use all of them; autoheader copies the ones
|
||||||
|
your configure.in uses into your configuration header file templates.
|
||||||
|
|
||||||
|
The entries are in sort -df order: alphabetical, case insensitive,
|
||||||
|
ignoring punctuation (such as underscores). Although this order
|
||||||
|
can split up related entries, it makes it easier to check whether
|
||||||
|
a given entry is in the file.
|
||||||
|
|
||||||
|
Leave the following blank line there!! Autoheader needs it. */
|
||||||
|
|
||||||
|
|
||||||
|
/* Define if on AIX 3.
|
||||||
|
System headers sometimes define this.
|
||||||
|
We just want to avoid a redefinition error message. */
|
||||||
|
#ifndef _ALL_SOURCE
|
||||||
|
#undef _ALL_SOURCE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Define if using alloca.c. */
|
||||||
|
#undef C_ALLOCA
|
||||||
|
|
||||||
|
/* Define if type char is unsigned and you are not using gcc. */
|
||||||
|
#ifndef __CHAR_UNSIGNED__
|
||||||
|
#undef __CHAR_UNSIGNED__
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Define if the closedir function returns void instead of int. */
|
||||||
|
#undef CLOSEDIR_VOID
|
||||||
|
|
||||||
|
/* Define to empty if the keyword does not work. */
|
||||||
|
#undef const
|
||||||
|
|
||||||
|
/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
|
||||||
|
This function is required for alloca.c support on those systems. */
|
||||||
|
#undef CRAY_STACKSEG_END
|
||||||
|
|
||||||
|
/* Define for DGUX with <sys/dg_sys_info.h>. */
|
||||||
|
#undef DGUX
|
||||||
|
|
||||||
|
/* Define if you have <dirent.h>. */
|
||||||
|
#undef DIRENT
|
||||||
|
|
||||||
|
/* Define to the type of elements in the array set by `getgroups'.
|
||||||
|
Usually this is either `int' or `gid_t'. */
|
||||||
|
#undef GETGROUPS_T
|
||||||
|
|
||||||
|
/* Define if the `getloadavg' function needs to be run setuid or setgid. */
|
||||||
|
#undef GETLOADAVG_PRIVILEGED
|
||||||
|
|
||||||
|
/* Define if the `getpgrp' function takes no argument. */
|
||||||
|
#undef GETPGRP_VOID
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
#undef gid_t
|
||||||
|
|
||||||
|
/* Define if you have alloca, as a function or macro. */
|
||||||
|
#undef HAVE_ALLOCA
|
||||||
|
|
||||||
|
/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
|
||||||
|
#undef HAVE_ALLOCA_H
|
||||||
|
|
||||||
|
/* Define if you don't have vprintf but do have _doprnt. */
|
||||||
|
#undef HAVE_DOPRNT
|
||||||
|
|
||||||
|
/* Define if your system has a working fnmatch function. */
|
||||||
|
#undef HAVE_FNMATCH
|
||||||
|
|
||||||
|
/* Define if your system has its own `getloadavg' function. */
|
||||||
|
#undef HAVE_GETLOADAVG
|
||||||
|
|
||||||
|
/* Define if you have the getmntent function. */
|
||||||
|
#undef HAVE_GETMNTENT
|
||||||
|
|
||||||
|
/* Define if the `long double' type works. */
|
||||||
|
#undef HAVE_LONG_DOUBLE
|
||||||
|
|
||||||
|
/* Define if you support file names longer than 14 characters. */
|
||||||
|
#undef HAVE_LONG_FILE_NAMES
|
||||||
|
|
||||||
|
/* Define if you have a working `mmap' system call. */
|
||||||
|
#undef HAVE_MMAP
|
||||||
|
|
||||||
|
/* Define if system calls automatically restart after interruption
|
||||||
|
by a signal. */
|
||||||
|
#undef HAVE_RESTARTABLE_SYSCALLS
|
||||||
|
|
||||||
|
/* Define if your struct stat has st_blksize. */
|
||||||
|
#undef HAVE_ST_BLKSIZE
|
||||||
|
|
||||||
|
/* Define if your struct stat has st_blocks. */
|
||||||
|
#undef HAVE_ST_BLOCKS
|
||||||
|
|
||||||
|
/* Define if you have the strcoll function and it is properly defined. */
|
||||||
|
#undef HAVE_STRCOLL
|
||||||
|
|
||||||
|
/* Define if your struct stat has st_rdev. */
|
||||||
|
#undef HAVE_ST_RDEV
|
||||||
|
|
||||||
|
/* Define if you have the strftime function. */
|
||||||
|
#undef HAVE_STRFTIME
|
||||||
|
|
||||||
|
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
|
||||||
|
#undef HAVE_SYS_WAIT_H
|
||||||
|
|
||||||
|
/* Define if your struct tm has tm_zone. */
|
||||||
|
#undef HAVE_TM_ZONE
|
||||||
|
|
||||||
|
/* Define if you don't have tm_zone but do have the external array
|
||||||
|
tzname. */
|
||||||
|
#undef HAVE_TZNAME
|
||||||
|
|
||||||
|
/* Define if you have <unistd.h>. */
|
||||||
|
#undef HAVE_UNISTD_H
|
||||||
|
|
||||||
|
/* Define if utime(file, NULL) sets file's timestamp to the present. */
|
||||||
|
#undef HAVE_UTIME_NULL
|
||||||
|
|
||||||
|
/* Define if you have <vfork.h>. */
|
||||||
|
#undef HAVE_VFORK_H
|
||||||
|
|
||||||
|
/* Define if you have the vprintf function. */
|
||||||
|
#undef HAVE_VPRINTF
|
||||||
|
|
||||||
|
/* Define if you have the wait3 system call. */
|
||||||
|
#undef HAVE_WAIT3
|
||||||
|
|
||||||
|
/* Define as __inline if that's what the C compiler calls it. */
|
||||||
|
#undef inline
|
||||||
|
|
||||||
|
/* Define if int is 16 bits instead of 32. */
|
||||||
|
#undef INT_16_BITS
|
||||||
|
|
||||||
|
/* Define if long int is 64 bits. */
|
||||||
|
#undef LONG_64_BITS
|
||||||
|
|
||||||
|
/* Define if major, minor, and makedev are declared in <mkdev.h>. */
|
||||||
|
#undef MAJOR_IN_MKDEV
|
||||||
|
|
||||||
|
/* Define if major, minor, and makedev are declared in <sysmacros.h>. */
|
||||||
|
#undef MAJOR_IN_SYSMACROS
|
||||||
|
|
||||||
|
/* Define if on MINIX. */
|
||||||
|
#undef _MINIX
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
#undef mode_t
|
||||||
|
|
||||||
|
/* Define if you don't have <dirent.h>, but have <ndir.h>. */
|
||||||
|
#undef NDIR
|
||||||
|
|
||||||
|
/* Define if you have <memory.h>, and <string.h> doesn't declare the
|
||||||
|
mem* functions. */
|
||||||
|
#undef NEED_MEMORY_H
|
||||||
|
|
||||||
|
/* Define if your struct nlist has an n_un member. */
|
||||||
|
#undef NLIST_NAME_UNION
|
||||||
|
|
||||||
|
/* Define if you have <nlist.h>. */
|
||||||
|
#undef NLIST_STRUCT
|
||||||
|
|
||||||
|
/* Define if your C compiler doesn't accept -c and -o together. */
|
||||||
|
#undef NO_MINUS_C_MINUS_O
|
||||||
|
|
||||||
|
/* Define to `long' if <sys/types.h> doesn't define. */
|
||||||
|
#undef off_t
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
#undef pid_t
|
||||||
|
|
||||||
|
/* Define if the system does not provide POSIX.1 features except
|
||||||
|
with this defined. */
|
||||||
|
#undef _POSIX_1_SOURCE
|
||||||
|
|
||||||
|
/* Define if you need to in order for stat and other things to work. */
|
||||||
|
#undef _POSIX_SOURCE
|
||||||
|
|
||||||
|
/* Define as the return type of signal handlers (int or void). */
|
||||||
|
#undef RETSIGTYPE
|
||||||
|
|
||||||
|
/* Define if the `setpgrp' function takes no argument. */
|
||||||
|
#undef SETPGRP_VOID
|
||||||
|
|
||||||
|
/* Define if the setvbuf function takes the buffering type as its second
|
||||||
|
argument and the buffer pointer as the third, as on System V
|
||||||
|
before release 3. */
|
||||||
|
#undef SETVBUF_REVERSED
|
||||||
|
|
||||||
|
/* Define to `unsigned' if <sys/types.h> doesn't define. */
|
||||||
|
#undef size_t
|
||||||
|
|
||||||
|
/* If using the C implementation of alloca, define if you know the
|
||||||
|
direction of stack growth for your system; otherwise it will be
|
||||||
|
automatically deduced at run-time.
|
||||||
|
STACK_DIRECTION > 0 => grows toward higher addresses
|
||||||
|
STACK_DIRECTION < 0 => grows toward lower addresses
|
||||||
|
STACK_DIRECTION = 0 => direction of growth unknown
|
||||||
|
*/
|
||||||
|
#undef STACK_DIRECTION
|
||||||
|
|
||||||
|
/* Define if the `S_IS*' macros in <sys/stat.h> do not work properly. */
|
||||||
|
#undef STAT_MACROS_BROKEN
|
||||||
|
|
||||||
|
/* Define if you have the ANSI C header files. */
|
||||||
|
#undef STDC_HEADERS
|
||||||
|
|
||||||
|
/* Define on System V Release 4. */
|
||||||
|
#undef SVR4
|
||||||
|
|
||||||
|
/* Define if you don't have <dirent.h>, but have <sys/dir.h>. */
|
||||||
|
#undef SYSDIR
|
||||||
|
|
||||||
|
/* Define if you don't have <dirent.h>, but have <sys/ndir.h>. */
|
||||||
|
#undef SYSNDIR
|
||||||
|
|
||||||
|
/* Define if `sys_siglist' is declared by <signal.h>. */
|
||||||
|
#undef SYS_SIGLIST_DECLARED
|
||||||
|
|
||||||
|
/* Define if you can safely include both <sys/time.h> and <time.h>. */
|
||||||
|
#undef TIME_WITH_SYS_TIME
|
||||||
|
|
||||||
|
/* Define if your <sys/time.h> declares struct tm. */
|
||||||
|
#undef TM_IN_SYS_TIME
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
#undef uid_t
|
||||||
|
|
||||||
|
/* Define for Encore UMAX. */
|
||||||
|
#undef UMAX
|
||||||
|
|
||||||
|
/* Define for Encore UMAX 4.3 that has <inq_status/cpustats.h>
|
||||||
|
instead of <sys/cpustats.h>. */
|
||||||
|
#undef UMAX4_3
|
||||||
|
|
||||||
|
/* Define if you do not have <strings.h>, index, bzero, etc.. */
|
||||||
|
#undef USG
|
||||||
|
|
||||||
|
/* Define vfork as fork if vfork does not work. */
|
||||||
|
#undef vfork
|
||||||
|
|
||||||
|
/* Define if the closedir function returns void instead of int. */
|
||||||
|
#undef VOID_CLOSEDIR
|
||||||
|
|
||||||
|
/* Define if your processor stores words with the most significant
|
||||||
|
byte first (like Motorola and SPARC, unlike Intel and VAX). */
|
||||||
|
#undef WORDS_BIGENDIAN
|
||||||
|
|
||||||
|
/* Define if the X Window System is missing or not being used. */
|
||||||
|
#undef X_DISPLAY_MISSING
|
||||||
|
|
||||||
|
/* Define if lex declares yytext as a char * by default, not a char[]. */
|
||||||
|
#undef YYTEXT_POINTER
|
||||||
|
|
||||||
|
/* Package name */
|
||||||
|
#undef PACKAGE
|
||||||
|
|
||||||
|
/* Version number */
|
||||||
|
#undef VERSION
|
||||||
|
|
||||||
|
/* Do we want malloc debugging? */
|
||||||
|
#undef WITH_DMALLOC
|
||||||
|
|
||||||
|
/* Linux xdm hack for higher kernel revs */
|
||||||
|
#undef NEED_LINUX_HACK
|
||||||
|
|
||||||
|
/* Do we need our own nanosleep()? */
|
||||||
|
#undef HAVE_NANOSLEEP
|
||||||
|
|
||||||
|
/* Debugging level */
|
||||||
|
#undef DEBUG
|
||||||
|
|
||||||
|
/* Stack tracing tools */
|
||||||
|
#undef NO_STACK_TRACE
|
||||||
|
#undef DBX
|
||||||
|
#undef GDB
|
||||||
|
#undef PSTACK
|
||||||
|
|
||||||
|
/* *BSD utmp stuff */
|
||||||
|
#undef HAVE_LOGIN
|
||||||
|
#undef HAVE_LOGOUT
|
||||||
|
|
||||||
|
/* Do we have the X shape extension? */
|
||||||
|
#undef HAVE_X_SHAPE_EXT
|
||||||
|
|
||||||
|
|
||||||
|
/* Leave that blank line there!! Autoheader needs it.
|
||||||
|
If you're adding to this file, keep in mind:
|
||||||
|
The entries are in sort -df order: alphabetical, case insensitive,
|
||||||
|
ignoring punctuation (such as underscores). */
|
|
@ -0,0 +1,249 @@
|
||||||
|
dnl acl.m4 -- Written by Duncan Simpson <dps@io.stargate.co.uk>
|
||||||
|
dnl Posted to BUGTRAQ on 17 June 1999
|
||||||
|
dnl Used by encouragement. :-)
|
||||||
|
|
||||||
|
dnl Check snprintf for overrun potential
|
||||||
|
AC_DEFUN(dps_snprintf_oflow,
|
||||||
|
[AC_MSG_CHECKING(whether snprintf ignores n)
|
||||||
|
AC_CACHE_VAL(dps_cv_snprintf_bug,
|
||||||
|
[AC_TRY_RUN(
|
||||||
|
changequote(<<, >>)dnl
|
||||||
|
<<#include <stdio.h>
|
||||||
|
|
||||||
|
#ifndef HAVE_SNPRINTF
|
||||||
|
#ifdef HAVE_VSNPRINTF
|
||||||
|
#include "vsnprintf.h"
|
||||||
|
#else /* not HAVE_VSNPRINTF */
|
||||||
|
#include "vsnprintf.c"
|
||||||
|
#endif /* HAVE_VSNPRINTF */
|
||||||
|
#endif /* HAVE_SNPRINTF */
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
char ovbuf[7];
|
||||||
|
int i;
|
||||||
|
for (i=0; i<7; i++) ovbuf[i]='x';
|
||||||
|
snprintf(ovbuf, 4,"foo%s", "bar");
|
||||||
|
if (ovbuf[5]!='x') exit(1);
|
||||||
|
snprintf(ovbuf, 4,"foo%d", 666);
|
||||||
|
if (ovbuf[5]!='x') exit(1);
|
||||||
|
exit(0);
|
||||||
|
} >>
|
||||||
|
changequote([, ]), dps_cv_snprintf_bug=0, dps_cv_snprintf_bug=1,
|
||||||
|
dps_cv_snprintf_bug=2)])
|
||||||
|
if test $dps_cv_snprintf_bug -eq 0; then
|
||||||
|
AC_MSG_RESULT([no, snprintf is ok])
|
||||||
|
else if test $dps_cv_snprint_bug -eq 1; then
|
||||||
|
AC_MSG_RESULT([yes, snprintf is broken])
|
||||||
|
AC_DEFINE(HAVE_SNPRINTF_BUG,1)
|
||||||
|
else
|
||||||
|
AC_MSG_RESULT([unknown, assuming yes])
|
||||||
|
AC_DEFINE(HAVE_SNPRINTF_BUG,1)
|
||||||
|
fi; fi])
|
||||||
|
|
||||||
|
dnl Check vsnprintf for overrun potential
|
||||||
|
AC_DEFUN(dps_vsnprintf_oflow,
|
||||||
|
[AC_MSG_CHECKING(whether vsnprintf ignores n)
|
||||||
|
AC_CACHE_VAL(dps_cv_vsnprintf_bug,
|
||||||
|
[AC_TRY_RUN(
|
||||||
|
changequote(<<, >>)dnl
|
||||||
|
<<#include <stdio.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
#ifndef HAVE_VSNPRINTF
|
||||||
|
#include "vsnprintf.c"
|
||||||
|
#endif /* HAVE_VSNPRINTF */
|
||||||
|
|
||||||
|
int prnt(char *s, const char *fmt, ...)
|
||||||
|
{
|
||||||
|
va_list argp;
|
||||||
|
va_start(argp, fmt);
|
||||||
|
vsnprintf(s, 4, fmt, argp);
|
||||||
|
va_end(argp);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
char ovbuf[7];
|
||||||
|
int i;
|
||||||
|
for (i=0; i<7; i++) ovbuf[i]='x';
|
||||||
|
prnt(ovbuf, "foo%s", "bar");
|
||||||
|
if (ovbuf[5]!='x') exit(1);
|
||||||
|
prnt(ovbuf, "foo%d", 666);
|
||||||
|
if (ovbuf[5]!='x') exit(1);
|
||||||
|
exit(0);
|
||||||
|
} >>
|
||||||
|
changequote([, ]), dps_cv_vsnprintf_bug=0, dps_cv_vsnprintf_bug=1,
|
||||||
|
dps_cv_vsnprintf_bug=2)])
|
||||||
|
|
||||||
|
if test $dps_cv_vsnprintf_bug -eq 0; then
|
||||||
|
AC_MSG_RESULT([no, vsnprintf is ok])
|
||||||
|
else if test $dps_cv_vsnprint_bug -eq 1; then
|
||||||
|
AC_MSG_RESULT([yes, vsnprintf is broken])
|
||||||
|
AC_DEFINE(HAVE_VSNPRINTF_BUG,1)
|
||||||
|
else
|
||||||
|
AC_MSG_RESULT([unknown, assuming yes])
|
||||||
|
AC_DEFINE(HAVE_VSNPRINTF_BUG,1)
|
||||||
|
fi; fi])
|
||||||
|
|
||||||
|
dnl open and symlink interaction bug test
|
||||||
|
AC_DEFUN(dps_symlink_open_bug,
|
||||||
|
[AC_MSG_CHECKING(security of interaction between symlink and open)
|
||||||
|
AC_CACHE_VAL(dps_cv_symlink_open_bug,
|
||||||
|
[mkdir conftest.d
|
||||||
|
AC_TRY_RUN(
|
||||||
|
changequote(<<, >>)dnl
|
||||||
|
<<#include <stdio.h>
|
||||||
|
#ifdef HAVE_STDLIB_H
|
||||||
|
#include <stdlib.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_SYS_TYPES_H
|
||||||
|
#include <sys/types.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_SYS_STAT_H
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_FCNTL_H
|
||||||
|
#include <fcntl.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_ERRNO_H
|
||||||
|
#include <errno.h>
|
||||||
|
#else
|
||||||
|
extern int errno;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
int fd;
|
||||||
|
if (chdir("conftest.d")!=0)
|
||||||
|
exit(1);
|
||||||
|
if (symlink("foo","bar")!=0)
|
||||||
|
exit(1);
|
||||||
|
if ((fd=open("bar", O_CREAT | O_EXCL | O_WRONLY, 0700))==0)
|
||||||
|
{
|
||||||
|
write(fd, "If the symlink was to .rhosts you would be unhappy", 50);
|
||||||
|
close(fd);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (errno!=EEXIST)
|
||||||
|
exit(1);
|
||||||
|
exit(0);
|
||||||
|
} >>
|
||||||
|
changequote([, ]), cps_cv_symlink_open_bug=0,
|
||||||
|
[if test -r conftest.d/foo; then
|
||||||
|
cps_cv_symlink_open_bug=2
|
||||||
|
else
|
||||||
|
cps_cv_symlink_open_bug=1
|
||||||
|
fi], cps_cv_symlink_open_buf=3)
|
||||||
|
rm -rf conftest.d])
|
||||||
|
case "$cps_cv_symlink_open_bug" in
|
||||||
|
0) AC_MSG_RESULT(secure) ;;
|
||||||
|
1) AC_MSG_RESULT(errno wrong but ok)
|
||||||
|
AC_DEFINE(HAVE_SYMLINK_OPEN_ERRNO_BUG) ;;
|
||||||
|
2) AC_MSG_RESULT(insecure)
|
||||||
|
AC_DEFINE(HAVE_SYMLINK_OPEN_SECURITY_HOLE)
|
||||||
|
AC_DEFINE(HAVE_SYMLINK_OPEN_ERRNO_BUG) ;;
|
||||||
|
3) AC_MSG_RESULT(assuming insecure)
|
||||||
|
AC_DEFINE(HAVE_SYMLINK_OPEN_SECURITY_HOLE)
|
||||||
|
AC_DEFINE(HAVE_SYMLINK_OPEN_ERRNO_BUG) ;;
|
||||||
|
*) AC_MSG_RESULT($cps_cv_symlink_open_bug)
|
||||||
|
AC_MSG_ERROR(Impossible value of cps_cv_symlink_open_bug) ;;
|
||||||
|
esac])
|
||||||
|
|
||||||
|
dnl Check to RLIMIT_NPROC resource limit
|
||||||
|
AC_DEFUN(dps_rlimit_nproc,
|
||||||
|
[AC_MSG_CHECKING(for working RLIMIT_NPROC resource limit)
|
||||||
|
AC_CACHE_VAL(dps_cv_rlimit_nproc,
|
||||||
|
[AC_TRY_RUN(
|
||||||
|
changequote(<<, >>)dnl
|
||||||
|
<<
|
||||||
|
#ifndef HAVE_STDLIB_H
|
||||||
|
#include <stdlib.h>
|
||||||
|
#endif /* HAVE_STDLIB_H */
|
||||||
|
#ifndef HAVE_SIGNAL_H
|
||||||
|
#include <signal.h>
|
||||||
|
#endif /* HAVE_SIGNAL_H */
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif /* HAVE_UNISTD_H */
|
||||||
|
#ifdef HAVE_SYS_RESOURCE_H
|
||||||
|
#include <sys/resource.h>
|
||||||
|
#endif /* HAVE_SYS_RESOURCE_H */
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
#ifdef RLIMIT_NPROC
|
||||||
|
static const struct rlimit pid_lim={RLIMIT_NPROC, 1};
|
||||||
|
pid_t f;
|
||||||
|
|
||||||
|
signal(SIGCHLD, SIG_IGN);
|
||||||
|
setrlimit(RLIMIT_NPROC, (struct rlimit *) &pid_lim);
|
||||||
|
if ((f=fork())==0)
|
||||||
|
exit(0);
|
||||||
|
if (f==-1)
|
||||||
|
exit(0); /* The fork() failed (the right thing) */
|
||||||
|
#endif
|
||||||
|
exit(1);
|
||||||
|
} >>
|
||||||
|
changequote([, ]), cps_cv_rlimit_nproc=0, cps_cv_rlimit_nproc=1,
|
||||||
|
cps_cv_rlimit_nproc=2)])
|
||||||
|
if test $cps_cv_rlimit_nproc -eq 0; then
|
||||||
|
AC_MSG_RESULT([yes])
|
||||||
|
AC_DEFINE(HAVE_RLIMIT_NPROC,1)
|
||||||
|
else if test $cps_cv_rlimit_nproc -eq 1; then
|
||||||
|
AC_MSG_RESULT([no])
|
||||||
|
else
|
||||||
|
AC_MSG_RESULT([unknown, assuming none])
|
||||||
|
fi; fi])
|
||||||
|
|
||||||
|
dnl Check to RLIMIT_MEMLOCK resource limit
|
||||||
|
AC_DEFUN(cps_rlimit_memlock,
|
||||||
|
[AC_MSG_CHECKING(for RLIMIT_MEMLOCK resource limit)
|
||||||
|
AC_CACHE_VAL(cps_cv_rlimit_memlock,
|
||||||
|
[AC_TRY_RUN(
|
||||||
|
changequote(<<, >>)dnl
|
||||||
|
<<
|
||||||
|
#ifndef HAVE_STDLIB_H
|
||||||
|
#include <stdlib.h>
|
||||||
|
#endif /* HAVE_STDLIB_H */
|
||||||
|
#ifndef HAVE_SIGNAL_H
|
||||||
|
#include <signal.h>
|
||||||
|
#endif /* HAVE_SIGNAL_H */
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif /* HAVE_UNISTD_H */
|
||||||
|
#ifdef HAVE_SYS_RESOURCE_H
|
||||||
|
#include <sys/resource.h>
|
||||||
|
#endif /* HAVE_SYS_RESOURCE_H */
|
||||||
|
#ifdef HAVE_SYS_MMAN
|
||||||
|
#include <sys/mman.h>
|
||||||
|
#endif /* HAVE_SYS_MMAN */
|
||||||
|
#ifdef HAVE_ERRNO_H
|
||||||
|
#include <errno.h>
|
||||||
|
#endif /* HAVE_ERRNO_H */
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
#ifdef RLIMIT_MEMLOCK
|
||||||
|
static const struct rlimit mlock_lim={RLIMIT_MEMLOCK, 0};
|
||||||
|
void *memory;
|
||||||
|
|
||||||
|
if (setrlimit(RLIMIT_MEMLOCK, (struct rlimit *) &mlock_lim)!=-1)
|
||||||
|
exit(0);
|
||||||
|
#endif
|
||||||
|
exit(1);
|
||||||
|
} >>
|
||||||
|
changequote([, ]), cps_cv_rlimit_memlock=0, cps_cv_rlimit_memlock=1,
|
||||||
|
cps_cv_rlimit_memlock=2)])
|
||||||
|
if test $cps_cv_rlimit_memlock -eq 0; then
|
||||||
|
AC_MSG_RESULT([yes])
|
||||||
|
AC_DEFINE(HAVE_RLIMIT_MEMLOCK,1)
|
||||||
|
else if test $cps_cv_rlimit_memlock -eq 1; then
|
||||||
|
AC_MSG_RESULT([no])
|
||||||
|
else
|
||||||
|
AC_MSG_RESULT([unknown, assuming none])
|
||||||
|
fi; fi])
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# Run this to generate all the initial makefiles, etc.
|
||||||
|
# $Id$
|
||||||
|
|
||||||
|
DIE=0
|
||||||
|
|
||||||
|
(autoconf --version) < /dev/null > /dev/null 2>&1 || {
|
||||||
|
echo
|
||||||
|
echo "You must have autoconf installed to compile Eterm."
|
||||||
|
echo "Download the appropriate package for your distribution,"
|
||||||
|
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
|
||||||
|
DIE=1
|
||||||
|
}
|
||||||
|
|
||||||
|
(libtool --version) < /dev/null > /dev/null 2>&1 || {
|
||||||
|
echo
|
||||||
|
echo "You must have libtool installed to compile Eterm."
|
||||||
|
echo "Download the appropriate package for your distribution,"
|
||||||
|
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
|
||||||
|
DIE=1
|
||||||
|
}
|
||||||
|
|
||||||
|
(automake --version) < /dev/null > /dev/null 2>&1 || {
|
||||||
|
echo
|
||||||
|
echo "You must have automake installed to compile Eterm."
|
||||||
|
echo "Download the appropriate package for your distribution,"
|
||||||
|
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
|
||||||
|
DIE=1
|
||||||
|
}
|
||||||
|
|
||||||
|
if test "$DIE" -eq 1; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
libtoolize --copy --force
|
||||||
|
aclocal $ACLOCAL_FLAGS
|
||||||
|
automake --add-missing
|
||||||
|
autoconf
|
||||||
|
autoheader
|
||||||
|
|
||||||
|
if [ -x config.status -a -z "$*" ]; then
|
||||||
|
./config.status --recheck
|
||||||
|
else
|
||||||
|
if test -z "$*"; then
|
||||||
|
echo "I am going to run ./configure with no arguments - if you wish "
|
||||||
|
echo "to pass any to it, please specify them on the $0 command line."
|
||||||
|
echo "If you do not wish to run ./configure, press Ctrl-C now."
|
||||||
|
trap 'echo "configure aborted" ; exit 0' 1 2 15
|
||||||
|
sleep 1
|
||||||
|
fi
|
||||||
|
./configure "$@"
|
||||||
|
fi
|
|
@ -0,0 +1,42 @@
|
||||||
|
# $Id$
|
||||||
|
|
||||||
|
DIRS = tile scale
|
||||||
|
EXTRA_DIST = tile/014.png tile/circuit.png tile/backwave.jpg tile/button1.jpg tile/button5.jpg \
|
||||||
|
tile/nebula.jpg scale/fourthday.jpg scale/gaia.jpg scale/galleon.jpg scale/night_of_the_dragon.jpg \
|
||||||
|
README.backgrounds
|
||||||
|
pixmapdir = $(pkgdatadir)/pix
|
||||||
|
themedir = $(pkgdatadir)/themes
|
||||||
|
|
||||||
|
all: Makefile
|
||||||
|
@echo "*** Generating pixmaps.list file from images in tile/ and scale/..."
|
||||||
|
@true > pixmaps.list
|
||||||
|
@cd tile ; \
|
||||||
|
for i in `ls -1 | grep -v CVS | grep -v \.cvsignore` ; do \
|
||||||
|
echo '" 0 0 '$$i'"' >> ../pixmaps.list ; \
|
||||||
|
done ; \
|
||||||
|
cd .. ; \
|
||||||
|
cd scale ; \
|
||||||
|
for i in `ls -1 | grep -v CVS | grep -v \.cvsignore` ; do \
|
||||||
|
echo '"-1 -1 '$$i'"' >> ../pixmaps.list ; \
|
||||||
|
done
|
||||||
|
|
||||||
|
install-data-hook:
|
||||||
|
@if test ! -f pixmaps.list ; then $(MAKE) all ; fi
|
||||||
|
$(mkinstalldirs) $(DESTDIR)$(pixmapdir)
|
||||||
|
@for j in $(DIRS) ; do echo "Installing pixmaps in $$j" ; cd $$j ; \
|
||||||
|
for i in `ls -1 | grep -v CVS | grep -v \.cvsignore` ; do \
|
||||||
|
echo $(INSTALL_DATA) $$i $(DESTDIR)${pixmapdir} ; \
|
||||||
|
$(INSTALL_DATA) $$i $(DESTDIR)${pixmapdir} ; \
|
||||||
|
done ; cd .. ; \
|
||||||
|
done
|
||||||
|
@if test -f $(DESTDIR)${pixmapdir}/pixmaps.list ; then \
|
||||||
|
$(CP) -p $(DESTDIR)${pixmapdir}/pixmaps.list $(DESTDIR)${pixmapdir}/pixmaps.list.old ; \
|
||||||
|
echo "WARNING: Backup of existing pixmaps.list created." ; \
|
||||||
|
fi
|
||||||
|
$(INSTALL_DATA) pixmaps.list $(DESTDIR)${pixmapdir}
|
||||||
|
@for i in `ls -1d $(DESTDIR)${themedir}/*` ; do \
|
||||||
|
if test $$i != "." -a $$i != ".." -a ! -f $$i/pixmaps.list ; then \
|
||||||
|
echo "$(LN_S) ../../pix/pixmaps.list $$i/pixmaps.list" ; \
|
||||||
|
$(LN_S) ../../pix/pixmaps.list $$i/pixmaps.list ; \
|
||||||
|
fi ; \
|
||||||
|
done
|
|
@ -0,0 +1,252 @@
|
||||||
|
# Makefile.in generated automatically by automake 1.4 from Makefile.am
|
||||||
|
|
||||||
|
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
|
||||||
|
# This Makefile.in is free software; the Free Software Foundation
|
||||||
|
# gives unlimited permission to copy and/or distribute it,
|
||||||
|
# with or without modifications, as long as this notice is preserved.
|
||||||
|
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||||
|
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
# PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
# $Id$
|
||||||
|
|
||||||
|
|
||||||
|
SHELL = @SHELL@
|
||||||
|
|
||||||
|
srcdir = @srcdir@
|
||||||
|
top_srcdir = @top_srcdir@
|
||||||
|
VPATH = @srcdir@
|
||||||
|
prefix = @prefix@
|
||||||
|
exec_prefix = @exec_prefix@
|
||||||
|
|
||||||
|
bindir = @bindir@
|
||||||
|
sbindir = @sbindir@
|
||||||
|
libexecdir = @libexecdir@
|
||||||
|
datadir = @datadir@
|
||||||
|
sysconfdir = @sysconfdir@
|
||||||
|
sharedstatedir = @sharedstatedir@
|
||||||
|
localstatedir = @localstatedir@
|
||||||
|
libdir = @libdir@
|
||||||
|
infodir = @infodir@
|
||||||
|
mandir = @mandir@
|
||||||
|
includedir = @includedir@
|
||||||
|
oldincludedir = /usr/include
|
||||||
|
|
||||||
|
DESTDIR =
|
||||||
|
|
||||||
|
pkgdatadir = $(datadir)/@PACKAGE@
|
||||||
|
pkglibdir = $(libdir)/@PACKAGE@
|
||||||
|
pkgincludedir = $(includedir)/@PACKAGE@
|
||||||
|
|
||||||
|
top_builddir = ..
|
||||||
|
|
||||||
|
ACLOCAL = @ACLOCAL@
|
||||||
|
AUTOCONF = @AUTOCONF@
|
||||||
|
AUTOMAKE = @AUTOMAKE@
|
||||||
|
AUTOHEADER = @AUTOHEADER@
|
||||||
|
|
||||||
|
INSTALL = @INSTALL@
|
||||||
|
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
|
||||||
|
INSTALL_DATA = @INSTALL_DATA@
|
||||||
|
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||||
|
transform = @program_transform_name@
|
||||||
|
|
||||||
|
NORMAL_INSTALL = :
|
||||||
|
PRE_INSTALL = :
|
||||||
|
POST_INSTALL = :
|
||||||
|
NORMAL_UNINSTALL = :
|
||||||
|
PRE_UNINSTALL = :
|
||||||
|
POST_UNINSTALL = :
|
||||||
|
host_alias = @host_alias@
|
||||||
|
host_triplet = @host@
|
||||||
|
AR = @AR@
|
||||||
|
AS = @AS@
|
||||||
|
AUTHORS = @AUTHORS@
|
||||||
|
CC = @CC@
|
||||||
|
CFLAGS = @CFLAGS@
|
||||||
|
CHMOD = @CHMOD@
|
||||||
|
CP = @CP@
|
||||||
|
CPP = @CPP@
|
||||||
|
CPPFLAGS = @CPPFLAGS@
|
||||||
|
CTAGS = @CTAGS@
|
||||||
|
DATE = @DATE@
|
||||||
|
DBX = @DBX@
|
||||||
|
DIST_ROOT = @DIST_ROOT@
|
||||||
|
DLLTOOL = @DLLTOOL@
|
||||||
|
EGCS = @EGCS@
|
||||||
|
FEATURE_CMD = @FEATURE_CMD@
|
||||||
|
GDB = @GDB@
|
||||||
|
GRLIBS = @GRLIBS@
|
||||||
|
IMLIB_CONFIG = @IMLIB_CONFIG@
|
||||||
|
LD = @LD@
|
||||||
|
LDFLAGS = @LDFLAGS@
|
||||||
|
LIBS = @LIBS@
|
||||||
|
LIBTOOL = @LIBTOOL@
|
||||||
|
LN_S = @LN_S@
|
||||||
|
MAINT = @MAINT@
|
||||||
|
MAKEINFO = @MAKEINFO@
|
||||||
|
MKDIR = @MKDIR@
|
||||||
|
MV = @MV@
|
||||||
|
NM = @NM@
|
||||||
|
OBJDUMP = @OBJDUMP@
|
||||||
|
PACKAGE = @PACKAGE@
|
||||||
|
PGCC = @PGCC@
|
||||||
|
PSTACK = @PSTACK@
|
||||||
|
RANLIB = @RANLIB@
|
||||||
|
RM = @RM@
|
||||||
|
SED = @SED@
|
||||||
|
TAR = @TAR@
|
||||||
|
THREADLIBS = @THREADLIBS@
|
||||||
|
VERSION = @VERSION@
|
||||||
|
|
||||||
|
DIRS = tile scale
|
||||||
|
EXTRA_DIST = tile/014.png tile/circuit.png tile/backwave.jpg tile/button1.jpg tile/button5.jpg tile/nebula.jpg scale/fourthday.jpg scale/gaia.jpg scale/galleon.jpg scale/night_of_the_dragon.jpg README.backgrounds
|
||||||
|
|
||||||
|
pixmapdir = $(pkgdatadir)/pix
|
||||||
|
themedir = $(pkgdatadir)/themes
|
||||||
|
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||||
|
CONFIG_HEADER = ../config.h
|
||||||
|
CONFIG_CLEAN_FILES =
|
||||||
|
DIST_COMMON = Makefile.am Makefile.in
|
||||||
|
|
||||||
|
|
||||||
|
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||||
|
|
||||||
|
GZIP_ENV = --best
|
||||||
|
all: all-redirect
|
||||||
|
.SUFFIXES:
|
||||||
|
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||||
|
cd $(top_srcdir) && $(AUTOMAKE) --gnu bg/Makefile
|
||||||
|
|
||||||
|
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||||
|
cd $(top_builddir) \
|
||||||
|
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||||
|
|
||||||
|
tags: TAGS
|
||||||
|
TAGS:
|
||||||
|
|
||||||
|
|
||||||
|
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||||
|
|
||||||
|
subdir = bg
|
||||||
|
|
||||||
|
distdir: $(DISTFILES)
|
||||||
|
here=`cd $(top_builddir) && pwd`; \
|
||||||
|
top_distdir=`cd $(top_distdir) && pwd`; \
|
||||||
|
distdir=`cd $(distdir) && pwd`; \
|
||||||
|
cd $(top_srcdir) \
|
||||||
|
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu bg/Makefile
|
||||||
|
$(mkinstalldirs) $(distdir)/scale $(distdir)/tile
|
||||||
|
@for file in $(DISTFILES); do \
|
||||||
|
d=$(srcdir); \
|
||||||
|
if test -d $$d/$$file; then \
|
||||||
|
cp -pr $$/$$file $(distdir)/$$file; \
|
||||||
|
else \
|
||||||
|
test -f $(distdir)/$$file \
|
||||||
|
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||||
|
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||||
|
fi; \
|
||||||
|
done
|
||||||
|
info-am:
|
||||||
|
info: info-am
|
||||||
|
dvi-am:
|
||||||
|
dvi: dvi-am
|
||||||
|
check-am: all-am
|
||||||
|
check: check-am
|
||||||
|
installcheck-am:
|
||||||
|
installcheck: installcheck-am
|
||||||
|
install-exec-am:
|
||||||
|
install-exec: install-exec-am
|
||||||
|
|
||||||
|
install-data-am:
|
||||||
|
@$(NORMAL_INSTALL)
|
||||||
|
$(MAKE) $(AM_MAKEFLAGS) install-data-hook
|
||||||
|
install-data: install-data-am
|
||||||
|
|
||||||
|
install-am: all-am
|
||||||
|
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||||
|
install: install-am
|
||||||
|
uninstall-am:
|
||||||
|
uninstall: uninstall-am
|
||||||
|
all-am: Makefile
|
||||||
|
all-redirect: all-am
|
||||||
|
install-strip:
|
||||||
|
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
|
||||||
|
installdirs:
|
||||||
|
|
||||||
|
|
||||||
|
mostlyclean-generic:
|
||||||
|
|
||||||
|
clean-generic:
|
||||||
|
|
||||||
|
distclean-generic:
|
||||||
|
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
||||||
|
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||||
|
|
||||||
|
maintainer-clean-generic:
|
||||||
|
mostlyclean-am: mostlyclean-generic
|
||||||
|
|
||||||
|
mostlyclean: mostlyclean-am
|
||||||
|
|
||||||
|
clean-am: clean-generic mostlyclean-am
|
||||||
|
|
||||||
|
clean: clean-am
|
||||||
|
|
||||||
|
distclean-am: distclean-generic clean-am
|
||||||
|
-rm -f libtool
|
||||||
|
|
||||||
|
distclean: distclean-am
|
||||||
|
|
||||||
|
maintainer-clean-am: maintainer-clean-generic distclean-am
|
||||||
|
@echo "This command is intended for maintainers to use;"
|
||||||
|
@echo "it deletes files that may require special tools to rebuild."
|
||||||
|
|
||||||
|
maintainer-clean: maintainer-clean-am
|
||||||
|
|
||||||
|
.PHONY: tags distdir info-am info dvi-am dvi check check-am \
|
||||||
|
installcheck-am installcheck install-exec-am install-exec \
|
||||||
|
install-data-am install-data install-am install uninstall-am uninstall \
|
||||||
|
all-redirect all-am all installdirs mostlyclean-generic \
|
||||||
|
distclean-generic clean-generic maintainer-clean-generic clean \
|
||||||
|
mostlyclean distclean maintainer-clean
|
||||||
|
|
||||||
|
|
||||||
|
all: Makefile
|
||||||
|
@echo "*** Generating pixmaps.list file from images in tile/ and scale/..."
|
||||||
|
@true > pixmaps.list
|
||||||
|
@cd tile ; \
|
||||||
|
for i in `ls -1 | grep -v CVS | grep -v \.cvsignore` ; do \
|
||||||
|
echo '" 0 0 '$$i'"' >> ../pixmaps.list ; \
|
||||||
|
done ; \
|
||||||
|
cd .. ; \
|
||||||
|
cd scale ; \
|
||||||
|
for i in `ls -1 | grep -v CVS | grep -v \.cvsignore` ; do \
|
||||||
|
echo '"-1 -1 '$$i'"' >> ../pixmaps.list ; \
|
||||||
|
done
|
||||||
|
|
||||||
|
install-data-hook:
|
||||||
|
@if test ! -f pixmaps.list ; then $(MAKE) all ; fi
|
||||||
|
$(mkinstalldirs) $(DESTDIR)$(pixmapdir)
|
||||||
|
@for j in $(DIRS) ; do echo "Installing pixmaps in $$j" ; cd $$j ; \
|
||||||
|
for i in `ls -1 | grep -v CVS | grep -v \.cvsignore` ; do \
|
||||||
|
echo $(INSTALL_DATA) $$i $(DESTDIR)${pixmapdir} ; \
|
||||||
|
$(INSTALL_DATA) $$i $(DESTDIR)${pixmapdir} ; \
|
||||||
|
done ; cd .. ; \
|
||||||
|
done
|
||||||
|
@if test -f $(DESTDIR)${pixmapdir}/pixmaps.list ; then \
|
||||||
|
$(CP) -p $(DESTDIR)${pixmapdir}/pixmaps.list $(DESTDIR)${pixmapdir}/pixmaps.list.old ; \
|
||||||
|
echo "WARNING: Backup of existing pixmaps.list created." ; \
|
||||||
|
fi
|
||||||
|
$(INSTALL_DATA) pixmaps.list $(DESTDIR)${pixmapdir}
|
||||||
|
@for i in `ls -1d $(DESTDIR)${themedir}/*` ; do \
|
||||||
|
if test $$i != "." -a $$i != ".." -a ! -f $$i/pixmaps.list ; then \
|
||||||
|
echo "$(LN_S) ../../pix/pixmaps.list $$i/pixmaps.list" ; \
|
||||||
|
$(LN_S) ../../pix/pixmaps.list $$i/pixmaps.list ; \
|
||||||
|
fi ; \
|
||||||
|
done
|
||||||
|
|
||||||
|
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||||
|
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||||
|
.NOEXPORT:
|
|
@ -0,0 +1,34 @@
|
||||||
|
Eterm Background Archive
|
||||||
|
========================
|
||||||
|
|
||||||
|
This is the official (<G>) collection of Eterm background images. The only
|
||||||
|
things that make it official are (1) I put it together, and (2) the default
|
||||||
|
themes that come with Eterm are designed to work with these images. NONE of
|
||||||
|
these images are original work by either of the Eterm authors; they have all
|
||||||
|
been collected from various sites on the web. As far as I know, they are all
|
||||||
|
freely available for use.
|
||||||
|
|
||||||
|
However, should any person who can provide proof of ownership of any of these
|
||||||
|
pictures object to their inclusion, they will be IMMEDIATELY withdrawn. No
|
||||||
|
copyright infringement is intended. Inclusion here should be taken as a
|
||||||
|
compliment. :-)
|
||||||
|
|
||||||
|
Installation
|
||||||
|
------------
|
||||||
|
|
||||||
|
Now that this is included with the Eterm distribution, these images will be
|
||||||
|
cataloged and installed as part of the normal Eterm build process.
|
||||||
|
|
||||||
|
Changes
|
||||||
|
-------
|
||||||
|
|
||||||
|
Adding pictures to the archive is equally simple. If the picture is intended
|
||||||
|
to be tiled, copy it into the "tile" directory. If it is intended to be scaled
|
||||||
|
(i.e., non-tileable pictures), copy it into the "scale" directory. Then re-run
|
||||||
|
"make" and "make install". That's it! The images will automatically be
|
||||||
|
included in Eterm's random rotation.
|
||||||
|
|
||||||
|
Removing pictures is done the same way. Simply remove them from whichever
|
||||||
|
directory they reside in, then re-run "make" and "make install". You will need
|
||||||
|
to manually remove the file from the pixmap directory if you so desire; these
|
||||||
|
instructions only pertain to changing the standard rotation.
|
|
@ -0,0 +1,4 @@
|
||||||
|
*.jpg
|
||||||
|
*.png
|
||||||
|
*.gif
|
||||||
|
*.list
|
|
@ -0,0 +1,4 @@
|
||||||
|
*.jpg
|
||||||
|
*.png
|
||||||
|
*.gif
|
||||||
|
*.list
|
|
@ -0,0 +1,387 @@
|
||||||
|
dnl# $Id$
|
||||||
|
|
||||||
|
AC_INIT(src/feature.h.in)
|
||||||
|
AM_INIT_AUTOMAKE(Eterm, 0.8.9)
|
||||||
|
|
||||||
|
dnl# Set some basic variables
|
||||||
|
DATE="21 January 1999"
|
||||||
|
AC_SUBST(DATE)
|
||||||
|
AUTHORS="Tuomo Venalainen (vendu@cc.hut.fi) and Michael Jennings (mej@tcserv.com)"
|
||||||
|
AC_SUBST(AUTHORS)
|
||||||
|
|
||||||
|
dnl# Supply default CFLAGS, if not specified by `CFLAGS=flags ./configure'
|
||||||
|
if test ! -z "${CFLAGS}" -o ! -z "${CCOPTS}"; then
|
||||||
|
CFLAGS_GIVEN=1
|
||||||
|
else
|
||||||
|
CFLAGS_GIVEN=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test -z "${CFLAGS}"; then
|
||||||
|
if test -z "${CCOPTS}"; then
|
||||||
|
CCOPTS="-O"
|
||||||
|
fi
|
||||||
|
CFLAGS="$CCOPTS"
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_ARG_WITH(cc, [ --with-cc=compiler force Eterm to build with a particular compiler (like pgcc, egcs, etc.)],
|
||||||
|
CC=$withval,
|
||||||
|
if test -z "$CC"; then
|
||||||
|
CC=check
|
||||||
|
fi
|
||||||
|
)
|
||||||
|
|
||||||
|
if test "$CC" = "check"; then
|
||||||
|
dnl# Check for Pentium compilers
|
||||||
|
AC_CHECK_PROG(EGCS, egcs, egcs)
|
||||||
|
AC_CHECK_PROG(PGCC, pgcc, pgcc)
|
||||||
|
|
||||||
|
if test ! -z "$EGCS"; then
|
||||||
|
CC=$EGCS
|
||||||
|
elif test ! -z "$PGCC"; then
|
||||||
|
CC=$PGCC
|
||||||
|
else
|
||||||
|
unset CC
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_PROG_CC
|
||||||
|
AC_PROG_CPP
|
||||||
|
|
||||||
|
dnl# These must be run after AC_PROG_CC but before any other macros that use
|
||||||
|
dnl# the C compiler
|
||||||
|
AC_AIX
|
||||||
|
AC_ISC_POSIX
|
||||||
|
AC_MINIX
|
||||||
|
|
||||||
|
dnl# At least make the attempt to support CygWin32
|
||||||
|
AC_CYGWIN
|
||||||
|
AC_ARG_PROGRAM
|
||||||
|
|
||||||
|
AM_PROG_LIBTOOL
|
||||||
|
|
||||||
|
dnl# Where are we?
|
||||||
|
AC_MSG_CHECKING(for distribution root)
|
||||||
|
DIST_ROOT=`pwd`
|
||||||
|
AC_SUBST(DIST_ROOT)
|
||||||
|
AC_MSG_RESULT($DIST_ROOT)
|
||||||
|
|
||||||
|
AC_GCC_TRADITIONAL
|
||||||
|
|
||||||
|
dnl # If using gcc, use -O2. If -g works with it, use that too
|
||||||
|
if test "${CFLAGS_GIVEN}" -ne 1; then
|
||||||
|
if test "$GCC" = "yes"; then
|
||||||
|
if test "$ac_cv_prog_cc_g" = "yes"; then
|
||||||
|
CCOPTS='-g -O2'
|
||||||
|
else
|
||||||
|
CCOPTS='-O2'
|
||||||
|
fi
|
||||||
|
CFLAGS="$CCOPTS"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_PROG_INSTALL
|
||||||
|
|
||||||
|
dnl# Check for host system type
|
||||||
|
AC_CANONICAL_HOST
|
||||||
|
|
||||||
|
dnl# Check the sanity of what we've done so far
|
||||||
|
AM_SANITY_CHECK
|
||||||
|
|
||||||
|
dnl# Most people don't want the developer-only clutter
|
||||||
|
AM_MAINTAINER_MODE
|
||||||
|
|
||||||
|
dnl# If it's there, what the hell?
|
||||||
|
AM_WITH_DMALLOC
|
||||||
|
|
||||||
|
dnl# Look for needed programs
|
||||||
|
AC_CHECK_PROG(SED, sed, sed, false)
|
||||||
|
AC_CHECK_PROG(RM, rm, rm, true)
|
||||||
|
AC_CHECK_PROG(CP, cp, cp, false)
|
||||||
|
AC_CHECK_PROG(CHMOD, chmod, chmod, true)
|
||||||
|
AC_CHECK_PROG(TAR, tar, tar, tar)
|
||||||
|
AC_CHECK_PROG(MKDIR, mkdir, mkdir, false)
|
||||||
|
AC_CHECK_PROG(CTAGS, ctags, ctags, true)
|
||||||
|
AC_CHECK_PROG(AR, ar, ar, false)
|
||||||
|
AC_CHECK_PROG(MV, mv, mv, true)
|
||||||
|
AC_LN_S
|
||||||
|
|
||||||
|
AC_CHECK_SIZEOF(int, 4)
|
||||||
|
AC_CHECK_SIZEOF(long, 4)
|
||||||
|
AC_CHECK_SIZEOF(long long, 8)
|
||||||
|
dnl AC_C_BIGENDIAN
|
||||||
|
|
||||||
|
AC_C_CONST
|
||||||
|
AC_C_INLINE
|
||||||
|
AC_PATH_XTRA
|
||||||
|
|
||||||
|
if test "$ac_cv_lib_socket_connect" = "yes" ; then
|
||||||
|
SUBLIBS="-lsocket"
|
||||||
|
fi
|
||||||
|
if test "$ac_cv_lib_nsl_gethostbyname" = "yes" ; then
|
||||||
|
SUBLIBS="$SUBLIBS -lnsl"
|
||||||
|
fi
|
||||||
|
|
||||||
|
dnl# Checks for header files.
|
||||||
|
AC_HEADER_SYS_WAIT
|
||||||
|
AC_CHECK_HEADERS(fcntl.h termios.h \
|
||||||
|
sys/ioctl.h sys/select.h sys/time.h \
|
||||||
|
sys/sockio.h sys/byteorder.h \
|
||||||
|
utmpx.h unistd.h bsd/signal.h regex.h \
|
||||||
|
regexp.h stdarg.h)
|
||||||
|
AC_HEADER_TIME
|
||||||
|
|
||||||
|
dnl# Missing typedefs and replacements
|
||||||
|
AC_TYPE_MODE_T
|
||||||
|
AC_CHECK_TYPE(off_t, long)
|
||||||
|
AC_TYPE_PID_T
|
||||||
|
AC_TYPE_UID_T
|
||||||
|
|
||||||
|
dnl# Checks for library functions.
|
||||||
|
AC_TYPE_SIGNAL
|
||||||
|
AC_CHECK_FUNCS(atexit _exit unsetenv setutent seteuid memmove putenv strsep setresuid setresgid memmem usleep snprintf)
|
||||||
|
|
||||||
|
dnl# Check for the need for -lutil on BSD systems
|
||||||
|
AC_CHECK_FUNC(login,
|
||||||
|
AC_DEFINE(HAVE_LOGIN)
|
||||||
|
, AC_CHECK_LIB(util, login, LIBS="$LIBS -lutil" ;
|
||||||
|
AC_DEFINE(HAVE_LOGIN)
|
||||||
|
))
|
||||||
|
AC_CHECK_FUNC(logout,
|
||||||
|
AC_DEFINE(HAVE_LOGOUT)
|
||||||
|
, AC_CHECK_LIB(util, logout, LIBS="$LIBS -lutil" ;
|
||||||
|
AC_DEFINE(HAVE_LOGOUT)
|
||||||
|
))
|
||||||
|
AC_CHECK_FUNC(getpwuid, , AC_CHECK_LIB(sun, getpwuid, LIBS="$LIBS -lsun"))
|
||||||
|
|
||||||
|
dnl# Check for POSIX threads library
|
||||||
|
dnl# Don't comment this back in before multithreading actually works,
|
||||||
|
dnl# so people don't need thread-safe X libs to be able to run unthreaded
|
||||||
|
dnl# Eterm :) -vendu
|
||||||
|
#AC_CHECK_LIB(pthread, pthread_create, CFLAGS="$CFLAGS -D_REENTRANT";
|
||||||
|
# THREADLIBS="-lpthread", ,
|
||||||
|
# -D_REENTRANT -L/usr/lib -L/lib -L/usr/local/lib)
|
||||||
|
|
||||||
|
dnl# Did they want debugging?
|
||||||
|
AC_MSG_CHECKING(for debugging level)
|
||||||
|
AC_ARG_WITH(debugging, [ --with-debugging[=num] enable debugging output, num is an optional level],
|
||||||
|
if test "$withval" = "yes"; then
|
||||||
|
withval=4
|
||||||
|
else
|
||||||
|
:
|
||||||
|
fi
|
||||||
|
if test "$withval" != "no"; then
|
||||||
|
echo "$withval"
|
||||||
|
AC_DEFINE_UNQUOTED(DEBUG, $withval)
|
||||||
|
else
|
||||||
|
echo "no debugging"
|
||||||
|
fi, echo "4"
|
||||||
|
AC_DEFINE_UNQUOTED(DEBUG, 4)
|
||||||
|
)
|
||||||
|
|
||||||
|
dnl# Check for support for menus
|
||||||
|
AC_MSG_CHECKING(whether or not to enable menubar support)
|
||||||
|
AC_ARG_ENABLE(menus, [ --disable-menus disable support for menubars (support enabled by default)],
|
||||||
|
if test "$enableval" != "no"; then
|
||||||
|
echo "yes" ; MENUSED="";
|
||||||
|
else echo "no" ; MENUSED='s/define MENUBAR_MAX .*/define MENUBAR_MAX 0/g';
|
||||||
|
fi, echo "yes" ; MENUSED="")
|
||||||
|
|
||||||
|
dnl# Check for graphics libraries.
|
||||||
|
dnl# Force Imlib flags - see below. -vendu
|
||||||
|
AC_MSG_CHECKING(whether or not to enable pixmap support)
|
||||||
|
AC_ARG_WITH(imlib,
|
||||||
|
[ --with-imlib[=DIR] compile with Imlib support (Imlib residing in DIR/lib) [default]
|
||||||
|
--without-imlib compile with pixmap support disabled],
|
||||||
|
if test "$withval" != "no"; then
|
||||||
|
echo "yes" ; CFLAGS="$CFLAGS -I${withval}/include -L${withval}/lib";
|
||||||
|
GRLIBS="-lImlib" ; PIXMAPSED="";
|
||||||
|
else echo "no" ; PIXMAPSED='s/define PIXMAP_SUPPORT/undef PIXMAP_SUPPORT/g';
|
||||||
|
GRLIBS="";
|
||||||
|
fi, echo "yes" ; GRLIBS="-lImlib" ; PIXMAPSED="")
|
||||||
|
|
||||||
|
AC_CHECK_LIB(X11, XOpenDisplay, X_LIBS="$X_LIBS -lX11", [
|
||||||
|
echo "ERROR: You need libX11 to build Eterm. Verify that you have libX11.a or";
|
||||||
|
echo " libX11.so installed and that it is located in the X libraries";
|
||||||
|
echo " directory shown above. If it is in a different directory, try using";
|
||||||
|
echo " the --x-libraries parameter to configure.";
|
||||||
|
AC_MSG_ERROR([Fatal: libX11 not found.])], $X_LIBS $SUBLIBS)
|
||||||
|
|
||||||
|
AC_CHECK_LIB(Xext, XextAddDisplay, X_LIBS="-lXext $X_LIBS", [
|
||||||
|
echo "ERROR: You need libXext to build Eterm. Verify that you have libXext.a or";
|
||||||
|
echo " libXext.so installed and that it is located in the X libraries";
|
||||||
|
echo " directory shown above. If it is in a different directory, try using";
|
||||||
|
echo " the --x-libraries parameter to configure.";
|
||||||
|
AC_MSG_ERROR([Fatal: libXext not found.])], $X_LIBS $SUBLIBS)
|
||||||
|
|
||||||
|
AC_CHECK_LIB(Xext, XShapeQueryExtension, AC_DEFINE(HAVE_X_SHAPE_EXT), , $X_LIBS $SUBLIBS)
|
||||||
|
|
||||||
|
if test -z "$PIXMAPSED"; then
|
||||||
|
|
||||||
|
AC_CHECK_PROG(IMLIB_CONFIG, imlib-config, imlib-config, no)
|
||||||
|
|
||||||
|
if test "$IMLIB_CONFIG" != "no"; then
|
||||||
|
|
||||||
|
if test "$prefix" = "NONE"; then
|
||||||
|
AC_MSG_CHECKING(imlib-config for prefix)
|
||||||
|
prefix="`$IMLIB_CONFIG --prefix`"
|
||||||
|
AC_MSG_RESULT($prefix)
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_MSG_CHECKING(imlib-config for the value of CFLAGS)
|
||||||
|
CFLAGS="$CFLAGS `$IMLIB_CONFIG --cflags`"
|
||||||
|
AC_MSG_RESULT($CFLAGS)
|
||||||
|
|
||||||
|
AC_MSG_CHECKING(imlib-config for the value of GRLIBS)
|
||||||
|
GRLIBS="$GRLIBS `$IMLIB_CONFIG --libs`"
|
||||||
|
AC_MSG_RESULT($GRLIBS)
|
||||||
|
|
||||||
|
SAVE_LIBS="$LIBS"
|
||||||
|
LIBS="$GRLIBS"
|
||||||
|
|
||||||
|
AC_MSG_CHECKING(the sanity of new compile/link flags)
|
||||||
|
AC_TRY_LINK(, , echo "yes", echo "no" ; IMLIB_CONFIG="no" ;
|
||||||
|
AC_WARN(Compile/link failed. Reverting to manual method.)
|
||||||
|
)
|
||||||
|
|
||||||
|
LIBS="$SAVE_LIBS"
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "$IMLIB_CONFIG" = "no"; then
|
||||||
|
|
||||||
|
AC_CHECK_LIB(png, png_get_valid, GRLIBS="$GRLIBS -lpng -lz -lm", ,
|
||||||
|
$SUBLIBS $X_LIBS -lz -lm)
|
||||||
|
AC_CHECK_LIB(jpeg, jpeg_read_scanlines, GRLIBS="$GRLIBS -ljpeg", ,
|
||||||
|
$SUBLIBS $X_LIBS)
|
||||||
|
AC_CHECK_LIB(tiff, TIFFOpen, GRLIBS="$GRLIBS -ltiff", ,
|
||||||
|
$SUBLIBS $X_LIBS -lm)
|
||||||
|
AC_CHECK_LIB(gif, DGifOpenFileName, GRLIBS="$GRLIBS -lgif", ,
|
||||||
|
$SUBLIBS $X_LIBS)
|
||||||
|
AC_CHECK_LIB(ungif, DGifOpenFileName, GRLIBS="$GRLIBS -lungif", ,
|
||||||
|
$SUBLIBS $X_LIBS)
|
||||||
|
AC_CHECK_LIB(Imlib, Imlib_init, , [
|
||||||
|
echo "WARNING: Imlib was not found or did not correctly link.";
|
||||||
|
echo " Please check config.log to see what the error was.";
|
||||||
|
echo " I will attempt to continue, but things may go wrong.";
|
||||||
|
AC_MSG_WARN([WARNING: libImlib not found. Attempting to continue anyway.])],
|
||||||
|
$GRLIBS $SUBLIBS $X_LIBS)
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_PREFIX(Eterm)
|
||||||
|
AC_PREFIX(gcc)
|
||||||
|
|
||||||
|
dnl Stack Tracing toys
|
||||||
|
AC_ARG_ENABLE(stack-trace, [ --disable-stack-trace disable stack trace on abnormal termination],
|
||||||
|
if test "$enableval" = "no"; then
|
||||||
|
AC_DEFINE(NO_STACK_TRACE)
|
||||||
|
NO_STACK_TRACE=1
|
||||||
|
fi
|
||||||
|
)
|
||||||
|
|
||||||
|
if test "$NO_STACK_TRACE" != "1"; then
|
||||||
|
AC_PATH_PROG(DBX, dbx, no)
|
||||||
|
if test "$DBX" != "no"; then
|
||||||
|
AC_DEFINE_UNQUOTED(DBX, "$DBX")
|
||||||
|
fi
|
||||||
|
AC_PATH_PROG(GDB, gdb, no)
|
||||||
|
if test "$GDB" != "no"; then
|
||||||
|
AC_DEFINE_UNQUOTED(GDB, "$GDB")
|
||||||
|
fi
|
||||||
|
AC_PATH_PROG(PSTACK, pstack, no, $PATH:/usr/proc/bin:/usr/sbin)
|
||||||
|
if test "$PSTACK" != "no"; then
|
||||||
|
AC_DEFINE_UNQUOTED(PSTACK, "$PSTACK")
|
||||||
|
fi
|
||||||
|
AC_CHECK_LIB(cl, U_STACK_TRACE, LIBS="$LIBS -lcl")
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_MSG_CHECKING(for Linux 2.1 or higher)
|
||||||
|
OS_NAME=`uname -s`
|
||||||
|
if test "$OS_NAME" = "Linux"; then
|
||||||
|
OS_REV=`uname -r`
|
||||||
|
OS_MAJOR=`echo $OS_REV | cut -d. -f1`
|
||||||
|
OS_MINOR=`echo $OS_REV | cut -d. -f2`
|
||||||
|
if test "$OS_MAJOR" -ge "2" -a "$OS_MINOR" -ge "1"; then
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
AC_DEFINE(NEED_LINUX_HACK)
|
||||||
|
else
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
fi
|
||||||
|
|
||||||
|
dnl# Enable/disable humor
|
||||||
|
AC_ARG_WITH(sense-of-humor, [ --without-sense-of-humor Specify this if you have no sense of humor],
|
||||||
|
if test "$withval" = "no"; then
|
||||||
|
HUMOR=none
|
||||||
|
fi)
|
||||||
|
|
||||||
|
if test -z "$HUMOR"; then
|
||||||
|
AC_CHECK_LIB(Kenny, life_signs, , [
|
||||||
|
echo " Oh my god, they killed Kenny! You bastards!"
|
||||||
|
])
|
||||||
|
fi
|
||||||
|
|
||||||
|
CFLAGS=${CFLAGS--O}
|
||||||
|
LDFLAGS=${LDFLAGS--O}
|
||||||
|
|
||||||
|
CPPFLAGS="$CPPFLAGS"
|
||||||
|
AC_SUBST(CC)
|
||||||
|
AC_SUBST(CFLAGS)
|
||||||
|
AC_SUBST(CPPFLAGS)
|
||||||
|
AC_SUBST(LDFLAGS)
|
||||||
|
AC_SUBST(LIBS)
|
||||||
|
AC_SUBST(THREADLIBS)
|
||||||
|
AC_SUBST(GRLIBS)
|
||||||
|
|
||||||
|
basedir=.
|
||||||
|
FEATURE_CMD="$SED -e \"s%@PREFIX@%${prefix}%g\" -e \"s%@DATADIR@%${datadir}%g\" -e \"$PIXMAPSED\" -e \"$MENUSED\" "'${DIST_ROOT}'"/src/feature.h.in > "'${DIST_ROOT}'"/src/feature.h"
|
||||||
|
AC_SUBST(FEATURE_CMD)
|
||||||
|
|
||||||
|
dnl# common parts of the Makefile
|
||||||
|
dnl# MCOMMON=./Make.common
|
||||||
|
dnl# AC_SUBST_FILE(MCOMMON)
|
||||||
|
|
||||||
|
AM_CONFIG_HEADER(config.h)
|
||||||
|
|
||||||
|
AC_OUTPUT(Makefile \
|
||||||
|
bg/Makefile \
|
||||||
|
doc/Makefile \
|
||||||
|
utils/Makefile \
|
||||||
|
libmej/Makefile \
|
||||||
|
src/Makefile \
|
||||||
|
src/graphics/Makefile \
|
||||||
|
themes/Makefile \
|
||||||
|
Eterm.spec \
|
||||||
|
)
|
||||||
|
|
||||||
|
dnl If we're not building with Imlib support, don't build Esetroot
|
||||||
|
if test -n "$PIXMAPSED"; then
|
||||||
|
sed -e 's/^bin_PROGRAMS.*$//g' doc/Makefile > doc/Makefile.new
|
||||||
|
mv doc/Makefile.new doc/Makefile
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "creating src/feature.h"
|
||||||
|
eval ${FEATURE_CMD}.new
|
||||||
|
if cmp -s ${DIST_ROOT}/src/feature.h.new ${DIST_ROOT}/src/feature.h 2>/dev/null ; then
|
||||||
|
echo "feature.h is unchanged"
|
||||||
|
rm -f ${DIST_ROOT}/src/feature.h.new
|
||||||
|
else
|
||||||
|
mv ${DIST_ROOT}/src/feature.h.new ${DIST_ROOT}/src/feature.h
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "
|
||||||
|
Configuration:
|
||||||
|
|
||||||
|
Source code location: ${srcdir}
|
||||||
|
Compiler: ${CC} ${CFLAGS}
|
||||||
|
Host System Type: ${host}
|
||||||
|
Graphics libraries: ${GRLIBS}
|
||||||
|
X Windows libs/paths: ${X_LIBS}
|
||||||
|
Install path: ${prefix}
|
||||||
|
|
||||||
|
See src/feature.h for further configuration information."
|
||||||
|
echo
|
|
@ -0,0 +1,12 @@
|
||||||
|
eterm for DEBIAN
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
Sources can be found at www.eterm.org. Would like again to thank all of
|
||||||
|
#E on EFNet and #Debian on openprojects.net.
|
||||||
|
|
||||||
|
This is a CVS PRERELEASE DEB _ONLY_! DO NOT FILE BUGS AGAINST IT!
|
||||||
|
If you run into problems, please contact Brian Almeida <bma@debian.org>
|
||||||
|
|
||||||
|
No changes made from the original.
|
||||||
|
|
||||||
|
Brian M. Almeida <bma@debian.org>, Sun, 27 Sep 1998 20:18:11 -0400
|
|
@ -0,0 +1,137 @@
|
||||||
|
eterm (0.8.9-0.1) unstable; urgency=low
|
||||||
|
|
||||||
|
* Made CVS debian/ stuff just like regular package stuff
|
||||||
|
(Ok, the -cvs stuff was a bad idea) Contains lots of improvements :)
|
||||||
|
|
||||||
|
-- Brian M. Almeida <bma@debian.org> Tue, 2 Mar 1999 20:42:10 -0500
|
||||||
|
|
||||||
|
eterm (0.8.8-7) unstable; urgency=low
|
||||||
|
|
||||||
|
* Incorporated upstream patch for --console/-C (#33847)
|
||||||
|
|
||||||
|
-- Brian M. Almeida <bma@debian.org> Tue, 2 Mar 1999 20:39:06 -0500
|
||||||
|
|
||||||
|
eterm (0.8.8-7) unstable; urgency=low
|
||||||
|
|
||||||
|
* Fixed bash bug in postinst
|
||||||
|
|
||||||
|
-- Brian M. Almeida <bma@debian.org> Sat, 27 Feb 1999 09:49:59 -0500
|
||||||
|
|
||||||
|
eterm (0.8.8-6) unstable; urgency=low
|
||||||
|
|
||||||
|
* --console/-C option now writes to /dev/xconsole (#33847)
|
||||||
|
|
||||||
|
-- Brian M. Almeida <bma@debian.org> Fri, 26 Feb 1999 11:05:35 -0500
|
||||||
|
|
||||||
|
eterm (0.8.8-5) unstable; urgency=low
|
||||||
|
|
||||||
|
* UPSTREAM SECURITY FIX for bug #33558
|
||||||
|
|
||||||
|
-- Brian M. Almeida <bma@debian.org> Thu, 18 Feb 1999 15:29:43 -0500
|
||||||
|
|
||||||
|
eterm (0.8.8-4) unstable; urgency=low
|
||||||
|
|
||||||
|
* Changed suidmanager line to use 4755 instead of 04755 (#33470)
|
||||||
|
* Added doc-base support (#31168)
|
||||||
|
* Cleaned up some lintian errors
|
||||||
|
- Calls ldconfig in postinst
|
||||||
|
- Removed -rpath stuff
|
||||||
|
|
||||||
|
-- Brian M. Almeida <bma@debian.org> Tue, 16 Feb 1999 15:55:04 -0500
|
||||||
|
|
||||||
|
eterm (0.8.8-3) unstable; urgency=low
|
||||||
|
|
||||||
|
* REALLY fixed the pixmap problem! Yay! Thanks to Thunder- for his help
|
||||||
|
in tracking it down.
|
||||||
|
|
||||||
|
-- Brian M. Almeida <bma@debian.org> Tue, 9 Feb 1999 19:33:47 -0500
|
||||||
|
|
||||||
|
eterm (0.8.8-2) unstable; urgency=low
|
||||||
|
|
||||||
|
* Correct eterm-backgrounds dependency (#28215)
|
||||||
|
* Relies on correct version of imlib (#29463)
|
||||||
|
* Added glibc2.1 fix for sparc port from Christian Meder (#32816)
|
||||||
|
* Corrected pixmap.lists files (#32835)
|
||||||
|
* Added note about non-bash shells and vim in README.Debian (re: #32768)
|
||||||
|
|
||||||
|
-- Brian M. Almeida <bma@debian.org> Sat, 6 Feb 1999 19:23:21 -0500
|
||||||
|
|
||||||
|
eterm (0.8.8-1) unstable; urgency=low
|
||||||
|
|
||||||
|
* New upstream release
|
||||||
|
* New maintainer
|
||||||
|
* Updated download location in /usr/doc/copyright
|
||||||
|
* Added Eterm termcap files in /usr/doc/eterm
|
||||||
|
* imlib-nonfree1 is dead, background problem fixed (#20528)
|
||||||
|
* Uses correct location of Imlib.h (#24381)
|
||||||
|
* Backspace problem under bash fixed (#27617)
|
||||||
|
* Changed default TERM to xterm-debian (#27678)
|
||||||
|
* Has sample configuration file (#28018)
|
||||||
|
* Correct depends on eterm-backgrounds (#28284)
|
||||||
|
* Eterm now registers with suidmanager (#29777)
|
||||||
|
* Linked against libjpeg62 (#30464)
|
||||||
|
* Linked against libpng2-1.0.2b (#30975)
|
||||||
|
* Symlinks no longer dangle (#31511)
|
||||||
|
* Esetroot memory leak fixed (#32225)
|
||||||
|
|
||||||
|
-- Brian M. Almeida <bma@debian.org> Mon, 1 Feb 1999 15:24:00 -0500
|
||||||
|
|
||||||
|
eterm (0.8.7-0.4) frozen unstable; urgency=low
|
||||||
|
|
||||||
|
* Non-maintainer upload
|
||||||
|
* Fixed -rpath bug
|
||||||
|
|
||||||
|
-- Brian M. Almeida <bma@debian.org> Mon, 7 Dec 1998 18:32:00 -0500
|
||||||
|
|
||||||
|
eterm (0.8.7-0.3) unstable; urgency=low
|
||||||
|
|
||||||
|
* Non-maintainer upload
|
||||||
|
* Fixed the still-broken themes in 0.8.7-0.2
|
||||||
|
|
||||||
|
-- Brian M. Almeida <bma@debian.org> Sun, 25 Oct 1998 11:00:00 -0400
|
||||||
|
|
||||||
|
eterm (0.8.7-0.2) unstable; urgency=low
|
||||||
|
|
||||||
|
* Non-maintainer upload
|
||||||
|
* Fixed the extremely broken 0.8.7-0.1 (Oops!)
|
||||||
|
* Added more cleanup stuff to debian/rules (.deps .libs etc)
|
||||||
|
|
||||||
|
-- Brian M. Almeida <bma@debian.org> Sat, 24 Oct 1998 00:53:45 -0400
|
||||||
|
|
||||||
|
eterm (0.8.7-0.1) unstable; urgency=low
|
||||||
|
|
||||||
|
* Non-maintainer upload
|
||||||
|
* New upstream release
|
||||||
|
|
||||||
|
-- Brian M. Almeida <bma@debian.org> Thu, 22 Oct 1998 00:53:45 -0400
|
||||||
|
|
||||||
|
eterm (0.8.6-3) unstable; urgency=low
|
||||||
|
|
||||||
|
* Changed the depends: backgrounds to a Recommends at the request of Zed Phobre
|
||||||
|
|
||||||
|
-- Sean E. Perry <shaleh@debian.org> Tue, 20 Oct 1998 00:53:45 -0400
|
||||||
|
|
||||||
|
eterm (0.8.6-2) unstable; urgency=low
|
||||||
|
|
||||||
|
* Fixed the menu file -- typos gotta love 'em
|
||||||
|
|
||||||
|
-- Sean E. Perry <shaleh@debian.org> Mon, 19 Oct 1998 21:43:20 -0400
|
||||||
|
|
||||||
|
eterm (0.8.6-1) frozen unstable; urgency=low
|
||||||
|
|
||||||
|
* Fixed the fact that the theme files were missing
|
||||||
|
* Can find the pixmaps properly now
|
||||||
|
|
||||||
|
-- Sean E. Perry <shaleh@debian.org> Sun, 18 Oct 1998 02:19:22 -0400
|
||||||
|
|
||||||
|
eterm (0.8.6-0) unstable; urgency=low
|
||||||
|
|
||||||
|
* New maintainer
|
||||||
|
* new upstream release
|
||||||
|
|
||||||
|
-- Sean E. Perry <shaleh@debian.org> Sun, 27 Sep 1998 20:18:11 -0400
|
||||||
|
|
||||||
|
Local variables:
|
||||||
|
mode: debian-changelog
|
||||||
|
add-log-mailing-address: "bma@debian.org"
|
||||||
|
End:
|
|
@ -0,0 +1,17 @@
|
||||||
|
Source: eterm
|
||||||
|
Section: x11
|
||||||
|
Priority: optional
|
||||||
|
Maintainer: Brian M. Almeida <bma@debian.org>
|
||||||
|
Standards-Version: 2.5.0.0
|
||||||
|
|
||||||
|
Package: eterm
|
||||||
|
Architecture: any
|
||||||
|
Depends: ${shlibs:Depends}
|
||||||
|
Recommends: eterm-backgrounds
|
||||||
|
Description: Enlightened Terminal Emulator (ala xterm) with Imlib support
|
||||||
|
A terminal emulator in the spirit of xterm or rxvt. However this one differs
|
||||||
|
in that it uses an Enlightenment style config file, as well as themes. The
|
||||||
|
Imlib graphics engine is used to render images. This version supports
|
||||||
|
background images, pixmap shading/tinting, and pseudo-transparency.
|
||||||
|
Eterm also now uses libpthreads.
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
This package was debianized by Sean E. Perry shaleh@debian.org on
|
||||||
|
Sun, 27 Sep 1998 20:18:11 -0400.
|
||||||
|
|
||||||
|
It was downloaded from www.eterm.org
|
||||||
|
|
||||||
|
Copyright:
|
||||||
|
|
||||||
|
Eterm is released under the GPL.
|
|
@ -0,0 +1,5 @@
|
||||||
|
usr/X11R6/bin
|
||||||
|
usr/X11R6/man
|
||||||
|
usr/lib/menu
|
||||||
|
usr/share/Eterm
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
Document: eterm
|
||||||
|
Title: Eterm Frequently Asked Questions
|
||||||
|
Author: Michael Jennings
|
||||||
|
Abstract: Frequently Asked Questions about the Enlightened Terminal.
|
||||||
|
.
|
||||||
|
Section: Apps/Terminals
|
||||||
|
|
||||||
|
Format: HTML
|
||||||
|
Index: /usr/doc/eterm/FAQ.html
|
||||||
|
Files: /usr/doc/eterm/FAQ.html
|
|
@ -0,0 +1 @@
|
||||||
|
README ReleaseNotes doc/FAQ.html doc/Eterm.tcap doc/Eterm.ti
|
|
@ -0,0 +1,2 @@
|
||||||
|
?package(eterm):needs=X11 section=XShells\
|
||||||
|
title="Eterm" command="/usr/bin/X11/Eterm"
|
|
@ -0,0 +1,29 @@
|
||||||
|
#!/bin/sh -e
|
||||||
|
|
||||||
|
ldconfig
|
||||||
|
|
||||||
|
if [ -x /usr/bin/update-menus ] ; then update-menus ; fi
|
||||||
|
|
||||||
|
cd /usr/share/Eterm/themes
|
||||||
|
for theme_dir in `ls -1`
|
||||||
|
do
|
||||||
|
if [ -d $theme_dir ]
|
||||||
|
then
|
||||||
|
cd $theme_dir
|
||||||
|
echo "Linking pixmaps.list in $theme_dir"
|
||||||
|
ln -sf /usr/share/Eterm/pix/pixmaps.list pixmaps.list
|
||||||
|
cd ..
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Register with suidmanager
|
||||||
|
if command -v suidregister >/dev/null 2>&1 && [ -e /etc/suid.conf ]; then
|
||||||
|
suidregister -s eterm /usr/X11R6/bin/Eterm root root 4755
|
||||||
|
else
|
||||||
|
chown root.root /usr/X11R6/bin/Eterm
|
||||||
|
chmod 4755 /usr/X11R6/bin/Eterm
|
||||||
|
fi
|
||||||
|
|
||||||
|
if command -v install-docs >/dev/null 2>&1; then
|
||||||
|
install-docs -i /usr/share/doc-base/eterm
|
||||||
|
fi
|
|
@ -0,0 +1,9 @@
|
||||||
|
#!/bin/sh -e
|
||||||
|
# Automatically added by dh_installmenu
|
||||||
|
if test -x /usr/bin/update-menus ; then update-menus ; fi
|
||||||
|
# End automatically added section
|
||||||
|
# Automatically added by dh_suidregister
|
||||||
|
if command -v suidunregister >/dev/null 2>&1 && [ -e /etc/suid.conf ]; then
|
||||||
|
suidunregister -s eterm /usr/X11R6/bin/Eterm
|
||||||
|
fi
|
||||||
|
# End automatically added section
|
|
@ -0,0 +1,94 @@
|
||||||
|
#!/usr/bin/make -f
|
||||||
|
|
||||||
|
# Uncomment this to turn on verbose mode.
|
||||||
|
#export DH_VERBOSE=1
|
||||||
|
|
||||||
|
INSTALL_BASE=`pwd`/debian/tmp
|
||||||
|
|
||||||
|
configure: configure.in
|
||||||
|
libtoolize --copy --force
|
||||||
|
aclocal $ACLOCAL_FLAGS
|
||||||
|
automake --add-missing
|
||||||
|
autoconf
|
||||||
|
autoheader
|
||||||
|
|
||||||
|
build: build-stamp
|
||||||
|
build-stamp:
|
||||||
|
dh_testdir
|
||||||
|
|
||||||
|
# Add here commands to compile the package.
|
||||||
|
./configure --prefix=/usr --bindir=/usr/X11R6/bin \
|
||||||
|
--datadir=/usr/share --mandir=/usr/X11R6/man
|
||||||
|
|
||||||
|
|
||||||
|
# because glibc 2.1's utmpx.h is incompatible on sparc
|
||||||
|
sed -e 's/#define HAVE_UTMPX_H 1/\/* #undef HAVE_UTMPX_H *\//' config.h > config.h.tmp
|
||||||
|
mv config.h.tmp config.h
|
||||||
|
|
||||||
|
# fix rpath issues
|
||||||
|
sed < libtool > libtool-2 \
|
||||||
|
-e 's/^hardcode_libdir_flag_spec.*$$/hardcode_libdir_flag_spec="-D__LIBTOOL_IS_A_FOOL__ "/' \
|
||||||
|
-e '/^archive_cmds="/s/"$$/ \\$$deplibs"/'
|
||||||
|
mv libtool-2 libtool
|
||||||
|
chmod 755 libtool
|
||||||
|
|
||||||
|
make
|
||||||
|
|
||||||
|
touch build-stamp
|
||||||
|
|
||||||
|
clean:
|
||||||
|
dh_testdir
|
||||||
|
dh_testroot
|
||||||
|
rm -f build-stamp
|
||||||
|
|
||||||
|
# Add here commands to clean up after the build process.
|
||||||
|
-$(MAKE) -k distclean
|
||||||
|
-rm -f `find . -name "*~"`
|
||||||
|
-rm -rf `find . -name "\.deps"`
|
||||||
|
-rm -rf `find . -name "\.libs"`
|
||||||
|
-rm -rf debian/tmp `find debian/* -type d ! -name CVS` debian/files* core
|
||||||
|
-rm -f debian/*substvars
|
||||||
|
|
||||||
|
dh_clean
|
||||||
|
|
||||||
|
# Build architecture-independent files here.
|
||||||
|
binary-indep: build
|
||||||
|
# We have nothing to do by default.
|
||||||
|
|
||||||
|
# Build architecture-dependent files here.
|
||||||
|
binary-arch: build
|
||||||
|
dh_testdir -a
|
||||||
|
dh_testroot -a
|
||||||
|
dh_clean -k -a
|
||||||
|
dh_installdirs -a
|
||||||
|
|
||||||
|
# Add here commands to install the files into debian/tmp
|
||||||
|
$(MAKE) install DESTDIR=$(INSTALL_BASE) \
|
||||||
|
PREFIX=$(INSTALL_BASE)/usr \
|
||||||
|
datadir=$(INSTALL_BASE)/usr/share \
|
||||||
|
pkglibdir=$(INSTALL_BASE)/usr/share/Eterm \
|
||||||
|
DATADIR=$(INSTALL_BASE)/usr/share \
|
||||||
|
themedir=$(INSTALL_BASE)/usr/share/Eterm/themes
|
||||||
|
|
||||||
|
dh_installdocs -a
|
||||||
|
dh_installmenu -a
|
||||||
|
#dh_installmanpages --verbose -a
|
||||||
|
dh_undocumented -a Esetroot.1x
|
||||||
|
dh_installchangelogs -a
|
||||||
|
dh_strip -a
|
||||||
|
dh_compress -a
|
||||||
|
dh_fixperms -a
|
||||||
|
chown root.root debian/tmp/usr/X11R6/bin/Eterm
|
||||||
|
chmod 4755 debian/tmp/usr/X11R6/bin/Eterm
|
||||||
|
dh_suidregister
|
||||||
|
dh_installdeb -a
|
||||||
|
dh_shlibdeps -a
|
||||||
|
dh_gencontrol -a
|
||||||
|
dh_md5sums -a
|
||||||
|
dh_builddeb -a
|
||||||
|
|
||||||
|
source diff:
|
||||||
|
@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
|
||||||
|
|
||||||
|
binary: binary-indep binary-arch
|
||||||
|
.PHONY: build clean binary-indep binary-arch binary
|
|
@ -0,0 +1 @@
|
||||||
|
libpng 2 libpng2(>= 1.0.2b-0.1)
|
|
@ -0,0 +1,4 @@
|
||||||
|
Eterm.1
|
||||||
|
Eterm.1.html
|
||||||
|
Makefile
|
||||||
|
Makefile.in
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,44 @@
|
||||||
|
# termcap for rxvt (and xterm) -- (modified from the Midnight Commander)
|
||||||
|
#
|
||||||
|
# From: Jakub Jelinek <jj@jfch.vc.cvut.cz> 1 Sep 1995
|
||||||
|
# This is a checked termcap entry for the xterm terminal emulator.
|
||||||
|
# It is compatible with the enclosed terminfo entry.
|
||||||
|
# Install this by cutting off the old xterm entry from /etc/termcap
|
||||||
|
# and replacing that place it with this file.
|
||||||
|
# Heavily based on xterm from:
|
||||||
|
# Eric S. Raymond <esr@snark.thyrsus.com> 30 Mar 1995
|
||||||
|
# Note: If you use the line-drawing character set, the disable afterwards
|
||||||
|
# will leave you in US-ASCII. If you live somewhere that wants a pound sign
|
||||||
|
# at 2/3, change rmacs to "\E(A". Further note: cuf and cub don't seem
|
||||||
|
# to be reliable under my xterm, so they're commented out.
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
|
||||||
|
xterm|vs100|xterm terminal emulator (X11R6 Window System):\
|
||||||
|
:am:bs:km:mi:ms:pt:xn:xo:co#80:li#24:it#8:\
|
||||||
|
:AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:\
|
||||||
|
:IC=\E[%d@:LE=\E[%dD:UP=\E[%dA:\
|
||||||
|
:ac=++\054\054..00II--``aaffgghhjjkkllmmnnooqqssttuuvvwwxx~~:\
|
||||||
|
:ae=\E(B:al=\E[L:as=\E(0:bl=^G:cd=\E[J:ce=\E[K:\
|
||||||
|
:cl=\E[H\E[2J:cm=\E[%i%d;%dH:cr=^M:cs=\E[%i%d;%dr:\
|
||||||
|
:ct=\E[3k:dc=\E[P:dl=\E[M:ei=\E[4l:ho=\E[H:\
|
||||||
|
:ic=\E[@:im=\E[4h:\
|
||||||
|
:is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l:\
|
||||||
|
:k0=\E[21~:\
|
||||||
|
:k1=\E[11~:k2=\E[12~:k3=\E[13~:k4=\E[14~:k5=\E[15~:\
|
||||||
|
:k6=\E[17~:k7=\E[18~:k8=\E[19~:k9=\E[20~:k;=\E[21~:\
|
||||||
|
:F1=\E[23~:F2=\E[24~:F3=\E[25~:F4=\E[26~:\
|
||||||
|
:F5=\E[28~:F6=\E[29~:F7=\E[31~:F8=\E[32~:F9=\E[33~:FA=\E[34~:\
|
||||||
|
:*0=\E[1~:kI=\E[2~:kD=\E[3~:*6=\E[4~:kP=\E[5~:kN=\E[6~:\
|
||||||
|
:kh=\E[7~:@7=\E[8~:kB=\E[Z:\
|
||||||
|
:ke=\E>:ks=\E=:\
|
||||||
|
:ku=\E[A:kd=\E[B:kr=\E[C:kl=\E[D:\
|
||||||
|
:K1=\EOw:K3=\EOy:K2=\EOu:K4=\EOq:K5=\EOs:\
|
||||||
|
:kb=^H:up=\E[A:do=^J:nd=\E[C:le=^H:\
|
||||||
|
:md=\E[1m:me=\E[m:mr=\E[7m:\
|
||||||
|
:r2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l\E<:\
|
||||||
|
:rc=\E8:sc=\E7:se=\E[m:sf=^J:so=\E[7m:sr=\EM:ta=^I:\
|
||||||
|
:te=\E[2J\E[?47l\E8:ti=\E7\E[?47h:u6=\E[%d;%dR:\
|
||||||
|
:u7=\E[6n:u8=\E[?1;2c:u9=\E[c:ue=\E[m:\
|
||||||
|
:us=\E[4m:
|
||||||
|
xterm-color|color-xterm|xterm with color support:\
|
||||||
|
:tc=xterm:tc=ansi-pc-color:
|
|
@ -0,0 +1,147 @@
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
# terminfo for Eterm (and xterm) -- [modified from the Midnight Commander]
|
||||||
|
#
|
||||||
|
# Install using `tic Eterm.ti', to be used with the enclosed termcap
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
|
||||||
|
xterm-basic|xterm terminal base (X Window System),
|
||||||
|
am, km, mir, msgr, xenl, xon, cols#80, lines#24, it#8,
|
||||||
|
# Not sure about eo (Erase overstrike with a blank)
|
||||||
|
eo,
|
||||||
|
cr=\r, bel=^G,
|
||||||
|
|
||||||
|
# Scroll text up, down
|
||||||
|
ind=\n, ri=\EM,
|
||||||
|
|
||||||
|
# Clear Screen, EOS, EOL, BOL
|
||||||
|
clear=\E[H\E[2J, ed=\E[J, el=\E[K, el1=\E[1K,
|
||||||
|
|
||||||
|
# Change Scroll Region
|
||||||
|
csr=\E[%i%p1%d;%p2%dr,
|
||||||
|
|
||||||
|
# Cursor Position
|
||||||
|
cup=\E[%i%p1%d;%p2%dH,
|
||||||
|
|
||||||
|
# Horizontal & Vertical Position Absolute
|
||||||
|
hpa=\E[%i%p1%dG, vpa=\E[%i%p1%dd,
|
||||||
|
|
||||||
|
# Cursor Up/Down/Forward/Backward: any, 1 char
|
||||||
|
cuu=\E[%p1%dA, cud=\E[%p1%dB, cuf=\E[%p1%dC, cub=\E[%p1%dD,
|
||||||
|
cuu1=\E[A, cud1=\E[B, cuf1=\E[C, cub1=\b,
|
||||||
|
|
||||||
|
# Misc cursor motion
|
||||||
|
home=\E[1;1H,
|
||||||
|
|
||||||
|
# Enter insert mode, leave insert mode
|
||||||
|
smir=\E[4h, rmir=\E[4l,
|
||||||
|
|
||||||
|
# Set tab stops, clear tab stops, tab character
|
||||||
|
hts=\EH, tbc=\E[3g, ht=\t,
|
||||||
|
|
||||||
|
# Make cursor invisible, normal, bold
|
||||||
|
civis=\E[?25l, cnorm=\E[?25h, cvvis=\E[?25h,
|
||||||
|
|
||||||
|
# Save/Restore Cursor position
|
||||||
|
sc=\E7, rc=\E8,
|
||||||
|
|
||||||
|
# Alternate Char Set (line drawing), enable/enter/exit ACS
|
||||||
|
acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
|
||||||
|
enacs=\E(B\E)0, smacs=\E(B\E)U^N, rmacs=\E(B\E)0^O,
|
||||||
|
|
||||||
|
#-- begin AIX 3.2.5 hack
|
||||||
|
# acsc (box2 is the standard AIX form, box1 has been changed to work!)
|
||||||
|
# box1=llqqkkxxjjmmwwuuvvttnn,
|
||||||
|
# box2=lqkxjmwuvtn,
|
||||||
|
# font0=\E(B, font1=\E(0,
|
||||||
|
# position occupied by kend
|
||||||
|
# colf7=\E[8~,
|
||||||
|
#-- end AIX 3.2.5 hack
|
||||||
|
|
||||||
|
# Delete/Insert: Chars, Lines, 1-char, 1-line
|
||||||
|
dch=\E[%p1%dP, dl=\E[%p1%dM,
|
||||||
|
ich=\E[%p1%d@, il=\E[%p1%dL,
|
||||||
|
dch1=\E[P, dl1=\E[M,
|
||||||
|
ich1=\E[@, il1=\E[L,
|
||||||
|
|
||||||
|
# Erase Chars
|
||||||
|
ech=\E[%p1%dX,
|
||||||
|
|
||||||
|
# Enter/Leave Fonts: Bold, Reverse, Blink, Underline
|
||||||
|
# standout (enter/leave), Define attribs 1-9
|
||||||
|
bold=\E[1m, rev=\E[7m, blink=\E[5m,
|
||||||
|
smul=\E[4m, rmul=\E[24m, smso=\E[7m, rmso=\E[m,
|
||||||
|
|
||||||
|
# visual bell
|
||||||
|
flash=\E[?5h\E[?5l,
|
||||||
|
|
||||||
|
# Enter/leave keypad transmit, Cursor keys (sent by terminal). Don't touch
|
||||||
|
# cursor keys! use ANSI cursor keys rather than application cursor keys to
|
||||||
|
# avoid starting in application cursor mode when `$xterm&' is used and to
|
||||||
|
# enable the Eterm Shift/Ctrl cursor extensions.
|
||||||
|
smkx=\E=, rmkx=\E>,
|
||||||
|
kcuu1=\E[A, kcud1=\E[B, kcuf1=\E[C, kcub1=\E[D,
|
||||||
|
|
||||||
|
# Other nice keys
|
||||||
|
ka1=\EOw, ka3=\EOy, kb2=\EOu, kc1=\EOq, kc3=\EOs
|
||||||
|
|
||||||
|
# Function keys
|
||||||
|
kf0=\E[21~,
|
||||||
|
kf1=\E[11~, kf2=\E[12~, kf3=\E[13~, kf4=\E[14~, kf5=\E[15~,
|
||||||
|
kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, kf10=\E[21~,
|
||||||
|
kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, kf14=\E[26~,
|
||||||
|
kf15=\E[28~, kf16=\E[29~, kf17=\E[31~,
|
||||||
|
kf18=\E[32~, kf19=\E[33~, kf20=\E[34~,
|
||||||
|
|
||||||
|
# Find, Insert, Delete, Select, Prior, Next
|
||||||
|
kfnd=\E[1~, kich1=\E[2~, kdch1=\E[3~, kslt=\E[4~, kpp=\E[5~, knp=\E[6~,
|
||||||
|
# Home (vt100 may use khome=\E[H), End, Backspace, Enter, Backtab
|
||||||
|
khome=\E[7~, kend=\E[8~, kbs=\177, kent=\EOM, kcbt=\E[Z,
|
||||||
|
|
||||||
|
# Shifted Right, Left, Delete, Prior, Next, Home, End, Ctrl-End
|
||||||
|
kRIT=\E[c, kLFT=\E[d,
|
||||||
|
kDC=\E[3$, kPRV=\E[5$, kNXT=\E[6$,
|
||||||
|
kHOM=\E[7$, kEND=\E[8$, kel=\E[8^,
|
||||||
|
|
||||||
|
# Reset terminal, turn off all attributes
|
||||||
|
rs1=\E>\E[1;3;4;5;6l\E[?7h\E[m\E[r\E[2J\E[H,
|
||||||
|
rs2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l\E>,
|
||||||
|
# dec.ti
|
||||||
|
# rs2=@,
|
||||||
|
|
||||||
|
# Init terminal
|
||||||
|
is1=\E[?47l\E=\E[?1l,
|
||||||
|
is2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l,
|
||||||
|
|
||||||
|
# Leave/Enter CA-Mode.
|
||||||
|
smcup=\E7\E[?47h, rmcup=\E[?47l\E8,
|
||||||
|
# dec.ti
|
||||||
|
# smcup=\E[?7h\E[?1l\E(B\E=, rmcup=\E[?7h,
|
||||||
|
|
||||||
|
# turn on/off the printer
|
||||||
|
# mc5=\E[5i, mc4=\E[4i,
|
||||||
|
mc4=\E[4i,
|
||||||
|
|
||||||
|
#
|
||||||
|
# XTerm with color support.
|
||||||
|
#
|
||||||
|
xterm|vs100|xterm terminal emulator (X Window System),
|
||||||
|
use=xterm-basic,
|
||||||
|
# sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t^N%e^O%;,
|
||||||
|
sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m,
|
||||||
|
sgr0=\E[m^O,
|
||||||
|
# from dec.ti
|
||||||
|
# sgr0=\E[m\E(B,
|
||||||
|
# sgr0=\E[m,
|
||||||
|
# sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m%?%p9%t\E(0%e\E(B%;,
|
||||||
|
|
||||||
|
xterm-color|color-xterm|Eterm|eterm|color xterm terminal emulator (X Window System),
|
||||||
|
use=xterm, colors#8, pairs#64,
|
||||||
|
|
||||||
|
# Set all color pairs to the original ones
|
||||||
|
# op=\E[0m,
|
||||||
|
op=\E[39;49m,
|
||||||
|
|
||||||
|
# Set foreground color, background color
|
||||||
|
setf=\E[%p1%{30}%+%dm, setb=\E[%p1%{40}%+%dm,
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------- eof
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,534 @@
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
||||||
|
|
||||||
|
<HTML>
|
||||||
|
<HEAD>
|
||||||
|
<TITLE>Eterm FAQ</TITLE>
|
||||||
|
</HEAD>
|
||||||
|
|
||||||
|
<BODY bgcolor="#ffffff" text="#000000" vlink="#3f3fff" link="#0000ff" alink="#000000">
|
||||||
|
|
||||||
|
<H1>Eterm FAQ</H1>
|
||||||
|
<P>
|
||||||
|
<H2>Contents</H2>
|
||||||
|
<P>
|
||||||
|
<UL>
|
||||||
|
<LI><A HREF="#q1">How do I know which version of Eterm I am running?</A>
|
||||||
|
<LI><A HREF="#q2">Why did you have to go and change all the options!?</A>
|
||||||
|
<LI><A HREF="#q3">Why isn't my .Xdefaults being parsed any more?</A>
|
||||||
|
<LI><A HREF="#q4">Well then why isn't the Eterm theme <TT>MAIN</TT> file being parsed?</A>
|
||||||
|
<LI><A HREF="#q5">Where do I find out what you've changed for each release?</A>
|
||||||
|
<LI><A HREF="#q6">What information/help files are in the Eterm distribution?</A>
|
||||||
|
<LI><A HREF="#q7">Do I need this file called <TT>Eterm-bg.tar.gz</TT>?</A>
|
||||||
|
<LI><A HREF="#q8">The man page is all wrong! What's up with that?</A>
|
||||||
|
<LI><A HREF="#q9">Why did the mouse selection thing suddenly quit working?</A>
|
||||||
|
<LI><A HREF="#q10">The docs keep mentioning blinking text, but I can't get it to work. What am I doing wrong?</A>
|
||||||
|
<LI><A HREF="#q11">How do I change the screen colors?</A>
|
||||||
|
<LI><A HREF="#q12">What's the deal with Backspace/Delete? Neither seems to work!</A>
|
||||||
|
<LI><A HREF="#q13">Why won't my Backspace work under Linux?</A>
|
||||||
|
<LI><A HREF="#q14">How do I change the key bindings in Eterm?</A>
|
||||||
|
<LI><A HREF="#q15">My keyboard has some extra keys. How can I use them in Eterm?</A>
|
||||||
|
<LI><A HREF="#q16">How does a program tell if it's running in an Eterm or an xterm?</A>
|
||||||
|
<LI><A HREF="#q17">How do I properly set <B><TT>$DISPLAY</TT></B> to the correct, full IP address from a shell?</A>
|
||||||
|
<LI><A HREF="#q18">Why isn't the <TT>-n (--name)</TT> option working?</A> (added 6 Sept 1997)
|
||||||
|
<LI><A HREF="#q19">Eterm doesn't work on my machine. Help!</A> (added 19 Sept 1997)
|
||||||
|
<LI><A HREF="#q20">Why is 0 sending a Ctrl-C?</A> (added 5 August 1998)
|
||||||
|
<LI><A HREF="#q21">What constitutes an Eterm theme?</A> (added 5 August 1998)
|
||||||
|
<LI><A HREF="#q22">How does Eterm determine which theme to use?</A> (added 5 August 1998)
|
||||||
|
<LI><A HREF="#q23">What does this accomplish?</A> (added 5 August 1998)
|
||||||
|
<!-- <LI><A HREF="#q"></A> -->
|
||||||
|
</UL>
|
||||||
|
|
||||||
|
<HR SIZE=5>
|
||||||
|
<H2>Q&A</H2>
|
||||||
|
<P>
|
||||||
|
<H3><A NAME="q1">How do I know which version of Eterm I am running?</A></H3>
|
||||||
|
<P>
|
||||||
|
Eterm always displays its current version at the top of the options list
|
||||||
|
on the usage screen. You can view the usage screen by envoking Eterm with
|
||||||
|
the <TT>-h</TT> or <TT>--help</TT> option. Also, you can place the current
|
||||||
|
version number in the Eterm title bar using the escape sequence "ESC[8n".
|
||||||
|
<BR><BR>
|
||||||
|
<HR SIZE=3 WIDTH=80%>
|
||||||
|
<H3><A NAME="q2">Why did you have to go and change all the options!?</A></H3>
|
||||||
|
<P>
|
||||||
|
There are several reasons we chose to do this:
|
||||||
|
<BR>
|
||||||
|
<OL>
|
||||||
|
<LI> To make Eterm's command-line option mechanisms be POSIX- and GNU-compliant.
|
||||||
|
<LI> To allow for shorter synonyms for the most frequently-used options.
|
||||||
|
<LI> We were sick of the obfuscated nature of the xterm options.
|
||||||
|
<LI> We felt like it.
|
||||||
|
</OL>
|
||||||
|
For those who don't know, POSIX-standard option syntax uses single-letter options
|
||||||
|
which can be combined on the command line (e.g., the "-xvf" in a tar command),
|
||||||
|
among other things. GNU-standard options (also known as "long options") begin
|
||||||
|
with two hyphens and make it very easy to tell what an individual option
|
||||||
|
controls (e.g., --background-pixmap, whose POSIX synonym is -P).
|
||||||
|
<BR><BR>
|
||||||
|
<HR SIZE=3 WIDTH=80%>
|
||||||
|
<H3><A NAME="q3">Why isn't my .Xdefaults being parsed any more?</A></H3>
|
||||||
|
<P>
|
||||||
|
This is another change made as of DR 0.6. Since it is <I>E</I>term (Enlightened term,
|
||||||
|
intended for use with <A HREF="http://www.enlightenment.org/" TARGET="_top">The
|
||||||
|
Enlightenment Window Manager</A>), we chose to have it read a config file
|
||||||
|
very similar to Enlightenment's own MAIN.
|
||||||
|
|
||||||
|
<P>
|
||||||
|
Eterm 0.7 has support for themes. (See the later question,
|
||||||
|
"<A HREF="#q21">What constitutes an Eterm theme?</A>", for more info
|
||||||
|
on themes.) By default, the <TT>make install</TT> will copy the themes
|
||||||
|
from the themes/* directories into the <TT>$libdir/Eterm/themes/</TT> directory
|
||||||
|
(<TT>/usr/local/lib/Eterm/themes</TT> by default). It will no longer read
|
||||||
|
<TT>~/.Eterm/MAIN</TT>, but instead will look for the Eterm theme if no
|
||||||
|
theme is specified on the command line.</P>
|
||||||
|
|
||||||
|
<BR><BR>
|
||||||
|
<HR SIZE=3 WIDTH=80%>
|
||||||
|
<H3><A NAME="q4">Well then why isn't the Eterm theme <TT>MAIN</TT> file being parsed?</A></H3>
|
||||||
|
<P>
|
||||||
|
The most likely cause of this (besides not having one :-) is not having the
|
||||||
|
proper "magic number" line at the top of your config file. As of DR 0.6a,
|
||||||
|
the first line of your config file must look like:<BR>
|
||||||
|
<PRE>
|
||||||
|
<Eterm-0.6a>
|
||||||
|
</PRE>
|
||||||
|
|
||||||
|
<P>
|
||||||
|
This "magic number" mechanism prevents Eterm from trying to read an Enlightenment
|
||||||
|
config file as its own, and it may provide backward compatibility in the future.
|
||||||
|
The "0.6a" part represents the version of Eterm for which the config file was
|
||||||
|
written (without the "DR" if there is one).
|
||||||
|
<BR><BR>
|
||||||
|
<HR SIZE=3 WIDTH=80%>
|
||||||
|
<H3><A NAME="q5">Where do I find out what you've changed for each release?</A></H3>
|
||||||
|
<P>
|
||||||
|
There is a file called <TT>RELNOTES.Eterm</TT> in the base directory of each
|
||||||
|
Eterm distribution. Those release notes give information about what changes
|
||||||
|
were made in each release, plans for future changes, etc.
|
||||||
|
<BR><BR>
|
||||||
|
<HR SIZE=3 WIDTH=80%>
|
||||||
|
<H3><A NAME="q6">What information/help files are in the Eterm distribution?</A></H3>
|
||||||
|
<P>
|
||||||
|
Here is a list:
|
||||||
|
<UL>
|
||||||
|
<LI> doc/FAQ -- A preliminary Eterm FAQ. This document will soon replace it.
|
||||||
|
<LI> doc/colortest.sh -- A script to demonstrate Eterm's color capabilities.
|
||||||
|
<LI> doc/Eterm.ref -- Eterm technical reference. Exhaustive list of all supported escape sequences.
|
||||||
|
<LI> doc/menu.sh -- A script to demonstrate Eterm's menubar code.
|
||||||
|
<LI> doc/Eterm.tcap -- Sample Eterm termcap file.
|
||||||
|
<LI> doc/Eterm.ti -- Sample Eterm terminfo file. Compile with <TT>tic</TT>.
|
||||||
|
<LI> doc/Eterm.help -- Output of <TT>Eterm --help</TT> (until we get a new man page).
|
||||||
|
<LI> doc/Eterm.1 -- Old Eterm man page. Does not reflect changes in DR 0.6.
|
||||||
|
<LI> RELNOTES.Eterm -- Eterm release notes. Read this!!
|
||||||
|
<LI> INSTALL -- A script that does the configure, compile, link, and install for you.
|
||||||
|
</UL>
|
||||||
|
<HR SIZE=3 WIDTH=80%>
|
||||||
|
<H3><A NAME="q7">Do I need this file called <TT>Eterm-bg.tar.gz</TT>?</A></H3>
|
||||||
|
<P>
|
||||||
|
One of Eterm's most notable features is its ability to put images (called pixmaps by
|
||||||
|
convention) in the background of your terminal windows. <TT>Eterm-bg.tar.gz</TT>
|
||||||
|
(obtainable from any Eterm site) contains about 14 Meg worth of cool pixmaps to
|
||||||
|
try. It's completely optional. If you do get it, be sure to untar it into your
|
||||||
|
home directory. It puts the images in <TT>.Eterm/pix/</TT> underneath wherever
|
||||||
|
you install it. I also left the <TT>.xvpics</TT> directory intact, so you can use
|
||||||
|
the Visual Schnauzer to preview the pixmaps.
|
||||||
|
<BR><BR>
|
||||||
|
<HR SIZE=3 WIDTH=80%>
|
||||||
|
<H3><A NAME="q8">The man page is all wrong! What's up with that?</A></H3>
|
||||||
|
<P>
|
||||||
|
The man page for Eterm DR 0.6 and later is not finished yet. Stay tuned to these
|
||||||
|
pages. I'll post it here as soon as it's ready.
|
||||||
|
<BR><BR>
|
||||||
|
<HR SIZE=3 WIDTH=80%>
|
||||||
|
<H3><A NAME="q9">Why did the mouse selection thing suddenly quit working?</A></H3>
|
||||||
|
<P>
|
||||||
|
Make sure that mouse reporting is actually turned off. Unfortunately, some editors
|
||||||
|
do not properly turn off mouse reporting when they are abnormally terminated. The
|
||||||
|
tcsh shell may also use mouse reporting unless explicitly turned off. You can check
|
||||||
|
this by trying the selection/cut/paste while holding down Alt or Shift. See the
|
||||||
|
Technical Reference (<TT>doc/Eterm.ref</TT>) for more detailed information.
|
||||||
|
<BR><BR>
|
||||||
|
<HR SIZE=3 WIDTH=80%>
|
||||||
|
<H3><A NAME="q10">The docs keep mentioning blinking text, but I can't get it to work. What am I doing wrong?</A></H3>
|
||||||
|
<P>
|
||||||
|
You aren't doing anything wrong. Eterm does not support, and probably never will
|
||||||
|
support, blinking text. Instead (assuming NO_BRIGHTCOLOR is *not* defined during
|
||||||
|
compilation), Eterm uses the bold and blink attributes to provide high-intensity
|
||||||
|
versions of the foreground and background colors respectively. In general,
|
||||||
|
colors 0-7 are the low-intensity colors, and colors 8-15 are the corresponding
|
||||||
|
high-intensity colors. (So color 8 is a "bold" color 0, color 9 is a "bold"
|
||||||
|
color 1, etc.) It is worth noting that some programs break this convention and
|
||||||
|
use colors 8-15 to provide 16 total colors, none of which bear any relationship
|
||||||
|
to any other based on their color number.
|
||||||
|
|
||||||
|
<P>
|
||||||
|
Related to this issue is the question of how the default foreground and
|
||||||
|
background colors are treated (those specified by the -f (--foreground-color)
|
||||||
|
and -b (--background-color) options) with respect to the bold and blink
|
||||||
|
attributes. In the simplest (and most common) case, the fg/bg colors each match
|
||||||
|
one of the low-intensity colors (0-7). If this is true, the bold/blink
|
||||||
|
attributes (respectively) activate the corresponding high-intensity color
|
||||||
|
(8-15).
|
||||||
|
|
||||||
|
<P>
|
||||||
|
If this is not the case, and either the foreground color or the background
|
||||||
|
color does not match any of the 8 low-intensity colors, slightly different
|
||||||
|
action must be taken. In the former case, the bold foreground is simulated
|
||||||
|
using an overstrike mechanism <FONT COLOR="#ff0f0f">*</FONT>. In the
|
||||||
|
latter case, the blink attribute is simply ignored.
|
||||||
|
|
||||||
|
<P>
|
||||||
|
<FONT COLOR="#ff0f0f">*</FONT> This feature is dependent upon NO_BOLDOVERSTRIKE
|
||||||
|
not being defined during compile. Furthermore, its use is discouraged and
|
||||||
|
unsupported, as it tends to create "pixel droppings."
|
||||||
|
<BR><BR>
|
||||||
|
<HR SIZE=3 WIDTH=80%>
|
||||||
|
<H3><A NAME="q11">How do I change the screen colors?</A></H3>
|
||||||
|
<P>
|
||||||
|
You can change the colors 0-15 in your Eterm configuration file. These settings,
|
||||||
|
taken from <TT>themes/Eterm/MAIN</TT>, are Rasterman's colors which he says work well
|
||||||
|
for displaying ANSI art:
|
||||||
|
|
||||||
|
<PRE>
|
||||||
|
color 0 0 0 0
|
||||||
|
color 1 0xaa 0 0
|
||||||
|
color 2 0 0210 0
|
||||||
|
color 3 0xaa 0x55 0x22
|
||||||
|
color 4 0 0 0xaa
|
||||||
|
color 5 0xaa 0 0xaa
|
||||||
|
color 6 0 0xaa 0xaa
|
||||||
|
color 7 0xaa 0xaa 0xaa
|
||||||
|
color 8 0x44 0x44 0x44
|
||||||
|
color 9 0xff 0x44 0x44
|
||||||
|
color 10 0x44 0xff 0x44
|
||||||
|
color 11 0xff 0xff 0x44
|
||||||
|
color 12 0x44 0x44 0xff
|
||||||
|
color 13 0xff 0x44 0xff
|
||||||
|
color 14 0x44 0xff 0xff
|
||||||
|
color 15 #ffffff
|
||||||
|
</PRE>
|
||||||
|
|
||||||
|
<P>
|
||||||
|
The syntax for this section is discussed in <TT>themes/Eterm/MAIN</TT>.
|
||||||
|
|
||||||
|
<P>
|
||||||
|
You can also change individual colors on the command line, using the <TT>--color<I>N</I></TT>
|
||||||
|
options (where <I>N</I> is the number of the color you wish to change). The value can be
|
||||||
|
either a color name or an RGB triple. For example, <TT>--color5=blue</TT> or
|
||||||
|
<TT>--color1="#ff0000"</TT>.
|
||||||
|
<BR><BR>
|
||||||
|
<HR SIZE=3 WIDTH=80%>
|
||||||
|
<H3><A NAME="q12">What's the deal with Backspace/Delete? Neither seems to work!</A></H3>
|
||||||
|
<P>
|
||||||
|
The Backspace/Delete problem has plagued UNIX for quite some time now, and there are
|
||||||
|
no easy answers. This FAQ covers how Eterm handles the two keys; however, detailed
|
||||||
|
explanations of <TT>xmodmap</TT>, <TT>stty</TT>, and so forth are beyond its scope.
|
||||||
|
The appropriate man pages should be consulted.
|
||||||
|
|
||||||
|
<P>
|
||||||
|
First, I'll assume that the Backspace key on your keyboard corresponds to the Backspace
|
||||||
|
keysym under X. (This is not always the case. See the next question for more details
|
||||||
|
on this.) There are two standard values that the Backspace key sends: Ctrl-H ("^H")
|
||||||
|
and Ctrl-? ("^?"). Eterm inherits the "erase" stty setting from the terminal from
|
||||||
|
which it is started. If it is not started from a terminal (e.g., if it were started
|
||||||
|
from a window manager button or pull-down menu, or a remote shell), Eterm defaults
|
||||||
|
to the value of CERASE (defined in <termios.h>). This may not be the same
|
||||||
|
as the stty settings of your terminal.
|
||||||
|
|
||||||
|
<P>
|
||||||
|
When starting a new Eterm, you can set the desired value before calling Eterm:
|
||||||
|
|
||||||
|
<PRE>
|
||||||
|
$ stty erase ^H
|
||||||
|
$ Eterm
|
||||||
|
</PRE>
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
<PRE>
|
||||||
|
$ stty erase ^?
|
||||||
|
$ Eterm
|
||||||
|
</PRE>
|
||||||
|
|
||||||
|
<P>
|
||||||
|
Remember, you can generate either value using Backspace and Ctrl/Shift-Backspace. You
|
||||||
|
can also toggle which key is which using the "ESC[36h" and "ESC[36l" escape sequences.
|
||||||
|
|
||||||
|
<P>
|
||||||
|
In an existing Eterm, use these commands:
|
||||||
|
|
||||||
|
<PRE>
|
||||||
|
$ stty erase ^H
|
||||||
|
$ echo -n "^[[36h"
|
||||||
|
</PRE>
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
<PRE>
|
||||||
|
$ stty erase ^?
|
||||||
|
$ echo -n "^[[36l"
|
||||||
|
</PRE>
|
||||||
|
|
||||||
|
<P>
|
||||||
|
Of course, there are other Backspace-related problems. For example, some editors
|
||||||
|
use termcap/terminfo, but there are some that expect Backspace == ^H regardless.
|
||||||
|
And then there's GNU Emacs, which binds ^H to help.... My personal solution is
|
||||||
|
to always use ^H for backspace, and add this line to my <TT>.emacs</TT> file:
|
||||||
|
|
||||||
|
<PRE>
|
||||||
|
(global-set-key "\C-h" 'delete-backward-char)
|
||||||
|
</PRE>
|
||||||
|
|
||||||
|
<P>
|
||||||
|
This should cover the Backspace problems. Remember that if you use ^? for Backspace,
|
||||||
|
you'll need to change the <TT>doc/Eterm.ti</TT> and <TT>doc/Eterm.tcap</TT> to
|
||||||
|
reflect this.
|
||||||
|
|
||||||
|
<P>
|
||||||
|
The Delete key (which is supposed to correspond to ^?) has problems of its own. In
|
||||||
|
an effort to avoid excessive confusion (yeah, right :-) between Backspace and
|
||||||
|
Delete, Eterm assigns "ESC[3~" to the Delete key, which is the vt100 sequence
|
||||||
|
for Execute.
|
||||||
|
<BR><BR>
|
||||||
|
<HR SIZE=3 WIDTH=80%>
|
||||||
|
<H3><A NAME="q13">Why won't my Backspace work under Linux?</A></H3>
|
||||||
|
<P>
|
||||||
|
Apparently, the XFree86 server elects to map the Backspace key as Delete to match
|
||||||
|
the Linux console. Besides complaining to the Linux and XF86 people, here's
|
||||||
|
what you can do about it:
|
||||||
|
|
||||||
|
<OL>
|
||||||
|
<LI> Use <TT>xmodmap</TT> to correct the Backspace mapping. Add this line to your <TT>~/.Xmodmap</TT>
|
||||||
|
file:
|
||||||
|
|
||||||
|
<PRE>
|
||||||
|
keycode 22 = BackSpace
|
||||||
|
</PRE>
|
||||||
|
|
||||||
|
Use <TT>xev</TT> to change the keycode to properly match your machine if needed. This
|
||||||
|
will also fix the BackSpace problem with Motif applications, like Netscape.
|
||||||
|
<LI> Remap the Eterm keybindings as described in the next answer. You will lose
|
||||||
|
the Ctrl/Shift-Backspace and escape sequence toggling functionality discussed
|
||||||
|
in the previous answer.
|
||||||
|
</OL>
|
||||||
|
<P>
|
||||||
|
Congratulations! Your Backspace now works as described in the previous answer, so
|
||||||
|
start from there.
|
||||||
|
<BR><BR>
|
||||||
|
<HR SIZE=3 WIDTH=80%>
|
||||||
|
<H3><A NAME="q14">How do I change the key bindings in Eterm?</A></H3>
|
||||||
|
<P>
|
||||||
|
You must compile Eterm with KEYSYM_RESOURCE defined to change key bindings.
|
||||||
|
Assuming you've done this, you can change the keystrings associated with
|
||||||
|
keysyms 0xFF00 - 0xFFFF (special keys only) in your Eterm config file.
|
||||||
|
|
||||||
|
<P>
|
||||||
|
Here is a sample set of keysym attributes included in the tn3270 theme:
|
||||||
|
|
||||||
|
<PRE>
|
||||||
|
# Delete - ^D
|
||||||
|
keysym 0xFFFF "\004"
|
||||||
|
|
||||||
|
# Left - ^B
|
||||||
|
keysym 0xFF51 "\002"
|
||||||
|
# Right - ^F
|
||||||
|
keysym 0xFF53 "\006"
|
||||||
|
# Up - ^P
|
||||||
|
keysym 0xFF52 "\020"
|
||||||
|
# Down - ^N
|
||||||
|
keysym 0xFF54 "\016"
|
||||||
|
# Home - ^A
|
||||||
|
keysym 0xFF50 "\001"
|
||||||
|
# End - ^E
|
||||||
|
keysym 0xFF57 "\005"
|
||||||
|
|
||||||
|
# F1 - F12
|
||||||
|
keysym 0xFFBE "\e1"
|
||||||
|
keysym 0xFFBF "\e2"
|
||||||
|
keysym 0xFFC0 "\e3"
|
||||||
|
keysym 0xFFC1 "\e4"
|
||||||
|
keysym 0xFFC2 "\e5"
|
||||||
|
keysym 0xFFC3 "\e6"
|
||||||
|
keysym 0xFFC4 "\e7"
|
||||||
|
keysym 0xFFC5 "\e8"
|
||||||
|
keysym 0xFFC6 "\e9"
|
||||||
|
keysym 0xFFC7 "\e0"
|
||||||
|
keysym 0xFFC8 "\e-"
|
||||||
|
keysym 0xFFC9 "\e="
|
||||||
|
|
||||||
|
# map Prior/Next to F7/F8
|
||||||
|
keysym 0xFF55 "\e7"
|
||||||
|
keysym 0xFF56 "\e8"
|
||||||
|
</PRE>
|
||||||
|
<HR SIZE=3 WIDTH=80%>
|
||||||
|
<H3><A NAME="q15">My keyboard has some extra keys. How can I use them in Eterm?</A></H3>
|
||||||
|
<P>
|
||||||
|
The proper way to do this is to use <TT>xmodmap</TT> to remap the keys needed.
|
||||||
|
Consult the appropriate man page, as a discussion of <TT>xmodmap</TT> usage
|
||||||
|
is beyond the scope of this FAQ.
|
||||||
|
<BR><BR>
|
||||||
|
<HR SIZE=3 WIDTH=80%>
|
||||||
|
<H3><A NAME="q16">How does a program tell if it's running in an Eterm or an xterm?</A></H3>
|
||||||
|
<P>
|
||||||
|
It is useful to know whether or not you are in an xterm or an Eterm (or
|
||||||
|
another terminal emulator that supports color), for purposes of setting
|
||||||
|
color variables and so forth. To this end, Eterm always sets and exports
|
||||||
|
the <B><TT>$COLORTERM</TT></B> environment variable, so you can use
|
||||||
|
<TT>test</TT> to see if it's set. Many programs (mutt, jed, slrn, etc.)
|
||||||
|
perform this test for you to determine whether or not to use color.
|
||||||
|
<BR><BR>
|
||||||
|
<HR SIZE=3 WIDTH=80%>
|
||||||
|
<H3><A NAME="q17">How do I properly set <B><TT>$DISPLAY</TT></B> to the correct, full IP address from a shell?</A></H3>
|
||||||
|
<P>
|
||||||
|
You must have compiled Eterm with DISPLAY_IS_IP and ENABLE_DISPLAY_ANSWER defined. It
|
||||||
|
is also wise to define ESCZ_ANSWER properly, or the provided shell code samples
|
||||||
|
will not work. (You'll need to use <B><TT>$COLORTERM</TT></B> to determine if you
|
||||||
|
are using an Eterm.)
|
||||||
|
|
||||||
|
<P>
|
||||||
|
Here are a couple shell script samples that will properly set your
|
||||||
|
<B><TT>$DISPLAY</TT></B>, first for Bourne/POSIX-compatible shells,
|
||||||
|
then for csh-compatible shells.
|
||||||
|
|
||||||
|
<PRE>
|
||||||
|
#!/bin/sh
|
||||||
|
# If $TERM is not set, set it to xterm
|
||||||
|
[ ${TERM:-empty} = empty ] && TERM=xterm
|
||||||
|
|
||||||
|
# If it's an xterm, see if it's an Eterm
|
||||||
|
if [ ${TERM:-foo} = xterm ]; then
|
||||||
|
stty -icanon -echo min 0 time 15
|
||||||
|
echo -n '^[Z'
|
||||||
|
read term_id
|
||||||
|
stty icanon echo
|
||||||
|
|
||||||
|
# If it's an Eterm, get $DISPLAY from it.
|
||||||
|
if [ "$term_id" = '^[[?1;2C' -a ${DISPLAY:-empty} = empty ]; then
|
||||||
|
echo -n '^[[7n'
|
||||||
|
read DISPLAY
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
----- 8< ----- cut here ----- 8< -----
|
||||||
|
#!/bin/csh
|
||||||
|
# If $TERM is not set, set it to xterm
|
||||||
|
if ( !(${?TERM}) ) then
|
||||||
|
TERM = xterm
|
||||||
|
endif
|
||||||
|
|
||||||
|
# If it's an xterm, see if it's an Eterm
|
||||||
|
if ( ${TERM} =~ xterm ) then
|
||||||
|
stty -icanon -echo min 0 time 15
|
||||||
|
echo -n '^[Z'
|
||||||
|
set term_id=$<
|
||||||
|
stty icanon echo
|
||||||
|
if ( "${term_id}" == "^[[?1;2C" && ${?DISPLAY} == 0 ) then
|
||||||
|
echo -n '^[[7n'
|
||||||
|
setenv DISPLAY "$<"
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
</PRE>
|
||||||
|
<HR SIZE=3 WIDTH=80%>
|
||||||
|
<H3><A NAME="q18">Why isn't the <TT>-n (--name)</TT> option working?</A></H3>
|
||||||
|
<P>
|
||||||
|
This is most often due to the fact that the MAIN file distributed with
|
||||||
|
some versions of Eterm contains lines that set the <TT>title</TT> and
|
||||||
|
<TT>iconname</TT> attributes. If you comment these lines out, the <TT>-n
|
||||||
|
(--name)</TT> option will set the title and icon name if they are not
|
||||||
|
otherwise explicitly assigned on the command line.
|
||||||
|
<BR><BR>
|
||||||
|
<HR SIZE=3 WIDTH=80%>
|
||||||
|
<H3><A NAME="q19">Eterm doesn't work on my machine. Help!</A></H3>
|
||||||
|
<P>
|
||||||
|
One of the primary goals of the Eterm project is portability. We do our
|
||||||
|
best to write portable code, but we only have a limited number of platforms
|
||||||
|
on which we have accounts. Therefore, you as the end user are a vital part
|
||||||
|
of the testing and debugging process.
|
||||||
|
<P>
|
||||||
|
If you run into problems with Eterm, please go through the steps outlined
|
||||||
|
<A HREF="index.html#contact">here</A>. If you make it to the last step
|
||||||
|
(going in order, of course) with no luck, please do the following:</P>
|
||||||
|
<OL>
|
||||||
|
<LI> Comment out line 41 of <TT>src/feature.h</TT> where NDEBUG is defined.
|
||||||
|
<LI> Recompile Eterm.
|
||||||
|
<LI> Run the new copy of Eterm and mail the output to me (<I>mej@tcserv.com</I>).
|
||||||
|
</OL>
|
||||||
|
This is the only way we can get the information we need about where the
|
||||||
|
program is when it runs into problems, or what privileges it has, or
|
||||||
|
whatever. If you do not do this, we cannot help you.
|
||||||
|
<BR><BR>
|
||||||
|
<HR SIZE=3 WIDTH=80%>
|
||||||
|
<H3><A NAME="q20">Why is 0 sending a Ctrl-C?</A></H3>
|
||||||
|
<P>
|
||||||
|
This problem was reported by Charles Hagenbuch <chuck@athera.ml.org>. I'm not sure
|
||||||
|
why it happens, but according to Chuck, <TT>stty sane</TT> fixes it.</P>
|
||||||
|
<BR><BR>
|
||||||
|
<HR SIZE=3 WIDTH=80%>
|
||||||
|
<H3><A NAME="q21">What constitutes an Eterm theme?</A></H3>
|
||||||
|
<P>
|
||||||
|
An Eterm theme consists of a primary configuration file, always called
|
||||||
|
"MAIN", residing in a directory bearing the same name as the
|
||||||
|
theme. This directory must be a child of one of the directories
|
||||||
|
specified by <TT>CONFIG_SEARCH_PATH</TT> in <TT>src/feature.h</TT>, in
|
||||||
|
the environment variable defined by <TT>PATHENV</TT> in <TT>src/feature.h</TT>,
|
||||||
|
or in the default PATH. The theme may also contain additional configuration
|
||||||
|
files referenced by the primary MAIN file, pixmaps, menu files, documentation,
|
||||||
|
etc., which are allowable as extensions to the minimum requirement of an
|
||||||
|
Eterm theme.
|
||||||
|
|
||||||
|
<P>
|
||||||
|
By convention, Eterm themes should be stored under
|
||||||
|
<TT>~/.Eterm/themes/<theme_name>/</TT> or
|
||||||
|
<TT>$libdir/themes/<theme_name></TT>
|
||||||
|
|
||||||
|
<BR><BR>
|
||||||
|
<HR SIZE=3 WIDTH=80%>
|
||||||
|
<H3><A NAME="q22">How does Eterm determine which theme to use?</A></H3>
|
||||||
|
<P>
|
||||||
|
<OL TYPE=1>
|
||||||
|
<LI>If the <TT>-t</TT> or <TT>--theme</TT> option is specified on the
|
||||||
|
command line, Eterm will search for, and use if found, the specified
|
||||||
|
theme.
|
||||||
|
<LI>Eterm will check to see if it is running under Enlightenment. If
|
||||||
|
it is, it will query Enlightenment for the current theme name.
|
||||||
|
It will then search for, and use if found, an Eterm theme by the
|
||||||
|
same name. (NOTE: This is contingent on Enlightenment having
|
||||||
|
this capability, so this will not work yet.)
|
||||||
|
<LI>Eterm will search for, and use if found, a theme called Eterm.
|
||||||
|
<LI>Eterm will search for, and use if found, a theme called DEFAULT.
|
||||||
|
<LI>As a last resort, Eterm will search for, and use if found, a
|
||||||
|
compatible MAIN file. (Recall that this is not a valid Eterm theme.)
|
||||||
|
</OL>
|
||||||
|
<BR><BR>
|
||||||
|
<HR SIZE=3 WIDTH=80%>
|
||||||
|
<H3><A NAME="q23">What does this accomplish?</A></H3>
|
||||||
|
<P>
|
||||||
|
This proposal fulfills both of the primary goals regarding theme
|
||||||
|
support. On the one hand, it allows for things like "Eterm -t tn3270",
|
||||||
|
where <TT>.../tn3270/MAIN</TT> would contain color definitions,
|
||||||
|
keysym definitions, etc. which would be beneficial to tn3270, but
|
||||||
|
perhaps detrimental to other applications.
|
||||||
|
|
||||||
|
<P>
|
||||||
|
On the other hand, it provides Enlightenment theme authors a relatively-
|
||||||
|
transparent mechanism for extending the look and feel of their E theme
|
||||||
|
to their Eterm windows.
|
||||||
|
<BR><BR>
|
||||||
|
|
||||||
|
<HR SIZE=3>
|
||||||
|
<TABLE>
|
||||||
|
<TR>
|
||||||
|
<TD ALIGN=middle VALIGN=middle><A HREF="http://www.nu-media.net/" TARGET="_top"><IMG ALIGN=middle SRC="/pics/nupower.gif" WIDTH=110 HEIGHT=60 ALT="[Powered by Nu-Media Net!]"></A></TD>
|
||||||
|
<TD ALIGN=middle VALIGN=middle><FONT SIZE=2>
|
||||||
|
Copyright © 1997-1995, Michael Jennings. All rights worth squat. These pages are guaranteed to be
|
||||||
|
100% SPAM(tm)-free or your money back!
|
||||||
|
</TD>
|
||||||
|
</TR>
|
||||||
|
</TABLE>
|
||||||
|
<BR>
|
||||||
|
<I>Last modified -- Wednesday, 05 August 1998, 21:19:35 EDT</I><BR>
|
||||||
|
|
||||||
|
</FONT>
|
||||||
|
</BODY>
|
||||||
|
|
||||||
|
</HTML>
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
# $Id$
|
||||||
|
|
||||||
|
man_MANS = Eterm.1
|
||||||
|
|
||||||
|
all: Makefile Eterm.1.html
|
||||||
|
|
||||||
|
Eterm.1: Eterm.1.in
|
||||||
|
$(SED) -e 's%@''VERSION''@%$(VERSION)%g' -e 's%@''DATE''@%$(DATE)%g' -e 's%@THEMEDIR@%$(pkgdatadir)/themes%g' $@.in > $@
|
||||||
|
|
||||||
|
Eterm.1.html: Eterm.1
|
||||||
|
-nroff -man $< | man2html > $@
|
||||||
|
|
||||||
|
EXTRA_DIST = Eterm.1.in Eterm_reference.html Eterm.tcap Eterm.ti FAQ.html Makefile.am Makefile.in
|
||||||
|
|
|
@ -0,0 +1,238 @@
|
||||||
|
#! /bin/sh
|
||||||
|
#
|
||||||
|
# install - install a program, script, or datafile
|
||||||
|
# This comes from X11R5.
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
# 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}"
|
||||||
|
|
||||||
|
tranformbasename=""
|
||||||
|
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
|
||||||
|
true
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ x"$dir_arg" != x ]; then
|
||||||
|
dst=$src
|
||||||
|
src=""
|
||||||
|
|
||||||
|
if [ -d $dst ]; then
|
||||||
|
instcmd=:
|
||||||
|
else
|
||||||
|
instcmd=mkdir
|
||||||
|
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
|
||||||
|
true
|
||||||
|
else
|
||||||
|
echo "install: $src does not exist"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ x"$dst" = x ]
|
||||||
|
then
|
||||||
|
echo "install: no destination specified"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
true
|
||||||
|
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
|
||||||
|
true
|
||||||
|
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
|
||||||
|
true
|
||||||
|
fi
|
||||||
|
|
||||||
|
pathcomp="${pathcomp}/"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ x"$dir_arg" != x ]
|
||||||
|
then
|
||||||
|
$doit $instcmd $dst &&
|
||||||
|
|
||||||
|
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
|
||||||
|
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
|
||||||
|
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
|
||||||
|
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; 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
|
||||||
|
true
|
||||||
|
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 true;fi &&
|
||||||
|
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
|
||||||
|
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
|
||||||
|
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
|
||||||
|
|
||||||
|
# Now rename the file to the real destination.
|
||||||
|
|
||||||
|
$doit $rmcmd -f $dstdir/$dstfile &&
|
||||||
|
$doit $mvcmd $dsttmp $dstdir/$dstfile
|
||||||
|
|
||||||
|
fi &&
|
||||||
|
|
||||||
|
|
||||||
|
exit 0
|
|
@ -0,0 +1,12 @@
|
||||||
|
# $Id$
|
||||||
|
|
||||||
|
lib_LTLIBRARIES = libmej.la
|
||||||
|
|
||||||
|
libmej_la_SOURCES = debug.c mem.c strings.c snprintf.c
|
||||||
|
|
||||||
|
INCLUDES = -I. -I.. -I$(includedir) -I$(prefix)/include
|
||||||
|
|
||||||
|
libmej_la_LDFLAGS = -version-info 8:9:8
|
||||||
|
|
||||||
|
EXTRA_DIST = debug.h global.h mem.h strings.h strptime.h strptime.c
|
||||||
|
|
|
@ -0,0 +1,372 @@
|
||||||
|
# Makefile.in generated automatically by automake 1.4 from Makefile.am
|
||||||
|
|
||||||
|
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
|
||||||
|
# This Makefile.in is free software; the Free Software Foundation
|
||||||
|
# gives unlimited permission to copy and/or distribute it,
|
||||||
|
# with or without modifications, as long as this notice is preserved.
|
||||||
|
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||||
|
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
# PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
# $Id$
|
||||||
|
|
||||||
|
|
||||||
|
SHELL = @SHELL@
|
||||||
|
|
||||||
|
srcdir = @srcdir@
|
||||||
|
top_srcdir = @top_srcdir@
|
||||||
|
VPATH = @srcdir@
|
||||||
|
prefix = @prefix@
|
||||||
|
exec_prefix = @exec_prefix@
|
||||||
|
|
||||||
|
bindir = @bindir@
|
||||||
|
sbindir = @sbindir@
|
||||||
|
libexecdir = @libexecdir@
|
||||||
|
datadir = @datadir@
|
||||||
|
sysconfdir = @sysconfdir@
|
||||||
|
sharedstatedir = @sharedstatedir@
|
||||||
|
localstatedir = @localstatedir@
|
||||||
|
libdir = @libdir@
|
||||||
|
infodir = @infodir@
|
||||||
|
mandir = @mandir@
|
||||||
|
includedir = @includedir@
|
||||||
|
oldincludedir = /usr/include
|
||||||
|
|
||||||
|
DESTDIR =
|
||||||
|
|
||||||
|
pkgdatadir = $(datadir)/@PACKAGE@
|
||||||
|
pkglibdir = $(libdir)/@PACKAGE@
|
||||||
|
pkgincludedir = $(includedir)/@PACKAGE@
|
||||||
|
|
||||||
|
top_builddir = ..
|
||||||
|
|
||||||
|
ACLOCAL = @ACLOCAL@
|
||||||
|
AUTOCONF = @AUTOCONF@
|
||||||
|
AUTOMAKE = @AUTOMAKE@
|
||||||
|
AUTOHEADER = @AUTOHEADER@
|
||||||
|
|
||||||
|
INSTALL = @INSTALL@
|
||||||
|
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
|
||||||
|
INSTALL_DATA = @INSTALL_DATA@
|
||||||
|
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||||
|
transform = @program_transform_name@
|
||||||
|
|
||||||
|
NORMAL_INSTALL = :
|
||||||
|
PRE_INSTALL = :
|
||||||
|
POST_INSTALL = :
|
||||||
|
NORMAL_UNINSTALL = :
|
||||||
|
PRE_UNINSTALL = :
|
||||||
|
POST_UNINSTALL = :
|
||||||
|
host_alias = @host_alias@
|
||||||
|
host_triplet = @host@
|
||||||
|
AR = @AR@
|
||||||
|
AS = @AS@
|
||||||
|
AUTHORS = @AUTHORS@
|
||||||
|
CC = @CC@
|
||||||
|
CFLAGS = @CFLAGS@
|
||||||
|
CHMOD = @CHMOD@
|
||||||
|
CP = @CP@
|
||||||
|
CPP = @CPP@
|
||||||
|
CPPFLAGS = @CPPFLAGS@
|
||||||
|
CTAGS = @CTAGS@
|
||||||
|
DATE = @DATE@
|
||||||
|
DBX = @DBX@
|
||||||
|
DIST_ROOT = @DIST_ROOT@
|
||||||
|
DLLTOOL = @DLLTOOL@
|
||||||
|
EGCS = @EGCS@
|
||||||
|
FEATURE_CMD = @FEATURE_CMD@
|
||||||
|
GDB = @GDB@
|
||||||
|
GRLIBS = @GRLIBS@
|
||||||
|
IMLIB_CONFIG = @IMLIB_CONFIG@
|
||||||
|
LD = @LD@
|
||||||
|
LDFLAGS = @LDFLAGS@
|
||||||
|
LIBS = @LIBS@
|
||||||
|
LIBTOOL = @LIBTOOL@
|
||||||
|
LN_S = @LN_S@
|
||||||
|
MAINT = @MAINT@
|
||||||
|
MAKEINFO = @MAKEINFO@
|
||||||
|
MKDIR = @MKDIR@
|
||||||
|
MV = @MV@
|
||||||
|
NM = @NM@
|
||||||
|
OBJDUMP = @OBJDUMP@
|
||||||
|
PACKAGE = @PACKAGE@
|
||||||
|
PGCC = @PGCC@
|
||||||
|
PSTACK = @PSTACK@
|
||||||
|
RANLIB = @RANLIB@
|
||||||
|
RM = @RM@
|
||||||
|
SED = @SED@
|
||||||
|
TAR = @TAR@
|
||||||
|
THREADLIBS = @THREADLIBS@
|
||||||
|
VERSION = @VERSION@
|
||||||
|
|
||||||
|
lib_LTLIBRARIES = libmej.la
|
||||||
|
|
||||||
|
libmej_la_SOURCES = debug.c mem.c strings.c snprintf.c
|
||||||
|
|
||||||
|
INCLUDES = -I. -I.. -I$(includedir) -I$(prefix)/include
|
||||||
|
|
||||||
|
libmej_la_LDFLAGS = -version-info 8:9:8
|
||||||
|
|
||||||
|
EXTRA_DIST = debug.h global.h mem.h strings.h strptime.h strptime.c
|
||||||
|
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||||
|
CONFIG_HEADER = ../config.h
|
||||||
|
CONFIG_CLEAN_FILES =
|
||||||
|
LTLIBRARIES = $(lib_LTLIBRARIES)
|
||||||
|
|
||||||
|
|
||||||
|
DEFS = @DEFS@ -I. -I$(srcdir) -I..
|
||||||
|
X_CFLAGS = @X_CFLAGS@
|
||||||
|
X_LIBS = @X_LIBS@
|
||||||
|
X_EXTRA_LIBS = @X_EXTRA_LIBS@
|
||||||
|
X_PRE_LIBS = @X_PRE_LIBS@
|
||||||
|
libmej_la_LIBADD =
|
||||||
|
libmej_la_OBJECTS = debug.lo mem.lo strings.lo snprintf.lo
|
||||||
|
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||||
|
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||||
|
CCLD = $(CC)
|
||||||
|
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
|
||||||
|
DIST_COMMON = Makefile.am Makefile.in
|
||||||
|
|
||||||
|
|
||||||
|
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||||
|
|
||||||
|
GZIP_ENV = --best
|
||||||
|
DEP_FILES = .deps/debug.P .deps/mem.P .deps/snprintf.P .deps/strings.P
|
||||||
|
SOURCES = $(libmej_la_SOURCES)
|
||||||
|
OBJECTS = $(libmej_la_OBJECTS)
|
||||||
|
|
||||||
|
all: all-redirect
|
||||||
|
.SUFFIXES:
|
||||||
|
.SUFFIXES: .S .c .lo .o .s
|
||||||
|
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||||
|
cd $(top_srcdir) && $(AUTOMAKE) --gnu libmej/Makefile
|
||||||
|
|
||||||
|
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||||
|
cd $(top_builddir) \
|
||||||
|
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||||
|
|
||||||
|
|
||||||
|
mostlyclean-libLTLIBRARIES:
|
||||||
|
|
||||||
|
clean-libLTLIBRARIES:
|
||||||
|
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
|
||||||
|
|
||||||
|
distclean-libLTLIBRARIES:
|
||||||
|
|
||||||
|
maintainer-clean-libLTLIBRARIES:
|
||||||
|
|
||||||
|
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
|
||||||
|
@$(NORMAL_INSTALL)
|
||||||
|
$(mkinstalldirs) $(DESTDIR)$(libdir)
|
||||||
|
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
|
||||||
|
if test -f $$p; then \
|
||||||
|
echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p"; \
|
||||||
|
$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p; \
|
||||||
|
else :; fi; \
|
||||||
|
done
|
||||||
|
|
||||||
|
uninstall-libLTLIBRARIES:
|
||||||
|
@$(NORMAL_UNINSTALL)
|
||||||
|
list='$(lib_LTLIBRARIES)'; for p in $$list; do \
|
||||||
|
$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \
|
||||||
|
done
|
||||||
|
|
||||||
|
.s.o:
|
||||||
|
$(COMPILE) -c $<
|
||||||
|
|
||||||
|
.S.o:
|
||||||
|
$(COMPILE) -c $<
|
||||||
|
|
||||||
|
mostlyclean-compile:
|
||||||
|
-rm -f *.o core *.core
|
||||||
|
|
||||||
|
clean-compile:
|
||||||
|
|
||||||
|
distclean-compile:
|
||||||
|
-rm -f *.tab.c
|
||||||
|
|
||||||
|
maintainer-clean-compile:
|
||||||
|
|
||||||
|
.s.lo:
|
||||||
|
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
||||||
|
|
||||||
|
.S.lo:
|
||||||
|
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
||||||
|
|
||||||
|
mostlyclean-libtool:
|
||||||
|
-rm -f *.lo
|
||||||
|
|
||||||
|
clean-libtool:
|
||||||
|
-rm -rf .libs _libs
|
||||||
|
|
||||||
|
distclean-libtool:
|
||||||
|
|
||||||
|
maintainer-clean-libtool:
|
||||||
|
|
||||||
|
libmej.la: $(libmej_la_OBJECTS) $(libmej_la_DEPENDENCIES)
|
||||||
|
$(LINK) -rpath $(libdir) $(libmej_la_LDFLAGS) $(libmej_la_OBJECTS) $(libmej_la_LIBADD) $(LIBS)
|
||||||
|
|
||||||
|
tags: TAGS
|
||||||
|
|
||||||
|
ID: $(HEADERS) $(SOURCES) $(LISP)
|
||||||
|
list='$(SOURCES) $(HEADERS)'; \
|
||||||
|
unique=`for i in $$list; do echo $$i; done | \
|
||||||
|
awk ' { files[$$0] = 1; } \
|
||||||
|
END { for (i in files) print i; }'`; \
|
||||||
|
here=`pwd` && cd $(srcdir) \
|
||||||
|
&& mkid -f$$here/ID $$unique $(LISP)
|
||||||
|
|
||||||
|
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
|
||||||
|
tags=; \
|
||||||
|
here=`pwd`; \
|
||||||
|
list='$(SOURCES) $(HEADERS)'; \
|
||||||
|
unique=`for i in $$list; do echo $$i; done | \
|
||||||
|
awk ' { files[$$0] = 1; } \
|
||||||
|
END { for (i in files) print i; }'`; \
|
||||||
|
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|
||||||
|
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
|
||||||
|
|
||||||
|
mostlyclean-tags:
|
||||||
|
|
||||||
|
clean-tags:
|
||||||
|
|
||||||
|
distclean-tags:
|
||||||
|
-rm -f TAGS ID
|
||||||
|
|
||||||
|
maintainer-clean-tags:
|
||||||
|
|
||||||
|
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||||
|
|
||||||
|
subdir = libmej
|
||||||
|
|
||||||
|
distdir: $(DISTFILES)
|
||||||
|
here=`cd $(top_builddir) && pwd`; \
|
||||||
|
top_distdir=`cd $(top_distdir) && pwd`; \
|
||||||
|
distdir=`cd $(distdir) && pwd`; \
|
||||||
|
cd $(top_srcdir) \
|
||||||
|
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu libmej/Makefile
|
||||||
|
@for file in $(DISTFILES); do \
|
||||||
|
d=$(srcdir); \
|
||||||
|
if test -d $$d/$$file; then \
|
||||||
|
cp -pr $$/$$file $(distdir)/$$file; \
|
||||||
|
else \
|
||||||
|
test -f $(distdir)/$$file \
|
||||||
|
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||||
|
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||||
|
fi; \
|
||||||
|
done
|
||||||
|
|
||||||
|
DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
|
||||||
|
|
||||||
|
-include $(DEP_FILES)
|
||||||
|
|
||||||
|
mostlyclean-depend:
|
||||||
|
|
||||||
|
clean-depend:
|
||||||
|
|
||||||
|
distclean-depend:
|
||||||
|
-rm -rf .deps
|
||||||
|
|
||||||
|
maintainer-clean-depend:
|
||||||
|
|
||||||
|
%.o: %.c
|
||||||
|
@echo '$(COMPILE) -c $<'; \
|
||||||
|
$(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
|
||||||
|
@-cp .deps/$(*F).pp .deps/$(*F).P; \
|
||||||
|
tr ' ' '\012' < .deps/$(*F).pp \
|
||||||
|
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
|
||||||
|
>> .deps/$(*F).P; \
|
||||||
|
rm .deps/$(*F).pp
|
||||||
|
|
||||||
|
%.lo: %.c
|
||||||
|
@echo '$(LTCOMPILE) -c $<'; \
|
||||||
|
$(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
|
||||||
|
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
|
||||||
|
< .deps/$(*F).pp > .deps/$(*F).P; \
|
||||||
|
tr ' ' '\012' < .deps/$(*F).pp \
|
||||||
|
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
|
||||||
|
>> .deps/$(*F).P; \
|
||||||
|
rm -f .deps/$(*F).pp
|
||||||
|
info-am:
|
||||||
|
info: info-am
|
||||||
|
dvi-am:
|
||||||
|
dvi: dvi-am
|
||||||
|
check-am: all-am
|
||||||
|
check: check-am
|
||||||
|
installcheck-am:
|
||||||
|
installcheck: installcheck-am
|
||||||
|
install-exec-am: install-libLTLIBRARIES
|
||||||
|
install-exec: install-exec-am
|
||||||
|
|
||||||
|
install-data-am:
|
||||||
|
install-data: install-data-am
|
||||||
|
|
||||||
|
install-am: all-am
|
||||||
|
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||||
|
install: install-am
|
||||||
|
uninstall-am: uninstall-libLTLIBRARIES
|
||||||
|
uninstall: uninstall-am
|
||||||
|
all-am: Makefile $(LTLIBRARIES)
|
||||||
|
all-redirect: all-am
|
||||||
|
install-strip:
|
||||||
|
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
|
||||||
|
installdirs:
|
||||||
|
$(mkinstalldirs) $(DESTDIR)$(libdir)
|
||||||
|
|
||||||
|
|
||||||
|
mostlyclean-generic:
|
||||||
|
|
||||||
|
clean-generic:
|
||||||
|
|
||||||
|
distclean-generic:
|
||||||
|
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
||||||
|
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||||
|
|
||||||
|
maintainer-clean-generic:
|
||||||
|
mostlyclean-am: mostlyclean-libLTLIBRARIES mostlyclean-compile \
|
||||||
|
mostlyclean-libtool mostlyclean-tags mostlyclean-depend \
|
||||||
|
mostlyclean-generic
|
||||||
|
|
||||||
|
mostlyclean: mostlyclean-am
|
||||||
|
|
||||||
|
clean-am: clean-libLTLIBRARIES clean-compile clean-libtool clean-tags \
|
||||||
|
clean-depend clean-generic mostlyclean-am
|
||||||
|
|
||||||
|
clean: clean-am
|
||||||
|
|
||||||
|
distclean-am: distclean-libLTLIBRARIES distclean-compile \
|
||||||
|
distclean-libtool distclean-tags distclean-depend \
|
||||||
|
distclean-generic clean-am
|
||||||
|
-rm -f libtool
|
||||||
|
|
||||||
|
distclean: distclean-am
|
||||||
|
|
||||||
|
maintainer-clean-am: maintainer-clean-libLTLIBRARIES \
|
||||||
|
maintainer-clean-compile maintainer-clean-libtool \
|
||||||
|
maintainer-clean-tags maintainer-clean-depend \
|
||||||
|
maintainer-clean-generic distclean-am
|
||||||
|
@echo "This command is intended for maintainers to use;"
|
||||||
|
@echo "it deletes files that may require special tools to rebuild."
|
||||||
|
|
||||||
|
maintainer-clean: maintainer-clean-am
|
||||||
|
|
||||||
|
.PHONY: mostlyclean-libLTLIBRARIES distclean-libLTLIBRARIES \
|
||||||
|
clean-libLTLIBRARIES maintainer-clean-libLTLIBRARIES \
|
||||||
|
uninstall-libLTLIBRARIES install-libLTLIBRARIES mostlyclean-compile \
|
||||||
|
distclean-compile clean-compile maintainer-clean-compile \
|
||||||
|
mostlyclean-libtool distclean-libtool clean-libtool \
|
||||||
|
maintainer-clean-libtool tags mostlyclean-tags distclean-tags \
|
||||||
|
clean-tags maintainer-clean-tags distdir mostlyclean-depend \
|
||||||
|
distclean-depend clean-depend maintainer-clean-depend info-am info \
|
||||||
|
dvi-am dvi check check-am installcheck-am installcheck install-exec-am \
|
||||||
|
install-exec install-data-am install-data install-am install \
|
||||||
|
uninstall-am uninstall all-redirect all-am all installdirs \
|
||||||
|
mostlyclean-generic distclean-generic clean-generic \
|
||||||
|
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||||
|
|
||||||
|
|
||||||
|
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||||
|
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||||
|
.NOEXPORT:
|
|
@ -0,0 +1,55 @@
|
||||||
|
/*********************************************************
|
||||||
|
* DEBUG.C -- Standardized debugging output *
|
||||||
|
* -- Michael Jennings *
|
||||||
|
* -- 20 December 1996 *
|
||||||
|
*********************************************************/
|
||||||
|
/*
|
||||||
|
* This file is original work by Michael Jennings <mej@tcserv.com>.
|
||||||
|
*
|
||||||
|
* Copyright (C) 1997, Michael Jennings
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
static const char cvs_ident[] = "$Id$";
|
||||||
|
|
||||||
|
#include "global.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#ifndef WITH_DMALLOC
|
||||||
|
# include <malloc.h>
|
||||||
|
#endif
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#define DEBUG_C
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
int
|
||||||
|
real_dprintf(const char *format,...)
|
||||||
|
{
|
||||||
|
|
||||||
|
va_list args;
|
||||||
|
int n;
|
||||||
|
|
||||||
|
va_start(args, format);
|
||||||
|
n = fprintf(stderr, "[debug] ");
|
||||||
|
n += vfprintf(stderr, format, args);
|
||||||
|
va_end(args);
|
||||||
|
fflush(stderr);
|
||||||
|
return (n);
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
/**********************************************************
|
||||||
|
* DEBUG.H -- Header file for DEBUG.C *
|
||||||
|
* -- Michael Jennings *
|
||||||
|
* -- 20 December 1996 *
|
||||||
|
**********************************************************/
|
||||||
|
/*
|
||||||
|
* This file is original work by Michael Jennings <mej@tcserv.com>.
|
||||||
|
*
|
||||||
|
* Copyright (C) 1997, Michael Jennings
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(DEBUG_C) && !defined(DEBUG_CC)
|
||||||
|
extern int real_dprintf(const char *, ...);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _LIBMEJ_DEBUG_H
|
||||||
|
# define _LIBMEJ_DEBUG_H
|
||||||
|
|
||||||
|
#include "../src/debug.h"
|
||||||
|
|
||||||
|
#endif /* _LIBMEJ_DEBUG_H */
|
|
@ -0,0 +1,47 @@
|
||||||
|
/***************************************************************
|
||||||
|
* GLOBAL.H -- Compile-time options header file *
|
||||||
|
* -- Michael Jennings *
|
||||||
|
* -- 16 January 1997 *
|
||||||
|
***************************************************************/
|
||||||
|
/*
|
||||||
|
* This file is original work by Michael Jennings <mej@tcserv.com>.
|
||||||
|
*
|
||||||
|
* Copyright (C) 1997, Michael Jennings
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _GLOBAL_H_
|
||||||
|
|
||||||
|
#define _GLOBAL_H_
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#include "src/feature.h"
|
||||||
|
|
||||||
|
/* Other compile-time defines */
|
||||||
|
#ifdef LINUX
|
||||||
|
# define _GNU_SOURCE
|
||||||
|
# define __USE_GNU
|
||||||
|
# define _BSD_SOURCE
|
||||||
|
#elif defined(IRIX)
|
||||||
|
# define _MODERN_C_
|
||||||
|
# define _BSD_TYPES
|
||||||
|
# define _SGI_SOURCE
|
||||||
|
#elif defined(HP_UX)
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _GLOBAL_H_ */
|
|
@ -0,0 +1,407 @@
|
||||||
|
|
||||||
|
/***************************************************************
|
||||||
|
* MEM.C -- Memory allocation handlers *
|
||||||
|
* -- Michael Jennings *
|
||||||
|
* -- 07 January 1997 *
|
||||||
|
***************************************************************/
|
||||||
|
/*
|
||||||
|
* This file is original work by Michael Jennings <mej@tcserv.com>.
|
||||||
|
*
|
||||||
|
* Copyright (C) 1997, Michael Jennings
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
static const char cvs_ident[] = "$Id$";
|
||||||
|
|
||||||
|
#include "global.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#define MEM_C
|
||||||
|
#include "debug.h"
|
||||||
|
#include "mem.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These're added for a pretty obvious reason -- they're implemented towards
|
||||||
|
* The beginning of each one's respective function. (The ones with capitalized
|
||||||
|
* letters. I'm not sure that they'll be useful outside of gdb. Maybe.
|
||||||
|
*/
|
||||||
|
#if DEBUG >= DEBUG_MALLOC
|
||||||
|
static int malloc_count = 0;
|
||||||
|
static int calloc_count = 0;
|
||||||
|
static int realloc_count = 0;
|
||||||
|
static int free_count = 0;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
MemRec memrec =
|
||||||
|
{0, 0, 0, (void **) NULL, (size_t *) NULL};
|
||||||
|
|
||||||
|
char *
|
||||||
|
SafeStr(register char *str, unsigned short len)
|
||||||
|
{
|
||||||
|
|
||||||
|
register unsigned short i;
|
||||||
|
|
||||||
|
for (i = 0; i < len; i++) {
|
||||||
|
if (iscntrl(str[i])) {
|
||||||
|
str[i] = '.';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (str);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
memrec_init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
memrec.Count = 0;
|
||||||
|
D_MALLOC(("Constructing memrec\n"));
|
||||||
|
memrec.Ptrs = (void **) malloc(sizeof(void *));
|
||||||
|
|
||||||
|
memrec.Size = (size_t *) malloc(sizeof(size_t));
|
||||||
|
memrec.init = 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
memrec_add_var(void *ptr, size_t size)
|
||||||
|
{
|
||||||
|
|
||||||
|
memrec.Count++;
|
||||||
|
if ((memrec.Ptrs = (void **) realloc(memrec.Ptrs, sizeof(void *) * memrec.Count)) == NULL) {
|
||||||
|
D_MALLOC(("Unable to reallocate pointer list -- %s\n", strerror(errno)));
|
||||||
|
}
|
||||||
|
if ((memrec.Size = (size_t *) realloc(memrec.Size, sizeof(size_t) * memrec.Count)) == NULL) {
|
||||||
|
D_MALLOC(("Unable to reallocate pointer size list -- %s\n", strerror(errno)));
|
||||||
|
}
|
||||||
|
D_MALLOC(("Adding variable of size %lu at 0x%08x\n", size, ptr));
|
||||||
|
memrec.Ptrs[memrec.Count - 1] = ptr;
|
||||||
|
memrec.Size[memrec.Count - 1] = size;
|
||||||
|
#if 0
|
||||||
|
memrec_dump();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
memrec_rem_var(void *ptr)
|
||||||
|
{
|
||||||
|
|
||||||
|
unsigned long i;
|
||||||
|
|
||||||
|
for (i = 0; i < memrec.Count; i++)
|
||||||
|
if (memrec.Ptrs[i] == ptr)
|
||||||
|
break;
|
||||||
|
if (i == memrec.Count && memrec.Ptrs[i] != ptr) {
|
||||||
|
#if 0
|
||||||
|
memrec_dump();
|
||||||
|
#endif
|
||||||
|
D_MALLOC(("Attempt to remove a pointer not allocated with Malloc/Realloc:"
|
||||||
|
" 0x%08x\n", ptr));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
memrec.Count--;
|
||||||
|
D_MALLOC(("Removing variable of size %lu at 0x%08x\n", memrec.Size[i], memrec.Ptrs[i]));
|
||||||
|
memmove(memrec.Ptrs + i, memrec.Ptrs + i + 1, sizeof(void *) * (memrec.Count - i));
|
||||||
|
|
||||||
|
memmove(memrec.Size + i, memrec.Size + i + 1, sizeof(size_t) * (memrec.Count - i));
|
||||||
|
memrec.Ptrs = (void **) realloc(memrec.Ptrs, sizeof(void *) * memrec.Count);
|
||||||
|
|
||||||
|
memrec.Size = (size_t *) realloc(memrec.Size, sizeof(size_t) * memrec.Count);
|
||||||
|
#if 0
|
||||||
|
memrec_dump();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
memrec_chg_var(void *oldp, void *newp, size_t size)
|
||||||
|
{
|
||||||
|
|
||||||
|
unsigned long i;
|
||||||
|
|
||||||
|
for (i = 0; i < memrec.Count; i++)
|
||||||
|
if (memrec.Ptrs[i] == oldp)
|
||||||
|
break;
|
||||||
|
if (i == memrec.Count && memrec.Ptrs[i] != oldp) {
|
||||||
|
#if 0
|
||||||
|
memrec_dump();
|
||||||
|
#endif
|
||||||
|
D_MALLOC(("Attempt to move a pointer not allocated with Malloc/Realloc:"
|
||||||
|
" 0x%08x\n", oldp));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
D_MALLOC(("Changing variable of %lu bytes at 0x%08x to one "
|
||||||
|
"of %lu bytes at 0x%08x\n", memrec.Size[i], memrec.Ptrs[i], size, newp));
|
||||||
|
memrec.Ptrs[i] = newp;
|
||||||
|
memrec.Size[i] = size;
|
||||||
|
#if 0
|
||||||
|
memrec_dump();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
memrec_dump(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
unsigned long i, j, k, l, total = 0;
|
||||||
|
unsigned long len1, len2;
|
||||||
|
unsigned char *ptr;
|
||||||
|
unsigned char buff[9];
|
||||||
|
|
||||||
|
fprintf(stderr, "DUMP :: %lu pointers stored.\n", memrec.Count);
|
||||||
|
fprintf(stderr, "DUMP :: Pointer | Address | Size | Offset | 00 01 02 03 04 05 06 07 | ASCII \n");
|
||||||
|
fflush(stderr);
|
||||||
|
fprintf(stderr, "DUMP :: ---------+----------+--------+---------+-------------------------+---------\n");
|
||||||
|
fflush(stderr);
|
||||||
|
len1 = sizeof(void *) * memrec.Count;
|
||||||
|
|
||||||
|
len2 = sizeof(size_t) * memrec.Count;
|
||||||
|
for (ptr = (unsigned char *) memrec.Ptrs, j = 0; j < len1; j += 8) {
|
||||||
|
fprintf(stderr, "DUMP :: %07lu | %08X | %06lu | %07X | ", (unsigned long) 0, (unsigned int) memrec.Ptrs, (unsigned long) (sizeof(void *) * memrec.Count), (unsigned int) j);
|
||||||
|
|
||||||
|
l = ((len1 - j < 8) ? (len1 - j) : (8));
|
||||||
|
memset(buff, 0, 9);
|
||||||
|
memcpy(buff, ptr + j, l);
|
||||||
|
for (k = 0; k < l; k++) {
|
||||||
|
fprintf(stderr, "%02.2X ", buff[k]);
|
||||||
|
}
|
||||||
|
for (; k < 8; k++) {
|
||||||
|
fprintf(stderr, " ");
|
||||||
|
}
|
||||||
|
fprintf(stderr, "| %-8s\n", SafeStr((char *) buff, l));
|
||||||
|
fflush(stderr);
|
||||||
|
}
|
||||||
|
for (ptr = (unsigned char *) memrec.Size, j = 0; j < len2; j += 8) {
|
||||||
|
fprintf(stderr, "DUMP :: %07lu | %08x | %06lu | %07X | ", (unsigned long) 0, (unsigned int) memrec.Size, sizeof(size_t) * memrec.Count, (unsigned int) j);
|
||||||
|
l = ((len2 - j < 8) ? (len2 - j) : (8));
|
||||||
|
memset(buff, 0, 9);
|
||||||
|
memcpy(buff, ptr + j, l);
|
||||||
|
for (k = 0; k < l; k++) {
|
||||||
|
fprintf(stderr, "%02.2X ", buff[k]);
|
||||||
|
}
|
||||||
|
for (; k < 8; k++) {
|
||||||
|
fprintf(stderr, " ");
|
||||||
|
}
|
||||||
|
fprintf(stderr, "| %-8s\n", SafeStr((char *) buff, l));
|
||||||
|
fflush(stderr);
|
||||||
|
}
|
||||||
|
for (i = 0; i < memrec.Count; i++) {
|
||||||
|
total += memrec.Size[i];
|
||||||
|
for (ptr = (unsigned char *) memrec.Ptrs[i], j = 0; j < memrec.Size[i]; j += 8) {
|
||||||
|
fprintf(stderr, "DUMP :: %07lu | %08x | %06lu | %07X | ", i + 1, (unsigned int) memrec.Ptrs[i], (unsigned long) memrec.Size[i], (unsigned int) j);
|
||||||
|
l = ((memrec.Size[i] - j < 8) ? (memrec.Size[i] - j) : (8));
|
||||||
|
memset(buff, 0, 9);
|
||||||
|
memcpy(buff, ptr + j, l);
|
||||||
|
for (k = 0; k < l; k++) {
|
||||||
|
fprintf(stderr, "%02.2X ", buff[k]);
|
||||||
|
}
|
||||||
|
for (; k < 8; k++) {
|
||||||
|
fprintf(stderr, " ");
|
||||||
|
}
|
||||||
|
fprintf(stderr, "| %-8s\n", SafeStr((char *) buff, l));
|
||||||
|
fflush(stderr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fprintf(stderr, "DUMP :: Total allocated memory: %10lu bytes\n\n", total);
|
||||||
|
fflush(stderr);
|
||||||
|
}
|
||||||
|
|
||||||
|
/************* Function prototypes ****************/
|
||||||
|
|
||||||
|
/* Replacements for malloc(), realloc(), calloc(), and free() */
|
||||||
|
void *Malloc(size_t);
|
||||||
|
void *Realloc(void *, size_t);
|
||||||
|
void *Calloc(size_t, size_t);
|
||||||
|
void Free(void *);
|
||||||
|
|
||||||
|
/* A handler for SIGSEGV */
|
||||||
|
void HandleSigSegv(int);
|
||||||
|
|
||||||
|
void *
|
||||||
|
Malloc(size_t size)
|
||||||
|
{
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
char *temp = NULL;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
void *temp = NULL;
|
||||||
|
|
||||||
|
#if DEBUG >= DEBUG_MALLOC
|
||||||
|
++malloc_count;
|
||||||
|
#ifdef MALLOC_CALL_DEBUG
|
||||||
|
if (!(malloc_count % MALLOC_MOD)) {
|
||||||
|
fprintf(stderr, "Calls to malloc(): %d\n", malloc_count);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if DEBUG >= DEBUG_MALLOC
|
||||||
|
|
||||||
|
if (!memrec.init) {
|
||||||
|
D_MALLOC(("WARNING: You must call memrec_init() before using the libmej memory management calls.\n"));
|
||||||
|
memrec_init();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
temp = (char *) malloc(size);
|
||||||
|
#endif
|
||||||
|
temp = malloc(size);
|
||||||
|
if (!temp)
|
||||||
|
return NULL;
|
||||||
|
#if DEBUG >= DEBUG_MALLOC
|
||||||
|
memrec_add_var(temp, size);
|
||||||
|
#endif
|
||||||
|
return (temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void *
|
||||||
|
Realloc(void *ptr, size_t size)
|
||||||
|
{
|
||||||
|
|
||||||
|
char *temp = NULL;
|
||||||
|
|
||||||
|
#if DEBUG >= DEBUG_MALLOC
|
||||||
|
++realloc_count;
|
||||||
|
# ifdef MALLOC_CALL_DEBUG
|
||||||
|
if (!(realloc_count % REALLOC_MOD)) {
|
||||||
|
fprintf(stderr, "Calls to realloc(): %d\n", realloc_count);
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
/*
|
||||||
|
* Redundant. You know the drill :)
|
||||||
|
* #if DEBUG >= DEBUG_MALLOC
|
||||||
|
*/
|
||||||
|
if (!memrec.init) {
|
||||||
|
D_MALLOC(("WARNING: You must call memrec_init() before using the libmej memory management calls.\n"));
|
||||||
|
memrec_init();
|
||||||
|
}
|
||||||
|
/* #endif */
|
||||||
|
|
||||||
|
if (ptr == NULL) {
|
||||||
|
temp = (char *) Malloc(size);
|
||||||
|
} else {
|
||||||
|
temp = (char *) realloc(ptr, size);
|
||||||
|
#if DEBUG >= DEBUG_MALLOC
|
||||||
|
memrec_chg_var(ptr, temp, size);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
if (!temp)
|
||||||
|
return NULL;
|
||||||
|
return (temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void *
|
||||||
|
Calloc(size_t count, size_t size)
|
||||||
|
{
|
||||||
|
|
||||||
|
char *temp = NULL;
|
||||||
|
|
||||||
|
#if DEBUG >= DEBUG_MALLOC
|
||||||
|
++calloc_count;
|
||||||
|
#ifdef MALLOC_CALL_DEBUG
|
||||||
|
if (!(calloc_count % CALLOC_MOD)) {
|
||||||
|
fprintf(stderr, "Calls to calloc(): %d\n", calloc_count);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if DEBUG >= DEBUG_MALLOC
|
||||||
|
|
||||||
|
if (!memrec.init) {
|
||||||
|
D_MALLOC(("WARNING: You must call memrec_init() before using the libmej memory management calls.\n"));
|
||||||
|
memrec_init();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
temp = (char *) calloc(count, size);
|
||||||
|
#if DEBUG >= DEBUG_MALLOC
|
||||||
|
memrec_add_var(temp, size * count);
|
||||||
|
#endif
|
||||||
|
if (!temp)
|
||||||
|
return NULL;
|
||||||
|
return (temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Free(void *ptr)
|
||||||
|
{
|
||||||
|
|
||||||
|
#if DEBUG >= DEBUG_MALLOC
|
||||||
|
++free_count;
|
||||||
|
#ifdef MALLOC_CALL_DEBUG
|
||||||
|
if (!(free_count % FREE_MOD)) {
|
||||||
|
fprintf(stderr, "Calls to free(): %d\n", free_count);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#if DEBUG >= DEBUG_MALLOC
|
||||||
|
if (!memrec.init) {
|
||||||
|
D_MALLOC(("WARNING: You must call memrec_init() before using the libmej memory management calls.\n"));
|
||||||
|
memrec_init();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (ptr) {
|
||||||
|
#if DEBUG >= DEBUG_MALLOC
|
||||||
|
memrec_rem_var(ptr);
|
||||||
|
#endif
|
||||||
|
free(ptr);
|
||||||
|
} else {
|
||||||
|
D_MALLOC(("Caught attempt to free NULL pointer\n"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
HandleSigSegv(int sig)
|
||||||
|
{
|
||||||
|
|
||||||
|
static unsigned char segv_again = 0;
|
||||||
|
|
||||||
|
/* Reinstate ourselves as the SIGSEGV handler if we're replaced */
|
||||||
|
(void) signal(SIGSEGV, HandleSigSegv);
|
||||||
|
|
||||||
|
/* Recursive seg faults are not cool.... */
|
||||||
|
if (segv_again) {
|
||||||
|
printf("RECURSIVE SEGMENTATION FAULT DETECTED!\n");
|
||||||
|
_exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
segv_again = 1;
|
||||||
|
#if DEBUG >= DEBUG_MALLOC
|
||||||
|
fprintf(stderr, "SEGMENTATION FAULT! DUMPING MEMORY TABLE\n");
|
||||||
|
memrec_dump();
|
||||||
|
#endif
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void *
|
||||||
|
fixed_realloc(void *ptr, size_t size)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (ptr)
|
||||||
|
return (realloc(ptr, size));
|
||||||
|
else
|
||||||
|
return (malloc(size));
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,82 @@
|
||||||
|
/***************************************************************
|
||||||
|
* MEM.H -- Header file for mem.c *
|
||||||
|
* -- Michael Jennings *
|
||||||
|
* -- 07 January 1997 *
|
||||||
|
***************************************************************/
|
||||||
|
/*
|
||||||
|
* This file is original work by Michael Jennings <mej@tcserv.com>.
|
||||||
|
*
|
||||||
|
* Copyright (C) 1997, Michael Jennings
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _MEM_H_
|
||||||
|
|
||||||
|
#define _MEM_H_
|
||||||
|
|
||||||
|
typedef struct memrec_struct {
|
||||||
|
unsigned char init;
|
||||||
|
unsigned long Count, TotalSize;
|
||||||
|
void **Ptrs;
|
||||||
|
size_t *Size;
|
||||||
|
} MemRec;
|
||||||
|
|
||||||
|
#ifdef WITH_DMALLOC
|
||||||
|
# include <dmalloc.h>
|
||||||
|
# define MALLOC(sz) malloc(sz)
|
||||||
|
# define CALLOC(type,n) calloc((n),(sizeof(type)))
|
||||||
|
# define REALLOC(mem,sz) fixed_realloc((mem),(sz))
|
||||||
|
# define FREE(ptr) free(ptr)
|
||||||
|
#elif defined(DEBUG) || !defined(NDEBUG)
|
||||||
|
# define MALLOC(sz) Malloc(sz)
|
||||||
|
# define CALLOC(type,n) Calloc((n),(sizeof(type)))
|
||||||
|
# define REALLOC(mem,sz) Realloc((mem),(sz))
|
||||||
|
/* # define FREE(ptr) Free(ptr) */
|
||||||
|
# define FREE(ptr) { Free(ptr); ptr = NULL; }
|
||||||
|
# define MALLOC_MOD 25
|
||||||
|
# define REALLOC_MOD 25
|
||||||
|
# define CALLOC_MOD 25
|
||||||
|
# define FREE_MOD 25
|
||||||
|
#else
|
||||||
|
# define MALLOC(sz) malloc(sz)
|
||||||
|
# define CALLOC(type,n) calloc((n),(sizeof(type)))
|
||||||
|
# define REALLOC(mem,sz) fixed_realloc((mem),(sz))
|
||||||
|
# define FREE(ptr) free(ptr)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef MEM_C
|
||||||
|
|
||||||
|
extern char *SafeStr(char *, unsigned short);
|
||||||
|
extern MemRec memrec;
|
||||||
|
extern void memrec_init(void);
|
||||||
|
void memrec_add_var(void *, size_t);
|
||||||
|
void memrec_rem_var(void *);
|
||||||
|
void memrec_chg_var(void *, void *, size_t);
|
||||||
|
void memrec_dump(void);
|
||||||
|
extern void *Malloc(size_t);
|
||||||
|
extern void *Realloc(void *, size_t);
|
||||||
|
extern void *Calloc(size_t, size_t);
|
||||||
|
extern void Free(void *);
|
||||||
|
extern void myalarm(long);
|
||||||
|
extern void HandleSigSegv(int);
|
||||||
|
extern char *GarbageCollect(char *, size_t);
|
||||||
|
extern char *FileGarbageCollect(char *, size_t);
|
||||||
|
extern void *fixed_realloc(void *, size_t);
|
||||||
|
#endif /* MEM_C */
|
||||||
|
|
||||||
|
#endif /* _MEM_H_ */
|
||||||
|
|
|
@ -0,0 +1,519 @@
|
||||||
|
#include "global.h"
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
static const char cvs_ident[] = "$Id$";
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Shamelessly snarfed from Enlightenment...
|
||||||
|
* which shamelessly snarfed from sane...
|
||||||
|
* which shamelessly snarfed from LPR
|
||||||
|
* which probably shamelessly snarfed from....
|
||||||
|
*
|
||||||
|
* Moved comments to end so I can actually read the code.. cleaned out useless
|
||||||
|
* junk....
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HAVE_SNPRINTF
|
||||||
|
|
||||||
|
#ifdef HAVE_STDARG_H
|
||||||
|
#include <stdarg.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define VA_LOCAL_DECL va_list ap
|
||||||
|
#define VA_START(f) va_start(ap, f)
|
||||||
|
#define VA_SHIFT(v,t) ; /* no-op for ANSI */
|
||||||
|
#define VA_END va_end(ap)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* dopr(): poor man's version of doprintf
|
||||||
|
*/
|
||||||
|
|
||||||
|
static void dopr(char *buffer, const char *format, va_list args);
|
||||||
|
static void fmtstr(char *value, int ljust, int len, int zpad, int precision);
|
||||||
|
static void fmtnum(long value, int base, int dosign,
|
||||||
|
int ljust, int len, int zpad, int precision);
|
||||||
|
static void fmtdouble(int fmt, double value,
|
||||||
|
int ljust, int len, int zpad, int precision);
|
||||||
|
static void dostr(char *);
|
||||||
|
static char *output;
|
||||||
|
static void dopr_outch(int c);
|
||||||
|
static char *end;
|
||||||
|
int visible_control = 1;
|
||||||
|
|
||||||
|
int
|
||||||
|
vsnprintf(char *str, size_t count, const char *fmt, va_list args)
|
||||||
|
{
|
||||||
|
str[0] = 0;
|
||||||
|
end = str + count - 1;
|
||||||
|
dopr(str, fmt, args);
|
||||||
|
if (count > 0) {
|
||||||
|
end[0] = 0;
|
||||||
|
}
|
||||||
|
return (strlen(str));
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_STDARG_H
|
||||||
|
int
|
||||||
|
snprintf(char *str, size_t count, const char *fmt,...)
|
||||||
|
#else
|
||||||
|
int
|
||||||
|
snprintf(va_alist)
|
||||||
|
va_dcl
|
||||||
|
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
#ifndef HAVE_STDARG_H
|
||||||
|
char *str;
|
||||||
|
size_t count;
|
||||||
|
char *fmt;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
VA_LOCAL_DECL;
|
||||||
|
|
||||||
|
VA_START(fmt);
|
||||||
|
VA_SHIFT(str, char *);
|
||||||
|
|
||||||
|
VA_SHIFT(count, size_t);
|
||||||
|
VA_SHIFT(fmt, char *);
|
||||||
|
|
||||||
|
(void) vsnprintf(str, count, fmt, ap);
|
||||||
|
VA_END;
|
||||||
|
return (strlen(str));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
dopr(char *buffer, const char *format, va_list args)
|
||||||
|
{
|
||||||
|
int ch;
|
||||||
|
long value;
|
||||||
|
int longflag = 0;
|
||||||
|
char *strvalue;
|
||||||
|
int ljust;
|
||||||
|
int len;
|
||||||
|
int zpad;
|
||||||
|
int precision;
|
||||||
|
int set_precision;
|
||||||
|
double dval;
|
||||||
|
|
||||||
|
output = buffer;
|
||||||
|
while ((ch = *format++)) {
|
||||||
|
switch (ch) {
|
||||||
|
case '%':
|
||||||
|
ljust = len = zpad = 0;
|
||||||
|
precision = -1;
|
||||||
|
set_precision = 0;
|
||||||
|
nextch:
|
||||||
|
ch = *format++;
|
||||||
|
switch (ch) {
|
||||||
|
case 0:
|
||||||
|
dostr("**end of format**");
|
||||||
|
return;
|
||||||
|
case '-':
|
||||||
|
ljust = 1;
|
||||||
|
goto nextch;
|
||||||
|
case '.':
|
||||||
|
set_precision = 1;
|
||||||
|
precision = 0;
|
||||||
|
goto nextch;
|
||||||
|
case '*':
|
||||||
|
len = va_arg(args, int);
|
||||||
|
|
||||||
|
goto nextch;
|
||||||
|
case '0': /* set zero padding if len not set */
|
||||||
|
if (len == 0 && set_precision == 0)
|
||||||
|
zpad = '0';
|
||||||
|
case '1':
|
||||||
|
case '2':
|
||||||
|
case '3':
|
||||||
|
case '4':
|
||||||
|
case '5':
|
||||||
|
case '6':
|
||||||
|
case '7':
|
||||||
|
case '8':
|
||||||
|
case '9':
|
||||||
|
if (set_precision) {
|
||||||
|
precision = precision * 10 + ch - '0';
|
||||||
|
} else {
|
||||||
|
len = len * 10 + ch - '0';
|
||||||
|
}
|
||||||
|
goto nextch;
|
||||||
|
case 'l':
|
||||||
|
longflag = 1;
|
||||||
|
goto nextch;
|
||||||
|
case 'u':
|
||||||
|
case 'U':
|
||||||
|
/*fmtnum(value,base,dosign,ljust,len, zpad, precision) */
|
||||||
|
if (longflag) {
|
||||||
|
value = va_arg(args, long);
|
||||||
|
} else {
|
||||||
|
value = va_arg(args, int);
|
||||||
|
}
|
||||||
|
fmtnum(value, 10, 0, ljust, len, zpad, precision);
|
||||||
|
break;
|
||||||
|
case 'o':
|
||||||
|
case 'O':
|
||||||
|
/*fmtnum(value,base,dosign,ljust,len, zpad, precision) */
|
||||||
|
if (longflag) {
|
||||||
|
value = va_arg(args, long);
|
||||||
|
} else {
|
||||||
|
value = va_arg(args, int);
|
||||||
|
}
|
||||||
|
fmtnum(value, 8, 0, ljust, len, zpad, precision);
|
||||||
|
break;
|
||||||
|
case 'd':
|
||||||
|
case 'i':
|
||||||
|
case 'D':
|
||||||
|
if (longflag) {
|
||||||
|
value = va_arg(args, long);
|
||||||
|
} else {
|
||||||
|
value = va_arg(args, int);
|
||||||
|
}
|
||||||
|
fmtnum(value, 10, 1, ljust, len, zpad, precision);
|
||||||
|
break;
|
||||||
|
case 'x':
|
||||||
|
if (longflag) {
|
||||||
|
value = va_arg(args, long);
|
||||||
|
} else {
|
||||||
|
value = va_arg(args, int);
|
||||||
|
}
|
||||||
|
fmtnum(value, 16, 0, ljust, len, zpad, precision);
|
||||||
|
break;
|
||||||
|
case 'X':
|
||||||
|
if (longflag) {
|
||||||
|
value = va_arg(args, long);
|
||||||
|
} else {
|
||||||
|
value = va_arg(args, int);
|
||||||
|
}
|
||||||
|
fmtnum(value, -16, 0, ljust, len, zpad, precision);
|
||||||
|
break;
|
||||||
|
case 's':
|
||||||
|
strvalue = va_arg(args, char *);
|
||||||
|
|
||||||
|
fmtstr(strvalue, ljust, len, zpad, precision);
|
||||||
|
break;
|
||||||
|
case 'c':
|
||||||
|
ch = va_arg(args, int);
|
||||||
|
|
||||||
|
{
|
||||||
|
char b[2];
|
||||||
|
int vsb = visible_control;
|
||||||
|
|
||||||
|
b[0] = ch;
|
||||||
|
b[1] = 0;
|
||||||
|
visible_control = 0;
|
||||||
|
fmtstr(b, ljust, len, zpad, precision);
|
||||||
|
visible_control = vsb;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'f':
|
||||||
|
case 'g':
|
||||||
|
dval = va_arg(args, double);
|
||||||
|
|
||||||
|
fmtdouble(ch, dval, ljust, len, zpad, precision);
|
||||||
|
break;
|
||||||
|
case '%':
|
||||||
|
dopr_outch(ch);
|
||||||
|
continue;
|
||||||
|
default:
|
||||||
|
dostr("???????");
|
||||||
|
}
|
||||||
|
longflag = 0;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
dopr_outch(ch);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*output = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Format '%[-]len[.precision]s'
|
||||||
|
* - = left justify (ljust)
|
||||||
|
* len = minimum length
|
||||||
|
* precision = numbers of chars in string to use
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
fmtstr(char *value, int ljust, int len, int zpad, int precision)
|
||||||
|
{
|
||||||
|
int padlen, strlen, i, c; /* amount to pad */
|
||||||
|
|
||||||
|
zpad = 0;
|
||||||
|
if (value == 0) {
|
||||||
|
value = "<NULL>";
|
||||||
|
}
|
||||||
|
if (precision > 0) {
|
||||||
|
strlen = precision;
|
||||||
|
} else {
|
||||||
|
/* cheap strlen so you do not have library call */
|
||||||
|
for (strlen = 0; (c = value[strlen]); ++strlen) {
|
||||||
|
if (visible_control && iscntrl(c) && !isspace(c)) {
|
||||||
|
++strlen;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
padlen = len - strlen;
|
||||||
|
if (padlen < 0)
|
||||||
|
padlen = 0;
|
||||||
|
if (ljust)
|
||||||
|
padlen = -padlen;
|
||||||
|
while (padlen > 0) {
|
||||||
|
dopr_outch(' ');
|
||||||
|
--padlen;
|
||||||
|
}
|
||||||
|
/* output characters */
|
||||||
|
for (i = 0; (c = value[i]); ++i) {
|
||||||
|
if (visible_control && iscntrl(c) && !isspace(c)) {
|
||||||
|
dopr_outch('^');
|
||||||
|
c = ('@' | (c & 0x1F));
|
||||||
|
}
|
||||||
|
dopr_outch(c);
|
||||||
|
}
|
||||||
|
while (padlen < 0) {
|
||||||
|
dopr_outch(' ');
|
||||||
|
++padlen;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
fmtnum(long value, int base, int dosign, int ljust,
|
||||||
|
int len, int zpad, int precision)
|
||||||
|
{
|
||||||
|
int signvalue = 0;
|
||||||
|
unsigned long uvalue;
|
||||||
|
char convert[20];
|
||||||
|
int place = 0;
|
||||||
|
int padlen = 0; /* amount to pad */
|
||||||
|
int caps = 0;
|
||||||
|
|
||||||
|
precision = 0;
|
||||||
|
/* DEBUGP(("value 0x%x, base %d, dosign %d, ljust %d, len %d, zpad %d\n",
|
||||||
|
* value, base, dosign, ljust, len, zpad )); */
|
||||||
|
uvalue = value;
|
||||||
|
if (dosign) {
|
||||||
|
if (value < 0) {
|
||||||
|
signvalue = '-';
|
||||||
|
uvalue = -value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (base < 0) {
|
||||||
|
caps = 1;
|
||||||
|
base = -base;
|
||||||
|
}
|
||||||
|
do {
|
||||||
|
convert[place++] =
|
||||||
|
(caps ? "0123456789ABCDEF" : "0123456789abcdef")
|
||||||
|
[uvalue % (unsigned) base];
|
||||||
|
uvalue = (uvalue / (unsigned) base);
|
||||||
|
}
|
||||||
|
while (uvalue);
|
||||||
|
convert[place] = 0;
|
||||||
|
padlen = len - place;
|
||||||
|
if (padlen < 0)
|
||||||
|
padlen = 0;
|
||||||
|
if (ljust)
|
||||||
|
padlen = -padlen;
|
||||||
|
/* DEBUGP(( "str '%s', place %d, sign %c, padlen %d\n",
|
||||||
|
* convert,place,signvalue,padlen)); */
|
||||||
|
if (zpad && padlen > 0) {
|
||||||
|
if (signvalue) {
|
||||||
|
dopr_outch(signvalue);
|
||||||
|
--padlen;
|
||||||
|
signvalue = 0;
|
||||||
|
}
|
||||||
|
while (padlen > 0) {
|
||||||
|
dopr_outch(zpad);
|
||||||
|
--padlen;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while (padlen > 0) {
|
||||||
|
dopr_outch(' ');
|
||||||
|
--padlen;
|
||||||
|
}
|
||||||
|
if (signvalue)
|
||||||
|
dopr_outch(signvalue);
|
||||||
|
while (place > 0)
|
||||||
|
dopr_outch(convert[--place]);
|
||||||
|
while (padlen < 0) {
|
||||||
|
dopr_outch(' ');
|
||||||
|
++padlen;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
fmtdouble(int fmt, double value, int ljust, int len, int zpad, int precision)
|
||||||
|
{
|
||||||
|
char convert[128];
|
||||||
|
char fmtstr[128];
|
||||||
|
int l;
|
||||||
|
|
||||||
|
zpad = 0;
|
||||||
|
if (len == 0)
|
||||||
|
len = 10;
|
||||||
|
if (len > (int) sizeof(convert) - 10) {
|
||||||
|
len = (int) sizeof(convert) - 10;
|
||||||
|
}
|
||||||
|
if (precision > (int) sizeof(convert) - 10) {
|
||||||
|
precision = (int) sizeof(convert) - 10;
|
||||||
|
}
|
||||||
|
if (precision > len)
|
||||||
|
precision = len;
|
||||||
|
strcpy(fmtstr, "%");
|
||||||
|
if (ljust)
|
||||||
|
strcat(fmtstr, "-");
|
||||||
|
if (len) {
|
||||||
|
sprintf(fmtstr + strlen(fmtstr), "%d", len);
|
||||||
|
}
|
||||||
|
if (precision > 0) {
|
||||||
|
sprintf(fmtstr + strlen(fmtstr), ".%d", precision);
|
||||||
|
}
|
||||||
|
l = strlen(fmtstr);
|
||||||
|
fmtstr[l] = fmt;
|
||||||
|
fmtstr[l + 1] = 0;
|
||||||
|
sprintf(convert, fmtstr, value);
|
||||||
|
dostr(convert);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
dostr(char *str)
|
||||||
|
{
|
||||||
|
while (*str)
|
||||||
|
dopr_outch(*str++);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
dopr_outch(int c)
|
||||||
|
{
|
||||||
|
if (end == 0 || output < end) {
|
||||||
|
*output++ = c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************
|
||||||
|
* Original:
|
||||||
|
* Patrick Powell Tue Apr 11 09:48:21 PDT 1995
|
||||||
|
* A bombproof version of doprnt (dopr) included.
|
||||||
|
* Sigh. This sort of thing is always nasty do deal with. Note that
|
||||||
|
* the version here does not include floating point...
|
||||||
|
*
|
||||||
|
* plp_snprintf() is used instead of sprintf() as it does limit checks
|
||||||
|
* for string length. This covers a nasty loophole.
|
||||||
|
*
|
||||||
|
* The other functions are there to prevent NULL pointers from
|
||||||
|
* causing nast effects.
|
||||||
|
**************************************************************/
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* LPRng - An Extended Print Spooler System
|
||||||
|
*
|
||||||
|
* Copyright 1988-1997, Patrick Powell, San Diego, CA
|
||||||
|
* papowell@sdsu.edu
|
||||||
|
* See below for conditions of use.
|
||||||
|
*
|
||||||
|
***************************************************************************
|
||||||
|
* MODULE: snprintf.c
|
||||||
|
* PURPOSE: LPRng version of printf - absolutely bombproof (hopefully!)
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The "Artistic License"
|
||||||
|
*
|
||||||
|
* Preamble
|
||||||
|
*
|
||||||
|
* The intent of this document is to state the conditions under which a
|
||||||
|
* Package may be copied, such that the Copyright Holder maintains some
|
||||||
|
* semblance of artistic control over the development of the package,
|
||||||
|
* while giving the users of the package the right to use and distribute
|
||||||
|
* the Package in a more-or-less customary fashion, plus the right to make
|
||||||
|
* reasonable modifications.
|
||||||
|
*
|
||||||
|
* Definitions:
|
||||||
|
*
|
||||||
|
* "Package" refers to the collection of files distributed by the
|
||||||
|
* Copyright Holder, and derivatives of that collection of files
|
||||||
|
* created through textual modification.
|
||||||
|
*
|
||||||
|
* "Standard Version" refers to such a Package if it has not been
|
||||||
|
* modified, or has been modified in accordance with the wishes
|
||||||
|
* of the Copyright Holder as specified below.
|
||||||
|
*
|
||||||
|
* "Copyright Holder" is whoever is named in the copyright or
|
||||||
|
* copyrights for the package.
|
||||||
|
*
|
||||||
|
* "You" is you, if you are thinking about copying or distributing
|
||||||
|
* this Package.
|
||||||
|
*
|
||||||
|
* "Reasonable copying fee" is whatever you can justify on the
|
||||||
|
* basis of media cost, duplication charges, time of people involved,
|
||||||
|
* and so on. (You will not be required to justify it to the
|
||||||
|
* Copyright Holder, but only to the computing community at large
|
||||||
|
* as a market that must bear the fee.)
|
||||||
|
*
|
||||||
|
* "Freely Available" means that no fee is charged for the item
|
||||||
|
* itself, though there may be fees involved in handling the item.
|
||||||
|
* It also means that recipients of the item may redistribute it
|
||||||
|
* under the same conditions they received it.
|
||||||
|
*
|
||||||
|
* 1. You may make and give away verbatim copies of the source form of the
|
||||||
|
* Standard Version of this Package without restriction, provided that you
|
||||||
|
* duplicate all of the original copyright notices and associated disclaimers.
|
||||||
|
*
|
||||||
|
* 2. You may apply bug fixes, portability fixes and other modifications
|
||||||
|
* derived from the Public Domain or from the Copyright Holder. A Package
|
||||||
|
* modified in such a way shall still be considered the Standard Version.
|
||||||
|
*
|
||||||
|
* 3. You may otherwise modify your copy of this Package in any way, provided
|
||||||
|
* that you insert a prominent notice in each changed file stating how and
|
||||||
|
* when you changed that file, and provided that you do at least ONE of the
|
||||||
|
* following:
|
||||||
|
*
|
||||||
|
* a) place your modifications in the Public Domain or otherwise make them
|
||||||
|
* Freely Available, such as by posting said modifications to Usenet or
|
||||||
|
* an equivalent medium, or placing the modifications on a major archive
|
||||||
|
* site such as uunet.uu.net, or by allowing the Copyright Holder to include
|
||||||
|
* your modifications in the Standard Version of the Package.
|
||||||
|
*
|
||||||
|
* b) use the modified Package only within your corporation or organization.
|
||||||
|
*
|
||||||
|
* c) rename any non-standard executables so the names do not conflict
|
||||||
|
* with standard executables, which must also be provided, and provide
|
||||||
|
* a separate manual page for each non-standard executable that clearly
|
||||||
|
* documents how it differs from the Standard Version.
|
||||||
|
*
|
||||||
|
* d) make other distribution arrangements with the Copyright Holder.
|
||||||
|
*
|
||||||
|
* 4. You may distribute the programs of this Package in object code or
|
||||||
|
* executable form, provided that you do at least ONE of the following:
|
||||||
|
*
|
||||||
|
* a) distribute a Standard Version of the executables and library files,
|
||||||
|
* together with instructions (in the manual page or equivalent) on where
|
||||||
|
* to get the Standard Version.
|
||||||
|
*
|
||||||
|
* b) accompany the distribution with the machine-readable source of
|
||||||
|
* the Package with your modifications.
|
||||||
|
*
|
||||||
|
* c) give non-standard executables non-standard names, and clearly
|
||||||
|
* document the differences in manual pages (or equivalent), together
|
||||||
|
* with instructions on where to get the Standard Version.
|
||||||
|
*
|
||||||
|
* d) make other distribution arrangements with the Copyright Holder.
|
||||||
|
*
|
||||||
|
* 5. You may charge a reasonable copying fee for any distribution of this
|
||||||
|
* Package. You may charge any fee you choose for support of this
|
||||||
|
* Package. You may not charge a fee for this Package itself. However,
|
||||||
|
* you may distribute this Package in aggregate with other (possibly
|
||||||
|
* commercial) programs as part of a larger (possibly commercial) software
|
||||||
|
* distribution provided that you do not advertise this Package as a
|
||||||
|
* product of your own.
|
||||||
|
*
|
||||||
|
* 6. The name of the Copyright Holder may not be used to endorse or promote
|
||||||
|
* products derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* 7. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
||||||
|
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
*
|
||||||
|
* The End
|
||||||
|
*/
|
||||||
|
|
||||||
|
#endif /* HAVE_SNPRINTF */
|
|
@ -0,0 +1,568 @@
|
||||||
|
/***************************************************************
|
||||||
|
* STRINGS.C -- String manipulation routines *
|
||||||
|
* -- Michael Jennings *
|
||||||
|
* -- 08 January 1997 *
|
||||||
|
***************************************************************/
|
||||||
|
/*
|
||||||
|
* This file is original work by Michael Jennings <mej@tcserv.com>.
|
||||||
|
*
|
||||||
|
* Copyright (C) 1997, Michael Jennings
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
static const char cvs_ident[] = "$Id$";
|
||||||
|
|
||||||
|
#include "global.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#ifndef WITH_DMALLOC
|
||||||
|
# include <malloc.h>
|
||||||
|
#endif
|
||||||
|
#include <ctype.h>
|
||||||
|
#include "debug.h"
|
||||||
|
#include "mem.h"
|
||||||
|
#define STRINGS_C
|
||||||
|
#include "strings.h"
|
||||||
|
|
||||||
|
#ifndef HAVE_MEMMEM
|
||||||
|
/* Find first occurance of bytestring needle of size needlelen in memory region
|
||||||
|
haystack of size haystacklen */
|
||||||
|
void *
|
||||||
|
memmem(void *haystack, register size_t haystacklen, void *needle, register size_t needlelen)
|
||||||
|
{
|
||||||
|
|
||||||
|
register char *hs = (char *) haystack;
|
||||||
|
register char *n = (char *) needle;
|
||||||
|
register unsigned long i;
|
||||||
|
register len = haystacklen - needlelen;
|
||||||
|
|
||||||
|
for (i = 0; i < len; i++) {
|
||||||
|
if (!memcmp(hs + i, n, needlelen)) {
|
||||||
|
return (hs + i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef HAVE_USLEEP
|
||||||
|
void
|
||||||
|
usleep(unsigned long usec)
|
||||||
|
{
|
||||||
|
|
||||||
|
struct timeval delay;
|
||||||
|
|
||||||
|
delay.tv_sec = 0;
|
||||||
|
delay.tv_usec = usec;
|
||||||
|
select(0, NULL, NULL, NULL, &delay);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/***** Not needed ******
|
||||||
|
#ifndef HAVE_NANOSLEEP
|
||||||
|
inline void
|
||||||
|
nanosleep(unsigned long nsec) {
|
||||||
|
usleep(nsec / 1000);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
************************/
|
||||||
|
|
||||||
|
/* Return the leftmost cnt characters of str */
|
||||||
|
char *
|
||||||
|
LeftStr(const char *str, unsigned long cnt)
|
||||||
|
{
|
||||||
|
|
||||||
|
char *tmpstr;
|
||||||
|
|
||||||
|
tmpstr = (char *) MALLOC(cnt + 1);
|
||||||
|
strncpy(tmpstr, str, cnt);
|
||||||
|
tmpstr[cnt] = 0;
|
||||||
|
return (tmpstr);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Return cnt characters from str, starting at position index (from 0) */
|
||||||
|
char *
|
||||||
|
MidStr(const char *str, unsigned long index, unsigned long cnt)
|
||||||
|
{
|
||||||
|
|
||||||
|
char *tmpstr;
|
||||||
|
const char *pstr = str;
|
||||||
|
|
||||||
|
tmpstr = (char *) MALLOC(cnt + 1);
|
||||||
|
pstr += index;
|
||||||
|
strncpy(tmpstr, pstr, cnt);
|
||||||
|
tmpstr[cnt] = 0;
|
||||||
|
return (tmpstr);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Return the rightmost characters of str */
|
||||||
|
char *
|
||||||
|
RightStr(const char *str, unsigned long cnt)
|
||||||
|
{
|
||||||
|
|
||||||
|
char *tmpstr;
|
||||||
|
const char *pstr = str;
|
||||||
|
|
||||||
|
tmpstr = (char *) MALLOC(cnt + 1);
|
||||||
|
pstr += strlen(str);
|
||||||
|
pstr -= cnt;
|
||||||
|
strcpy(tmpstr, pstr);
|
||||||
|
return (tmpstr);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Returns TRUE if str matches regular expression pattern, FALSE otherwise */
|
||||||
|
#if defined(HAVE_REGEX_H) || defined(IRIX)
|
||||||
|
unsigned char
|
||||||
|
Match(register const char *str, register const char *pattern)
|
||||||
|
{
|
||||||
|
|
||||||
|
register regex_t *rexp;
|
||||||
|
register int result;
|
||||||
|
|
||||||
|
#ifndef IRIX
|
||||||
|
char errbuf[256];
|
||||||
|
|
||||||
|
rexp = (regex_t *) MALLOC(sizeof(regex_t));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef IRIX
|
||||||
|
if ((rexp = compile((const char *) pattern, (char *) NULL, (char *) NULL)) == NULL) {
|
||||||
|
fprintf(stderr, "Unable to compile regexp %s\n", pattern);
|
||||||
|
return (FALSE);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
if ((result = regcomp(rexp, pattern, REG_EXTENDED)) != 0) {
|
||||||
|
regerror(result, rexp, errbuf, 256);
|
||||||
|
fprintf(stderr, "Unable to compile regexp %s -- %s.\n", pattern, errbuf);
|
||||||
|
FREE(rexp);
|
||||||
|
return (FALSE);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef IRIX
|
||||||
|
result = step((const char *) str, rexp);
|
||||||
|
FREE(rexp);
|
||||||
|
return (result);
|
||||||
|
#else
|
||||||
|
if (((result = regexec(rexp, str, (size_t) 0, (regmatch_t *) NULL, 0))
|
||||||
|
!= 0) && (result != REG_NOMATCH)) {
|
||||||
|
regerror(result, rexp, errbuf, 256);
|
||||||
|
fprintf(stderr, "Error testing input string %s -- %s.\n", str, errbuf);
|
||||||
|
FREE(rexp);
|
||||||
|
return (FALSE);
|
||||||
|
}
|
||||||
|
FREE(rexp);
|
||||||
|
return (!result);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Return malloc'd pointer to index-th word in str. "..." counts as 1 word. */
|
||||||
|
char *
|
||||||
|
Word(unsigned long index, const char *str)
|
||||||
|
{
|
||||||
|
|
||||||
|
char *tmpstr;
|
||||||
|
char *delim = DEFAULT_DELIM;
|
||||||
|
register unsigned long i, j, k;
|
||||||
|
|
||||||
|
k = strlen(str) + 1;
|
||||||
|
if ((tmpstr = (char *) MALLOC(k)) == NULL) {
|
||||||
|
fprintf(stderr, "Word(%lu, %s): Unable to allocate memory -- %s.\n",
|
||||||
|
index, str, strerror(errno));
|
||||||
|
return ((char *) NULL);
|
||||||
|
}
|
||||||
|
*tmpstr = 0;
|
||||||
|
for (i = 0, j = 0; j < index && str[i]; j++) {
|
||||||
|
for (; isspace(str[i]); i++);
|
||||||
|
switch (str[i]) {
|
||||||
|
case '\"':
|
||||||
|
delim = "\"";
|
||||||
|
i++;
|
||||||
|
break;
|
||||||
|
case '\'':
|
||||||
|
delim = "\'";
|
||||||
|
i++;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
delim = DEFAULT_DELIM;
|
||||||
|
}
|
||||||
|
for (k = 0; str[i] && !strchr(delim, str[i]);) {
|
||||||
|
if (str[i] == '\\') {
|
||||||
|
if (str[i + 1] == '\'' || str[i + 1] == '\"') {
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tmpstr[k++] = str[i++];
|
||||||
|
}
|
||||||
|
switch (str[i]) {
|
||||||
|
case '\"':
|
||||||
|
case '\'':
|
||||||
|
i++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
tmpstr[k] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (j != index) {
|
||||||
|
FREE(tmpstr);
|
||||||
|
D_STRINGS(("Word(%lu, %s) returning NULL.\n", index, str));
|
||||||
|
return ((char *) NULL);
|
||||||
|
} else {
|
||||||
|
tmpstr = (char *) REALLOC(tmpstr, strlen(tmpstr) + 1);
|
||||||
|
D_STRINGS(("Word(%lu, %s) returning \"%s\".\n", index, str, tmpstr));
|
||||||
|
return (tmpstr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Return pointer into str to index-th word in str. "..." counts as 1 word. */
|
||||||
|
char *
|
||||||
|
PWord(unsigned long index, char *str)
|
||||||
|
{
|
||||||
|
|
||||||
|
register char *tmpstr = str;
|
||||||
|
register unsigned long j;
|
||||||
|
|
||||||
|
if (!str)
|
||||||
|
return ((char *) NULL);
|
||||||
|
for (; isspace(*tmpstr) && *tmpstr; tmpstr++);
|
||||||
|
for (j = 1; j < index && *tmpstr; j++) {
|
||||||
|
for (; !isspace(*tmpstr) && *tmpstr; tmpstr++);
|
||||||
|
for (; isspace(*tmpstr) && *tmpstr; tmpstr++);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*tmpstr == '\"' || *tmpstr == '\'') {
|
||||||
|
tmpstr++;
|
||||||
|
}
|
||||||
|
if (*tmpstr == '\0') {
|
||||||
|
D_STRINGS(("PWord(%lu, %s) returning NULL.\n", index, str));
|
||||||
|
return ((char *) NULL);
|
||||||
|
} else {
|
||||||
|
D_STRINGS(("PWord(%lu, %s) returning \"%s\"\n", index, str, tmpstr));
|
||||||
|
return tmpstr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Returns the number of words in str, for use with Word() and PWord(). "..." counts as 1 word. */
|
||||||
|
unsigned long
|
||||||
|
NumWords(const char *str)
|
||||||
|
{
|
||||||
|
|
||||||
|
register unsigned long cnt = 0;
|
||||||
|
char *delim = DEFAULT_DELIM;
|
||||||
|
register unsigned long i;
|
||||||
|
|
||||||
|
for (i = 0; str[i] && strchr(delim, str[i]); i++);
|
||||||
|
for (; str[i]; cnt++) {
|
||||||
|
switch (str[i]) {
|
||||||
|
case '\"':
|
||||||
|
delim = "\"";
|
||||||
|
i++;
|
||||||
|
break;
|
||||||
|
case '\'':
|
||||||
|
delim = "\'";
|
||||||
|
i++;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
delim = DEFAULT_DELIM;
|
||||||
|
}
|
||||||
|
for (; str[i] && !strchr(delim, str[i]); i++);
|
||||||
|
switch (str[i]) {
|
||||||
|
case '\"':
|
||||||
|
case '\'':
|
||||||
|
i++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
for (; str[i] && isspace(str[i]); i++);
|
||||||
|
}
|
||||||
|
|
||||||
|
D_STRINGS(("NumWords() returning %lu\n", cnt));
|
||||||
|
return (cnt);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *
|
||||||
|
StripWhitespace(register char *str)
|
||||||
|
{
|
||||||
|
|
||||||
|
register unsigned long i, j;
|
||||||
|
|
||||||
|
if ((j = strlen(str))) {
|
||||||
|
for (i = j - 1; isspace(*(str + i)); i--);
|
||||||
|
str[j = i + 1] = 0;
|
||||||
|
for (i = 0; isspace(*(str + i)); i++);
|
||||||
|
j -= i;
|
||||||
|
memmove(str, str + i, j + 1);
|
||||||
|
}
|
||||||
|
return (str);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *
|
||||||
|
LowerStr(char *str)
|
||||||
|
{
|
||||||
|
|
||||||
|
register char *tmp;
|
||||||
|
|
||||||
|
for (tmp = str; *tmp; tmp++)
|
||||||
|
*tmp = tolower(*tmp);
|
||||||
|
D_STRINGS(("LowerStr() returning %s\n", str));
|
||||||
|
return (str);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *
|
||||||
|
UpStr(char *str)
|
||||||
|
{
|
||||||
|
|
||||||
|
register char *tmp;
|
||||||
|
|
||||||
|
for (tmp = str; *tmp; tmp++)
|
||||||
|
*tmp = toupper(*tmp);
|
||||||
|
D_STRINGS(("UpStr() returning %s\n", str));
|
||||||
|
return (str);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *
|
||||||
|
StrCaseStr(char *haystack, register const char *needle)
|
||||||
|
{
|
||||||
|
|
||||||
|
register char *t;
|
||||||
|
register size_t len = strlen(needle);
|
||||||
|
|
||||||
|
for (t = haystack; t && *t; t++) {
|
||||||
|
if (!strncasecmp(t, needle, len)) {
|
||||||
|
return (t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *
|
||||||
|
StrCaseChr(char *haystack, register char needle)
|
||||||
|
{
|
||||||
|
|
||||||
|
register char *t;
|
||||||
|
|
||||||
|
for (t = haystack; t && *t; t++) {
|
||||||
|
if (tolower(*t) == tolower(needle)) {
|
||||||
|
return (t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *
|
||||||
|
StrCasePBrk(char *haystack, register char *needle)
|
||||||
|
{
|
||||||
|
|
||||||
|
register char *t;
|
||||||
|
|
||||||
|
for (t = haystack; t && *t; t++) {
|
||||||
|
if (StrCaseChr(needle, *t)) {
|
||||||
|
return (t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *
|
||||||
|
StrRev(register char *str)
|
||||||
|
{
|
||||||
|
|
||||||
|
register int i, j;
|
||||||
|
|
||||||
|
i = strlen(str);
|
||||||
|
for (j = 0, i--; i > j; i--, j++) {
|
||||||
|
cswap(str[j], str[i]);
|
||||||
|
}
|
||||||
|
return (str);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#if !(HAVE_STRSEP)
|
||||||
|
char *
|
||||||
|
strsep(char **str, register char *sep)
|
||||||
|
{
|
||||||
|
|
||||||
|
register char *s = *str;
|
||||||
|
char *sptr;
|
||||||
|
|
||||||
|
D_STRINGS(("StrSep(%s, %s) called.\n", *str, sep));
|
||||||
|
sptr = s;
|
||||||
|
for (; *s && !strchr(sep, *s); s++);
|
||||||
|
if (!*s) {
|
||||||
|
if (s != sptr) {
|
||||||
|
*str = s;
|
||||||
|
D_STRINGS(("Reached end of string with token \"%s\" in buffer\n", sptr));
|
||||||
|
return (sptr);
|
||||||
|
} else {
|
||||||
|
D_STRINGS(("Reached end of string\n"));
|
||||||
|
return ((char *) NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*s = 0;
|
||||||
|
*str = s + 1;
|
||||||
|
D_STRINGS(("Got token \"%s\", *str == \"%s\"\n", sptr, *str));
|
||||||
|
return (sptr);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
char *
|
||||||
|
GarbageCollect(char *buff, size_t len)
|
||||||
|
{
|
||||||
|
|
||||||
|
register char *tbuff = buff, *pbuff = buff;
|
||||||
|
register unsigned long i, j;
|
||||||
|
|
||||||
|
D_STRINGS(("Garbage collecting on %lu bytes at %10.8p\n", len, buff));
|
||||||
|
for (i = 0, j = 0; j < len; j++)
|
||||||
|
if (pbuff[j])
|
||||||
|
tbuff[i++] = pbuff[j];
|
||||||
|
tbuff[i++] = '\0';
|
||||||
|
D_STRINGS(("Garbage collecting gives: \n%s\n", buff));
|
||||||
|
return ((char *) REALLOC(buff, sizeof(char) * i));
|
||||||
|
}
|
||||||
|
|
||||||
|
char *
|
||||||
|
FGarbageCollect(char *buff, size_t len)
|
||||||
|
{
|
||||||
|
|
||||||
|
register char *tbuff = buff, *pbuff = buff;
|
||||||
|
char *tmp1, *tmp2;
|
||||||
|
register unsigned long j;
|
||||||
|
|
||||||
|
D_STRINGS(("File garbage collecting on %lu bytes at %10.8p\n", len, buff));
|
||||||
|
for (j = 0; j < len;) {
|
||||||
|
switch (pbuff[j]) {
|
||||||
|
case '#':
|
||||||
|
for (; !strchr("\r\n", pbuff[j]) && j < len; j++)
|
||||||
|
pbuff[j] = '\0'; /* First null out the line up to the CR and/or LF */
|
||||||
|
for (; strchr("\r\n", pbuff[j]) && j < len; j++)
|
||||||
|
pbuff[j] = '\0'; /* Then null out the CR and/or LF */
|
||||||
|
break;
|
||||||
|
case '\r':
|
||||||
|
case '\n':
|
||||||
|
case '\f':
|
||||||
|
case ' ':
|
||||||
|
case '\t':
|
||||||
|
case '\v':
|
||||||
|
for (; isspace(pbuff[j]) && j < len; j++)
|
||||||
|
pbuff[j] = '\0'; /* Null out the whitespace */
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
/* Find the end of this line and the occurence of the
|
||||||
|
next mid-line comment. */
|
||||||
|
tmp1 = strpbrk(pbuff + j, "\r\n");
|
||||||
|
tmp2 = strstr(pbuff + j, " #");
|
||||||
|
|
||||||
|
/* If either is null, take the non-null one. Otherwise,
|
||||||
|
take the lesser of the two. */
|
||||||
|
if (!tmp1 || !tmp2) {
|
||||||
|
tbuff = ((tmp1) ? (tmp1) : (tmp2));
|
||||||
|
} else {
|
||||||
|
tbuff = ((tmp1 < tmp2) ? (tmp1) : (tmp2));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Now let j catch up so that pbuff+j = tbuff; i.e., let
|
||||||
|
pbuff[j] refer to the same character that tbuff does */
|
||||||
|
j += tbuff - (pbuff + j);
|
||||||
|
|
||||||
|
/* Finally, change whatever is at pbuff[j] to a newline.
|
||||||
|
This will accomplish several things at once:
|
||||||
|
o It will change a \r to a \n if that's what's there
|
||||||
|
o If it's a \n, it'll stay the same. No biggie.
|
||||||
|
o If it's a space, it will end the line there and the
|
||||||
|
next line will begin with a comment, which is handled
|
||||||
|
above. */
|
||||||
|
if (j < len)
|
||||||
|
pbuff[j++] = '\n';
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Change all occurances of a backslash followed by a newline to nulls
|
||||||
|
and null out all whitespace up to the next non-whitespace character.
|
||||||
|
This handles support for breaking a string across multiple lines. */
|
||||||
|
for (j = 0; j < len; j++) {
|
||||||
|
if (pbuff[j] == '\\' && pbuff[j + 1] == '\n') {
|
||||||
|
pbuff[j++] = '\0';
|
||||||
|
for (; isspace(pbuff[j]) && j < len; j++)
|
||||||
|
pbuff[j] = '\0'; /* Null out the whitespace */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* And the final step, garbage collect the buffer to condense all
|
||||||
|
those nulls we just put in. */
|
||||||
|
return (GarbageCollect(buff, len));
|
||||||
|
}
|
||||||
|
|
||||||
|
char *
|
||||||
|
CondenseWhitespace(char *s)
|
||||||
|
{
|
||||||
|
|
||||||
|
register unsigned char gotspc = 0;
|
||||||
|
register char *pbuff = s, *pbuff2 = s;
|
||||||
|
|
||||||
|
D_STRINGS(("CondenseWhitespace(%s) called.\n", s));
|
||||||
|
for (; *pbuff2; pbuff2++) {
|
||||||
|
if (isspace(*pbuff2)) {
|
||||||
|
if (!gotspc) {
|
||||||
|
*pbuff = ' ';
|
||||||
|
gotspc = 1;
|
||||||
|
pbuff++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
*pbuff = *pbuff2;
|
||||||
|
gotspc = 0;
|
||||||
|
pbuff++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ((pbuff >= s) && (isspace(*(pbuff - 1))))
|
||||||
|
pbuff--;
|
||||||
|
*pbuff = 0;
|
||||||
|
D_STRINGS(("CondenseWhitespace() returning \"%s\"\n", s));
|
||||||
|
return (REALLOC(s, strlen(s) + 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
HexDump(void *buff, register size_t count)
|
||||||
|
{
|
||||||
|
|
||||||
|
register unsigned long j, k, l;
|
||||||
|
register unsigned char *ptr;
|
||||||
|
unsigned char buffr[9];
|
||||||
|
|
||||||
|
fprintf(stderr, " Address | Size | Offset | 00 01 02 03 04 05 06 07 | ASCII \n");
|
||||||
|
fprintf(stderr, "---------+--------+---------+-------------------------+---------\n");
|
||||||
|
for (ptr = (unsigned char *) buff, j = 0; j < count; j += 8) {
|
||||||
|
fprintf(stderr, " %08x | %06lu | %07X | ", (unsigned int) buff,
|
||||||
|
(unsigned long) count, (unsigned int) j);
|
||||||
|
l = ((count - j < 8) ? (count - j) : (8));
|
||||||
|
memset(buffr, 0, 9);
|
||||||
|
memcpy(buffr, ptr + j, l);
|
||||||
|
for (k = 0; k < l; k++) {
|
||||||
|
fprintf(stderr, "%02.2X ", buffr[k]);
|
||||||
|
}
|
||||||
|
for (; k < 8; k++) {
|
||||||
|
fprintf(stderr, " ");
|
||||||
|
}
|
||||||
|
fprintf(stderr, "| %-8s\n", SafeStr((char *) buffr, l));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,106 @@
|
||||||
|
/***************************************************************
|
||||||
|
* STRINGS.H -- String manipulation routines *
|
||||||
|
* -- Michael Jennings *
|
||||||
|
* -- 08 January 1997 *
|
||||||
|
***************************************************************/
|
||||||
|
/*
|
||||||
|
* This file is original work by Michael Jennings <mej@tcserv.com>.
|
||||||
|
*
|
||||||
|
* Copyright (C) 1997, Michael Jennings
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _STRINGS_H_
|
||||||
|
|
||||||
|
#define _STRINGS_H_
|
||||||
|
|
||||||
|
#include "global.h"
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
|
#ifndef TRUE
|
||||||
|
# define TRUE ((unsigned char)(1))
|
||||||
|
# define FALSE ((unsigned char)(0))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef swap
|
||||||
|
# define swap(a, b) (((int)(b)) ^= ((int)(a)) ^= ((int)(b)) ^= ((int)(a)))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef cswap
|
||||||
|
# define cswap(a, b) ((b) ^= (a) ^= (b) ^= (a))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define DEFAULT_DELIM " \r\n\f\t\v"
|
||||||
|
|
||||||
|
#define CONST_STRLEN(x) (sizeof(x) - 1)
|
||||||
|
#define BEG_STRCASECMP(s, constr) (strncasecmp(s, constr, CONST_STRLEN(constr)))
|
||||||
|
|
||||||
|
#ifdef IRIX
|
||||||
|
# define regex_t char
|
||||||
|
# define NBRA 9
|
||||||
|
extern char *braslist[NBRA];
|
||||||
|
extern char *braelist[NBRA];
|
||||||
|
extern int nbra, regerrno, reglength;
|
||||||
|
extern char *loc1, *loc2, *locs;
|
||||||
|
|
||||||
|
extern "C" int step(const char *, const char *);
|
||||||
|
extern "C" int advance(const char *, char *);
|
||||||
|
extern "C" char *compile(const char *, char *, char *);
|
||||||
|
#elif defined(HAVE_REGEX_H)
|
||||||
|
# include <regex.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef STRINGS_C
|
||||||
|
extern char *LeftStr(const char *, unsigned long);
|
||||||
|
extern char *MidStr(const char *, unsigned long, unsigned long);
|
||||||
|
extern char *RightStr(const char *, unsigned long);
|
||||||
|
#if defined(HAVE_REGEX_H) || defined(IRIX)
|
||||||
|
extern unsigned char Match(const char *, const char *);
|
||||||
|
#endif
|
||||||
|
extern char *Word(unsigned long index, const char *str);
|
||||||
|
extern char *PWord(unsigned long index, char *str);
|
||||||
|
extern char *StripWhitespace(char *);
|
||||||
|
extern char *LowerStr(char *);
|
||||||
|
extern char *UpStr(char *);
|
||||||
|
extern char *StrCaseStr(char *, const char *);
|
||||||
|
extern char *StrCaseChr(char *, char);
|
||||||
|
extern char *StrCasePBrk(char *, char *);
|
||||||
|
extern char *StrRev(char *);
|
||||||
|
#if !(HAVE_STRSEP)
|
||||||
|
extern char *strsep(char **, char *);
|
||||||
|
#endif
|
||||||
|
extern char *SafeStr(char *, unsigned short);
|
||||||
|
extern char *GarbageCollect(char *, size_t);
|
||||||
|
extern char *FGarbageCollect(char *, size_t);
|
||||||
|
extern char *CondenseWhitespace(char *);
|
||||||
|
extern void HexDump(void *, size_t);
|
||||||
|
#ifndef HAVE_MEMMEM
|
||||||
|
extern void *memmem(void *, size_t, void *, size_t);
|
||||||
|
#endif
|
||||||
|
#ifndef HAVE_USLEEP
|
||||||
|
extern void usleep(unsigned long);
|
||||||
|
#endif
|
||||||
|
/*
|
||||||
|
#ifndef HAVE_NANOSLEEP
|
||||||
|
extern void nanosleep(unsigned long);
|
||||||
|
#endif
|
||||||
|
*/
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _STRINGS_H_ */
|
|
@ -0,0 +1,272 @@
|
||||||
|
|
||||||
|
/***************************************************************
|
||||||
|
* STRPTIME.C -- strptime() for IRIX *
|
||||||
|
* -- Michael Jennings *
|
||||||
|
* -- 2 April 1997 *
|
||||||
|
***************************************************************/
|
||||||
|
/*
|
||||||
|
* This file is original work by Michael Jennings <mej@tcserv.com>.
|
||||||
|
*
|
||||||
|
* Copyright (C) 1997, Michael Jennings
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
static const char cvs_ident[] = "$Id$";
|
||||||
|
|
||||||
|
#ifdef IRIX
|
||||||
|
|
||||||
|
#include "global.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <time.h>
|
||||||
|
#define STRPTIME_C
|
||||||
|
#include "strptime.h"
|
||||||
|
|
||||||
|
char *
|
||||||
|
strptime(char *buf, const char *format, struct tm *tm)
|
||||||
|
{
|
||||||
|
|
||||||
|
register char c;
|
||||||
|
register const char *tmp;
|
||||||
|
register int i, len;
|
||||||
|
|
||||||
|
for (tmp = format; *tmp;) {
|
||||||
|
if (!(*buf))
|
||||||
|
break;
|
||||||
|
|
||||||
|
if ((c = *tmp++) != '%') {
|
||||||
|
if (!isspace(*buf) && c != *buf++)
|
||||||
|
return ((char *) NULL);
|
||||||
|
for (; *buf != 0 && isspace(*buf); buf++);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
switch ((c = *tmp++)) {
|
||||||
|
case 0:
|
||||||
|
case '%':
|
||||||
|
if (*buf++ != '%')
|
||||||
|
return ((char *) NULL);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'C':
|
||||||
|
buf = strptime(buf, USMap.LocaleDateFormat, tm);
|
||||||
|
if (!buf)
|
||||||
|
return ((char *) NULL);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'c':
|
||||||
|
buf = strptime(buf, "%x %X", tm);
|
||||||
|
if (!buf)
|
||||||
|
return ((char *) NULL);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'D':
|
||||||
|
buf = strptime(buf, "%m/%d/%y", tm);
|
||||||
|
if (!buf)
|
||||||
|
return ((char *) NULL);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'R':
|
||||||
|
buf = strptime(buf, "%H:%M", tm);
|
||||||
|
if (!buf)
|
||||||
|
return ((char *) NULL);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'r':
|
||||||
|
buf = strptime(buf, "%I:%M:%S %p", tm);
|
||||||
|
if (!buf)
|
||||||
|
return ((char *) NULL);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'T':
|
||||||
|
buf = strptime(buf, "%H:%M:%S", tm);
|
||||||
|
if (!buf)
|
||||||
|
return ((char *) NULL);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'X':
|
||||||
|
buf = strptime(buf, USMap.TimeFormat, tm);
|
||||||
|
if (!buf)
|
||||||
|
return ((char *) NULL);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'x':
|
||||||
|
buf = strptime(buf, USMap.DateFormat, tm);
|
||||||
|
if (!buf)
|
||||||
|
return ((char *) NULL);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'j':
|
||||||
|
if (!isdigit(*buf))
|
||||||
|
return ((char *) NULL);
|
||||||
|
for (i = 0; *buf != 0 && isdigit(*buf); buf++) {
|
||||||
|
i *= 10;
|
||||||
|
i += *buf - '0';
|
||||||
|
}
|
||||||
|
if (i > 365)
|
||||||
|
return ((char *) NULL);
|
||||||
|
tm->tm_yday = i;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'M':
|
||||||
|
case 'S':
|
||||||
|
if (!(*buf) || isspace(*buf))
|
||||||
|
break;
|
||||||
|
if (!isdigit(*buf))
|
||||||
|
return ((char *) NULL);
|
||||||
|
for (i = 0; *buf != 0 && isdigit(*buf); buf++) {
|
||||||
|
i *= 10;
|
||||||
|
i += *buf - '0';
|
||||||
|
}
|
||||||
|
if (i > 59)
|
||||||
|
return ((char *) NULL);
|
||||||
|
if (c == 'M')
|
||||||
|
tm->tm_min = i;
|
||||||
|
else
|
||||||
|
tm->tm_sec = i;
|
||||||
|
|
||||||
|
if (*buf && isspace(*buf))
|
||||||
|
for (; *tmp && !isspace(*tmp); tmp++);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'H':
|
||||||
|
case 'I':
|
||||||
|
case 'k':
|
||||||
|
case 'l':
|
||||||
|
if (!isdigit(*buf))
|
||||||
|
return ((char *) NULL);
|
||||||
|
for (i = 0; *buf && isdigit(*buf); buf++) {
|
||||||
|
i *= 10;
|
||||||
|
i += *buf - '0';
|
||||||
|
}
|
||||||
|
if (c == 'H' || c == 'k') {
|
||||||
|
if (i > 23)
|
||||||
|
return ((char *) NULL);
|
||||||
|
} else if (i > 11)
|
||||||
|
return ((char *) NULL);
|
||||||
|
tm->tm_hour = i;
|
||||||
|
if (*buf && isspace(*buf))
|
||||||
|
for (; *tmp && !isspace(*tmp); tmp++);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'p':
|
||||||
|
len = strlen(USMap.AM);
|
||||||
|
if (!strncasecmp(buf, USMap.AM, len)) {
|
||||||
|
if (tm->tm_hour > 12)
|
||||||
|
return ((char *) NULL);
|
||||||
|
if (tm->tm_hour == 12)
|
||||||
|
tm->tm_hour = 0;
|
||||||
|
buf += len;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
len = strlen(USMap.PM);
|
||||||
|
if (!strncasecmp(buf, USMap.PM, len)) {
|
||||||
|
if (tm->tm_hour > 12)
|
||||||
|
return ((char *) NULL);
|
||||||
|
if (tm->tm_hour != 12)
|
||||||
|
tm->tm_hour += 12;
|
||||||
|
buf += len;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return ((char *) NULL);
|
||||||
|
|
||||||
|
case 'A':
|
||||||
|
case 'a':
|
||||||
|
for (i = 0; i < NUM_DAYS; i++) {
|
||||||
|
len = strlen(USMap.Days[i]);
|
||||||
|
if (!strncasecmp(buf, USMap.Days[i], len))
|
||||||
|
break;
|
||||||
|
len = strlen(USMap.DaysAbbrev[i]);
|
||||||
|
if (!strncasecmp(buf, USMap.DaysAbbrev[i], len))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (i == NUM_DAYS)
|
||||||
|
return ((char *) NULL);
|
||||||
|
tm->tm_wday = i;
|
||||||
|
buf += len;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'd':
|
||||||
|
case 'e':
|
||||||
|
if (!isdigit(*buf))
|
||||||
|
return ((char *) NULL);
|
||||||
|
for (i = 0; *buf && isdigit(*buf); buf++) {
|
||||||
|
i *= 10;
|
||||||
|
i += *buf - '0';
|
||||||
|
}
|
||||||
|
if (i > 31)
|
||||||
|
return ((char *) NULL);
|
||||||
|
tm->tm_mday = i;
|
||||||
|
if (*buf && isspace(*buf))
|
||||||
|
for (; *tmp && !isspace(*tmp); tmp++);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'B':
|
||||||
|
case 'b':
|
||||||
|
case 'h':
|
||||||
|
for (i = 0; i < NUM_MONTHS; i++) {
|
||||||
|
len = strlen(USMap.Months[i]);
|
||||||
|
if (!strncasecmp(buf, USMap.Months[i], len))
|
||||||
|
break;
|
||||||
|
len = strlen(USMap.MonthsAbbrev[i]);
|
||||||
|
if (!strncasecmp(buf, USMap.MonthsAbbrev[i], len))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (i == NUM_MONTHS)
|
||||||
|
return ((char *) NULL);
|
||||||
|
tm->tm_mon = i;
|
||||||
|
buf += len;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'm':
|
||||||
|
if (!isdigit(*buf))
|
||||||
|
return ((char *) NULL);
|
||||||
|
for (i = 0; *buf && isdigit(*buf); buf++) {
|
||||||
|
i *= 10;
|
||||||
|
i += *buf - '0';
|
||||||
|
}
|
||||||
|
if (i < 1 || i > 12)
|
||||||
|
return ((char *) NULL);
|
||||||
|
tm->tm_mon = i - 1;
|
||||||
|
if (*buf && isspace(*buf))
|
||||||
|
for (; *tmp && !isspace(*tmp); tmp++);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'Y':
|
||||||
|
case 'y':
|
||||||
|
if (!(*buf) || isspace(*buf))
|
||||||
|
break;
|
||||||
|
if (!isdigit(*buf))
|
||||||
|
return ((char *) NULL);
|
||||||
|
for (i = 0; *buf && isdigit(*buf); buf++) {
|
||||||
|
i *= 10;
|
||||||
|
i += *buf - '0';
|
||||||
|
}
|
||||||
|
if (c == 'Y')
|
||||||
|
i -= 1900;
|
||||||
|
if (i < 0)
|
||||||
|
return ((char *) NULL);
|
||||||
|
tm->tm_year = i;
|
||||||
|
if (*buf && isspace(*buf))
|
||||||
|
for (; *tmp && !isspace(*tmp); tmp++);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,76 @@
|
||||||
|
/***************************************************************
|
||||||
|
* STRPTIME.H -- Header file for strptime() *
|
||||||
|
* -- Michael Jennings *
|
||||||
|
* -- 2 April 1997 *
|
||||||
|
***************************************************************/
|
||||||
|
/*
|
||||||
|
* This file is original work by Michael Jennings <mej@tcserv.com>.
|
||||||
|
*
|
||||||
|
* Copyright (C) 1997, Michael Jennings
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _STRPTIME_H_
|
||||||
|
|
||||||
|
#define _STRPTIME_H_
|
||||||
|
|
||||||
|
#define sizeofone(s) (sizeof(s) / sizeof((s)[0]))
|
||||||
|
|
||||||
|
#define NUM_MONTHS 12
|
||||||
|
#define NUM_DAYS 7
|
||||||
|
|
||||||
|
typedef struct dtmap_struct {
|
||||||
|
char *Months[NUM_MONTHS];
|
||||||
|
char *MonthsAbbrev[NUM_MONTHS];
|
||||||
|
char *Days[NUM_DAYS];
|
||||||
|
char *DaysAbbrev[NUM_DAYS];
|
||||||
|
char *DateFormat;
|
||||||
|
char *TimeFormat;
|
||||||
|
char *DateTimeFormat;
|
||||||
|
char *LocaleDateFormat;
|
||||||
|
char *AM;
|
||||||
|
char *PM;
|
||||||
|
} DTMap;
|
||||||
|
|
||||||
|
static DTMap USMap = {
|
||||||
|
{ "January", "February", "March", "April",
|
||||||
|
"May", "June", "July", "August",
|
||||||
|
"September", "October", "November", "December" },
|
||||||
|
{ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
||||||
|
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec" },
|
||||||
|
{ "Sunday", "Monday", "Tuesday", "Wednesday",
|
||||||
|
"Thursday", "Friday", "Saturday" },
|
||||||
|
{ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" },
|
||||||
|
"%m/%d/%y",
|
||||||
|
"%H:%M:%S",
|
||||||
|
"%a %b %e %T %Z %Y",
|
||||||
|
"%A, %B, %e, %Y",
|
||||||
|
"AM",
|
||||||
|
"PM"
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifndef STRPTIME_C
|
||||||
|
# ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
# else
|
||||||
|
extern {
|
||||||
|
# endif
|
||||||
|
extern char *strptime(char *, const char *, struct tm *);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _STRPTIME_H_ */
|
|
@ -0,0 +1,188 @@
|
||||||
|
#! /bin/sh
|
||||||
|
# Common stub for a few missing GNU programs while installing.
|
||||||
|
# Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||||
|
# Franc,ois Pinard <pinard@iro.umontreal.ca>, 1996.
|
||||||
|
|
||||||
|
# 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, 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.
|
||||||
|
|
||||||
|
if test $# -eq 0; then
|
||||||
|
echo 1>&2 "Try \`$0 --help' for more information"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
|
||||||
|
-h|--h|--he|--hel|--help)
|
||||||
|
echo "\
|
||||||
|
$0 [OPTION]... PROGRAM [ARGUMENT]...
|
||||||
|
|
||||||
|
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
|
||||||
|
error status if there is no known handling for PROGRAM.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-h, --help display this help and exit
|
||||||
|
-v, --version output version information and exit
|
||||||
|
|
||||||
|
Supported PROGRAM values:
|
||||||
|
aclocal touch file \`aclocal.m4'
|
||||||
|
autoconf touch file \`configure'
|
||||||
|
autoheader touch file \`config.h.in'
|
||||||
|
automake touch all \`Makefile.in' files
|
||||||
|
bison create \`y.tab.[ch]', if possible, from existing .[ch]
|
||||||
|
flex create \`lex.yy.c', if possible, from existing .c
|
||||||
|
lex create \`lex.yy.c', if possible, from existing .c
|
||||||
|
makeinfo touch the output file
|
||||||
|
yacc create \`y.tab.[ch]', if possible, from existing .[ch]"
|
||||||
|
;;
|
||||||
|
|
||||||
|
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
|
||||||
|
echo "missing - GNU libit 0.0"
|
||||||
|
;;
|
||||||
|
|
||||||
|
-*)
|
||||||
|
echo 1>&2 "$0: Unknown \`$1' option"
|
||||||
|
echo 1>&2 "Try \`$0 --help' for more information"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
|
||||||
|
aclocal)
|
||||||
|
echo 1>&2 "\
|
||||||
|
WARNING: \`$1' is missing on your system. You should only need it if
|
||||||
|
you modified \`acinclude.m4' or \`configure.in'. You might want
|
||||||
|
to install the \`Automake' and \`Perl' packages. Grab them from
|
||||||
|
any GNU archive site."
|
||||||
|
touch aclocal.m4
|
||||||
|
;;
|
||||||
|
|
||||||
|
autoconf)
|
||||||
|
echo 1>&2 "\
|
||||||
|
WARNING: \`$1' is missing on your system. You should only need it if
|
||||||
|
you modified \`configure.in'. You might want to install the
|
||||||
|
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
|
||||||
|
archive site."
|
||||||
|
touch configure
|
||||||
|
;;
|
||||||
|
|
||||||
|
autoheader)
|
||||||
|
echo 1>&2 "\
|
||||||
|
WARNING: \`$1' is missing on your system. You should only need it if
|
||||||
|
you modified \`acconfig.h' or \`configure.in'. You might want
|
||||||
|
to install the \`Autoconf' and \`GNU m4' packages. Grab them
|
||||||
|
from any GNU archive site."
|
||||||
|
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER([^):]*:\([^)]*\)).*/\1/p' configure.in`
|
||||||
|
if test -z "$files"; then
|
||||||
|
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^):]*\)).*/\1/p' configure.in`
|
||||||
|
test -z "$files" || files="$files.in"
|
||||||
|
else
|
||||||
|
files=`echo "$files" | sed -e 's/:/ /g'`
|
||||||
|
fi
|
||||||
|
test -z "$files" && files="config.h.in"
|
||||||
|
touch $files
|
||||||
|
;;
|
||||||
|
|
||||||
|
automake)
|
||||||
|
echo 1>&2 "\
|
||||||
|
WARNING: \`$1' is missing on your system. You should only need it if
|
||||||
|
you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'.
|
||||||
|
You might want to install the \`Automake' and \`Perl' packages.
|
||||||
|
Grab them from any GNU archive site."
|
||||||
|
find . -type f -name Makefile.am -print \
|
||||||
|
| sed 's/^\(.*\).am$/touch \1.in/' \
|
||||||
|
| sh
|
||||||
|
;;
|
||||||
|
|
||||||
|
bison|yacc)
|
||||||
|
echo 1>&2 "\
|
||||||
|
WARNING: \`$1' is missing on your system. You should only need it if
|
||||||
|
you modified a \`.y' file. You may need the \`Bison' package
|
||||||
|
in order for those modifications to take effect. You can get
|
||||||
|
\`Bison' from any GNU archive site."
|
||||||
|
rm -f y.tab.c y.tab.h
|
||||||
|
if [ $# -ne 1 ]; then
|
||||||
|
eval LASTARG="\${$#}"
|
||||||
|
case "$LASTARG" in
|
||||||
|
*.y)
|
||||||
|
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
|
||||||
|
if [ -f "$SRCFILE" ]; then
|
||||||
|
cp "$SRCFILE" y.tab.c
|
||||||
|
fi
|
||||||
|
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
|
||||||
|
if [ -f "$SRCFILE" ]; then
|
||||||
|
cp "$SRCFILE" y.tab.h
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
if [ ! -f y.tab.h ]; then
|
||||||
|
echo >y.tab.h
|
||||||
|
fi
|
||||||
|
if [ ! -f y.tab.c ]; then
|
||||||
|
echo 'main() { return 0; }' >y.tab.c
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
|
lex|flex)
|
||||||
|
echo 1>&2 "\
|
||||||
|
WARNING: \`$1' is missing on your system. You should only need it if
|
||||||
|
you modified a \`.l' file. You may need the \`Flex' package
|
||||||
|
in order for those modifications to take effect. You can get
|
||||||
|
\`Flex' from any GNU archive site."
|
||||||
|
rm -f lex.yy.c
|
||||||
|
if [ $# -ne 1 ]; then
|
||||||
|
eval LASTARG="\${$#}"
|
||||||
|
case "$LASTARG" in
|
||||||
|
*.l)
|
||||||
|
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
|
||||||
|
if [ -f "$SRCFILE" ]; then
|
||||||
|
cp "$SRCFILE" lex.yy.c
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
if [ ! -f lex.yy.c ]; then
|
||||||
|
echo 'main() { return 0; }' >lex.yy.c
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
|
makeinfo)
|
||||||
|
echo 1>&2 "\
|
||||||
|
WARNING: \`$1' is missing on your system. You should only need it if
|
||||||
|
you modified a \`.texi' or \`.texinfo' file, or any other file
|
||||||
|
indirectly affecting the aspect of the manual. The spurious
|
||||||
|
call might also be the consequence of using a buggy \`make' (AIX,
|
||||||
|
DU, IRIX). You might want to install the \`Texinfo' package or
|
||||||
|
the \`GNU make' package. Grab either from any GNU archive site."
|
||||||
|
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
|
||||||
|
if test -z "$file"; then
|
||||||
|
file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
|
||||||
|
file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
|
||||||
|
fi
|
||||||
|
touch $file
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
echo 1>&2 "\
|
||||||
|
WARNING: \`$1' is needed, and you do not seem to have it handy on your
|
||||||
|
system. You might have modified some files without having the
|
||||||
|
proper tools for further handling them. Check the \`README' file,
|
||||||
|
it often tells you about the needed prerequirements for installing
|
||||||
|
this package. You may also peek at any GNU archive site, in case
|
||||||
|
some other package would contain this missing \`$1' program."
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
exit 0
|
|
@ -0,0 +1,32 @@
|
||||||
|
#!/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
|
||||||
|
|
||||||
|
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
|
||||||
|
mkdir "$pathcomp" || errstatus=$?
|
||||||
|
fi
|
||||||
|
|
||||||
|
pathcomp="$pathcomp/"
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
exit $errstatus
|
||||||
|
|
||||||
|
# mkinstalldirs ends here
|
|
@ -0,0 +1,9 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
for i in *.c src/*.c utils/*.c ; do
|
||||||
|
if test -f $i; then
|
||||||
|
echo Reformatting $i
|
||||||
|
indent -bap -br -ce -ci4 -cli2 -cs -di1 -i2 -l140 -lp -lps -nbc -npcs -nss -nsob -psl $i
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
Makefile
|
||||||
|
Makefile.in
|
||||||
|
.deps
|
||||||
|
.libs
|
||||||
|
Eterm
|
||||||
|
libEterm.la
|
||||||
|
feature.h
|
||||||
|
VERSION.h
|
||||||
|
*.lo
|
||||||
|
*.da
|
|
@ -0,0 +1,822 @@
|
||||||
|
/* XPM */
|
||||||
|
static char * Eterm_xpm[] = {
|
||||||
|
"48 48 771 2",
|
||||||
|
" c None",
|
||||||
|
". c #282722",
|
||||||
|
"+ c #2E2C27",
|
||||||
|
"@ c #33332C",
|
||||||
|
"# c #3A382F",
|
||||||
|
"$ c #403E36",
|
||||||
|
"% c #44433B",
|
||||||
|
"& c #47463C",
|
||||||
|
"* c #515048",
|
||||||
|
"= c #58584E",
|
||||||
|
"- c #5B5B52",
|
||||||
|
"; c #757469",
|
||||||
|
"> c #918F83",
|
||||||
|
", c #8B897D",
|
||||||
|
"' c #7F7E70",
|
||||||
|
") c #807E6F",
|
||||||
|
"! c #878576",
|
||||||
|
"~ c #8C8C7A",
|
||||||
|
"{ c #010103",
|
||||||
|
"] c #020204",
|
||||||
|
"^ c #32322B",
|
||||||
|
"/ c #3B382E",
|
||||||
|
"( c #434035",
|
||||||
|
"_ c #48473D",
|
||||||
|
": c #505044",
|
||||||
|
"< c #565647",
|
||||||
|
"[ c #5A584A",
|
||||||
|
"} c #5B5B4A",
|
||||||
|
"| c #5C5B4D",
|
||||||
|
"1 c #5E5B50",
|
||||||
|
"2 c #5E5C50",
|
||||||
|
"3 c #6D6A5C",
|
||||||
|
"4 c #757362",
|
||||||
|
"5 c #787764",
|
||||||
|
"6 c #7D7B6B",
|
||||||
|
"7 c #81806F",
|
||||||
|
"8 c #848372",
|
||||||
|
"9 c #888675",
|
||||||
|
"0 c #949484",
|
||||||
|
"a c #A8A796",
|
||||||
|
"b c #B3B3A0",
|
||||||
|
"c c #B9B6A4",
|
||||||
|
"d c #B4B39F",
|
||||||
|
"e c #A6A592",
|
||||||
|
"f c #959482",
|
||||||
|
"g c #928F7E",
|
||||||
|
"h c #92917E",
|
||||||
|
"i c #928F7D",
|
||||||
|
"j c #3B3A32",
|
||||||
|
"k c #454337",
|
||||||
|
"l c #71705B",
|
||||||
|
"m c #706F5B",
|
||||||
|
"n c #6C6C5A",
|
||||||
|
"o c #727261",
|
||||||
|
"p c #757263",
|
||||||
|
"q c #757363",
|
||||||
|
"r c #757563",
|
||||||
|
"s c #787563",
|
||||||
|
"t c #787663",
|
||||||
|
"u c #787863",
|
||||||
|
"v c #797963",
|
||||||
|
"w c #7C7969",
|
||||||
|
"x c #7C7C69",
|
||||||
|
"y c #7D7C6B",
|
||||||
|
"z c #7D7D6B",
|
||||||
|
"A c #7E7D6B",
|
||||||
|
"B c #807D6B",
|
||||||
|
"C c #827F6C",
|
||||||
|
"D c #848270",
|
||||||
|
"E c #8F8B7D",
|
||||||
|
"F c #A7A693",
|
||||||
|
"G c #B2B1A0",
|
||||||
|
"H c #B6B3A2",
|
||||||
|
"I c #B6B6A2",
|
||||||
|
"J c #B3B1A0",
|
||||||
|
"K c #ADAA99",
|
||||||
|
"L c #9A9988",
|
||||||
|
"M c #8C8979",
|
||||||
|
"N c #8D8A7A",
|
||||||
|
"O c #8D8D7A",
|
||||||
|
"P c #8D8B7B",
|
||||||
|
"Q c #3E3E34",
|
||||||
|
"R c #34342C",
|
||||||
|
"S c #726E5C",
|
||||||
|
"T c #72705E",
|
||||||
|
"U c #6A6A56",
|
||||||
|
"V c #72705C",
|
||||||
|
"W c #71705C",
|
||||||
|
"X c #716F5E",
|
||||||
|
"Y c #6D6D5B",
|
||||||
|
"Z c #6C6B5B",
|
||||||
|
"` c #6A6758",
|
||||||
|
" . c #69695A",
|
||||||
|
".. c #656556",
|
||||||
|
"+. c #666656",
|
||||||
|
"@. c #615F53",
|
||||||
|
"#. c #5F5E4F",
|
||||||
|
"$. c #5E5D50",
|
||||||
|
"%. c #5C5950",
|
||||||
|
"&. c #5C5B4E",
|
||||||
|
"*. c #59574C",
|
||||||
|
"=. c #5A594C",
|
||||||
|
"-. c #5C5D50",
|
||||||
|
";. c #727166",
|
||||||
|
">. c #807D71",
|
||||||
|
",. c #818176",
|
||||||
|
"'. c #808078",
|
||||||
|
"). c #7D7D74",
|
||||||
|
"!. c #777770",
|
||||||
|
"~. c #6F6E66",
|
||||||
|
"{. c #5C5C56",
|
||||||
|
"]. c #717162",
|
||||||
|
"^. c #8A8874",
|
||||||
|
"/. c #8A8876",
|
||||||
|
"(. c #8A8A78",
|
||||||
|
"_. c #3B3B34",
|
||||||
|
":. c #706F5D",
|
||||||
|
"<. c #515044",
|
||||||
|
"[. c #30312A",
|
||||||
|
"}. c #2E2D26",
|
||||||
|
"|. c #2C2B26",
|
||||||
|
"1. c #2A2A24",
|
||||||
|
"2. c #282824",
|
||||||
|
"3. c #272926",
|
||||||
|
"4. c #252523",
|
||||||
|
"5. c #262421",
|
||||||
|
"6. c #232221",
|
||||||
|
"7. c #282625",
|
||||||
|
"8. c #232321",
|
||||||
|
"9. c #212420",
|
||||||
|
"0. c #1A1919",
|
||||||
|
"a. c #141411",
|
||||||
|
"b. c #111214",
|
||||||
|
"c. c #171616",
|
||||||
|
"d. c #2C2B2F",
|
||||||
|
"e. c #404040",
|
||||||
|
"f. c #484746",
|
||||||
|
"g. c #4C4C4C",
|
||||||
|
"h. c #494949",
|
||||||
|
"i. c #4A4A4A",
|
||||||
|
"j. c #414146",
|
||||||
|
"k. c #323235",
|
||||||
|
"l. c #31312E",
|
||||||
|
"m. c #62625A",
|
||||||
|
"n. c #868574",
|
||||||
|
"o. c #878574",
|
||||||
|
"p. c #878575",
|
||||||
|
"q. c #3D3D31",
|
||||||
|
"r. c #6E6D5B",
|
||||||
|
"s. c #706E5C",
|
||||||
|
"t. c #535045",
|
||||||
|
"u. c #161610",
|
||||||
|
"v. c #13140D",
|
||||||
|
"w. c #121519",
|
||||||
|
"x. c #0B0A0F",
|
||||||
|
"y. c #0F0F0E",
|
||||||
|
"z. c #0F0F0D",
|
||||||
|
"A. c #09090A",
|
||||||
|
"B. c #060606",
|
||||||
|
"C. c #060608",
|
||||||
|
"D. c #050507",
|
||||||
|
"E. c #07080B",
|
||||||
|
"F. c #090C14",
|
||||||
|
"G. c #070708",
|
||||||
|
"H. c #07080A",
|
||||||
|
"I. c #1F211F",
|
||||||
|
"J. c #2D2D2E",
|
||||||
|
"K. c #333535",
|
||||||
|
"L. c #323234",
|
||||||
|
"M. c #343436",
|
||||||
|
"N. c #353634",
|
||||||
|
"O. c #373735",
|
||||||
|
"P. c #373736",
|
||||||
|
"Q. c #30302F",
|
||||||
|
"R. c #2B2B29",
|
||||||
|
"S. c #615F56",
|
||||||
|
"T. c #82816F",
|
||||||
|
"U. c #82816D",
|
||||||
|
"V. c #838172",
|
||||||
|
"W. c #3C3B34",
|
||||||
|
"X. c #6C6A5B",
|
||||||
|
"Y. c #6F6E5C",
|
||||||
|
"Z. c #5D5D4D",
|
||||||
|
"`. c #202712",
|
||||||
|
" + c #1B2C0C",
|
||||||
|
".+ c #0A0B11",
|
||||||
|
"++ c #0E1117",
|
||||||
|
"@+ c #0C0C0D",
|
||||||
|
"#+ c #111013",
|
||||||
|
"$+ c #131314",
|
||||||
|
"%+ c #131310",
|
||||||
|
"&+ c #101011",
|
||||||
|
"*+ c #0F1419",
|
||||||
|
"=+ c #121419",
|
||||||
|
"-+ c #12110F",
|
||||||
|
";+ c #1A1B1B",
|
||||||
|
">+ c #363634",
|
||||||
|
",+ c #313130",
|
||||||
|
"'+ c #313131",
|
||||||
|
")+ c #2F2F31",
|
||||||
|
"!+ c #343334",
|
||||||
|
"~+ c #343534",
|
||||||
|
"{+ c #343433",
|
||||||
|
"]+ c #333434",
|
||||||
|
"^+ c #2B2C2C",
|
||||||
|
"/+ c #232324",
|
||||||
|
"(+ c #5F5E54",
|
||||||
|
"_+ c #807F6F",
|
||||||
|
":+ c #817F6C",
|
||||||
|
"<+ c #7F7E6C",
|
||||||
|
"[+ c #434138",
|
||||||
|
"}+ c #5E5E4E",
|
||||||
|
"|+ c #6D6A5B",
|
||||||
|
"1+ c #686554",
|
||||||
|
"2+ c #101911",
|
||||||
|
"3+ c #061307",
|
||||||
|
"4+ c #0B0C09",
|
||||||
|
"5+ c #0F111D",
|
||||||
|
"6+ c #0A0D0F",
|
||||||
|
"7+ c #0A0B09",
|
||||||
|
"8+ c #0A0A0B",
|
||||||
|
"9+ c #08080A",
|
||||||
|
"0+ c #050506",
|
||||||
|
"a+ c #040405",
|
||||||
|
"b+ c #040507",
|
||||||
|
"c+ c #070B11",
|
||||||
|
"d+ c #0B0C10",
|
||||||
|
"e+ c #16151A",
|
||||||
|
"f+ c #202021",
|
||||||
|
"g+ c #232323",
|
||||||
|
"h+ c #222625",
|
||||||
|
"i+ c #292A27",
|
||||||
|
"j+ c #2B2A2C",
|
||||||
|
"k+ c #2C2B2D",
|
||||||
|
"l+ c #2B2B2C",
|
||||||
|
"m+ c #292929",
|
||||||
|
"n+ c #242424",
|
||||||
|
"o+ c #131615",
|
||||||
|
"p+ c #54584C",
|
||||||
|
"q+ c #7E7B6C",
|
||||||
|
"r+ c #7E7E6C",
|
||||||
|
"s+ c #44443A",
|
||||||
|
"t+ c #424238",
|
||||||
|
"u+ c #6D6B5B",
|
||||||
|
"v+ c #171815",
|
||||||
|
"w+ c #030203",
|
||||||
|
"x+ c #040709",
|
||||||
|
"y+ c #07081E",
|
||||||
|
"z+ c #01030A",
|
||||||
|
"A+ c #02070C",
|
||||||
|
"B+ c #010204",
|
||||||
|
"C+ c #03030C",
|
||||||
|
"D+ c #03030B",
|
||||||
|
"E+ c #010107",
|
||||||
|
"F+ c #020213",
|
||||||
|
"G+ c #020208",
|
||||||
|
"H+ c #040715",
|
||||||
|
"I+ c #0E0F18",
|
||||||
|
"J+ c #141412",
|
||||||
|
"K+ c #1A1A1A",
|
||||||
|
"L+ c #1E1C21",
|
||||||
|
"M+ c #202022",
|
||||||
|
"N+ c #222224",
|
||||||
|
"O+ c #252524",
|
||||||
|
"P+ c #242422",
|
||||||
|
"Q+ c #222120",
|
||||||
|
"R+ c #1A1D1C",
|
||||||
|
"S+ c #0F100F",
|
||||||
|
"T+ c #55544A",
|
||||||
|
"U+ c #7A7964",
|
||||||
|
"V+ c #7A7968",
|
||||||
|
"W+ c #404038",
|
||||||
|
"X+ c #6A6A57",
|
||||||
|
"Y+ c #6C6B59",
|
||||||
|
"Z+ c #22241E",
|
||||||
|
"`+ c #040403",
|
||||||
|
" @ c #030506",
|
||||||
|
".@ c #04090C",
|
||||||
|
"+@ c #010303",
|
||||||
|
"@@ c #03060F",
|
||||||
|
"#@ c #03030D",
|
||||||
|
"$@ c #030314",
|
||||||
|
"%@ c #020306",
|
||||||
|
"&@ c #02030B",
|
||||||
|
"*@ c #0A1016",
|
||||||
|
"=@ c #131A1F",
|
||||||
|
"-@ c #141717",
|
||||||
|
";@ c #181814",
|
||||||
|
">@ c #1D1C18",
|
||||||
|
",@ c #1E1D20",
|
||||||
|
"'@ c #202020",
|
||||||
|
")@ c #202026",
|
||||||
|
"!@ c #1F1E1D",
|
||||||
|
"~@ c #1C1D1E",
|
||||||
|
"{@ c #151515",
|
||||||
|
"]@ c #0D0F0F",
|
||||||
|
"^@ c #54544C",
|
||||||
|
"/@ c #787668",
|
||||||
|
"(@ c #787664",
|
||||||
|
"_@ c #7A7664",
|
||||||
|
":@ c #434136",
|
||||||
|
"<@ c #6B6A57",
|
||||||
|
"[@ c #6D695B",
|
||||||
|
"}@ c #302F29",
|
||||||
|
"|@ c #020415",
|
||||||
|
"1@ c #010306",
|
||||||
|
"2@ c #06070E",
|
||||||
|
"3@ c #030608",
|
||||||
|
"4@ c #030609",
|
||||||
|
"5@ c #020307",
|
||||||
|
"6@ c #050714",
|
||||||
|
"7@ c #04030A",
|
||||||
|
"8@ c #0E0F20",
|
||||||
|
"9@ c #161834",
|
||||||
|
"0@ c #121418",
|
||||||
|
"a@ c #171816",
|
||||||
|
"b@ c #181A1B",
|
||||||
|
"c@ c #1B1B17",
|
||||||
|
"d@ c #1C1C1C",
|
||||||
|
"e@ c #1B1B1F",
|
||||||
|
"f@ c #1A191A",
|
||||||
|
"g@ c #171519",
|
||||||
|
"h@ c #100D0B",
|
||||||
|
"i@ c #07090D",
|
||||||
|
"j@ c #454945",
|
||||||
|
"k@ c #757564",
|
||||||
|
"l@ c #767668",
|
||||||
|
"m@ c #777664",
|
||||||
|
"n@ c #4A493E",
|
||||||
|
"o@ c #686753",
|
||||||
|
"p@ c #696955",
|
||||||
|
"q@ c #403F37",
|
||||||
|
"r@ c #080807",
|
||||||
|
"s@ c #050505",
|
||||||
|
"t@ c #040415",
|
||||||
|
"u@ c #05050E",
|
||||||
|
"v@ c #03060A",
|
||||||
|
"w@ c #04050D",
|
||||||
|
"x@ c #050708",
|
||||||
|
"y@ c #030305",
|
||||||
|
"z@ c #04060B",
|
||||||
|
"A@ c #02030A",
|
||||||
|
"B@ c #090916",
|
||||||
|
"C@ c #131327",
|
||||||
|
"D@ c #101012",
|
||||||
|
"E@ c #111113",
|
||||||
|
"F@ c #151213",
|
||||||
|
"G@ c #171618",
|
||||||
|
"H@ c #171714",
|
||||||
|
"I@ c #161614",
|
||||||
|
"J@ c #151614",
|
||||||
|
"K@ c #141413",
|
||||||
|
"L@ c #0F1012",
|
||||||
|
"M@ c #070707",
|
||||||
|
"N@ c #090808",
|
||||||
|
"O@ c #464339",
|
||||||
|
"P@ c #737060",
|
||||||
|
"Q@ c #727263",
|
||||||
|
"R@ c #727262",
|
||||||
|
"S@ c #47473F",
|
||||||
|
"T@ c #696958",
|
||||||
|
"U@ c #090907",
|
||||||
|
"V@ c #0D0E13",
|
||||||
|
"W@ c #0B0B09",
|
||||||
|
"X@ c #0E0E11",
|
||||||
|
"Y@ c #0B0B0C",
|
||||||
|
"Z@ c #090A0D",
|
||||||
|
"`@ c #09090E",
|
||||||
|
" # c #030504",
|
||||||
|
".# c #020205",
|
||||||
|
"+# c #060605",
|
||||||
|
"@# c #09090B",
|
||||||
|
"## c #0C0C0B",
|
||||||
|
"$# c #0E0E12",
|
||||||
|
"%# c #11120D",
|
||||||
|
"&# c #121212",
|
||||||
|
"*# c #121214",
|
||||||
|
"=# c #121311",
|
||||||
|
"-# c #0F0F12",
|
||||||
|
";# c #0B0C0A",
|
||||||
|
"># c #030304",
|
||||||
|
",# c #0C0D0D",
|
||||||
|
"'# c #4C4C42",
|
||||||
|
")# c #70705C",
|
||||||
|
"!# c #727162",
|
||||||
|
"~# c #47453D",
|
||||||
|
"{# c #545345",
|
||||||
|
"]# c #676658",
|
||||||
|
"^# c #535143",
|
||||||
|
"/# c #0C0C0A",
|
||||||
|
"(# c #121314",
|
||||||
|
"_# c #141517",
|
||||||
|
":# c #131312",
|
||||||
|
"<# c #080A08",
|
||||||
|
"[# c #060707",
|
||||||
|
"}# c #040506",
|
||||||
|
"|# c #080806",
|
||||||
|
"1# c #0A0A0A",
|
||||||
|
"2# c #0B0D0D",
|
||||||
|
"3# c #0E0E0C",
|
||||||
|
"4# c #0E0E0E",
|
||||||
|
"5# c #0A0A0C",
|
||||||
|
"6# c #060505",
|
||||||
|
"7# c #45443C",
|
||||||
|
"8# c #6F6C5A",
|
||||||
|
"9# c #726F5D",
|
||||||
|
"0# c #72715C",
|
||||||
|
"a# c #47463D",
|
||||||
|
"b# c #34342A",
|
||||||
|
"c# c #696858",
|
||||||
|
"d# c #585648",
|
||||||
|
"e# c #2E1911",
|
||||||
|
"f# c #290704",
|
||||||
|
"g# c #0E0F0C",
|
||||||
|
"h# c #090B0B",
|
||||||
|
"i# c #0C0C10",
|
||||||
|
"j# c #181919",
|
||||||
|
"k# c #0C0D0A",
|
||||||
|
"l# c #0B0D12",
|
||||||
|
"m# c #0A0D0D",
|
||||||
|
"n# c #010305",
|
||||||
|
"o# c #020304",
|
||||||
|
"p# c #0B0B0A",
|
||||||
|
"q# c #0D0B0C",
|
||||||
|
"r# c #0C0B0A",
|
||||||
|
"s# c #0A0B0E",
|
||||||
|
"t# c #0B0B0B",
|
||||||
|
"u# c #0C0C0C",
|
||||||
|
"v# c #0B0A0B",
|
||||||
|
"w# c #090905",
|
||||||
|
"x# c #050608",
|
||||||
|
"y# c #373733",
|
||||||
|
"z# c #696959",
|
||||||
|
"A# c #6E6D5C",
|
||||||
|
"B# c #4F4D43",
|
||||||
|
"C# c #323229",
|
||||||
|
"D# c #686553",
|
||||||
|
"E# c #5A594D",
|
||||||
|
"F# c #3D201B",
|
||||||
|
"G# c #480904",
|
||||||
|
"H# c #111012",
|
||||||
|
"I# c #111114",
|
||||||
|
"J# c #080A09",
|
||||||
|
"K# c #121515",
|
||||||
|
"L# c #0A0F10",
|
||||||
|
"M# c #0F1219",
|
||||||
|
"N# c #0B1217",
|
||||||
|
"O# c #010608",
|
||||||
|
"P# c #030605",
|
||||||
|
"Q# c #0E0E0F",
|
||||||
|
"R# c #111010",
|
||||||
|
"S# c #0C1011",
|
||||||
|
"T# c #090A0E",
|
||||||
|
"U# c #070706",
|
||||||
|
"V# c #060709",
|
||||||
|
"W# c #080608",
|
||||||
|
"X# c #050404",
|
||||||
|
"Y# c #030204",
|
||||||
|
"Z# c #666555",
|
||||||
|
"`# c #6E6B5C",
|
||||||
|
" $ c #6D6B5A",
|
||||||
|
".$ c #4D4D3F",
|
||||||
|
"+$ c #313129",
|
||||||
|
"@$ c #656553",
|
||||||
|
"#$ c #5E5D4D",
|
||||||
|
"$$ c #3B2B22",
|
||||||
|
"%$ c #510905",
|
||||||
|
"&$ c #181829",
|
||||||
|
"*$ c #101021",
|
||||||
|
"=$ c #161318",
|
||||||
|
"-$ c #0D0C15",
|
||||||
|
";$ c #070811",
|
||||||
|
">$ c #04040C",
|
||||||
|
",$ c #050611",
|
||||||
|
"'$ c #03040F",
|
||||||
|
")$ c #010105",
|
||||||
|
"!$ c #020103",
|
||||||
|
"~$ c #050504",
|
||||||
|
"{$ c #060604",
|
||||||
|
"]$ c #171817",
|
||||||
|
"^$ c #090908",
|
||||||
|
"/$ c #242420",
|
||||||
|
"($ c #626154",
|
||||||
|
"_$ c #6B6A5C",
|
||||||
|
":$ c #4E4B41",
|
||||||
|
"<$ c #272721",
|
||||||
|
"[$ c #605F4F",
|
||||||
|
"}$ c #616050",
|
||||||
|
"|$ c #343328",
|
||||||
|
"1$ c #300805",
|
||||||
|
"2$ c #170E0E",
|
||||||
|
"3$ c #110A0A",
|
||||||
|
"4$ c #0B0713",
|
||||||
|
"5$ c #0A0511",
|
||||||
|
"6$ c #090813",
|
||||||
|
"7$ c #0B0814",
|
||||||
|
"8$ c #0F0A1C",
|
||||||
|
"9$ c #09021C",
|
||||||
|
"0$ c #0B0320",
|
||||||
|
"a$ c #0A0329",
|
||||||
|
"b$ c #050337",
|
||||||
|
"c$ c #020240",
|
||||||
|
"d$ c #05054E",
|
||||||
|
"e$ c #0B0C4E",
|
||||||
|
"f$ c #0E0E30",
|
||||||
|
"g$ c #0D1022",
|
||||||
|
"h$ c #080B1A",
|
||||||
|
"i$ c #050812",
|
||||||
|
"j$ c #050810",
|
||||||
|
"k$ c #050711",
|
||||||
|
"l$ c #070716",
|
||||||
|
"m$ c #08080C",
|
||||||
|
"n$ c #61604F",
|
||||||
|
"o$ c #6A6A59",
|
||||||
|
"p$ c #4E4D3F",
|
||||||
|
"q$ c #1E1F1B",
|
||||||
|
"r$ c #5A5A4C",
|
||||||
|
"s$ c #646152",
|
||||||
|
"t$ c #3A392F",
|
||||||
|
"u$ c #200906",
|
||||||
|
"v$ c #150303",
|
||||||
|
"w$ c #0E0303",
|
||||||
|
"x$ c #0E0203",
|
||||||
|
"y$ c #210A03",
|
||||||
|
"z$ c #0D0203",
|
||||||
|
"A$ c #100403",
|
||||||
|
"B$ c #1B0603",
|
||||||
|
"C$ c #210503",
|
||||||
|
"D$ c #260703",
|
||||||
|
"E$ c #270803",
|
||||||
|
"F$ c #120605",
|
||||||
|
"G$ c #090909",
|
||||||
|
"H$ c #09093B",
|
||||||
|
"I$ c #020224",
|
||||||
|
"J$ c #03033A",
|
||||||
|
"K$ c #02023E",
|
||||||
|
"L$ c #030335",
|
||||||
|
"M$ c #04043A",
|
||||||
|
"N$ c #030336",
|
||||||
|
"O$ c #030324",
|
||||||
|
"P$ c #23231C",
|
||||||
|
"Q$ c #5F5F52",
|
||||||
|
"R$ c #6A6855",
|
||||||
|
"S$ c #6A6A58",
|
||||||
|
"T$ c #545348",
|
||||||
|
"U$ c #4E4D42",
|
||||||
|
"V$ c #636453",
|
||||||
|
"W$ c #424036",
|
||||||
|
"X$ c #190C09",
|
||||||
|
"Y$ c #110403",
|
||||||
|
"Z$ c #0B0103",
|
||||||
|
"`$ c #130103",
|
||||||
|
" % c #210603",
|
||||||
|
".% c #110203",
|
||||||
|
"+% c #070203",
|
||||||
|
"@% c #0B0203",
|
||||||
|
"#% c #1B0703",
|
||||||
|
"$% c #1F0603",
|
||||||
|
"%% c #0E0E10",
|
||||||
|
"&% c #04043F",
|
||||||
|
"*% c #020216",
|
||||||
|
"=% c #020229",
|
||||||
|
"-% c #020233",
|
||||||
|
";% c #020238",
|
||||||
|
">% c #020234",
|
||||||
|
",% c #020327",
|
||||||
|
"'% c #20201C",
|
||||||
|
")% c #5C5C4D",
|
||||||
|
"!% c #69685A",
|
||||||
|
"~% c #676756",
|
||||||
|
"{% c #545143",
|
||||||
|
"]% c #010102",
|
||||||
|
"^% c #4B493F",
|
||||||
|
"/% c #626454",
|
||||||
|
"(% c #4E4C3F",
|
||||||
|
"_% c #343128",
|
||||||
|
":% c #292921",
|
||||||
|
"<% c #27231D",
|
||||||
|
"[% c #281F19",
|
||||||
|
"}% c #221A13",
|
||||||
|
"|% c #1A1512",
|
||||||
|
"1% c #1A1311",
|
||||||
|
"2% c #13100F",
|
||||||
|
"3% c #17100E",
|
||||||
|
"4% c #1E100D",
|
||||||
|
"5% c #1E0C0B",
|
||||||
|
"6% c #110B09",
|
||||||
|
"7% c #080809",
|
||||||
|
"8% c #0C0D1A",
|
||||||
|
"9% c #060619",
|
||||||
|
"0% c #02020F",
|
||||||
|
"a% c #020212",
|
||||||
|
"b% c #020219",
|
||||||
|
"c% c #02021C",
|
||||||
|
"d% c #02021A",
|
||||||
|
"e% c #1B1B1A",
|
||||||
|
"f% c #59594A",
|
||||||
|
"g% c #676655",
|
||||||
|
"h% c #666657",
|
||||||
|
"i% c #000001",
|
||||||
|
"j% c #46453C",
|
||||||
|
"k% c #626254",
|
||||||
|
"l% c #5D5D4E",
|
||||||
|
"m% c #5C5C4E",
|
||||||
|
"n% c #5F5E50",
|
||||||
|
"o% c #5C5C4B",
|
||||||
|
"p% c #5A594B",
|
||||||
|
"q% c #585749",
|
||||||
|
"r% c #585447",
|
||||||
|
"s% c #515143",
|
||||||
|
"t% c #4E4C41",
|
||||||
|
"u% c #4B4B3F",
|
||||||
|
"v% c #4A453A",
|
||||||
|
"w% c #413F35",
|
||||||
|
"x% c #3D3D33",
|
||||||
|
"y% c #363442",
|
||||||
|
"z% c #312F41",
|
||||||
|
"A% c #2A293C",
|
||||||
|
"B% c #26263A",
|
||||||
|
"C% c #222238",
|
||||||
|
"D% c #1E1E2F",
|
||||||
|
"E% c #1A1A2B",
|
||||||
|
"F% c #18162A",
|
||||||
|
"G% c #161528",
|
||||||
|
"H% c #272636",
|
||||||
|
"I% c #59594F",
|
||||||
|
"J% c #686455",
|
||||||
|
"K% c #676556",
|
||||||
|
"L% c #555548",
|
||||||
|
"M% c #3A3930",
|
||||||
|
"N% c #625F4F",
|
||||||
|
"O% c #5E5E50",
|
||||||
|
"P% c #606052",
|
||||||
|
"Q% c #646254",
|
||||||
|
"R% c #636254",
|
||||||
|
"S% c #656454",
|
||||||
|
"T% c #656354",
|
||||||
|
"U% c #646454",
|
||||||
|
"V% c #636354",
|
||||||
|
"W% c #656254",
|
||||||
|
"X% c #636253",
|
||||||
|
"Y% c #605F51",
|
||||||
|
"Z% c #616051",
|
||||||
|
"`% c #5F6150",
|
||||||
|
" & c #605F50",
|
||||||
|
".& c #5D5D4F",
|
||||||
|
"+& c #5B5A53",
|
||||||
|
"@& c #595751",
|
||||||
|
"#& c #555550",
|
||||||
|
"$& c #514F4F",
|
||||||
|
"%& c #53504C",
|
||||||
|
"&& c #616052",
|
||||||
|
"*& c #636454",
|
||||||
|
"=& c #646455",
|
||||||
|
"-& c #585948",
|
||||||
|
";& c #20201D",
|
||||||
|
">& c #625F4E",
|
||||||
|
",& c #605D4D",
|
||||||
|
"'& c #626153",
|
||||||
|
")& c #626152",
|
||||||
|
"!& c #646354",
|
||||||
|
"~& c #626553",
|
||||||
|
"{& c #636553",
|
||||||
|
"]& c #595949",
|
||||||
|
"^& c #4B4941",
|
||||||
|
"/& c #524F44",
|
||||||
|
"(& c #5C5C4C",
|
||||||
|
"_& c #605E4E",
|
||||||
|
":& c #636153",
|
||||||
|
"<& c #626050",
|
||||||
|
"[& c #626051",
|
||||||
|
"}& c #5D6F4C",
|
||||||
|
"|& c #3D9F32",
|
||||||
|
"1& c #35A92D",
|
||||||
|
"2& c #59764B",
|
||||||
|
"3& c #59574B",
|
||||||
|
"4& c #4A483D",
|
||||||
|
"5& c #4F4C41",
|
||||||
|
"6& c #515043",
|
||||||
|
"7& c #565548",
|
||||||
|
"8& c #595846",
|
||||||
|
"9& c #5C5A4B",
|
||||||
|
"0& c #5F5E4E",
|
||||||
|
"a& c #5F6750",
|
||||||
|
"b& c #507F44",
|
||||||
|
"c& c #4B8640",
|
||||||
|
"d& c #5D6B4F",
|
||||||
|
"e& c #504F43",
|
||||||
|
"f& c #555546",
|
||||||
|
"g& c #535246",
|
||||||
|
"h& c #514F40",
|
||||||
|
"i& c #4F4D40",
|
||||||
|
"j& c #4C4C40",
|
||||||
|
"k& c #4D4A40",
|
||||||
|
"l& c #4A4A3F",
|
||||||
|
"m& c #49493E",
|
||||||
|
"n& c #49483E",
|
||||||
|
"o& c #4A483E",
|
||||||
|
"p& c #4A493C",
|
||||||
|
"q& c #505042",
|
||||||
|
"r& c #525242",
|
||||||
|
"s& c #555248",
|
||||||
|
"t& c #585748",
|
||||||
|
"u& c #5C5949",
|
||||||
|
"v& c #5C5B4C",
|
||||||
|
"w& c #5D5A4E",
|
||||||
|
"x& c #5E5D4E",
|
||||||
|
"y& c #5F5C4D",
|
||||||
|
"z& c #5F5E51",
|
||||||
|
"A& c #5F5F50",
|
||||||
|
"B& c #5F5E4C",
|
||||||
|
"C& c #5E5E4C",
|
||||||
|
"D& c #5D5A4A",
|
||||||
|
"E& c #5A5848",
|
||||||
|
"F& c #565445",
|
||||||
|
"G& c #535144",
|
||||||
|
"H& c #4F4E43",
|
||||||
|
"I& c #4D4D40",
|
||||||
|
"J& c #4A4A40",
|
||||||
|
"K& c #4B4A3C",
|
||||||
|
"L& c #4B4B3E",
|
||||||
|
"M& c #4E4E40",
|
||||||
|
"N& c #333329",
|
||||||
|
"O& c #2E2E27",
|
||||||
|
"P& c #303029",
|
||||||
|
"Q& c #4D4D44",
|
||||||
|
"R& c #575547",
|
||||||
|
"S& c #5C594C",
|
||||||
|
"T& c #605D4C",
|
||||||
|
"U& c #605E4C",
|
||||||
|
"V& c #5E5D4C",
|
||||||
|
"W& c #5F5D4C",
|
||||||
|
"X& c #5D5B4A",
|
||||||
|
"Y& c #5B5A4A",
|
||||||
|
"Z& c #585848",
|
||||||
|
"`& c #535345",
|
||||||
|
" * c #524F42",
|
||||||
|
".* c #3C3A34",
|
||||||
|
"+* c #414138",
|
||||||
|
"@* c #45453D",
|
||||||
|
"#* c #484638",
|
||||||
|
"$* c #464638",
|
||||||
|
"%* c #525248",
|
||||||
|
"&* c #595749",
|
||||||
|
"** c #5A584C",
|
||||||
|
"=* c #5D5D4C",
|
||||||
|
"-* c #5F5E4D",
|
||||||
|
";* c #5E5E4D",
|
||||||
|
">* c #000000",
|
||||||
|
",* c #21211D",
|
||||||
|
"'* c #23231F",
|
||||||
|
")* c #2D2D25",
|
||||||
|
"!* c #302E27",
|
||||||
|
"~* c #302E26",
|
||||||
|
"{* c #37352E",
|
||||||
|
"]* c #4C4B40",
|
||||||
|
"^* c #525144",
|
||||||
|
"/* c #5F5F5F",
|
||||||
|
"(* c #BFBFBF",
|
||||||
|
"_* c #8F8F8F",
|
||||||
|
":* c #FFFFFF",
|
||||||
|
"<* c #3F3F3F",
|
||||||
|
"[* c #6F6F6F",
|
||||||
|
"}* c #7F7F7F",
|
||||||
|
"|* c #1F1F1F",
|
||||||
|
"1* c #FEFEFE",
|
||||||
|
"2* c #2F2F2F",
|
||||||
|
"3* c #EFEFEF",
|
||||||
|
"4* c #DFDFDF",
|
||||||
|
"5* c #9F9F9F",
|
||||||
|
"6* c #0F0F0F",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" . + @ # $ % & * = - ; > , ' ) ! ~ @ { ] ",
|
||||||
|
" ^ / ( _ : < [ } | 1 2 2 3 4 5 6 7 8 9 0 a b c c d e f g h i j { ] ",
|
||||||
|
" k l m n o 4 p q r s t u v w x y z A B C D E F G H I J K L M N O P Q { ] ",
|
||||||
|
" R S T U V W X Y Z ` ...+.@.#.$.%.&.*.=.-.;.>.,.'.).!.~.{.].^./.(._.{ ] ",
|
||||||
|
" W :.<.[.}.|.1.2.3.4.5.6.7.8.9.0.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.{ ] ",
|
||||||
|
" r.s.t.u.v.w.x.y.z.A.B.C.D.E.F.C.G.H.I.J.K.L.M.N.O.P.Q.R.S.T.U.V.W.{ ] ",
|
||||||
|
" X.Y.Z.`. +.+++@+#+$+%+&+y.&+*+=+-+;+>+,+'+)+!+~+{+]+^+/+(+_+:+<+[+{ ] ",
|
||||||
|
" }+|+1+2+3+4+5+6+7+8+9+0+a+a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p+q+r+r+s+{ ] ",
|
||||||
|
" t+n u+v+w+x+y+z+A+B+C+D+E+F+G+H+I+J+K+L+M+N+/+O+P+Q+R+S+T+U+V+U+W+{ ] ",
|
||||||
|
" X+Y+Z+`+ @.@+@@@] #@$@%@@@&@*@=@-@;@>@,@'@'@)@!@~@{@]@^@/@(@_@:@{ ] ",
|
||||||
|
" <@[@}@0+`+|@1@2@] 3@4@5@6@7@8@9@0@$+a@b@c@d@e@f@g@h@i@j@k@l@m@n@{ ] ",
|
||||||
|
" o@p@q@r@s@t@u@v@w@C.x@y@z@A@B@C@D@E@F@G@H@I@J@K@L@M@N@O@P@Q@R@S@{ ] ",
|
||||||
|
" #.T@n@U@M@V@W@X@Y@Z@`@ #.#.#+#@###$#%#&#*#$+=#-#;#>#,#'#)#!#V ~#{ ] ",
|
||||||
|
" {#]#^#/#G.(#_#:#<#[#}#] { { >#|#1#2#3#z.-#4#3#5#6#] 8+7#8#9#0#a#{ ] ",
|
||||||
|
" b#c#d#e#f#g#h#i#j#k#l#m#n#o#p#q#r#s#@#t#u#v#w#x#] ] C.y#z#A#A#B#{ ] ",
|
||||||
|
" C#D#E#F#G#H#I#J#K#L#M#N#O#P#Q#R#S#T#U#r@V#W#X#Y#] ] ] . Z#`# $.${ ] ",
|
||||||
|
" +$@$#$$$%$&$*$=$-$;$>$,$'$)${ !$`+~$>#{$]$^$] ] ] ] ] /$($_$X.:${ ] ",
|
||||||
|
" <$[$}$|$1$2$3$4$5$6$7$8$9$0$a$b$c$d$e$f$g$h$i$j$k$l$m$. n$o$U p${ ] ",
|
||||||
|
" q$r$s$t$u$v$w$x$y$z$A$B$C$D$E$F$a+G$b.H$I$J$K$L$M$N$O$P$Q$R$S$T${ ] ",
|
||||||
|
" U$V$W$X$Y$Z$`$ %.%+%@%#%$%C$A${ D.%%&%*%=%-%;%;%>%,%'%)%!%~%{%{ ]% ",
|
||||||
|
" ^%/%(%_%:%<%[%}%|%1%2%3%4%5%6%7%E.8%9%0%a%b%b%c%d%F+e%f%g%h%^#{ i% ",
|
||||||
|
" j%k%l%m%n%Z.o%p%q%r%s%t%u%v%w%x%y#y%z%A%B%C%D%E%F%G%H%I%J%K%L%{ i% ",
|
||||||
|
" M%N%O%P%N%k%Q%R%Q%S%T%U%V%W%X%s$Y%Z%`% &#..&+&@&#&$&%&&&*&=&-&{ ",
|
||||||
|
" ;&>&,&n%'&'&k%'&)&'&W%W%k%Q%R%Q%*&W%R%R%W%W%S%!&Q%~&{&W%R%W%]&]% ",
|
||||||
|
" ^&: /&(&_&'&:&<&'&[&k%k%k%W%R%W%R%R%V%k%R%k%R%k%}&|&1&2&Q%3&]% ",
|
||||||
|
" 4&5&6&T$7&8&9&0&N%k%k%R%k%N%k%R%R%Q%R%k%a&b&c&d&Z%p%]% ",
|
||||||
|
" e&f&g&h&i&j&k&l&m&n&o&p&'#q&r&s&7&t&u&v&w&x&y&z&A&[$0& ",
|
||||||
|
" i&B&B&B&C&C&v&D&E&d#t&F&G&<.<.H&I&J&K&L&J&j&M&H&N&O&}@ ",
|
||||||
|
" P&Q&R&S&T&C&B&B&C&U&B&V&W&T&o%X&Y&&.p%Z&L%`& *U# ",
|
||||||
|
" .*W++*@*#*$*%*&***Y&=*-*B&;*;*C&]% ",
|
||||||
|
" >*>*>*>*>*>*>*>*>* ,*'*<$)*!*~*{*]*^* ",
|
||||||
|
" >*/*(*(*(*(*(*(*(*_*>* >*>* ",
|
||||||
|
" >*>*:*:*<*>*>*_*(*>*>*[*}*>* ",
|
||||||
|
" >*>*:*:*<*>*<*|*(*>*/*1*}*>* >*>*>*>* >*>*>*>*>*>*>*>*>*>*>*>*>*>*>*>*>*>* ",
|
||||||
|
" >*>*:*:*<*>*}*<*2*/*3*:*4*(*>*>*_*(*(*2*>*/*(*(*/*_*(*/*>*(*(*(*(*(*(*>*/*(*_*>* ",
|
||||||
|
" >*>*:*:*[*[*:*<*>*>*(*:*}*>*>*}*:*>*}*:*2*>*(*:*4*(*:*}*>*<*:*:*>*}*:*3*/*(*:*}*>* ",
|
||||||
|
" >*>*:*:*5*5*:*<*>*>*(*:*}*>*|*(*:*>*}*:*(*>*(*:*}*>*}*<*>*<*:*:*>*}*:*(*>*(*:*}*>* ",
|
||||||
|
" >*>*:*:*<*6*5*<*>*>*(*:*}*>*<*:*:*(*4*:*(*>*(*:*}*>*>*>*>*<*:*:*>*}*:*(*>*(*:*}*>* ",
|
||||||
|
" >*>*:*:*<*>*/*2*6*|*(*:*}*>*<*:*:*>*>*>*>*>*(*:*}*>* >*<*:*:*>*}*:*(*>*(*:*}*>* ",
|
||||||
|
" >*>*:*:*<*>*>*>*<*}*(*:*}*>*<*:*:*/*>*>*/*>*(*:*}*>* >*<*:*:*>*}*:*(*>*(*:*}*>* ",
|
||||||
|
" >*>*:*:*<*>*>*_*5*|*(*:*}*_*6*5*:*3*(*(*2*>*(*:*}*>* >*<*:*:*>*}*:*(*>*(*:*}*>* ",
|
||||||
|
" >*/*(*(*(*(*(*(*(*_*>*>*(*(*2*>*>*_*(*(*2*>*/*(*(*(*2*>* >*(*(*(*(*(*(*(*(*(*(*(*2*>* ",
|
||||||
|
" >*>*>*>*>*>*>*>*>* >*>*>* >*>*>*>* >*>*>*>*>* >*>*>*>*>*>*>*>*>*>*>*>* ",
|
||||||
|
" "};
|
|
@ -0,0 +1,30 @@
|
||||||
|
# $Id$
|
||||||
|
|
||||||
|
lib_LTLIBRARIES = libEterm.la
|
||||||
|
|
||||||
|
libEterm_la_SOURCES = activeconfig.c activeeterm.c activetags.c command.c \
|
||||||
|
graphics.c grkelot.c menubar.c misc.c netdisp.c options.c \
|
||||||
|
pixmap.c screen.c scrollbar.c system.c threads.c utmp.c
|
||||||
|
|
||||||
|
libEterm_la_LDFLAGS = -version-info 8:9:8
|
||||||
|
|
||||||
|
bin_PROGRAMS = Eterm
|
||||||
|
|
||||||
|
Eterm_SOURCES = main.c
|
||||||
|
|
||||||
|
Eterm_DEPENDENCIES = ../libmej/libmej.la feature.h
|
||||||
|
|
||||||
|
INCLUDES = -I. -I../libmej -I.. -I$(includedir) -I$(prefix)/include $(X_CFLAGS)
|
||||||
|
|
||||||
|
Eterm_LDFLAGS = -rpath $(libdir):$(pkglibdir)
|
||||||
|
LDADD = -L$(DIST_ROOT)/src/.libs -lEterm -L$(DIST_ROOT)/libmej/.libs -L$(libdir) -L$(prefix)/lib $(LIBS) -lmej $(GRLIBS) $(X_LIBS)
|
||||||
|
|
||||||
|
EXTRA_DIST = activeconfig.h activeeterm.h activetags.h command.h debug.h \
|
||||||
|
eterm_imlib.h feature.h.in graphics.h grkelot.h grx.h main.h \
|
||||||
|
menubar.h misc.h options.h pixmap.h profile.h screen.h scrollbar.h \
|
||||||
|
system.h threads.h graphics/Makefile.am graphics/Makefile.in \
|
||||||
|
graphics/README graphics/data graphics/grxlib.c graphics/grxlib.h \
|
||||||
|
graphics/qplot.c Eterm.xpm
|
||||||
|
|
||||||
|
feature.h: feature.h.in
|
||||||
|
$(FEATURE_CMD)
|
|
@ -0,0 +1,623 @@
|
||||||
|
/*--------------------------------*-C-*---------------------------------*
|
||||||
|
* File: activeconfig.c
|
||||||
|
*
|
||||||
|
* Copyright 1997 Nat Friedman, Massachusetts Institute of Technology
|
||||||
|
* <ndf@mit.edu>
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*----------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* This file contains all the config file parsing functionality */
|
||||||
|
|
||||||
|
static const char cvs_ident[] = "$Id$";
|
||||||
|
|
||||||
|
#include "feature.h"
|
||||||
|
#ifdef USE_ACTIVE_TAGS
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <pwd.h>
|
||||||
|
|
||||||
|
#include "activeconfig.h"
|
||||||
|
|
||||||
|
/* The basic design of the config file parsing routines revolves around the
|
||||||
|
dispatch table below. The dispatch table relates file tokens with
|
||||||
|
their parsing functions. In order to add a new config file token
|
||||||
|
(for example "Foo=something"), simply define TAG_CONFIG_FOO, write
|
||||||
|
parse_config_tag_foo, and then add the following line to the dispatch
|
||||||
|
table:
|
||||||
|
|
||||||
|
{TAG_CONFIG_FOO, parse_config_tag_foo}
|
||||||
|
|
||||||
|
and it will magically work. */
|
||||||
|
|
||||||
|
/* This is the actual dispatch table. It should be terminated by a struct
|
||||||
|
config_entry whose parser field is NULL. */
|
||||||
|
struct config_entry config_dispatch[] =
|
||||||
|
{
|
||||||
|
{TAG_CONFIG_LOAD, parse_config_load},
|
||||||
|
{TAG_CONFIG_DEFAULT_BINDING, parse_config_default_binding},
|
||||||
|
{TAG_CONFIG_DEFAULT_HIGHLIGHT, parse_config_default_highlight},
|
||||||
|
{TAG_CONFIG_DEFAULT_SEARCH_LINES, parse_config_default_search_lines},
|
||||||
|
{TAG_CONFIG_NEW_TAG, parse_config_tag_begin},
|
||||||
|
{TAG_CONFIG_END_TAG, parse_config_tag_end},
|
||||||
|
{TAG_CONFIG_LATENT, parse_config_tag_latent},
|
||||||
|
{TAG_CONFIG_BINDING, parse_config_tag_binding},
|
||||||
|
{TAG_CONFIG_HIGHLIGHT, parse_config_tag_highlight},
|
||||||
|
{TAG_CONFIG_MODES, parse_config_tag_modes},
|
||||||
|
{TAG_CONFIG_REGEXP, parse_config_tag_regexp},
|
||||||
|
{TAG_CONFIG_ACTION, parse_config_tag_action},
|
||||||
|
{TAG_CONFIG_OUTPUT, parse_config_tag_output},
|
||||||
|
{TAG_CONFIG_SEARCH_LINES, parse_config_tag_search_lines},
|
||||||
|
{TAG_CONFIG_CLUE, parse_config_tag_clue},
|
||||||
|
{TAG_CONFIG_ENV, parse_config_tag_env},
|
||||||
|
{"", NULL}
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
Dispatch Functions
|
||||||
|
*/
|
||||||
|
|
||||||
|
int
|
||||||
|
parse_config_tag_env(char *envlist, struct config_info *config_info)
|
||||||
|
{
|
||||||
|
char *p, *q;
|
||||||
|
int nenvs = 0;
|
||||||
|
|
||||||
|
p = envlist;
|
||||||
|
do {
|
||||||
|
printf("Env...\n");
|
||||||
|
if ((q = strchr(p, ',')) == NULL)
|
||||||
|
q = p + strlen(p);
|
||||||
|
strncpy(tag[config_info->curr_tag].env[nenvs], p, q - p);
|
||||||
|
tag[config_info->curr_tag].env[nenvs][q - p] = '\0';
|
||||||
|
printf("got env: %s\n", tag[config_info->curr_tag].env[nenvs]);
|
||||||
|
nenvs++;
|
||||||
|
if (*q != ',')
|
||||||
|
p = NULL;
|
||||||
|
else
|
||||||
|
p = q + 1;
|
||||||
|
} while (p != NULL);
|
||||||
|
tag[config_info->curr_tag].num_envs = nenvs;
|
||||||
|
|
||||||
|
printf("Got envs for tag:\n");
|
||||||
|
for (nenvs = 0; nenvs < tag[config_info->curr_tag].num_envs; nenvs++)
|
||||||
|
printf("Env %d: (%s)\n", nenvs, tag[config_info->curr_tag].env[nenvs]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
parse_config_load(char *filename, struct config_info *config_info)
|
||||||
|
{
|
||||||
|
struct config_info new_config_info;
|
||||||
|
|
||||||
|
/* Scope on Defaults is per-file */
|
||||||
|
set_config_defaults(&new_config_info);
|
||||||
|
new_config_info.curr_tag = config_info->curr_tag;
|
||||||
|
|
||||||
|
/* If it's a relative file name, make it absolute */
|
||||||
|
if (*filename != '/') {
|
||||||
|
char new_filename[1024];
|
||||||
|
char *p, *q;
|
||||||
|
|
||||||
|
if ((p = strrchr(config_info->filename, '/')) == NULL)
|
||||||
|
configerror(config_info, "Could not determine path to file!");
|
||||||
|
q = config_info->filename;
|
||||||
|
|
||||||
|
strcpy(new_filename, q);
|
||||||
|
new_filename[p - q] = '\0';
|
||||||
|
strcat(new_filename, "/");
|
||||||
|
strcat(new_filename, filename);
|
||||||
|
printf("Filename: %s\n", new_filename);
|
||||||
|
strcpy(filename, new_filename);
|
||||||
|
}
|
||||||
|
/* FIXME: This implementation forces pathnames to be absolute. We should
|
||||||
|
allow relative pathnames somehow. */
|
||||||
|
parse_tag_file(filename, &new_config_info);
|
||||||
|
|
||||||
|
config_info->curr_tag = new_config_info.curr_tag;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
parse_config_default_binding(char *def,
|
||||||
|
struct config_info *config_info)
|
||||||
|
{
|
||||||
|
config_info->default_binding = string_to_binding_mask(config_info, def);
|
||||||
|
if (!(config_info->default_binding & (TAG_BINDING_BUTTON1 | TAG_BINDING_BUTTON2 |
|
||||||
|
TAG_BINDING_BUTTON3))) {
|
||||||
|
configerror(config_info, "Error reading default binding: binding _must_ "
|
||||||
|
"include either Button1, Button2, or Button3. Reverting to "
|
||||||
|
"compiled default.");
|
||||||
|
config_info->default_binding = TAG_DEFAULT_BINDING_MASK;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
parse_config_default_highlight(char *def,
|
||||||
|
struct config_info *config_info)
|
||||||
|
{
|
||||||
|
string_to_highlight(config_info, &config_info->default_highlight, def);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
parse_config_default_search_lines(char *def,
|
||||||
|
struct config_info *config_info)
|
||||||
|
{
|
||||||
|
if ((config_info->default_search_lines = atoi(def)) == 0) {
|
||||||
|
configerror(config_info, "Invalid default number of search lines. "
|
||||||
|
"Reverting to compiled default.\n");
|
||||||
|
config_info->default_search_lines = TAG_DEFAULT_SEARCH_LINES;
|
||||||
|
}
|
||||||
|
if (config_info->default_search_lines > MAX_SEARCH_LINES) {
|
||||||
|
configerror(config_info, "Default number of search lines > maximum. "
|
||||||
|
"Reverting to compiled default.\n");
|
||||||
|
config_info->default_search_lines = TAG_DEFAULT_SEARCH_LINES;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
parse_config_tag_begin(char *s, struct config_info *config_info)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "New tag\n");
|
||||||
|
if (config_info->in_tag) {
|
||||||
|
configerror(config_info, "Open brace inside braces");
|
||||||
|
disable_tags();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if ((config_info->curr_tag + 1) >= MAX_TAGS) {
|
||||||
|
configerror(config_info, "Too many tags! Increase the maximum number "
|
||||||
|
"of tags and recompile!\n");
|
||||||
|
disable_tags();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
config_info->in_tag = 1;
|
||||||
|
|
||||||
|
/* Initialize the new tag with all the default values. */
|
||||||
|
tag[config_info->curr_tag].binding_mask = config_info->default_binding;
|
||||||
|
tag[config_info->curr_tag].search_lines = config_info->default_search_lines;
|
||||||
|
tag[config_info->curr_tag].highlight.attributes =
|
||||||
|
config_info->default_highlight.attributes;
|
||||||
|
tag[config_info->curr_tag].highlight.fg_color =
|
||||||
|
config_info->default_highlight.fg_color;
|
||||||
|
tag[config_info->curr_tag].highlight.bg_color =
|
||||||
|
config_info->default_highlight.bg_color;
|
||||||
|
tag[config_info->curr_tag].num_modes = 0;
|
||||||
|
tag[config_info->curr_tag].latent = 0;
|
||||||
|
tag[config_info->curr_tag].output_type = TAG_OUTPUT_NULL;
|
||||||
|
|
||||||
|
#ifdef ACTIVE_TAGS_SPENCER_REGEXP
|
||||||
|
tag[config_info->curr_tag].rx = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
parse_config_tag_end(char *s, struct config_info *config_info)
|
||||||
|
{
|
||||||
|
if (!config_info->in_tag) {
|
||||||
|
configerror(config_info, "close brace without open brace");
|
||||||
|
disable_tags();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
/* Make sure that the tag was setup properly before advancing to the next
|
||||||
|
one in the list */
|
||||||
|
|
||||||
|
/* FIXME: we need a way of figuring this out if we're using POSIX regex */
|
||||||
|
#ifdef ACTIVE_TAGS_SPENCER_REGEXP
|
||||||
|
if (tag[config_info->curr_tag].rx == NULL) {
|
||||||
|
configerror("No regular epxression supplied for tag. Tag ignored.");
|
||||||
|
config_info->curr_tag--;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
config_info->in_tag = 0;
|
||||||
|
config_info->curr_tag++;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
parse_config_tag_latent(char *latent, struct config_info *config_info)
|
||||||
|
{
|
||||||
|
if (!strcasecmp(latent, "true"))
|
||||||
|
tag[config_info->curr_tag].latent = 1;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
parse_config_tag_search_lines(char *sl, struct config_info *config_info)
|
||||||
|
{
|
||||||
|
if (atoi(sl))
|
||||||
|
tag[config_info->curr_tag].search_lines = atoi(sl);
|
||||||
|
|
||||||
|
D_TAGS(("==> Setting tag %d's search lines to %d\n", config_info->curr_tag, atoi(sl)));
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
parse_config_tag_binding(char *s, struct config_info *config_info)
|
||||||
|
{
|
||||||
|
tag[config_info->curr_tag].binding_mask = string_to_binding_mask(config_info, s);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
parse_config_tag_highlight(char *s, struct config_info *config_info)
|
||||||
|
{
|
||||||
|
string_to_highlight(config_info, &tag[config_info->curr_tag].highlight, s);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
parse_config_tag_modes(char *s, struct config_info *config_info)
|
||||||
|
{
|
||||||
|
char *mode, *p;
|
||||||
|
|
||||||
|
mode = s;
|
||||||
|
|
||||||
|
while (mode != NULL) {
|
||||||
|
if ((p = strchr(mode, ',')) != NULL)
|
||||||
|
*p = '\0';
|
||||||
|
strcpy(tag[config_info->curr_tag].mode[tag[config_info->curr_tag].num_modes], mode);
|
||||||
|
if (p != NULL)
|
||||||
|
mode = p + 1;
|
||||||
|
else
|
||||||
|
mode = NULL;
|
||||||
|
|
||||||
|
tag[config_info->curr_tag].num_modes++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
parse_config_tag_regexp(char *regexp, struct config_info *config_info)
|
||||||
|
{
|
||||||
|
#ifdef ACTIVE_TAGS_SPENCER_REGEXP
|
||||||
|
if ((tag[config_info->curr_tag].rx = regcomp(regexp)) == NULL)
|
||||||
|
#else
|
||||||
|
if (regcomp(&tag[config_info->curr_tag].rx, regexp, REG_EXTENDED) != 0)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
configerror(config_info, "Couldn't compile regular expression");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
parse_config_tag_action(char *action, struct config_info *config_info)
|
||||||
|
{
|
||||||
|
strcpy(tag[config_info->curr_tag].action, action);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
parse_config_tag_output(char *output, struct config_info *config_info)
|
||||||
|
{
|
||||||
|
if (!strcasecmp(output, "null"))
|
||||||
|
tag[config_info->curr_tag].output_type = TAG_OUTPUT_NULL;
|
||||||
|
else if (!strcasecmp(output, "loop"))
|
||||||
|
tag[config_info->curr_tag].output_type = TAG_OUTPUT_LOOP;
|
||||||
|
else if (!strcasecmp(output, "replace"))
|
||||||
|
tag[config_info->curr_tag].output_type = TAG_OUTPUT_REPL;
|
||||||
|
else if (!strcasecmp(output, "popup"))
|
||||||
|
tag[config_info->curr_tag].output_type = TAG_OUTPUT_POPUP;
|
||||||
|
else {
|
||||||
|
configerror(config_info, "Unknown output method; defaulting to NULL");
|
||||||
|
tag[config_info->curr_tag].output_type = TAG_OUTPUT_NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
parse_config_tag_clue(char *clue, struct config_info *config_info)
|
||||||
|
{
|
||||||
|
strcpy(tag[config_info->curr_tag].clue, clue);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
set_config_defaults(struct config_info *config_info)
|
||||||
|
{
|
||||||
|
config_info->default_binding = TAG_DEFAULT_BINDING_MASK;
|
||||||
|
config_info->default_search_lines = TAG_DEFAULT_SEARCH_LINES;
|
||||||
|
config_info->default_highlight.bg_color = TAG_DEFAULT_HIGHLIGHT_BG;
|
||||||
|
config_info->default_highlight.fg_color = TAG_DEFAULT_HIGHLIGHT_FG;
|
||||||
|
config_info->default_highlight.attributes = TAG_DEFAULT_HIGHLIGHT_ATT;
|
||||||
|
config_info->curr_tag = 0;
|
||||||
|
config_info->line_num = 0;
|
||||||
|
config_info->in_tag = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* parse_tag_config actually reads the file and calls the dispatch functions
|
||||||
|
where appropriate */
|
||||||
|
void
|
||||||
|
parse_tag_config(char *tag_config_file)
|
||||||
|
{
|
||||||
|
char file_name[1024];
|
||||||
|
struct passwd *user;
|
||||||
|
|
||||||
|
struct config_info config_info;
|
||||||
|
|
||||||
|
/* Set the defaults */
|
||||||
|
set_config_defaults(&config_info);
|
||||||
|
|
||||||
|
if (tag_config_file != NULL)
|
||||||
|
if (!parse_tag_file(tag_config_file, &config_info)) {
|
||||||
|
fprintf(stderr, "parse_tag_config: Couldn't open tag config"
|
||||||
|
"file: %s\n", tag_config_file);
|
||||||
|
tag_config_file = NULL;
|
||||||
|
}
|
||||||
|
if (tag_config_file == NULL) {
|
||||||
|
user = getpwuid(getuid());
|
||||||
|
sprintf(file_name, "%s/%s", user->pw_dir, TAG_CONFIG_USER_FILENAME);
|
||||||
|
if (!parse_tag_file(file_name, &config_info)) {
|
||||||
|
fprintf(stderr, "parse_tag_config: Couldn't open user tag config "
|
||||||
|
"file: %s\n", file_name);
|
||||||
|
fprintf(stderr, "parse_tag_config: Trying system config file\n");
|
||||||
|
|
||||||
|
/* Try the system-wide config file */
|
||||||
|
if (!parse_tag_file(TAG_CONFIG_SYSTEM_FILENAME, &config_info)) {
|
||||||
|
fprintf(stderr, "parse_tag_config: Error parsing config file: "
|
||||||
|
"%s\n", TAG_CONFIG_SYSTEM_FILENAME);
|
||||||
|
disable_tags();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
num_tags = config_info.curr_tag;
|
||||||
|
printf("Num tags: %d\n", num_tags);
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < num_tags; i++)
|
||||||
|
printf("Tag action(%d): %s\n", i, tag[i].action);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
parse_tag_file(const char *filename, struct config_info *config_info)
|
||||||
|
{
|
||||||
|
FILE *tag_file;
|
||||||
|
char line[1024];
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if ((tag_file = fopen(filename, "r")) == NULL)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
strcpy(config_info->filename, filename);
|
||||||
|
|
||||||
|
/* Loop through the config file lines */
|
||||||
|
while (!feof(tag_file)) {
|
||||||
|
fgets(line, sizeof(line), tag_file);
|
||||||
|
config_info->line_num++;
|
||||||
|
|
||||||
|
if (feof(tag_file))
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (line[strlen(line) - 1] != '\n') {
|
||||||
|
configerror(config_info, "line too long?");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
line[strlen(line) - 1] = '\0';
|
||||||
|
|
||||||
|
/* Loop through the config file lines, calling the appropriate
|
||||||
|
functions from the dispatch table as we go. If there is no
|
||||||
|
corresponding function, flag a warning and try to continue. */
|
||||||
|
if ((line[0] != '#') && (!isspace(line[0])) && (strlen(line) != 0)) {
|
||||||
|
for (i = 0; config_dispatch[i].parser != NULL; i++)
|
||||||
|
if (TAG_CONFIG(config_dispatch[i].token)) {
|
||||||
|
if ((strchr(line, '=') == NULL) && (*line != '{') &&
|
||||||
|
(*line != '}') && !TAG_CONFIG(TAG_CONFIG_LOAD))
|
||||||
|
configerror(config_info, "'=' not found");
|
||||||
|
else {
|
||||||
|
char *p;
|
||||||
|
|
||||||
|
p = line + strlen(config_dispatch[i].token) + 1;
|
||||||
|
if (strchr(line, '=') != NULL) {
|
||||||
|
p = strchr(line, '=') + 1;
|
||||||
|
while (isspace(*p))
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
if (!((config_dispatch[i].parser) (p, config_info)))
|
||||||
|
return 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (config_dispatch[i].parser == NULL)
|
||||||
|
configerror(config_info, "Unrecognized token");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fclose(tag_file);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Internal Functions
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Use this function to display errors encountered while parsing the config
|
||||||
|
file to keep them looking uniform */
|
||||||
|
void
|
||||||
|
configerror(struct config_info *config_info, char *message)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "active tags: error on line %d of config file %s: %s\n",
|
||||||
|
config_info->line_num, config_info->filename, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
string_to_color(struct config_info *config_info, tag_highlight_t * highlight,
|
||||||
|
char *c)
|
||||||
|
{
|
||||||
|
#if 0
|
||||||
|
int color;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
int color = 0;
|
||||||
|
int bg = 0;
|
||||||
|
char *p;
|
||||||
|
|
||||||
|
p = c;
|
||||||
|
|
||||||
|
/* Background colors are prefaced by a '*' */
|
||||||
|
if (*p == '*') {
|
||||||
|
bg = 1;
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
if (!strcasecmp(p, "Black"))
|
||||||
|
color = TAG_HIGHLIGHT_BLACK;
|
||||||
|
else if (!strcasecmp(p, "White"))
|
||||||
|
color = TAG_HIGHLIGHT_WHITE;
|
||||||
|
else if (!strcasecmp(p, "Red"))
|
||||||
|
color = TAG_HIGHLIGHT_RED;
|
||||||
|
else if (!strcasecmp(p, "Green"))
|
||||||
|
color = TAG_HIGHLIGHT_GREEN;
|
||||||
|
else if (!strcasecmp(p, "Yellow"))
|
||||||
|
color = TAG_HIGHLIGHT_YELLOW;
|
||||||
|
else if (!strcasecmp(p, "Blue"))
|
||||||
|
color = TAG_HIGHLIGHT_BLUE;
|
||||||
|
else if (!strcasecmp(p, "Magenta"))
|
||||||
|
color = TAG_HIGHLIGHT_MAGENTA;
|
||||||
|
else if (!strcasecmp(p, "Cyan"))
|
||||||
|
color = TAG_HIGHLIGHT_CYAN;
|
||||||
|
else if (!strcasecmp(p, "Normal"))
|
||||||
|
color = TAG_HIGHLIGHT_NORMAL;
|
||||||
|
else
|
||||||
|
configerror(config_info, "Unrecognized highlight token");
|
||||||
|
|
||||||
|
if (bg)
|
||||||
|
highlight->bg_color = color;
|
||||||
|
else
|
||||||
|
highlight->fg_color = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
string_to_highlight(struct config_info *config_info, tag_highlight_t *
|
||||||
|
highlight, char *s)
|
||||||
|
{
|
||||||
|
char *h_bit;
|
||||||
|
|
||||||
|
/* att_set is 0 if we've set an attribute value and 1 otherwise. We have to
|
||||||
|
keep track of this because setting an attribute value should override the
|
||||||
|
default, so we can't blindly OR the new values with whatever was in
|
||||||
|
highlight->attribute before. So, if we've already overriden the value,
|
||||||
|
we OR. If we haven't yet overriden it, then we do so and set att_set to
|
||||||
|
1. */
|
||||||
|
int att_set = 0;
|
||||||
|
|
||||||
|
h_bit = strtok(s, "&");
|
||||||
|
|
||||||
|
while (h_bit != NULL) {
|
||||||
|
if (!strcasecmp(h_bit, "Underline")) {
|
||||||
|
if (att_set)
|
||||||
|
highlight->attributes |= TAG_HIGHLIGHT_ULINE;
|
||||||
|
else {
|
||||||
|
highlight->attributes = TAG_HIGHLIGHT_ULINE;
|
||||||
|
highlight->fg_color = TAG_HIGHLIGHT_NORMAL;
|
||||||
|
highlight->bg_color = TAG_HIGHLIGHT_NORMAL;
|
||||||
|
att_set = 1;
|
||||||
|
}
|
||||||
|
} else if (!strcasecmp(h_bit, "Bold")) {
|
||||||
|
if (att_set)
|
||||||
|
highlight->attributes |= TAG_HIGHLIGHT_BOLD;
|
||||||
|
else {
|
||||||
|
highlight->attributes = TAG_HIGHLIGHT_BOLD;
|
||||||
|
highlight->fg_color = TAG_HIGHLIGHT_NORMAL;
|
||||||
|
highlight->bg_color = TAG_HIGHLIGHT_NORMAL;
|
||||||
|
att_set = 1;
|
||||||
|
}
|
||||||
|
} else if (!strcasecmp(h_bit, "RVid")) {
|
||||||
|
if (att_set)
|
||||||
|
highlight->attributes |= TAG_HIGHLIGHT_RVID;
|
||||||
|
else {
|
||||||
|
highlight->attributes = TAG_HIGHLIGHT_RVID;
|
||||||
|
highlight->fg_color = TAG_HIGHLIGHT_NORMAL;
|
||||||
|
highlight->bg_color = TAG_HIGHLIGHT_NORMAL;
|
||||||
|
att_set = 1;
|
||||||
|
}
|
||||||
|
} else if (!strcasecmp(h_bit, "Blink")) {
|
||||||
|
if (att_set)
|
||||||
|
highlight->attributes |= TAG_HIGHLIGHT_BLINK;
|
||||||
|
else {
|
||||||
|
highlight->attributes = TAG_HIGHLIGHT_BLINK;
|
||||||
|
highlight->fg_color = TAG_HIGHLIGHT_NORMAL;
|
||||||
|
highlight->bg_color = TAG_HIGHLIGHT_NORMAL;
|
||||||
|
att_set = 1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (att_set)
|
||||||
|
string_to_color(config_info, highlight, h_bit);
|
||||||
|
else {
|
||||||
|
att_set = 1;
|
||||||
|
highlight->fg_color = TAG_HIGHLIGHT_NORMAL;
|
||||||
|
highlight->bg_color = TAG_HIGHLIGHT_NORMAL;
|
||||||
|
highlight->attributes = 0;
|
||||||
|
string_to_color(config_info, highlight, h_bit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
h_bit = strtok(NULL, "&");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int
|
||||||
|
string_to_binding_mask(struct config_info *config_info, char *s)
|
||||||
|
{
|
||||||
|
char *b_bit;
|
||||||
|
unsigned int mask = 0;
|
||||||
|
|
||||||
|
b_bit = strtok(s, "&");
|
||||||
|
while (b_bit != NULL) {
|
||||||
|
if (!strcasecmp(b_bit, "Button1"))
|
||||||
|
mask |= TAG_BINDING_BUTTON1;
|
||||||
|
else if (!strcasecmp(b_bit, "Button2"))
|
||||||
|
mask |= TAG_BINDING_BUTTON2;
|
||||||
|
else if (!strcasecmp(b_bit, "Button3"))
|
||||||
|
mask |= TAG_BINDING_BUTTON3;
|
||||||
|
else if (!strcasecmp(b_bit, "Shift"))
|
||||||
|
mask |= TAG_BINDING_SHIFT;
|
||||||
|
else if (!strcasecmp(b_bit, "Control"))
|
||||||
|
mask |= TAG_BINDING_CONTROL;
|
||||||
|
else if (!strcasecmp(b_bit, "Meta"))
|
||||||
|
mask |= TAG_BINDING_META;
|
||||||
|
else
|
||||||
|
configerror(config_info, "Unknown binding token");
|
||||||
|
|
||||||
|
b_bit = strtok(NULL, "&");
|
||||||
|
}
|
||||||
|
|
||||||
|
return mask;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* USE_ACTIVE_TAGS */
|
|
@ -0,0 +1,106 @@
|
||||||
|
/*--------------------------------*-C-*---------------------------------*
|
||||||
|
* File: activeconfig.h
|
||||||
|
*
|
||||||
|
* Copyright 1996,1997 Nat Friedman, Massachusetts Institute of Technology
|
||||||
|
* <ndf@mit.edu>
|
||||||
|
*
|
||||||
|
* You can do what you like with this source code as long as
|
||||||
|
* you don't try to make money out of it and you include an
|
||||||
|
* unaltered copy of this message (including the copyright).
|
||||||
|
*
|
||||||
|
* The author accepts no responsibility for anything whatsoever, nor does he
|
||||||
|
* guarantee anything, nor are any guarantees, promises, or covenants implicit
|
||||||
|
* with the use of this software.
|
||||||
|
*
|
||||||
|
* For information regarding this particular module, please see
|
||||||
|
* README.ActiveTags.
|
||||||
|
*
|
||||||
|
*----------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifdef ACTIVE_TAGS_SPENCER_REGEXP
|
||||||
|
#include "regexp/regexp.h"
|
||||||
|
#else
|
||||||
|
#include <regex.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "activetags.h"
|
||||||
|
|
||||||
|
/* The default locations for the config file */
|
||||||
|
#define TAG_CONFIG_USER_FILENAME ".active.tags"
|
||||||
|
#define TAG_CONFIG_SYSTEM_FILENAME "/etc/active.tags"
|
||||||
|
|
||||||
|
/* Defaults */
|
||||||
|
#define TAG_DEFAULT_SEARCH_LINES 1
|
||||||
|
#define TAG_DEFAULT_BINDING_MASK TAG_BINDING_BUTTON3
|
||||||
|
#define TAG_DEFAULT_HIGHLIGHT_BG TAG_HIGHLIGHT_NORMAL
|
||||||
|
#define TAG_DEFAULT_HIGHLIGHT_FG TAG_HIGHLIGHT_BLUE
|
||||||
|
#define TAG_DEFAULT_HIGHLIGHT_ATT 0
|
||||||
|
|
||||||
|
/* These are the config file tokens. */
|
||||||
|
#define TAG_CONFIG_DEFAULT_BINDING "DefaultBinding"
|
||||||
|
#define TAG_CONFIG_DEFAULT_HIGHLIGHT "DefaultHighlight"
|
||||||
|
#define TAG_CONFIG_DEFAULT_SEARCH_LINES "DefaultSearchLines"
|
||||||
|
#define TAG_CONFIG_SEARCH_LINES "SearchLines"
|
||||||
|
#define TAG_CONFIG_NEW_TAG "{"
|
||||||
|
#define TAG_CONFIG_END_TAG "}"
|
||||||
|
#define TAG_CONFIG_OUTPUT "Output"
|
||||||
|
#define TAG_CONFIG_LATENT "Latent"
|
||||||
|
#define TAG_CONFIG_BINDING "Binding"
|
||||||
|
#define TAG_CONFIG_HIGHLIGHT "Highlight"
|
||||||
|
#define TAG_CONFIG_MODES "Modes"
|
||||||
|
#define TAG_CONFIG_REGEXP "Regexp"
|
||||||
|
#define TAG_CONFIG_ACTION "Action"
|
||||||
|
#define TAG_CONFIG_LOOPACTION "LoopAction"
|
||||||
|
#define TAG_CONFIG_CLUE "Clue"
|
||||||
|
#define TAG_CONFIG_LOAD "Load"
|
||||||
|
#define TAG_CONFIG_ENV "Env"
|
||||||
|
|
||||||
|
/* Macros for parsing the config file */
|
||||||
|
#define TAG_CONFIG(x) (!strncmp(line, (x), strlen(x)))
|
||||||
|
|
||||||
|
/* The config_info structure holds all the information that each individual
|
||||||
|
configuration parsing function needs as it runs */
|
||||||
|
struct config_info {
|
||||||
|
int line_num;
|
||||||
|
int default_binding;
|
||||||
|
tag_highlight_t default_highlight;
|
||||||
|
int default_search_lines;
|
||||||
|
int in_tag;
|
||||||
|
int curr_tag;
|
||||||
|
char filename[1024];
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Each dispatch table entry is of the following form */
|
||||||
|
struct config_entry {
|
||||||
|
char * token;
|
||||||
|
int (*parser)(char *, struct config_info *);
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Configuration dispatch function prototypes */
|
||||||
|
int parse_config_default_binding(char *, struct config_info *);
|
||||||
|
int parse_config_default_highlight(char *, struct config_info *);
|
||||||
|
int parse_config_default_search_lines(char *, struct config_info *);
|
||||||
|
int parse_config_tag_begin(char *, struct config_info *);
|
||||||
|
int parse_config_tag_end(char *, struct config_info *);
|
||||||
|
int parse_config_tag_latent(char *, struct config_info *);
|
||||||
|
int parse_config_tag_binding(char *, struct config_info *);
|
||||||
|
int parse_config_tag_highlight(char *, struct config_info *);
|
||||||
|
int parse_config_tag_modes(char *, struct config_info *);
|
||||||
|
int parse_config_tag_regexp(char *, struct config_info *);
|
||||||
|
int parse_config_tag_action(char *, struct config_info *);
|
||||||
|
int parse_config_tag_search_lines(char *, struct config_info *);
|
||||||
|
int parse_config_tag_output(char *, struct config_info *);
|
||||||
|
int parse_config_tag_clue(char *, struct config_info *);
|
||||||
|
int parse_config_load(char * filename, struct config_info * config_info);
|
||||||
|
int parse_config_tag_env(char * envlist, struct config_info * config_info);
|
||||||
|
|
||||||
|
/* Internal helper functin prototypes */
|
||||||
|
void configerror(struct config_info * config_info, char * message);
|
||||||
|
void string_to_color(struct config_info * config_info, tag_highlight_t *
|
||||||
|
highlight, char * c);
|
||||||
|
void string_to_highlight(struct config_info * config_info, tag_highlight_t *
|
||||||
|
highlight, char * s);
|
||||||
|
unsigned int string_to_binding_mask(struct config_info * config_info,
|
||||||
|
char * s);
|
||||||
|
void set_config_defaults(struct config_info * config_info);
|
||||||
|
int parse_tag_file(const char * filename, struct config_info * config_info);
|
|
@ -0,0 +1,390 @@
|
||||||
|
/*--------------------------------*-C-*---------------------------------*
|
||||||
|
* File: activeeterm.c
|
||||||
|
*
|
||||||
|
* Copyright 1997 Nat Friedman, Massachusetts Institute of Technology
|
||||||
|
* <ndf@mit.edu>
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*----------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* This file contains the glue functions to make active tags work in eterm. */
|
||||||
|
|
||||||
|
/*
|
||||||
|
In order to dingify a program, this plugin file must define the following
|
||||||
|
functions with the specified behavior. Note that functions can be defined
|
||||||
|
as macros just fine.
|
||||||
|
|
||||||
|
The functions are broken up into two groups. The first group of functions
|
||||||
|
are the wrapper functions which get called by the main program. These
|
||||||
|
functions call the internal active tags functions. The second group of
|
||||||
|
functions are the internal functions which are called by the active
|
||||||
|
tags functions.
|
||||||
|
|
||||||
|
WRAPPER FUNCTIONS
|
||||||
|
|
||||||
|
int tag_click( ... )
|
||||||
|
This should call tag_activate after it has properly assembled the
|
||||||
|
binding mask and determined the row and column properly. tag_click()
|
||||||
|
is called from inside the main program.
|
||||||
|
|
||||||
|
void tag_pointer_new_position( ... )
|
||||||
|
This should call show_tag after it has computed the row and column
|
||||||
|
properly and done whatever processing it needs to do.
|
||||||
|
|
||||||
|
void tag_scroll( ... )
|
||||||
|
void tag_init ( ... )
|
||||||
|
void tag_sig_child ( ... )
|
||||||
|
void tag_hide ( ... )
|
||||||
|
|
||||||
|
INTERNAL FUNCTIONS
|
||||||
|
|
||||||
|
void get_tag_mode(char * mode)
|
||||||
|
This function stores a string containing the current mode in the
|
||||||
|
mode parameter. This can be very simple (for example
|
||||||
|
strcpy(mode, "browser") might be sufficient), or somewhat more complex
|
||||||
|
for those programs which can change modes, such as rxvt.
|
||||||
|
|
||||||
|
int row_width(void)
|
||||||
|
returns the maximum width of each row.
|
||||||
|
|
||||||
|
const char ** get_rows(void)
|
||||||
|
returns the comparison region. current_row() and current_col() should
|
||||||
|
be indexes into this region.
|
||||||
|
|
||||||
|
void set_tag_highlight(int row, int col, tag_highlight_t highlight)
|
||||||
|
Highlights the specified character with the specified highlighting.
|
||||||
|
|
||||||
|
tag_highlight_t get_tag_highlight(int row, int col)
|
||||||
|
Returns the current highlighting information for the specified
|
||||||
|
character.
|
||||||
|
*/
|
||||||
|
|
||||||
|
static const char cvs_ident[] = "$Id$";
|
||||||
|
|
||||||
|
#include "feature.h"
|
||||||
|
#ifdef USE_ACTIVE_TAGS
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include "activetags.h"
|
||||||
|
#include "activeeterm.h"
|
||||||
|
#include "mem.h" /* From libmej */
|
||||||
|
|
||||||
|
/*
|
||||||
|
WRAPPER FUNCTIONS
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
tag_pointer_new_position(int x, int y)
|
||||||
|
{
|
||||||
|
int row, col;
|
||||||
|
|
||||||
|
if (!active_tags_enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
col = Pixel2Col(x);
|
||||||
|
row = Pixel2Row(y);
|
||||||
|
|
||||||
|
#ifdef ACTIVE_TAG_CLICK_CLUES
|
||||||
|
if (show_tag(row, col))
|
||||||
|
set_click_clue_timer();
|
||||||
|
else {
|
||||||
|
destroy_click_clue();
|
||||||
|
unset_click_clue_timer();
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
show_tag(row, col);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
tag_scroll(int nlines, int row1, int row2)
|
||||||
|
{
|
||||||
|
if (!active_tags_enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
#ifdef ACTIVE_TAG_CLICK_CLUES
|
||||||
|
if (tag_screen_scroll(nlines, row1, row2)) {
|
||||||
|
destroy_click_clue();
|
||||||
|
unset_click_clue_timer();
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
(void) tag_screen_scroll(nlines, row1, row2);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
tag_init(void)
|
||||||
|
{
|
||||||
|
if (!active_tags_enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
tag_env = "X";
|
||||||
|
|
||||||
|
#ifdef ACTIVE_TAG_CLICK_CLUES
|
||||||
|
init_click_clues();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
initialize_tags();
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
void
|
||||||
|
#endif
|
||||||
|
inline void
|
||||||
|
tag_hide(void)
|
||||||
|
{
|
||||||
|
if (!active_tags_enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
erase_tag_highlighting();
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
tag_click(int x, int y, unsigned int button, unsigned int keystate)
|
||||||
|
{
|
||||||
|
int binding_mask;
|
||||||
|
int row, col;
|
||||||
|
int retval;
|
||||||
|
|
||||||
|
if (!active_tags_enabled)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
#ifdef ACTIVE_TAG_CLICK_CLUES
|
||||||
|
destroy_click_clue();
|
||||||
|
unset_click_clue_timer();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Build the binding mask. Button3 == 3. We need it to be 4
|
||||||
|
(100 binary) to fit in the binding mask properly. */
|
||||||
|
if (button == Button3)
|
||||||
|
button = TAG_BINDING_BUTTON3;
|
||||||
|
|
||||||
|
binding_mask = button;
|
||||||
|
|
||||||
|
if (keystate & ShiftMask)
|
||||||
|
binding_mask |= TAG_BINDING_SHIFT;
|
||||||
|
if (keystate & ControlMask)
|
||||||
|
binding_mask |= TAG_BINDING_CONTROL;
|
||||||
|
if (keystate & Mod1Mask)
|
||||||
|
binding_mask |= TAG_BINDING_META;
|
||||||
|
|
||||||
|
row = Pixel2Row(y);
|
||||||
|
col = Pixel2Col(x);
|
||||||
|
retval = tag_activate(row, col, binding_mask);
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
INTERNAL FUNCTIONS
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* This function finds the current tag mode and stores it in the 'mode'
|
||||||
|
parameter. The current mode is equivalent to argv[0] of the program
|
||||||
|
currently controlling the eterm's terminal. */
|
||||||
|
void
|
||||||
|
get_tag_mode(char *mode)
|
||||||
|
{
|
||||||
|
char proc_name[1024];
|
||||||
|
FILE *f;
|
||||||
|
pid_t pid;
|
||||||
|
|
||||||
|
if ((pid = tcgetpgrp(cmd_fd)) == -1) {
|
||||||
|
fprintf(stderr, "Couldn't get tag mode!\n");
|
||||||
|
strcpy(mode, "");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
sprintf(proc_name, "/proc/%d/cmdline", pid);
|
||||||
|
if ((f = fopen(proc_name, "r")) == NULL) {
|
||||||
|
fprintf(stderr, "Couldn't open proc!\n");
|
||||||
|
strcpy(mode, "");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
fscanf(f, "%s", mode);
|
||||||
|
fclose(f);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* These were changed to macros and moved into activeeterm.h. -vendu */
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
int
|
||||||
|
row_width(void)
|
||||||
|
{
|
||||||
|
return TermWin.ncol;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
tag_min_row(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
tag_max_row(void)
|
||||||
|
{
|
||||||
|
return TermWin.nrow - 1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void
|
||||||
|
tag_get_row(int row_num, char **row)
|
||||||
|
{
|
||||||
|
/* FIXME: I guess this works :) -vendu */
|
||||||
|
*row = drawn_text[row_num];
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
tag_eterm_color(int tag_color)
|
||||||
|
{
|
||||||
|
switch (tag_color) {
|
||||||
|
case TAG_HIGHLIGHT_BLACK:
|
||||||
|
return 2;
|
||||||
|
case TAG_HIGHLIGHT_WHITE:
|
||||||
|
return 1;
|
||||||
|
case TAG_HIGHLIGHT_RED:
|
||||||
|
return 3;
|
||||||
|
case TAG_HIGHLIGHT_GREEN:
|
||||||
|
return 4;
|
||||||
|
case TAG_HIGHLIGHT_YELLOW:
|
||||||
|
return 5;
|
||||||
|
case TAG_HIGHLIGHT_BLUE:
|
||||||
|
return 6;
|
||||||
|
case TAG_HIGHLIGHT_MAGENTA:
|
||||||
|
return 7;
|
||||||
|
case TAG_HIGHLIGHT_CYAN:
|
||||||
|
return 8;
|
||||||
|
default:
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
eterm_tag_color(int eterm_color)
|
||||||
|
{
|
||||||
|
switch (eterm_color) {
|
||||||
|
case 0:
|
||||||
|
return TAG_HIGHLIGHT_NORMAL;
|
||||||
|
case 7:
|
||||||
|
return TAG_HIGHLIGHT_MAGENTA;
|
||||||
|
case 1:
|
||||||
|
return TAG_HIGHLIGHT_WHITE;
|
||||||
|
case 2:
|
||||||
|
return TAG_HIGHLIGHT_BLACK;
|
||||||
|
case 3:
|
||||||
|
return TAG_HIGHLIGHT_RED;
|
||||||
|
case 4:
|
||||||
|
return TAG_HIGHLIGHT_GREEN;
|
||||||
|
case 5:
|
||||||
|
return TAG_HIGHLIGHT_YELLOW;
|
||||||
|
case 6:
|
||||||
|
return TAG_HIGHLIGHT_BLUE;
|
||||||
|
case 8:
|
||||||
|
return TAG_HIGHLIGHT_CYAN;
|
||||||
|
default:
|
||||||
|
return TAG_HIGHLIGHT_NORMAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
set_tag_highlight(int row, int col, tag_highlight_t highlight)
|
||||||
|
{
|
||||||
|
unsigned int rend_mask = 0;
|
||||||
|
unsigned int back;
|
||||||
|
unsigned int fore;
|
||||||
|
|
||||||
|
/* rend_t ** rp = &(screen.rend[row + TermWin.saveLines - TermWin.view_start][col]); */
|
||||||
|
|
||||||
|
if (highlight.attributes & TAG_HIGHLIGHT_RVID)
|
||||||
|
rend_mask |= RS_RVid;
|
||||||
|
if (highlight.attributes & TAG_HIGHLIGHT_ULINE)
|
||||||
|
rend_mask |= RS_Uline;
|
||||||
|
if (highlight.attributes & TAG_HIGHLIGHT_BOLD)
|
||||||
|
rend_mask |= RS_Bold;
|
||||||
|
|
||||||
|
if (highlight.fg_color == TAG_HIGHLIGHT_NORMAL)
|
||||||
|
fore = SET_FGCOLOR(0, fgColor);
|
||||||
|
else
|
||||||
|
fore = SET_FGCOLOR(0, tag_eterm_color(highlight.fg_color));
|
||||||
|
|
||||||
|
if (highlight.bg_color == TAG_HIGHLIGHT_NORMAL)
|
||||||
|
back = SET_BGCOLOR(0, bgColor);
|
||||||
|
else
|
||||||
|
back = SET_BGCOLOR(0, tag_eterm_color(highlight.bg_color));
|
||||||
|
|
||||||
|
screen.rend[row + TermWin.saveLines - TermWin.view_start][col] =
|
||||||
|
rend_mask | fore | back;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
get_tag_highlight(int row, int col, tag_highlight_t * highlight)
|
||||||
|
{
|
||||||
|
unsigned int rend;
|
||||||
|
|
||||||
|
rend = screen.rend[row + TermWin.saveLines - TermWin.view_start][col];
|
||||||
|
|
||||||
|
highlight->attributes = 0;
|
||||||
|
if (rend & RS_RVid)
|
||||||
|
highlight->attributes |= TAG_HIGHLIGHT_RVID;
|
||||||
|
if (rend & RS_Uline)
|
||||||
|
highlight->attributes |= TAG_HIGHLIGHT_ULINE;
|
||||||
|
if (rend & RS_Bold)
|
||||||
|
highlight->attributes |= TAG_HIGHLIGHT_BOLD;
|
||||||
|
if (rend & RS_Blink)
|
||||||
|
highlight->attributes |= TAG_HIGHLIGHT_BLINK;
|
||||||
|
|
||||||
|
highlight->fg_color = eterm_tag_color(GET_FGCOLOR(rend));
|
||||||
|
highlight->bg_color = eterm_tag_color(GET_BGCOLOR(rend));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set the UID appropriately */
|
||||||
|
int
|
||||||
|
set_tag_uid(void)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set stdout for loop actions */
|
||||||
|
int
|
||||||
|
set_tag_stdout(void)
|
||||||
|
{
|
||||||
|
if (close(1) < 0) {
|
||||||
|
perror("close");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (dup(cmd_fd) < 0) {
|
||||||
|
perror("dup");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set the PWD to the pwd of the process eterm is running */
|
||||||
|
int
|
||||||
|
set_tag_pwd(void)
|
||||||
|
{
|
||||||
|
char dir[1024];
|
||||||
|
|
||||||
|
sprintf(dir, "/proc/%d/cwd", cmd_pid);
|
||||||
|
if (chdir(dir) < 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* USE_ACTIVE_TAGS */
|
|
@ -0,0 +1,48 @@
|
||||||
|
/*--------------------------------*-C-*---------------------------------*
|
||||||
|
* File: activeeterm.h
|
||||||
|
*
|
||||||
|
* Copyright 1997 Nat Friedman, Massachusetts Institute of Technology
|
||||||
|
* <ndf@mit.edu>
|
||||||
|
*
|
||||||
|
* 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 _ACTIVEETERM_H
|
||||||
|
# define ACTIVEETERM_H
|
||||||
|
|
||||||
|
# include "screen.h"
|
||||||
|
# include "command.h"
|
||||||
|
# include "main.h" /* for TermWin */
|
||||||
|
/* #include "rxvtgrx.h" */
|
||||||
|
|
||||||
|
/* #define MAX_RXVT_ROWS 1024 */
|
||||||
|
|
||||||
|
int tag_click(int x, int y, unsigned int button, unsigned int keystate);
|
||||||
|
void tag_pointer_new_position(int x, int y);
|
||||||
|
void tag_init(void);
|
||||||
|
|
||||||
|
extern int cmd_fd;
|
||||||
|
extern screen_t screen;
|
||||||
|
|
||||||
|
extern text_t **drawn_text;
|
||||||
|
extern rend_t **drawn_rend;
|
||||||
|
|
||||||
|
# define row_width() (TermWin.ncol)
|
||||||
|
# define tag_min_row() (0)
|
||||||
|
# define tag_max_row() (TermWin.nrow - 1)
|
||||||
|
|
||||||
|
#endif /* ACTIVEETERM_H */
|
|
@ -0,0 +1,524 @@
|
||||||
|
/*--------------------------------*-C-*---------------------------------*
|
||||||
|
* File: activetags.c
|
||||||
|
*
|
||||||
|
* Copyright 1997 Nat Friedman, Massachusetts Institute of Technology
|
||||||
|
* <ndf@mit.edu>
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*----------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
This file contains all of the basic active tags functionality. These
|
||||||
|
are the generalized routines which can be plugged into just about anything.
|
||||||
|
If I've designed everything properly, which I believe I have, you should
|
||||||
|
not have to change anything in this file in order to plug active tags into
|
||||||
|
an application.
|
||||||
|
|
||||||
|
See activeeterm.c for the routines which interface these functions with Eterm
|
||||||
|
*/
|
||||||
|
|
||||||
|
static const char cvs_ident[] = "$Id$";
|
||||||
|
|
||||||
|
#include "feature.h"
|
||||||
|
#ifdef USE_ACTIVE_TAGS
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include "activetags.h"
|
||||||
|
#include "activeeterm.h"
|
||||||
|
|
||||||
|
/* ============================ Global Variables =========================== */
|
||||||
|
|
||||||
|
/* This is for run-time enabling and disabling of tags. It is 1 if tags are
|
||||||
|
enabled at 0 otherwise. */
|
||||||
|
int active_tags_enabled = 1;
|
||||||
|
|
||||||
|
/* This is the global array of tag configurations. Each of the tags in the
|
||||||
|
configuration file corresponds to a tag in this global array. These are
|
||||||
|
allocated statically just to reduce the complexity of the code. Increase
|
||||||
|
MAX_TAGS in activetags.h if you run out. */
|
||||||
|
struct active_tag tag[MAX_TAGS];
|
||||||
|
int num_tags = 0;
|
||||||
|
|
||||||
|
/* The tag environment (e.g. "X", "console", ... */
|
||||||
|
char *tag_env;
|
||||||
|
|
||||||
|
/* The data regarding the last tag highlighted on the screen. NB: this model
|
||||||
|
limits the number of highlighted tags on the screen to one. */
|
||||||
|
int last_h_tag_index = -1, last_h_tag_begin_row = -1, last_h_tag_end_row = -1, last_h_tag_begin_col = -1, last_h_tag_end_col = -1;
|
||||||
|
tag_highlight_t old_highlighting[MAX_SEARCH_LINES][MAX_SEARCH_COLS];
|
||||||
|
|
||||||
|
char *tag_config_file = NULL;
|
||||||
|
|
||||||
|
static char *thingy = "ActiveTags 1.0b4 -- Copyright 1997,1998 Nat Friedman <ndf@mit.edu> -- DINGUS UBER ALLES";
|
||||||
|
|
||||||
|
/* ============================== Tag Routines ============================= */
|
||||||
|
|
||||||
|
/* This is the tag intialization routine. It needs to be called upon
|
||||||
|
startup. */
|
||||||
|
void
|
||||||
|
initialize_tags(void)
|
||||||
|
{
|
||||||
|
/* Parse the config file */
|
||||||
|
parse_tag_config(tag_config_file);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
disable_tags(void)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Active tags are disabled.\n");
|
||||||
|
active_tags_enabled = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* check_tag_mode returns true if the mode parameter is one of the modes
|
||||||
|
for which the tag indexed by tag_index is active. Otherwise, it returns
|
||||||
|
false. */
|
||||||
|
int
|
||||||
|
check_tag_mode(int tag_index, char *mode)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
/* If no modes are listed for a particular tag, that tag is always active. */
|
||||||
|
if (tag[tag_index].num_modes == 0)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
for (i = 0; i < tag[tag_index].num_modes; i++)
|
||||||
|
if (!strcmp(mode, tag[tag_index].mode[i]))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
check_tag_env(int tag_index)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (!tag[tag_index].num_envs)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
for (i = 0; i < tag[tag_index].num_envs; i++)
|
||||||
|
if (!strcasecmp(tag_env, tag[tag_index].env[i]))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check the position specified by (row,col) for a tag. If there is
|
||||||
|
a tag there, set tag_begin and tag_end to the proper offsets into
|
||||||
|
screen.text and screen.rend, and set tag_index to the index of the
|
||||||
|
tag that was identified. If no tag is found, return 0. Otherwise,
|
||||||
|
return 1. If binding_mask is set, then only search tags whose
|
||||||
|
binding mask matches the binding_mask passed to the function.
|
||||||
|
Tag searching begins at the specified index, tag_begin_index. */
|
||||||
|
int
|
||||||
|
find_tag(int row, int col, int *tag_begin_row, int *tag_begin_col,
|
||||||
|
int *tag_end_row, int *tag_end_col, int *tag_index,
|
||||||
|
unsigned int binding_mask, int tag_begin_index)
|
||||||
|
{
|
||||||
|
char *curr_row;
|
||||||
|
static char mode[1024];
|
||||||
|
static int mode_check_count = 0;
|
||||||
|
char compare_region[MAX_SEARCH_CHARS];
|
||||||
|
int compare_offset, compare_region_pointer_position;
|
||||||
|
int done;
|
||||||
|
unsigned int region_size;
|
||||||
|
unsigned int last_region_size = 0;
|
||||||
|
|
||||||
|
int start_row, end_row, i, dest_offset;
|
||||||
|
|
||||||
|
char *start_match_p, *end_match_p;
|
||||||
|
|
||||||
|
#ifndef ACTIVE_TAGS_SPENCER_REGEXP
|
||||||
|
regmatch_t regmatch[5];
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
D_TAGS(("==> find_tag(row=%d, col=%d, ..., binding=%d, begin=%d)\n", row, col, binding_mask, tag_begin_index));
|
||||||
|
if (!mode_check_count)
|
||||||
|
get_tag_mode(mode);
|
||||||
|
|
||||||
|
mode_check_count++;
|
||||||
|
if (mode_check_count == MAX_MODE_CHECK_COUNT)
|
||||||
|
mode_check_count = 0;
|
||||||
|
for (*tag_index = tag_begin_index; *tag_index < num_tags; (*tag_index)++) {
|
||||||
|
D_TAGS((" ==> tag: %d (sl=%d)\n", *tag_index, tag[*tag_index].search_lines));
|
||||||
|
if (((binding_mask == 0) && (!tag[*tag_index].latent)) ||
|
||||||
|
(binding_mask && (binding_mask == tag[*tag_index].binding_mask)))
|
||||||
|
if (check_tag_mode(*tag_index, mode) && (check_tag_env(*tag_index))) {
|
||||||
|
start_row = row - tag[*tag_index].search_lines / 2;
|
||||||
|
end_row = row + tag[*tag_index].search_lines / 2;
|
||||||
|
|
||||||
|
if (start_row < tag_min_row())
|
||||||
|
start_row = tag_min_row();
|
||||||
|
|
||||||
|
if (end_row > tag_max_row())
|
||||||
|
end_row = tag_max_row();
|
||||||
|
|
||||||
|
compare_region_pointer_position = ((row - start_row) * row_width()) +
|
||||||
|
col;
|
||||||
|
|
||||||
|
region_size = (row_width()) * (end_row - start_row + 1);
|
||||||
|
|
||||||
|
if (region_size > MAX_SEARCH_CHARS) {
|
||||||
|
fprintf(stderr, "search region too large: reduce number of "
|
||||||
|
"search lines.\n");
|
||||||
|
fprintf(stderr, "row_width: %d end_row: %d start_row: %d\n",
|
||||||
|
row_width(), end_row, start_row);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (region_size != last_region_size) {
|
||||||
|
D_TAGS((" ==> region_size == %d\tlast_region_size == %d\n", region_size, last_region_size));
|
||||||
|
i = start_row;
|
||||||
|
dest_offset = 0;
|
||||||
|
while (i <= end_row) {
|
||||||
|
tag_get_row(i, &curr_row);
|
||||||
|
D_TAGS(("Memcpying row into place...\n"));
|
||||||
|
memcpy(compare_region + dest_offset, curr_row, row_width());
|
||||||
|
D_TAGS(("Done\n"));
|
||||||
|
dest_offset += row_width();
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
compare_region[dest_offset + 1] = '\0';
|
||||||
|
}
|
||||||
|
last_region_size = region_size;
|
||||||
|
|
||||||
|
|
||||||
|
done = 0;
|
||||||
|
compare_offset = 0;
|
||||||
|
|
||||||
|
while (!done) {
|
||||||
|
#ifdef ACTIVE_TAGS_SPENCER_REGEXP
|
||||||
|
if (regexec(tag[*tag_index].rx, compare_region + compare_offset))
|
||||||
|
#else
|
||||||
|
if (!regexec(&tag[*tag_index].rx, compare_region + compare_offset,
|
||||||
|
4, regmatch, REG_NOTBOL | REG_NOTEOL))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
{
|
||||||
|
#ifdef ACTIVE_TAGS_SPENCER_REGEXP
|
||||||
|
start_match_p = tag[*tag_index].rx->startp[0];
|
||||||
|
end_match_p = tag[*tag_index].rx->endp[0];
|
||||||
|
#else
|
||||||
|
start_match_p = compare_region + compare_offset +
|
||||||
|
regmatch[0].rm_so;
|
||||||
|
end_match_p = compare_region + compare_offset +
|
||||||
|
regmatch[0].rm_eo;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if ((start_match_p <=
|
||||||
|
(compare_region + compare_region_pointer_position)) &&
|
||||||
|
(end_match_p >
|
||||||
|
(compare_region + compare_region_pointer_position))) {
|
||||||
|
*tag_begin_row = ((start_match_p -
|
||||||
|
compare_region) / row_width()) +
|
||||||
|
start_row;
|
||||||
|
*tag_begin_col = (start_match_p -
|
||||||
|
compare_region) -
|
||||||
|
((start_match_p - compare_region) /
|
||||||
|
row_width()) * row_width();
|
||||||
|
|
||||||
|
*tag_end_row = ((end_match_p -
|
||||||
|
compare_region) / row_width()) +
|
||||||
|
start_row;
|
||||||
|
*tag_end_col = (end_match_p -
|
||||||
|
compare_region) -
|
||||||
|
((end_match_p - compare_region) /
|
||||||
|
row_width()) * row_width();
|
||||||
|
D_TAGS(("Found tag: begin_row: %d begin_col: %d\nend_row : %d end_col : %d\n", *tag_begin_row, *tag_begin_col,
|
||||||
|
*tag_end_row, *tag_end_col));
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
} else
|
||||||
|
compare_offset = (end_match_p -
|
||||||
|
compare_region);
|
||||||
|
} else
|
||||||
|
done = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* tag_scroll -- This is to notify the tag functionality that the screen
|
||||||
|
has scrolled nlines lines (positive means scrolled up, negative means
|
||||||
|
scrolled down) from start_row to end_row (inclusive) */
|
||||||
|
int
|
||||||
|
tag_screen_scroll(int nlines, int start_row, int end_row)
|
||||||
|
{
|
||||||
|
|
||||||
|
D_TAGS(("tag_scroll(%d, %d, %d)\n", nlines, start_row, end_row));
|
||||||
|
D_TAGS(("\tlast_brow: %d last_erow: %d\n", last_h_tag_begin_row, last_h_tag_end_row));
|
||||||
|
if (!nlines)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (last_h_tag_index == -1)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* If the last highlighted tag is not part of the region that scrolled,
|
||||||
|
we don't need to do anything. */
|
||||||
|
if (last_h_tag_begin_row > end_row)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (last_h_tag_end_row < start_row)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* Otherwise, update the position of the tag last highlighted */
|
||||||
|
last_h_tag_begin_row += nlines;
|
||||||
|
last_h_tag_end_row += nlines;
|
||||||
|
|
||||||
|
/* Erase the tag */
|
||||||
|
(void) show_tag(last_h_tag_begin_row - nlines, last_h_tag_begin_col + 1);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* This function restores the rendering information for the currently
|
||||||
|
highlighted tag to its status before the tag was highlighted. */
|
||||||
|
void
|
||||||
|
erase_tag_highlighting(void)
|
||||||
|
{
|
||||||
|
int row, col;
|
||||||
|
int final_highlight_col;
|
||||||
|
int start_highlight_col;
|
||||||
|
|
||||||
|
if (last_h_tag_index != -1) {
|
||||||
|
for (row = last_h_tag_begin_row; row <= last_h_tag_end_row; row++) {
|
||||||
|
final_highlight_col = (row == last_h_tag_end_row) ?
|
||||||
|
last_h_tag_end_col : row_width();
|
||||||
|
start_highlight_col = (row == last_h_tag_begin_row) ?
|
||||||
|
last_h_tag_begin_col : 0;
|
||||||
|
for (col = start_highlight_col; col < final_highlight_col; col++) {
|
||||||
|
set_tag_highlight(row, col,
|
||||||
|
old_highlighting[row - last_h_tag_begin_row][col]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* We don't need to keep erasing now that nothing is highlighted */
|
||||||
|
last_h_tag_index = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Highlight a tag if one exists at the location specified in pixels.
|
||||||
|
If no tag exists there and a tag is currently highlighted, we need
|
||||||
|
to erase that tag's highlighting. */
|
||||||
|
int
|
||||||
|
show_tag(int row, int col)
|
||||||
|
{
|
||||||
|
unsigned int tag_begin_col, tag_end_col, tag_begin_row, tag_end_row, tag_index;
|
||||||
|
int final_highlight_col;
|
||||||
|
int start_highlight_col;
|
||||||
|
tag_highlight_t highlight;
|
||||||
|
|
||||||
|
D_TAGS(("==> show_tag(%d,%d)\n", row, col));
|
||||||
|
|
||||||
|
/* If there's no tag there and a tag is currently highlighted, we need
|
||||||
|
to erase its highlighting. */
|
||||||
|
if (!find_tag(row, col, &tag_begin_row, &tag_begin_col, &tag_end_row,
|
||||||
|
&tag_end_col, &tag_index, 0, 0)) {
|
||||||
|
D_TAGS((" ==> no tag, erasing highlighting and leaving.\n"));
|
||||||
|
/* Erase the old highlighting */
|
||||||
|
tag_hide();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
/* If we've come this far, then we are on a tag, and it needs to be
|
||||||
|
highlighted. */
|
||||||
|
|
||||||
|
/* If we're on the same tag as last time, there's no need to do
|
||||||
|
anything. */
|
||||||
|
if ((tag_index == last_h_tag_index) &&
|
||||||
|
(tag_begin_row == last_h_tag_begin_row) &&
|
||||||
|
(tag_end_row == last_h_tag_end_row) &&
|
||||||
|
(tag_begin_col == last_h_tag_begin_col) &&
|
||||||
|
(tag_end_col == last_h_tag_end_col))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
/* Erase the old highlighting */
|
||||||
|
tag_hide();
|
||||||
|
|
||||||
|
/* Add the new highlighting */
|
||||||
|
for (row = tag_begin_row; row <= tag_end_row; row++) {
|
||||||
|
final_highlight_col = (row == tag_end_row) ? tag_end_col :
|
||||||
|
row_width();
|
||||||
|
start_highlight_col = (row == tag_begin_row) ? tag_begin_col : 0;
|
||||||
|
for (col = start_highlight_col; col < final_highlight_col; col++) {
|
||||||
|
get_tag_highlight(row, col, &highlight);
|
||||||
|
memcpy((void *) &old_highlighting[row - tag_begin_row][col],
|
||||||
|
(void *) &highlight, sizeof(tag_highlight_t));
|
||||||
|
|
||||||
|
set_tag_highlight(row, col, tag[tag_index].highlight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Store the old values to erase later */
|
||||||
|
last_h_tag_index = tag_index;
|
||||||
|
last_h_tag_begin_row = tag_begin_row;
|
||||||
|
last_h_tag_end_row = tag_end_row;
|
||||||
|
last_h_tag_begin_col = tag_begin_col;
|
||||||
|
last_h_tag_end_col = tag_end_col;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check to see if there's a tag at the location specified by (x,y) (in
|
||||||
|
pixels). If so, execute the corresponding action. Return 0 if there's
|
||||||
|
no tag there, otherwise return 1. */
|
||||||
|
int
|
||||||
|
tag_activate(int row, int col, unsigned int binding_mask)
|
||||||
|
{
|
||||||
|
int tag_begin_row, tag_end_row, tag_index, tag_begin_col, tag_end_col;
|
||||||
|
|
||||||
|
D_TAGS(("tag_activate(row==%d, col==%d, ...)\n", row, col));
|
||||||
|
|
||||||
|
/* If there is no tag to be activated here, return. */
|
||||||
|
if (!find_tag(row, col, &tag_begin_row, &tag_begin_col, &tag_end_row,
|
||||||
|
&tag_end_col, &tag_index, binding_mask, 0))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* Otherwise, activate the tag. */
|
||||||
|
execute_tag(tag_begin_row, tag_begin_col, tag_end_row, tag_end_col,
|
||||||
|
tag_index);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Execute the tag specified by tag_index and contained between the
|
||||||
|
indices specified by tag_begin and tag_end. */
|
||||||
|
|
||||||
|
void
|
||||||
|
execute_tag(int tag_begin_row, int tag_begin_col,
|
||||||
|
int tag_end_row, int tag_end_col, int tag_index)
|
||||||
|
{
|
||||||
|
char tagstr[MAX_SEARCH_CHARS];
|
||||||
|
char cmd[MAX_TAG_COMMAND_LENGTH];
|
||||||
|
char *p, *q;
|
||||||
|
pid_t pid;
|
||||||
|
int dest_offset;
|
||||||
|
int i, start_column, end_column;
|
||||||
|
char *curr_row;
|
||||||
|
|
||||||
|
printf("==> Activating tag %d:\n ==> Action: [%s]\n Env: [%s] ==> Output: %s\n",
|
||||||
|
tag_index, tag[tag_index].action, tag_env,
|
||||||
|
(tag[tag_index].output_type == TAG_OUTPUT_NULL) ? "NULL" :
|
||||||
|
((tag[tag_index].output_type == TAG_OUTPUT_POPUP) ? "POPUP" :
|
||||||
|
((tag[tag_index].output_type == TAG_OUTPUT_LOOP) ? "LOOP" :
|
||||||
|
((tag[tag_index].output_type == TAG_OUTPUT_REPL) ? "REPL" :
|
||||||
|
"UNKNOWN"))));
|
||||||
|
|
||||||
|
/* If the tag's action is TAG_ACTION_RELOAD, then we simply
|
||||||
|
relaod the tag config file. */
|
||||||
|
if (!strcmp(tag[tag_index].action, TAG_ACTION_RELOAD)) {
|
||||||
|
for (i = 0; i < num_tags; i++)
|
||||||
|
#ifdef ACTIVE_TAGS_SPENCER_REGEXP
|
||||||
|
regfree(tag[i].rx);
|
||||||
|
#else
|
||||||
|
regfree(&tag[i].rx);
|
||||||
|
#endif
|
||||||
|
num_tags = 0;
|
||||||
|
parse_tag_config(tag_config_file);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!strcmp(tag[tag_index].action, TAG_ACTION_DISABLE)) {
|
||||||
|
disable_tags();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
/* For debugging */
|
||||||
|
if (!strcmp(tag[tag_index].action, TAG_ACTION_MODE)) {
|
||||||
|
char mode[1024];
|
||||||
|
|
||||||
|
get_tag_mode(mode);
|
||||||
|
fprintf(stderr, "Mode: %s\n", mode);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
/* Fork off a separate process to execute the new tag. */
|
||||||
|
pid = fork();
|
||||||
|
|
||||||
|
if (pid == 0) { /* child */
|
||||||
|
|
||||||
|
D_TAGS(("Child\n"));
|
||||||
|
|
||||||
|
i = tag_begin_row;
|
||||||
|
dest_offset = 0;
|
||||||
|
|
||||||
|
while (i <= tag_end_row) {
|
||||||
|
start_column = i == tag_begin_row ? tag_begin_col : 0;
|
||||||
|
end_column = i == tag_end_row ? tag_end_col : row_width();
|
||||||
|
D_TAGS(("row: %d Start col: %d end_col: %d\n", i, start_column, end_column));
|
||||||
|
tag_get_row(i, &curr_row);
|
||||||
|
memcpy(tagstr + dest_offset,
|
||||||
|
curr_row + start_column,
|
||||||
|
end_column - start_column);
|
||||||
|
|
||||||
|
dest_offset += end_column - start_column;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
tagstr[dest_offset] = '\0';
|
||||||
|
D_TAGS(("\t==> tag string: {%s}\n", tagstr));
|
||||||
|
/* Initialize the command string */
|
||||||
|
*cmd = '\0';
|
||||||
|
|
||||||
|
/* Build the command string from the action string by replacing
|
||||||
|
all occurences of ${} in the action string with the tag string. */
|
||||||
|
q = p = tag[tag_index].action;
|
||||||
|
while ((p = strstr(q, "${}")) != NULL) {
|
||||||
|
*p = '\0';
|
||||||
|
strcat(cmd, q);
|
||||||
|
|
||||||
|
strcat(cmd, tagstr);
|
||||||
|
|
||||||
|
/* Step over the remaining characters of the ${} */
|
||||||
|
q = p + 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
strcat(cmd + strlen(cmd), q);
|
||||||
|
|
||||||
|
if (!set_tag_pwd())
|
||||||
|
fprintf(stderr, "Active Tags: couldn't set the pwd!\n");
|
||||||
|
|
||||||
|
|
||||||
|
/* Set the UID appropriately so we don't act as the wrong user */
|
||||||
|
if (!set_tag_uid()) {
|
||||||
|
fprintf(stderr, "Active Tags: tag action: Couldn't set the uid!\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
/* For a loop action, we connect stdout on the tag process to stdin on
|
||||||
|
the terminal's executing process */
|
||||||
|
if (tag[tag_index].output_type == TAG_OUTPUT_LOOP)
|
||||||
|
/* I wonder if screwing around with Eterm's stdin is a good idea >:)
|
||||||
|
* -vendu
|
||||||
|
*/
|
||||||
|
if (!set_tag_stdout()) {
|
||||||
|
fprintf(stderr, "Active Tags: tag action: Couldn't set stdout for "
|
||||||
|
"a loop action!\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
system(cmd);
|
||||||
|
#if 0
|
||||||
|
exit(1); /* This might be a bad idea :) Makes Eterm exit, at
|
||||||
|
* least if run from another Eterm. -vendu */
|
||||||
|
#endif
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* USE_ACTIVE_TAGS */
|
|
@ -0,0 +1,182 @@
|
||||||
|
/*--------------------------------*-C-*---------------------------------*
|
||||||
|
* File: activetags.h
|
||||||
|
*
|
||||||
|
* Copyright 1996,1997 Nat Friedman, Massachusetts Institute of Technology
|
||||||
|
* <ndf@mit.edu>
|
||||||
|
*
|
||||||
|
* You can do what you like with this source code as long as
|
||||||
|
* you don't try to make money out of it and you include an
|
||||||
|
* unaltered copy of this message (including the copyright).
|
||||||
|
*
|
||||||
|
* The author accepts no responsibility for anything whatsoever, nor does he
|
||||||
|
* guarantee anything, nor are any guarantees, promises, or covenants implicit
|
||||||
|
* with the use of this software.
|
||||||
|
*
|
||||||
|
* For information regarding this particular module, please see
|
||||||
|
* README.ActiveTags.
|
||||||
|
*
|
||||||
|
*----------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef _ACTIVE_TAGS_H
|
||||||
|
#define _ACTIVE_TAGS_H
|
||||||
|
|
||||||
|
#ifndef ACTIVE_TAGS
|
||||||
|
#define ACTIVE_TAGS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ACTIVE_TAGS_SPENCER_REGEXP
|
||||||
|
#include "regexp/regexp.h"
|
||||||
|
#else
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <regex.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#define TAG_ACTION_RELOAD "*reload*"
|
||||||
|
#define TAG_ACTION_DISABLE "*disable*"
|
||||||
|
|
||||||
|
/* Debugging actions */
|
||||||
|
#define TAG_ACTION_MODE "*mode*"
|
||||||
|
|
||||||
|
|
||||||
|
#define TAG_DRAG_THRESHHOLD 500
|
||||||
|
|
||||||
|
/* Maximums */
|
||||||
|
#define MAX_TAGS 128
|
||||||
|
#define MAX_SEARCH_CHARS 32767
|
||||||
|
#define MAX_SEARCH_LINES 25
|
||||||
|
#define MAX_SEARCH_COLS 300
|
||||||
|
#define MAX_SCREEN_ROWS 128
|
||||||
|
#define MAX_TAG_MODES 32
|
||||||
|
#define MAX_TAG_MODE_LEN 32
|
||||||
|
#define MAX_TAG_COMMAND_LENGTH 2048
|
||||||
|
#define MAX_REGEXP_LEN 1024
|
||||||
|
#define MAX_ACTION_LEN 1024
|
||||||
|
#define MAX_CLUE_LENGTH 1024
|
||||||
|
#define MAX_MODE_CHECK_COUNT 25
|
||||||
|
#define MAX_TAG_ENVS 8
|
||||||
|
#define MAX_TAG_ENV_LEN 16
|
||||||
|
|
||||||
|
/* Output Types */
|
||||||
|
#define TAG_OUTPUT_POPUP 1
|
||||||
|
#define TAG_OUTPUT_LOOP 2
|
||||||
|
#define TAG_OUTPUT_NULL 3
|
||||||
|
#define TAG_OUTPUT_REPL 4
|
||||||
|
|
||||||
|
/* Binding fields */
|
||||||
|
#define TAG_BINDING_BUTTON1 (1<<0)
|
||||||
|
#define TAG_BINDING_BUTTON2 (1<<1)
|
||||||
|
#define TAG_BINDING_BUTTON3 (1<<2)
|
||||||
|
#define TAG_BINDING_SHIFT (1<<3)
|
||||||
|
#define TAG_BINDING_CONTROL (1<<4)
|
||||||
|
#define TAG_BINDING_META (1<<5)
|
||||||
|
|
||||||
|
/* Highlight fields */
|
||||||
|
#define TAG_HIGHLIGHT_RVID (1L<<0)
|
||||||
|
#define TAG_HIGHLIGHT_BOLD (1L<<1)
|
||||||
|
#define TAG_HIGHLIGHT_ULINE (1L<<2)
|
||||||
|
#define TAG_HIGHLIGHT_BLINK (1L<<3)
|
||||||
|
|
||||||
|
#define TAG_HIGHLIGHT_BLACK (1L<<0)
|
||||||
|
#define TAG_HIGHLIGHT_WHITE (1L<<1)
|
||||||
|
#define TAG_HIGHLIGHT_RED (1L<<2)
|
||||||
|
#define TAG_HIGHLIGHT_GREEN (1L<<3)
|
||||||
|
#define TAG_HIGHLIGHT_YELLOW (1L<<4)
|
||||||
|
#define TAG_HIGHLIGHT_BLUE (1L<<5)
|
||||||
|
#define TAG_HIGHLIGHT_MAGENTA (1L<<6)
|
||||||
|
#define TAG_HIGHLIGHT_CYAN (1L<<7)
|
||||||
|
#define TAG_HIGHLIGHT_NORMAL -1
|
||||||
|
|
||||||
|
typedef struct tag_highlight {
|
||||||
|
/* Underline, Reverse Video, Bold */
|
||||||
|
int attributes;
|
||||||
|
|
||||||
|
/* Highlighting colors */
|
||||||
|
int fg_color;
|
||||||
|
int bg_color;
|
||||||
|
|
||||||
|
} tag_highlight_t;
|
||||||
|
|
||||||
|
struct active_tag {
|
||||||
|
|
||||||
|
/* rx is the compiled regular expression for the tag */
|
||||||
|
#ifdef ACTIVE_TAGS_SPENCER_REGEXP
|
||||||
|
regexp * rx;
|
||||||
|
#else
|
||||||
|
regex_t rx;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* The action is a program to be executed. The string ${} in the action
|
||||||
|
will be replaced with the tag. */
|
||||||
|
char action[MAX_ACTION_LEN];
|
||||||
|
|
||||||
|
tag_highlight_t highlight;
|
||||||
|
|
||||||
|
/* The button/key combo that activates this tag. */
|
||||||
|
unsigned int binding_mask;
|
||||||
|
|
||||||
|
/* Number of lines to search for this tag */
|
||||||
|
int search_lines;
|
||||||
|
|
||||||
|
char mode[MAX_TAG_MODES][MAX_TAG_MODE_LEN];
|
||||||
|
int num_modes;
|
||||||
|
|
||||||
|
char env[MAX_TAG_ENVS][MAX_TAG_ENV_LEN];
|
||||||
|
int num_envs;
|
||||||
|
|
||||||
|
/* See TAG_OUTPUT_* */
|
||||||
|
int output_type;
|
||||||
|
|
||||||
|
/* Whether or not the tag is latent. */
|
||||||
|
int latent;
|
||||||
|
|
||||||
|
char clue[MAX_CLUE_LENGTH];
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* Template prototypes */
|
||||||
|
void get_tag_mode(char * mode);
|
||||||
|
/* int row_width(void); */
|
||||||
|
void tag_get_row(int row_num, char ** row);
|
||||||
|
/* int tag_min_row(void); */
|
||||||
|
/* int tag_max_row(void); */
|
||||||
|
void set_tag_highlight(int row, int col, tag_highlight_t highlight);
|
||||||
|
void get_tag_highlight(int row, int col, tag_highlight_t * highlight);
|
||||||
|
int set_tag_stdout(void);
|
||||||
|
int set_tag_pwd(void);
|
||||||
|
int set_tag_uid(void);
|
||||||
|
|
||||||
|
/* Prototypes */
|
||||||
|
void parse_tag_config(char * tag_config_file);
|
||||||
|
int find_tag(int row, int col, int * tag_begin_row, int * tag_begin_col,
|
||||||
|
int * tag_end_row, int * tag_end_col,
|
||||||
|
int * tag_index, unsigned int binding_mask, int tag_begin_index);
|
||||||
|
int show_tag(int x, int y);
|
||||||
|
int tag_activate(int row, int col, unsigned int binding_mask);
|
||||||
|
void execute_tag(int tag_begin_row, int tag_begin_col, int tag_end_row, int tag_end_col, int tag_index);
|
||||||
|
void initialize_tags(void);
|
||||||
|
int tag_screen_scroll(int nlines, int start_row, int end_row);
|
||||||
|
void reap_tag_process(pid_t pid);
|
||||||
|
void erase_tag_highlighting(void);
|
||||||
|
void disable_tags(void);
|
||||||
|
void tag_hide(void);
|
||||||
|
|
||||||
|
/* Externs */
|
||||||
|
extern int active_tags_enabled;
|
||||||
|
extern struct active_tag tag[MAX_TAGS];
|
||||||
|
extern int num_tags;
|
||||||
|
extern int last_h_tag_begin_row;
|
||||||
|
extern int last_h_tag_begin_col;
|
||||||
|
extern int last_h_tag_index;
|
||||||
|
extern char * tag_env;
|
||||||
|
|
||||||
|
#endif /* _ACTIVE_TAGS_H */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,122 @@
|
||||||
|
/*--------------------------------*-C-*---------------------------------*
|
||||||
|
* File: command.h
|
||||||
|
*
|
||||||
|
* Copyright 1992 John Bovey, University of Kent at Canterbury.
|
||||||
|
*
|
||||||
|
* You can do what you like with this source code as long as you don't try
|
||||||
|
* to make money out of it and you include an unaltered copy of this
|
||||||
|
* message (including the copyright).
|
||||||
|
*
|
||||||
|
* This module has been heavily modified by R. Nation
|
||||||
|
* <nation@rocket.sanders.lockheed.com>
|
||||||
|
* No additional restrictions are applied.
|
||||||
|
*
|
||||||
|
* Additional modifications by mj olesen <olesen@me.QueensU.CA>
|
||||||
|
* No additional restrictions are applied.
|
||||||
|
*
|
||||||
|
* As usual, the author accepts no responsibility for anything, nor does
|
||||||
|
* he guarantee anything whatsoever.
|
||||||
|
*----------------------------------------------------------------------*/
|
||||||
|
#ifndef _COMMAND_H_
|
||||||
|
# define _COMMAND_H_
|
||||||
|
# include <X11/X.h>
|
||||||
|
# include <X11/Xfuncproto.h>
|
||||||
|
# include <X11/Xproto.h>
|
||||||
|
# include <stdio.h>
|
||||||
|
# include <limits.h>
|
||||||
|
|
||||||
|
# ifdef USE_ACTIVE_TAGS
|
||||||
|
# include "activetags.h"
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# define menuBar_esc 10
|
||||||
|
# define scrollBar_esc 30
|
||||||
|
|
||||||
|
/* Motif window hints */
|
||||||
|
#define MWM_HINTS_FUNCTIONS (1L << 0)
|
||||||
|
#define MWM_HINTS_DECORATIONS (1L << 1)
|
||||||
|
#define MWM_HINTS_INPUT_MODE (1L << 2)
|
||||||
|
#define MWM_HINTS_STATUS (1L << 3)
|
||||||
|
|
||||||
|
/* bit definitions for MwmHints.functions */
|
||||||
|
#define MWM_FUNC_ALL (1L << 0)
|
||||||
|
#define MWM_FUNC_RESIZE (1L << 1)
|
||||||
|
#define MWM_FUNC_MOVE (1L << 2)
|
||||||
|
#define MWM_FUNC_MINIMIZE (1L << 3)
|
||||||
|
#define MWM_FUNC_MAXIMIZE (1L << 4)
|
||||||
|
#define MWM_FUNC_CLOSE (1L << 5)
|
||||||
|
|
||||||
|
/* bit definitions for MwmHints.decorations */
|
||||||
|
#define MWM_DECOR_ALL (1L << 0)
|
||||||
|
#define MWM_DECOR_BORDER (1L << 1)
|
||||||
|
#define MWM_DECOR_RESIZEH (1L << 2)
|
||||||
|
#define MWM_DECOR_TITLE (1L << 3)
|
||||||
|
#define MWM_DECOR_MENU (1L << 4)
|
||||||
|
#define MWM_DECOR_MINIMIZE (1L << 5)
|
||||||
|
#define MWM_DECOR_MAXIMIZE (1L << 6)
|
||||||
|
|
||||||
|
/* bit definitions for MwmHints.inputMode */
|
||||||
|
#define MWM_INPUT_MODELESS 0
|
||||||
|
#define MWM_INPUT_PRIMARY_APPLICATION_MODAL 1
|
||||||
|
#define MWM_INPUT_SYSTEM_MODAL 2
|
||||||
|
#define MWM_INPUT_FULL_APPLICATION_MODAL 3
|
||||||
|
|
||||||
|
#define PROP_MWM_HINTS_ELEMENTS 5
|
||||||
|
|
||||||
|
/* Motif window hints */
|
||||||
|
typedef struct _mwmhints {
|
||||||
|
CARD32 flags;
|
||||||
|
CARD32 functions;
|
||||||
|
CARD32 decorations;
|
||||||
|
INT32 input_mode;
|
||||||
|
CARD32 status;
|
||||||
|
} MWMHints;
|
||||||
|
|
||||||
|
/* DEC private modes */
|
||||||
|
# define PrivMode_132 (1LU<<0)
|
||||||
|
# define PrivMode_132OK (1LU<<1)
|
||||||
|
# define PrivMode_rVideo (1LU<<2)
|
||||||
|
# define PrivMode_relOrigin (1LU<<3)
|
||||||
|
# define PrivMode_Screen (1LU<<4)
|
||||||
|
# define PrivMode_Autowrap (1LU<<5)
|
||||||
|
# define PrivMode_aplCUR (1LU<<6)
|
||||||
|
# define PrivMode_aplKP (1LU<<7)
|
||||||
|
# define PrivMode_BackSpace (1LU<<8)
|
||||||
|
# define PrivMode_ShiftKeys (1LU<<9)
|
||||||
|
# define PrivMode_VisibleCursor (1LU<<10)
|
||||||
|
# define PrivMode_MouseX10 (1LU<<11)
|
||||||
|
# define PrivMode_MouseX11 (1LU<<12)
|
||||||
|
/* too annoying to implement X11 highlight tracking */
|
||||||
|
/* #define PrivMode_MouseX11Track (1LU<<13) */
|
||||||
|
# define PrivMode_scrollBar (1LU<<14)
|
||||||
|
# define PrivMode_menuBar (1LU<<15)
|
||||||
|
|
||||||
|
#define PrivMode_mouse_report (PrivMode_MouseX10|PrivMode_MouseX11)
|
||||||
|
#define PrivMode(test,bit) do {\
|
||||||
|
if (test) PrivateModes |= (bit); else PrivateModes &= ~(bit);} while (0)
|
||||||
|
|
||||||
|
#define PrivMode_Default (PrivMode_Autowrap|PrivMode_ShiftKeys|PrivMode_VisibleCursor)
|
||||||
|
|
||||||
|
extern char initial_dir[PATH_MAX+1];
|
||||||
|
extern unsigned long PrivateModes;
|
||||||
|
|
||||||
|
_XFUNCPROTOBEGIN
|
||||||
|
|
||||||
|
# ifdef USE_ACTIVE_TAGS
|
||||||
|
pid_t cmd_pid;
|
||||||
|
int cmd_fd;
|
||||||
|
# endif
|
||||||
|
extern void init_command(char **);
|
||||||
|
extern void tt_resize(void);
|
||||||
|
extern void tt_write(const unsigned char *, unsigned int);
|
||||||
|
extern void tt_printf(const unsigned char *, ...);
|
||||||
|
extern unsigned int cmd_write(const unsigned char *, unsigned int);
|
||||||
|
extern void main_loop(void);
|
||||||
|
extern FILE *popen_printer(void);
|
||||||
|
extern int pclose_printer(FILE *);
|
||||||
|
extern void color_aliases (int idx);
|
||||||
|
|
||||||
|
_XFUNCPROTOEND
|
||||||
|
|
||||||
|
#endif /* _COMMAND_H_ */
|
||||||
|
/*----------------------- end-of-file (C header) -----------------------*/
|
|
@ -0,0 +1,105 @@
|
||||||
|
/* debug.h for Eterm.
|
||||||
|
* 21 Feb 1998, vendu.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _DEBUG_H
|
||||||
|
# define _DEBUG_H
|
||||||
|
|
||||||
|
extern unsigned int debug_level;
|
||||||
|
|
||||||
|
/* Assert macros stolen from my work on Ebar. If these macros break with your cpp, let me know -- mej@eterm.org */
|
||||||
|
# define NOP ((void)0)
|
||||||
|
|
||||||
|
#if defined(__FILE__) && defined(__LINE__)
|
||||||
|
# define ASSERT(x) do {if (!(x)) {if (debug_level>=1) {fatal_error("ASSERT failed at %s:%d: %s", __FILE__, __LINE__, #x);} \
|
||||||
|
else {print_warning("ASSERT failed at %s:%d: %s", __FILE__, __LINE__, #x);}}} while (0);
|
||||||
|
#else
|
||||||
|
# define ASSERT(x) do {if (!(x)) {if (debug_level>=1) {fatal_error("ASSERT failed: %s", #x);} \
|
||||||
|
else {print_warning("ASSERT failed: %s", #x);}}} while (0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __FILE__
|
||||||
|
#ifdef __LINE__
|
||||||
|
#define __DEBUG() fprintf(stderr, "%s, line %d: ", __FILE__, __LINE__);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __DEBUG
|
||||||
|
#define __DEBUG() NOP
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Macros for printing debugging messages */
|
||||||
|
# if DEBUG >= 1
|
||||||
|
# ifndef DPRINTF
|
||||||
|
# define DPRINTF(x) do { if (debug_level >= 1) {__DEBUG(); real_dprintf x;} } while (0)
|
||||||
|
# endif
|
||||||
|
# define DPRINTF1(x) do { if (debug_level >= 1) {__DEBUG(); real_dprintf x;} } while (0)
|
||||||
|
# define DPRINTF2(x) do { if (debug_level >= 2) {__DEBUG(); real_dprintf x;} } while (0)
|
||||||
|
# define DPRINTF3(x) do { if (debug_level >= 3) {__DEBUG(); real_dprintf x;} } while (0)
|
||||||
|
# define DPRINTF4(x) do { if (debug_level >= 4) {__DEBUG(); real_dprintf x;} } while (0)
|
||||||
|
# define DPRINTF5(x) do { if (debug_level >= 5) {__DEBUG(); real_dprintf x;} } while (0)
|
||||||
|
# else
|
||||||
|
# ifndef DPRINTF
|
||||||
|
# define DPRINTF(x) NOP
|
||||||
|
# endif
|
||||||
|
# define DPRINTF1(x) NOP
|
||||||
|
# define DPRINTF2(x) NOP
|
||||||
|
# define DPRINTF3(x) NOP
|
||||||
|
# define DPRINTF4(x) NOP
|
||||||
|
# define DPRINTF5(x) NOP
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* Debugging macros/defines which set the debugging levels for each output type.
|
||||||
|
To change the debugging level at which something appears, change the number in
|
||||||
|
both the DEBUG_ definition and the D_ macro (if there is one). -- mej */
|
||||||
|
|
||||||
|
# define DEBUG_SCREEN 1
|
||||||
|
# define D_SCREEN(x) DPRINTF1(x)
|
||||||
|
# define DEBUG_CMD 1
|
||||||
|
# define D_CMD(x) DPRINTF1(x)
|
||||||
|
# define DEBUG_TTY 1
|
||||||
|
# define D_TTY(x) DPRINTF1(x)
|
||||||
|
# define DEBUG_SELECTION 1
|
||||||
|
# define D_SELECT(x) DPRINTF1(x)
|
||||||
|
# define DEBUG_UTMP 1
|
||||||
|
# define D_UTMP(x) DPRINTF1(x)
|
||||||
|
# define DEBUG_OPTIONS 1
|
||||||
|
# define D_OPTIONS(x) DPRINTF1(x)
|
||||||
|
# define DEBUG_IMLIB 1
|
||||||
|
# define D_IMLIB(x) DPRINTF1(x)
|
||||||
|
# define DEBUG_PIXMAP 1
|
||||||
|
# define D_PIXMAP(x) DPRINTF1(x)
|
||||||
|
# define DEBUG_EVENTS 1
|
||||||
|
# define D_EVENTS(x) DPRINTF1(x)
|
||||||
|
# define DEBUG_STRINGS 1
|
||||||
|
# define D_STRINGS(x) DPRINTF1(x)
|
||||||
|
|
||||||
|
# define DEBUG_X11 2
|
||||||
|
# define D_X11(x) DPRINTF2(x)
|
||||||
|
# define DEBUG_SCROLLBAR 2
|
||||||
|
# define D_SCROLLBAR(x) DPRINTF2(x)
|
||||||
|
# define DEBUG_THREADS 2
|
||||||
|
# define D_THREADS(x) DPRINTF2(x)
|
||||||
|
# define DEBUG_TAGS 2
|
||||||
|
# define D_TAGS(x) DPRINTF2(x)
|
||||||
|
|
||||||
|
# define DEBUG_MENU 3
|
||||||
|
# define D_MENUBAR(x) DPRINTF3(x)
|
||||||
|
# define DEBUG_TTYMODE 3
|
||||||
|
# define D_TTYMODE(x) DPRINTF3(x)
|
||||||
|
# define DEBUG_COLORS 3
|
||||||
|
# define D_COLORS(x) DPRINTF3(x)
|
||||||
|
|
||||||
|
# define DEBUG_MALLOC 4
|
||||||
|
# define D_MALLOC(x) DPRINTF4(x)
|
||||||
|
# define DEBUG_MENUARROWS 4
|
||||||
|
# define D_MENUARROWS(x) DPRINTF4(x)
|
||||||
|
# define DEBUG_MENU_LAYOUT 4
|
||||||
|
# define D_MENU_LAYOUT(x) DPRINTF4(x)
|
||||||
|
# define DEBUG_MENUBAR_STACKING 4
|
||||||
|
# define D_MENUBAR_STACKING(x) DPRINTF4(x)
|
||||||
|
|
||||||
|
# define DEBUG_X 5
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* _DEBUG_H */
|
|
@ -0,0 +1,26 @@
|
||||||
|
/* eterm_imlib.h - An include file for porting Eterm to use Imlib 1.0
|
||||||
|
* in addition to Imlib 0.x.
|
||||||
|
* Feb 15 1998, vendu
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _ETERM_IMLIB_H
|
||||||
|
# define _ETERM_IMLIB_H
|
||||||
|
|
||||||
|
# ifdef NEW_IMLIB
|
||||||
|
# include <Imlib.h>
|
||||||
|
# else if defined(OLD_IMLIB)
|
||||||
|
# include <X11/imlib.h>
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef NEW_IMLIB
|
||||||
|
# define ImColor ImlibColor
|
||||||
|
# define Image ImlibImage
|
||||||
|
# define ImlibInit(d) Imlib_init(d)
|
||||||
|
# define ImlibLoadImage(id,f,c) Imlib_load_image(id,f)
|
||||||
|
# define ImlibFreePixmap(id,p) Imlib_free_pixmap(id,p)
|
||||||
|
# define ImlibRender(id,i,w,h) Imlib_render(id,i,w,h)
|
||||||
|
# define ImlibCopyImageToPixmap(id,i) Imlib_copy_image(id,i)
|
||||||
|
# define ImlibDestroyImage(id,i) Imlib_destroy_image(id,i)
|
||||||
|
# endif
|
||||||
|
|
||||||
|
#endif /* _ETERM_IMLIB_H */
|
|
@ -0,0 +1,527 @@
|
||||||
|
/* feature.h -- Eterm feature defines header
|
||||||
|
* -- 10 Sept 1997, mej
|
||||||
|
*
|
||||||
|
* This file is original work by Michael Jennings <mej@tcserv.com> and
|
||||||
|
* Tuomo Venalainen <vendu@cc.hut.fi>. This file, and any other file
|
||||||
|
* bearing this same message or a similar one, is distributed under
|
||||||
|
* the GNU Public License (GPL) as outlined in the COPYING file.
|
||||||
|
*
|
||||||
|
* Copyright (C) 1997, Michael Jennings and Tuomo Venalainen
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _FEATURE_H_
|
||||||
|
# define _FEATURE_H_
|
||||||
|
|
||||||
|
# include <stdio.h>
|
||||||
|
# include <stdlib.h>
|
||||||
|
|
||||||
|
# include "config.h"
|
||||||
|
# include "debug.h"
|
||||||
|
|
||||||
|
/********************* Miscellaneous OS fixings *********************/
|
||||||
|
|
||||||
|
# if defined(hpux) && !defined(_HPUX_SOURCE)
|
||||||
|
# define _HPUX_SOURCE
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
# if defined(_HPUX_SOURCE) && !defined(SVR4)
|
||||||
|
# define SVR4
|
||||||
|
# endif
|
||||||
|
*/
|
||||||
|
|
||||||
|
# if defined(SVR4) && !defined(__svr4__)
|
||||||
|
# define __svr4__
|
||||||
|
# endif
|
||||||
|
# if !defined(SVR4) && defined(__svr4__)
|
||||||
|
# define SVR4
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# if defined(sun) && !defined(__sun__)
|
||||||
|
# define __sun__
|
||||||
|
# endif
|
||||||
|
# if !defined(sun) && defined(__sun__)
|
||||||
|
# define sun
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# if defined (sun)
|
||||||
|
# undef HAVE_SYS_IOCTL_H
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef _SCO_DS /* SCO Osr5 */
|
||||||
|
# define ALL_NUMERIC_PTYS /* Scos pty naming is /dev/[pt]typ0 - /dev/[pt]ty256 */
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/********************* Debugging stuff *********************/
|
||||||
|
/* As Keith Bunge would say, don't crap with the debugging stuff below
|
||||||
|
* unless you develop this mess. :^) -- mej
|
||||||
|
*/
|
||||||
|
|
||||||
|
# ifndef DEBUG
|
||||||
|
# define DEBUG 0
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/********************* Random development stuff ***************************/
|
||||||
|
/* #define PROFILE */
|
||||||
|
#ifdef PROFILE
|
||||||
|
/* #define PROFILE_SCREEN */
|
||||||
|
/* #define PROFILE_X_EVENTS */
|
||||||
|
/* #define COUNT_X_EVENTS */
|
||||||
|
#endif
|
||||||
|
/* Active tags are disabled by default until we find a bug that crashes Eterm
|
||||||
|
* on window resize :(
|
||||||
|
*/
|
||||||
|
/* #define USE_ACTIVE_TAGS */
|
||||||
|
#define OPTIMIZE_HACKS
|
||||||
|
|
||||||
|
/********************* Color, screen, and image stuff *********************/
|
||||||
|
|
||||||
|
/* Allow pixmaps in the background of the window */
|
||||||
|
# define PIXMAP_SUPPORT
|
||||||
|
|
||||||
|
/* I'm having problems with this... The call to XInitThreads() in main.c seems
|
||||||
|
* to mess threads up on my system... They run "OK" for a while without that,
|
||||||
|
* but will make Eterm hang eventually.
|
||||||
|
*/
|
||||||
|
/* #define USE_POSIX_THREADS */
|
||||||
|
/* Use mutexes for thread synchronization. */
|
||||||
|
/* #define MUTEX_SYNCH */
|
||||||
|
|
||||||
|
/* Support for pseudo-transparency and viewport mode */
|
||||||
|
# define PIXMAP_OFFSET
|
||||||
|
|
||||||
|
/* Use Imlib for pseudo-transparency, shading, etc. Still experimental at
|
||||||
|
this point. -- mej */
|
||||||
|
/* # define IMLIB_TRANS */
|
||||||
|
|
||||||
|
/* Support for background pixmap cycling */
|
||||||
|
#define BACKGROUND_CYCLING_SUPPORT
|
||||||
|
|
||||||
|
/* Pixmapped scrollbar.
|
||||||
|
*/
|
||||||
|
# define PIXMAP_SCROLLBAR
|
||||||
|
|
||||||
|
/* Pixmapped menubar.
|
||||||
|
*/
|
||||||
|
# define PIXMAP_MENUBAR
|
||||||
|
|
||||||
|
/* Enable use of backing store for the terminal window. */
|
||||||
|
# define BACKING_STORE
|
||||||
|
|
||||||
|
/* Use Rasterman's Imlib image library for image manipulation
|
||||||
|
* If you don't use Imlib, you won't be able to have background pixmaps */
|
||||||
|
# define USE_IMLIB
|
||||||
|
|
||||||
|
/* Define this to use Eterm with Imlib 0.x. Otherwise, it will use Imlib 1.0's
|
||||||
|
* API.
|
||||||
|
*/
|
||||||
|
/* #define OLD_IMLIB */
|
||||||
|
|
||||||
|
/* Define this to use Eterm with Imlib 1.x. This certainly is the Imlib you
|
||||||
|
* want to use.
|
||||||
|
*/
|
||||||
|
|
||||||
|
# if defined(USE_IMLIB) && !defined(OLD_IMLIB)
|
||||||
|
# define NEW_IMLIB
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* The environment variable in which Eterm looks for a search path for
|
||||||
|
config files and pixmaps */
|
||||||
|
# define PATH_ENV "ETERMPATH"
|
||||||
|
|
||||||
|
/* Enable support for themes. */
|
||||||
|
# define USE_THEMES
|
||||||
|
|
||||||
|
/* These are for future use. Defining them won't help anything, and it may
|
||||||
|
break stuff. */
|
||||||
|
#define USE_EFFECTS
|
||||||
|
|
||||||
|
/* Option to watch the desktop pixmap for changes. If the desktop background changes
|
||||||
|
a pseudo-transparent Eterm will find out about it and update to the new image */
|
||||||
|
#define WATCH_DESKTOP_OPTION
|
||||||
|
|
||||||
|
/* Disable support for changing the cursor color (-c and -t options) */
|
||||||
|
/* #define NO_CURSORCOLOR */
|
||||||
|
|
||||||
|
/* Disable use of high-intensity colors 8-15. They will be simulated using
|
||||||
|
the "bold" font, colorBD, or overstrike */
|
||||||
|
/* #define NO_BRIGHTCOLOR */
|
||||||
|
|
||||||
|
/* Disable separate colors for the bold and underline attributes */
|
||||||
|
/* #define NO_BOLDUNDERLINE */
|
||||||
|
|
||||||
|
/* Disable simulation of bold font using an "overstrike" technique. This technique
|
||||||
|
has been known to cause pixel droppings, and its use is not advised. See
|
||||||
|
also FORCE_CLEAR_CHARS. */
|
||||||
|
/* #define NO_BOLDOVERSTRIKE */
|
||||||
|
|
||||||
|
/* Disable the use of a separate "bold" font */
|
||||||
|
/* #define NO_BOLDFONT */
|
||||||
|
|
||||||
|
/* Disable the secondary screen ("\E[?47h" / "\E[?47l") */
|
||||||
|
/* #define NO_SECONDARY_SCREEN */
|
||||||
|
|
||||||
|
/* The number of screenfuls between refreshes.
|
||||||
|
* If you define this, it will be set to 3.
|
||||||
|
*/
|
||||||
|
/*#define REFRESH_PERIOD 3 */
|
||||||
|
# define REFRESH_PERIOD 5
|
||||||
|
|
||||||
|
/* This will force clearing of characters before writing new ones on top of
|
||||||
|
* them. This is experimental - added in order to try and fix pixel dropping
|
||||||
|
* problems some people have had. See also NO_BOLDOVERSTRIKE. */
|
||||||
|
# define FORCE_CLEAR_CHARS
|
||||||
|
|
||||||
|
/* Rob Nation's graphics escape sequences */
|
||||||
|
/* #define RXVT_GRAPHICS */
|
||||||
|
|
||||||
|
/* The command through which to pipe print-screen requests */
|
||||||
|
#define PRINTPIPE "lp"
|
||||||
|
|
||||||
|
/* If the screen can handle 24-bit graphics, force them */
|
||||||
|
/* #define PREFER_24BIT */
|
||||||
|
|
||||||
|
/* Offer some support for the Offix DND (Drag 'n' Drop) protocol (untested) */
|
||||||
|
/* #define OFFIX_DND */
|
||||||
|
|
||||||
|
/* Allows the -w and --border-width options for specifying the width of the
|
||||||
|
* border (in pixels) between the actual X client window and the program-useable
|
||||||
|
* terminal window. -- mej
|
||||||
|
*/
|
||||||
|
# define BORDER_WIDTH_OPTION
|
||||||
|
|
||||||
|
/********************* Key and key-bindings options *********************/
|
||||||
|
|
||||||
|
/* Use the X server value for the Delete key, regardless */
|
||||||
|
/* #define NO_DELETE_KEY */
|
||||||
|
|
||||||
|
/* Force the delete key to send ^? instead of ESC [ 3 ~ */
|
||||||
|
/* #define KS_DELETE "\177" */
|
||||||
|
#ifndef NO_DELETE_KEY
|
||||||
|
# define KS_DELETE "\177"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Force the Backspace key to send ^H instead of checking the stty setting */
|
||||||
|
#define FORCE_BACKSPACE
|
||||||
|
/* Force Backspace to send ^? */
|
||||||
|
/* #define FORCE_DELETE */
|
||||||
|
|
||||||
|
/* Pick the hotkey for changing the font size */
|
||||||
|
# define HOTKEY_CTRL
|
||||||
|
/* #define HOTKEY_META */
|
||||||
|
|
||||||
|
/* Use Home = "\E[1~" and End = "\E[4~" instead of Home = "\E[7~" and End = "\E[8~" */
|
||||||
|
/* #define LINUX_KEYS */
|
||||||
|
#ifdef linux
|
||||||
|
# define LINUX_KEYS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Allow the "keysym" attribute in config files for remapping keysyms */
|
||||||
|
#define KEYSYM_ATTRIBUTE
|
||||||
|
|
||||||
|
/* Disable X11R6 support for European languages */
|
||||||
|
/* #define NO_XLOCALE */
|
||||||
|
|
||||||
|
/* Allow unshifted Next and Prior keys to scroll, in addition to their shifted
|
||||||
|
* counterparts */
|
||||||
|
/* #define UNSHIFTED_SCROLLKEYS */
|
||||||
|
|
||||||
|
/********************* Mouse, scrollbar, and menu bar options *********************/
|
||||||
|
|
||||||
|
/* Disable sending escape sequences from the scrollbar when mouse reporting
|
||||||
|
* is enabled */
|
||||||
|
/* #define NO_SCROLLBAR_REPORT */
|
||||||
|
|
||||||
|
/* Set the default number of lines in the scrollback buffer */
|
||||||
|
/* #define SAVELINES 256 */
|
||||||
|
|
||||||
|
/* Set the default separator characters for double-click word selection */
|
||||||
|
#define CUTCHARS "\"&'()*,;<=>?@[\\]^`{|}~ \t"
|
||||||
|
|
||||||
|
/* Make it an option */
|
||||||
|
#define CUTCHAR_OPTION
|
||||||
|
|
||||||
|
/* To activate double-click reporting for button 1 */
|
||||||
|
/* #define MOUSE_REPORT_DOUBLECLICK */
|
||||||
|
|
||||||
|
/* The delay in milliseconds between multiple clicks */
|
||||||
|
/* #define MULTICLICK_TIME 500 */
|
||||||
|
|
||||||
|
/* Support for the old xterm-style scrollbar */
|
||||||
|
#define XTERM_SCROLLBAR
|
||||||
|
|
||||||
|
/* Support for the traditional motif-style scrollbar */
|
||||||
|
#define MOTIF_SCROLLBAR
|
||||||
|
|
||||||
|
/* Support for a NeXT-style scrollbar */
|
||||||
|
#define NEXT_SCROLLBAR
|
||||||
|
|
||||||
|
/* Default scrollbar type */
|
||||||
|
#define SCROLLBAR_DEFAULT_TYPE SCROLLBAR_MOTIF
|
||||||
|
|
||||||
|
/* Scrollbar Colors */
|
||||||
|
#define KEEP_SCROLLCOLOR
|
||||||
|
|
||||||
|
/* The default width (in pixels) of the scrollbar. Should be an even number. */
|
||||||
|
#define SB_WIDTH 10
|
||||||
|
|
||||||
|
/* Revert the scrollbar's color to the background color when the window loses focus */
|
||||||
|
#define CHANGE_SCROLLCOLOR_ON_FOCUS
|
||||||
|
|
||||||
|
/* Continuous scrolling by pressing the scrollbar arrow buttons */
|
||||||
|
#define SCROLLBAR_BUTTON_CONTINUAL_SCROLLING
|
||||||
|
|
||||||
|
/* To allow smooth refresh when the terminal window is fully unobscured.
|
||||||
|
* Didn't seem to cause a performance hit rolling a big amount of text
|
||||||
|
* on my Pentium-100 system (Linux) :)... Recommended :)
|
||||||
|
*/
|
||||||
|
#define USE_SMOOTH_REFRESH
|
||||||
|
|
||||||
|
/* Delay periods for continuous scrolling */
|
||||||
|
/* #define SCROLLBAR_INITIAL_DELAY 40 */
|
||||||
|
/* #define SCROLLBAR_CONTINUOUS_DELAY 2 */
|
||||||
|
|
||||||
|
/* The maximum number of menubars that can be stacked. 1 disabled stacking, 0
|
||||||
|
disables menubars altogether */
|
||||||
|
#define MENUBAR_MAX 8
|
||||||
|
|
||||||
|
/* An alternative placement of the menubar shadow */
|
||||||
|
/* #define MENUBAR_SHADOW_IN */
|
||||||
|
|
||||||
|
/* An alternative placement of the menu shadow */
|
||||||
|
#define MENU_SHADOW_IN
|
||||||
|
|
||||||
|
/* Allow Ctrl+Button1 in a window to raise and steal focus */
|
||||||
|
#define CTRL_CLICK_RAISE
|
||||||
|
|
||||||
|
/* Allow Ctrl+Button2 in a window to toggle the scrollbar */
|
||||||
|
#define CTRL_CLICK_SCROLLBAR
|
||||||
|
|
||||||
|
/* Allow Ctrl+Button3 in a window to toggle the menubar */
|
||||||
|
#define CTRL_CLICK_MENU
|
||||||
|
|
||||||
|
/********************* Multi-lingual support options *********************/
|
||||||
|
|
||||||
|
/* Allow option/attribute for Meta to set the 8th bit */
|
||||||
|
#define META8_OPTION
|
||||||
|
|
||||||
|
/* To include support for Greek Elot-928 and IBM-437 keyboard modes */
|
||||||
|
/* #define GREEK_SUPPORT */
|
||||||
|
|
||||||
|
/* To compile as a Kanji terminal. Executable should be renamed "Kterm". */
|
||||||
|
/* #define KANJI */
|
||||||
|
|
||||||
|
/********************* Miscellaneous options *********************/
|
||||||
|
|
||||||
|
/* To have $DISPLAY and the "\E[7n" response be IP addresses rather than FQDN's */
|
||||||
|
/* #define DISPLAY_IS_IP */
|
||||||
|
|
||||||
|
/* To have "\E[7n" reply with the display name. This is a potential security risk,
|
||||||
|
* so its use is discouraged and unsupported. */
|
||||||
|
/* #define ENABLE_DISPLAY_ANSWER */
|
||||||
|
|
||||||
|
/* To control what the Eterm detection sequence, ESC-Z, replies with */
|
||||||
|
/* #define ESCZ_ANSWER "\033[?1;2C" */
|
||||||
|
|
||||||
|
/* Comment this out to allow printing of the VT100_ANS sequence. See
|
||||||
|
* command.c. I have no idea what this is supposed to do, but disabling
|
||||||
|
* it will prevent your terminal from getting garbage when ^E (ctrl-E)
|
||||||
|
* is printed on it.
|
||||||
|
*/
|
||||||
|
#define NO_VT100_ANS
|
||||||
|
|
||||||
|
/* Checks the current value of the window title and icon name before setting them.
|
||||||
|
Can save unnecessary screen refreshes */
|
||||||
|
#define SMART_WINDOW_TITLE
|
||||||
|
|
||||||
|
/* Allow changing of the foreground and background colors with "\E]39;color^G" */
|
||||||
|
/* #define XTERM_COLOR_CHANGE */
|
||||||
|
|
||||||
|
/* Exports TERM=xterm-color instead of just TERM=xterm */
|
||||||
|
/* #define DEFINE_XTERM_COLOR */
|
||||||
|
|
||||||
|
/* Disable automatic de-iconify on bell altogether */
|
||||||
|
/* #define NO_MAPALERT */
|
||||||
|
|
||||||
|
/* Make it an option */
|
||||||
|
#define MAPALERT_OPTION
|
||||||
|
|
||||||
|
/* Enable core dumps from Eterm. Not recommended for use by anyone but developers. */
|
||||||
|
/* #define ENABLE_CORE_DUMPS */
|
||||||
|
|
||||||
|
/********************* utmp logging support *********************/
|
||||||
|
|
||||||
|
/* Enable utmp support. This has been tested and verified to work on Linux,
|
||||||
|
* FreeBSD, and HP-UX. Other operatings systems should work, but we have
|
||||||
|
* not been able to verify for sure that they do. Eterm *must* be setuid
|
||||||
|
* or setgid, usually setuid root, for this to work. Do it at your own risk.
|
||||||
|
*/
|
||||||
|
#define UTMP_SUPPORT
|
||||||
|
|
||||||
|
/* Added security for systems with saved uids and gids. If you don't define
|
||||||
|
* this, and you're not on HP-UX with _HPUX_SOURCE defined, Eterm processes
|
||||||
|
* may seem to be owned by root. But if you define this and don't have them,
|
||||||
|
* the utmp and tty stuff could break. Do some testing. DO NOT get this one
|
||||||
|
* wrong! */
|
||||||
|
/* #define HAVE_SAVED_UIDS */
|
||||||
|
|
||||||
|
/* Use getgrnam() to determine the group id of TTY_GRP_NAME, and chgrp tty
|
||||||
|
* device files to that group. This should be ok on SVR4 and Linux systems
|
||||||
|
* with group "tty" and on BSD systems with group "wheel"
|
||||||
|
*/
|
||||||
|
#define USE_GETGRNAME
|
||||||
|
#define TTY_GRP_NAME "tty"
|
||||||
|
|
||||||
|
/********************* Config file parser options *********************/
|
||||||
|
|
||||||
|
/* Allow evaluation of expressions like `echo hello` in config files. The
|
||||||
|
* security-paranoid will not want to define this, but I have replaced the
|
||||||
|
* OS system() call with a secure one that I have tested and verified, so
|
||||||
|
* child processes run in this way will not run with any privileges, active
|
||||||
|
* or attainable.
|
||||||
|
*/
|
||||||
|
#define ALLOW_BACKQUOTE_EXEC
|
||||||
|
|
||||||
|
/* This is the initial path that Eterm searches for its config file.
|
||||||
|
* By convention, this should be ".", then "~/.Eterm", then a global
|
||||||
|
* directory for all users like "/usr/local/lib/Eterm" */
|
||||||
|
#define CONFIG_SEARCH_PATH "~/.Eterm/themes:~/.Eterm:@DATADIR@/Eterm/themes:@DATADIR@/Eterm"
|
||||||
|
|
||||||
|
/* The name of the config file. "MAIN" by default. Don't change this
|
||||||
|
unless you have a darn good reason to. It's never been tested any other way. */
|
||||||
|
#define CONFIG_FILE_NAME "MAIN"
|
||||||
|
|
||||||
|
/* This causes Eterm to warn you if a config file it's about to parse was
|
||||||
|
* designed for an older version of Eterm. */
|
||||||
|
/* #define WARN_OLDER */
|
||||||
|
|
||||||
|
/********************* Anti-cl00bie protection (sigh) *********************/
|
||||||
|
/* EDITING THIS FILE BELOW THIS LINE IS UNSUPPORTED! YOU HAVE BEEN WARNED! */
|
||||||
|
|
||||||
|
#ifdef KANJI
|
||||||
|
# undef GREEK_SUPPORT
|
||||||
|
# undef XTERM_FONT_CHANGE
|
||||||
|
# undef DEFINE_XTERM_COLOR
|
||||||
|
# define KFONT0 "k14"
|
||||||
|
# define KFONT1 "jiskan16"
|
||||||
|
# define KFONT2 "jiskan18"
|
||||||
|
# define KFONT3 "jiskan24"
|
||||||
|
# define KFONT4 "jiskan26"
|
||||||
|
/* sizes matched to kanji fonts */
|
||||||
|
# define FONT0 "7x14"
|
||||||
|
# define FONT1 "8x16"
|
||||||
|
# define FONT2 "9x18"
|
||||||
|
# define FONT3 "12x24"
|
||||||
|
# define FONT4 "13x26"
|
||||||
|
#else /* KANJI */
|
||||||
|
# define FONT0 "7x14"
|
||||||
|
# define FONT1 "6x10"
|
||||||
|
# define FONT2 "6x13"
|
||||||
|
# define FONT3 "8x13"
|
||||||
|
# define FONT4 "9x15"
|
||||||
|
#endif /* KANJI */
|
||||||
|
#define FONT0_IDX 2
|
||||||
|
|
||||||
|
#ifndef PIXMAP_SUPPORT
|
||||||
|
# undef USE_IMLIB
|
||||||
|
# undef OLD_IMLIB
|
||||||
|
# undef PIXMAP_SCROLLBAR
|
||||||
|
# undef PIXMAP_MENUBAR
|
||||||
|
# undef BACKING_STORE
|
||||||
|
# undef PIXMAP_OFFSET
|
||||||
|
# undef IMLIB_TRANS
|
||||||
|
# undef PIXMAP_BUFFERING
|
||||||
|
# undef BACKGROUND_CYCLING_SUPPORT
|
||||||
|
# undef WATCH_PIXMAP_OPTION
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef PIXMAP_OFFSET
|
||||||
|
# undef WATCH_DESKTOP_OPTION
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(XTERM_SCROLLBAR) && !defined(NO_MENUBAR)
|
||||||
|
# define NO_MENUBAR
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef TTY_GRP_NAME
|
||||||
|
# undef USE_GETGRNAME
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef HAVE_MEMMOVE
|
||||||
|
inline void *memmove(void *, const void *, size_t);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define APL_NAME "Eterm" /* The name of our beloved program */
|
||||||
|
|
||||||
|
/* COLORTERM, TERM environment variables */
|
||||||
|
#ifdef KANJI
|
||||||
|
# define TERMENV "kterm"
|
||||||
|
# define COLORTERMENV "Kterm"
|
||||||
|
#else
|
||||||
|
# define TERMENV "xterm"
|
||||||
|
# define COLORTERMENV "Eterm"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef NO_MOUSE_REPORT
|
||||||
|
# ifndef NO_MOUSE_REPORT_SCROLLBAR
|
||||||
|
# define NO_MOUSE_REPORT_SCROLLBAR
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef DEFAULT_BORDER_WIDTH
|
||||||
|
# define DEFAULT_BORDER_WIDTH 5
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef SB_WIDTH
|
||||||
|
# define SB_WIDTH 10
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef KEEP_SCROLLCOLOR
|
||||||
|
# undef CHANGE_SCROLLCOLOR_ON_FOCUS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef MENUBAR_MAX
|
||||||
|
# define MENUBAR_MAX 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef SAVELINES
|
||||||
|
# define SAVELINES 256
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef NO_SECONDARY_SCREEN
|
||||||
|
# define NSCREENS 0
|
||||||
|
#else
|
||||||
|
# define NSCREENS 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef CUTCHARS
|
||||||
|
# define CUTCHARS "\"&'()*,;<=>?@[\\]^`{|}~"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined (__sun__) || defined (__svr4__)
|
||||||
|
# define NO_DELETE_KEY /* These systems seem to be anal this way*/
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* utmp doesn't work on CygWin32 */
|
||||||
|
#ifdef __CYGWIN32__
|
||||||
|
# undef UTMP_SUPPORT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _FEATURE_H_ */
|
|
@ -0,0 +1,556 @@
|
||||||
|
/*--------------------------------*-C-*---------------------------------*
|
||||||
|
* File: graphics.c
|
||||||
|
*
|
||||||
|
* This module is all new by Rob Nation
|
||||||
|
* <nation@rocket.sanders.lockheed.com>
|
||||||
|
*
|
||||||
|
* Modifications by mj olesen <olesen@me.QueensU.CA>
|
||||||
|
* and Raul Garcia Garcia <rgg@tid.es>
|
||||||
|
*----------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
static const char cvs_ident[] = "$Id$";
|
||||||
|
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
# include <unistd.h>
|
||||||
|
#endif
|
||||||
|
#include <X11/cursorfont.h>
|
||||||
|
|
||||||
|
#include "command.h" /* for tt_printf() */
|
||||||
|
#include "debug.h"
|
||||||
|
#include "graphics.h"
|
||||||
|
#include "screen.h"
|
||||||
|
|
||||||
|
/* commands:
|
||||||
|
* 'C' = Clear
|
||||||
|
* 'F' = Fill
|
||||||
|
* 'G' = Geometry
|
||||||
|
* 'L' = Line
|
||||||
|
* 'P' = Points
|
||||||
|
* 'T' = Text
|
||||||
|
* 'W' = Window
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef GRX_SCALE
|
||||||
|
# define GRX_SCALE 10000
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* extern functions referenced */
|
||||||
|
/* extern variables referenced */
|
||||||
|
/* extern variables declared here */
|
||||||
|
|
||||||
|
#ifdef RXVT_GRAPHICS
|
||||||
|
/* local variables */
|
||||||
|
static int graphics_up = 0;
|
||||||
|
|
||||||
|
typedef struct grcmd_t {
|
||||||
|
char cmd;
|
||||||
|
short color;
|
||||||
|
short ncoords;
|
||||||
|
int *coords;
|
||||||
|
unsigned char *text;
|
||||||
|
struct grcmd_t *next;
|
||||||
|
} grcmd_t;
|
||||||
|
|
||||||
|
typedef struct grwin_t {
|
||||||
|
Window win;
|
||||||
|
int x, y;
|
||||||
|
unsigned int w, h;
|
||||||
|
short screen;
|
||||||
|
grcmd_t *graphics;
|
||||||
|
struct grwin_t *prev, *next;
|
||||||
|
} grwin_t;
|
||||||
|
|
||||||
|
static grwin_t *gr_root = NULL;
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------*
|
||||||
|
* local functions
|
||||||
|
*/
|
||||||
|
/* Gr_NewWindow() */
|
||||||
|
static void
|
||||||
|
Gr_NewWindow(int nargs, int args[])
|
||||||
|
{
|
||||||
|
int x, y;
|
||||||
|
unsigned int w, h;
|
||||||
|
Window win;
|
||||||
|
grwin_t *grwin;
|
||||||
|
Cursor cursor;
|
||||||
|
|
||||||
|
if (nargs != 4) {
|
||||||
|
print_error("NewWindow: 4 args needed, got %d\n", nargs);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
x = args[0] * TermWin.width / GRX_SCALE + TermWin.internalBorder;
|
||||||
|
y = args[1] * TermWin.height / GRX_SCALE + TermWin.internalBorder;
|
||||||
|
w = args[2] * TermWin.width / GRX_SCALE;
|
||||||
|
h = args[3] * TermWin.height / GRX_SCALE;
|
||||||
|
|
||||||
|
win = XCreateSimpleWindow(Xdisplay, TermWin.vt,
|
||||||
|
x, y, w, h,
|
||||||
|
0,
|
||||||
|
PixColors[fgColor],
|
||||||
|
PixColors[bgColor]);
|
||||||
|
|
||||||
|
cursor = XCreateFontCursor(Xdisplay, XC_crosshair);
|
||||||
|
XDefineCursor(Xdisplay, win, cursor);
|
||||||
|
XMapWindow(Xdisplay, win);
|
||||||
|
XSelectInput(Xdisplay, win, ExposureMask);
|
||||||
|
|
||||||
|
grwin = (grwin_t *) MALLOC(sizeof(grwin_t));
|
||||||
|
grwin->win = win;
|
||||||
|
grwin->x = x;
|
||||||
|
grwin->y = y;
|
||||||
|
grwin->w = w;
|
||||||
|
grwin->h = h;
|
||||||
|
grwin->screen = 0;
|
||||||
|
grwin->prev = NULL;
|
||||||
|
grwin->next = gr_root;
|
||||||
|
if (grwin->next)
|
||||||
|
grwin->next->prev = grwin;
|
||||||
|
gr_root = grwin;
|
||||||
|
grwin->graphics = NULL;
|
||||||
|
graphics_up++;
|
||||||
|
|
||||||
|
tt_printf("\033W%ld\n", (long) grwin->win);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Gr_ClearWindow() */
|
||||||
|
static void
|
||||||
|
Gr_ClearWindow(grwin_t * grwin)
|
||||||
|
{
|
||||||
|
grcmd_t *cmd, *next;
|
||||||
|
|
||||||
|
for (cmd = grwin->graphics; cmd != NULL; cmd = next) {
|
||||||
|
next = cmd->next;
|
||||||
|
free(cmd->coords);
|
||||||
|
if (cmd->text != NULL)
|
||||||
|
free(cmd->text);
|
||||||
|
free(cmd);
|
||||||
|
}
|
||||||
|
grwin->graphics = NULL;
|
||||||
|
XClearWindow(Xdisplay, grwin->win);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Gr_Text() */
|
||||||
|
/*
|
||||||
|
* arg [0] = x
|
||||||
|
* arg [1] = y
|
||||||
|
* arg [2] = alignment
|
||||||
|
* arg [3] = strlen (text)
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
Gr_Text(grwin_t * grwin, grcmd_t * data)
|
||||||
|
{
|
||||||
|
int x, y, align;
|
||||||
|
|
||||||
|
if (data->ncoords < 4 || data->text == NULL || *(data->text) == '\0')
|
||||||
|
return;
|
||||||
|
|
||||||
|
x = data->coords[0] * grwin->w / GRX_SCALE;
|
||||||
|
y = data->coords[1] * grwin->h / GRX_SCALE;
|
||||||
|
align = data->coords[2];
|
||||||
|
|
||||||
|
if (align & RIGHT_TEXT)
|
||||||
|
x -= XTextWidth(TermWin.font, data->text, data->coords[3]);
|
||||||
|
else if (align & HCENTER_TEXT)
|
||||||
|
x -= (XTextWidth(TermWin.font, data->text, data->coords[3]) >> 1);
|
||||||
|
|
||||||
|
if (align & TOP_TEXT)
|
||||||
|
y += TermWin.font->ascent;
|
||||||
|
else if (align & BOTTOM_TEXT)
|
||||||
|
y -= TermWin.font->descent;
|
||||||
|
|
||||||
|
if (align & VCENTER_TEXT)
|
||||||
|
y -= TermWin.font->descent + ((TermWin.font->ascent + TermWin.font->descent) >> 1);
|
||||||
|
if (align & VCAPS_CENTER_TEXT)
|
||||||
|
y += (TermWin.font->ascent >> 1);
|
||||||
|
|
||||||
|
# ifdef PIXMAP_SUPPORT
|
||||||
|
XClearArea(Xdisplay, grwin->win,
|
||||||
|
x, y,
|
||||||
|
Width2Pixel(data->coords[3]),
|
||||||
|
Height2Pixel(1),
|
||||||
|
0);
|
||||||
|
# endif
|
||||||
|
XDrawString(Xdisplay, grwin->win, TermWin.gc,
|
||||||
|
x, y,
|
||||||
|
data->text, data->coords[3]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Gr_Geometry() */
|
||||||
|
static void
|
||||||
|
Gr_Geometry(grwin_t * grwin, grcmd_t * data)
|
||||||
|
{
|
||||||
|
if (grwin)
|
||||||
|
tt_printf("\033G%ld %d %d %u %u %d %d %ld %ld %d\n",
|
||||||
|
(long) grwin->win,
|
||||||
|
grwin->x, grwin->y, grwin->w, grwin->h,
|
||||||
|
TermWin.fwidth,
|
||||||
|
TermWin.fheight,
|
||||||
|
(long) GRX_SCALE * TermWin.fwidth / grwin->w,
|
||||||
|
(long) GRX_SCALE * TermWin.fheight / grwin->h,
|
||||||
|
Xdepth);
|
||||||
|
else /* rxvt terminal window size */
|
||||||
|
tt_printf("\033G0 0 0 %d %d %d %d %ld %ld %d\n",
|
||||||
|
TermWin.width - 2 * TermWin.internalBorder,
|
||||||
|
TermWin.height - 2 * TermWin.internalBorder,
|
||||||
|
TermWin.fwidth,
|
||||||
|
TermWin.fheight,
|
||||||
|
(long) GRX_SCALE * TermWin.fwidth / (TermWin.width - 2 * TermWin.internalBorder),
|
||||||
|
(long) GRX_SCALE * TermWin.fheight / (TermWin.height - 2 * TermWin.internalBorder),
|
||||||
|
Xdepth);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Gr_DestroyWindow() */
|
||||||
|
static void
|
||||||
|
Gr_DestroyWindow(grwin_t * grwin)
|
||||||
|
{
|
||||||
|
grcmd_t *cmd, *next;
|
||||||
|
|
||||||
|
if (grwin == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (cmd = grwin->graphics; cmd; cmd = next) {
|
||||||
|
next = cmd->next;
|
||||||
|
free(cmd->coords);
|
||||||
|
if (cmd->text != NULL)
|
||||||
|
free(cmd->text);
|
||||||
|
free(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
XDestroyWindow(Xdisplay, grwin->win);
|
||||||
|
if (grwin->next != NULL)
|
||||||
|
grwin->next->prev = grwin->prev;
|
||||||
|
if (grwin->prev != NULL)
|
||||||
|
grwin->prev->next = grwin->next;
|
||||||
|
else
|
||||||
|
gr_root = grwin->next;
|
||||||
|
free(grwin);
|
||||||
|
|
||||||
|
graphics_up--;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Gr_Dispatch() */
|
||||||
|
static void
|
||||||
|
Gr_Dispatch(grwin_t * grwin, grcmd_t * data)
|
||||||
|
{
|
||||||
|
int i, n;
|
||||||
|
union {
|
||||||
|
XPoint pt[NGRX_PTS / 2];
|
||||||
|
XRectangle rect[NGRX_PTS / 4];
|
||||||
|
} xdata;
|
||||||
|
|
||||||
|
if (data->color != fgColor) {
|
||||||
|
XGCValues gcv;
|
||||||
|
|
||||||
|
gcv.foreground = PixColors[data->color];
|
||||||
|
XChangeGC(Xdisplay, TermWin.gc, GCForeground, &gcv);
|
||||||
|
}
|
||||||
|
if (grwin)
|
||||||
|
switch (data->cmd) {
|
||||||
|
case 'L':
|
||||||
|
if (data->ncoords > 3) {
|
||||||
|
for (n = i = 0; i < data->ncoords; i += 2, n++) {
|
||||||
|
xdata.pt[n].x = data->coords[i] * grwin->w / GRX_SCALE;
|
||||||
|
xdata.pt[n].y = data->coords[i + 1] * grwin->h / GRX_SCALE;
|
||||||
|
}
|
||||||
|
XDrawLines(Xdisplay,
|
||||||
|
grwin->win, TermWin.gc, xdata.pt, n, CoordModeOrigin);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'P':
|
||||||
|
if (data->ncoords > 3) {
|
||||||
|
for (n = i = 0; i < data->ncoords; i += 2, n++) {
|
||||||
|
xdata.pt[n].x = data->coords[i] * grwin->w / GRX_SCALE;
|
||||||
|
xdata.pt[n].y = data->coords[i + 1] * grwin->h / GRX_SCALE;
|
||||||
|
}
|
||||||
|
XDrawPoints(Xdisplay,
|
||||||
|
grwin->win, TermWin.gc, xdata.pt, n, CoordModeOrigin);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'F':
|
||||||
|
if (data->ncoords > 0) {
|
||||||
|
for (n = i = 0; i < data->ncoords; i += 4, n++) {
|
||||||
|
xdata.rect[n].x = data->coords[i] * grwin->w / GRX_SCALE;
|
||||||
|
xdata.rect[n].y = data->coords[i + 1] * grwin->h / GRX_SCALE;
|
||||||
|
xdata.rect[n].width = ((data->coords[i + 2]
|
||||||
|
- data->coords[i] + 1) *
|
||||||
|
grwin->w / GRX_SCALE);
|
||||||
|
xdata.rect[n].height = ((data->coords[i + 3]
|
||||||
|
- data->coords[i + 1] + 1) *
|
||||||
|
grwin->h / GRX_SCALE);
|
||||||
|
|
||||||
|
# ifdef PIXMAP_SUPPORT
|
||||||
|
XClearArea(Xdisplay, grwin->win,
|
||||||
|
xdata.rect[n].x,
|
||||||
|
xdata.rect[n].y,
|
||||||
|
xdata.rect[n].width,
|
||||||
|
xdata.rect[n].height,
|
||||||
|
0);
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
XFillRectangles(Xdisplay, grwin->win, TermWin.gc, xdata.rect, n);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'T':
|
||||||
|
Gr_Text(grwin, data);
|
||||||
|
break;
|
||||||
|
case 'C':
|
||||||
|
Gr_ClearWindow(grwin);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (data->color != fgColor) {
|
||||||
|
XGCValues gcv;
|
||||||
|
|
||||||
|
gcv.foreground = PixColors[fgColor];
|
||||||
|
XChangeGC(Xdisplay, TermWin.gc, GCForeground, &gcv);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Gr_Redraw() */
|
||||||
|
static void
|
||||||
|
Gr_Redraw(grwin_t * grwin)
|
||||||
|
{
|
||||||
|
grcmd_t *cmd;
|
||||||
|
|
||||||
|
for (cmd = grwin->graphics; cmd != NULL; cmd = cmd->next)
|
||||||
|
Gr_Dispatch(grwin, cmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
/*----------------------------------------------------------------------*
|
||||||
|
* end of static functions
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef RXVT_GRAPHICS
|
||||||
|
void
|
||||||
|
Gr_ButtonReport(int but, int x, int y)
|
||||||
|
{
|
||||||
|
grwin_t *grwin;
|
||||||
|
|
||||||
|
for (grwin = gr_root; grwin != NULL; grwin = grwin->next)
|
||||||
|
if ((x > grwin->x) &&
|
||||||
|
(y > grwin->y) &&
|
||||||
|
(x < grwin->x + grwin->w) &&
|
||||||
|
(y < grwin->y + grwin->h))
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (grwin == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
x = GRX_SCALE * (x - grwin->x) / grwin->w;
|
||||||
|
y = GRX_SCALE * (y - grwin->y) / grwin->h;
|
||||||
|
tt_printf("\033%c%ld;%d;%d;\n", but, (long) grwin->win, x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Gr_do_graphics() */
|
||||||
|
void
|
||||||
|
Gr_do_graphics(int cmd, int nargs, int args[], unsigned char *text)
|
||||||
|
{
|
||||||
|
static Window last_id = None;
|
||||||
|
long win_id;
|
||||||
|
grwin_t *grwin;
|
||||||
|
grcmd_t *newcmd, *oldcmd;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (cmd == 'W') {
|
||||||
|
Gr_NewWindow(nargs, args);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
win_id = (nargs > 0) ? (Window) args[0] : None;
|
||||||
|
|
||||||
|
if ((cmd == 'G') && (win_id == None)) {
|
||||||
|
Gr_Geometry(NULL, NULL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ((win_id == None) && (last_id != None))
|
||||||
|
win_id = last_id;
|
||||||
|
|
||||||
|
if (win_id == None)
|
||||||
|
return;
|
||||||
|
|
||||||
|
grwin = gr_root;
|
||||||
|
while ((grwin != NULL) && (grwin->win != win_id))
|
||||||
|
grwin = grwin->next;
|
||||||
|
|
||||||
|
if (grwin == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (cmd == 'G') {
|
||||||
|
Gr_Geometry(grwin, NULL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
nargs--;
|
||||||
|
args++; /* skip over window id */
|
||||||
|
|
||||||
|
/* record this new command */
|
||||||
|
newcmd = (grcmd_t *) MALLOC(sizeof(grcmd_t));
|
||||||
|
newcmd->ncoords = nargs;
|
||||||
|
newcmd->coords = (int *) MALLOC((newcmd->ncoords * sizeof(int)));
|
||||||
|
|
||||||
|
newcmd->next = NULL;
|
||||||
|
newcmd->cmd = cmd;
|
||||||
|
newcmd->color = scr_get_fgcolor();
|
||||||
|
newcmd->text = text;
|
||||||
|
|
||||||
|
for (i = 0; i < newcmd->ncoords; i++)
|
||||||
|
newcmd->coords[i] = args[i];
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If newcmd == fill, and rectangle is full window, drop all prior
|
||||||
|
* commands.
|
||||||
|
*/
|
||||||
|
if ((newcmd->cmd == 'F') && (grwin) && (grwin->graphics)) {
|
||||||
|
for (i = 0; i < newcmd->ncoords; i += 4) {
|
||||||
|
if ((newcmd->coords[i] == 0) &&
|
||||||
|
(newcmd->coords[i + 1] == 0) &&
|
||||||
|
(newcmd->coords[i + 2] == GRX_SCALE) &&
|
||||||
|
(newcmd->coords[i + 3] == GRX_SCALE)) {
|
||||||
|
/* drop previous commands */
|
||||||
|
oldcmd = grwin->graphics;
|
||||||
|
while (oldcmd->next != NULL) {
|
||||||
|
grcmd_t *tmp = oldcmd;
|
||||||
|
|
||||||
|
oldcmd = oldcmd->next;
|
||||||
|
free(tmp);
|
||||||
|
}
|
||||||
|
grwin->graphics = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* insert new command into command list */
|
||||||
|
oldcmd = grwin->graphics;
|
||||||
|
if (oldcmd == NULL)
|
||||||
|
grwin->graphics = newcmd;
|
||||||
|
else {
|
||||||
|
while (oldcmd->next != NULL)
|
||||||
|
oldcmd = oldcmd->next;
|
||||||
|
oldcmd->next = newcmd;
|
||||||
|
}
|
||||||
|
Gr_Dispatch(grwin, newcmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Gr_scroll() */
|
||||||
|
void
|
||||||
|
Gr_scroll(int count)
|
||||||
|
{
|
||||||
|
static short prev_start = 0;
|
||||||
|
grwin_t *grwin, *next;
|
||||||
|
|
||||||
|
if ((count == 0) && (prev_start == TermWin.view_start))
|
||||||
|
return;
|
||||||
|
|
||||||
|
prev_start = TermWin.view_start;
|
||||||
|
|
||||||
|
for (grwin = gr_root; grwin != NULL; grwin = next) {
|
||||||
|
next = grwin->next;
|
||||||
|
grwin->y -= (count * TermWin.fheight);
|
||||||
|
# ifdef USE_ACTIVE_TAGS
|
||||||
|
fprintf(stderr, "FUCK YOU!\n");
|
||||||
|
if (grwin == TermWin.vt)
|
||||||
|
tag_hide();
|
||||||
|
# endif
|
||||||
|
if ((grwin->y + grwin->h) < -(TermWin.saveLines * TermWin.fheight))
|
||||||
|
Gr_DestroyWindow(grwin);
|
||||||
|
else
|
||||||
|
XMoveWindow(Xdisplay, grwin->win,
|
||||||
|
grwin->x,
|
||||||
|
grwin->y + (TermWin.view_start * TermWin.fheight));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Gr_ClearScreen() */
|
||||||
|
void
|
||||||
|
Gr_ClearScreen(void)
|
||||||
|
{
|
||||||
|
grwin_t *grwin, *next;
|
||||||
|
|
||||||
|
for (grwin = gr_root; grwin != NULL; grwin = next) {
|
||||||
|
next = grwin->next;
|
||||||
|
if ((grwin->screen == 0) && (grwin->y + grwin->h > 0)) {
|
||||||
|
if (grwin->y >= 0)
|
||||||
|
Gr_DestroyWindow(grwin);
|
||||||
|
else
|
||||||
|
XResizeWindow(Xdisplay, grwin->win,
|
||||||
|
grwin->w, -grwin->y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Gr_ChangeScreen() */
|
||||||
|
void
|
||||||
|
Gr_ChangeScreen(void)
|
||||||
|
{
|
||||||
|
grwin_t *grwin, *next;
|
||||||
|
|
||||||
|
for (grwin = gr_root; grwin != NULL; grwin = next) {
|
||||||
|
next = grwin->next;
|
||||||
|
if (grwin->y + grwin->h > 0) {
|
||||||
|
if (grwin->screen == 1) {
|
||||||
|
XMapWindow(Xdisplay, grwin->win);
|
||||||
|
grwin->screen = 0;
|
||||||
|
} else {
|
||||||
|
XUnmapWindow(Xdisplay, grwin->win);
|
||||||
|
grwin->screen = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Gr_expose() */
|
||||||
|
void
|
||||||
|
Gr_expose(Window win)
|
||||||
|
{
|
||||||
|
grwin_t *grwin;
|
||||||
|
|
||||||
|
for (grwin = gr_root; grwin != NULL; grwin = grwin->next) {
|
||||||
|
if (grwin->win == win) {
|
||||||
|
Gr_Redraw(grwin);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Gr_Resize() */
|
||||||
|
void
|
||||||
|
Gr_Resize(int w, int h)
|
||||||
|
{
|
||||||
|
grwin_t *grwin;
|
||||||
|
|
||||||
|
for (grwin = gr_root; grwin != NULL; grwin = grwin->next) {
|
||||||
|
if (TermWin.height != h) {
|
||||||
|
grwin->y += (TermWin.height - h);
|
||||||
|
XMoveWindow(Xdisplay, grwin->win,
|
||||||
|
grwin->x,
|
||||||
|
grwin->y + (TermWin.view_start * TermWin.fheight));
|
||||||
|
}
|
||||||
|
Gr_Redraw(grwin);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Gr_reset() */
|
||||||
|
void
|
||||||
|
Gr_reset(void)
|
||||||
|
{
|
||||||
|
grwin_t *grwin, *next;
|
||||||
|
|
||||||
|
for (grwin = gr_root; grwin != NULL; grwin = next) {
|
||||||
|
next = grwin->next;
|
||||||
|
Gr_DestroyWindow(grwin);
|
||||||
|
}
|
||||||
|
|
||||||
|
graphics_up = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Gr_Displayed() */
|
||||||
|
int
|
||||||
|
Gr_Displayed(void)
|
||||||
|
{
|
||||||
|
return graphics_up;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* RXVT_GRAPHICS */
|
||||||
|
/*----------------------- end-of-file (C source) -----------------------*/
|
|
@ -0,0 +1,63 @@
|
||||||
|
/*--------------------------------*-C-*---------------------------------*
|
||||||
|
* File: graphics.h
|
||||||
|
*
|
||||||
|
*----------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef _GRAPHICS_H_
|
||||||
|
# define _GRAPHICS_H_
|
||||||
|
# include <X11/Xfuncproto.h>
|
||||||
|
|
||||||
|
# include "grx.h" /* text alignment */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* number of graphics points
|
||||||
|
* divisible by 2 (num lines)
|
||||||
|
* divisible by 4 (num rect)
|
||||||
|
*/
|
||||||
|
# define NGRX_PTS 1000
|
||||||
|
|
||||||
|
_XFUNCPROTOBEGIN
|
||||||
|
|
||||||
|
extern void Gr_ButtonReport(int, int, int);
|
||||||
|
|
||||||
|
extern void Gr_do_graphics (int /* cmd */,
|
||||||
|
int /* nargs */,
|
||||||
|
int /* args */[],
|
||||||
|
unsigned char * /* text */);
|
||||||
|
|
||||||
|
extern void Gr_scroll (int /* count */);
|
||||||
|
|
||||||
|
extern void Gr_ClearScreen (void);
|
||||||
|
|
||||||
|
extern void Gr_ChangeScreen (void);
|
||||||
|
|
||||||
|
extern void Gr_expose (Window /* win */);
|
||||||
|
|
||||||
|
extern void Gr_Resize (int /* w */,
|
||||||
|
int /* h */);
|
||||||
|
|
||||||
|
extern void Gr_reset (void);
|
||||||
|
|
||||||
|
extern int Gr_Displayed (void);
|
||||||
|
|
||||||
|
_XFUNCPROTOEND
|
||||||
|
|
||||||
|
# ifdef RXVT_GRAPHICS
|
||||||
|
# define Gr_ButtonPress(x,y) Gr_ButtonReport ('P',(x),(y))
|
||||||
|
# define Gr_ButtonRelease(x,y) Gr_ButtonReport ('R',(x),(y))
|
||||||
|
# define GR_DISPLAY(x) if (Gr_Displayed()) (x)
|
||||||
|
# define GR_NO_DISPLAY(x) if (!Gr_Displayed()) (x)
|
||||||
|
# else
|
||||||
|
# define Gr_ButtonPress(x,y) ((void)0)
|
||||||
|
# define Gr_ButtonRelease(x,y) ((void)0)
|
||||||
|
# define Gr_scroll(count) ((void)0)
|
||||||
|
# define Gr_ClearScreen() ((void)0)
|
||||||
|
# define Gr_ChangeScreen() ((void)0)
|
||||||
|
# define Gr_expose(win) ((void)0)
|
||||||
|
# define Gr_Resize(w,h) ((void)0)
|
||||||
|
# define Gr_reset() ((void)0)
|
||||||
|
# define GR_DISPLAY(x)
|
||||||
|
# define GR_NO_DISPLAY(x) (x)
|
||||||
|
# endif
|
||||||
|
#endif /* whole file */
|
||||||
|
/*----------------------- end-of-file (C header) -----------------------*/
|
|
@ -0,0 +1,2 @@
|
||||||
|
Makefile
|
||||||
|
Makefile.in
|
|
@ -0,0 +1,11 @@
|
||||||
|
# $Id$
|
||||||
|
|
||||||
|
bin_PROGRAMS = qplot
|
||||||
|
|
||||||
|
qplot_SOURCES = grxlib.c qplot.c
|
||||||
|
|
||||||
|
INCLUDES = -I. -I.. -I$(includedir) -I$(prefix)/include
|
||||||
|
|
||||||
|
LDADD = -L. -L.. -L$(libdir) -L$(prefix)/lib
|
||||||
|
|
||||||
|
install-exec-hook:
|
|
@ -0,0 +1 @@
|
||||||
|
This is an example of rxvt graphics.
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,169 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
static const char cvs_ident[] = "$Id$";
|
||||||
|
|
||||||
|
#ifdef _AIX
|
||||||
|
# include <termio.h>
|
||||||
|
#else
|
||||||
|
# include <termios.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "grxlib.h"
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
void Done (void) { putchar (':'); }
|
||||||
|
void StartLine (long id) { printf ("\033GL%ld", id); }
|
||||||
|
void StartPoint (long id) { printf ("\033GP%ld", id); }
|
||||||
|
void StartFill (long id) { printf ("\033GF%ld", id); }
|
||||||
|
void Extend (int x, int y) { printf (";%d;%d", x, y); }
|
||||||
|
void FillArea (int x1, int y1, int x2, int y2)
|
||||||
|
{
|
||||||
|
printf (";%d;%d;%d;%d", x1, y1, x2, y2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlaceText (long id, int x, int y, int mode, char *text)
|
||||||
|
{
|
||||||
|
printf ("\033GT%ld;%d;%d;%d;%d:%s", id, x, y, mode, strlen(text), text);
|
||||||
|
fflush (stdout);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ClearWindow (long id) { printf ("\033GC%ld:", id); }
|
||||||
|
void ForeColor (int col) { printf ("\033[3%dm", (col<0||col>7)?0:col); }
|
||||||
|
void DefaultRendition (void) { printf ("\033[m"); }
|
||||||
|
|
||||||
|
#define LINESZ 100
|
||||||
|
static char line [LINESZ];
|
||||||
|
static FILE *infd = NULL;
|
||||||
|
|
||||||
|
long
|
||||||
|
CreateWin (int x, int y, int w, int h)
|
||||||
|
{
|
||||||
|
long id = 0;
|
||||||
|
|
||||||
|
fflush (stdout);
|
||||||
|
printf ("\033GW%d;%d;%d;%d:", x, y, w, h);
|
||||||
|
fflush (stdout);
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
if ((fgets (line, LINESZ, infd) != NULL) &&
|
||||||
|
(sscanf (line,"\033W%ld", &id) == 1))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
QueryWin (long id, int *nfwidth, int *nfheight)
|
||||||
|
{
|
||||||
|
int id1, x, y, width, height, fwidth, fheight;
|
||||||
|
printf ("\033GG%ld:",id);
|
||||||
|
fflush (stdout);
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
if ((fgets (line, sizeof(line), infd) != NULL) &&
|
||||||
|
(sscanf (line,"\033G%ld %ld %ld %ld %ld %ld %ld %ld %ld",
|
||||||
|
&id1, &x, &y, &width, &height,
|
||||||
|
&fwidth, &fheight, nfwidth, nfheight) != 0))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
WaitForCarriageReturn (long *win, int *x, int *y)
|
||||||
|
{
|
||||||
|
int i, len;
|
||||||
|
|
||||||
|
fgets (line, LINESZ, infd);
|
||||||
|
line [LINESZ-1] = 0;
|
||||||
|
len = strlen (line);
|
||||||
|
for (i = 0; i < len; i++)
|
||||||
|
{
|
||||||
|
if (line [i] == '\033')
|
||||||
|
{
|
||||||
|
int ret = 1;
|
||||||
|
i++;
|
||||||
|
switch (line[i]) {
|
||||||
|
case 'R': ret++;
|
||||||
|
/* drop */
|
||||||
|
case 'P':
|
||||||
|
sscanf (&line[i+1],"%ld;%d;%d", win, x, y);
|
||||||
|
return ret;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int fno2;
|
||||||
|
static struct termios ttmode;
|
||||||
|
|
||||||
|
int
|
||||||
|
InitializeGraphics (int scroll_text_up)
|
||||||
|
{
|
||||||
|
int fno, i;
|
||||||
|
char *screen_tty;
|
||||||
|
struct winsize winsize;
|
||||||
|
|
||||||
|
fno = fileno (stdout);
|
||||||
|
if (!isatty (fno))
|
||||||
|
{
|
||||||
|
fprintf (stderr, "stdout must be a tty\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
screen_tty = ttyname (fno);
|
||||||
|
ioctl (fno, TCGETS, (char *)&ttmode);
|
||||||
|
ttmode.c_lflag &= ~ECHO;
|
||||||
|
ioctl (fno, TCSETS, (char *)&ttmode);
|
||||||
|
|
||||||
|
infd = fopen (screen_tty, "rw");
|
||||||
|
|
||||||
|
fno2 = fileno (infd);
|
||||||
|
ioctl (fno2, TCGETS, (char *)&ttmode);
|
||||||
|
ttmode.c_lflag &= ~ECHO;
|
||||||
|
ioctl (fno2, TCSETS, (char *)&ttmode);
|
||||||
|
|
||||||
|
/* query rxvt to find if graphics are available */
|
||||||
|
fflush (stdout);
|
||||||
|
printf ("\033GQ");
|
||||||
|
fflush (stdout);
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
if ((fgets (line, LINESZ, infd) != NULL) &&
|
||||||
|
(sscanf (line,"\033G%d", &i) == 1))
|
||||||
|
{
|
||||||
|
if (!i)
|
||||||
|
{
|
||||||
|
fprintf (stderr, "rxvt graphics not available\n");
|
||||||
|
CloseGraphics ();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (scroll_text_up)
|
||||||
|
{
|
||||||
|
ioctl (fno, TIOCGWINSZ, &winsize);
|
||||||
|
fflush (stdout);
|
||||||
|
for (i = 0; i < winsize.ws_row; i++)
|
||||||
|
putchar ('\n');
|
||||||
|
fflush (stdout);
|
||||||
|
}
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CloseGraphics (void)
|
||||||
|
{
|
||||||
|
DefaultRendition ();
|
||||||
|
fflush (stdout);
|
||||||
|
ttmode.c_lflag |= ECHO;
|
||||||
|
ioctl (fno2, TCSETS, (char *)&ttmode);
|
||||||
|
fclose (infd);
|
||||||
|
}
|
||||||
|
/*----------------------- end-of-file (C source) -----------------------*/
|
|
@ -0,0 +1,28 @@
|
||||||
|
#include "../grx.h" /* text alignment */
|
||||||
|
|
||||||
|
/*function pointer to either StartLine or StartPoint */
|
||||||
|
typedef void (*LineFunction) (long id);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
extern void StartLine (long id);
|
||||||
|
extern void StartPoint (long id);
|
||||||
|
extern void Extend (int x, int y);
|
||||||
|
extern void StartFill (long id);
|
||||||
|
extern void FillArea (int x1, int y1, int x2, int y2);
|
||||||
|
extern void Done (void);
|
||||||
|
extern void PlaceText (long id, int x, int y, int mode, char *text);
|
||||||
|
|
||||||
|
extern void ClearWindow (long id);
|
||||||
|
extern long CreateWin (int x, int y, int w, int h);
|
||||||
|
extern void QueryWin (long id, int *nfwidth, int *nfheight);
|
||||||
|
extern void ForeColor (int color);
|
||||||
|
extern void DefaultRendition (void);
|
||||||
|
extern int WaitForCarriageReturn (long *win, int *x, int *y);
|
||||||
|
extern int InitializeGraphics (int scroll_text_up);
|
||||||
|
extern void CloseGraphics (void);
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
/*----------------------- end-of-file (C header) -----------------------*/
|
|
@ -0,0 +1,257 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <math.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include "grxlib.h"
|
||||||
|
|
||||||
|
static const char cvs_ident[] = "$Id$";
|
||||||
|
|
||||||
|
#define Real float
|
||||||
|
|
||||||
|
#ifndef GRX_SCALE
|
||||||
|
# define GRX_SCALE 10000
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define DEFAULT_DATA_FILE "data"
|
||||||
|
|
||||||
|
static void
|
||||||
|
axis_round (Real *min, Real *max, Real *grid_spacing)
|
||||||
|
{
|
||||||
|
int logspace;
|
||||||
|
|
||||||
|
logspace = (int)(log10 ((*max - *min)/10.0) + 0.5);
|
||||||
|
*grid_spacing = pow (10, (double)logspace);
|
||||||
|
*min = (Real)((int)(*min / (*grid_spacing))) * (*grid_spacing);
|
||||||
|
*max = (Real)((int)(*max / (*grid_spacing))+1) * (*grid_spacing);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
nice_end (int junk)
|
||||||
|
{
|
||||||
|
CloseGraphics ();
|
||||||
|
putchar ('\n');
|
||||||
|
exit (EXIT_SUCCESS);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main (int argc, char **argv)
|
||||||
|
{
|
||||||
|
char line[256], *file = NULL;
|
||||||
|
long id,winclick;
|
||||||
|
int Do_Start = 1,tmp;
|
||||||
|
Real x[1000000], y[1000000];
|
||||||
|
Real nls[1000];
|
||||||
|
int m, p, i, j, n, nchars, theight, twidth, xclick, yclick;
|
||||||
|
int downx = 1000,downy = 1000,upx,upy;
|
||||||
|
Real xmax, xmin, ymax, ymin, xdiff, ydiff, xgrid_spacing, ygrid_spacing;
|
||||||
|
FILE *fd;
|
||||||
|
char axis[100];
|
||||||
|
|
||||||
|
LineFunction linetype = StartLine;
|
||||||
|
|
||||||
|
ymax = xmax = -HUGE_VAL;
|
||||||
|
ymin = xmin = HUGE_VAL;
|
||||||
|
|
||||||
|
for (i = 1; i < argc; i++)
|
||||||
|
{
|
||||||
|
if (*argv[i] == '-')
|
||||||
|
{
|
||||||
|
if (!strcmp (argv[i], "-nl"))
|
||||||
|
linetype = StartPoint;
|
||||||
|
else if (argv[i][1] == '\0') /* use stdin */
|
||||||
|
file = argv [i];
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
fprintf(stderr,
|
||||||
|
"Usage:\n\t %s [options] [file]\n\n", argv[0]);
|
||||||
|
fprintf(stderr,
|
||||||
|
"where options include:\n"
|
||||||
|
" -pt plot with points instead of lines\n\n");
|
||||||
|
|
||||||
|
fprintf(stderr,
|
||||||
|
"file name `-' specifies stdin\n"
|
||||||
|
"if no file name is specified, "
|
||||||
|
"the default is \"%s\"\n\n",
|
||||||
|
DEFAULT_DATA_FILE);
|
||||||
|
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
file = argv [i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!strcmp (file, "-"))
|
||||||
|
{
|
||||||
|
fd = stdin;
|
||||||
|
file = "stdin";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (file == NULL) file = DEFAULT_DATA_FILE;
|
||||||
|
|
||||||
|
if ((fd = fopen (file, "r")) == NULL)
|
||||||
|
{
|
||||||
|
fprintf (stderr, "%s: can't open file \"%s\"\n", argv[0], file);
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m = 0;
|
||||||
|
p = 0;
|
||||||
|
while (fgets(line, sizeof(line),fd) != NULL)
|
||||||
|
{
|
||||||
|
if (sscanf(line,"%f %f",&x[m], &y[m]) == 2)
|
||||||
|
{
|
||||||
|
if (x[m] > xmax) xmax = x[m]; else if (x[m] < xmin) xmin = x[m];
|
||||||
|
if (y[m] > ymax) ymax = y[m]; else if (y[m] < ymin) ymin = y[m];
|
||||||
|
m++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nls [p] = m;
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
nls [p++] = m;
|
||||||
|
|
||||||
|
if (m == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
signal (SIGTERM, nice_end);
|
||||||
|
signal (SIGSTOP, nice_end);
|
||||||
|
signal (SIGTSTP, nice_end);
|
||||||
|
signal (SIGINT, nice_end);
|
||||||
|
signal (SIGQUIT, nice_end);
|
||||||
|
if (!InitializeGraphics (1))
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
|
||||||
|
n = 1;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
axis_round (&xmin, &xmax, &xgrid_spacing);
|
||||||
|
axis_round (&ymin, &ymax, &ygrid_spacing);
|
||||||
|
|
||||||
|
id = CreateWin (0, 0, GRX_SCALE, GRX_SCALE);
|
||||||
|
if (id == 0)
|
||||||
|
{
|
||||||
|
fprintf (stderr,"Help id = 0\n");
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
/* Fill the window in black for real eye-catching graphics! */
|
||||||
|
ForeColor (0);
|
||||||
|
StartFill (id);
|
||||||
|
FillArea (0, 0, GRX_SCALE, GRX_SCALE);
|
||||||
|
Done ();
|
||||||
|
|
||||||
|
/* draw outline box in white */
|
||||||
|
ForeColor (7);
|
||||||
|
|
||||||
|
/* Draw outline box */
|
||||||
|
StartLine(id);
|
||||||
|
Extend (1000, 1000);
|
||||||
|
Extend (1000, 9000);
|
||||||
|
Extend (9000, 9000);
|
||||||
|
Extend (9000, 1000);
|
||||||
|
Extend (1000, 1000);
|
||||||
|
Done();
|
||||||
|
|
||||||
|
/* Draw the data - either lines or dots */
|
||||||
|
xdiff = 8000 / (xmax-xmin);
|
||||||
|
ydiff = 8000 / (ymax-ymin);
|
||||||
|
|
||||||
|
for (i = j = 0; j < p; j++)
|
||||||
|
{
|
||||||
|
int n = 0;
|
||||||
|
|
||||||
|
ForeColor (j%6+1);
|
||||||
|
while (((x[i] < xmin) || (x[i] > xmax) ||
|
||||||
|
(y[i] < ymin) || (y[i] > ymax)) && (i < nls [j]))
|
||||||
|
i++;
|
||||||
|
|
||||||
|
while (i < nls [j])
|
||||||
|
{
|
||||||
|
if (n == 0)
|
||||||
|
linetype (id);
|
||||||
|
Extend (1000+(x[i]-xmin)*xdiff,9000-(y[i]-ymin)*ydiff);
|
||||||
|
n++;
|
||||||
|
if (n > 450)
|
||||||
|
{
|
||||||
|
Done ();
|
||||||
|
n = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
while ((i < nls [j]) &&
|
||||||
|
((x [i] < xmin) || (x [i] > xmax) ||
|
||||||
|
(y [i] < ymin) || (y [i] > ymax)))
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
if (n > 0)
|
||||||
|
Done ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Do axis labels in black */
|
||||||
|
ForeColor (7);
|
||||||
|
QueryWin (id, &twidth,&theight);
|
||||||
|
PlaceText (id, GRX_SCALE/2, 0, HCENTER_TEXT|TOP_TEXT, file);
|
||||||
|
PlaceText (id, GRX_SCALE/2, GRX_SCALE, HCENTER_TEXT|BOTTOM_TEXT, "X");
|
||||||
|
PlaceText (id, 0, GRX_SCALE/2, LEFT_TEXT|VCENTER_TEXT, "Y");
|
||||||
|
sprintf (axis, "%f", ymax);
|
||||||
|
nchars = 1000 / twidth;
|
||||||
|
|
||||||
|
axis [nchars] = 0;
|
||||||
|
PlaceText (id, GRX_SCALE/10, GRX_SCALE/10,
|
||||||
|
RIGHT_TEXT|TOP_TEXT, axis);
|
||||||
|
sprintf (axis, "%f", ymin);
|
||||||
|
axis [nchars] = 0;
|
||||||
|
PlaceText (id, GRX_SCALE/10, 9*GRX_SCALE/10,
|
||||||
|
RIGHT_TEXT|BOTTOM_TEXT,axis);
|
||||||
|
sprintf (axis, "%f",xmax);
|
||||||
|
PlaceText (id, 9*GRX_SCALE/10, 9*GRX_SCALE/10,
|
||||||
|
HCENTER_TEXT|TOP_TEXT,axis);
|
||||||
|
sprintf (axis,"%f",xmin);
|
||||||
|
PlaceText (id, GRX_SCALE/10, 9*GRX_SCALE/10,
|
||||||
|
HCENTER_TEXT|TOP_TEXT,axis);
|
||||||
|
fflush (stdout);
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
n = WaitForCarriageReturn (&winclick, &xclick, &yclick);
|
||||||
|
switch (n) {
|
||||||
|
case 1:
|
||||||
|
downx = xclick;
|
||||||
|
downy = yclick;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
upx = xclick;
|
||||||
|
upy = yclick;
|
||||||
|
if (upx < downx)
|
||||||
|
{
|
||||||
|
tmp = downx;
|
||||||
|
downx = upx;
|
||||||
|
upx = tmp;
|
||||||
|
}
|
||||||
|
if (upy < downy)
|
||||||
|
{
|
||||||
|
tmp = downy;
|
||||||
|
downy = upy;
|
||||||
|
upy = tmp;
|
||||||
|
}
|
||||||
|
xmin = (xmax - xmin) * (downx - 1000) / (8000) + xmin;
|
||||||
|
xmax = (xmax - xmin) * (upx - 1000) / (8000) + xmin;
|
||||||
|
ymax = ymax - (ymax - ymin) * (downy - 1000) / (8000);
|
||||||
|
ymin = ymax - (ymax - ymin) * (upy - 1000) / (8000);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while (n && (n != 2));
|
||||||
|
}
|
||||||
|
while (n);
|
||||||
|
nice_end (EXIT_SUCCESS);
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
/*----------------------- end-of-file (C source) -----------------------*/
|
|
@ -0,0 +1,389 @@
|
||||||
|
/*
|
||||||
|
* File: grkelot.c
|
||||||
|
*
|
||||||
|
* Synopsis: string -> greek ELOT928 or IBM437 string;
|
||||||
|
* 4-state FSM implementation.
|
||||||
|
*
|
||||||
|
* System: Any (ANSI C)
|
||||||
|
*
|
||||||
|
* This is code derived from a more generic key remapper written by the same
|
||||||
|
* author and used in other environments. It was not written only
|
||||||
|
* for greek kbd bindings. An extension to other languages is easy
|
||||||
|
* (well don't know how the FSM lends itself to Far East languages).
|
||||||
|
*
|
||||||
|
* The FSM can have MAX_STATES states (change it for more).
|
||||||
|
* Each state contains:
|
||||||
|
* 1. many tranlsation tables (registered via kstate_add_xlat())
|
||||||
|
* 2. many switch codes for transition to other states (registered via
|
||||||
|
* kstate_add_switcher()) : limit is static now: MAX_SWITCHER
|
||||||
|
* 3. life: the number of xlations allowed in a state (0 = unlimited)
|
||||||
|
*
|
||||||
|
* Format of tranlation strings:
|
||||||
|
* <first>-<last>:n1,n2,n3,...
|
||||||
|
* Format of switcher string:
|
||||||
|
* A<char>:<state_no>
|
||||||
|
* (other switchers apart from A=ascii can be supported; not in this context)
|
||||||
|
* Format of life string:
|
||||||
|
* L<N> (N=0,1,...)
|
||||||
|
*
|
||||||
|
* Copyright (c) 1994,1995 Angelo Haritsis. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms are permitted provided
|
||||||
|
* that the above copyright notice and this paragraph are duplicated in all
|
||||||
|
* such forms and that any documentation, advertising materials, and other
|
||||||
|
* materials related to such distribution and use acknowledge that the
|
||||||
|
* software was developed by Angelo Haritsis.
|
||||||
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||||
|
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
*
|
||||||
|
* NB: DO NOT ALTER! THIS CODE IS USED IN MANY PLATFORMS!!!
|
||||||
|
*
|
||||||
|
* TODO: make it more dynamic (linked lists is an idea but slower)
|
||||||
|
*/
|
||||||
|
|
||||||
|
static const char cvs_ident[] = "$Id$";
|
||||||
|
|
||||||
|
#include "feature.h"
|
||||||
|
#include "grkelot.h"
|
||||||
|
|
||||||
|
#ifdef GREEK_SUPPORT
|
||||||
|
# include "grkelot.h"
|
||||||
|
# include <stdlib.h>
|
||||||
|
# include <string.h>
|
||||||
|
|
||||||
|
/* --- Macros, Types --------- */
|
||||||
|
# define MAX_STATES 4 /* max # states for the FSM */
|
||||||
|
# define MAX_SWITCHER 2U /* per state */
|
||||||
|
# define MAX_VAL 256 /* for temp allocation */
|
||||||
|
|
||||||
|
typedef unsigned char u_char;
|
||||||
|
typedef unsigned int u_int;
|
||||||
|
typedef unsigned long u_long;
|
||||||
|
|
||||||
|
typedef struct s_xlat {
|
||||||
|
u_int first, last;
|
||||||
|
u_int *pval; /* array of translated values */
|
||||||
|
} K_XLAT;
|
||||||
|
|
||||||
|
typedef struct s_switch {
|
||||||
|
u_char type; /* Ascii, Virtual, Scan */
|
||||||
|
u_int code;
|
||||||
|
u_char nextstate;
|
||||||
|
u_char on; /* current state of key: 0 = off */
|
||||||
|
} K_SWITCH;
|
||||||
|
|
||||||
|
typedef struct s_state {
|
||||||
|
u_int num_xlat; /* number of translations */
|
||||||
|
K_XLAT *xlat; /* State translations ((dynamic - realloc'ed) */
|
||||||
|
u_int num_switcher; /* number of switcher keys */
|
||||||
|
K_SWITCH switcher[MAX_SWITCHER]; /* switcher keys to other states */
|
||||||
|
u_char life; /* 0 = until switched by key */
|
||||||
|
u_char prev_state; /* filled when jumped to a new state */
|
||||||
|
} K_STATE;
|
||||||
|
|
||||||
|
/* type for each one of the different greek standards (xlat types) */
|
||||||
|
typedef struct s_xlat_type {
|
||||||
|
char *plain;
|
||||||
|
char *accent;
|
||||||
|
char *accent_xtra;
|
||||||
|
char *umlaut;
|
||||||
|
char *acc_uml;
|
||||||
|
} XLAT_TYPE;
|
||||||
|
|
||||||
|
/* --- Local Data ------------ */
|
||||||
|
static K_STATE State[MAX_STATES];
|
||||||
|
|
||||||
|
/* Current State */
|
||||||
|
static u_char nStateNow = 0;
|
||||||
|
static K_STATE *pStateNow = &State[0];
|
||||||
|
static int GreekMode = GREEK_ELOT928;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The following are hard-coded for now. The idea is that such strings would
|
||||||
|
* be read from a config file making it possible to change language/encodings
|
||||||
|
* more flexibly.
|
||||||
|
*/
|
||||||
|
/* elot 928 xlations */
|
||||||
|
static char elot_xlat_plain[] = "65-122:193,194,216,196,197,214,195,199,201,206,202,203,204,205,207,208,81,209,211,212,200,217,87,215,213,198,91,92,93,94,95,96,225,226,248,228,229,246,227,231,233,238,234,235,236,237,239,240,113,241,243,244,232,249,242,247,245,230";
|
||||||
|
|
||||||
|
/* c and s give copyright and section sign */
|
||||||
|
static char elot_xlat_acc[] = "65-122:182,194,216,196,184,214,195,185,186,206,202,203,204,205,188,208,81,209,211,212,200,191,87,215,190,198,91,92,93,94,95,96,220,226," /*248 */ "169,228,221,246,227,222,223,238,234,235,236,237,252,240,113,241," /*243 */ "167,244,232,254,242,247,253,230";
|
||||||
|
static char elot_xlat_acc_xtra[] = "46-62:183,47,48,49,50,51,52,53,54,55,56,57,58,59,171,61,187"; /* anw teleia, quotes */
|
||||||
|
static char elot_xlat_uml[] = "65-122:193,194,216,196,197,214,195,199,218,206,202,203,204,205,207,208,81,209,211,212,200,217,87,215,219,198,91,92,93,94,95,96,225,226,248,228,229,246,227,231,250,238,234,235,236,237,239,240,113,241,243,244,232,249,242,247,251,230";
|
||||||
|
static char elot_xlat_umacc[] = "65-122:193,194,216,196,197,214,195,199,201,206,202,203,204,205,207,208,81,209,211,212,200,217,87,215,213,198,91,92,93,94,95,96,225,226,248,228,229,246,227,231,192,238,234,235,236,237,239,240,113,241,243,244,232,249,242,247,224,230";
|
||||||
|
|
||||||
|
/* ibm 437 xlations */
|
||||||
|
static char i437_xlat_plain[] = "65-122:128,129,150,131,132,148,130,134,136,141,137,138,139,140,142,143,81,144,145,146,135,151,87,149,147,133,91,92,93,94,95,96,152,153,175,155,156,173,154,158,160,165,161,162,163,164,166,167,113,168,169,171,159,224,170,174,172,157";
|
||||||
|
static char i437_xlat_acc[] = "65-122:234,129,150,131,235,148,130,236,237,141,137,138,139,140,238,143,81,144,145,146,135,240,87,149,239,133,91,92,93,94,95,96,225,153,175,155,226,173,154,227,229,165,161,162,163,164,230,167,113,168,169,171,159,233,170,174,231,157";
|
||||||
|
static char i437_xlat_acc_xtra[] = "46-46:250"; /* anw teleia */
|
||||||
|
static char i437_xlat_uml[] = "65-122:128,129,150,131,132,148,130,134,136,141,137,138,139,140,142,143,81,144,145,146,135,151,87,149,147,133,91,92,93,94,95,96,152,153,175,155,156,173,154,158,228,165,161,162,163,164,166,167,113,168,169,171,159,224,170,174,232,157";
|
||||||
|
static char i437_xlat_umacc[] = "65-122:128,129,150,131,132,148,130,134,136,141,137,138,139,140,142,143,81,144,145,146,135,151,87,149,147,133,91,92,93,94,95,96,152,153,175,155,156,173,154,158,42,165,161,162,163,164,166,167,113,168,169,171,159,224,170,174,42,157";
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* currently ELOT928 and IBM437 are supported; easy to include others
|
||||||
|
* (not recommended: stick to just these 2 if not only the ELOT one)
|
||||||
|
*/
|
||||||
|
static XLAT_TYPE xlat_type[] =
|
||||||
|
{
|
||||||
|
{elot_xlat_plain, elot_xlat_acc, elot_xlat_acc_xtra, elot_xlat_uml, elot_xlat_umacc},
|
||||||
|
{i437_xlat_plain, i437_xlat_acc, i437_xlat_acc_xtra, i437_xlat_uml, i437_xlat_umacc},
|
||||||
|
};
|
||||||
|
|
||||||
|
/* the current trasnaltion type */
|
||||||
|
static XLAT_TYPE *xlat_now = &xlat_type[GREEK_ELOT928];
|
||||||
|
|
||||||
|
# define NUM_XLAT_TYPES (sizeof(xlat_type) / sizeof(xlat_type[0]))
|
||||||
|
|
||||||
|
static void kstate_add_xlat(char *str);
|
||||||
|
static void kstate_add_switcher(char *str);
|
||||||
|
static void kstate_set_life(char *str);
|
||||||
|
|
||||||
|
/* --- Functions ------------- */
|
||||||
|
static void
|
||||||
|
kstate_setcurr(int stateno)
|
||||||
|
{
|
||||||
|
u_char prev_state;
|
||||||
|
|
||||||
|
if ((u_int) stateno > (u_int) MAX_STATES)
|
||||||
|
return;
|
||||||
|
if (pStateNow->life == 1)
|
||||||
|
prev_state = pStateNow->prev_state;
|
||||||
|
else
|
||||||
|
prev_state = nStateNow;
|
||||||
|
pStateNow = &State[nStateNow = stateno];
|
||||||
|
pStateNow->prev_state = prev_state;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
kstate_init(void)
|
||||||
|
{
|
||||||
|
pStateNow->num_xlat = pStateNow->num_switcher = pStateNow->life = pStateNow->prev_state = 0;
|
||||||
|
pStateNow->xlat = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
kstate_end(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < pStateNow->num_xlat; i++)
|
||||||
|
free(pStateNow->xlat[i].pval);
|
||||||
|
if (pStateNow->num_xlat > 0)
|
||||||
|
free(pStateNow->xlat);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Hard coded ELOT-928 translations. Could read these from an rc-type file
|
||||||
|
* to support other remappers.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
kstate_init_all(int greek_mode)
|
||||||
|
{
|
||||||
|
/* the translation tables for the 4 FSM states for ELOT-928 mappings */
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < MAX_STATES; i++) {
|
||||||
|
kstate_setcurr(i);
|
||||||
|
kstate_init();
|
||||||
|
}
|
||||||
|
if (greek_mode < 0 || greek_mode >= NUM_XLAT_TYPES) /* avoid death */
|
||||||
|
greek_mode = GREEK_ELOT928;
|
||||||
|
xlat_now = &xlat_type[greek_mode];
|
||||||
|
kstate_setcurr(0);
|
||||||
|
kstate_add_xlat(xlat_now->plain);
|
||||||
|
kstate_add_switcher("A;:1");
|
||||||
|
kstate_add_switcher("A::2");
|
||||||
|
kstate_set_life("L0");
|
||||||
|
|
||||||
|
kstate_setcurr(1);
|
||||||
|
kstate_add_xlat(xlat_now->accent);
|
||||||
|
kstate_add_xlat(xlat_now->accent_xtra);
|
||||||
|
kstate_add_switcher("A::3");
|
||||||
|
kstate_set_life("L1");
|
||||||
|
|
||||||
|
kstate_setcurr(2);
|
||||||
|
kstate_add_xlat(xlat_now->umlaut);
|
||||||
|
kstate_add_switcher("A;:3");
|
||||||
|
kstate_set_life("L1");
|
||||||
|
|
||||||
|
kstate_setcurr(3);
|
||||||
|
kstate_add_xlat(xlat_now->acc_uml);
|
||||||
|
kstate_set_life("L1");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
kstate_end_all(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < MAX_STATES; i++) {
|
||||||
|
kstate_setcurr(i);
|
||||||
|
kstate_end();
|
||||||
|
}
|
||||||
|
kstate_setcurr(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* reset FSM
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
kstate_reset(void)
|
||||||
|
{
|
||||||
|
kstate_setcurr(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
kstate_add_xlat(char *str)
|
||||||
|
{
|
||||||
|
K_XLAT *xlat;
|
||||||
|
u_int *pval_tmp;
|
||||||
|
char *sval;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (str == NULL)
|
||||||
|
return;
|
||||||
|
/* add a new xlat table in state */
|
||||||
|
if (pStateNow->num_xlat == 0) {
|
||||||
|
pStateNow->xlat = malloc(sizeof(K_XLAT));
|
||||||
|
} else /* prefer contiguous data, realloc */
|
||||||
|
pStateNow->xlat = realloc(pStateNow->xlat, (pStateNow->num_xlat + 1) * sizeof(K_XLAT));
|
||||||
|
xlat = &pStateNow->xlat[pStateNow->num_xlat];
|
||||||
|
/* parse str and derive first, last, values */
|
||||||
|
xlat->first = (u_int) atoi(strtok(str, "-"));
|
||||||
|
xlat->last = (u_int) atoi(strtok(NULL, ":"));
|
||||||
|
i = 0;
|
||||||
|
pval_tmp = calloc(MAX_VAL, sizeof(K_XLAT));
|
||||||
|
while ((sval = strtok(NULL, ",")) != NULL) {
|
||||||
|
pval_tmp[i++] = (u_int) (atoi(sval));
|
||||||
|
}
|
||||||
|
xlat->pval = calloc(i, sizeof(K_XLAT));
|
||||||
|
if (xlat->pval != NULL)
|
||||||
|
memcpy(xlat->pval, pval_tmp, i * sizeof(u_int));
|
||||||
|
free(pval_tmp);
|
||||||
|
pStateNow->num_xlat++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Ascii only for this implementation
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
kstate_add_switcher(char *str)
|
||||||
|
{
|
||||||
|
K_SWITCH *switcher;
|
||||||
|
|
||||||
|
if (str == NULL)
|
||||||
|
return;
|
||||||
|
if (pStateNow->num_switcher >= MAX_SWITCHER)
|
||||||
|
return;
|
||||||
|
switcher = &pStateNow->switcher[pStateNow->num_switcher];
|
||||||
|
switch (switcher->type = str[0]) {
|
||||||
|
case 'A': /* ascii eg: A;:2 */
|
||||||
|
switcher->code = str[1];
|
||||||
|
switcher->nextstate = atoi(&str[3]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
switcher->on = 0;
|
||||||
|
pStateNow->num_switcher++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* L1 or L0 */
|
||||||
|
static void
|
||||||
|
kstate_set_life(char *str)
|
||||||
|
{
|
||||||
|
pStateNow->life = atoi(&str[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
static unsigned int
|
||||||
|
kstate_cxlat(unsigned int c)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
/* check for ascii switcher */
|
||||||
|
for (i = 0; i < pStateNow->num_switcher; i++)
|
||||||
|
if (pStateNow->switcher[i].type == 'A' && /* only ascii here */
|
||||||
|
c == pStateNow->switcher[i].code) {
|
||||||
|
kstate_setcurr(pStateNow->switcher[i].nextstate);
|
||||||
|
pStateNow->switcher[i].on = 1;
|
||||||
|
return ((unsigned int) -1);
|
||||||
|
}
|
||||||
|
/* do translation */
|
||||||
|
for (i = 0; i < pStateNow->num_xlat; i++)
|
||||||
|
if (c >= pStateNow->xlat[i].first && c <= pStateNow->xlat[i].last) {
|
||||||
|
c = pStateNow->xlat[i].pval[c - pStateNow->xlat[i].first];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/* switch back to previous state if life of current is 1 */
|
||||||
|
if (pStateNow->life == 1)
|
||||||
|
kstate_setcurr(pStateNow->prev_state);
|
||||||
|
return (c);
|
||||||
|
}
|
||||||
|
|
||||||
|
# ifdef RXVT
|
||||||
|
void
|
||||||
|
greek_init(void)
|
||||||
|
{
|
||||||
|
kstate_init_all(GreekMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
greek_end(void)
|
||||||
|
{
|
||||||
|
kstate_end_all();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
greek_reset(void)
|
||||||
|
{
|
||||||
|
kstate_reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
greek_setmode(int greek_mode)
|
||||||
|
{
|
||||||
|
GreekMode = greek_mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
greek_getmode(void)
|
||||||
|
{
|
||||||
|
return (GreekMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* xlate a given string in-place - return new string length
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
greek_xlat(char *s, int num_chars)
|
||||||
|
{
|
||||||
|
int i, count;
|
||||||
|
unsigned int c;
|
||||||
|
|
||||||
|
for (i = 0, count = 0; i < num_chars; i++) {
|
||||||
|
c = kstate_cxlat((unsigned int) s[i]);
|
||||||
|
if (c != -1)
|
||||||
|
s[count++] = (char) c;
|
||||||
|
}
|
||||||
|
s[count] = '\0';
|
||||||
|
return (count);
|
||||||
|
}
|
||||||
|
|
||||||
|
# ifdef TEST
|
||||||
|
int
|
||||||
|
main(void)
|
||||||
|
{
|
||||||
|
/*char text[] = "abcdef;aGDZXC"; */
|
||||||
|
char text[] = "abcdef;a:ibgdezhuiklmnjoprstyfxcv";
|
||||||
|
|
||||||
|
kstate_init_all(GREEK_ELOT928);
|
||||||
|
printf("text: %s\n", text);
|
||||||
|
greek_xlat(text, strlen(text));
|
||||||
|
printf("xlat'ed text: %s\n", text);
|
||||||
|
kstate_end_all();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
# endif /* RXVT */
|
||||||
|
|
||||||
|
#endif /* GREEK_SUPPORT */
|
|
@ -0,0 +1,38 @@
|
||||||
|
/*
|
||||||
|
* File: grkelot.h
|
||||||
|
*
|
||||||
|
* Synopsis: string -> greek ELOT928 string; 4-state FSM.
|
||||||
|
*
|
||||||
|
* Copyright (c) 1994 Angelo Haritsis. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms are permitted provided
|
||||||
|
* that the above copyright notice and this paragraph are duplicated in all
|
||||||
|
* such forms and that any documentation, advertising materials, and other
|
||||||
|
* materials related to such distribution and use acknowledge that the
|
||||||
|
* software was developed by Angelo Haritsis.
|
||||||
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||||
|
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
*
|
||||||
|
* $Header$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _GRKELOT_H
|
||||||
|
# define _GRKELOT_H
|
||||||
|
|
||||||
|
# define GREEK_ELOT928 0
|
||||||
|
# define GREEK_IBM437 1
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
# endif
|
||||||
|
extern void greek_init (void);
|
||||||
|
extern void greek_end (void);
|
||||||
|
extern void greek_reset (void);
|
||||||
|
extern void greek_setmode(int greek_mode);
|
||||||
|
extern int greek_getmode(void);
|
||||||
|
extern int greek_xlat (char *s, int num_chars);
|
||||||
|
# ifdef __cplusplus
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
#endif /* _GRKELOT_H */
|
|
@ -0,0 +1,53 @@
|
||||||
|
/*--------------------------------*-C-*---------------------------------*
|
||||||
|
* File: grx.h
|
||||||
|
*
|
||||||
|
* Stuff for text alignment for special graphics mode
|
||||||
|
*
|
||||||
|
* alignment
|
||||||
|
* Top:
|
||||||
|
* text is placed so that the specified point is at the top of the
|
||||||
|
* capital letters
|
||||||
|
* Center:
|
||||||
|
* text is placed so that the specified point is equidistant from the
|
||||||
|
* bottom of descenders and the top of the capital letters
|
||||||
|
* Botton:
|
||||||
|
* text is placed so that the bottom of descenders is on the specified
|
||||||
|
* point
|
||||||
|
* Base:
|
||||||
|
* text is placed so that the bottom of the characters with no descenders
|
||||||
|
* is on the specified point
|
||||||
|
* Caps_Center:
|
||||||
|
* text is placed so that the specified point is equidistant from the
|
||||||
|
* bottom and tops of capital letters
|
||||||
|
*----------------------------------------------------------------------*/
|
||||||
|
#ifndef _RXVTGRX_H
|
||||||
|
# define _RXVTGRX_H
|
||||||
|
|
||||||
|
# define GRX_SCALE 10000
|
||||||
|
|
||||||
|
# define RIGHT_TEXT 0x10
|
||||||
|
# define HCENTER_TEXT 0x20
|
||||||
|
# define LEFT_TEXT 0x30
|
||||||
|
# define HORIZONTAL_ALIGNMENT 0x70
|
||||||
|
|
||||||
|
# define TOP_TEXT 0x01
|
||||||
|
# define VCENTER_TEXT 0x02
|
||||||
|
# define BOTTOM_TEXT 0x03
|
||||||
|
# define BASE_TEXT 0x04
|
||||||
|
# define VCAPS_CENTER_TEXT 0x05
|
||||||
|
# define VERTICAL_ALIGNMENT 0x0F
|
||||||
|
|
||||||
|
# if 0 /* this would be nicer */
|
||||||
|
# define TXT_RIGHT 'r'
|
||||||
|
# define TXT_CENTER 'c'
|
||||||
|
# define TXT_LEFT 'l'
|
||||||
|
|
||||||
|
# define TXT_TOP 't'
|
||||||
|
# define TXT_VCENTER 'v'
|
||||||
|
# define TXT_BOTTOM 'b'
|
||||||
|
# define TXT_BASE '_'
|
||||||
|
# define TXT_VCAPS_CENTER 'C'
|
||||||
|
# endif
|
||||||
|
|
||||||
|
#endif /* whole file */
|
||||||
|
/*----------------------- end-of-file (C header) -----------------------*/
|
|
@ -0,0 +1,479 @@
|
||||||
|
/* main.c -- Eterm main() function
|
||||||
|
* -- 22 August 1998, mej
|
||||||
|
*
|
||||||
|
* This file is original work by Michael Jennings <mej@tcserv.com> and
|
||||||
|
* Tuomo Venalainen <vendu@cc.hut.fi>. This file, and any other file
|
||||||
|
* bearing this same message or a similar one, is distributed under
|
||||||
|
* the GNU Public License (GPL) as outlined in the COPYING file.
|
||||||
|
*
|
||||||
|
* Copyright (C) 1997, Michael Jennings and Tuomo Venalainen
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
static const char cvs_ident[] = "$Id$";
|
||||||
|
|
||||||
|
/* includes */
|
||||||
|
#include "main.h"
|
||||||
|
#ifdef USE_ACTIVE_TAGS
|
||||||
|
# include "activetags.h"
|
||||||
|
# include "activeeterm.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
# include <unistd.h>
|
||||||
|
#endif
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <X11/cursorfont.h>
|
||||||
|
#include <X11/keysym.h>
|
||||||
|
#include <X11/Xlib.h>
|
||||||
|
#include <X11/Xutil.h>
|
||||||
|
#include <X11/Xatom.h>
|
||||||
|
#include <X11/Xos.h>
|
||||||
|
|
||||||
|
#include "command.h"
|
||||||
|
#include "feature.h"
|
||||||
|
#include "../libmej/debug.h" /* from libmej */
|
||||||
|
#include "debug.h"
|
||||||
|
#include "../libmej/mem.h"
|
||||||
|
#include "../libmej/strings.h"
|
||||||
|
/* For strsep(). -vendu */
|
||||||
|
#if defined(linux)
|
||||||
|
# include <string.h>
|
||||||
|
#endif
|
||||||
|
#include "string.h"
|
||||||
|
#include "graphics.h"
|
||||||
|
#include "scrollbar.h"
|
||||||
|
#include "menubar.h"
|
||||||
|
#include "screen.h"
|
||||||
|
#include "options.h"
|
||||||
|
#include "pixmap.h"
|
||||||
|
#ifdef USE_POSIX_THREADS
|
||||||
|
# include "threads.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Global attributes */
|
||||||
|
XWindowAttributes attr;
|
||||||
|
XSetWindowAttributes Attributes;
|
||||||
|
char *orig_argv0;
|
||||||
|
|
||||||
|
#ifdef PIXMAP_SUPPORT
|
||||||
|
/* Set to one in case there is no WM, or a lousy one
|
||||||
|
that doesn't send the right events (*cough*
|
||||||
|
Window Maker *cough*) -- mej */
|
||||||
|
short bg_needs_update = 1;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* extern functions referenced */
|
||||||
|
#ifdef DISPLAY_IS_IP
|
||||||
|
extern char *network_display(const char *display);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern void get_initial_options(int, char **);
|
||||||
|
extern void menubar_read(const char *filename);
|
||||||
|
|
||||||
|
#ifdef USE_POSIX_THREADS
|
||||||
|
static void **retval;
|
||||||
|
static int join_value;
|
||||||
|
static pthread_t main_loop_thr;
|
||||||
|
static pthread_attr_t main_loop_attr;
|
||||||
|
|
||||||
|
# ifdef MUTEX_SYNCH
|
||||||
|
pthread_mutex_t mutex;
|
||||||
|
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PIXMAP_SUPPORT
|
||||||
|
extern void render_pixmap(Window win, imlib_t image, pixmap_t pmap,
|
||||||
|
int which, renderop_t renderop);
|
||||||
|
|
||||||
|
# ifdef BACKING_STORE
|
||||||
|
extern const char *rs_saveUnder;
|
||||||
|
|
||||||
|
# endif
|
||||||
|
|
||||||
|
extern char *rs_noCursor;
|
||||||
|
|
||||||
|
# ifdef USE_IMLIB
|
||||||
|
extern ImlibData *imlib_id;
|
||||||
|
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* extern variables referenced */
|
||||||
|
extern int my_ruid, my_rgid, my_euid, my_egid;
|
||||||
|
extern unsigned int rs_shadePct;
|
||||||
|
extern unsigned long rs_tintMask;
|
||||||
|
|
||||||
|
/* extern variables declared here */
|
||||||
|
TermWin_t TermWin;
|
||||||
|
Display *Xdisplay; /* display */
|
||||||
|
|
||||||
|
char *rs_color[NRS_COLORS];
|
||||||
|
Pixel PixColors[NRS_COLORS + NSHADOWCOLORS];
|
||||||
|
|
||||||
|
unsigned long Options = (Opt_scrollBar);
|
||||||
|
unsigned int debug_level = 0; /* Level of debugging information to display */
|
||||||
|
|
||||||
|
const char *display_name = NULL;
|
||||||
|
char *rs_name = NULL; /* client instance (resource name) */
|
||||||
|
|
||||||
|
#ifndef NO_BOLDFONT
|
||||||
|
const char *rs_boldFont = NULL;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
const char *rs_font[NFONTS];
|
||||||
|
|
||||||
|
#ifdef KANJI
|
||||||
|
const char *rs_kfont[NFONTS];
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PRINTPIPE
|
||||||
|
char *rs_print_pipe = NULL;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
char *rs_cutchars = NULL;
|
||||||
|
|
||||||
|
/* local variables */
|
||||||
|
Cursor TermWin_cursor; /* cursor for vt window */
|
||||||
|
unsigned int colorfgbg;
|
||||||
|
menuBar_t menuBar;
|
||||||
|
|
||||||
|
XSizeHints szHint =
|
||||||
|
{
|
||||||
|
PMinSize | PResizeInc | PBaseSize | PWinGravity,
|
||||||
|
0, 0, 80, 24, /* x, y, width, height */
|
||||||
|
1, 1, /* Min width, height */
|
||||||
|
0, 0, /* Max width, height - unused */
|
||||||
|
1, 1, /* increments: width, height */
|
||||||
|
{1, 1}, /* increments: x, y */
|
||||||
|
{0, 0}, /* Aspect ratio - unused */
|
||||||
|
0, 0, /* base size: width, height */
|
||||||
|
NorthWestGravity /* gravity */
|
||||||
|
};
|
||||||
|
|
||||||
|
char *def_colorName[] =
|
||||||
|
{
|
||||||
|
"rgb:0/0/0", "rgb:ff/ff/ff", /* fg/bg */
|
||||||
|
"rgb:0/0/0", /* 0: black (#000000) */
|
||||||
|
#ifndef NO_BRIGHTCOLOR
|
||||||
|
/* low-intensity colors */
|
||||||
|
"rgb:cc/00/00", /* 1: red */
|
||||||
|
"rgb:00/cc/00", /* 2: green */
|
||||||
|
"rgb:cc/cc/00", /* 3: yellow */
|
||||||
|
"rgb:00/00/cc", /* 4: blue */
|
||||||
|
"rgb:cc/00/cc", /* 5: magenta */
|
||||||
|
"rgb:00/cc/cc", /* 6: cyan */
|
||||||
|
"rgb:fa/eb/d7", /* 7: white */
|
||||||
|
/* high-intensity colors */
|
||||||
|
"rgb:33/33/33", /* 8: bright black */
|
||||||
|
#endif /* NO_BRIGHTCOLOR */
|
||||||
|
"rgb:ff/00/00", /* 1/9: bright red */
|
||||||
|
"rgb:00/ff/00", /* 2/10: bright green */
|
||||||
|
"rgb:ff/ff/00", /* 3/11: bright yellow */
|
||||||
|
"rgb:00/00/ff", /* 4/12: bright blue */
|
||||||
|
"rgb:ff/00/ff", /* 5/13: bright magenta */
|
||||||
|
"rgb:00/ff/ff", /* 6/14: bright cyan */
|
||||||
|
"rgb:ff/ff/ff", /* 7/15: bright white */
|
||||||
|
#ifndef NO_CURSORCOLOR
|
||||||
|
NULL, NULL, /* cursorColor, cursorColor2 */
|
||||||
|
#endif /* NO_CURSORCOLOR */
|
||||||
|
NULL, NULL /* pointerColor, borderColor */
|
||||||
|
#ifndef NO_BOLDUNDERLINE
|
||||||
|
,NULL, NULL /* colorBD, colorUL */
|
||||||
|
#endif /* NO_BOLDUNDERLINE */
|
||||||
|
,"rgb:ff/ff/ff" /* menuTextColor */
|
||||||
|
#ifdef KEEP_SCROLLCOLOR
|
||||||
|
,"rgb:b2/b2/b2" /* scrollColor: match Netscape color */
|
||||||
|
# ifdef CHANGE_SCROLLCOLOR_ON_FOCUS
|
||||||
|
,NULL /* unfocusedscrollColor: somebody chose black? */
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef KANJI
|
||||||
|
/* Kanji font names, roman fonts sized to match */
|
||||||
|
const char *def_kfontName[] =
|
||||||
|
{
|
||||||
|
KFONT0, KFONT1, KFONT2, KFONT3, KFONT4
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* KANJI */
|
||||||
|
const char *def_fontName[] =
|
||||||
|
{
|
||||||
|
FONT0, FONT1, FONT2, FONT3, FONT4
|
||||||
|
};
|
||||||
|
|
||||||
|
/* extern functions referenced */
|
||||||
|
#ifdef PIXMAP_SUPPORT
|
||||||
|
/* the originally loaded pixmap and its scaling */
|
||||||
|
extern pixmap_t bgPixmap;
|
||||||
|
extern void set_bgPixmap(const char * /* file */ );
|
||||||
|
|
||||||
|
# ifdef USE_IMLIB
|
||||||
|
extern imlib_t imlib_bg;
|
||||||
|
|
||||||
|
# endif
|
||||||
|
# ifdef PIXMAP_SCROLLBAR
|
||||||
|
extern pixmap_t sbPixmap;
|
||||||
|
extern pixmap_t upPixmap, up_clkPixmap;
|
||||||
|
extern pixmap_t dnPixmap, dn_clkPixmap;
|
||||||
|
extern pixmap_t saPixmap, sa_clkPixmap;
|
||||||
|
|
||||||
|
# ifdef USE_IMLIB
|
||||||
|
extern imlib_t imlib_sb, imlib_sa, imlib_saclk;
|
||||||
|
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
# ifdef PIXMAP_MENUBAR
|
||||||
|
extern pixmap_t mbPixmap, mb_selPixmap;
|
||||||
|
|
||||||
|
# ifdef USE_IMLIB
|
||||||
|
extern imlib_t imlib_mb, imlib_ms;
|
||||||
|
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
|
||||||
|
extern int scale_pixmap(const char *geom, pixmap_t * pmap);
|
||||||
|
|
||||||
|
#endif /* PIXMAP_SUPPORT */
|
||||||
|
|
||||||
|
/* have we changed the font? Needed to avoid race conditions
|
||||||
|
* while window resizing */
|
||||||
|
int font_change_count = 0;
|
||||||
|
|
||||||
|
static void resize(void);
|
||||||
|
|
||||||
|
extern XErrorHandler xerror_handler(Display *, XErrorEvent *);
|
||||||
|
extern void Create_Windows(int, char **);
|
||||||
|
|
||||||
|
/* main() */
|
||||||
|
int
|
||||||
|
main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
|
||||||
|
int i, count;
|
||||||
|
char *val;
|
||||||
|
static char windowid_string[20], *display_string, *term_string; /* "WINDOWID=\0" = 10 chars, UINT_MAX = 10 chars */
|
||||||
|
|
||||||
|
orig_argv0 = argv[0];
|
||||||
|
|
||||||
|
#ifdef USE_POSIX_THREADS
|
||||||
|
# ifdef MUTEX_SYNCH
|
||||||
|
pthread_atfork((void *) &prepare, (void *) &parent, (void *) &child);
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Security enhancements -- mej */
|
||||||
|
my_ruid = getuid();
|
||||||
|
my_euid = geteuid();
|
||||||
|
my_rgid = getgid();
|
||||||
|
my_egid = getegid();
|
||||||
|
privileges(REVERT);
|
||||||
|
|
||||||
|
TermWin.wm_parent = None;
|
||||||
|
init_defaults();
|
||||||
|
|
||||||
|
/* Open display, get options/resources and create the window */
|
||||||
|
if ((display_name = getenv("DISPLAY")) == NULL)
|
||||||
|
display_name = ":0";
|
||||||
|
|
||||||
|
/* This MUST be called before any other Xlib functions */
|
||||||
|
|
||||||
|
#ifdef USE_POSIX_THREADS
|
||||||
|
if (XInitThreads()) {
|
||||||
|
D_THREADS(("XInitThreads() succesful\n"));
|
||||||
|
} else {
|
||||||
|
D_THREADS(("XInitThreads() failed, I'm outta here\n"));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_THEMES
|
||||||
|
get_initial_options(argc, argv);
|
||||||
|
#endif
|
||||||
|
read_config();
|
||||||
|
#ifdef PIXMAP_SUPPORT
|
||||||
|
if (rs_path) {
|
||||||
|
rs_path = REALLOC(rs_path, strlen(rs_path) + strlen(initial_dir) + 2);
|
||||||
|
strcat(rs_path, ":");
|
||||||
|
strcat(rs_path, initial_dir);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
get_options(argc, argv);
|
||||||
|
#ifdef USE_ACTIVE_TAGS
|
||||||
|
tag_init();
|
||||||
|
#endif
|
||||||
|
D_UTMP(("Saved real uid/gid = [ %d, %d ] effective uid/gid = [ %d, %d ]\n", my_ruid, my_rgid, my_euid, my_egid));
|
||||||
|
D_UTMP(("Now running with real uid/gid = [ %d, %d ] effective uid/gid = [ %d, %d ]\n", getuid(), getgid(), geteuid(),
|
||||||
|
getegid()));
|
||||||
|
|
||||||
|
#ifdef NEED_LINUX_HACK
|
||||||
|
privileges(INVOKE); /* xdm in new Linux versions requires ruid != root to open the display -- mej */
|
||||||
|
#endif
|
||||||
|
Xdisplay = XOpenDisplay(display_name);
|
||||||
|
#ifdef NEED_LINUX_HACK
|
||||||
|
privileges(REVERT);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!Xdisplay) {
|
||||||
|
print_error("can't open display %s", display_name);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if DEBUG >= DEBUG_X
|
||||||
|
if (debug_level >= DEBUG_X) {
|
||||||
|
XSetErrorHandler((XErrorHandler) abort);
|
||||||
|
} else {
|
||||||
|
XSetErrorHandler((XErrorHandler) xerror_handler);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
XSetErrorHandler((XErrorHandler) xerror_handler);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Since we always use Imlib now, let's initialize it here. */
|
||||||
|
imlib_id = Imlib_init(Xdisplay);
|
||||||
|
|
||||||
|
post_parse();
|
||||||
|
|
||||||
|
#ifdef PREFER_24BIT
|
||||||
|
Xdepth = DefaultDepth(Xdisplay, Xscreen);
|
||||||
|
Xcmap = DefaultColormap(Xdisplay, Xscreen);
|
||||||
|
Xvisual = DefaultVisual(Xdisplay, Xscreen);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If depth is not 24, look for a 24bit visual.
|
||||||
|
*/
|
||||||
|
if (Xdepth != 24) {
|
||||||
|
XVisualInfo vinfo;
|
||||||
|
|
||||||
|
if (XMatchVisualInfo(Xdisplay, Xscreen, 24, TrueColor, &vinfo)) {
|
||||||
|
Xdepth = 24;
|
||||||
|
Xvisual = vinfo.visual;
|
||||||
|
Xcmap = XCreateColormap(Xdisplay, RootWindow(Xdisplay, Xscreen),
|
||||||
|
Xvisual, AllocNone);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Create_Windows(argc, argv);
|
||||||
|
scr_reset(); /* initialize screen */
|
||||||
|
Gr_reset(); /* reset graphics */
|
||||||
|
|
||||||
|
/* add scrollBar, do it directly to avoid resize() */
|
||||||
|
scrollbar_mapping(Options & Opt_scrollBar);
|
||||||
|
/* we can now add menuBar */
|
||||||
|
if (delay_menu_drawing) {
|
||||||
|
delay_menu_drawing = 0;
|
||||||
|
menubar_mapping(1);
|
||||||
|
} else if (rs_menubar == *false_vals) {
|
||||||
|
menubar_mapping(0);
|
||||||
|
}
|
||||||
|
#if DEBUG >= DEBUG_X
|
||||||
|
if (debug_level >= DEBUG_X) {
|
||||||
|
XSynchronize(Xdisplay, True);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef DISPLAY_IS_IP
|
||||||
|
/* Fixup display_name for export over pty to any interested terminal
|
||||||
|
* clients via "ESC[7n" (e.g. shells). Note we use the pure IP number
|
||||||
|
* (for the first non-loopback interface) that we get from
|
||||||
|
* network_display(). This is more "name-resolution-portable", if you
|
||||||
|
* will, and probably allows for faster x-client startup if your name
|
||||||
|
* server is beyond a slow link or overloaded at client startup. Of
|
||||||
|
* course that only helps the shell's child processes, not us.
|
||||||
|
*
|
||||||
|
* Giving out the display_name also affords a potential security hole
|
||||||
|
*/
|
||||||
|
|
||||||
|
val = display_name = network_display(display_name);
|
||||||
|
if (val == NULL)
|
||||||
|
#endif /* DISPLAY_IS_IP */
|
||||||
|
val = XDisplayString(Xdisplay);
|
||||||
|
if (display_name == NULL)
|
||||||
|
display_name = val; /* use broken `:0' value */
|
||||||
|
|
||||||
|
i = strlen(val);
|
||||||
|
display_string = MALLOC((i + 9));
|
||||||
|
|
||||||
|
sprintf(display_string, "DISPLAY=%s", val);
|
||||||
|
sprintf(windowid_string, "WINDOWID=%u", (unsigned int) TermWin.parent);
|
||||||
|
|
||||||
|
/* add entries to the environment:
|
||||||
|
* @ DISPLAY: in case we started with -display
|
||||||
|
* @ WINDOWID: X window id number of the window
|
||||||
|
* @ COLORTERM: terminal sub-name and also indicates its color
|
||||||
|
* @ TERM: terminal name
|
||||||
|
*/
|
||||||
|
putenv(display_string);
|
||||||
|
putenv(windowid_string);
|
||||||
|
if (Xdepth <= 2) {
|
||||||
|
putenv("COLORTERM=" COLORTERMENV "-mono");
|
||||||
|
putenv("TERM=" TERMENV);
|
||||||
|
} else {
|
||||||
|
if (rs_term_name != NULL) {
|
||||||
|
i = strlen(rs_term_name);
|
||||||
|
term_string = MALLOC((i + 6) * sizeof(char));
|
||||||
|
|
||||||
|
sprintf(term_string, "TERM=%s", rs_term_name);
|
||||||
|
putenv(term_string);
|
||||||
|
} else {
|
||||||
|
#ifdef DEFINE_XTERM_COLOR
|
||||||
|
if (Xdepth <= 2)
|
||||||
|
putenv("TERM=" TERMENV);
|
||||||
|
else
|
||||||
|
putenv("TERM=" TERMENV "-color");
|
||||||
|
#else
|
||||||
|
putenv("TERM=" TERMENV);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#ifdef PIXMAP_SUPPORT
|
||||||
|
putenv("COLORTERM=" COLORTERMENV "-pixmap");
|
||||||
|
#else
|
||||||
|
putenv("COLORTERM=" COLORTERMENV);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
D_CMD(("init_command()\n"));
|
||||||
|
init_command(rs_execArgs);
|
||||||
|
#ifndef USE_POSIX_THREADS
|
||||||
|
if (Options & Opt_borderless) {
|
||||||
|
resize_window();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_POSIX_THREADS
|
||||||
|
D_THREADS(("main_thread:"));
|
||||||
|
pthread_attr_init(&main_loop_attr);
|
||||||
|
pthread_create(&main_loop_thr, &main_loop_attr,
|
||||||
|
(void *) &main_thread, NULL);
|
||||||
|
D_THREADS(("done? :)\n"));
|
||||||
|
while (1);
|
||||||
|
/* main_loop(); */
|
||||||
|
#else
|
||||||
|
main_loop(); /* main processing loop */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return (EXIT_SUCCESS);
|
||||||
|
}
|
||||||
|
/* EOF */
|
|
@ -0,0 +1,304 @@
|
||||||
|
/*--------------------------------*-C-*---------------------------------*
|
||||||
|
* File: main.h
|
||||||
|
*/
|
||||||
|
/* notes: */
|
||||||
|
/*----------------------------------------------------------------------*
|
||||||
|
* Copyright 1992 John Bovey, University of Kent at Canterbury.
|
||||||
|
*
|
||||||
|
* You can do what you like with this source code as long as you don't try
|
||||||
|
* to make money out of it and you include an unaltered copy of this
|
||||||
|
* message (including the copyright).
|
||||||
|
*
|
||||||
|
* This module has been heavily modified by R. Nation
|
||||||
|
* <nation@rocket.sanders.lockheed.com>
|
||||||
|
* No additional restrictions are applied
|
||||||
|
*
|
||||||
|
* Additional modifications by mj olesen <olesen@me.QueensU.CA>
|
||||||
|
* No additional restrictions are applied.
|
||||||
|
*
|
||||||
|
* As usual, the author accepts no responsibility for anything, nor does
|
||||||
|
* he guarantee anything whatsoever.
|
||||||
|
*----------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef _MAIN_H
|
||||||
|
# define _MAIN_H
|
||||||
|
# include "config.h"
|
||||||
|
# include "feature.h"
|
||||||
|
# include <X11/Xfuncproto.h>
|
||||||
|
# include <assert.h>
|
||||||
|
# include <ctype.h>
|
||||||
|
# include <stdio.h>
|
||||||
|
|
||||||
|
/* STDC_HEADERS
|
||||||
|
* don't check for these using configure, since we need them regardless.
|
||||||
|
* if you don't have them -- figure a workaround.
|
||||||
|
*
|
||||||
|
* Sun is often reported as not being STDC_HEADERS, but it's not true
|
||||||
|
* for our purposes and only generates spurious bug reports.
|
||||||
|
*/
|
||||||
|
# include <stdarg.h>
|
||||||
|
# include <stdlib.h>
|
||||||
|
# include <string.h>
|
||||||
|
|
||||||
|
# ifndef EXIT_SUCCESS /* missing from <stdlib.h> */
|
||||||
|
# define EXIT_SUCCESS 0 /* exit function success */
|
||||||
|
# define EXIT_FAILURE 1 /* exit function failure */
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# include <X11/Intrinsic.h> /* Xlib, Xutil, Xresource, Xfuncproto */
|
||||||
|
# include "misc.h"
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int internalBorder; /* Internal border size */
|
||||||
|
short width, height; /* window size [pixels] */
|
||||||
|
short fwidth, fheight; /* font width and height [pixels] */
|
||||||
|
short fprop; /* font is proportional */
|
||||||
|
short ncol, nrow; /* window size [characters] */
|
||||||
|
short focus; /* window has focus */
|
||||||
|
short saveLines; /* number of lines that fit in scrollback */
|
||||||
|
short nscrolled; /* number of line actually scrolled */
|
||||||
|
short view_start; /* scrollback view starts here */
|
||||||
|
Window parent, vt; /* parent (main) and vt100 window */
|
||||||
|
Window wm_parent, /* The parent assigned by the WM */
|
||||||
|
wm_grandparent; /* The grandparent assigned by the WM */
|
||||||
|
GC gc; /* GC for drawing text */
|
||||||
|
XFontStruct * font; /* main font structure */
|
||||||
|
# ifndef NO_BOLDFONT
|
||||||
|
XFontStruct * boldFont; /* bold font */
|
||||||
|
# endif
|
||||||
|
# ifdef KANJI
|
||||||
|
XFontStruct * kanji; /* Kanji font structure */
|
||||||
|
# endif
|
||||||
|
# ifdef PIXMAP_SUPPORT
|
||||||
|
Pixmap pixmap;
|
||||||
|
# ifdef PIXMAP_BUFFERING
|
||||||
|
Pixmap buf_pixmap;
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
} TermWin_t;
|
||||||
|
|
||||||
|
extern TermWin_t TermWin;
|
||||||
|
extern Window root;
|
||||||
|
extern Display * Xdisplay;
|
||||||
|
extern char *def_colorName[];
|
||||||
|
extern const char *def_fontName[];
|
||||||
|
# ifdef KANJI
|
||||||
|
extern const char *def_kfontName[];
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# define MAX_COLS 200
|
||||||
|
# define MAX_ROWS 128
|
||||||
|
|
||||||
|
# ifndef min
|
||||||
|
# define min(a,b) (((a) < (b)) ? (a) : (b))
|
||||||
|
# define max(a,b) (((a) > (b)) ? (a) : (b))
|
||||||
|
# endif
|
||||||
|
# ifndef MIN
|
||||||
|
# define MIN(a,b) (((a) < (b)) ? (a) : (b))
|
||||||
|
# endif
|
||||||
|
# ifndef MAX
|
||||||
|
# define MAX(a,b) (((a) > (b)) ? (a) : (b))
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# define MAX_IT(current, other) if ((other) > (current)) (current) = (other)
|
||||||
|
# define MIN_IT(current, other) if ((other) < (current)) (current) = (other)
|
||||||
|
# define SWAP_IT(one, two, tmp) \
|
||||||
|
do { \
|
||||||
|
(tmp) = (one); (one) = (two); (two) = (tmp); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
/* width of scrollBar, menuBar shadow ... don't change! */
|
||||||
|
# define SHADOW 2
|
||||||
|
|
||||||
|
/* convert pixel dimensions to row/column values */
|
||||||
|
# define Pixel2Width(x) ((x) / TermWin.fwidth)
|
||||||
|
# define Pixel2Height(y) ((y) / TermWin.fheight)
|
||||||
|
# define Pixel2Col(x) Pixel2Width((x) - TermWin.internalBorder)
|
||||||
|
# define Pixel2Row(y) Pixel2Height((y) - TermWin.internalBorder)
|
||||||
|
|
||||||
|
# define Width2Pixel(n) ((n) * TermWin.fwidth)
|
||||||
|
# define Height2Pixel(n) ((n) * TermWin.fheight)
|
||||||
|
# define Col2Pixel(col) (Width2Pixel(col) + TermWin.internalBorder)
|
||||||
|
# define Row2Pixel(row) (Height2Pixel(row) + TermWin.internalBorder)
|
||||||
|
|
||||||
|
# define TermWin_TotalWidth() (TermWin.width + 2 * TermWin.internalBorder)
|
||||||
|
# define TermWin_TotalHeight() (TermWin.height + 2 * TermWin.internalBorder)
|
||||||
|
|
||||||
|
# define Xscreen DefaultScreen(Xdisplay)
|
||||||
|
# define Xcmap DefaultColormap(Xdisplay,Xscreen)
|
||||||
|
# define Xdepth DefaultDepth(Xdisplay,Xscreen)
|
||||||
|
# define Xroot DefaultRootWindow(Xdisplay)
|
||||||
|
# ifdef DEBUG_DEPTH
|
||||||
|
# undef Xdepth
|
||||||
|
# define Xdepth DEBUG_DEPTH
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# define Opt_console (1LU << 0)
|
||||||
|
# define Opt_loginShell (1LU << 1)
|
||||||
|
# define Opt_iconic (1LU << 2)
|
||||||
|
# define Opt_visualBell (1LU << 3)
|
||||||
|
# define Opt_mapAlert (1LU << 4)
|
||||||
|
# define Opt_reverseVideo (1LU << 5)
|
||||||
|
# define Opt_utmpLogging (1LU << 6)
|
||||||
|
# define Opt_scrollBar (1LU << 7)
|
||||||
|
# define Opt_meta8 (1LU << 8)
|
||||||
|
# define Opt_pixmapScale (1LU << 9)
|
||||||
|
# define Opt_exec (1LU << 10)
|
||||||
|
# define Opt_homeOnEcho (1LU << 11)
|
||||||
|
# define Opt_homeOnRefresh (1LU << 12)
|
||||||
|
# define Opt_scrollBar_floating (1LU << 13)
|
||||||
|
# define Opt_scrollBar_right (1LU << 14)
|
||||||
|
# define Opt_borderless (1LU << 15)
|
||||||
|
# define Opt_pixmapTrans (1LU << 16)
|
||||||
|
# define Opt_saveUnder (1LU << 17)
|
||||||
|
# define Opt_noCursor (1LU << 18)
|
||||||
|
# define Opt_pause (1LU << 19)
|
||||||
|
# define Opt_watchDesktop (1LU << 20)
|
||||||
|
# define Opt_homeOnInput (1LU << 21)
|
||||||
|
# define Opt_menubar_move (1LU << 22)
|
||||||
|
# define Opt_xterm_select (1LU << 23)
|
||||||
|
# define Opt_select_whole_line (1LU << 24)
|
||||||
|
# define Opt_viewport_mode (1LU << 25)
|
||||||
|
# define Opt_scrollbar_popup (1LU << 26)
|
||||||
|
# define Opt_select_trailing_spaces (1LU << 24)
|
||||||
|
|
||||||
|
/* place holder used for parsing command-line options */
|
||||||
|
# define Opt_Boolean (1LU << 31)
|
||||||
|
extern unsigned long Options;
|
||||||
|
|
||||||
|
extern const char *display_name;
|
||||||
|
extern char *rs_name; /* client instance (resource name) */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* XTerm escape sequences: ESC ] Ps;Pt BEL
|
||||||
|
*/
|
||||||
|
# define XTerm_name 0
|
||||||
|
# define XTerm_iconName 1
|
||||||
|
# define XTerm_title 2
|
||||||
|
# define XTerm_logfile 46 /* not implemented */
|
||||||
|
# define XTerm_font 50
|
||||||
|
|
||||||
|
/*
|
||||||
|
* rxvt/Eterm extensions of XTerm escape sequences: ESC ] Ps;Pt BEL
|
||||||
|
*/
|
||||||
|
# define XTerm_Takeover 5 /* Steal keyboard focus and raise window */
|
||||||
|
# define XTerm_EtermSeq 6 /* Eterm proprietary escape sequences */
|
||||||
|
# define XTerm_Menu 10 /* set menu item */
|
||||||
|
# define XTerm_Pixmap 20 /* new bg pixmap */
|
||||||
|
# define XTerm_restoreFG 39 /* change default fg color */
|
||||||
|
# define XTerm_restoreBG 49 /* change default bg color */
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
# define restoreFG 39 /* restore default fg color */
|
||||||
|
# define restoreBG 49 /* restore default bg color */
|
||||||
|
|
||||||
|
enum colour_list {
|
||||||
|
fgColor,
|
||||||
|
bgColor,
|
||||||
|
minColor, /* 2 */
|
||||||
|
BlackColor = minColor,
|
||||||
|
Red3Color,
|
||||||
|
Green3Color,
|
||||||
|
Yellow3Color,
|
||||||
|
Blue3Color,
|
||||||
|
Magenta3Color,
|
||||||
|
Cyan3Color,
|
||||||
|
maxColor, /* minColor + 7 */
|
||||||
|
# ifndef NO_BRIGHTCOLOR
|
||||||
|
AntiqueWhiteColor = maxColor,
|
||||||
|
minBright, /* maxColor + 1 */
|
||||||
|
Grey25Color = minBright,
|
||||||
|
RedColor,
|
||||||
|
GreenColor,
|
||||||
|
YellowColor,
|
||||||
|
BlueColor,
|
||||||
|
MagentaColor,
|
||||||
|
CyanColor,
|
||||||
|
maxBright, /* minBright + 7 */
|
||||||
|
WhiteColor = maxBright,
|
||||||
|
# else
|
||||||
|
WhiteColor = maxColor,
|
||||||
|
# endif
|
||||||
|
# ifndef NO_CURSORCOLOR
|
||||||
|
cursorColor,
|
||||||
|
cursorColor2,
|
||||||
|
# endif
|
||||||
|
pointerColor,
|
||||||
|
borderColor,
|
||||||
|
# ifndef NO_BOLDUNDERLINE
|
||||||
|
colorBD,
|
||||||
|
colorUL,
|
||||||
|
# endif
|
||||||
|
menuTextColor,
|
||||||
|
# if defined(KEEP_SCROLLCOLOR)
|
||||||
|
scrollColor,
|
||||||
|
# if defined(CHANGE_SCROLLCOLOR_ON_FOCUS)
|
||||||
|
unfocusedScrollColor,
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
NRS_COLORS, /* */
|
||||||
|
# ifdef KEEP_SCROLLCOLOR
|
||||||
|
topShadowColor = NRS_COLORS,
|
||||||
|
bottomShadowColor,
|
||||||
|
# ifdef CHANGE_SCROLLCOLOR_ON_FOCUS
|
||||||
|
unfocusedTopShadowColor,
|
||||||
|
unfocusedBottomShadowColor,
|
||||||
|
# endif
|
||||||
|
TOTAL_COLORS /* */
|
||||||
|
# else
|
||||||
|
TOTAL_COLORS = NRS_COLORS /* */
|
||||||
|
# endif
|
||||||
|
};
|
||||||
|
|
||||||
|
# define NSHADOWCOLORS (TOTAL_COLORS - NRS_COLORS)
|
||||||
|
|
||||||
|
# define DEFAULT_RSTYLE (RS_None | (fgColor<<8) | (bgColor<<16))
|
||||||
|
|
||||||
|
extern char * rs_color [NRS_COLORS];
|
||||||
|
extern Pixel PixColors [NRS_COLORS + NSHADOWCOLORS];
|
||||||
|
|
||||||
|
# define NFONTS 5
|
||||||
|
extern const char * rs_font [NFONTS];
|
||||||
|
# ifdef KANJI
|
||||||
|
extern const char * rs_kfont [NFONTS];
|
||||||
|
# endif
|
||||||
|
# ifndef NO_BOLDFONT
|
||||||
|
extern const char * rs_boldFont;
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef PRINTPIPE
|
||||||
|
extern char *rs_print_pipe;
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef CUTCHAR_OPTION
|
||||||
|
extern char * rs_cutchars;
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* prototypes */
|
||||||
|
_XFUNCPROTOBEGIN
|
||||||
|
|
||||||
|
#ifndef GCC
|
||||||
|
extern void map_menuBar(int);
|
||||||
|
extern void map_scrollBar(int);
|
||||||
|
#else
|
||||||
|
extern inline void map_menuBar(int);
|
||||||
|
extern inline void map_scrollBar(int);
|
||||||
|
#endif
|
||||||
|
extern void xterm_seq(int, const char *);
|
||||||
|
extern void change_font(int, const char *);
|
||||||
|
extern void set_width(unsigned short);
|
||||||
|
extern void resize_window(void);
|
||||||
|
|
||||||
|
/* special (internal) prefix for font commands */
|
||||||
|
# define FONT_CMD '#'
|
||||||
|
# define FONT_DN "#-"
|
||||||
|
# define FONT_UP "#+"
|
||||||
|
|
||||||
|
# ifdef USE_IMLIB
|
||||||
|
Pixmap ReadFileToPixmapViaImlib(Display *, char *, int *, int *);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
_XFUNCPROTOEND
|
||||||
|
|
||||||
|
#endif /* whole file */
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,126 @@
|
||||||
|
/*--------------------------------*-C-*---------------------------------*
|
||||||
|
* File: menubar.h
|
||||||
|
*
|
||||||
|
* Copyright 1996,97
|
||||||
|
* mj olesen <olesen@me.QueensU.CA> Queen's Univ at Kingston
|
||||||
|
*
|
||||||
|
* You can do what you like with this source code provided you don't make
|
||||||
|
* money from it and you include an unaltered copy of this message
|
||||||
|
* (including the copyright). As usual, the author accepts no
|
||||||
|
* responsibility for anything, nor does he guarantee anything whatsoever.
|
||||||
|
*----------------------------------------------------------------------*/
|
||||||
|
#ifndef _MENUBAR_H
|
||||||
|
# define _MENUBAR_H
|
||||||
|
# include <X11/Intrinsic.h> /* Xlib, Xutil, Xresource, Xfuncproto */
|
||||||
|
# include <X11/Xfuncproto.h>
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
short state;
|
||||||
|
Window win;
|
||||||
|
} menuBar_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
short type; /* must not be changed; first element */
|
||||||
|
short len; /* strlen (str) */
|
||||||
|
unsigned char *str; /* action to take */
|
||||||
|
} action_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
short type; /* must not be changed; first element */
|
||||||
|
struct menu_t *menu; /* sub-menu */
|
||||||
|
} submenu_t;
|
||||||
|
|
||||||
|
typedef struct menuitem_t {
|
||||||
|
struct menuitem_t *prev; /* prev menu-item */
|
||||||
|
struct menuitem_t *next; /* next menu-item */
|
||||||
|
char *name; /* character string displayed */
|
||||||
|
char *name2; /* character string displayed (right) */
|
||||||
|
short len; /* strlen (name) */
|
||||||
|
short len2; /* strlen (name) */
|
||||||
|
union {
|
||||||
|
short type; /* must not be changed; first element */
|
||||||
|
action_t action;
|
||||||
|
submenu_t submenu;
|
||||||
|
} entry;
|
||||||
|
} menuitem_t;
|
||||||
|
|
||||||
|
enum menuitem_t_action {
|
||||||
|
MenuLabel,
|
||||||
|
MenuAction,
|
||||||
|
MenuTerminalAction,
|
||||||
|
MenuSubMenu
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct menu_t {
|
||||||
|
struct menu_t *parent; /* parent menu */
|
||||||
|
struct menu_t *prev; /* prev menu */
|
||||||
|
struct menu_t *next; /* next menu */
|
||||||
|
menuitem_t *head; /* double-linked list */
|
||||||
|
menuitem_t *tail; /* double-linked list */
|
||||||
|
menuitem_t *item; /* current item */
|
||||||
|
char *name; /* menu name */
|
||||||
|
short len; /* strlen (name) */
|
||||||
|
short width; /* maximum menu width [chars] */
|
||||||
|
Window win; /* window of the menu */
|
||||||
|
short x; /* x location [pixels] (chars if parent == NULL) */
|
||||||
|
short y; /* y location [pixels] */
|
||||||
|
short w, h; /* window width, height [pixels] */
|
||||||
|
} menu_t;
|
||||||
|
|
||||||
|
typedef struct bar_t {
|
||||||
|
menu_t *head, *tail; /* double-linked list of menus */
|
||||||
|
char *title; /* title to put in the empty menuBar */
|
||||||
|
# if (MENUBAR_MAX > 1)
|
||||||
|
# define MAXNAME 16
|
||||||
|
char name[MAXNAME]; /* name to use to refer to menubar */
|
||||||
|
struct bar_t *next, *prev; /* circular linked-list */
|
||||||
|
# endif /* (MENUBAR_MAX > 1) */
|
||||||
|
# define NARROWS 4
|
||||||
|
action_t arrows[NARROWS];
|
||||||
|
} bar_t;
|
||||||
|
|
||||||
|
extern menuBar_t menuBar;
|
||||||
|
extern int delay_menu_drawing;
|
||||||
|
|
||||||
|
# define menuBar_margin 2 /* margin below text */
|
||||||
|
# ifdef PIXMAP_MENUBAR
|
||||||
|
# define menubar_is_pixmapped() (0)
|
||||||
|
# else
|
||||||
|
# define menubar_is_pixmapped() (0)
|
||||||
|
# endif
|
||||||
|
/* macros */
|
||||||
|
#define menubar_visible() (menuBar.state)
|
||||||
|
#define menuBar_height() (TermWin.fheight + SHADOW)
|
||||||
|
#define menuBar_TotalHeight() (menuBar_height() + SHADOW + menuBar_margin)
|
||||||
|
#define menuBar_TotalWidth() (2 * TermWin.internalBorder + TermWin.width)
|
||||||
|
#define isMenuBarWindow(w) ((w) == menuBar.win)
|
||||||
|
|
||||||
|
_XFUNCPROTOBEGIN
|
||||||
|
|
||||||
|
extern void
|
||||||
|
menubar_control (XButtonEvent * /* ev */);
|
||||||
|
|
||||||
|
extern void
|
||||||
|
menubar_dispatch (char * /* str */);
|
||||||
|
|
||||||
|
extern void
|
||||||
|
menubar_expose (void);
|
||||||
|
|
||||||
|
extern int
|
||||||
|
menubar_mapping (int /* map */);
|
||||||
|
|
||||||
|
_XFUNCPROTOEND
|
||||||
|
|
||||||
|
#if !(MENUBAR_MAX)
|
||||||
|
# define menubar_dispatch(str) ((void)0)
|
||||||
|
# define menubar_expose() ((void)0)
|
||||||
|
# define menubar_control(ev) ((void)0)
|
||||||
|
# define menubar_mapping(map) (0)
|
||||||
|
# undef menubar_visible
|
||||||
|
# define menubar_visible() (0)
|
||||||
|
# undef isMenuBarWindow
|
||||||
|
# define isMenuBarWindow(w) (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _MENUBAR_H */
|
||||||
|
/*----------------------- end-of-file (C header) -----------------------*/
|
|
@ -0,0 +1,379 @@
|
||||||
|
/*--------------------------------*-C-*---------------------------------*
|
||||||
|
* File: misc.c
|
||||||
|
*
|
||||||
|
* miscellaneous service routines
|
||||||
|
*
|
||||||
|
* Copyright 1996,97
|
||||||
|
* mj olesen <olesen@me.QueensU.CA> Queen's Univ at Kingston
|
||||||
|
*
|
||||||
|
* You can do what you like with this source code provided you don't make
|
||||||
|
* money from it and you include an unaltered copy of this message
|
||||||
|
* (including the copyright). As usual, the author accepts no
|
||||||
|
* responsibility for anything, nor does he guarantee anything whatsoever.
|
||||||
|
*----------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
static const char cvs_ident[] = "$Id$";
|
||||||
|
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include "command.h"
|
||||||
|
#include "main.h"
|
||||||
|
#include "misc.h"
|
||||||
|
#include "debug.h"
|
||||||
|
#include "../libmej/debug.h"
|
||||||
|
#include "../libmej/strings.h"
|
||||||
|
#include "mem.h"
|
||||||
|
#include "options.h"
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------*/
|
||||||
|
const char *
|
||||||
|
my_basename(const char *str)
|
||||||
|
{
|
||||||
|
|
||||||
|
const char *base = strrchr(str, '/');
|
||||||
|
|
||||||
|
return (base ? base + 1 : str);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Print a non-terminal error message */
|
||||||
|
void
|
||||||
|
print_error(const char *fmt,...)
|
||||||
|
{
|
||||||
|
|
||||||
|
va_list arg_ptr;
|
||||||
|
|
||||||
|
va_start(arg_ptr, fmt);
|
||||||
|
fprintf(stderr, APL_NAME ": ");
|
||||||
|
vfprintf(stderr, fmt, arg_ptr);
|
||||||
|
fprintf(stderr, "\n");
|
||||||
|
va_end(arg_ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Print a simple warning. */
|
||||||
|
void
|
||||||
|
print_warning(const char *fmt,...)
|
||||||
|
{
|
||||||
|
|
||||||
|
va_list arg_ptr;
|
||||||
|
|
||||||
|
va_start(arg_ptr, fmt);
|
||||||
|
fprintf(stderr, APL_NAME ": warning: ");
|
||||||
|
vfprintf(stderr, fmt, arg_ptr);
|
||||||
|
fprintf(stderr, "\n");
|
||||||
|
va_end(arg_ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Print a fatal error message and terminate */
|
||||||
|
void
|
||||||
|
fatal_error(const char *fmt,...)
|
||||||
|
{
|
||||||
|
|
||||||
|
va_list arg_ptr;
|
||||||
|
|
||||||
|
va_start(arg_ptr, fmt);
|
||||||
|
fprintf(stderr, APL_NAME ": FATAL: ");
|
||||||
|
vfprintf(stderr, fmt, arg_ptr);
|
||||||
|
fprintf(stderr, "\n");
|
||||||
|
va_end(arg_ptr);
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Compares the first n characters of s1 and s2, where n is strlen(s2)
|
||||||
|
* Returns strlen(s2) if they match, 0 if not.
|
||||||
|
*/
|
||||||
|
unsigned long
|
||||||
|
str_leading_match(register const char *s1, register const char *s2)
|
||||||
|
{
|
||||||
|
|
||||||
|
register unsigned long n;
|
||||||
|
|
||||||
|
if (!s1 || !s2) {
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
for (n = 0; *s2; n++, s1++, s2++) {
|
||||||
|
if (*s1 != *s2) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Strip leading and trailing whitespace and quotes from a string */
|
||||||
|
char *
|
||||||
|
str_trim(char *str)
|
||||||
|
{
|
||||||
|
|
||||||
|
register char *tmp = str;
|
||||||
|
size_t n;
|
||||||
|
|
||||||
|
if (str && *str) {
|
||||||
|
|
||||||
|
chomp(str);
|
||||||
|
n = strlen(str);
|
||||||
|
|
||||||
|
if (!n) {
|
||||||
|
*str = 0;
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
/* strip leading/trailing quotes */
|
||||||
|
if (*tmp == '"') {
|
||||||
|
tmp++;
|
||||||
|
n--;
|
||||||
|
if (!n) {
|
||||||
|
*str = 0;
|
||||||
|
return str;
|
||||||
|
} else if (tmp[n - 1] == '"') {
|
||||||
|
tmp[--n] = '\0';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (tmp != str) {
|
||||||
|
memmove(str, tmp, (strlen(tmp)) + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* in-place interpretation of string:
|
||||||
|
*
|
||||||
|
* backslash-escaped: "\a\b\E\e\n\r\t", "\octal"
|
||||||
|
* Ctrl chars: ^@ .. ^_, ^?
|
||||||
|
*
|
||||||
|
* Emacs-style: "M-" prefix
|
||||||
|
*
|
||||||
|
* Also,
|
||||||
|
* "M-x" prefixed strings, append "\r" if needed
|
||||||
|
* "\E]" prefixed strings (XTerm escape sequence) append "\a" if needed
|
||||||
|
*
|
||||||
|
* returns the converted string length
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define MAKE_CTRL_CHAR(c) ((c) == '?' ? 127 : ((toupper(c)) - '@'))
|
||||||
|
|
||||||
|
int
|
||||||
|
parse_escaped_string(char *str)
|
||||||
|
{
|
||||||
|
|
||||||
|
register char *pold, *pnew;
|
||||||
|
unsigned char i;
|
||||||
|
|
||||||
|
D_MENUBAR(("parse_escaped_string(\"%s\")\n", str));
|
||||||
|
|
||||||
|
for (pold = pnew = str; *pold; pold++, pnew++) {
|
||||||
|
D_MENUBAR(("Looking at \"%s\"\n", pold));
|
||||||
|
if (!BEG_STRCASECMP(pold, "m-")) {
|
||||||
|
*pold = '\\';
|
||||||
|
*(pold + 1) = 'e';
|
||||||
|
} else if (!BEG_STRCASECMP(pold, "c-")) {
|
||||||
|
*(++pold) = '^';
|
||||||
|
}
|
||||||
|
D_MENUBAR(("Operating on \'%c\'\n", *pold));
|
||||||
|
switch (*pold) {
|
||||||
|
case '\\':
|
||||||
|
D_MENUBAR(("Backslash + %c\n", *(pold + 1)));
|
||||||
|
switch (tolower(*(++pold))) {
|
||||||
|
case '0':
|
||||||
|
case '1':
|
||||||
|
case '2':
|
||||||
|
case '3':
|
||||||
|
case '4':
|
||||||
|
case '5':
|
||||||
|
case '6':
|
||||||
|
case '7':
|
||||||
|
for (i = 0; *pold >= '0' && *pold <= '7'; pold++) {
|
||||||
|
i = (i * 8) + (*pold - '0');
|
||||||
|
}
|
||||||
|
pold--;
|
||||||
|
D_MENUBAR(("Octal number evaluates to %d\n", i));
|
||||||
|
*pnew = i;
|
||||||
|
break;
|
||||||
|
case 'n':
|
||||||
|
*pnew = '\n';
|
||||||
|
break;
|
||||||
|
case 'r':
|
||||||
|
*pnew = '\r';
|
||||||
|
break;
|
||||||
|
case 't':
|
||||||
|
*pnew = '\t';
|
||||||
|
break;
|
||||||
|
case 'b':
|
||||||
|
*pnew = '\b';
|
||||||
|
break;
|
||||||
|
case 'f':
|
||||||
|
*pnew = '\f';
|
||||||
|
break;
|
||||||
|
case 'a':
|
||||||
|
*pnew = '\a';
|
||||||
|
break;
|
||||||
|
case 'v':
|
||||||
|
*pnew = '\v';
|
||||||
|
break;
|
||||||
|
case 'e':
|
||||||
|
*pnew = '\033';
|
||||||
|
break;
|
||||||
|
case 'c':
|
||||||
|
pold++;
|
||||||
|
*pnew = MAKE_CTRL_CHAR(*pold);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
*pnew = *pold;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case '^':
|
||||||
|
D_MENUBAR(("Caret + %c\n", *(pold + 1)));
|
||||||
|
pold++;
|
||||||
|
*pnew = MAKE_CTRL_CHAR(*pold);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
*pnew = *pold;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!BEG_STRCASECMP(str, "\033x") && *(pnew - 1) != '\r') {
|
||||||
|
D_MENUBAR(("Adding carriage return\n"));
|
||||||
|
*(pnew++) = '\r';
|
||||||
|
} else if (!BEG_STRCASECMP(str, "\0\e]") && *(pnew - 1) != '\a') {
|
||||||
|
D_MENUBAR(("Adding bell character\n"));
|
||||||
|
*(pnew++) = '\a';
|
||||||
|
}
|
||||||
|
*pnew = 0;
|
||||||
|
|
||||||
|
#if DEBUG >= DEBUG_MENU
|
||||||
|
if (debug_level >= DEBUG_MENU) {
|
||||||
|
D_MENUBAR(("New value is:\n\n"));
|
||||||
|
HexDump(str, (size_t) (pnew - str));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return (pnew - str);
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *
|
||||||
|
find_file(const char *file, const char *ext)
|
||||||
|
{
|
||||||
|
|
||||||
|
const char *f;
|
||||||
|
|
||||||
|
#if defined(PIXMAP_SUPPORT) || (MENUBAR_MAX)
|
||||||
|
if ((f = search_path(rs_path, file, ext)) != NULL) {
|
||||||
|
return (f);
|
||||||
|
} else
|
||||||
|
# ifdef PATH_ENV
|
||||||
|
if ((f = search_path(getenv(PATH_ENV), file, ext)) != NULL) {
|
||||||
|
return (f);
|
||||||
|
} else
|
||||||
|
# endif
|
||||||
|
if ((f = search_path(getenv("PATH"), file, ext)) != NULL) {
|
||||||
|
return (f);
|
||||||
|
} else {
|
||||||
|
return (search_path(initial_dir, file, ext));
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
return ((const char *) NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------*
|
||||||
|
* miscellaneous drawing routines
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* draw bottomShadow/highlight along top/left sides of the window
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
Draw_tl(Window win, GC gc, int x, int y, int w, int h)
|
||||||
|
{
|
||||||
|
|
||||||
|
int shadow = SHADOW;
|
||||||
|
|
||||||
|
if (w == 0 || h == 0) {
|
||||||
|
shadow = 1;
|
||||||
|
}
|
||||||
|
w += (x - 1);
|
||||||
|
h += (y - 1);
|
||||||
|
|
||||||
|
for (; shadow > 0; shadow--, x++, y++, w--, h--) {
|
||||||
|
XDrawLine(Xdisplay, win, gc, x, y, w, y);
|
||||||
|
XDrawLine(Xdisplay, win, gc, x, y, x, h);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* draw bottomShadow/highlight along the bottom/right sides of the window
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
Draw_br(Window win, GC gc, int x, int y, int w, int h)
|
||||||
|
{
|
||||||
|
|
||||||
|
int shadow = SHADOW;
|
||||||
|
|
||||||
|
if (w == 0 || h == 0) {
|
||||||
|
shadow = 1;
|
||||||
|
}
|
||||||
|
w += (x - 1);
|
||||||
|
h += (y - 1);
|
||||||
|
x++;
|
||||||
|
y++;
|
||||||
|
|
||||||
|
for (; shadow > 0; shadow--, x++, y++, w--, h--) {
|
||||||
|
XDrawLine(Xdisplay, win, gc, w, h, w, y);
|
||||||
|
XDrawLine(Xdisplay, win, gc, w, h, x, h);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Draw_Shadow(Window win, GC topShadow, GC botShadow, int x, int y, int w, int h)
|
||||||
|
{
|
||||||
|
|
||||||
|
Draw_tl(win, topShadow, x, y, w, h);
|
||||||
|
Draw_br(win, botShadow, x, y, w, h);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* button shapes */
|
||||||
|
void
|
||||||
|
Draw_Triangle(Window win, GC topShadow, GC botShadow, int x, int y, int w, int type)
|
||||||
|
{
|
||||||
|
switch (type) {
|
||||||
|
case 'r': /* right triangle */
|
||||||
|
XDrawLine(Xdisplay, win, topShadow, x, y, x, y + w);
|
||||||
|
XDrawLine(Xdisplay, win, topShadow, x, y, x + w, y + w / 2);
|
||||||
|
XDrawLine(Xdisplay, win, botShadow, x, y + w, x + w, y + w / 2);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'l': /* left triangle */
|
||||||
|
XDrawLine(Xdisplay, win, botShadow, x + w, y + w, x + w, y);
|
||||||
|
XDrawLine(Xdisplay, win, botShadow, x + w, y + w, x, y + w / 2);
|
||||||
|
XDrawLine(Xdisplay, win, topShadow, x, y + w / 2, x + w, y);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'd': /* down triangle */
|
||||||
|
XDrawLine(Xdisplay, win, topShadow, x, y, x + w / 2, y + w);
|
||||||
|
XDrawLine(Xdisplay, win, topShadow, x, y, x + w, y);
|
||||||
|
XDrawLine(Xdisplay, win, botShadow, x + w, y, x + w / 2, y + w);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'u': /* up triangle */
|
||||||
|
XDrawLine(Xdisplay, win, botShadow, x + w, y + w, x + w / 2, y);
|
||||||
|
XDrawLine(Xdisplay, win, botShadow, x + w, y + w, x, y + w);
|
||||||
|
XDrawLine(Xdisplay, win, topShadow, x, y + w, x + w / 2, y);
|
||||||
|
break;
|
||||||
|
#if 0
|
||||||
|
case 's': /* square */
|
||||||
|
XDrawLine(Xdisplay, win, topShadow, x + w, y, x, y);
|
||||||
|
XDrawLine(Xdisplay, win, topShadow, x, y, x, y + w);
|
||||||
|
XDrawLine(Xdisplay, win, botShadow, x, y + w, x + w, y + w);
|
||||||
|
XDrawLine(Xdisplay, win, botShadow, x + w, y + w, x + w, y);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*----------------------- end-of-file (C source) -----------------------*/
|
|
@ -0,0 +1,38 @@
|
||||||
|
/*--------------------------------*-C-*---------------------------------*
|
||||||
|
* File: misc.h
|
||||||
|
*
|
||||||
|
* miscellaneous service routines
|
||||||
|
*
|
||||||
|
* Copyright 1996,97
|
||||||
|
* mj olesen <olesen@me.QueensU.CA> Queen's Univ at Kingston
|
||||||
|
*
|
||||||
|
* You can do what you like with this source code provided you don't make
|
||||||
|
* money from it and you include an unaltered copy of this message
|
||||||
|
* (including the copyright). As usual, the author accepts no
|
||||||
|
* responsibility for anything, nor does he guarantee anything whatsoever.
|
||||||
|
*----------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef _MISC_H_
|
||||||
|
#define _MISC_H_
|
||||||
|
#include <X11/Xfuncproto.h>
|
||||||
|
|
||||||
|
/* prototypes */
|
||||||
|
_XFUNCPROTOBEGIN
|
||||||
|
|
||||||
|
const char *my_basename(const char *str);
|
||||||
|
void print_error(const char *fmt,...);
|
||||||
|
void print_warning(const char *fmt,...);
|
||||||
|
void fatal_error(const char *fmt,...);
|
||||||
|
unsigned long str_leading_match(register const char *, register const char *);
|
||||||
|
char *str_trim(char *str);
|
||||||
|
int parse_escaped_string(char *str);
|
||||||
|
const char *search_path(const char *pathlist, const char *file, const char *ext);
|
||||||
|
const char *find_file(const char *file, const char *ext);
|
||||||
|
void Draw_tl(Window win, GC gc, int x, int y, int w, int h);
|
||||||
|
void Draw_br(Window win, GC gc, int x, int y, int w, int h);
|
||||||
|
void Draw_Shadow(Window win, GC topShadow, GC botShadow, int x, int y, int w, int h);
|
||||||
|
void Draw_Triangle(Window win, GC topShadow, GC botShadow, int x, int y, int w, int type);
|
||||||
|
|
||||||
|
_XFUNCPROTOEND
|
||||||
|
|
||||||
|
#endif /* whole file */
|
|
@ -0,0 +1,148 @@
|
||||||
|
/*--------------------------------*-C-*---------------------------------*
|
||||||
|
* File: netdisp.c
|
||||||
|
*/
|
||||||
|
/*{{{ notes: */
|
||||||
|
/*----------------------------------------------------------------------*
|
||||||
|
* support for resolving the actual IP number of the host for remote
|
||||||
|
* DISPLAYs. When the display is local (i.e. :0), we add support for
|
||||||
|
* sending the first non-loopback interface IP number as the DISPLAY
|
||||||
|
* instead of just sending the incorrect ":0". This way telnet/rlogin
|
||||||
|
* shells can actually get the correct information into DISPLAY for
|
||||||
|
* xclients.
|
||||||
|
*
|
||||||
|
* Copyright 1996 Chuck Blake <cblake@BBN.COM>
|
||||||
|
*
|
||||||
|
+ * Cleaned up somewhat by mj olesen <olesen@me.queensu.ca>
|
||||||
|
+ *
|
||||||
|
* You can do what you like with this source code as long as you don't try
|
||||||
|
* to make money out of it and you include an unaltered copy of this
|
||||||
|
* message (including the copyright).
|
||||||
|
*
|
||||||
|
* As usual, the author accepts no responsibility for anything, nor does
|
||||||
|
* he guarantee anything whatsoever.
|
||||||
|
*----------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
static const char cvs_ident[] = "$Id$";
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#include "feature.h"
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
|
/* Put in a dummy routine if this is disabled, inline it if possible */
|
||||||
|
#ifndef DISPLAY_IS_IP
|
||||||
|
inline const char *
|
||||||
|
network_display(const char *display)
|
||||||
|
{
|
||||||
|
return (display);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
/*{{{ includes */
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#ifdef HAVE_FCNTL_H
|
||||||
|
# include <fcntl.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
# include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* On Solaris link with -lsocket and -lnsl */
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
|
||||||
|
/* these next two are probably only on Sun (not Solaris) */
|
||||||
|
#ifdef HAVE_SYS_SOCKIO_H
|
||||||
|
# include <sys/sockio.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_SYS_BYTEORDER_H
|
||||||
|
# include <sys/byteorder.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef TIME_WITH_SYS_TIME
|
||||||
|
# include <sys/time.h>
|
||||||
|
# include <time.h>
|
||||||
|
#else
|
||||||
|
# ifdef HAVE_SYS_TIME_H
|
||||||
|
# include <sys/time.h>
|
||||||
|
# else
|
||||||
|
# include <time.h>
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_SYS_IOCTL_H
|
||||||
|
# include <sys/ioctl.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
#include <net/if.h>
|
||||||
|
#include <net/if_arp.h>
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------*/
|
||||||
|
/* return a pointer to a static buffer */
|
||||||
|
char *
|
||||||
|
network_display(const char *display)
|
||||||
|
{
|
||||||
|
|
||||||
|
static char ipaddress[32] = "";
|
||||||
|
char buffer[1024], *rval = NULL;
|
||||||
|
struct ifconf ifc;
|
||||||
|
struct ifreq *ifr;
|
||||||
|
int i, skfd;
|
||||||
|
|
||||||
|
if (display[0] != ':' && strncmp(display, "unix:", 5))
|
||||||
|
return display; /* nothing to do */
|
||||||
|
|
||||||
|
ifc.ifc_len = sizeof(buffer); /* Get names of all ifaces */
|
||||||
|
ifc.ifc_buf = buffer;
|
||||||
|
|
||||||
|
if ((skfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
|
||||||
|
perror("socket");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
if (ioctl(skfd, SIOCGIFCONF, &ifc) < 0) {
|
||||||
|
perror("SIOCGIFCONF");
|
||||||
|
close(skfd);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
for (i = 0, ifr = ifc.ifc_req; i < (ifc.ifc_len / sizeof(struct ifreq)); i++, ifr++) {
|
||||||
|
|
||||||
|
struct ifreq ifr2;
|
||||||
|
|
||||||
|
strcpy(ifr2.ifr_name, ifr->ifr_name);
|
||||||
|
if (ioctl(skfd, SIOCGIFADDR, &ifr2) >= 0) {
|
||||||
|
unsigned long addr;
|
||||||
|
struct sockaddr_in *p_addr;
|
||||||
|
|
||||||
|
p_addr = (struct sockaddr_in *) &(ifr2.ifr_addr);
|
||||||
|
addr = htonl((unsigned long) p_addr->sin_addr.s_addr);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* not "0.0.0.0" or "127.0.0.1" - so format the address
|
||||||
|
*/
|
||||||
|
if (addr && addr != 0x7F000001) {
|
||||||
|
char *colon = strchr(display, ':');
|
||||||
|
|
||||||
|
if (colon == NULL)
|
||||||
|
colon = ":0.0";
|
||||||
|
|
||||||
|
sprintf(ipaddress, "%d.%d.%d.%d%s",
|
||||||
|
(int) ((addr >> 030) & 0xFF),
|
||||||
|
(int) ((addr >> 020) & 0xFF),
|
||||||
|
(int) ((addr >> 010) & 0xFF),
|
||||||
|
(int) (addr & 0xFF), colon);
|
||||||
|
|
||||||
|
rval = ipaddress;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
close(skfd);
|
||||||
|
return rval;
|
||||||
|
}
|
||||||
|
#endif /* DISPLAY_IS_IP */
|
||||||
|
/*----------------------- end-of-file (C source) -----------------------*/
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,107 @@
|
||||||
|
/* options.h -- Eterm options module header file
|
||||||
|
* -- 25 July 1997, mej
|
||||||
|
*
|
||||||
|
* This file is original work by Michael Jennings <mej@tcserv.com> and
|
||||||
|
* Tuomo Venalainen <vendu@cc.hut.fi>. This file, and any other file
|
||||||
|
* bearing this same message or a similar one, is distributed under
|
||||||
|
* the GNU Public License (GPL) as outlined in the COPYING file.
|
||||||
|
*
|
||||||
|
* Copyright (C) 1997, Michael Jennings and Tuomo Venalainen
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _OPTIONS_H_
|
||||||
|
#define _OPTIONS_H_
|
||||||
|
/* includes */
|
||||||
|
#include <X11/Xfuncproto.h>
|
||||||
|
#include <X11/Intrinsic.h> /* Xlib, Xutil, Xresource, Xfuncproto */
|
||||||
|
#include "feature.h"
|
||||||
|
|
||||||
|
/* prototypes */
|
||||||
|
unsigned long NumWords(const char *str);
|
||||||
|
|
||||||
|
/* extern variables */
|
||||||
|
extern char **rs_execArgs; /* Args to exec (-e or --exec) */
|
||||||
|
extern char *rs_title; /* Window title */
|
||||||
|
extern char *rs_iconName; /* Icon name */
|
||||||
|
extern char *rs_geometry; /* Geometry string */
|
||||||
|
extern int rs_desktop; /* Startup desktop */
|
||||||
|
extern int rs_saveLines; /* Lines in the scrollback buffer */
|
||||||
|
extern unsigned short rs_min_anchor_size; /* Minimum size, in pixels, of the scrollbar anchor */
|
||||||
|
extern const char *rs_scrollBar_right;
|
||||||
|
extern const char *rs_scrollBar_floating;
|
||||||
|
extern const char *rs_scrollbar_popup;
|
||||||
|
extern char *rs_viewport_mode;
|
||||||
|
extern const char *rs_term_name;
|
||||||
|
extern const char *rs_menubar;
|
||||||
|
extern const char *rs_menu;
|
||||||
|
extern const char *rs_menubar_move;
|
||||||
|
extern const char *rs_pause;
|
||||||
|
extern char *rs_icon;
|
||||||
|
extern char *rs_scrollbar_type;
|
||||||
|
extern unsigned long rs_scrollbar_width;
|
||||||
|
extern char *rs_scrollbar_type;
|
||||||
|
extern char *rs_anim_pixmap_list;
|
||||||
|
extern char **rs_anim_pixmaps;
|
||||||
|
extern time_t rs_anim_delay;
|
||||||
|
extern char *rs_path;
|
||||||
|
|
||||||
|
extern const char *true_vals[];
|
||||||
|
extern const char *false_vals[];
|
||||||
|
#define BOOL_OPT_ISTRUE(s) (!strcasecmp((s), true_vals[0]) || !strcasecmp((s), true_vals[1]) \
|
||||||
|
|| !strcasecmp((s), true_vals[2]) || !strcasecmp((s), true_vals[3]))
|
||||||
|
#define BOOL_OPT_ISFALSE(s) (!strcasecmp((s), false_vals[0]) || !strcasecmp((s), false_vals[1]) \
|
||||||
|
|| !strcasecmp((s), false_vals[2]) || !strcasecmp((s), false_vals[3]))
|
||||||
|
|
||||||
|
#ifdef CUTCHAR_OPTION
|
||||||
|
extern char *rs_cutchars;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef KEYSYM_ATTRIBUTE
|
||||||
|
extern unsigned char *KeySym_map[256];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined (HOTKEY_CTRL) || defined (HOTKEY_META)
|
||||||
|
extern KeySym ks_bigfont;
|
||||||
|
extern KeySym ks_smallfont;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PIXMAP_SUPPORT
|
||||||
|
extern char *rs_pixmaps[];
|
||||||
|
|
||||||
|
#define pixmap_bg 0
|
||||||
|
#define pixmap_sb 1
|
||||||
|
#define pixmap_up 2
|
||||||
|
#define pixmap_upclk 3
|
||||||
|
#define pixmap_dn 4
|
||||||
|
#define pixmap_dnclk 5
|
||||||
|
#define pixmap_sa 6
|
||||||
|
#define pixmap_saclk 7
|
||||||
|
#define pixmap_mb 8
|
||||||
|
#define pixmap_ms 9
|
||||||
|
#endif /* PIXMAP_SUPPORT */
|
||||||
|
|
||||||
|
/* prototypes */
|
||||||
|
_XFUNCPROTOBEGIN
|
||||||
|
|
||||||
|
extern void get_options(int, char **);
|
||||||
|
extern char *chomp(char *);
|
||||||
|
extern void read_config(void);
|
||||||
|
|
||||||
|
_XFUNCPROTOEND
|
||||||
|
|
||||||
|
#endif /* _OPTIONS_H_ */
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,89 @@
|
||||||
|
/* pixmap.h for Eterm.
|
||||||
|
* 17 Feb 1998 vendu
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _PIXMAP_H
|
||||||
|
# define _PIXMAP_H
|
||||||
|
|
||||||
|
#include <X11/Xatom.h>
|
||||||
|
|
||||||
|
# ifdef USE_IMLIB
|
||||||
|
# include "eterm_imlib.h"
|
||||||
|
# endif
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
short w, h, x, y;
|
||||||
|
Pixmap pixmap;
|
||||||
|
} pixmap_t;
|
||||||
|
|
||||||
|
# ifdef USE_IMLIB
|
||||||
|
typedef struct {
|
||||||
|
Image *im;
|
||||||
|
int last_w,last_h;
|
||||||
|
} imlib_t;
|
||||||
|
|
||||||
|
# define background_is_pixmap() ((imlib_id != NULL) || Options & Opt_pixmapTrans)
|
||||||
|
# define background_is_image() (imlib_bg.im != NULL)
|
||||||
|
|
||||||
|
# else
|
||||||
|
|
||||||
|
# define background_is_pixmap() ((int)0)
|
||||||
|
# define background_is_image() ((int)0)
|
||||||
|
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef USE_IMLIB
|
||||||
|
extern imlib_t imlib_bg;
|
||||||
|
extern ImlibData *imlib_id;
|
||||||
|
# ifdef PIXMAP_SCROLLBAR
|
||||||
|
imlib_t imlib_sb, imlib_sa, imlib_saclk;
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
pixmap_t bgPixmap;
|
||||||
|
# ifdef PIXMAP_SCROLLBAR
|
||||||
|
pixmap_t sbPixmap;
|
||||||
|
pixmap_t upPixmap, up_clkPixmap;
|
||||||
|
pixmap_t dnPixmap, dn_clkPixmap;
|
||||||
|
pixmap_t saPixmap, sa_clkPixmap;
|
||||||
|
# endif
|
||||||
|
|
||||||
|
typedef short renderop_t;
|
||||||
|
|
||||||
|
# ifdef PIXMAP_OFFSET
|
||||||
|
enum { FAKE_TRANSPARENCY };
|
||||||
|
enum { tint_none, tint_red, tint_green, tint_blue,
|
||||||
|
tint_cyan, tint_magenta, tint_yellow };
|
||||||
|
|
||||||
|
# ifdef USE_IMLIB
|
||||||
|
void render_pixmap(Window win, imlib_t image, pixmap_t pmap,
|
||||||
|
int which, renderop_t renderop);
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef USE_POSIX_THREADS
|
||||||
|
void init_bg_pixmap_thread(void *file);
|
||||||
|
# endif
|
||||||
|
void set_bgPixmap(const char *file);
|
||||||
|
void set_Pixmap(const char *file, Pixmap dest_pmap, int type);
|
||||||
|
int scale_pixmap(const char *geom, pixmap_t *pmap);
|
||||||
|
# ifdef USE_IMLIB
|
||||||
|
void colormod_pixmap(imlib_t, GC, int, int);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef PIXMAP_OFFSET
|
||||||
|
# ifdef IMLIB_TRANS
|
||||||
|
void colormod_trans(imlib_t, GC, int, int);
|
||||||
|
# else
|
||||||
|
void colormod_trans(Pixmap, GC, int, int);
|
||||||
|
# endif
|
||||||
|
Window get_desktop_window(void);
|
||||||
|
Pixmap get_desktop_pixmap(void);
|
||||||
|
extern Window desktop_window;
|
||||||
|
# endif
|
||||||
|
extern void shaped_window_apply_mask(Window, Pixmap);
|
||||||
|
extern void set_icon_pixmap(char *, XWMHints *);
|
||||||
|
# ifdef USE_IMLIB
|
||||||
|
extern ImlibImage *ReadImageViaImlib(Display *, const char *);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
#endif /* _PIXMAP_H */
|
|
@ -0,0 +1,80 @@
|
||||||
|
/* profile.h for Eterm.
|
||||||
|
* 25 Mar 1998, vendu.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _PROFILE_H
|
||||||
|
# define _PROFILE_H
|
||||||
|
|
||||||
|
/* included for a possible #define PROFILE */
|
||||||
|
/* # include "feature.h" */
|
||||||
|
# include <stdio.h>
|
||||||
|
# include <sys/time.h>
|
||||||
|
# include <unistd.h>
|
||||||
|
|
||||||
|
/* NOTE: if PROFILE is not defined, all macros in this file will
|
||||||
|
* be set to (void)0 so they won't get compiled into binaries.
|
||||||
|
*/
|
||||||
|
#define PROFILE
|
||||||
|
# ifdef PROFILE
|
||||||
|
|
||||||
|
/* Data structures */
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
long long total;
|
||||||
|
struct timeval start;
|
||||||
|
struct timeval stop;
|
||||||
|
} P_counter_t;
|
||||||
|
|
||||||
|
/* Profiling macros */
|
||||||
|
|
||||||
|
/* Sets tv to current time.
|
||||||
|
* struct timeval tv;
|
||||||
|
* Usage: P_SETTIMEVAL(struct timeval tv);
|
||||||
|
*/
|
||||||
|
# define P_SETTIMEVAL(tv) gettimeofday(&(tv), NULL)
|
||||||
|
|
||||||
|
/* NOT FINISHED YET */
|
||||||
|
# define P_UPDATETOTAL(cnt) { \
|
||||||
|
cnt.total += P_CMPTIMEVALS_USEC(cnt.start, cnt.stop); \
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Declare cnt and initialize by setting to zero.
|
||||||
|
* P_counter_t cnt;
|
||||||
|
* Usage: P_INITCOUNTER(counter);
|
||||||
|
* NOTES: cnt will be declared. This means that you'll
|
||||||
|
* probably need to localize a block where to use this; see
|
||||||
|
* the definition of P_CALL() elsewhere in this file.
|
||||||
|
*/
|
||||||
|
# define P_INITCOUNTER(cnt) \
|
||||||
|
P_counter_t cnt = { 0, { 0, 0 }, { 0, 0 } }
|
||||||
|
/* Time from start to stop in microseconds
|
||||||
|
* struct timeval start, stop;
|
||||||
|
*/
|
||||||
|
# define P_CMPTIMEVALS_USEC(start, stop) \
|
||||||
|
((stop.tv_sec - start.tv_sec)*1000000 \
|
||||||
|
+ (stop.tv_usec - start.tv_usec))
|
||||||
|
|
||||||
|
/* Counts the time spent in the call f and outputs
|
||||||
|
* str: <time spent in f in microseconds> to stderr.
|
||||||
|
* NOTE: f can be any function call, for example sqrt(5).
|
||||||
|
*/
|
||||||
|
# define P_CALL(f, str) { \
|
||||||
|
P_INITCOUNTER(cnt); \
|
||||||
|
P_SETTIMEVAL(cnt.start); \
|
||||||
|
f; \
|
||||||
|
P_SETTIMEVAL(cnt.stop); \
|
||||||
|
fprintf(stderr, "%s: %ld\n", str, \
|
||||||
|
P_CMPTIMEVALS_USEC(cnt.start, cnt.stop)); \
|
||||||
|
}
|
||||||
|
|
||||||
|
# else /* PROFILE */
|
||||||
|
|
||||||
|
# define P_SETTIMEVAL(tv) ((void)0)
|
||||||
|
# define P_UPDATETOTAL(cnt) ((void)0)
|
||||||
|
# define P_INITCOUNTER(cnt) ((void)0)
|
||||||
|
# define P_CMPTIMEVALS_USEC(start, stop) ((void)0)
|
||||||
|
# define P_CALL(f, str) f
|
||||||
|
|
||||||
|
# endif /* PROFILE */
|
||||||
|
|
||||||
|
#endif /* _PROFILE_H */
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,261 @@
|
||||||
|
/*--------------------------------*-C-*---------------------------------*
|
||||||
|
* File: screen.h
|
||||||
|
*
|
||||||
|
* This module is all new by Robert Nation
|
||||||
|
* <nation@rocket.sanders.lockheed.com>
|
||||||
|
*
|
||||||
|
* Additional modifications by mj olesen <olesen@me.QueensU.CA>
|
||||||
|
* No additional restrictions are applied.
|
||||||
|
*
|
||||||
|
* As usual, the author accepts no responsibility for anything, nor does
|
||||||
|
* he guarantee anything whatsoever.
|
||||||
|
*----------------------------------------------------------------------*/
|
||||||
|
#ifndef _SCREEN_H
|
||||||
|
#define _SCREEN_H
|
||||||
|
/* includes */
|
||||||
|
#include <X11/Xfuncproto.h>
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
|
/* defines */
|
||||||
|
/* Screen refresh methods */
|
||||||
|
#define NO_REFRESH 0 /* Window not visible at all! */
|
||||||
|
#define FAST_REFRESH (1<<1) /* Fully exposed window */
|
||||||
|
#define SLOW_REFRESH (1<<2) /* Partially exposed window */
|
||||||
|
#define SMOOTH_REFRESH (1<<3) /* Do sync'ing to make it smooth */
|
||||||
|
|
||||||
|
#define IGNORE 0
|
||||||
|
#define SAVE 's'
|
||||||
|
#define RESTORE 'r'
|
||||||
|
#define REVERT IGNORE
|
||||||
|
#define INVOKE RESTORE
|
||||||
|
extern void privileges(int);
|
||||||
|
|
||||||
|
/* flags for scr_gotorc() */
|
||||||
|
#define C_RELATIVE 1 /* col movement is relative */
|
||||||
|
#define R_RELATIVE 2 /* row movement is relative */
|
||||||
|
#define RELATIVE (R_RELATIVE|C_RELATIVE)
|
||||||
|
|
||||||
|
/* modes for scr_insdel_chars(), scr_insdel_lines() */
|
||||||
|
#define INSERT -1 /* don't change these values */
|
||||||
|
#define DELETE +1
|
||||||
|
#define ERASE +2
|
||||||
|
|
||||||
|
/* modes for scr_page() - scroll page. used by scrollbar window */
|
||||||
|
enum {
|
||||||
|
UP,
|
||||||
|
DN,
|
||||||
|
NO_DIR
|
||||||
|
};
|
||||||
|
|
||||||
|
/* arguments for scr_change_screen() */
|
||||||
|
enum {
|
||||||
|
PRIMARY,
|
||||||
|
SECONDARY
|
||||||
|
};
|
||||||
|
|
||||||
|
#define RS_None 0 /* Normal */
|
||||||
|
#define RS_Cursor 0x01000000u /* cursor location */
|
||||||
|
#define RS_Select 0x02000000u /* selected text */
|
||||||
|
#define RS_RVid 0x04000000u /* reverse video */
|
||||||
|
#define RS_Uline 0x08000000u /* underline */
|
||||||
|
#define RS_acsFont 0x10000000u /* ACS graphics character set */
|
||||||
|
#define RS_ukFont 0x20000000u /* UK character set */
|
||||||
|
#define RS_fontMask (RS_acsFont|RS_ukFont)
|
||||||
|
#ifdef KANJI
|
||||||
|
#define RS_multi0 0x40000000u /* only multibyte characters */
|
||||||
|
#define RS_multi1 0x80000000u /* multibyte 1st byte */
|
||||||
|
#define RS_multi2 (RS_multi0|RS_multi1) /* multibyte 2nd byte */
|
||||||
|
#define RS_multiMask (RS_multi0|RS_multi1) /* multibyte mask */
|
||||||
|
#endif
|
||||||
|
#define RS_fgMask 0x00001F00u /* 32 colors */
|
||||||
|
#define RS_Bold 0x00008000u /* bold */
|
||||||
|
#define RS_bgMask 0x001F0000u /* 32 colors */
|
||||||
|
#define RS_Blink 0x00800000u /* blink */
|
||||||
|
#define RS_Dirty 0x00400000u /* forced update of char */
|
||||||
|
|
||||||
|
#define RS_attrMask (0xFF000000u|RS_Bold|RS_Blink)
|
||||||
|
|
||||||
|
/* macros */
|
||||||
|
/* how to build & extract colors and attributes */
|
||||||
|
#define GET_FGCOLOR(r) (((r) & RS_fgMask)>>8)
|
||||||
|
#define GET_BGCOLOR(r) (((r) & RS_bgMask)>>16)
|
||||||
|
#define GET_ATTR(r) (((r) & RS_attrMask))
|
||||||
|
#define GET_BGATTR(r) (((r) & (RS_attrMask | RS_bgMask)))
|
||||||
|
|
||||||
|
#define SET_FGCOLOR(r,fg) (((r) & ~RS_fgMask) | ((fg)<<8))
|
||||||
|
#define SET_BGCOLOR(r,bg) (((r) & ~RS_bgMask) | ((bg)<<16))
|
||||||
|
#define SET_ATTR(r,a) (((r) & ~RS_attrMask)| (a))
|
||||||
|
#define DEFAULT_RSTYLE (RS_None | (fgColor<<8) | (bgColor<<16))
|
||||||
|
|
||||||
|
/* extern variables */
|
||||||
|
#ifndef NO_BRIGHTCOLOR
|
||||||
|
extern unsigned int colorfgbg;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* types */
|
||||||
|
typedef unsigned char text_t;
|
||||||
|
typedef unsigned int rend_t;
|
||||||
|
typedef struct {
|
||||||
|
int row, col;
|
||||||
|
} row_col_t;
|
||||||
|
|
||||||
|
/* screen_t flags */
|
||||||
|
#define Screen_Relative (1<<0) /* relative origin mode flag */
|
||||||
|
#define Screen_VisibleCursor (1<<1) /* cursor visible? */
|
||||||
|
#define Screen_Autowrap (1<<2) /* auto-wrap flag */
|
||||||
|
#define Screen_Insert (1<<3) /* insert mode (vs. overstrike) */
|
||||||
|
#define Screen_WrapNext (1<<4) /* need to wrap for next char? */
|
||||||
|
#define Screen_DefaultFlags (Screen_VisibleCursor|Screen_Autowrap)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* screen accounting:
|
||||||
|
* screen_t elements
|
||||||
|
* text: Contains all the text information including the scrollback
|
||||||
|
* buffer. Each line is length (TermWin.ncol + 1)
|
||||||
|
* The final character is either the _length_ of the line or
|
||||||
|
* for wrapped lines: (MAX_COLS + 1)
|
||||||
|
* rend: Contains rendition information: font, bold, colour, etc.
|
||||||
|
* * Note: Each line for both text and rend are only allocated on demand, and
|
||||||
|
* text[x] is allocated <=> rend[x] is allocated for all x.
|
||||||
|
* row: Cursor row position : 0 <= row < TermWin.nrow
|
||||||
|
* col: Cursor column position : 0 <= col < TermWin.ncol
|
||||||
|
* tscroll: Scrolling region top row inclusive : 0 <= row < TermWin.nrow
|
||||||
|
* bscroll: Scrolling region bottom row inclusive : 0 <= row < TermWin.nrow
|
||||||
|
*
|
||||||
|
* selection_t elements
|
||||||
|
* clicks: 1, 2 or 3 clicks - 4 indicates a special condition of 1 where
|
||||||
|
* nothing is selected
|
||||||
|
* beg: row/column of beginning of selection : never past mark
|
||||||
|
* mark: row/column of initial click : never past end
|
||||||
|
* end: row/column of end of selection
|
||||||
|
* * Note: -TermWin.nscrolled <= beg.row <= mark.row <= end.row < TermWin.nrow
|
||||||
|
* * Note: col == -1 ==> we're left of screen
|
||||||
|
*
|
||||||
|
* TermWin.saveLines:
|
||||||
|
* Maximum number of lines in the scrollback buffer.
|
||||||
|
* This is fixed for each rxvt instance.
|
||||||
|
* TermWin.nscrolled:
|
||||||
|
* Actual number of lines we've used of the scrollback buffer
|
||||||
|
* 0 <= TermWin.nscrolled <= TermWin.saveLines
|
||||||
|
* TermWin.view_start:
|
||||||
|
* Offset back into the scrollback buffer for out current view
|
||||||
|
* 0 <= TermWin.view_start <= TermWin.nscrolled
|
||||||
|
*
|
||||||
|
* Layout of text/rend information in the screen_t text/rend structures:
|
||||||
|
* Rows [0] ... [TermWin.saveLines - 1]
|
||||||
|
* scrollback region : we're only here if TermWin.view_start != 0
|
||||||
|
* Rows [TermWin.saveLines] ... [TermWin.saveLines + TermWin.nrow - 1]
|
||||||
|
* normal `unscrolled' screen region
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
text_t **text; /* _all_ the text */
|
||||||
|
rend_t **rend; /* rendition, uses RS_ flags */
|
||||||
|
short row, /* cursor row on the screen */
|
||||||
|
col; /* cursor column on the screen */
|
||||||
|
short tscroll, /* top of settable scroll region */
|
||||||
|
bscroll; /* bottom of settable scroll region */
|
||||||
|
short charset; /* character set number [0..3] */
|
||||||
|
unsigned int flags;
|
||||||
|
} screen_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
short row, /* cursor row */
|
||||||
|
col, /* cursor column */
|
||||||
|
charset; /* character set number [0..3] */
|
||||||
|
char charset_char;
|
||||||
|
rend_t rstyle; /* rendition style */
|
||||||
|
} save_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
unsigned char *text; /* selected text */
|
||||||
|
int len; /* length of selected text */
|
||||||
|
enum {
|
||||||
|
SELECTION_CLEAR = 0, /* nothing selected */
|
||||||
|
SELECTION_INIT, /* marked a point */
|
||||||
|
SELECTION_BEGIN, /* started a selection */
|
||||||
|
SELECTION_CONT, /* continued selection */
|
||||||
|
SELECTION_DONE, /* selection put in CUT_BUFFER0 */
|
||||||
|
} op; /* current operation */
|
||||||
|
short screen; /* screen being used */
|
||||||
|
short clicks; /* number of clicks */
|
||||||
|
row_col_t beg, mark, end;
|
||||||
|
} selection_t;
|
||||||
|
|
||||||
|
#ifdef USE_ACTIVE_TAGS
|
||||||
|
extern screen_t screen;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* prototypes: */
|
||||||
|
_XFUNCPROTOBEGIN
|
||||||
|
|
||||||
|
void blank_dline(text_t * et, rend_t * er, int width, rend_t efs);
|
||||||
|
void blank_sline(text_t * et, rend_t * er, int width);
|
||||||
|
void make_screen_mem(text_t ** tp, rend_t ** rp, int row);
|
||||||
|
void scr_reset(void);
|
||||||
|
void scr_release(void);
|
||||||
|
void scr_poweron(void);
|
||||||
|
void scr_cursor(int mode);
|
||||||
|
int scr_change_screen(int scrn);
|
||||||
|
void scr_color(unsigned int color, unsigned int Intensity);
|
||||||
|
void scr_rendition(int set, int style);
|
||||||
|
int scroll_text(int row1, int row2, int count, int spec);
|
||||||
|
void scr_add_lines(const unsigned char *str, int nlines, int len);
|
||||||
|
void scr_backspace(void);
|
||||||
|
void scr_tab(int count);
|
||||||
|
void scr_gotorc(int row, int col, int relative);
|
||||||
|
void scr_index(int direction);
|
||||||
|
void scr_erase_line(int mode);
|
||||||
|
void scr_erase_screen(int mode);
|
||||||
|
void scr_E(void);
|
||||||
|
void scr_insdel_lines(int count, int insdel);
|
||||||
|
void scr_insdel_chars(int count, int insdel);
|
||||||
|
void scr_scroll_region(int top, int bot);
|
||||||
|
void scr_cursor_visible(int mode);
|
||||||
|
void scr_autowrap(int mode);
|
||||||
|
void scr_relative_origin(int mode);
|
||||||
|
void scr_insert_mode(int mode);
|
||||||
|
void scr_set_tab(int mode);
|
||||||
|
void scr_rvideo_mode(int mode);
|
||||||
|
void scr_report_position(void);
|
||||||
|
void set_font_style(void);
|
||||||
|
void scr_charset_choose(int set);
|
||||||
|
void scr_charset_set(int set, unsigned int ch);
|
||||||
|
void eucj2jis(unsigned char *str, int len);
|
||||||
|
void sjis2jis(unsigned char *str, int len);
|
||||||
|
void set_kanji_encoding(const char *str);
|
||||||
|
int scr_get_fgcolor(void);
|
||||||
|
int scr_get_bgcolor(void);
|
||||||
|
void scr_expose(int x, int y, int width, int height);
|
||||||
|
void scr_touch(void);
|
||||||
|
int scr_move_to(int y, int len);
|
||||||
|
int scr_page(int direction, int nlines);
|
||||||
|
void scr_bell(void);
|
||||||
|
void scr_printscreen(int fullhist);
|
||||||
|
void scr_refresh(int type);
|
||||||
|
void selection_check(void);
|
||||||
|
void PasteIt(unsigned char *data, unsigned int nitems);
|
||||||
|
void selection_paste(Window win, unsigned prop, int Delete);
|
||||||
|
void selection_request(Time tm, int x, int y);
|
||||||
|
void selection_reset(void);
|
||||||
|
void selection_clear(void);
|
||||||
|
void selection_setclr(int set, int startr, int startc, int endr, int endc);
|
||||||
|
void selection_start(int x, int y);
|
||||||
|
void selection_start_colrow(int col, int row);
|
||||||
|
void selection_make(Time tm);
|
||||||
|
void selection_click(int clicks, int x, int y);
|
||||||
|
void selection_delimit_word(int col, int row, row_col_t * beg, row_col_t * end);
|
||||||
|
void selection_extend(int x, int y, int flag);
|
||||||
|
void selection_extend_colrow(int col, int row, int flag, int cont);
|
||||||
|
void selection_rotate(int x, int y);
|
||||||
|
void selection_send(XSelectionRequestEvent * rq);
|
||||||
|
void mouse_report(XButtonEvent * ev);
|
||||||
|
void mouse_tracking(int report, int x, int y, int firstrow, int lastrow);
|
||||||
|
void debug_PasteIt(unsigned char *data, int nitems);
|
||||||
|
int debug_selection(void);
|
||||||
|
void debug_colors(void);
|
||||||
|
|
||||||
|
_XFUNCPROTOEND
|
||||||
|
|
||||||
|
#endif /* whole file */
|
||||||
|
/*----------------------- end-of-file (C header) -----------------------*/
|
|
@ -0,0 +1,539 @@
|
||||||
|
/*--------------------------------*-C-*---------------------------------*
|
||||||
|
* File: scrollbar.c
|
||||||
|
*
|
||||||
|
* scrollbar routines
|
||||||
|
*
|
||||||
|
* Copyright 1996,97
|
||||||
|
* mj olesen <olesen@me.QueensU.CA> Queen's Univ at Kingston
|
||||||
|
*
|
||||||
|
* You can do what you like with this source code provided you don't make
|
||||||
|
* money from it and you include an unaltered copy of this message
|
||||||
|
* (including the copyright). As usual, the author accepts no
|
||||||
|
* responsibility for anything, nor does he guarantee anything whatsoever.
|
||||||
|
*----------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
static const char cvs_ident[] = "$Id$";
|
||||||
|
|
||||||
|
#include "feature.h"
|
||||||
|
#include "main.h"
|
||||||
|
#include "scrollbar.h"
|
||||||
|
#include "screen.h"
|
||||||
|
#include "debug.h"
|
||||||
|
#include "options.h"
|
||||||
|
#ifdef PIXMAP_SCROLLBAR
|
||||||
|
# include "pixmap.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* extern functions referenced */
|
||||||
|
/* extern variables referenced */
|
||||||
|
/* extern variables declared here */
|
||||||
|
|
||||||
|
#ifdef PIXMAP_SCROLLBAR
|
||||||
|
scrollBar_t scrollBar =
|
||||||
|
{0, 0, 0, 0, 0, SCROLLBAR_DEFAULT_TYPE, SB_WIDTH, None, None, None, None};
|
||||||
|
|
||||||
|
#else
|
||||||
|
scrollBar_t scrollBar =
|
||||||
|
{0, 0, 0, 0, 0, SCROLLBAR_DEFAULT_TYPE, SB_WIDTH, None};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
int sb_shadow;
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------*
|
||||||
|
*/
|
||||||
|
static GC scrollbarGC;
|
||||||
|
static short last_top = 0, last_bot = 0; /* old (drawn) values */
|
||||||
|
|
||||||
|
#ifdef XTERM_SCROLLBAR /* bitmap scrollbar */
|
||||||
|
static GC shadowGC;
|
||||||
|
static char xterm_sb_bits[] =
|
||||||
|
{0xaa, 0x0a, 0x55, 0x05}; /* 12x2 bitmap */
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MOTIF_SCROLLBAR) || defined(NEXT_SCROLLBAR)
|
||||||
|
static GC topShadowGC, botShadowGC;
|
||||||
|
|
||||||
|
/* draw triangular up button with a shadow of SHADOW (1 or 2) pixels */
|
||||||
|
/* PROTO */
|
||||||
|
void
|
||||||
|
Draw_up_button(int x, int y, int state)
|
||||||
|
{
|
||||||
|
|
||||||
|
const unsigned int sz = (scrollBar.width), sz2 = (scrollBar.width / 2);
|
||||||
|
XPoint pt[3];
|
||||||
|
GC top = None, bot = None;
|
||||||
|
|
||||||
|
# ifdef PIXMAP_SCROLLBAR
|
||||||
|
Pixmap pixmap = upPixmap.pixmap;
|
||||||
|
|
||||||
|
# endif
|
||||||
|
|
||||||
|
D_SCROLLBAR(("Draw_up_button(%d, %d, %d)\n", x, y, state));
|
||||||
|
|
||||||
|
switch (state) {
|
||||||
|
case +1:
|
||||||
|
top = topShadowGC;
|
||||||
|
bot = botShadowGC;
|
||||||
|
break;
|
||||||
|
case -1:
|
||||||
|
top = botShadowGC;
|
||||||
|
bot = topShadowGC;
|
||||||
|
break;
|
||||||
|
case 0:
|
||||||
|
default:
|
||||||
|
top = bot = scrollbarGC;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
# ifdef PIXMAP_SCROLLBAR
|
||||||
|
if ((scrollbar_is_pixmapped()) && (pixmap != None)) {
|
||||||
|
XSetWindowBackgroundPixmap(Xdisplay, scrollBar.up_win, pixmap);
|
||||||
|
XClearWindow(Xdisplay, scrollBar.up_win);
|
||||||
|
} else
|
||||||
|
# endif
|
||||||
|
{
|
||||||
|
/* fill triangle */
|
||||||
|
pt[0].x = x;
|
||||||
|
pt[0].y = y + sz - 1;
|
||||||
|
pt[1].x = x + sz - 1;
|
||||||
|
pt[1].y = y + sz - 1;
|
||||||
|
pt[2].x = x + sz2;
|
||||||
|
pt[2].y = y;
|
||||||
|
XFillPolygon(Xdisplay, scrollBar.win, scrollbarGC,
|
||||||
|
pt, 3, Convex, CoordModeOrigin);
|
||||||
|
|
||||||
|
/* draw base */
|
||||||
|
XDrawLine(Xdisplay, scrollBar.win, bot,
|
||||||
|
pt[0].x, pt[0].y, pt[1].x, pt[1].y);
|
||||||
|
|
||||||
|
/* draw shadow */
|
||||||
|
pt[1].x = x + sz2 - 1;
|
||||||
|
pt[1].y = y;
|
||||||
|
XDrawLine(Xdisplay, scrollBar.win, top,
|
||||||
|
pt[0].x, pt[0].y, pt[1].x, pt[1].y);
|
||||||
|
# if (SHADOW > 1)
|
||||||
|
/* doubled */
|
||||||
|
pt[0].x++;
|
||||||
|
pt[0].y--;
|
||||||
|
pt[1].y++;
|
||||||
|
XDrawLine(Xdisplay, scrollBar.win, top,
|
||||||
|
pt[0].x, pt[0].y, pt[1].x, pt[1].y);
|
||||||
|
# endif
|
||||||
|
/* draw shadow */
|
||||||
|
pt[0].x = x + sz2;
|
||||||
|
pt[0].y = y;
|
||||||
|
pt[1].x = x + sz - 1;
|
||||||
|
pt[1].y = y + sz - 1;
|
||||||
|
XDrawLine(Xdisplay, scrollBar.win, bot,
|
||||||
|
pt[0].x, pt[0].y, pt[1].x, pt[1].y);
|
||||||
|
# if (SHADOW > 1)
|
||||||
|
/* doubled */
|
||||||
|
pt[0].y++;
|
||||||
|
pt[1].x--;
|
||||||
|
pt[1].y--;
|
||||||
|
XDrawLine(Xdisplay, scrollBar.win, bot,
|
||||||
|
pt[0].x, pt[0].y, pt[1].x, pt[1].y);
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* draw triangular down button with a shadow of SHADOW (1 or 2) pixels */
|
||||||
|
/* PROTO */
|
||||||
|
void
|
||||||
|
Draw_dn_button(int x, int y, int state)
|
||||||
|
{
|
||||||
|
|
||||||
|
const unsigned int sz = (scrollBar.width), sz2 = (scrollBar.width / 2);
|
||||||
|
XPoint pt[3];
|
||||||
|
GC top = None, bot = None;
|
||||||
|
|
||||||
|
# ifdef PIXMAP_SCROLLBAR
|
||||||
|
Pixmap pixmap = dnPixmap.pixmap;
|
||||||
|
|
||||||
|
# endif
|
||||||
|
|
||||||
|
D_SCROLLBAR(("Draw_dn_button(%d, %d, %d)\n", x, y, state));
|
||||||
|
|
||||||
|
switch (state) {
|
||||||
|
case +1:
|
||||||
|
top = topShadowGC;
|
||||||
|
bot = botShadowGC;
|
||||||
|
break;
|
||||||
|
case -1:
|
||||||
|
top = botShadowGC;
|
||||||
|
bot = topShadowGC;
|
||||||
|
break;
|
||||||
|
case 0:
|
||||||
|
default:
|
||||||
|
top = bot = scrollbarGC;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
# ifdef PIXMAP_SCROLLBAR
|
||||||
|
if ((scrollbar_is_pixmapped()) && (pixmap != None)) {
|
||||||
|
XSetWindowBackgroundPixmap(Xdisplay, scrollBar.up_win, pixmap);
|
||||||
|
XClearWindow(Xdisplay, scrollBar.dn_win);
|
||||||
|
} else
|
||||||
|
# endif
|
||||||
|
{
|
||||||
|
/* fill triangle */
|
||||||
|
pt[0].x = x;
|
||||||
|
pt[0].y = y;
|
||||||
|
pt[1].x = x + sz - 1;
|
||||||
|
pt[1].y = y;
|
||||||
|
pt[2].x = x + sz2;
|
||||||
|
pt[2].y = y + sz;
|
||||||
|
XFillPolygon(Xdisplay, scrollBar.win, scrollbarGC,
|
||||||
|
pt, 3, Convex, CoordModeOrigin);
|
||||||
|
|
||||||
|
/* draw base */
|
||||||
|
XDrawLine(Xdisplay, scrollBar.win, top,
|
||||||
|
pt[0].x, pt[0].y, pt[1].x, pt[1].y);
|
||||||
|
|
||||||
|
/* draw shadow */
|
||||||
|
pt[1].x = x + sz2 - 1;
|
||||||
|
pt[1].y = y + sz - 1;
|
||||||
|
XDrawLine(Xdisplay, scrollBar.win, top,
|
||||||
|
pt[0].x, pt[0].y, pt[1].x, pt[1].y);
|
||||||
|
# if (SHADOW > 1)
|
||||||
|
/* doubled */
|
||||||
|
pt[0].x++;
|
||||||
|
pt[0].y++;
|
||||||
|
pt[1].y--;
|
||||||
|
XDrawLine(Xdisplay, scrollBar.win, top,
|
||||||
|
pt[0].x, pt[0].y, pt[1].x, pt[1].y);
|
||||||
|
# endif
|
||||||
|
/* draw shadow */
|
||||||
|
pt[0].x = x + sz2;
|
||||||
|
pt[0].y = y + sz - 1;
|
||||||
|
pt[1].x = x + sz - 1;
|
||||||
|
pt[1].y = y;
|
||||||
|
XDrawLine(Xdisplay, scrollBar.win, bot,
|
||||||
|
pt[0].x, pt[0].y, pt[1].x, pt[1].y);
|
||||||
|
# if (SHADOW > 1)
|
||||||
|
/* doubled */
|
||||||
|
pt[0].y--;
|
||||||
|
pt[1].x--;
|
||||||
|
pt[1].y++;
|
||||||
|
XDrawLine(Xdisplay, scrollBar.win, bot,
|
||||||
|
pt[0].x, pt[0].y, pt[1].x, pt[1].y);
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /* MOTIF_SCROLLBAR || NEXT_SCROLLBAR */
|
||||||
|
|
||||||
|
/* PROTO */
|
||||||
|
int
|
||||||
|
scrollbar_mapping(int map)
|
||||||
|
{
|
||||||
|
|
||||||
|
int change = 0;
|
||||||
|
|
||||||
|
D_SCROLLBAR(("scrollbar_mapping(%d)\n", map));
|
||||||
|
|
||||||
|
if (map && !scrollbar_visible()) {
|
||||||
|
scrollBar.state = 1;
|
||||||
|
XMapWindow(Xdisplay, scrollBar.win);
|
||||||
|
#ifdef PIXMAP_SCROLLBAR
|
||||||
|
if (scrollbar_is_pixmapped()) {
|
||||||
|
XMapWindow(Xdisplay, scrollBar.up_win);
|
||||||
|
XMapWindow(Xdisplay, scrollBar.dn_win);
|
||||||
|
XMapWindow(Xdisplay, scrollBar.sa_win);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
change = 1;
|
||||||
|
} else if (!map && scrollbar_visible()) {
|
||||||
|
scrollBar.state = 0;
|
||||||
|
#ifdef PIXMAP_SCROLLBAR
|
||||||
|
if (scrollbar_is_pixmapped()) {
|
||||||
|
XUnmapWindow(Xdisplay, scrollBar.up_win);
|
||||||
|
XUnmapWindow(Xdisplay, scrollBar.dn_win);
|
||||||
|
XUnmapWindow(Xdisplay, scrollBar.sa_win);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
XUnmapWindow(Xdisplay, scrollBar.win);
|
||||||
|
change = 1;
|
||||||
|
}
|
||||||
|
return change;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
scrollbar_reset(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (scrollbarGC != None) {
|
||||||
|
XFreeGC(Xdisplay, scrollbarGC);
|
||||||
|
scrollbarGC = None;
|
||||||
|
}
|
||||||
|
if (topShadowGC != None) {
|
||||||
|
XFreeGC(Xdisplay, topShadowGC);
|
||||||
|
topShadowGC = None;
|
||||||
|
}
|
||||||
|
if (botShadowGC != None) {
|
||||||
|
XFreeGC(Xdisplay, botShadowGC);
|
||||||
|
botShadowGC = None;
|
||||||
|
}
|
||||||
|
if (shadowGC != None) {
|
||||||
|
XFreeGC(Xdisplay, shadowGC);
|
||||||
|
shadowGC = None;
|
||||||
|
}
|
||||||
|
last_top = last_bot = 0;
|
||||||
|
if (scrollBar.type == SCROLLBAR_XTERM) {
|
||||||
|
sb_shadow = 0;
|
||||||
|
} else {
|
||||||
|
sb_shadow = (Options & Opt_scrollBar_floating) ? 0 : SHADOW;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
scrollbar_show(int mouseoffset)
|
||||||
|
{
|
||||||
|
|
||||||
|
static short sb_width; /* old (drawn) values */
|
||||||
|
unsigned char xsb = 0, force_update = 0;
|
||||||
|
|
||||||
|
#ifdef CHANGE_SCROLLCOLOR_ON_FOCUS
|
||||||
|
static int focus = -1;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!scrollbar_visible())
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
D_SCROLLBAR(("scrollbar_show(%d)\n", mouseoffset));
|
||||||
|
|
||||||
|
if (scrollbarGC == None) {
|
||||||
|
|
||||||
|
XGCValues gcvalue;
|
||||||
|
|
||||||
|
#ifdef XTERM_SCROLLBAR
|
||||||
|
if (scrollBar.type == SCROLLBAR_XTERM) {
|
||||||
|
sb_width = scrollBar.width - 1;
|
||||||
|
gcvalue.stipple = XCreateBitmapFromData(Xdisplay, scrollBar.win,
|
||||||
|
xterm_sb_bits, 12, 2);
|
||||||
|
if (!gcvalue.stipple) {
|
||||||
|
print_error("can't create bitmap");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
gcvalue.fill_style = FillOpaqueStippled;
|
||||||
|
gcvalue.foreground = PixColors[fgColor];
|
||||||
|
gcvalue.background = PixColors[bgColor];
|
||||||
|
|
||||||
|
scrollbarGC = XCreateGC(Xdisplay, scrollBar.win,
|
||||||
|
GCForeground | GCBackground |
|
||||||
|
GCFillStyle | GCStipple,
|
||||||
|
&gcvalue);
|
||||||
|
gcvalue.foreground = PixColors[borderColor];
|
||||||
|
shadowGC = XCreateGC(Xdisplay, scrollBar.win, GCForeground, &gcvalue);
|
||||||
|
}
|
||||||
|
#endif /* XTERM_SCROLLBAR */
|
||||||
|
|
||||||
|
#if defined(MOTIF_SCROLLBAR) || defined(NEXT_SCROLLBAR)
|
||||||
|
if (scrollBar.type == SCROLLBAR_MOTIF || scrollBar.type == SCROLLBAR_NEXT) {
|
||||||
|
sb_width = scrollBar.width;
|
||||||
|
# ifdef KEEP_SCROLLCOLOR
|
||||||
|
gcvalue.foreground = (Xdepth <= 2 ? PixColors[fgColor]
|
||||||
|
: PixColors[scrollColor]);
|
||||||
|
# else
|
||||||
|
gcvalue.foreground = PixColors[fgColor];
|
||||||
|
# endif
|
||||||
|
scrollbarGC = XCreateGC(Xdisplay, scrollBar.win, GCForeground,
|
||||||
|
&gcvalue);
|
||||||
|
|
||||||
|
if ((sb_shadow) && (!(scrollbar_is_pixmapped()))) {
|
||||||
|
XSetWindowBackground(Xdisplay, scrollBar.win, gcvalue.foreground);
|
||||||
|
XClearWindow(Xdisplay, scrollBar.win);
|
||||||
|
} else if (Options & Opt_scrollBar_floating) {
|
||||||
|
if (!(Options & Opt_pixmapTrans)) {
|
||||||
|
if (background_is_pixmap()) {
|
||||||
|
XSetWindowBackground(Xdisplay, scrollBar.win, PixColors[scrollColor]);
|
||||||
|
} else {
|
||||||
|
XSetWindowBackground(Xdisplay, scrollBar.win, PixColors[bgColor]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
XClearWindow(Xdisplay, scrollBar.win);
|
||||||
|
}
|
||||||
|
# ifdef KEEP_SCROLLCOLOR
|
||||||
|
gcvalue.foreground = PixColors[topShadowColor];
|
||||||
|
# else /* KEEP_SCROLLCOLOR */
|
||||||
|
gcvalue.foreground = PixColors[bgColor];
|
||||||
|
# endif /* KEEP_SCROLLCOLOR */
|
||||||
|
topShadowGC = XCreateGC(Xdisplay, scrollBar.win,
|
||||||
|
GCForeground,
|
||||||
|
&gcvalue);
|
||||||
|
|
||||||
|
# ifdef KEEP_SCROLLCOLOR
|
||||||
|
gcvalue.foreground = PixColors[bottomShadowColor];
|
||||||
|
# else /* KEEP_SCROLLCOLOR */
|
||||||
|
gcvalue.foreground = PixColors[bgColor];
|
||||||
|
# endif /* KEEP_SCROLLCOLOR */
|
||||||
|
botShadowGC = XCreateGC(Xdisplay, scrollBar.win,
|
||||||
|
GCForeground,
|
||||||
|
&gcvalue);
|
||||||
|
}
|
||||||
|
#endif /* MOTIF_SCROLLBAR || NEXT_SCROLLBAR */
|
||||||
|
}
|
||||||
|
#if defined(CHANGE_SCROLLCOLOR_ON_FOCUS) && (defined(MOTIF_SCROLLBAR) || defined(NEXT_SCROLLBAR))
|
||||||
|
if (scrollBar.type == SCROLLBAR_MOTIF || scrollBar.type == SCROLLBAR_NEXT) {
|
||||||
|
if (focus != TermWin.focus) {
|
||||||
|
XGCValues gcvalue;
|
||||||
|
|
||||||
|
focus = TermWin.focus;
|
||||||
|
gcvalue.foreground = PixColors[focus ? scrollColor : unfocusedScrollColor];
|
||||||
|
# ifdef PIXMAP_OFFSET
|
||||||
|
if (!((Options & Opt_pixmapTrans) && (Options & Opt_scrollBar_floating))) {
|
||||||
|
# endif
|
||||||
|
XSetWindowBackground(Xdisplay, scrollBar.win, gcvalue.foreground);
|
||||||
|
XClearWindow(Xdisplay, scrollBar.win);
|
||||||
|
# ifdef PIXMAP_OFFSET
|
||||||
|
}
|
||||||
|
# endif /* PIXMAP_OFFSET */
|
||||||
|
XChangeGC(Xdisplay, scrollbarGC, GCForeground,
|
||||||
|
&gcvalue);
|
||||||
|
|
||||||
|
gcvalue.foreground = PixColors[focus ? topShadowColor : unfocusedTopShadowColor];
|
||||||
|
XChangeGC(Xdisplay, topShadowGC,
|
||||||
|
GCForeground,
|
||||||
|
&gcvalue);
|
||||||
|
gcvalue.foreground = PixColors[focus ? bottomShadowColor : unfocusedBottomShadowColor];
|
||||||
|
XChangeGC(Xdisplay, botShadowGC,
|
||||||
|
GCForeground,
|
||||||
|
&gcvalue);
|
||||||
|
force_update = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /* CHANGE_SCROLLCOLOR_ON_FOCUS && (MOTIF_SCROLLBAR || NEXT_SCROLLBAR) */
|
||||||
|
|
||||||
|
if (mouseoffset) {
|
||||||
|
int top = (TermWin.nscrolled - TermWin.view_start);
|
||||||
|
int bot = top + (TermWin.nrow - 1);
|
||||||
|
int len = max((TermWin.nscrolled + (TermWin.nrow - 1)), 1);
|
||||||
|
|
||||||
|
scrollBar.top = (scrollBar.beg + (top * scrollbar_size()) / len);
|
||||||
|
scrollBar.bot = (scrollBar.beg + (bot * scrollbar_size()) / len);
|
||||||
|
|
||||||
|
if (rs_min_anchor_size && scrollBar.type != SCROLLBAR_XTERM) {
|
||||||
|
if ((scrollbar_size() > rs_min_anchor_size) && (scrollBar.bot - scrollBar.top < rs_min_anchor_size)) {
|
||||||
|
|
||||||
|
int grab_point = scrollBar.top + mouseoffset;
|
||||||
|
|
||||||
|
if (grab_point - mouseoffset < scrollBar.beg) {
|
||||||
|
scrollBar.top = scrollBar.beg;
|
||||||
|
scrollBar.bot = rs_min_anchor_size + scrollBar.beg;
|
||||||
|
} else if (scrollBar.top + rs_min_anchor_size > scrollBar.end) {
|
||||||
|
scrollBar.top = scrollBar.end - rs_min_anchor_size;
|
||||||
|
scrollBar.bot = scrollBar.end;
|
||||||
|
} else {
|
||||||
|
scrollBar.top = grab_point - mouseoffset;
|
||||||
|
scrollBar.bot = scrollBar.top + rs_min_anchor_size;
|
||||||
|
}
|
||||||
|
if (scrollBar.bot == scrollBar.end) {
|
||||||
|
scr_move_to(scrollBar.end, scrollbar_size());
|
||||||
|
scr_refresh(SMOOTH_REFRESH);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* no change */
|
||||||
|
if (!force_update && (scrollBar.top == last_top) && (scrollBar.bot == last_bot))
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#ifdef XTERM_SCROLLBAR
|
||||||
|
xsb = ((scrollBar.type == SCROLLBAR_XTERM) && (Options & Opt_scrollBar_right)) ? 1 : 0;
|
||||||
|
#endif
|
||||||
|
if (last_top < scrollBar.top) {
|
||||||
|
#ifdef PIXMAP_SCROLLBAR
|
||||||
|
if (scrollbar_is_pixmapped()) {
|
||||||
|
D_SCROLLBAR(("ATTN: XClearArea() #1, going down\n"));
|
||||||
|
XClearArea(Xdisplay, scrollBar.win,
|
||||||
|
sb_shadow + xsb, last_top,
|
||||||
|
sb_width, (scrollBar.top - last_top),
|
||||||
|
False);
|
||||||
|
XMoveResizeWindow(Xdisplay, scrollBar.sa_win,
|
||||||
|
0, scrollBar.top,
|
||||||
|
scrollbar_total_width(),
|
||||||
|
(scrollBar.bot - scrollBar.top));
|
||||||
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
D_SCROLLBAR(("ATTN: XClearArea() #2\n"));
|
||||||
|
XClearArea(Xdisplay, scrollBar.win,
|
||||||
|
sb_shadow + xsb, last_top,
|
||||||
|
sb_width, (scrollBar.top - last_top),
|
||||||
|
False);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (scrollBar.bot < last_bot) {
|
||||||
|
#ifdef PIXMAP_SCROLLBAR
|
||||||
|
if (scrollbar_is_pixmapped()) {
|
||||||
|
D_SCROLLBAR(("ATTN: XClearArea() #3, going up\n"));
|
||||||
|
XClearArea(Xdisplay, scrollBar.win,
|
||||||
|
sb_shadow + xsb, scrollBar.bot,
|
||||||
|
sb_width, (last_bot - scrollBar.bot),
|
||||||
|
False);
|
||||||
|
XMoveResizeWindow(Xdisplay, scrollBar.sa_win,
|
||||||
|
0, scrollBar.top,
|
||||||
|
scrollbar_total_width(),
|
||||||
|
(scrollBar.bot - scrollBar.top));
|
||||||
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
D_SCROLLBAR(("ATTN: XClearArea() #4\n"));
|
||||||
|
XClearArea(Xdisplay, scrollBar.win,
|
||||||
|
sb_shadow + xsb, scrollBar.bot,
|
||||||
|
sb_width, (last_bot - scrollBar.bot),
|
||||||
|
False);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
last_top = scrollBar.top;
|
||||||
|
last_bot = scrollBar.bot;
|
||||||
|
|
||||||
|
/* scrollbar slider */
|
||||||
|
#ifdef XTERM_SCROLLBAR
|
||||||
|
if (scrollBar.type == SCROLLBAR_XTERM) {
|
||||||
|
XFillRectangle(Xdisplay, scrollBar.win, scrollbarGC,
|
||||||
|
xsb + 1, scrollBar.top,
|
||||||
|
sb_width - 2, (scrollBar.bot - scrollBar.top));
|
||||||
|
XDrawLine(Xdisplay, scrollBar.win, shadowGC,
|
||||||
|
xsb ? 0 : sb_width, scrollBar.beg, xsb ? 0 : sb_width, scrollBar.end);
|
||||||
|
}
|
||||||
|
#endif /* XTERM_SCROLLBAR */
|
||||||
|
|
||||||
|
#if defined(MOTIF_SCROLLBAR) || defined(NEXT_SCROLLBAR)
|
||||||
|
if (scrollBar.type == SCROLLBAR_MOTIF || scrollBar.type == SCROLLBAR_NEXT) {
|
||||||
|
# ifdef PIXMAP_SCROLLBAR
|
||||||
|
if ((scrollbar_is_pixmapped()) && (saPixmap.pixmap != None)) {
|
||||||
|
D_SCROLLBAR(("ATTN: XCopyArea(%dx%d)", sb_width, (scrollBar.bot - scrollBar.top)));
|
||||||
|
XCopyArea(Xdisplay, saPixmap.pixmap, scrollBar.sa_win, scrollbarGC,
|
||||||
|
0, 0, sb_width, (scrollBar.bot - scrollBar.top),
|
||||||
|
0, scrollBar.top);
|
||||||
|
XClearArea(Xdisplay, scrollBar.sa_win, 0, scrollBar.top,
|
||||||
|
sb_width, (scrollBar.bot - scrollBar.top), False);
|
||||||
|
} else
|
||||||
|
# endif
|
||||||
|
{
|
||||||
|
XFillRectangle(Xdisplay, scrollBar.win, scrollbarGC,
|
||||||
|
sb_shadow, scrollBar.top,
|
||||||
|
sb_width, (scrollBar.bot - scrollBar.top));
|
||||||
|
}
|
||||||
|
if ((sb_shadow) && (!(scrollbar_is_pixmapped()))) {
|
||||||
|
/* trough shadow */
|
||||||
|
Draw_Shadow(scrollBar.win, botShadowGC, topShadowGC, 0, 0,
|
||||||
|
(sb_width + 2 * sb_shadow),
|
||||||
|
scrollBar.end + ((scrollBar.type == SCROLLBAR_NEXT) ? (2 * (sb_width + 1) + sb_shadow) : ((sb_width + 1) + sb_shadow)));
|
||||||
|
}
|
||||||
|
/* shadow for scrollbar slider */
|
||||||
|
if (!(scrollbar_is_pixmapped())) {
|
||||||
|
Draw_Shadow(scrollBar.win, topShadowGC, botShadowGC, sb_shadow, scrollBar.top, sb_width,
|
||||||
|
(scrollBar.bot - scrollBar.top));
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* Redraw scrollbar arrows
|
||||||
|
*/
|
||||||
|
Draw_up_button(sb_shadow, scrollbar_up_loc(), (scrollbar_isUp()? -1 : +1));
|
||||||
|
Draw_dn_button(sb_shadow, scrollbar_dn_loc(), (scrollbar_isDn()? -1 : +1));
|
||||||
|
}
|
||||||
|
#endif /* MOTIF_SCROLLBAR || NEXT_SCROLLBAR */
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
|
@ -0,0 +1,91 @@
|
||||||
|
/*--------------------------------*-C-*---------------------------------*
|
||||||
|
* File: scrollbar.h
|
||||||
|
*
|
||||||
|
* Copyright 1996,97
|
||||||
|
* mj olesen <olesen@me.QueensU.CA> Queen's Univ at Kingston
|
||||||
|
*
|
||||||
|
* You can do what you like with this source code provided you don't make
|
||||||
|
* money from it and you include an unaltered copy of this message
|
||||||
|
* (including the copyright). As usual, the author accepts no
|
||||||
|
* responsibility for anything, nor does he guarantee anything whatsoever.
|
||||||
|
*----------------------------------------------------------------------*/
|
||||||
|
#ifndef _SCROLLBAR_H
|
||||||
|
# define _SCROLLBAR_H
|
||||||
|
|
||||||
|
# include <X11/Xfuncproto.h>
|
||||||
|
# include <ctype.h>
|
||||||
|
# ifdef PIXMAP_SCROLLBAR
|
||||||
|
# include "eterm_imlib.h"
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* Scrollbar types we support */
|
||||||
|
# define SCROLLBAR_MOTIF 1
|
||||||
|
# define SCROLLBAR_XTERM 2
|
||||||
|
# define SCROLLBAR_NEXT 3
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
short beg, end; /* beg/end of slider sub-window */
|
||||||
|
short top, bot; /* top/bot of slider */
|
||||||
|
short state; /* scrollbar state */
|
||||||
|
unsigned char type; /* scrollbar type (see above) */
|
||||||
|
short width; /* scrollbar width */
|
||||||
|
Window win;
|
||||||
|
# ifdef PIXMAP_SCROLLBAR
|
||||||
|
Window up_win;
|
||||||
|
Window dn_win;
|
||||||
|
Window sa_win;
|
||||||
|
# endif
|
||||||
|
} scrollBar_t;
|
||||||
|
extern scrollBar_t scrollBar;
|
||||||
|
extern int sb_shadow;
|
||||||
|
|
||||||
|
/* prototypes */
|
||||||
|
_XFUNCPROTOBEGIN
|
||||||
|
|
||||||
|
extern int scrollbar_mapping(int);
|
||||||
|
extern void scrollbar_reset(void);
|
||||||
|
extern int scrollbar_show(int);
|
||||||
|
_XFUNCPROTOEND
|
||||||
|
|
||||||
|
/* macros */
|
||||||
|
#define scrollbar_visible() (scrollBar.state)
|
||||||
|
#define scrollbar_isMotion() (scrollBar.state == 'm')
|
||||||
|
#define scrollbar_isUp() (scrollBar.state == 'U')
|
||||||
|
#define scrollbar_isDn() (scrollBar.state == 'D')
|
||||||
|
#define scrollbar_isUpDn() isupper (scrollBar.state)
|
||||||
|
#define scrollbar_setNone() do { scrollBar.state = 1; } while (0)
|
||||||
|
#define scrollbar_setMotion() do { scrollBar.state = 'm'; } while (0)
|
||||||
|
#define scrollbar_setUp() do { scrollBar.state = 'U'; } while (0)
|
||||||
|
#define scrollbar_setDn() do { scrollBar.state = 'D'; } while (0)
|
||||||
|
|
||||||
|
#define scrollbar_above_slider(y) ((y) < scrollBar.top)
|
||||||
|
#define scrollbar_below_slider(y) ((y) > scrollBar.bot)
|
||||||
|
#define scrollbar_position(y) ((y) - scrollBar.beg)
|
||||||
|
#define scrollbar_size() (scrollBar.end - scrollBar.beg)
|
||||||
|
|
||||||
|
#define scrollbar_total_width() (scrollBar.width + 2 * sb_shadow)
|
||||||
|
#define scrollbar_arrow_height() ((scrollBar.width + 1) + sb_shadow)
|
||||||
|
#define scrollbar_anchor_max_height() ((menubar_visible()) ? (TermWin.height) : (TermWin.height - ((scrollBar.width + 1) + sb_shadow)))
|
||||||
|
|
||||||
|
#define scrollbar_up_loc() ((scrollBar.type == SCROLLBAR_NEXT) ? (scrollBar.end + 1) : (sb_shadow))
|
||||||
|
#define scrollbar_dn_loc() ((scrollBar.type == SCROLLBAR_NEXT) \
|
||||||
|
? (scrollBar.end + scrollBar.width + 2) \
|
||||||
|
: (scrollBar.end + 1))
|
||||||
|
#define scrollbar_upButton(y) ((scrollBar.type == SCROLLBAR_NEXT && (y) > scrollBar.end && (y) <= scrollbar_dn_loc()) \
|
||||||
|
|| (scrollBar.type != SCROLLBAR_NEXT && (y) < scrollBar.beg))
|
||||||
|
#define scrollbar_dnButton(y) ((scrollBar.type == SCROLLBAR_NEXT && (y) > scrollbar_dn_loc()) \
|
||||||
|
|| (scrollBar.type != SCROLLBAR_NEXT && (y) > scrollBar.end))
|
||||||
|
|
||||||
|
#ifdef PIXMAP_SCROLLBAR
|
||||||
|
# define isScrollbarWindow(w) ((scrollbar_is_pixmapped() && scrollbar_visible() && (w) == scrollBar.sa_win) \
|
||||||
|
|| (!scrollbar_is_pixmapped() && scrollbar_visible() && (w) == scrollBar.win))
|
||||||
|
# define scrollbar_upButtonWin(w) ((w) == scrollBar.up_win)
|
||||||
|
# define scrollbar_dnButtonWin(w) ((w) == scrollBar.dn_win)
|
||||||
|
# define scrollbar_is_pixmapped() (0)
|
||||||
|
#else
|
||||||
|
# define isScrollbarWindow(w) (scrollbar_visible() && (w) == scrollBar.win)
|
||||||
|
# define scrollbar_is_pixmapped() (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _SCROLLBAR_H */
|
||||||
|
/*----------------------- end-of-file (C header) -----------------------*/
|
|
@ -0,0 +1,99 @@
|
||||||
|
/* system.c -- Eterm secure system() replacement
|
||||||
|
* -- 21 August 1997, mej
|
||||||
|
*/
|
||||||
|
|
||||||
|
static const char cvs_ident[] = "$Id$";
|
||||||
|
|
||||||
|
#include "../config.h"
|
||||||
|
#include "feature.h"
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#ifdef HAVE_SYS_WAIT_H
|
||||||
|
# include <sys/wait.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "strings.h"
|
||||||
|
#include "options.h"
|
||||||
|
#include "screen.h"
|
||||||
|
#include "system.h"
|
||||||
|
#include "../libmej/debug.h"
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
int system_wait(char *command);
|
||||||
|
int system_no_wait(char *command);
|
||||||
|
|
||||||
|
int
|
||||||
|
wait_for_chld(int system_pid)
|
||||||
|
{
|
||||||
|
|
||||||
|
int pid, status = 0, save_errno = errno, code;
|
||||||
|
|
||||||
|
D_OPTIONS(("wait_for_chld(%ld) called.\n", system_pid));
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
do {
|
||||||
|
errno = 0;
|
||||||
|
} while (((pid = waitpid(system_pid, &status, WNOHANG)) == -1) &&
|
||||||
|
(errno == EINTR) || !pid);
|
||||||
|
/* If the child that exited is the command we spawned, or if the
|
||||||
|
child exited before fork() returned in the parent, it must be
|
||||||
|
our immediate child that exited. We exit gracefully. */
|
||||||
|
D_OPTIONS(("wait_for_chld(): %ld exited.\n", pid));
|
||||||
|
if (pid == system_pid || system_pid == -1) {
|
||||||
|
if (WIFEXITED(status)) {
|
||||||
|
code = WEXITSTATUS(status);
|
||||||
|
D_OPTIONS(("wait_for_chld(): Child process exited with return code %lu\n", code));
|
||||||
|
} else if (WIFSIGNALED(status)) {
|
||||||
|
code = WTERMSIG(status);
|
||||||
|
D_OPTIONS(("wait_for_chld(): Child process was terminated by unhandled signal %lu\n", code));
|
||||||
|
}
|
||||||
|
return (code);
|
||||||
|
}
|
||||||
|
errno = save_errno;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Replace the system() call with a fork-and-exec that unprivs the child process */
|
||||||
|
|
||||||
|
int
|
||||||
|
system_wait(char *command)
|
||||||
|
{
|
||||||
|
|
||||||
|
pid_t pid;
|
||||||
|
|
||||||
|
D_OPTIONS(("system_wait(%s) called.\n", command));
|
||||||
|
|
||||||
|
if (!(pid = fork())) {
|
||||||
|
setreuid(my_ruid, my_ruid);
|
||||||
|
setreuid(my_rgid, my_rgid);
|
||||||
|
execl("/bin/sh", "sh", "-c", command, (char *) NULL);
|
||||||
|
print_error("system_wait(): execl(%s) failed -- %s", command, strerror(errno));
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
} else {
|
||||||
|
D_OPTIONS(("%d: fork() returned %d\n", getpid(), pid));
|
||||||
|
return (wait_for_chld(pid));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
system_no_wait(char *command)
|
||||||
|
{
|
||||||
|
|
||||||
|
pid_t pid;
|
||||||
|
|
||||||
|
D_OPTIONS(("system_no_wait(%s) called.\n", command));
|
||||||
|
|
||||||
|
if (!(pid = fork())) {
|
||||||
|
setreuid(my_ruid, my_ruid);
|
||||||
|
setreuid(my_rgid, my_rgid);
|
||||||
|
execl("/bin/sh", "sh", "-c", command, (char *) NULL);
|
||||||
|
print_error("system_no_wait(): execl(%s) failed -- %s", command, strerror(errno));
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
return (0);
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
/* system.h -- Header file for system.c */
|
||||||
|
|
||||||
|
#ifndef _SYSTEM_H_
|
||||||
|
#define _SYSTEM_H_
|
||||||
|
|
||||||
|
#define ETERM_SYSTEM_WAIT
|
||||||
|
|
||||||
|
#ifdef ETERM_SYSTEM_WAIT
|
||||||
|
# define system(c) system_wait((c))
|
||||||
|
#else
|
||||||
|
# define system(c) system_no_wait((c))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef RETSIGTYPE (*sighandler_t)(int);
|
||||||
|
|
||||||
|
extern int my_ruid, my_rgid, my_euid, my_egid;
|
||||||
|
|
||||||
|
extern int system_wait(char *command);
|
||||||
|
extern int system_no_wait(char *command);
|
||||||
|
|
||||||
|
#endif /* _SYSTEM_H_ */
|
|
@ -0,0 +1,219 @@
|
||||||
|
/* threads.c for Eterm
|
||||||
|
* Feb 25 1998, vendu
|
||||||
|
*/
|
||||||
|
|
||||||
|
static const char cvs_ident[] = "$Id$";
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "feature.h"
|
||||||
|
#ifdef USE_POSIX_THREADS
|
||||||
|
# include "main.h"
|
||||||
|
# include "debug.h"
|
||||||
|
# include "screen.h"
|
||||||
|
|
||||||
|
# ifdef PIXMAP_SUPPORT
|
||||||
|
# include "pixmap.h"
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* extern char *sig_to_str(int sig); */
|
||||||
|
|
||||||
|
# ifdef USE_IMLIB
|
||||||
|
extern imlib_t imlib_bg;
|
||||||
|
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# include "threads.h"
|
||||||
|
|
||||||
|
extern int refresh_count, refresh_limit;
|
||||||
|
extern unsigned char *cmdbuf_base, *cmdbuf_ptr, *cmdbuf_endp;
|
||||||
|
extern unsigned char cmd_getc(void);
|
||||||
|
|
||||||
|
# ifdef MUTEX_SYNCH
|
||||||
|
/* pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; */
|
||||||
|
# endif
|
||||||
|
|
||||||
|
short bg_set = 0;
|
||||||
|
pthread_t resize_sub_thr;
|
||||||
|
pthread_attr_t resize_sub_thr_attr;
|
||||||
|
|
||||||
|
# ifdef MUTEX_SYNCH
|
||||||
|
void
|
||||||
|
prepare(void *dummy)
|
||||||
|
{
|
||||||
|
D_THREADS(("prepare(): pthread_mutex_trylock(&mutex)\n"));
|
||||||
|
pthread_mutex_trylock(&mutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
parent(void *dummy)
|
||||||
|
{
|
||||||
|
D_THREADS(("parent(): pthread_mutex_unlock(&mutex)\n"));
|
||||||
|
pthread_mutex_unlock(&mutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
child(void *dummy)
|
||||||
|
{
|
||||||
|
D_THREADS(("child(): pthread_mutex_unlock(&mutex)\n"));
|
||||||
|
pthread_mutex_unlock(&mutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
# endif
|
||||||
|
|
||||||
|
inline void
|
||||||
|
refresh_termwin(void)
|
||||||
|
{
|
||||||
|
scrollbar_show(0);
|
||||||
|
scr_touch();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
render_bg_thread(void *dummy)
|
||||||
|
{
|
||||||
|
void *retval = NULL;
|
||||||
|
|
||||||
|
D_THREADS(("render_bg_thread() entered\n"));
|
||||||
|
|
||||||
|
if (bg_set) {
|
||||||
|
# ifdef AGGRESSIVE_THREADS
|
||||||
|
;
|
||||||
|
# else
|
||||||
|
D_THREADS(("Background already set\n"));
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
# ifdef MUTEX_SYNCH
|
||||||
|
if (pthread_mutex_trylock(&mutex) != EBUSY) {
|
||||||
|
D_THREADS(("pthread_mutex_trylock(&mutex): "));
|
||||||
|
} else {
|
||||||
|
D_THREADS(("mutex already locked\n"));
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
|
D_THREADS(("pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL);\n"));
|
||||||
|
pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL);
|
||||||
|
|
||||||
|
D_THREADS(("pthread_detach();\n"));
|
||||||
|
pthread_detach(resize_sub_thr);
|
||||||
|
|
||||||
|
D_THREADS(("render_bg_thread(): render_pixmap()\n"));
|
||||||
|
render_pixmap(TermWin.vt, imlib_bg, bgPixmap, 0, 1);
|
||||||
|
|
||||||
|
D_THREADS(("refresh_termwin()\n"));
|
||||||
|
refresh_termwin();
|
||||||
|
|
||||||
|
bg_set = 1;
|
||||||
|
|
||||||
|
# ifdef MUTEX_SYNCH
|
||||||
|
D_THREADS(("pthread_mutex_unlock(&mutex);\n"));
|
||||||
|
pthread_mutex_unlock(&mutex);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
D_THREADS(("pthread_exit()\n"));
|
||||||
|
pthread_exit(retval);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Read and process output from the application - threaded version. */
|
||||||
|
void
|
||||||
|
main_thread(void *ignored)
|
||||||
|
{
|
||||||
|
register int ch;
|
||||||
|
|
||||||
|
D_THREADS(("[%d] main_thread() entered\n", getpid()));
|
||||||
|
D_CMD(("bg_set = %d\n", bg_set));
|
||||||
|
|
||||||
|
do {
|
||||||
|
while ((ch = cmd_getc()) == 0); /* wait for something */
|
||||||
|
|
||||||
|
if (ch >= ' ' || ch == '\t' || ch == '\n' || ch == '\r') {
|
||||||
|
/* Read a text string from the input buffer */
|
||||||
|
int nlines = 0;
|
||||||
|
|
||||||
|
/* unsigned char * str; */
|
||||||
|
register unsigned char *str;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* point to the start of the string,
|
||||||
|
* decrement first since already did get_com_char ()
|
||||||
|
*/
|
||||||
|
str = --cmdbuf_ptr;
|
||||||
|
while (cmdbuf_ptr < cmdbuf_endp) {
|
||||||
|
ch = *cmdbuf_ptr++;
|
||||||
|
if (ch >= ' ' || ch == '\t' || ch == '\r') {
|
||||||
|
/* nothing */
|
||||||
|
} else if (ch == '\n') {
|
||||||
|
nlines++;
|
||||||
|
if (++refresh_count >= (refresh_limit * (TermWin.nrow - 1)))
|
||||||
|
break;
|
||||||
|
} else { /* unprintable */
|
||||||
|
cmdbuf_ptr--;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
scr_add_lines(str, nlines, (cmdbuf_ptr - str));
|
||||||
|
} else {
|
||||||
|
switch (ch) {
|
||||||
|
# ifdef NO_VT100_ANS
|
||||||
|
case 005:
|
||||||
|
break;
|
||||||
|
# else
|
||||||
|
case 005:
|
||||||
|
tt_printf(VT100_ANS);
|
||||||
|
break; /* terminal Status */
|
||||||
|
# endif
|
||||||
|
case 007:
|
||||||
|
scr_bell();
|
||||||
|
break; /* bell */
|
||||||
|
case '\b':
|
||||||
|
scr_backspace();
|
||||||
|
break; /* backspace */
|
||||||
|
case 013:
|
||||||
|
case 014:
|
||||||
|
scr_index(UP);
|
||||||
|
break; /* vertical tab, form feed */
|
||||||
|
case 016:
|
||||||
|
scr_charset_choose(1);
|
||||||
|
break; /* shift out - acs */
|
||||||
|
case 017:
|
||||||
|
scr_charset_choose(0);
|
||||||
|
break; /* shift in - acs */
|
||||||
|
case 033:
|
||||||
|
process_escape_seq();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} while (ch != EOF);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void
|
||||||
|
check_bg_pixmap(void)
|
||||||
|
{
|
||||||
|
if (bg_set) {
|
||||||
|
# ifdef MUTEX_SYNCH
|
||||||
|
if (pthread_mutex_trylock(&mutex) == EBUSY) {
|
||||||
|
D_THREADS(("cmd_getc(): mutex locked, bbl\n"));
|
||||||
|
} else
|
||||||
|
# endif
|
||||||
|
{
|
||||||
|
# ifdef MUTEX_SYNCH
|
||||||
|
D_THREADS(("cmd_getc(): pthread_mutex_trylock(&mutex): "));
|
||||||
|
# endif
|
||||||
|
|
||||||
|
D_THREADS(("refresh_termwin() "));
|
||||||
|
refresh_termwin();
|
||||||
|
|
||||||
|
# ifdef MUTEX_SYNCH
|
||||||
|
D_THREADS(("pthread_mutex_unlock(&mutex);\n"));
|
||||||
|
pthread_mutex_unlock(&mutex);
|
||||||
|
# endif
|
||||||
|
/* bg_set = 0; */
|
||||||
|
}
|
||||||
|
|
||||||
|
bg_set = 0;
|
||||||
|
|
||||||
|
/* main_thread(NULL); */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* USE_POSIX_THREADS */
|
|
@ -0,0 +1,33 @@
|
||||||
|
/* threads.h for Eterm
|
||||||
|
* 25 Feb 1998, vendu
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _THREADS_H
|
||||||
|
# define _THREADS_H
|
||||||
|
|
||||||
|
# ifdef USE_POSIX_THREADS
|
||||||
|
|
||||||
|
# ifdef PIXMAP_SUPPORT
|
||||||
|
# include "pixmap.h"
|
||||||
|
# include <X11/Xthreads.h>
|
||||||
|
# endif
|
||||||
|
|
||||||
|
short bg_set;
|
||||||
|
pthread_attr_t resize_sub_thr_attr;
|
||||||
|
pthread_t resize_sub_thr;
|
||||||
|
|
||||||
|
extern void main_thread(void *);
|
||||||
|
extern void render_bg_thread(void *);
|
||||||
|
extern void check_bg_pixmap(void);
|
||||||
|
|
||||||
|
# ifdef MUTEX_SYNCH
|
||||||
|
extern pthread_mutex_t mutex;
|
||||||
|
|
||||||
|
extern void prepare(void *dummy);
|
||||||
|
extern void parent(void *dummy);
|
||||||
|
extern void child(void *dummy);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# endif /* USE_POSIX_THREADS */
|
||||||
|
|
||||||
|
#endif /* _THREADS_H */
|
|
@ -0,0 +1,502 @@
|
||||||
|
/* utmp.c -- Eterm utmp support
|
||||||
|
|
||||||
|
* This program is distributed under the GNU Public License (GPL) as
|
||||||
|
* outlined in the COPYING file.
|
||||||
|
*
|
||||||
|
* Copyright (C) 1997-1999, Michael Jennings and Tuomo Venalainen
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
static const char cvs_ident[] = "$Id$";
|
||||||
|
|
||||||
|
/* includes, defines */
|
||||||
|
#include "config.h"
|
||||||
|
#include "feature.h"
|
||||||
|
#include "screen.h"
|
||||||
|
|
||||||
|
int my_ruid, my_euid, my_rgid, my_egid; /* These are needed regardless of utmp support -- mej */
|
||||||
|
|
||||||
|
#ifdef UTMP_SUPPORT
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
/* For some systems (HP-UX in particular), sys/types.h must be included
|
||||||
|
before utmp*.h -- mej */
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
/* Unsupported/broken utmpx.h on HP-UX, AIX, and glibc 2.1 */
|
||||||
|
#if defined(_HPUX_SOURCE) || defined(_AIX) || (defined(__GLIBC__) && __GLIBC__ >= 2)
|
||||||
|
# undef HAVE_UTMPX_H
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_UTMPX_H
|
||||||
|
# include <utmpx.h>
|
||||||
|
# define USE_SYSV_UTMP
|
||||||
|
#else
|
||||||
|
# include <utmp.h>
|
||||||
|
# ifdef HAVE_SETUTENT
|
||||||
|
# define USE_SYSV_UTMP
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef TIME_WITH_SYS_TIME
|
||||||
|
# include <sys/time.h>
|
||||||
|
# include <time.h>
|
||||||
|
#else
|
||||||
|
# ifdef HAVE_SYS_TIME_H
|
||||||
|
# include <sys/time.h>
|
||||||
|
# else
|
||||||
|
# include <time.h>
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
# include <unistd.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_LASTLOG_H
|
||||||
|
# include <lastlog.h>
|
||||||
|
#endif
|
||||||
|
#include <pwd.h>
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#ifdef HAVE_FCNTL_H
|
||||||
|
# include <fcntl.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef UTMP_FILENAME
|
||||||
|
# ifdef UTMP_FILE
|
||||||
|
# define UTMP_FILENAME UTMP_FILE
|
||||||
|
# elif defined(_PATH_UTMP)
|
||||||
|
# define UTMP_FILENAME _PATH_UTMP
|
||||||
|
# else
|
||||||
|
# define UTMP_FILENAME "/etc/utmp"
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef LASTLOG_FILENAME
|
||||||
|
# ifdef _PATH_LASTLOG
|
||||||
|
# define LASTLOG_FILENAME _PATH_LASTLOG
|
||||||
|
# else
|
||||||
|
# define LASTLOG_FILENAME "/usr/adm/lastlog" /* only on BSD systems */
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef WTMP_FILENAME
|
||||||
|
# ifdef WTMP_FILE
|
||||||
|
# define WTMP_FILENAME WTMP_FILE
|
||||||
|
# elif defined(_PATH_WTMP)
|
||||||
|
# define WTMP_FILENAME _PATH_WTMP
|
||||||
|
# elif defined(SYSV)
|
||||||
|
# define WTMP_FILENAME "/etc/wtmp"
|
||||||
|
# else
|
||||||
|
# define WTMP_FILENAME "/usr/adm/wtmp"
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef TTYTAB_FILENAME
|
||||||
|
# ifdef TTYTAB
|
||||||
|
# define TTYTAB_FILENAME TTYTAB_FILENAME
|
||||||
|
# else
|
||||||
|
# define TTYTAB_FILENAME "/etc/ttytab"
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef USER_PROCESS
|
||||||
|
# define USER_PROCESS 7
|
||||||
|
#endif
|
||||||
|
#ifndef DEAD_PROCESS
|
||||||
|
# define DEAD_PROCESS 8
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* don't go off end of ut_id & remember if an entry has been made */
|
||||||
|
#if defined(USE_SYSV_UTMP) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__)
|
||||||
|
static char ut_id[5]; /* remember if entry to utmp made */
|
||||||
|
|
||||||
|
#else
|
||||||
|
static int utmp_pos; /* BSD position of utmp-stamp */
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_SYSV_UTMP
|
||||||
|
|
||||||
|
# ifdef HAVE_UTMPX_H
|
||||||
|
# undef WTMP_FILENAME
|
||||||
|
# define WTMP_FILENAME WTMPX_FILE
|
||||||
|
# define update_wtmp updwtmpx
|
||||||
|
# else /* HAVE_UTMPX_H */
|
||||||
|
|
||||||
|
static void
|
||||||
|
update_wtmp(char *fname, struct utmp *putmp)
|
||||||
|
{
|
||||||
|
|
||||||
|
int fd, retry = 10; /* 10 attempts at locking */
|
||||||
|
struct flock lck; /* fcntl locking scheme */
|
||||||
|
|
||||||
|
if ((fd = open(fname, O_WRONLY | O_APPEND, 0)) < 0) {
|
||||||
|
D_UTMP(("Warning: Unable to open \"%s\" for writing -- %s\n", fname, strerror(errno)));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
lck.l_whence = SEEK_END; /* start lock at current eof */
|
||||||
|
lck.l_len = 0; /* end at ``largest possible eof'' */
|
||||||
|
lck.l_start = 0;
|
||||||
|
lck.l_type = F_WRLCK; /* we want a write lock */
|
||||||
|
|
||||||
|
# if !defined(EACCESS) && defined(EAGAIN)
|
||||||
|
# define EACCESS EAGAIN
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* attempt lock with F_SETLK - F_SETLKW would cause a deadlock! */
|
||||||
|
while (retry--) {
|
||||||
|
if ((fcntl(fd, F_SETLK, &lck) < 0) && errno != EACCESS) {
|
||||||
|
D_UTMP(("Warning: Unable to establish file lock on \"%s\" -- %s\n", fname, strerror(errno)));
|
||||||
|
close(fd);
|
||||||
|
return; /* failed for unknown reason: give up */
|
||||||
|
} else if (errno == EACCESS) {
|
||||||
|
D_UTMP(("Warning: Unable to establish file lock on \"%s\" -- %s\n", fname, strerror(errno)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
write(fd, putmp, sizeof(struct utmp));
|
||||||
|
|
||||||
|
/* unlocking the file */
|
||||||
|
lck.l_type = F_UNLCK;
|
||||||
|
fcntl(fd, F_SETLK, &lck);
|
||||||
|
|
||||||
|
close(fd);
|
||||||
|
}
|
||||||
|
|
||||||
|
# endif /* HAVE_UTMPX_H */
|
||||||
|
|
||||||
|
/* makeutent() - make a utmp entry */
|
||||||
|
void
|
||||||
|
makeutent(const char *pty, const char *hostname)
|
||||||
|
{
|
||||||
|
struct passwd *pwent = getpwuid(getuid());
|
||||||
|
|
||||||
|
#ifdef HAVE_UTMPX_H
|
||||||
|
struct utmpx utmp;
|
||||||
|
struct utmp utmp2;
|
||||||
|
memset(&utmp, 0, sizeof(struct utmpx));
|
||||||
|
|
||||||
|
#else
|
||||||
|
struct utmp utmp;
|
||||||
|
memset(&utmp, 0, sizeof(struct utmp));
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef WITH_DMALLOC
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!strncmp(pty, "/dev/", 5))
|
||||||
|
pty += 5; /* skip /dev/ prefix */
|
||||||
|
if (!strncmp(pty, "pty", 3) || !strncmp(pty, "tty", 3))
|
||||||
|
strncpy(ut_id, (pty + 3), sizeof(ut_id)); /* bsd naming */
|
||||||
|
else {
|
||||||
|
int n;
|
||||||
|
|
||||||
|
if (sscanf(pty, "pts/%d", &n) == 1)
|
||||||
|
sprintf(ut_id, "vt%02x", n); /* sysv naming */
|
||||||
|
else {
|
||||||
|
print_error("can't parse tty name \"%s\"", pty);
|
||||||
|
ut_id[0] = '\0'; /* entry not made */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
strncpy(utmp.ut_id, ut_id, sizeof(utmp.ut_id));
|
||||||
|
utmp.ut_type = DEAD_PROCESS;
|
||||||
|
|
||||||
|
privileges(INVOKE);
|
||||||
|
#ifdef HAVE_UTMPX_H
|
||||||
|
getutmp(&utmp, &utmp2);
|
||||||
|
getutid(&utmp2); /* position to entry in utmp file */
|
||||||
|
#else
|
||||||
|
getutid(&utmp); /* position to entry in utmp file */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* set up the new entry */
|
||||||
|
strncpy(utmp.ut_id, ut_id, sizeof(utmp.ut_id));
|
||||||
|
strncpy(utmp.ut_line, pty, sizeof(utmp.ut_line));
|
||||||
|
strncpy(utmp.ut_name, pwent->pw_name, sizeof(utmp.ut_name));
|
||||||
|
strncpy(utmp.ut_user, pwent->pw_name, sizeof(utmp.ut_user));
|
||||||
|
strncpy(utmp.ut_host, hostname, sizeof(utmp.ut_host));
|
||||||
|
utmp.ut_type = USER_PROCESS;
|
||||||
|
utmp.ut_pid = getpid();
|
||||||
|
#ifdef HAVE_UTMPX_H
|
||||||
|
utmp.ut_session = getsid(0);
|
||||||
|
utmp.ut_xtime = time(NULL);
|
||||||
|
utmp.ut_tv.tv_usec = 0;
|
||||||
|
#else
|
||||||
|
utmp.ut_time = time(NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* write a utmp entry to the utmp file
|
||||||
|
*/
|
||||||
|
utmpname(UTMP_FILENAME);
|
||||||
|
#ifdef HAVE_UTMPX_H
|
||||||
|
getutmp(&utmp, &utmp2);
|
||||||
|
pututline(&utmp2);
|
||||||
|
pututxline(&utmp);
|
||||||
|
#else
|
||||||
|
/* if (!utmpInhibit) */
|
||||||
|
pututline(&utmp);
|
||||||
|
#endif
|
||||||
|
update_wtmp(WTMP_FILENAME, &utmp);
|
||||||
|
endutent(); /* close the file */
|
||||||
|
privileges(REVERT);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* cleanutent() - remove a utmp entry */
|
||||||
|
void
|
||||||
|
cleanutent(void)
|
||||||
|
{
|
||||||
|
#ifdef HAVE_UTMPX_H
|
||||||
|
struct utmp utmp;
|
||||||
|
struct utmpx utmpx;
|
||||||
|
|
||||||
|
if (!ut_id[0])
|
||||||
|
return; /* entry not made */
|
||||||
|
|
||||||
|
privileges(INVOKE);
|
||||||
|
utmpname(UTMP_FILENAME);
|
||||||
|
setutent();
|
||||||
|
if (getutid(&utmp) == NULL)
|
||||||
|
return;
|
||||||
|
utmp.ut_type = DEAD_PROCESS;
|
||||||
|
utmp.ut_time = time(NULL);
|
||||||
|
pututline(&utmp);
|
||||||
|
getutmpx(&utmp, &utmpx);
|
||||||
|
update_wtmp(WTMP_FILENAME, &utmpx);
|
||||||
|
endutent();
|
||||||
|
privileges(REVERT);
|
||||||
|
|
||||||
|
#else /* HAVE_UTMPX_H */
|
||||||
|
struct utmp *putmp;
|
||||||
|
pid_t pid = getpid();
|
||||||
|
|
||||||
|
if (!ut_id[0])
|
||||||
|
return; /* entry not made */
|
||||||
|
|
||||||
|
privileges(INVOKE);
|
||||||
|
utmpname(UTMP_FILENAME);
|
||||||
|
setutent();
|
||||||
|
/*
|
||||||
|
* The following code waw copied from the poeigl-1.20 login/init package.
|
||||||
|
* Special thanks to poe for the code examples.
|
||||||
|
*/
|
||||||
|
while ((putmp = getutent()) != NULL) {
|
||||||
|
if (putmp->ut_pid == pid) {
|
||||||
|
putmp->ut_type = DEAD_PROCESS;
|
||||||
|
putmp->ut_pid = 0;
|
||||||
|
putmp->ut_user[0] = '\0';
|
||||||
|
putmp->ut_time = time(NULL);
|
||||||
|
pututline(putmp);
|
||||||
|
update_wtmp(WTMP_FILENAME, putmp);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
endutent();
|
||||||
|
privileges(REVERT);
|
||||||
|
#endif /* HAVE_UTMPX_H */
|
||||||
|
}
|
||||||
|
|
||||||
|
#else /* USE_SYSV_UTMP */
|
||||||
|
/* BSD utmp support */
|
||||||
|
|
||||||
|
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__bsdi__)
|
||||||
|
|
||||||
|
#include <ttyent.h>
|
||||||
|
|
||||||
|
/* used to hold the line we are using */
|
||||||
|
static char ut_line[32];
|
||||||
|
|
||||||
|
static int
|
||||||
|
get_tslot(const char *ttyname)
|
||||||
|
{
|
||||||
|
register struct ttyent *ttyp;
|
||||||
|
register int slot;
|
||||||
|
|
||||||
|
setttyent();
|
||||||
|
for (slot = 1; (ttyp = getttyent()); ++slot)
|
||||||
|
if (!strcmp(ttyp->ty_name, ttyname)) {
|
||||||
|
endttyent();
|
||||||
|
return (slot);
|
||||||
|
}
|
||||||
|
endttyent();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
b_login(struct utmp *ut)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
** replacement for freebsd's login(), which uses ttyslot()
|
||||||
|
**
|
||||||
|
** like I shouldn't have just KNOWN that from the comment on get_tslot
|
||||||
|
** below...
|
||||||
|
** - brian
|
||||||
|
*/
|
||||||
|
register int fd;
|
||||||
|
int tty;
|
||||||
|
|
||||||
|
tty = get_tslot(ut->ut_line);
|
||||||
|
if (tty > 0 && (fd = open(_PATH_UTMP, O_WRONLY | O_CREAT, 0644)) >= 0) {
|
||||||
|
(void) lseek(fd, (off_t) (tty * sizeof(struct utmp)), L_SET);
|
||||||
|
(void) write(fd, ut, sizeof(struct utmp));
|
||||||
|
|
||||||
|
(void) close(fd);
|
||||||
|
}
|
||||||
|
if ((fd = open(_PATH_WTMP, O_WRONLY | O_APPEND, 0)) >= 0) {
|
||||||
|
(void) write(fd, ut, sizeof(struct utmp));
|
||||||
|
|
||||||
|
(void) close(fd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#else /* __FreeBSD__ || NetBSD || BSDI */
|
||||||
|
static int utmp_pos = 0; /* position of utmp-stamp */
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------*
|
||||||
|
* get_tslot() - grabbed from xvt-1.0 - modified by David Perry
|
||||||
|
*
|
||||||
|
* find ttyname in /etc/ttytab and return a slot number that can be used to
|
||||||
|
* access the utmp file. Can't use ttyslot() because the tty name is not
|
||||||
|
* that of fd 0.
|
||||||
|
*----------------------------------------------------------------------*/
|
||||||
|
static int
|
||||||
|
get_tslot(const char *ttyname)
|
||||||
|
{
|
||||||
|
char buf[256], name[256];
|
||||||
|
FILE *fd;
|
||||||
|
|
||||||
|
if ((fd = fopen(UTMP_FILENAME, "r")) != NULL) {
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 1; fgets(buf, sizeof(buf), fd) != NULL; i++) {
|
||||||
|
if (*buf == '#' || sscanf(buf, "%s", name) != 1)
|
||||||
|
continue;
|
||||||
|
if (!strcmp(ttyname, name)) {
|
||||||
|
fclose(fd);
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fclose(fd);
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* write utmp entry to UTMP_FILENAME
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
write_utmp(struct utmp *putmp)
|
||||||
|
{
|
||||||
|
int rval = 0;
|
||||||
|
FILE *fd;
|
||||||
|
|
||||||
|
fprintf(stderr, "Utmp file is %s\n", UTMP_FILENAME);
|
||||||
|
privileges(INVOKE);
|
||||||
|
if ((fd = fopen(UTMP_FILENAME, "r+")) != NULL) {
|
||||||
|
utmp_pos = get_tslot(putmp->ut_line) * sizeof(struct utmp);
|
||||||
|
|
||||||
|
if (utmp_pos >= 0) {
|
||||||
|
fseek(fd, utmp_pos, 0);
|
||||||
|
fwrite(putmp, sizeof(struct utmp), 1, fd);
|
||||||
|
|
||||||
|
rval = 1;
|
||||||
|
}
|
||||||
|
fclose(fd);
|
||||||
|
}
|
||||||
|
privileges(REVERT);
|
||||||
|
return rval;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* __FreeBSD__ || NetBSD || BSDI */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* make a utmp entry
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
makeutent(const char *pty, const char *hostname)
|
||||||
|
{
|
||||||
|
struct passwd *pwent = getpwuid(getuid());
|
||||||
|
struct utmp utmp;
|
||||||
|
|
||||||
|
memset(&utmp, 0, sizeof(struct utmp));
|
||||||
|
|
||||||
|
if (!strncmp(pty, "/dev/", 5))
|
||||||
|
pty += 5; /* skip /dev/ prefix */
|
||||||
|
if (!strncmp(pty, "pty", 3) || !strncmp(pty, "tty", 3))
|
||||||
|
strncpy(ut_id, (pty + 3), sizeof(ut_id)); /* bsd naming */
|
||||||
|
else {
|
||||||
|
print_error("can't parse tty name \"%s\"", pty);
|
||||||
|
ut_id[0] = '\0'; /* entry not made */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__bsdi__)
|
||||||
|
strncpy(ut_line, pty, 31);
|
||||||
|
|
||||||
|
strncpy(utmp.ut_line, pty, UT_LINESIZE);
|
||||||
|
strncpy(utmp.ut_name, pwent->pw_name, UT_NAMESIZE);
|
||||||
|
strncpy(utmp.ut_host, hostname, UT_HOSTSIZE);
|
||||||
|
utmp.ut_time = time(NULL);
|
||||||
|
|
||||||
|
b_login(&utmp);
|
||||||
|
#else /* __FreeBSD__ || NetBSD || BSDI */
|
||||||
|
strncpy(utmp.ut_line, ut_id, sizeof(utmp.ut_line));
|
||||||
|
strncpy(utmp.ut_name, pwent->pw_name, sizeof(utmp.ut_name));
|
||||||
|
strncpy(utmp.ut_host, hostname, sizeof(utmp.ut_host));
|
||||||
|
utmp.ut_time = time(NULL);
|
||||||
|
|
||||||
|
if (write_utmp(&utmp) < 0)
|
||||||
|
ut_id[0] = '\0'; /* entry not made */
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* remove a utmp entry
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
cleanutent(void)
|
||||||
|
{
|
||||||
|
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__bsdi__)
|
||||||
|
logout(ut_line);
|
||||||
|
logwtmp(ut_line, "", "");
|
||||||
|
#else /* __FreeBSD__ */
|
||||||
|
FILE *fd;
|
||||||
|
|
||||||
|
privileges(INVOKE);
|
||||||
|
if (!ut_id[0] && (fd = fopen(UTMP_FILENAME, "r+")) != NULL) {
|
||||||
|
struct utmp utmp;
|
||||||
|
memset(&utmp, 0, sizeof(struct utmp));
|
||||||
|
|
||||||
|
fseek(fd, utmp_pos, 0);
|
||||||
|
fwrite(&utmp, sizeof(struct utmp), 1, fd);
|
||||||
|
|
||||||
|
fclose(fd);
|
||||||
|
}
|
||||||
|
privileges(REVERT);
|
||||||
|
#endif /* __FreeBSD__ || NetBSD || BSDI */
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* USE_SYSV_UTMP */
|
||||||
|
|
||||||
|
#endif /* UTMP_SUPPORT */
|
|
@ -0,0 +1 @@
|
||||||
|
timestamp
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue