1
0
Fork 0

Adding upstream version 4.9.1.

Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
This commit is contained in:
Daniel Baumann 2025-06-22 15:19:57 +02:00
parent 189fc4f449
commit e88291c4cd
Signed by: daniel.baumann
GPG key ID: BCC918A2ABD66424
134 changed files with 117972 additions and 0 deletions

21
.gitignore vendored Normal file
View file

@ -0,0 +1,21 @@
*.o
.*.swp
\#*\#
*~
Makefile
autom4te.cache
cscope.out
TAGS
tags
comm.h
config.h
config.h.in
config.log
config.status
configure
kmapdef.c
osdef.h
term.h
screen
stamp-h.in
tty.c

169
.iscreenrc Normal file
View file

@ -0,0 +1,169 @@
#
# A sample .screenrc which I use for everyday work.
#
# some of the commands commented out here, have been moved to
# /local/etc/screenrc
#
# we want no password, right?
#password # This will ask us for a password.
password none # Same as not even mentioning it.
#password 12Bz/9hNlPLZk # "1234"
#password YahtrWblnJw # ypmatch jnweiger passwd. Well, ... :-)
scrollback 200 # we have a 200 lines history buffer
markkeys "@=\177:@=^C" # our mad facit-twist terminal buffer overflow...
markkeys "h=^B:l=^F:\$=^E" # some missing emacs style bindings in copymode
echo -n "booting screen"
# let it flash, not horn!
#vbell on # "vbell" doesn't work any longer, sorry.
#vbell_msg " Wuff, Wuff!! " # this is the default message
#bell "Bimmmel No. %" # sounds the bell and shows a message
# we want to login all windows we create.
#login on # "login", "nologin" don't work any longer, sorry 2.
echo -n "."
# we have no termcap entry for screen on the target machine? Well then
# we tell a lie.
term screen # would be the obvious default here.
#term vt100 # screen will understand vt100 for 99%.
# we want to survive hangups
# note that the default setting is off now!
autodetach on
# when we open a window, where shall its CWD be?
chdir # without argument it's my $HOME
echo -n "."
# I hate nonexisting status lines! Force screen to believe me.
#hardstatus off
# now some Terminal setup:
# Printing in the leftmost column is not save. We express that fact as :LP@:
#
# Emacs tends to smear it's highlighted status bar across the screen, producing
# ugly areas of bright background, if termcap isn't perfectly sober.
# Give a little :ms@: in the termcap, this may help.
#
# And who invented the initialisation for facit terminals? We tell him that
# we don't like smooth scroll, by specifying :ti=\E[?l:.
# \E[?3l 80 Zeichen
# \E[?3h 132 Zeichen
# LP Last column Printable
# \E[A cursor up
# \E[B cursor down
# \E[?4h smooth scroll
# \E[?4l jump scroll
# \E[%dL insert %d lines
# \E[K clear to end of line
# cs \E[%i%d;%dr for twist and xterm
# ms@ Move in Standout mode is NOT save.
# WS our private variable, it declares that the terminal can
# be resized by an escape-sequence
# The termcap statement takes 2 or three parameters. First parameter lists
# which TERMCAPs are affected by this statement. Second we specify changes
# in screen's view of that terminals. Third we may specify some capabilities
# that user-programs want to see in the $TERMCAP environment variable or in
# screen's termcap entry.
termcap vt* cl=\E[H\E[J\E[?1h:vi=\E[?35h:ve=\E[35l:ti=\E[?4l[vt100]
termcap facit ti=\E[?4l[facit]
termcap xterm* is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l:Z0=\E[?3h:Z1=\E[?3l
echo -n "."
# "\E(B", "\E(0", "\E(1", "\E(2", ... to switch between charsets.
# screen internally emulates G1: "\E)..", G2: "\E*..", G3: "\E+.."
# you can switch between them, with:
#
# code | switch to
# ------+------
# ^O | G0
# ^N | G1
# \En | G2
# \Eo | G3
#termcap facit|vt100|xterm* G0
# how do we resize windows? under sunview, this is standard, but xterm
# needs to be a specially hacked xterm, to make this work.
termcap xterm* WS=\E[8;%d;%dt
# ICL 6402 testing:
termcap icl* G0:S0=\E$[start]:E0=\E%[end]:C0=j9k<l6m3n?q\:t7u=v;w>x5 GS=\E(0^O:GE=\E(B^O:G1=k:G2=l:G3=m:G4=j:GV=x:GH=q:GR=u:GL=t:GU=w:GD=v:GC=n
# Flow control produces trouble. ^S und ^Q will never reach screen, as our
# terminals catch them locally. Who can explain that to me?:
#flow on|off|auto [interrupt]
# Long lines get wrapped around (the back of your terminal). This is the
# default for vt100. But now programs make different asumptions about your
# terminal. You may find two linefeeds where you'd expect one, or you may
# be confronted with a truncated line. Currently there is no fix, but pressing
# C-A r and doing a redraw.
#wrap on
# the autoaka allows you to see the currently executing shell command in the
# window name field. To use that, your shell prompt must contain ^[k^[\ or
# you will see the string "(init)" as a name.
# in my .cshrc I may use this for a wonderful tcsh-prompt:
# set prompt="%{^[k^[\\%}%h %c2(%m)%# "
#
# defining a shellaka that contains a pipe-symbol (|) activates the
# autoaka feature. To the left of that | you specify a constant part of
# your prompt as a trigger, to the right you may place a default string
# as in
shellaka '> |tc'
# but beware! specifying a window name with the -t option has priority over
# the autoaka mechanism. Although specifying -t "> |foo" will work.
# shellaka tc
# ... now a little bit of key bindings
# In case we don't have write permission for /etc/utmp (no s-bit)
# we create even local windows via rlogin. -> Et voila: a utmp-slot
# utmp-slots are strongly recommended to keep sccs and talk happy.
# (thus we have ^A# or. ^Ac for window creation with or without utmp-slot.)
# but if we run suid-root, we produce all the rlogins with -ln,
# as nobody shall refer to these pty's.
bind '!' screen -ln -k faui41 rlogin faui41
bind '@' screen -ln -k vme2 rlogin faui4_vme2
#bind '#' screen -k faui43
bind '#' screen -ln -k faui43 rlogin faui43
bind '$' screen -ln -k faui44 rlogin faui44
bind '%' screen -ln -k faui45 rlogin faui45
bind '\^' screen -ln -k sup1 rlogin fausup1
bind '&' screen -ln -k sup2 rlogin fausup2
bind '*' screen -ln -k faui48 rlogin faui48
bind '(' screen -ln -k faui09 rlogin faui09
bind ')' screen -ln -k faui10 rlogin faui10
bind 'J' screen -ln -k 4j rlogin faui4j
bind 'P' screen -ln -k 4p rlogin faui4p
bind '^C' screen -ln -k 45c rlogin faui45c
bind '^D' screen -ln -k 45d rlogin faui45d
bind '^E' screen -ln -k 45e rlogin faui45e
bind '^I' screen -ln -k 45i rlogin faui45i
# these two are logIn and logOut. As a toggle is too stupid.
#bind 'I' set login on
#bind 'O' set login off
bind 'L'
# What happens, when you 'think emacs' and want to erase a whole
# line? You type ^A^K right? Under screen it should be ^Aa^K. But...
# killing the window would be a real punishment for a little mistyping.
bind k #wow! I even mange to type ^Ak by accident.
#bind ^k
#bind K kill
echo -n "."
#screen 1:faui43 # My good old <nr>:<alias> syntax
#screen -k faui43 # The way Wayne Davison thinks about it.
#screen -ln -k faui43 # this one not logged in.
#screen -ln 2:faui09 rlogin faui09 -l jnweiger
# Finally another bonus feature for people using strange terminal settings like
# different baud rate, etc. The next user will get standard settings
# as ^[c is a reset sequence.
#pow_detach_msg "" # is the default
pow_detach_msg "c"
echo "done."

674
COPYING Normal file
View file

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. 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
them 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 prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. 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.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey 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;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If 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 convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU 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 that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
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.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
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.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 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, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program 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, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU 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 Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

632
ChangeLog Normal file
View file

@ -0,0 +1,632 @@
Version 4.9.1 (20/08/2023):
* Support stop/parity bits on serial port (#23952)
* Add needed system headers in checks and return values
for implicit function declarations
* Fixes:
- Avoid zombies after shell exit (#25089)
- Missed signal sending permission check on failed
query messages (CVE-2023-24626)
- manpage fixes
- source code fixes during cleanup
- UTF-8 encoding can emit invalid UTF-8 sequences
for out of range unicode values (#62097)
Version 4.9.0 (30/01/2022):
* Hardstatus option for used encoding (escape string '%e')
* OpenBSD uses native openpty() from its utils.h
* Fixes:
- fix combining char handling that could lead to a segfault
- CVE-2021-26937: possible denial of service via a crafted UTF-8 character sequence (bug #60030)
- make screen exit code be 0 when checking --help
- session names limit is 80 symbols (bug #61534)
- option -X ignores specified user in multiuser env (bug #37437)
- a lot of reformations/fixes/cleanups (man page and source code)
Version 4.8.0 (05/02/2020):
* Improve startup time by only polling for files to close
* Fixes:
- Fix for segfault if termcap doesn't have Km entry
- Make screen exit code be 0 when checking --version
- Fix potential memory corruption when using OSC 49
Version 4.7.0 (02/10/2019):
* Add support for SGR (1006) mouse mode
* Add support for OSC 11
* Update Unicode ambiguous and wide tables to 12.1.0
* Fixes:
- cross-compilation support (bug #43223)
- a lot of manpage fixes and cleanups
Version 4.6.2 (23/10/2017):
* Fixes:
- revert changes to cursor position restore behavour (bug #51832)
- set freed pointer to NULL (bug #52133)
- documentation fixes
- fix windowlist crashes (bug #43054 & #51500)
Version 4.6.1 (10/07/2017):
* Fixes:
- problems with starting session in some cases
- parallel make install
- segfault when querying info on nonUTF locale (bug #51402)
Version 4.6.0 (28/06/2017):
* Update Unicode wide tables to 9.0 (bug #50044)
* Support more serial speeds
* Improved namespaces support
* Migrate from fifos to sockets
* Start viewing scrollback at first line of output (bug #49377)
Version 4.5.1 (25/02/2017):
* Fixes:
- logfile permissions problem (CVE-2017-5618)
- SunOS build problem (bug #50089)
- FreeBSD core dumps (bug #50143)
Version 4.5.0 (10/12/2016):
* Allow specifying logfile's name via command line parameter '-L'
* Fixes:
- broken handling of "bind u digraph U+" (bug #48691)
- crash with long $TERM (bug #48983)
- crash when bumping blank window
- build for AIX (bug #49149)
- %x improperly separating arguments
- install with custom DESTDIR (bug #48370)
Version 4.4.0 (19/06/2016):
* Support up to 24 function keys
* Fix runtime issues
* 'logfile' command, starts logging into new file upon changing
Version 4.3.1 (28/06/2015):
* Fix resize bug
Version 4.3.0 (13/06/2015):
* Introduce Xx string escape showing the executed command of a window
* Implement dead/zombie window polling, allowing for auto reconnecting
* Allow setting hardstatus on first line
* New Commands:
- 'sort' command sorting windows by title
- 'bumpleft', 'bumpright' - manually move windows on window list
- 'collapse' removing numbering 'gaps' between windows, by renumbering
- 'windows' command now accepts arguments for use with querying
Version 4.2.1 (28/04/2014):
* allow for terminal with long $TERM (up to 32 characters)
* allow to use long logins
* documentation fixes
* runtime fixes
Version 4.2.0 (17/04/2014):
New Commands:
* 'unbindall' to unbind all commands
* 'up', 'down', 'left', 'right' sub-commands for 'focus'
* 'rendition' to specify rendition to use in caption/hardstatus for window-names that have bell/monitor/silence/so turned on.
* 'layout', with the following sub-commands
- 'title'
- 'number'
- 'autosave' ('autosave on' or 'autosave off')
- 'new'
- 'save' ('save <name>')
- 'select'
- 'next'
- 'prev'
- 'attach'
- 'show'
- 'remove'
- 'dump'
* 'group' for moving window(s) into a group.
* 'defmousetrack' and 'mousetrack', to turn on/off mouse-tracking for
displays. It's turned off by default. With mouse-tracking turned on, it's
possible to switch to a region ('focus') using mouse clicks. It's also
possible to select a text region in copy-mode using a mouse click to place
a mark and the scroll wheel to scroll through the buffer. Additional
features might be to allow clicking on window-titles in the caption to
switch to that window.
* All commands prefixed '@' are treated as 'quiet', i.e. '@'-prefixed commands
do not trigger any display messages.
Changed Commands:
* '-v' parameter to 'split' command for vertical splits.
* 'sorendition' deprecated in favour of 'rendition so'.
* 'digraph' can take a second parameter to specify custom digraphs. For
example,
'digraph >= ≥' or 'digraph >= U+2265'
Using '0' as the second parameter will remove the digraph.
* 'stuff' will prompt for input if there's nothing to stuff.
* The argument to ":number" can be prefixed with '+' or '-' to use it as a
relative argument.
* '-g' parameter to 'windowlist' to show nested list of windows.
* '//group' parameter to 'screen' to create a grouped window.
* 'blankerprg' shows the currently set command on no argument.
* 'maxwin' can now be used to increase the number of maximum windows.
.screenrc:
* $PID expands to the PID of the screen session.
* $PWD expands to the current working directory of the session.
* $STY expands to the session name.
* Tilde-expansion in pathnames (e.g. for the 'source' command)
* C-style escapes can be used (e.g. "\n" to get a newline with 'stuff')
* '%p' in caption/hardstatus string expands to the PID of the backend, and
'%+p' expands to the PID of the frontend (display).
* '%S' in caption/hardstatus string expands to the session name.
* '%P' in the caption string evaluates to true if the region is in copy mode.
* '%E' in the caption string evaluates to true if the escape character has
currently been pressed.
Window List:
* Nested views when there are window groups (with 'windowlist -g').
* Press 'm' to toggle the most-recent view.
* Press 'g' to toggle nestedness.
* Press 'a' to view all windows in the list.
* Press '/' to search in the list.
* Press ',' and '.' to re-order windows in the list.
* Press 'K' to kill a window (requires confirmation).
Display List:
* Press 'd' to detach a display, 'D' to power-detach.
Others:
* Start using 'ChangeLog' for logging changes again.
* Terminfo update for 256-color support.
* Multiple input history (partially from Romain Francoise).
* vi-like fFtT;, searching in copy mode.
* In copy mode, search in reverse direction when 'N' is pressed.
* Tab-completion for command input.
* Some more readline-like bindings in input mode (e.g. ^W, ^D, ^P, ^N etc.)
* Fix displaying unicode characters in the caption/hardstatus on UTF8 locale.
* A revamped displays list (for 'displays' command)
* Increased default maximum number of windows from 40 to 100.
* Increased number color/attribute changes in caption/hardstatus string from 16 to 256.
* Some commands can be remotely queried using the -Q command-line flag.
In-Progress:
* Scripting support (thanks to Google Summer of Code 2009 project by Rui Guo)
Developers:
* Alexander Naumov <alexander_naumov@opensuse.org>
* Amadeusz Sławiński <amade@asmblr.net>
* Juergen Weigert <jw@suse.de>
* Michael Schroeder <mls@suse.de>
* Micah Cowan <micah@cowan.name>
* Sadrul Habib Chowdhury <sadrul@users.sourceforge.net>
Contributors:
* Clavelito <maromomo@hotmail.com>
* Dick <dick@mrns.nl>
* Gabriel <g2p.code@gmail.com>
* Benjamin Andresen <bandresen@gmail.com>
* Takeshi Banse <takebi@laafc.net>
* Maarten Billemont <lhunath@gmail.com>
* Curtis Brown <mrbrown8@juno.com>
* Cyril Brulebois <kibi@debian.org>
* Trent W Buck <trentbuck@gmail.com>
* Stephane Chazelas <stephane_chazelas@yahoo.fr>
* Kees Cook <kees@ubuntu.com>
* Thomas Dickey <tom@invisible-island.net>
* Christian Ebert <blacktrash@gmx.net>
* Geraint Edwards <gedge-lists-screen@yadn.org>
* Romain Francoise <romain@orebokech.com>
* Alexander Gattin <xrgtn@yandex.ru>
* Emanuele Giaquinta <e.giaquinta@glauco.it>
* Yi-Hsuan Hsin <mhsin@mhsin.org>
* Kipling Inscore <kinscore@synaptics.com>
* Chris Jones <cjns1989@gmail.com>
* Max Kalashnikov <mmt@maxkalashnikov.com>
* Steve Kemp <steve@steve.org.uk>
* Ryan Niebur <ryan@debian.org>
* Jan Christoph Nordholz <hesso@pool.math.tu-berlin.de>
* William Pursell <bill.pursell@gmail.com>
* Michael Scherer <misc@mandriva.org>
* Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
* Peter Teichman <peter@teichman.org>
30.10.94
This is a quick overview of screen's life story. But it is not up
to date. You'll find more details about the revision history in
patchlevel.h and newer changes are only documented there.
31.7.93 -- 3.5.1
================
* writelock, number, paste with arg, at, zombie and wall commands added.
* Access Control Lists and more multi-user support added.
* select and setenv commands enhanced.
* socket.c: motorola bugfix.
* configure.in: --srcdir support.
* configure.in: recognize alpha and SUNOS3 correctly.
* doc/screen.texinfo: Documentation by Jason Merrill.
13.05.93 -- 3.3.3
=================
* defautonuke, silence commands added.
* exec command added.
* hardcopydir, logdir commands added.
* Made a superb configure script.
* BROKEN_PIPE, SOCK_NOT_IN_FS added for braindamaged systems.
* multi display, multi user support.
* process command. CS, CE switch cursorkeycap in application mode.
* lockprg pow_detaches on SIGHUP
* ins_reg copy_reg commands.
* new screenrc syntax.
* split up screen.c and ansi.c
21.10.92 -- 3.2.9
================
* ChangeLog: replaces CHANGES and is in GNUish format.
* Makefile (CFLAGS, M_CFLAGS, LIBS, OPTIONS): moved user config here,
merged all Makefiles, GNUified
* socket.c (FindSocket): ignoring bad files in $SCREENDIR
* config/config.linux: ported.
* utmp.c, exec.c, loadav.c: split apart from screen.c/fileio.c
15.07.92 -- 3.2.8
=================
* ansi.c (WriteString): automatic character set switching for 8bit support
3.2.3-3.2.7
===========
* concept changes: Display structure, Multi attacher
...
3.2.2
=====
* screen.c (main): -m option, "_M_ake always new session", ignore $STY
* screen.c (main): -Ssessionname
* fileio.c (RcLine): ^A:sessionname give your session a nicer name.
* screen.c (main): supporting detached startup via screen -d -m -Ssockname
* fileio.c (stripdev): moved, could not compile
* overlay.h: "stackable overlay concept"
* search.c: vi-like / and ? search AND emacs-like ^S and ^R incremental search
in scrollback
* mark.c: I meant BSDI not BSD
* concept change: struct display and struct newwin introduced.
* screen.c (main): -v option prints version.
* screen.c (MakeWindow): ^A:screen /dev/ttya opens a character device
instead of forking ShellProg with a pty pair.
3.2.0
=====
Ultrix port
Irix 3.3 SGI port
shadow password suite supported
data loss on stdin overflow fixed
"refresh off" keyword added.
3.1.1
------
Screen is now under the GNU copyleft license. See file COPYING.
command line option -A. $LINES, $COLUMNS improved.
C-A : vbellwait <sec>
XENIX support (Ronald Khoo)
SYSV has uname() instead of gethostname().
hpux has setresuid.
ClearScreen now saves image to scrollback buffer.
mips has setenv.
numerous bugfixes.
3.1 finally released version.
=============================
3.0.99: last minute changes:
----------------------------
MIPS support (J{rvinen Markku)
SVR4 support (Marc Boucher)
secopen() secfopen() calls replace stat/access/open.
C-a : echo improved.
'register int'
Changes up to Screen 3.0 Patchlevel 7
=====================================
Better terminfo support: Screen now checks if a termcap/info
entry which the name "screen.$TERM" does exist. Look in the
"VIRTUAL TERMINAL" section of the manual for more details.
Many security improvements.
ScrollRegion() bug fixed which caused slow scrolling if AL
or DL was used.
Pyramid and Ultrix support added. (Tim and Larry)
ENVIRONMENT support.
/local/etc/screenrc checks for $SYSSCREENRC
$HOME/.screenrc checks for $ISCREENRC and $SCREENRC
/local/screens checks for $ISCREENDIR and $SCREENDIR
.screenrc understands ${VAR} and $VAR .
screen 3.0 Patchlevel 6
=======================
.screenrc:
screen now only opens the windows you explicitly ask for.
If you specify none, you still get one window, of course.
screen 3.0. Patchlevel 5
========================
Ansi prototyping by Christos.
copy mode: CTRL-U / CTRL-D exchanged. code cleanup.
changes to screen 3.0 patchlevel 4
==================================
markkeys "string"
allows to rebind the keys used in copy/history mode.
string is made up of pairs "<oldchar>=<newchar>" which are separated
by a colon. Oldchar and newchar are either single ascii characters,
or the two character sequence ^x, where x is an ascii character, or
a 3 digit octal value prepended with '\'. the string "\040=.:^M=q"
rebinds '.' to set marks, and the return key will abort copy mode.
set scrollback 100
resizes the scrollback history buffer to 100 lines. a default of 50
is installed.
A Howard Chu like scrollback history is installed. Many vi-like keys
are added to the copy mode. The '?' key reports on cursor position.
screen 3.0 Patchlevel 3
=======================
WriteString fixed, it did kill the display variable.
Yet another LP bugfix.
non vt100 semi-graphics character support.
waynes patch fixed
screen 3.0 Patchlevel 2
=======================
wayne patches cursor motion outside scrollregions.
.screenrc
monitor on|off
changes in Screen 3.0 Patchlevel 1
==================================
screen -wipe
^A : set vbell_msg "Wuff Wuff"
Thousand enhancements: help resizable, copy'n'paste in main
socket loop, and no more '\0' hackin'. :WS=\E8;%d;%dt:
screen can now resize windows under sunview.
^A : set crlf on|off
effects markroutine join.
screen learned about sized windows under X
screen -ls (-d) -q
quiet option. We count the number of detached (attached) sessions and set
a return value of 10+n. The -q option inhibits all startup
warnings/messages. i.e. screen -R -q may return with code 12 or higher
or start a new/old session.
pow_detach_msg "text string"
new command, allows messages, terminal reset, etc. on logout caused
by pow_detach.
^A : learned a new keyword "set":
commands like "login on" , "vbell off", ... affect the default for
windows to be created. But commands like "set login off" affect
the actual setting of this window. and not the default.
such commands may be bound to keys. example:
bind 'O' set login off
is valid in your .screenrc as well as typed at the ':' prompt.
a bonus is ":set all" which is synonym to ":help".
At the Colon prompt also KeyNames can be entered, although that makes
not always sense.
^A x uses a builtin lockprg, if
a) we don't find our lockprg, or
b) user supplies us with the environment variable LOCKPRG set to "builtin"
the builtin locks until your login password is typed. on systems using
"shadow password files" you are prompted for a password.
markroutine can append joined.
screen removes the "controlling tty" from utmp while ptys are attached.
markroutine performs CR+NL when '\n' is pressed
screen may die quietly, when no TERMCAP entry for "screen" is
found, and screen is run under X-windows
_SEQUENT_ marks sequent386_ptx
screen runs now under SunOS4.1.1 (we need setsid()!).
bug in SetForeWindow fixed.
rare markroutine bug fixed.
we don't open every file the attacher tells us.
we have now our wonderful "Wuff, Wuff" visual_bell
we have now the interprocess-communication-buffer. secure version.
'^A =' removes the interprocess-communication-buffer.
markroutine as in 2.1
markroutine: 'a' toggles append mode,
'>' like ' ', but immediately WriteFile(DUMP_EXCHANGE) then.
'A' like ' ', but first switch to append mode.
.screenrc understands "screen 2:faui09 rlogin faui09 -l jnweiger"
and "password none"
and "vbell [on|off]"
'^A :' allows .screenrc commands "online".
screen now receives new $TERM from attacher, when it is reattached
MakeClientSocket() fifo version does now test for access.
.screenrc learns "hardstatus {on|off}"
termcap's VB is used for vbell if available.
Attach() code rewritten:
screen now lists socket directory, if it does not find a suitable socket
screen -d [host.tty] detaches a running screen.
screen -[ls|list]
list all sockets that we find in our sockdir
when the socket has been removed, send a SIGCHLD to the poor SCREEN
process and it will try to recover. then try a 'screen -r' again.
all the socket stuff lives now in an extra file.
Major changes in version 2.4:
=============================
* Test version that presents the erlangen extensions from 2.0 in a 2.3
screen.
* window resize support
* screen locking C-a x
* support for SYSV
* password protection
* copy & paste across screens
* remote detach and power detach
Major changes in version 2.3:
* Terminal emulation has been significantly enhanced and bugfixed.
* We now fully update the last character on the screen for true auto-
margin terminals, though there may be some delay before the character
can be safely added to the screen. If your terminal has character
insert it will be used to shorten the delay.
* Added the "termcap" .screenrc command to tweak your terminal's termcap
entry AND to customize the termcap generated for the virtual terminals.
See also the -L and -O command-line options, and the SCREENCAP environ-
ment variable.
* Fixed screen's character handling when detached or suspended to NOT block
the child processes in their windows -- output continues to be processed
in the background.
* Added a.k.a.s (window-name aliases) that allow you to customize the
window-information line, including being able to change the name on-
the-fly to reflect what's currently running in the window (see the
-k option, shellaka command, and ALSO KNOWN AS discussion in the doc).
* Added the ability to log the output of a window to a file (see the
"C-a H" (log) command).
* Flow-control can now be set for each window and switched interactively
(see the "flow" command, -f option, and FLOW CONTROL discussion).
* Individual windows can be included or excluded from mention in the
/etc/utmp file (see the "login" command and -l option).
* Added an activity monitor, which allows you to have a window watched for
the start of any output and alert you when it occurs (see the "C-a M"
(monitor) command).
* Enhanced the information in the window-information line to keep track of
windows that have: logging turned on '(L)'; beeped in the background '!';
became active while being monitored '@' (see the "C-a w" (windows) command).
* Added an on-line help display that lists all the commands and their
key bindings (see the "C-a ?" (help) command).
* Extended handling of the beep message (and also the new activity message)
to allow '~' to specify a literal beep (see the "beep" and "activity"
.screenrc commands).
* You can now set the default action on receipt of a hangup signal: detach
or terminate (see the "autodetach" .screenrc command).
* Routing of characters to their virtual terminals has been enhanced to
not drop characters nor (in rare circumstances) hang up screen.
* The NFS compatibility has been enhanced.
Major changes in version 2.0a:
* Screen allows you to `detach' the "screen" session from the physical
terminal and resume it at a later point in time (possibly on a
different terminal or in a different login session).
To get an impression of this functionality do the following:
- call "screen" and create a couple of windows
- type Control-A Control-D (screen terminates; you are back
in the shell)
- call "screen -r" to resume the detached screen
* Screen supports multiple character sets and the ISO 2022 control
functions to designate and switch between character sets.
This allows you, for instance, to make use of the VT100 graphics
character set or national character sets.

1
FAQ Symbolic link
View file

@ -0,0 +1 @@
doc/FAQ

39
HACKING Normal file
View file

@ -0,0 +1,39 @@
WIP notes on hacking the Screen source.
* Screen commands are handled by the DoAction function in process.c.
The local variable nr is set to an integer value representing the
command to be evaluated; for every command `foo', there is an
integer value RC_FOO for use as nr's value to represent it. Find
the matching case label to follow processing of the command.
The RC_FOO values are defined in comm.h, which is automatically
generated by comm.sh, based on the names of the commands
themselves (found in comm.c).
* The current display is held in the global variable "display".
Variable names like D_foo are shorthands for display->d_foo (where d_foo
is a member of "struct display").
* Names like D_IS, D_TI, D_SG usually refer to the values of various
termcap features of the current display. These are found in term.h,
which is automatically generated from term.c by term.sh.
* The main input-reading function for handling user input from a display,
is disp_readev_fn in display.c. This also handles automatic transformation
of mouse-tracking codes from display coordinates to screen-window
coordinates, and decodes characters from the display's encoding, passing
it on to the foreground input processor.
Input is passed through ProcessInput in process.c to handle
keybindings (specified by bindkey and such), and then processed by
layer-specific input-processing functions, which you'll find in
instances of struct LayFuncs. For instance, keystrokes are processed
by:
normal windows: WinPrGocess
window in copy-mode: MarkProcess
window list: WListProcess
command input line: InpProcess
* Handling string escapes (in hardstatus and the like), such as %w or
%{= bw}, is done in screen.c, MakeWinMsgEv().

114
INSTALL Normal file
View file

@ -0,0 +1,114 @@
Installation of GNU screen.
0.) This instruction is quite lengthy
-------------------------------------
... and there are still important items near the end. Start here:
Unpack. Screen comes as a compressed tar archive. You need gzip to
uncompress. And... well, you probably already managed that step,
when you are reading this.
For general documentation on the coding and usage standards this
distributions follows, see the GNU standards document on
https://www.gnu.org/prep/standards/, especially the `Makefile
Conventions', `Configuration', and `User Interfaces' sections.
0.) autogen.sh
--------------
First, run ./autogen.sh. This will create configure file that you can use.
This should be already done, so you can skip this step.
1.) configure & config.status
-----------------------------
Run ./configure. This should create a reasonable Makefile and a config.h file
suited for your machine. Rename config.status to reflect the architecture
(hostname) where it was built. To reconfigure quickly for that architecture
just run that config.status file.
If this process fails, try to find out what configure did do and what it
should have checked.
And then please report a bug (https://savannah.gnu.org/bugs/?group=screen
or mail screen-devel@gnu.org).
Actually the initial Makefile that comes with the distribution just runs
configure -- thus you can start by typing 'make' right after unpacking.
You will be prompted to run 'make' again, which will really make screen.
2.) Makefile & config.h
-----------------------
Look through the Makefile & user configuration section in config.h and check
pathnames. Change them to suit your installation requirements. Usually
sysadmins discuss the location of SOCKDIR, whether it should be in /tmp or
not. At least it must be on a filesystem that supports sockets/fifos.
SOCKDIR must not point into an AFS (Andrew File System) mounted directory.
If you are uncertain about your NFS implementation, use a UFS directory for
SOCKDIR. Personally, I favour a user's home directory and recommend the the
/tmp/ area.
The path for ETCSCREENRC may also need to be adapted.
3.) how to actually compile
---------------------------
Run 'make'. Screen should compile without too many warnings :)
The creation of term.h, comm.h, tty.c or osdef.h may fail on some machines
for some odd reason. (E.g. the sed under SCO-unix is known to be
case-insensitive and breaks term.h.) If so, please mail a short description
of the problem to screen-devel@gnu.org and use the files ending in .dist
as a replacement (or in case of osdef.h retry with an empty file).
You can then try 'make install' (if you dare).
4.) where to install
--------------------
You may well run screen from your private binary directory and with a
private socket directory like $HOME/.screen. But to have a full featured
screen and (from a user's point of view) more secure pty's you should
consult a system administrator and discuss installing screen setuid-root
in some globally accessible directory like /usr/local/bin.
Consider this, when deciding whether you install screen setuid-root:
- On some machines root privileges are required to open pty's.
- Pty's should be owned by the user, so that she can do chmod to prevent
intruder attacks. The PTYs used by screen will remain world read-writable
if screen is not installed setuid-root.
- Some commands only work properly when the pty is owned by the user.
These include mesg and biff.
- The ^At feature may need to lseek and read the kernel file to retrieve
the load average.
- On most machines utmp slots can only be created/manipulated with root
privileges. Users will appear to be logged on the primary terminal
instead of the screen windows, if screen is not installed setuid-root.
- Multi-user screen sessions are only allowed when screen has a root-s-bit.
- If screen sockets of multiple users are kept in one directory (e.g.
/tmp/screens), this directory must be world writable when screen is not
installed setuid-root. Any user can remove or abuse any socket then.
5.) doc/screen.1 & doc/screen.texinfo
-------------------------------------
The man page doc/screen.1 should go to /usr/local/man/man1, or some similar
directory. It should format nicely with nroff -man. If it does not, then
try removing extra dots with: sed -e 's/^\.\././' < screen.1 | nroff -man
The info page doc/screen.texinfo contains basically the same information as
the man-page, we may have missed one or another thing in one of the files.
If so, mail me.
6.) etc/screenrc & etc/etcscreenrc
----------------------------------
The files screenrc and etc/etcscreenrc are instructive samples that
demonstrate what can/should be done from your private .screenrc and from
$ETCSCREENRC -- do not just copy them. Read them. Look through the
etcscreenrc file for system wide defaults that you like to set, e.g.
autodetach off, startup_message off, vbell on, ...
Since version 3.2.15 the screenrc file syntax changed slightly. All rc files
from previous versions should be run through the 'newsyntax' script that comes
with this package.
If and only if you want to install screen as a console multiplexer, look
at the *.sample files and what 'make cscreen' suggests.
7.) terminfo/screeninfo.src & terminfo/screencap
------------------------------------------------
Every now and then we update the termcap/terminfo entries for screen.
E.g. keycodes were added in 3.6.0 -- thus you check that your termcap/terminfo
database is up to date. See the README in the terminfo subdirectory.
8.) have fun
------------
To get an idea what the basic screen commands are, read the file README.
Request snail mail address for liquid and solid donations. :-)

356
Makefile.in Normal file
View file

@ -0,0 +1,356 @@
#
# Makefile template for screen
#
# See machine dependent config.h for more configuration options.
#
srcdir = @srcdir@
VPATH = @srcdir@
DESTDIR =
# Where to install screen.
prefix = @prefix@
exec_prefix = @exec_prefix@
datarootdir = @datarootdir@
datadir = @datadir@
# don't forget to change mandir and infodir in doc/Makefile.
bindir = $(exec_prefix)/bin
VERSION = @VERSION@
SCREEN = screen-$(VERSION)
GIT_REV =
DEFS = @DEFS@ -DGIT_REV=\"$(GIT_REV)\"
ETCSCREENRC = @ETCSCREENRC@
ifeq (${ETCSCREENRC}, )
ETCSCREENRC=$(prefix)/etc/screenrc
endif
SCREENENCODINGS = $(datadir)/screen/utf8encodings
CC = @CC@
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@ -DETCSCREENRC='"$(ETCSCREENRC)"' \
-DSCREENENCODINGS='"$(SCREENENCODINGS)"'
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
CPP=@CPP@
CPP_DEPEND=$(CC) -MM
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
AWK = @AWK@
### Chose some debug configuration options:
# -DDEBUG
# Turn on really heavy debug output. This is written to
# /tmp/debug/{SCREEN,screen}.<pid>. Look at these files and quote
# questionable sections when sending bug-reports to the author.
# -DDUMPSHADOW
# With shadow-pw screen would never dump core. Use this option if
# you still want to have a core. Use only for debugging.
OPTIONS=
#OPTIONS= -DDEBUG
SHELL=/bin/sh
CFILES= screen.c ansi.c fileio.c mark.c misc.c resize.c socket.c \
search.c tty.c term.c window.c utmp.c loadav.c putenv.c help.c \
termcap.c input.c attacher.c pty.c process.c display.c comm.c \
kmapdef.c acls.c braille.c braille_tsi.c logfile.c layer.c \
sched.c teln.c nethack.c encoding.c canvas.c layout.c viewport.c \
list_display.c list_generic.c list_window.c
OFILES= screen.o ansi.o fileio.o mark.o misc.o resize.o socket.o \
search.o tty.o term.o window.o utmp.o loadav.o putenv.o help.o \
termcap.o input.o attacher.o pty.o process.o display.o comm.o \
kmapdef.o acls.o braille.o braille_tsi.o logfile.o layer.o \
list_generic.o list_display.o list_window.o \
sched.o teln.o nethack.o encoding.o canvas.o layout.o viewport.o
all: screen
screen: $(OFILES)
$(CC) $(LDFLAGS) -o $@ $(OFILES) $(LIBS)
.c.o:
$(CC) -c -I. -I$(srcdir) $(M_CFLAGS) $(CPPFLAGS) $(DEFS) \
$(OPTIONS) $(CFLAGS) $<
install_bin: .version screen installdirs
-if [ -f $(DESTDIR)$(bindir)/$(SCREEN) ] && [ ! -f $(DESTDIR)$(bindir)/$(SCREEN).old ]; \
then mv $(DESTDIR)$(bindir)/$(SCREEN) $(DESTDIR)$(bindir)/$(SCREEN).old; fi
$(INSTALL_PROGRAM) screen $(DESTDIR)$(bindir)/$(SCREEN)
-chown root $(DESTDIR)$(bindir)/$(SCREEN) && chmod 4755 $(DESTDIR)$(bindir)/$(SCREEN)
# This doesn't work if $(bindir)/screen is a symlink
-if [ -f $(DESTDIR)$(bindir)/screen ] && [ ! -f $(DESTDIR)$(bindir)/screen.old ]; then mv $(DESTDIR)$(bindir)/screen $(DESTDIR)$(bindir)/screen.old; fi
rm -f $(DESTDIR)$(bindir)/screen
(cd $(DESTDIR)$(bindir) && ln -f -s $(SCREEN) screen)
cp $(srcdir)/utf8encodings/?? $(DESTDIR)$(SCREENENCODINGS)
###############################################################################
install: installdirs install_bin
cd doc ; $(MAKE) install
-if [ -d $(DESTDIR)/usr/lib/terminfo ]; then \
PATH="$$PATH:/usr/5bin" tic ${srcdir}/terminfo/screeninfo.src; \
chmod 644 $(DESTDIR)/usr/lib/terminfo/s/screen*; \
fi
# Better do this by hand. E.g. under RCS...
# cat ${srcdir}/terminfo/screencap >> /etc/termcap
@echo "termcap entry (${srcdir}/terminfo/screencap) should be installed manually."
@echo "You may also want to install $(srcdir)/etc/etcscreenrc in" $(ETCSCREENRC)
installdirs:
# Path leading to ETCSCREENRC and Socketdirectory not checked.
$(srcdir)/etc/mkinstalldirs $(DESTDIR)$(bindir) $(DESTDIR)$(SCREENENCODINGS)
cd doc ; $(MAKE) installdirs
uninstall: .version
rm -f $(DESTDIR)$(bindir)/$(SCREEN)
rm -f $(DESTDIR)$(bindir)/screen
-mv $(DESTDIR)$(bindir)/screen.old $(DESTDIR)$(bindir)/screen
rm -f $(DESTDIR)$(ETCSCREENRC)
cd doc; $(MAKE) uninstall
shadow:
mkdir shadow;
cd shadow; ln -s ../*.[ch] ../*.in ../*.sh ../configure ../doc ../terminfo ../etc .
rm -f shadow/term.h shadow/tty.c shadow/comm.h shadow/osdef.h
echo "install all Makefiles and config:" > shadow/Makefile
echo " rm -f config.cache" >> shadow/Makefile
echo " sh ./configure" >> shadow/Makefile
term.h: term.c term.sh
AWK=$(AWK) srcdir=$(srcdir) sh $(srcdir)/term.sh
kmapdef.c: term.h
tty.c: tty.sh
sh $(srcdir)/tty.sh tty.c
comm.h: comm.c comm.sh config.h
AWK=$(AWK) CC="$(CC) $(CFLAGS)" srcdir=${srcdir} sh $(srcdir)/comm.sh
osdef.h: osdef.sh config.h osdef.h.in
CPP="$(CPP) $(CPPFLAGS)" srcdir=${srcdir} sh $(srcdir)/osdef.sh
docs:
cd doc; $(MAKE) dvi screen.info
dvi info screen.info:
-cd doc; $(MAKE) $@
mostlyclean:
rm -f $(OFILES) screen config.cache osdef0.c osdef1.sed osdef2.sed
clean celan: mostlyclean
rm -f tty.c term.h comm.h osdef.h kmapdef.c core
# Delete all files from the current directory that are created by
# configuring or building the program.
# building of term.h/comm.h requires awk. Keep it in the distribution
# we keep config.h, as this file knows where 'make dist' finds the ETCSCREENRC.
#distclean: mostlyclean
# rm -f $(SCREEN).tar $(SCREEN).tar.gz
# rm -f config.status Makefile
# rm -f osdef.h doc/Makefile
maintainer-clean:
@echo "This command is not even intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
# Delete everything from the current directory that can be
# reconstructed with this Makefile.
realclean: .version mostlyclean
rm -f $(SCREEN).tar $(SCREEN).tar.gz
rm -f config.status Makefile doc/Makefile
rm -f tty.c term.h comm.h osdef.h kmapdef.c
rm -f config.h
echo "install all Makefiles and config:" > Makefile
echo " sh ./configure" >> Makefile
tags TAGS: $(CFILES)
-ctags *.sh $(CFILES) *.h
-etags *.sh $(CFILES) *.h
dist: .version $(SCREEN).tar.gz
$(SCREEN).tar: .version term.h comm.h tty.c kmapdef.c
-rm -rf dist
mkdir dist
mkdir dist/$(SCREEN)
ln acls.h ansi.h display.h extern.h logfile.h mark.h os.h \
layer.h patchlevel.h screen.h window.h image.h \
osdef.h.in term.sh tty.sh comm.sh osdef.sh braille.h \
sched.h \
$(CFILES) \
ChangeLog COPYING INSTALL NEWS* TODO install.sh \
dist/$(SCREEN)
cd dist/$(SCREEN); mv tty.c tty.c.dist
cd dist/$(SCREEN); mv kmapdef.c kmapdef.c.dist
ln configure.in configure dist/$(SCREEN)
sed -e 's@"/local/screens@"/tmp/screens@' -e 's@"/local@"/usr/local@g' < config.h.in > dist/$(SCREEN)/config.h.in
sed -e 's@[ ]/local@ /usr/local@g' -e 's/^CFLAGS = -g/CFLAGS = -O/' < Makefile.in > dist/$(SCREEN)/Makefile.in
ln term.h dist/$(SCREEN)/term.h.dist
ln comm.h dist/$(SCREEN)/comm.h.dist
ln README dist/$(SCREEN)/README
mkdir dist/$(SCREEN)/terminfo
cd terminfo; ln 8bits README checktc.c screencap \
screeninfo.src test.txt tetris.c \
../dist/$(SCREEN)/terminfo
mkdir dist/$(SCREEN)/etc
cd etc; ln * ../dist/$(SCREEN)/etc
mkdir dist/$(SCREEN)/utf8encodings
cd utf8encodings; ln * ../dist/$(SCREEN)/utf8encodings
# sed -e 's/^startup/#startup/' -e 's/^autodetach/#autodetach/' < $(ETCSCREENRC) > dist/$(SCREEN)/etc/etcscreenrc
cp $(HOME)/.screenrc dist/$(SCREEN)/etc/screenrc
mkdir dist/$(SCREEN)/doc
sed -e 's@/local/emacs@/usr/local@g' < doc/Makefile.in > dist/$(SCREEN)/doc/Makefile.in
cd doc; ln FAQ README.DOTSCREEN screen.1 screen.texinfo fdpat.ps make.help window_to_display.ps \
../dist/$(SCREEN)/doc
cd doc; if test -f screen.info; then ln screen.info* \
../dist/$(SCREEN)/doc; fi
cd dist/$(SCREEN)/doc; ln -s ../install.sh .
cd dist/$(SCREEN); ln -s doc/FAQ .
echo "install all Makefiles and config:" > dist/$(SCREEN)/Makefile
echo " rm -f config.cache" >> dist/$(SCREEN)/Makefile
echo " sh ./configure" >> dist/$(SCREEN)/Makefile
cd dist; tar cf ../$(SCREEN).tar $(SCREEN)
rm -rf dist
$(SCREEN).tar.gz: $(SCREEN).tar
gzip -nf $(SCREEN).tar || gzip -f $(SCREEN).tar
# Perform self-tests (if any).
check:
lint:
lint -I. $(CFILES)
saber:
#load $(CFLAGS) screen.c ansi.c $(LIBS)
config:
rm -f config.cache
sh ./configure
###############################################################################
.version:
@rev=`sed < $(srcdir)/patchlevel.h -n -e '/#define REV/s/#define REV *//p'`; \
vers=`sed < $(srcdir)/patchlevel.h -n -e '/#define VERS/s/#define VERS *//p'`; \
pat=`sed < $(srcdir)/patchlevel.h -n -e '/#define PATCHLEVEL/s/#define PATCHLEVEL *//p'`; \
if [ "$${rev}.$${vers}.$${pat}" != "$(VERSION)" ]; then \
echo "This distribution is screen-$${rev}.$${vers}.$${pat}, but"; \
echo "the Makefile is from $(VERSION). Please update!"; exit 1; fi
###############################################################################
mdepend: $(CFILES) term.h
@rm -f DEPEND ; \
for i in ${CFILES} ; do \
echo "$$i" ; \
echo `echo "$$i" | sed -e 's/.c$$/.o/'`": $$i" `\
cc -E $$i |\
grep '^# .*"\./.*\.h"' |\
(sort -t'"' -u -k 2,2 2>/dev/null || sort -t'"' -u +1 -2) |\
sed -e 's/.*"\.\/\(.*\)".*/\1/'\
` >> DEPEND ; \
done
depend: depend.in
./config.status || ./configure
depend.in: $(CFILES) term.h
cp Makefile.in Makefile.in~
sed -e '/\#\#\# Dependencies/q' < Makefile.in > tmp_make
for i in $(CFILES); do echo $$i; $(CPP_DEPEND) $$i >> tmp_make; done
mv tmp_make Makefile.in
###############################################################################
### Dependencies:
screen.o: layout.h viewport.h canvas.h screen.c config.h screen.h os.h osdef.h ansi.h acls.h \
comm.h layer.h term.h image.h display.h window.h braille.h \
patchlevel.h logfile.h extern.h
ansi.o: layout.h viewport.h canvas.h ansi.c config.h screen.h os.h osdef.h ansi.h acls.h \
comm.h layer.h term.h image.h display.h window.h braille.h extern.h \
logfile.h
fileio.o: layout.h viewport.h canvas.h fileio.c config.h screen.h os.h osdef.h ansi.h acls.h \
comm.h layer.h term.h image.h display.h window.h extern.h
mark.o: layout.h viewport.h canvas.h mark.c config.h screen.h os.h osdef.h ansi.h acls.h \
comm.h layer.h term.h image.h display.h window.h mark.h extern.h
misc.o: layout.h viewport.h canvas.h misc.c config.h screen.h os.h osdef.h ansi.h acls.h \
comm.h layer.h term.h image.h display.h window.h extern.h
resize.o: layout.h viewport.h canvas.h resize.c config.h screen.h os.h osdef.h ansi.h acls.h \
comm.h layer.h term.h image.h display.h window.h extern.h
socket.o: layout.h viewport.h canvas.h socket.c config.h screen.h os.h osdef.h ansi.h acls.h \
comm.h layer.h term.h image.h display.h window.h extern.h
search.o: layout.h viewport.h canvas.h search.c config.h screen.h os.h osdef.h ansi.h acls.h \
comm.h layer.h term.h image.h display.h window.h mark.h extern.h
tty.o: layout.h viewport.h canvas.h tty.c config.h screen.h os.h osdef.h ansi.h acls.h comm.h \
layer.h term.h image.h display.h window.h extern.h
term.o: layout.h viewport.h canvas.h term.c term.h
window.o: layout.h viewport.h canvas.h window.c config.h screen.h os.h osdef.h ansi.h acls.h \
comm.h layer.h term.h image.h display.h window.h extern.h logfile.h
utmp.o: layout.h viewport.h canvas.h utmp.c config.h screen.h os.h osdef.h ansi.h acls.h \
comm.h layer.h term.h image.h display.h window.h extern.h
loadav.o: layout.h viewport.h canvas.h loadav.c config.h screen.h os.h osdef.h ansi.h acls.h \
comm.h layer.h term.h image.h display.h window.h extern.h
putenv.o: layout.h viewport.h canvas.h putenv.c config.h
help.o: layout.h viewport.h canvas.h help.c config.h screen.h os.h osdef.h ansi.h acls.h \
comm.h layer.h term.h image.h display.h window.h extern.h list_generic.h
termcap.o: layout.h viewport.h canvas.h termcap.c config.h screen.h os.h osdef.h ansi.h acls.h \
comm.h layer.h term.h image.h display.h window.h extern.h
input.o: layout.h viewport.h canvas.h input.c config.h screen.h os.h osdef.h ansi.h acls.h \
comm.h layer.h term.h image.h display.h window.h extern.h
attacher.o: layout.h viewport.h canvas.h attacher.c config.h screen.h os.h osdef.h ansi.h \
acls.h comm.h layer.h term.h image.h display.h window.h extern.h
pty.o: layout.h viewport.h canvas.h pty.c config.h screen.h os.h osdef.h ansi.h acls.h comm.h \
layer.h term.h image.h display.h window.h extern.h
process.o: layout.h viewport.h canvas.h process.c config.h screen.h os.h osdef.h ansi.h acls.h \
comm.h layer.h term.h image.h display.h window.h extern.h logfile.h
display.o: layout.h viewport.h canvas.h display.c config.h screen.h os.h osdef.h ansi.h acls.h \
comm.h layer.h term.h image.h display.h window.h extern.h braille.h
canvas.o: layout.h viewport.h canvas.h canvas.c config.h screen.h os.h osdef.h ansi.h acls.h \
comm.h layer.h term.h image.h display.h window.h extern.h \
braille.h
comm.o: layout.h viewport.h canvas.h comm.c config.h acls.h comm.h
kmapdef.o: layout.h viewport.h canvas.h kmapdef.c config.h
acls.o: layout.h viewport.h canvas.h acls.c config.h screen.h os.h osdef.h ansi.h acls.h comm.h \
layer.h term.h image.h display.h window.h extern.h
braille.o: layout.h viewport.h canvas.h braille.c config.h screen.h os.h osdef.h ansi.h acls.h \
comm.h layer.h term.h image.h display.h window.h extern.h braille.h
braille_tsi.o: layout.h viewport.h canvas.h braille_tsi.c config.h screen.h os.h osdef.h ansi.h \
acls.h comm.h layer.h term.h image.h display.h window.h extern.h \
braille.h
logfile.o: layout.h viewport.h canvas.h logfile.c config.h screen.h os.h osdef.h ansi.h acls.h \
comm.h layer.h term.h image.h display.h window.h extern.h logfile.h
layer.o: layout.h viewport.h canvas.h layer.c config.h screen.h os.h osdef.h ansi.h acls.h \
comm.h layer.h term.h image.h display.h window.h extern.h
sched.o: layout.h viewport.h canvas.h sched.c config.h screen.h os.h osdef.h ansi.h acls.h \
comm.h layer.h term.h image.h display.h window.h extern.h logfile.h
teln.o: layout.h viewport.h canvas.h teln.c config.h screen.h os.h osdef.h ansi.h acls.h \
comm.h layer.h term.h image.h display.h window.h extern.h
nethack.o: layout.h viewport.h canvas.h nethack.c config.h screen.h os.h osdef.h ansi.h acls.h \
comm.h layer.h term.h image.h display.h window.h extern.h
encoding.o: layout.h viewport.h canvas.h encoding.c config.h screen.h os.h osdef.h ansi.h acls.h \
comm.h layer.h term.h image.h display.h window.h extern.h
layout.o: layout.h viewport.h canvas.h layout.c config.h screen.h os.h osdef.h ansi.h acls.h \
comm.h layer.h term.h image.h display.h window.h extern.h \
braille.h
viewport.o: layout.h viewport.h canvas.h viewport.c config.h screen.h os.h osdef.h ansi.h acls.h \
comm.h layer.h term.h image.h display.h window.h extern.h \
braille.h
list_generic.o: list_generic.h list_generic.c layer.h screen.h osdef.h
list_display.o: list_generic.h list_display.c layer.h screen.h osdef.h
list_window.o: list_generic.h list_window.c window.h layer.h screen.h osdef.h comm.h

28
NEWS Normal file
View file

@ -0,0 +1,28 @@
------------------------------
What's new in screen-4.0.3 ?
------------------------------
* zombie command has new option 'onerror'
* buffer overflow in resize.c fixed
* minor docu update
* more robust startup
* use setresuid; SendAttachMsg() for fd-passing added; DoCSI enhanced.
------------------------------
What's new in screen-4.0.0 ?
------------------------------
* new screenrc parser, not 100% compatible.
* screenblanker support: new 'idle', 'blanker', 'blankerprg'
commands.
* zmodem support via the 'zmodem' command.
* nonblock code rewritten, nonblock now understands a timeout.
new command 'defnonblock'.

119
NEWS.3.5 Normal file
View file

@ -0,0 +1,119 @@
----------------------------
What's new in screen-3.5 ?
----------------------------
* Texinfo manpage! Thanks to Jason Merrill.
* Screen now has a very large 'configure' script. If you have
problems with the resulting configuration please send mail to
screen@uni-erlangen.de.
* Stackable overlay planes.
All commands are available even if you work with an overlay. Thus
you can be in copy/paste mode on several windows!
* Unification of key bindings and screen commands. All keys now generate
commands.
* Screen now reads/writes only in asynchronous mode.
* ANSI parser speedup code resulting in much faster output of text.
* Changed the rc file syntax. Commands now directly affect the current
window. The default settings are changed with 'def...' commands.
The 'set' keyword no longer exists.
Please run the 'newsyntax' script on your old screenrc files!
* Emacs style isearch added to copy mode. Try ^A ESC ^R screen ^R ^R
to locate the last three occurrences of the word 'screen' in the
history buffer.
* New command 'silence'. Alarms the user whenever there was inactivity
for a specified amount of time on a certain window.
Useful if you want to wait for a compilation to end.
* Much better margin handling:
Screen now handles autowrapped lines correctly in the redisplay and
copy/paste functions.
* New commands for pastebuffer management:
'copy_reg' copies the pastebuffer to a register,
'ins_reg' pastes a register,
'register' fills a register with a string,
'process' stuffs a register into strings input queue.
* Autonuke feature. Flush the output buffer if the window gets
cleared. Enable this with 'autonuke on'.
* Modifications to save memory: Empty attribute and font lines don't
get allocated. This is very useful if you have a large scrollback.
* Multi display support:
You can now attach from more than one terminal to a session with
the '-x' option.
* New option '-S' to specify socket name.
* Experimental multiuser support added:
You can start screen in multiuser Mode by prepending the socket
name with a '/' (or by the command 'multiuser on').
If another user wants to attach to the screen session, he can do
this by prepending the socketname with 'screenuser/'.
Of course he must be in the access control list for a successful
attach (see the acladd/acldel command).
* Extension to the 'screen' command: You can now specify tty lines
instead of programs. This can be used for console management.
Added the command 'break' to send a break to the tty line.
Not really a new feature, but terminal initialisation now works
on suns.
* Input/output filters added. This has been implemented to allow the
user to configure an open tty line, but got soon exended to allow
all sorts of filters. For more information read the explanation
of the 'exec' command in the man page and check the 'fdpat.ps'
document.
* Screen can now be started detached (screen -d -m -S sockname).
This is useful if you want to start screen in your /etc/rc file
(e.g. as a console multiplexer)
* Console grabbing added ('console on' command).
* Windows can now be selected by akas, too. (Per default bound to the
>'< key.)
* New terminal capabilitise CS/CE for cursorkey control.
* setenv/unsetenv commands added.
* Expansion of environment variables ($VAR) and terminal capabilities
($:TC:) in the screenrc files and detach messages.
Example: pow_detach_msg "Session of \$LOGNAME \$:cr:\$:nl:ended."
* New commands:
'hardcopydir' and 'logdir' to change the output directories,
'partial' and 'allpartial' to make screen only refresh the line
containing the cursor if a window is selected (useful for slow
modem connections).
* Cleanup of the provided termcap/terminfo file. Please install
the new one!
* The program 'terminfo/checktc.c' does a visual check of a
termcap/terminfo entry. Please try it before calling screen and
in a screen session.
* LOTS of bugfixes and code cleanup.
Thanks to all the beta testers who helped porting screen to at least
the following platforms: Ultrix, SunOS, Solaris, BSD43, linux, NEWSOS,
Irix, OSF/1, Harris CX/UX, hpux, dynix/ptx, AIX.
And even more thanks to the brave who attempted to use the 'exec'
command features.
Donate patches, bugreports, suggestions, money, beer & pizza to
screen@uni-erlangen.de

48
NEWS.3.6 Normal file
View file

@ -0,0 +1,48 @@
----------------------------
What's new in screen-3.6 ?
----------------------------
* Input translation! This makes the vt100 emulation complete.
As an addition it is now possible to bind any command to any
(function-) key. See the man page for more details (bindkey
command).
* Status line support. Each window can have a different status line.
Use the ANSI APC string to set the status line, i.e.:
<ESC>_<status string><ESC>\
(For convenience the xterm sequence is also accepted.)
You may want to add
termcap * '' ':hs:ts=\E_:fs=\E\\:ds=\E_\E\\:'
terminfo * '' ':hs:ts=\E_:fs=\E\\:ds=\E_\E\\:'
to your ~/.screenrc to make screen advertise the hardstatus
support.
* Zombie feature added. Windows now may generate a message (with a
timestamp) if they die and stay around until the user presses
a key.
* New paste syntax: Paste can now concatenate registers and paste
either on screen or in another register.
This makes the old "ins_reg", "copy_reg" commands obsolete.
* More architectures supported. Screen now runs on AIX3.2.5,
Solaris, NeXT and some other exotic platforms.
* Kanji support added. Screen understands JIS, EUC and SJIS coding.
This is an experimental feature.
* GR charset switching (ISO 2022) implemented. Can be enabled with
the "gr" command.
* C1 sequences implemented (see the "c1" command).
* Tek support from Xiaoguang Zhang. Apply tek.patch if you want to
make screen pass tek sequences.
* List of new commands:
bindkey, c1, command, defc1, defgr, defkanji, gr, kanji, mapdefault,
mapnotnext, maptimeout, pastefont, printcmd, readreg, stuff, zombie
* Lots of other bugs fixed.

39
NEWS.3.7 Normal file
View file

@ -0,0 +1,39 @@
----------------------------
What's new in screen-3.7 ?
----------------------------
* Color support. Screen understands the following capabilities:
AF (setaf) = Set foreground color (ANSI compatible)
AB (setab) = Set background color (ANSI compatible)
AX = Does understand ANSI set default fg/bg color
(\E[39m / \E[49m)
The tweaks for the color xterm would be:
termcap xterm 'AF=\E[3%dm:AB=\E[4%dm'
terminfo xterm 'AF=\E[3%p1%dm:AB=\E[4%p1%dm'
* New 'digraph' command (bound to ^A^V)
^A^Va" or ^A^V0344 input an a-umlaut
* activity/bell message strings can now include the window title:
%t - title
%n - number (a single % still works)
* 'defhstatus' command to give every window a default
hardstatus line. ^E is used as a string escape instead of %
(see above). Try 'defhstatus "Screen: window ^E (^Et)"'
* Input parser changed to understand '^' (see ^E above).
Note that the linux color xterm has a stupid bug: the characters
get the color of the cursor, therefore if you change color and move
the cursor around all the characters will get the new color...
Here is a patch:
pub/utilities/screen/color_xterm_patch
Btw.: rxvt works fine.
* Optional Braille support. If you can read Braille and have one of
the devices listed in README.DOTSCREEN, please compile with
-DHAVE_BRAILLE and let us know if this feature is useful.

205
NEWS.3.9 Normal file
View file

@ -0,0 +1,205 @@
-------------------------------
What's new in screen-3.9.15 ?
-------------------------------
* unicode combining character support
* new encoding: Chinese GBK
* new 'backtick' command and string escape to embed command
output into e.g. the hardstatus line
-------------------------------
What's new in screen-3.9.13 ?
-------------------------------
* altscreen support from Gurusamy Sarathy
* new command "maxwin" to set a limit on the number of windows
* new keys in copy&paste mode: 'B' and 'E'
-------------------------------
What's new in screen-3.9.11 ?
-------------------------------
* windowlist, bound to ^A"
* support for other encodings, e.g. big5, koi8r, cp1251
new commands 'encoding', 'defencoding'
'register', 'readreg', 'readbuf', 'writebuf' now understand
an extra encoding parameter
* support for double UTF-8 characters
* lots of new string escapes and extensions to existing ones:
%LD, %LM, %Lw, %W, %-w, %+w, %H, %f, %F, %l, %=, %<, %>
* new commands: 'source', 'eval', 'deflog', 'ignorecase', 'setsid'
* command key classes: 'bind', 'command' and 'help' understand
a '-c <class>' parameter. See the man page for examples
* new login state: always - don't remove slot even if screen gets
detached
* 256 color support (experimental)
* configurable time format string (for ^At)
* config option to use localized month/week names
* new option '-h' for hardcopy: also dump the scrollback buffer
------------------------------
What's new in screen-3.9.9 ?
------------------------------
* new '-X' option to send commands to screen sessions.
screen -X echo Hi...
* added a possibility to change the attributes/color in caption or
hardstatus strings:
caption always "%3n %{r}%t%{-}%? @%u%?%? %{g}[%h]%{-}%?"
* new 'dinfo' command to show what screen thinks about your terminal.
* new 'attrcolor' command to map attributes to color codes:
attrcolor u "-u b"
attrcolor b "r"
* support for UTF-8: new commands 'utf8', 'defutf8' to change the
encoding of a window, plus a '-U' option to tell screen that
your terminal sends/receives UTF-8 codes.
* support for 16 colors.
------------------------------
What's new in screen-3.9.8 ?
------------------------------
* new command 'resize' to resize regions (aka split windows), try:
bind = resize =
bind + resize +1
bind - resize -1
bind _ resize max
* new argument for 'focus': up, down, top, bottom
* X11 mouse tracking support
* Support for the "new color model", aka "background color erase":
the bce/defbce commands change the color model of the current
window/new windows.
* experimental rxvt OSC sequence support (used to set a background
picture or to change the default colors), disabled by default.
----------------------------
What's new in screen-3.9 ?
----------------------------
* real multiuser support
A window can now be displayed on more than one attached displays.
Screen does all the necessary clipping if the window size doesn't
fit the display.
New command:
^AF - fit the window size into the display size.
* split screen support
A display may now host multiple windows.
New commands:
^AS - split horizontally. This add another region to the display
^A<Tab> - move the focus to the next region
^AX - kill the current region
^AQ - kill all other regions
* hardstatus emulation support
The last line of the display may now be used as a hardstatus
line if the terminal doesn't have the 'hs' capability.
New commands:
hardstatus [always]lastline
hardstatus [always]message
hardstatus [always]ignore
* configurable window separator and hardstatus strings
The window (region) separator and the hardstatus can be set to an
arbitrary string containing screen's % escape sequences.
The window's hardstatus is just another escape sequence, '%h'.
New commands:
hardstatus string [string]
caption string [string]
The default strings are "%h" (hardstatus) and "%3n %t" (caption).
* permanent window separator
The window separator can be set to stay on screen even if
the display contains only one region
New commands:
caption always
caption splitonly
* many new escapes
%c - current time HH:MM (*CHANGE*: this was %w in screen-3.7)
%C - current time HH:MM in 24h format
%l - the load of the system
%h - hardstatus of the window
%w - all window names
%W - all window names except the current window
%u - all other users on this window
%? - the part to the next %? is displayed only if an escape
expands to an nonempty string.
%: - "else" part of %?
Some escapes like %c may be qualified with a '0' (like %0c)
to make screen use '0' instead of space as a filler.
Others understand a length qualifier, like %3n.
If escapes like the current time are used as hardstatus/caption
string screen will update them so that you can always have
the current time onscreen.
*CHANGE* ~ is no longer used as bell character, use ^G instead!
* logfile timestamps and flush timeout
New commands:
logfile flush <secs>
logtstamp [on|off]
logtstamp string [string]
logtstamp after [secs]
* configurable breaktype
You can now choose one of TIOCSBRK, TCSBRK, tcsendbreak.
New commands:
breaktype
defbreaktype
* other new commands:
hstatus - set the window's hardstatus
defslowpaste
defsilence
* optional builtin telnet.
This is useful if screen is used as frontend to a terminal
multiplexor. Use //telnet to access the builtin telnet program,
as in: 'screen //telnet host [port]'
* remote detach and reattach change:
'-d' is now ignored if the screen is already detached and you
want to reattach. You can also use '-RR' to make screen use
the first session found if more than one session is available.
Thus '-d -RR' or '-x -RR' always gets you a screen.
* support for history compaction
You can tell screen to suppress trailing blank lines when
scrolling up text into the history buffer. (Wayne Davison)
New command:
compacthist
* optional Braille support. If you can read Braille and have one of
the devices listed in README.DOTSCREEN, please compile with
-DHAVE_BRAILLE and let us know if this feature is useful.

102
README Normal file
View file

@ -0,0 +1,102 @@
[If you just got the screen package, it pays to read the file INSTALL]
[This intro only describes the most common features to get you started]
[A full description of all features is contained in the source package]
Short introduction to GNU screen.
Send bugreports, fixes, enhancements, t-shirts, money, beer & pizza to
screen-devel@gnu.org
Screen provides you with an ANSI/vt100 terminal emulator, which can multiplex
up to 10 pseudo-terminals. On startup, it executes $SHELL in window 0.
Then it reads $HOME/.screenrc to learn configuration, keybindings, and
possibly open more windows.
C-a ? (help) Show all keybindings.
C-a c (screen) Create new windows.
C-a SPACE (next) Advance to next window (with wraparound).
C-a C-a (other) Toggle between the current and previously
displayed windows.
C-a 0 (select n) Switch to window n=0 ... 9.
...
C-a 9
C-a w (windows) Show a list of window names in the status line.
C-a a (meta) Send a literal C-a/C-s/C-q to the
C-a s (xoff) process in the window.
C-a q (xon) For instance, emacs uses C-a and C-s.
C-a l (redisplay) Redraw this window.
C-a W (width) Toggle between 80 & 132 columns mode.
C-a L (login) Try to toggle the window's utmp-slot.
C-a z (suspend) Suspend the whole screen session.
C-a x (lockscreen) Execute /usr/bin/lock, $LOCKCMD or a
built-in terminal lock.
C-a H (log) Log stdout of window n to screenlog.n.
C-a C-[ (copy) Start copy mode. Move cursor with h,j,k,l.
Set 2 marks with SPACE or y. Abort with ESC.
(C-[ is ESC.) Preceeding second mark with
an a appends the text to the copy buffer.
C-a C-] (paste) Output copy buffer to current window's stdin.
C-a < (readbuf) Read the copy buffer from /tmp/screen-exchange.
C-a > (writebuf) Write the copy buffer to /tmp/screen-exchange.
C-a d (detach) Detach screen. All processes continue and may
spool output to their pty's, but screen
disconnects from your terminal.
C-a D D (pow_detach) Power detach. Disconnect like C-a d but also
kill the parent shell.
C-a K (kill) Kill a window and send SIGHUP to its process
group. Per default this would be C-a C-k,
but it is redefined in the demo .screenrc
(think of killing a whole line in emacs).
C-a : (colon) Online configuration change.
See the man page or TeXinfo manual for many more keybindings and commands.
screen -r [pid.tty.host|tty.host]
Reattach to a specific detached session. The terminal emulator
reconfigures according to your $TERMCAP or $TERM settings.
When you have multiple screens detached, you must supply the session
name.
screen -R reattaches to a detached session or (if none) creates a new
session.
screen -d [pid.tty.host|tty.host]
Detach a screen session remotely. Has the same effect as typing 'C-a d'
on the controlling terminal. 'screen -D' will power-detach.
screen -list
screen -ls
screen -wipe
Show all available sessions and their status. Use -wipe to remove
DEAD sessions.
If sockets are missing, you may send a SIGCHLD to its 'SCREEN'
process and the process will re-establish the socket (think of
someone cleaning /tmp thoroughly).
screen -h 200
Starts a new screen session and sets the number of lines in the scrollback
buffer to 200. The default is 100 lines.

7
TODO Normal file
View file

@ -0,0 +1,7 @@
- display size adaption (Activate)
- process.c cleanup via comm splitting
- writelocks?
- partial?
- type into several windows at once (for cluster admins)
- configurable digraph table
- command line options should overwrite config files.

579
acconfig.h Normal file
View file

@ -0,0 +1,579 @@
/* Copyright (c) 1993-2000
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
*
* 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 3, 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 (see the file COPYING); if not, see
* https://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*
****************************************************************
* $Id$ GNU
*/
/**********************************************************************
*
* User Configuration Section
*/
/*
* Maximum of simultaneously allowed windows per screen session.
*/
#ifndef MAXWIN
# define MAXWIN 100
#endif
/*
* Define SOCKDIR to be the directory to contain the named sockets
* screen creates. This should be in a common subdirectory, such as
* /usr/local or /tmp. It makes things a little more secure if you
* choose a directory which is not writable by everyone or where the
* "sticky" bit is on, but this isn't required.
* If SOCKDIR is not defined screen will put the named sockets in
* the user's home directory. Notice that this can cause you problems
* if some user's HOME directories are AFS- or NFS-mounted. Especially
* AFS is unlikely to support named sockets.
*
* Screen will name the subdirectories "S-$USER" (e.g /tmp/S-davison).
*/
#undef SOCKDIR
/*
* Define this if the SOCKDIR is not shared between hosts.
*/
#define SOCKDIR_IS_LOCAL_TO_HOST
/*
* Screen can look for the environment variable $SYSSCREENRC and -if it
* exists- load the file specified in that variable as global screenrc.
* If you want to enable this feature, define ALLOW_SYSSCREENRC to one (1).
* Otherwise ETCSCREENRC is always loaded.
*/
#define ALLOW_SYSSCREENRC 1
/*
* Define CHECKLOGIN to force Screen users to enter their Unix password
* in addition to the screen password.
*
* Define NOSYSLOG if yo do not have logging facilities. Currently
* syslog() will be used to trace ``su'' commands only.
*/
#define CHECKLOGIN 1
#undef NOSYSLOG
/*
* define PTYMODE if you do not like the default of 0622, which allows
* public write to your pty.
* define PTYGROUP to some numerical group-id if you do not want the
* tty to be in "your" group.
* Note, screen is unable to change mode or group of the pty if it
* is not installed with sufficient privilege. (e.g. set-uid-root)
* define PTYROFS if the /dev/pty devices are mounted on a read-only
* filesystem so screen should not even attempt to set mode or group
* even if running as root (e.g. on TiVo).
*/
#undef PTYMODE
#undef PTYGROUP
#undef PTYROFS
/*
* If screen is NOT installed set-uid root, screen can provide tty
* security by exclusively locking the ptys. While this keeps other
* users from opening your ptys, it also keeps your own subprocesses
* from being able to open /dev/tty. Define LOCKPTY to add this
* exclusive locking.
*/
#undef LOCKPTY
/*
* If you'd rather see the status line on the first line of your
* terminal rather than the last, define TOPSTAT.
*/
#undef TOPSTAT
/*
* define DETACH can detach a session. An absolute 'must'.
*/
#define DETACH
/*
* here come the erlangen extensions to screen:
* define LOCK if you want to use a lock program for a screenlock.
* define PASSWORD for secure reattach of your screen.
* define COPY_PASTE to use the famous hacker's treasure zoo.
* define POW_DETACH to have a detach_and_logout key (requires DETACH).
* define REMOTE_DETACH (-d option) to move screen between terminals.
* define AUTO_NUKE to enable Tim MacKenzies clear screen nuking
* define PSEUDOS to allow window input/output filtering
* define MULTI to allow multiple attaches.
* define MULTIUSER to allow other users attach to your session
* (if they are in the acl, of course)
* define MAPKEYS to include input keyboard translation.
* define FONT to support ISO2022/alternet charset support
* define COLOR to include ansi color support. This may expose
* a bug in x11r6-color-xterm.
* define DW_CHARS to include support for double-width character
* sets.
* define ENCODINGS to include support for encodings like euc or big5.
* Needs FONT to work.
* define UTF8 if you want support for UTF-8 encoding.
* Needs FONT and ENCODINGS to work.
* define COLORS16 if you want 16 colors.
* Needs COLOR to work.
* define BUILTIN_TELNET to add telnet support to screen.
* Syntax: screen //telnet host [port]
* define RXVT_OSC if you want support for rxvts special
* change fgcolor/bgcolor/bgpicture sequences
*/
#undef SIMPLESCREEN
#ifndef SIMPLESCREEN
# define LOCK
# define PASSWORD
# define COPY_PASTE
# define REMOTE_DETACH
# define POW_DETACH
# define AUTO_NUKE
# define PSEUDOS
# define MULTI
# define MULTIUSER
# define MAPKEYS
# define COLOR
# define FONT
# define DW_CHARS
# define ENCODINGS
# define UTF8
# define COLORS16
# define ZMODEM
# define BLANKER_PRG
#endif /* SIMPLESCREEN */
#undef BUILTIN_TELNET
#undef RXVT_OSC
#undef COLORS256
/*
* If you have a braille display you should define HAVE_BRAILLE.
* The code inside #ifdef HAVE_BRAILLE was contributed by Hadi Bargi
* Rangin (bargi@dots.physics.orst.edu).
* WARNING: this is more or less unsupported code, it may be full of
* bugs leading to security holes, enable at your own risk!
*/
#undef HAVE_BRAILLE
/*
* As error messages are mostly meaningless to the user, we
* try to throw out phrases that are somewhat more familiar
* to ...well, at least familiar to us NetHack players.
*/
#ifndef NONETHACK
# define NETHACK
#endif /* NONETHACK */
/*
* If screen is installed with permissions to update /etc/utmp (such
* as if it is installed set-uid root), define UTMPOK.
*/
#define UTMPOK
/* Set LOGINDEFAULT to one (1)
* if you want entries added to /etc/utmp by default, else set it to
* zero (0).
* LOGINDEFAULT will be one (1) whenever LOGOUTOK is undefined!
*/
#define LOGINDEFAULT 1
/* Set LOGOUTOK to one (1)
* if you want the user to be able to log her/his windows out.
* (Meaning: They are there, but not visible in /etc/utmp).
* Disabling this feature only makes sense if you have a secure /etc/utmp
* database.
* Negative examples: suns usually have a world writable utmp file,
* xterm will run perfectly without s-bit.
*
* If LOGOUTOK is undefined and UTMPOK is defined, all windows are
* initially and permanently logged in.
*
* Set CAREFULUTMP to one (1) if you want that users have at least one
* window per screen session logged in.
*/
#define LOGOUTOK 1
#undef CAREFULUTMP
/*
* If UTMPOK is defined and your system (incorrectly) counts logins by
* counting non-null entries in /etc/utmp (instead of counting non-null
* entries with no hostname that are not on a pseudo tty), define USRLIMIT
* to have screen put an upper-limit on the number of entries to write
* into /etc/utmp. This helps to keep you from exceeding a limited-user
* license.
*/
#undef USRLIMIT
/*
* both must be defined if you want to favor tcsendbreak over
* other calls to generate a break condition on serial lines.
* (Do not bother, if you are not using plain tty windows.)
*/
#define POSIX_HAS_A_GOOD_TCSENDBREAK
#define SUNOS4_AND_WE_TRUST_TCSENDBREAK
/*
* to lower the interrupt load on the host machine, you may want to
* adjust the VMIN and VTIME settings used for plain tty windows.
* See the termio(4) manual page (Non-Canonical Mode Input Processing)
* for details.
* if undefined, VMIN=1, VTIME=0 is used as a default - this gives you
* best user responsiveness, but highest interrupt frequency.
* (Do not bother, if you are not using plain tty windows.)
*/
#define TTYVMIN 100
#define TTYVTIME 2
/*
* looks like the above values are ignored by setting FNDELAY.
* This is default for all pty/ttys, you may disable it for
* ttys here. After playing with it for a while, one may find out
* that this feature may cause screen to lock up.
*/
#ifdef bsdi
# define TTY_DISABLE_FNBLOCK /* select barfs without it ... */
#endif
/*
* Some terminals, e.g. Wyse 120, use a bitfield to select attributes.
* This doesn't work with the standard so/ul/m? terminal entries,
* because they will cancel each other out.
* On TERMINFO machines, "sa" (sgr) may work. If you want screen
* to switch attributes only with sgr, define USE_SGR.
* This is *not* recomended, do this only if you must.
*/
#undef USE_SGR
/*
* Define USE_LOCALE if you want screen to use the locale names
* for the name of the month and day of the week.
*/
#undef USE_LOCALE
/*
* Define USE_PAM if your system supports PAM (Pluggable Authentication
* Modules) and you want screen to use it instead of calling crypt().
* (You may also need to add -lpam to LIBS in the Makefile.)
*/
#undef USE_PAM
/*
* Define CHECK_SCREEN_W if you want screen to set TERM to screen-w
* if the terminal width is greater than 131 columns. No longer needed
* on modern systems which use $COLUMNS or the tty settings instead.
*/
#undef CHECK_SCREEN_W
/**********************************************************************
*
* End of User Configuration Section
*
* Rest of this file is modified by 'configure'
* Change at your own risk!
*
*/
/*
* Some defines to identify special unix variants
*/
#ifndef SVR4
#undef SVR4
#endif
/* #ifndef __osf__ */
#ifndef MIPS
#undef MIPS
#endif
/* #endif */
#ifndef OSX
#undef OSX
#endif
#ifndef ISC
#undef ISC
#endif
#ifndef sysV68
#undef sysV68
#endif
#ifndef _POSIX_SOURCE
#undef _POSIX_SOURCE
#endif
/*
* Define POSIX if your system supports IEEE Std 1003.1-1988 (POSIX).
*/
#undef POSIX
/*
* Define BSDJOBS if you have BSD-style job control (both process
* groups and a tty that deals correctly with them).
*/
#undef BSDJOBS
/*
* Define TERMIO if you have struct termio instead of struct sgttyb.
* This is usually the case for SVID systems, where BSD uses sgttyb.
* POSIX systems should define this anyway, even though they use
* struct termios.
*/
#undef TERMIO
/*
* Define CYTERMIO if you have cyrillic termio modes.
*/
#undef CYTERMIO
/*
* Define TERMINFO if your machine emulates the termcap routines
* with the terminfo database.
* Thus the .screenrc file is parsed for
* the command 'terminfo' and not 'termcap'.
*/
#undef TERMINFO
/*
* If your library does not define ospeed, define this.
*/
#undef NEED_OSPEED
/*
* Define SYSV if your machine is SYSV complient (Sys V, HPUX, A/UX)
*/
#ifndef SYSV
#undef SYSV
#endif
/*
* Define SIGVOID if your signal handlers return void. On older
* systems, signal returns int, but on newer ones, it returns void.
*/
#undef SIGVOID
/*
* Define USESIGSET if you have sigset for BSD 4.1 reliable signals.
*/
#undef USESIGSET
/*
* Define SYSVSIGS if signal handlers must be reinstalled after
* they have been called.
*/
#undef SYSVSIGS
/*
* Define BSDWAIT if your system defines a 'union wait' in <sys/wait.h>
*
* Only allow BSDWAIT i.e. wait3 on nonposix systems, since
* posix implies wait(3) and waitpid(3). vdlinden@fwi.uva.nl
*
*/
#ifndef POSIX
#undef BSDWAIT
#endif
/*
* On RISCOS we prefer wait2() over wait3(). rouilj@sni-usa.com
*/
#ifdef BSDWAIT
#undef USE_WAIT2
#endif
/*
* If your system has getutent(), pututline(), etc. to write to the
* utmp file, define GETUTENT.
*/
#undef GETUTENT
/*
* Define UTHOST if the utmp file has a host field.
*/
#undef UTHOST
/*
* Define if you have the utempter utmp helper program
*/
#undef HAVE_UTEMPTER
/*
* If ttyslot() breaks getlogin() by returning indexes to utmp entries
* of type DEAD_PROCESS, then our getlogin() replacement should be
* selected by defining BUGGYGETLOGIN.
*/
#undef BUGGYGETLOGIN
/*
* If your system has the calls setreuid() and setregid(),
* define HAVE_SETREUID. Otherwise screen will use a forked process to
* safely create output files without retaining any special privileges.
*/
#undef HAVE_SETRESUID
#undef HAVE_SETREUID
/*
* If your system supports BSD4.4's seteuid() and setegid(), define
* HAVE_SETEUID.
*/
#undef HAVE_SETEUID
/*
* execvpe is now defined in some systems.
*/
#undef HAVE_EXECVPE
/*
* If you want the "time" command to display the current load average
* define LOADAV. Maybe you must install screen with the needed
* privileges to read /dev/kmem.
* Note that NLIST_ stuff is only checked, when getloadavg() is not available.
*/
#undef LOADAV
#undef LOADAV_NUM
#undef LOADAV_TYPE
#undef LOADAV_SCALE
#undef LOADAV_GETLOADAVG
#undef LOADAV_UNIX
#undef LOADAV_AVENRUN
#undef LOADAV_USE_NLIST64
#undef NLIST_DECLARED
#undef NLIST_STRUCT
#undef NLIST_NAME_UNION
/*
* If your system has the new format /etc/ttys (like 4.3 BSD) and the
* getttyent(3) library functions, define GETTTYENT.
*/
#undef GETTTYENT
/*
* Define USEBCOPY if the bcopy/memcpy from your system's C library
* supports the overlapping of source and destination blocks. When
* undefined, screen uses its own (probably slower) version of bcopy().
*
* SYSV machines may have a working memcpy() -- Oh, this is
* quite unlikely. Tell me if you see one.
* "But then, memmove() should work, if at all available" he thought...
* Boing, never say "works everywhere" unless you checked SCO UNIX.
* Their memove fails the test in the configure script. Sigh. (Juergen)
*/
#undef USEBCOPY
#undef USEMEMCPY
#undef USEMEMMOVE
/*
* If your system has vsprintf() and requires the use of the macros in
* "varargs.h" to use functions with variable arguments,
* define USEVARARGS.
*/
#undef USEVARARGS
/*
* If the select return value doesn't treat a descriptor that is
* usable for reading and writing as two hits, define SELECT_BROKEN.
*/
#undef SELECT_BROKEN
/*
* Define this if your system exits select() immediatly if a pipe is
* opened read-only and no writer has opened it.
*/
#undef BROKEN_PIPE
/*
* Define this if the unix-domain socket implementation doesn't
* create a socket in the filesystem.
*/
#undef SOCK_NOT_IN_FS
/*
* If your system has setenv() and unsetenv() define USESETENV
*/
#undef USESETENV
/*
* If setenv() takes 3 arguments define HAVE_SETENV_3
*/
#undef HAVE_SETENV_3
/*
* If setenv() takes 2 arguments define HAVE_SETENV_2
*/
#undef HAVE_SETENV_2
/*
* If your system does not come with a setenv()/putenv()/getenv()
* functions, you may bring in our own code by defining NEEDPUTENV.
*/
#undef NEEDPUTENV
/*
* If the passwords are stored in a shadow file and you want the
* builtin lock to work properly, define SHADOWPW.
*/
#undef SHADOWPW
/*
* define HAVE_NL_LANGINFO if your system has the nl_langinfo() call
* and <langinfo.h> defines CODESET.
*/
#undef HAVE_NL_LANGINFO
/*
* Newer versions of Solaris include fdwalk, which can greatly improve
* the startup time of screen; otherwise screen spends a lot of time
* closing file descriptors.
*/
#undef HAVE_FDWALK
/*
* define HAVE_DEV_PTC if you have a /dev/ptc character special
* device.
*/
#undef HAVE_DEV_PTC
/*
* define HAVE_SVR4_PTYS if you have a /dev/ptmx character special
* device and support the ptsname(), grantpt(), unlockpt() functions.
*/
#undef HAVE_SVR4_PTYS
/*
* define PTYRANGE0 and or PTYRANGE1 if you want to adapt screen
* to unusual environments. E.g. For SunOs the defaults are "qpr" and
* "0123456789abcdef". For SunOs 4.1.2
* #define PTYRANGE0 "pqrstuvwxyzPQRST"
* is recommended by Dan Jacobson.
*/
#undef PTYRANGE0
#undef PTYRANGE1

1042
acls.c Normal file

File diff suppressed because it is too large Load diff

99
acls.h Normal file
View file

@ -0,0 +1,99 @@
/* Copyright (c) 2008, 2009
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Micah Cowan (micah@cowan.name)
* Sadrul Habib Chowdhury (sadrul@users.sourceforge.net)
* Copyright (c) 1993-2002, 2003, 2005, 2006, 2007
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
*
* 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 3, 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 (see the file COPYING); if not, see
* https://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*
****************************************************************
*/
#ifdef MULTIUSER
/* three known bits: */
#define ACL_EXEC 0
#define ACL_WRITE 1
#define ACL_READ 2
#define ACL_BITS_PER_CMD 1 /* for comm.h */
#define ACL_BITS_PER_WIN 3 /* for window.h */
#define USER_CHUNK 8
#define ACLBYTE(data, w) ((data)[(w) >> 3])
#define ACLBIT(w) (0x80 >> ((w) & 7))
typedef unsigned char * AclBits;
/*
* How a user joins a group.
* Here is the node to construct one list per user.
*/
struct aclusergroup
{
struct acluser *u; /* the user who borrows us his rights */
struct aclusergroup *next;
};
#endif /* MULTIUSER */
/***************
* ==> user.h
*/
/*
* a copy buffer
*/
struct plop
{
char *buf;
int len;
#ifdef ENCODINGS
int enc;
#endif
};
/*
* A User has a list of groups, and points to other users.
* users is the User entry of the session owner (creator)
* and anchors all other users. Add/Delete users there.
*/
typedef struct acluser
{
struct acluser *u_next; /* continue the main user list */
char u_name[MAXLOGINLEN + 1]; /* login name how he showed up */
char *u_password; /* his password (may be NullStr). */
int u_checkpassword; /* nonzero if this u_password is valid */
int u_detachwin; /* the window where he last detached */
int u_detachotherwin; /* window that was "other" when he detached */
int u_Esc, u_MetaEsc; /* the users screen escape character */
#ifdef COPY_PASTE
struct plop u_plop;
#endif
#ifdef MULTIUSER
int u_id; /* a uniq index in the bitfields. */
AclBits u_umask_w_bits[ACL_BITS_PER_WIN]; /* his window create umask */
struct aclusergroup *u_group; /* linked list of pointers to other users */
#endif
} User;
extern int DefaultEsc, DefaultMetaEsc;

3207
ansi.c Normal file

File diff suppressed because it is too large Load diff

175
ansi.h Normal file
View file

@ -0,0 +1,175 @@
/* Copyright (c) 2008, 2009
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Micah Cowan (micah@cowan.name)
* Sadrul Habib Chowdhury (sadrul@users.sourceforge.net)
* Copyright (c) 1993-2002, 2003, 2005, 2006, 2007
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
*
* 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 3, 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 (see the file COPYING); if not, see
* https://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*
****************************************************************
* $Id$ GNU
*/
#define NATTR 6
#define ATTR_DI 0 /* Dim mode */
#define ATTR_US 1 /* Underscore mode */
#define ATTR_BD 2 /* Bold mode */
#define ATTR_RV 3 /* Reverse mode */
#define ATTR_SO 4 /* Standout mode */
#define ATTR_BL 5 /* Blinking */
#define A_DI (1<<ATTR_DI)
#define A_US (1<<ATTR_US)
#define A_BD (1<<ATTR_BD)
#define A_RV (1<<ATTR_RV)
#define A_SO (1<<ATTR_SO)
#define A_BL (1<<ATTR_BL)
#define A_MAX (1<<(NATTR-1))
#define ATYP_M (1<<0)
#define ATYP_S (1<<1)
#define ATYP_U (1<<2)
#ifdef COLORS16
/* pseudo attributes */
# define ATTR_BFG 6 /* bright foreground */
# define ATTR_BBG 7 /* bright background */
# define A_BFG (1<<ATTR_BFG)
# define A_BBG (1<<ATTR_BBG)
#endif
/*
* Parser state
*/
/* keep state_t and state_t_string in sync! */
enum state_t
{
LIT, /* Literal input */
ESC, /* Start of escape sequence */
ASTR, /* Start of control string */
STRESC, /* ESC seen in control string */
CSI, /* Reading arguments in "CSI Pn ;...*/
PRIN, /* Printer mode */
PRINESC, /* ESC seen in printer mode */
PRINCSI, /* CSI seen in printer mode */
PRIN4 /* CSI 4 seen in printer mode */
};
/* keep string_t and string_t_string in sync! */
enum string_t
{
NONE,
DCS, /* Device control string */
OSC, /* Operating system command */
APC, /* Application program command */
/* - used for status change */
PM, /* Privacy message */
AKA, /* title for current screen */
GM, /* Global message to every display */
STATUS /* User hardstatus line */
};
/*
* Types of movement used by GotoPos()
*/
enum move_t {
M_NONE,
M_UP,
M_CUP,
M_DO,
M_CDO,
M_LE,
M_CLE,
M_RI,
M_CRI,
M_RW,
M_CR /* CR and rewrite */
};
#define EXPENSIVE 1000
#define G0 0
#define G1 1
#define G2 2
#define G3 3
#define ASCII 0
#ifdef TOPSTAT
#define STATLINE (0)
#else
#define STATLINE (D_height-1)
#endif
#ifdef ENCODINGS
#define KANJI ('B' & 037)
#define KANJI0212 ('D' & 037)
#define KANA 'I'
#define EUC_JP 1
#define SJIS 2
#define EUC_KR 3
#define EUC_CN 4
#define BIG5 5
#define KOI8R 6
#define CP1251 7
#define GBK 20
#define EUC EUC_JP
#endif
#ifdef UTF8
#undef UTF8
#define UTF8 8
#endif
#ifdef UTF8
# define UCS_REPL 0xfffd /* character for illegal codes */
# define UCS_REPL_DW 0xff1f /* character for illegal codes */
# define UCS_HIDDEN 0xffff
#endif
#ifdef DW_CHARS
# define is_dw_font(f) ((f) && ((f) & 0x60) == 0)
# ifdef UTF8
# define dw_left(ml, x, enc) ((enc == UTF8) ? \
(unsigned char)(ml)->font[(x) + 1] == 0xff && (unsigned char)(ml)->image[(x) + 1] == 0xff : \
((unsigned char)(ml)->font[x] & 0x1f) != 0 && ((unsigned char)(ml)->font[x] & 0xe0) == 0 \
)
# define dw_right(ml, x, enc) ((enc == UTF8) ? \
(unsigned char)(ml)->font[x] == 0xff && (unsigned char)(ml)->image[x] == 0xff : \
((unsigned char)(ml)->font[x] & 0xe0) == 0x80 \
)
# else
# define dw_left(ml, x, enc) ( \
((unsigned char)(ml)->font[x] & 0x1f) != 0 && ((unsigned char)(ml)->font[x] & 0xe0) == 0 \
)
# define dw_right(ml, x, enc) ( \
((unsigned char)(ml)->font[x] & 0xe0) == 0x80 \
)
# endif /* UTF8 */
#else
# define dw_left(ml, x, enc) 0
# define dw_right(ml, x, enc) 0
#endif

1117
attacher.c Normal file

File diff suppressed because it is too large Load diff

2
autogen.sh Executable file
View file

@ -0,0 +1,2 @@
#!/bin/sh
autoreconf -i

8812
autom4te.cache/output.0 Normal file

File diff suppressed because it is too large Load diff

8812
autom4te.cache/output.1 Normal file

File diff suppressed because it is too large Load diff

8813
autom4te.cache/output.2 Normal file

File diff suppressed because it is too large Load diff

187
autom4te.cache/requests Normal file
View file

@ -0,0 +1,187 @@
# This file was generated by Autom4te 2.71.
# It contains the lists of macros which have been traced.
# It can be safely removed.
@request = (
bless( [
'0',
1,
[
'/usr/share/autoconf'
],
[
'/usr/share/autoconf/autoconf/autoconf.m4f',
'/usr/share/aclocal-1.16/internal/ac-config-macro-dirs.m4',
'configure.ac'
],
{
'_AM_AUTOCONF_VERSION' => 1,
'm4_include' => 1,
'AC_CONFIG_MACRO_DIR_TRACE' => 1,
'm4_pattern_allow' => 1,
'_AM_CONFIG_MACRO_DIRS' => 1,
'AU_DEFUN' => 1,
'include' => 1,
'AC_PROGRAM_SOURCE' => 1,
'AC_DEFUN_ONCE' => 1,
'AC_DEFUN' => 1,
'_m4_warn' => 1,
'AC_CONFIG_MACRO_DIR' => 1,
'm4_pattern_forbid' => 1
}
], 'Autom4te::Request' ),
bless( [
'1',
1,
[
'/usr/share/autoconf'
],
[
'/usr/share/autoconf/autoconf/autoconf.m4f',
'configure.ac'
],
{
'_AM_COND_ELSE' => 1,
'AM_GNU_GETTEXT' => 1,
'AC_SUBST' => 1,
'AM_PROG_MKDIR_P' => 1,
'LT_CONFIG_LTDL_DIR' => 1,
'AC_CONFIG_LIBOBJ_DIR' => 1,
'AC_CANONICAL_BUILD' => 1,
'LT_SUPPORTED_TAG' => 1,
'AC_CONFIG_MACRO_DIR_TRACE' => 1,
'AM_PATH_GUILE' => 1,
'AM_XGETTEXT_OPTION' => 1,
'_AM_COND_IF' => 1,
'AM_ENABLE_MULTILIB' => 1,
'AM_GNU_GETTEXT_INTL_SUBDIR' => 1,
'AC_DEFINE_TRACE_LITERAL' => 1,
'AM_PROG_CC_C_O' => 1,
'IT_PROG_INTLTOOL' => 1,
'AM_EXTRA_RECURSIVE_TARGETS' => 1,
'AH_OUTPUT' => 1,
'AM_PROG_LIBTOOL' => 1,
'AM_NLS' => 1,
'AC_FC_FREEFORM' => 1,
'AM_CONDITIONAL' => 1,
'AC_LIBSOURCE' => 1,
'AM_MAINTAINER_MODE' => 1,
'AM_AUTOMAKE_VERSION' => 1,
'_m4_warn' => 1,
'AC_CONFIG_FILES' => 1,
'AM_MAKEFILE_INCLUDE' => 1,
'm4_pattern_allow' => 1,
'AC_FC_PP_SRCEXT' => 1,
'AC_SUBST_TRACE' => 1,
'AM_PROG_MOC' => 1,
'AM_PROG_FC_C_O' => 1,
'sinclude' => 1,
'AC_CANONICAL_TARGET' => 1,
'AM_PROG_AR' => 1,
'_AM_MAKEFILE_INCLUDE' => 1,
'AC_CANONICAL_SYSTEM' => 1,
'AC_CONFIG_HEADERS' => 1,
'AM_SILENT_RULES' => 1,
'AC_FC_PP_DEFINE' => 1,
'AC_CONFIG_SUBDIRS' => 1,
'AM_INIT_AUTOMAKE' => 1,
'_AM_COND_ENDIF' => 1,
'AC_INIT' => 1,
'_LT_AC_TAGCONFIG' => 1,
'GTK_DOC_CHECK' => 1,
'_AM_SUBST_NOTMAKE' => 1,
'm4_pattern_forbid' => 1,
'AC_CONFIG_AUX_DIR' => 1,
'AC_CONFIG_LINKS' => 1,
'm4_sinclude' => 1,
'AM_POT_TOOLS' => 1,
'AC_REQUIRE_AUX_FILE' => 1,
'LT_INIT' => 1,
'include' => 1,
'm4_include' => 1,
'AC_FC_SRCEXT' => 1,
'AC_CANONICAL_HOST' => 1,
'AC_PROG_LIBTOOL' => 1,
'AM_PROG_F77_C_O' => 1,
'AM_PROG_CXX_C_O' => 1
}
], 'Autom4te::Request' ),
bless( [
'2',
1,
[
'/usr/share/autoconf'
],
[
'/usr/share/autoconf/autoconf/autoconf.m4f',
'/usr/share/autoconf/autoconf/trailer.m4',
'configure.ac'
],
{
'AC_FC_PP_SRCEXT' => 1,
'AM_PROG_MOC' => 1,
'AC_SUBST_TRACE' => 1,
'm4_pattern_allow' => 1,
'AM_PROG_FC_C_O' => 1,
'AM_PROG_CC_C_O' => 1,
'IT_PROG_INTLTOOL' => 1,
'AM_ENABLE_MULTILIB' => 1,
'AC_DEFINE_TRACE_LITERAL' => 1,
'AM_GNU_GETTEXT_INTL_SUBDIR' => 1,
'AC_CONFIG_FILES' => 1,
'AM_MAKEFILE_INCLUDE' => 1,
'AM_NLS' => 1,
'AC_FC_FREEFORM' => 1,
'AH_OUTPUT' => 1,
'AM_EXTRA_RECURSIVE_TARGETS' => 1,
'AM_PROG_LIBTOOL' => 1,
'AM_MAINTAINER_MODE' => 1,
'AC_LIBSOURCE' => 1,
'AM_AUTOMAKE_VERSION' => 1,
'_m4_warn' => 1,
'AM_CONDITIONAL' => 1,
'LT_SUPPORTED_TAG' => 1,
'AC_CANONICAL_BUILD' => 1,
'AC_CONFIG_LIBOBJ_DIR' => 1,
'AC_CONFIG_MACRO_DIR_TRACE' => 1,
'_AM_COND_IF' => 1,
'AM_XGETTEXT_OPTION' => 1,
'AM_PATH_GUILE' => 1,
'AC_SUBST' => 1,
'AM_GNU_GETTEXT' => 1,
'AM_PROG_MKDIR_P' => 1,
'_AM_COND_ELSE' => 1,
'LT_CONFIG_LTDL_DIR' => 1,
'LT_INIT' => 1,
'AC_REQUIRE_AUX_FILE' => 1,
'include' => 1,
'm4_sinclude' => 1,
'AM_POT_TOOLS' => 1,
'AC_CANONICAL_HOST' => 1,
'AC_FC_SRCEXT' => 1,
'AM_PROG_F77_C_O' => 1,
'AC_PROG_LIBTOOL' => 1,
'AM_PROG_CXX_C_O' => 1,
'm4_include' => 1,
'_AM_SUBST_NOTMAKE' => 1,
'm4_pattern_forbid' => 1,
'AC_INIT' => 1,
'GTK_DOC_CHECK' => 1,
'_LT_AC_TAGCONFIG' => 1,
'AC_CONFIG_LINKS' => 1,
'AC_CONFIG_AUX_DIR' => 1,
'AC_CONFIG_SUBDIRS' => 1,
'AC_FC_PP_DEFINE' => 1,
'AM_INIT_AUTOMAKE' => 1,
'_AM_COND_ENDIF' => 1,
'AC_CONFIG_HEADERS' => 1,
'AM_SILENT_RULES' => 1,
'AM_PROG_AR' => 1,
'AC_CANONICAL_TARGET' => 1,
'sinclude' => 1,
'AC_CANONICAL_SYSTEM' => 1,
'_AM_MAKEFILE_INCLUDE' => 1
}
], 'Autom4te::Request' )
);

851
autom4te.cache/traces.0 Normal file
View file

@ -0,0 +1,851 @@
m4trace:configure.ac:9: -1- m4_pattern_forbid([^_?A[CHUM]_])
m4trace:configure.ac:9: -1- m4_pattern_forbid([_AC_])
m4trace:configure.ac:9: -1- m4_pattern_forbid([^LIBOBJS$], [do not use LIBOBJS directly, use AC_LIBOBJ (see section `AC_LIBOBJ vs LIBOBJS'])
m4trace:configure.ac:9: -1- m4_pattern_allow([^AS_FLAGS$])
m4trace:configure.ac:9: -1- m4_pattern_forbid([^_?m4_])
m4trace:configure.ac:9: -1- m4_pattern_forbid([^dnl$])
m4trace:configure.ac:9: -1- m4_pattern_forbid([^_?AS_])
m4trace:configure.ac:9: -1- m4_pattern_allow([^SHELL$])
m4trace:configure.ac:9: -1- m4_pattern_allow([^PATH_SEPARATOR$])
m4trace:configure.ac:9: -1- m4_pattern_allow([^PACKAGE_NAME$])
m4trace:configure.ac:9: -1- m4_pattern_allow([^PACKAGE_TARNAME$])
m4trace:configure.ac:9: -1- m4_pattern_allow([^PACKAGE_VERSION$])
m4trace:configure.ac:9: -1- m4_pattern_allow([^PACKAGE_STRING$])
m4trace:configure.ac:9: -1- m4_pattern_allow([^PACKAGE_BUGREPORT$])
m4trace:configure.ac:9: -1- m4_pattern_allow([^PACKAGE_URL$])
m4trace:configure.ac:9: -1- m4_pattern_allow([^exec_prefix$])
m4trace:configure.ac:9: -1- m4_pattern_allow([^prefix$])
m4trace:configure.ac:9: -1- m4_pattern_allow([^program_transform_name$])
m4trace:configure.ac:9: -1- m4_pattern_allow([^bindir$])
m4trace:configure.ac:9: -1- m4_pattern_allow([^sbindir$])
m4trace:configure.ac:9: -1- m4_pattern_allow([^libexecdir$])
m4trace:configure.ac:9: -1- m4_pattern_allow([^datarootdir$])
m4trace:configure.ac:9: -1- m4_pattern_allow([^datadir$])
m4trace:configure.ac:9: -1- m4_pattern_allow([^sysconfdir$])
m4trace:configure.ac:9: -1- m4_pattern_allow([^sharedstatedir$])
m4trace:configure.ac:9: -1- m4_pattern_allow([^localstatedir$])
m4trace:configure.ac:9: -1- m4_pattern_allow([^runstatedir$])
m4trace:configure.ac:9: -1- m4_pattern_allow([^includedir$])
m4trace:configure.ac:9: -1- m4_pattern_allow([^oldincludedir$])
m4trace:configure.ac:9: -1- m4_pattern_allow([^docdir$])
m4trace:configure.ac:9: -1- m4_pattern_allow([^infodir$])
m4trace:configure.ac:9: -1- m4_pattern_allow([^htmldir$])
m4trace:configure.ac:9: -1- m4_pattern_allow([^dvidir$])
m4trace:configure.ac:9: -1- m4_pattern_allow([^pdfdir$])
m4trace:configure.ac:9: -1- m4_pattern_allow([^psdir$])
m4trace:configure.ac:9: -1- m4_pattern_allow([^libdir$])
m4trace:configure.ac:9: -1- m4_pattern_allow([^localedir$])
m4trace:configure.ac:9: -1- m4_pattern_allow([^mandir$])
m4trace:configure.ac:9: -1- m4_pattern_allow([^PACKAGE_NAME$])
m4trace:configure.ac:9: -1- m4_pattern_allow([^PACKAGE_TARNAME$])
m4trace:configure.ac:9: -1- m4_pattern_allow([^PACKAGE_VERSION$])
m4trace:configure.ac:9: -1- m4_pattern_allow([^PACKAGE_STRING$])
m4trace:configure.ac:9: -1- m4_pattern_allow([^PACKAGE_BUGREPORT$])
m4trace:configure.ac:9: -1- m4_pattern_allow([^PACKAGE_URL$])
m4trace:configure.ac:9: -1- m4_pattern_allow([^DEFS$])
m4trace:configure.ac:9: -1- m4_pattern_allow([^ECHO_C$])
m4trace:configure.ac:9: -1- m4_pattern_allow([^ECHO_N$])
m4trace:configure.ac:9: -1- m4_pattern_allow([^ECHO_T$])
m4trace:configure.ac:9: -1- m4_pattern_allow([^LIBS$])
m4trace:configure.ac:9: -1- m4_pattern_allow([^build_alias$])
m4trace:configure.ac:9: -1- m4_pattern_allow([^host_alias$])
m4trace:configure.ac:9: -1- m4_pattern_allow([^target_alias$])
m4trace:configure.ac:10: -1- _m4_warn([obsolete], [The macro `AC_CONFIG_HEADER' is obsolete.
You should run autoupdate.], [./lib/autoconf/status.m4:719: AC_CONFIG_HEADER is expanded from...
configure.ac:10: the top level])
m4trace:configure.ac:16: -1- AC_DEFUN([AC_PROGRAM_SOURCE], [AC_REQUIRE([AC_PROG_CPP])AC_PROVIDE([$0])cat > conftest.c <<EOF
#include "confdefs.h"
[$1]
_CUT_HERE_
[$2]
EOF
eval "$ac_cpp conftest.c 2>&5 | sed -e '1,/_CUT_HERE_/d' -e 's/ //g' > conftest.out"
. ./conftest.out
rm -f conftest*
])
m4trace:configure.ac:39: -1- _m4_warn([obsolete], [The macro `AC_FD_MSG' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:400: AC_FD_MSG is expanded from...
configure.ac:39: the top level])
m4trace:configure.ac:40: -1- m4_pattern_allow([^VERSION$])
m4trace:configure.ac:41: -1- m4_pattern_allow([^ac_prefix_program$])
m4trace:configure.ac:42: -1- m4_pattern_allow([^ac_prefix_program$])
m4trace:configure.ac:45: -1- m4_pattern_allow([^CC$])
m4trace:configure.ac:45: -1- m4_pattern_allow([^CFLAGS$])
m4trace:configure.ac:45: -1- m4_pattern_allow([^LDFLAGS$])
m4trace:configure.ac:45: -1- m4_pattern_allow([^LIBS$])
m4trace:configure.ac:45: -1- m4_pattern_allow([^CPPFLAGS$])
m4trace:configure.ac:45: -1- m4_pattern_allow([^CC$])
m4trace:configure.ac:45: -1- m4_pattern_allow([^CC$])
m4trace:configure.ac:45: -1- m4_pattern_allow([^CC$])
m4trace:configure.ac:45: -1- m4_pattern_allow([^CC$])
m4trace:configure.ac:45: -1- m4_pattern_allow([^ac_ct_CC$])
m4trace:configure.ac:45: -1- m4_pattern_allow([^CC$])
m4trace:configure.ac:45: -1- m4_pattern_allow([^EXEEXT$])
m4trace:configure.ac:45: -1- m4_pattern_allow([^OBJEXT$])
m4trace:configure.ac:46: -1- m4_pattern_allow([^CPP$])
m4trace:configure.ac:46: -1- m4_pattern_allow([^CPPFLAGS$])
m4trace:configure.ac:46: -1- m4_pattern_allow([^CPP$])
m4trace:configure.ac:47: -1- m4_pattern_allow([^GREP$])
m4trace:configure.ac:47: -1- m4_pattern_allow([^EGREP$])
m4trace:configure.ac:48: -1- _m4_warn([obsolete], [The macro `AC_ISC_POSIX' is obsolete.
You should run autoupdate.], [./lib/autoconf/specific.m4:550: AC_ISC_POSIX is expanded from...
configure.ac:48: the top level])
m4trace:configure.ac:49: -1- _m4_warn([syntax], [AC_LINK_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS], [./lib/autoconf/specific.m4:364: AC_USE_SYSTEM_EXTENSIONS is expanded from...
configure.ac:49: the top level])
m4trace:configure.ac:49: -1- AC_DEFUN([_AC_Header_stdio_h], [m4_divert_text([INIT_PREPARE],
[AS_VAR_APPEND([ac_header_]]_AC_LANG_ABBREV[[_list],
[" stdio.h ]AS_TR_SH([stdio.h]) AS_TR_CPP([HAVE_stdio.h])["])])_AC_HEADERS_EXPANSION(_AC_LANG_ABBREV)])
m4trace:configure.ac:49: -1- AC_DEFUN([_AC_Header_stdlib_h], [m4_divert_text([INIT_PREPARE],
[AS_VAR_APPEND([ac_header_]]_AC_LANG_ABBREV[[_list],
[" stdlib.h ]AS_TR_SH([stdlib.h]) AS_TR_CPP([HAVE_stdlib.h])["])])_AC_HEADERS_EXPANSION(_AC_LANG_ABBREV)])
m4trace:configure.ac:49: -1- AC_DEFUN([_AC_Header_string_h], [m4_divert_text([INIT_PREPARE],
[AS_VAR_APPEND([ac_header_]]_AC_LANG_ABBREV[[_list],
[" string.h ]AS_TR_SH([string.h]) AS_TR_CPP([HAVE_string.h])["])])_AC_HEADERS_EXPANSION(_AC_LANG_ABBREV)])
m4trace:configure.ac:49: -1- AC_DEFUN([_AC_Header_inttypes_h], [m4_divert_text([INIT_PREPARE],
[AS_VAR_APPEND([ac_header_]]_AC_LANG_ABBREV[[_list],
[" inttypes.h ]AS_TR_SH([inttypes.h]) AS_TR_CPP([HAVE_inttypes.h])["])])_AC_HEADERS_EXPANSION(_AC_LANG_ABBREV)])
m4trace:configure.ac:49: -1- AC_DEFUN([_AC_Header_stdint_h], [m4_divert_text([INIT_PREPARE],
[AS_VAR_APPEND([ac_header_]]_AC_LANG_ABBREV[[_list],
[" stdint.h ]AS_TR_SH([stdint.h]) AS_TR_CPP([HAVE_stdint.h])["])])_AC_HEADERS_EXPANSION(_AC_LANG_ABBREV)])
m4trace:configure.ac:49: -1- AC_DEFUN([_AC_Header_strings_h], [m4_divert_text([INIT_PREPARE],
[AS_VAR_APPEND([ac_header_]]_AC_LANG_ABBREV[[_list],
[" strings.h ]AS_TR_SH([strings.h]) AS_TR_CPP([HAVE_strings.h])["])])_AC_HEADERS_EXPANSION(_AC_LANG_ABBREV)])
m4trace:configure.ac:49: -1- AC_DEFUN([_AC_Header_sys_stat_h], [m4_divert_text([INIT_PREPARE],
[AS_VAR_APPEND([ac_header_]]_AC_LANG_ABBREV[[_list],
[" sys/stat.h ]AS_TR_SH([sys/stat.h]) AS_TR_CPP([HAVE_sys/stat.h])["])])_AC_HEADERS_EXPANSION(_AC_LANG_ABBREV)])
m4trace:configure.ac:49: -1- AC_DEFUN([_AC_Header_sys_types_h], [m4_divert_text([INIT_PREPARE],
[AS_VAR_APPEND([ac_header_]]_AC_LANG_ABBREV[[_list],
[" sys/types.h ]AS_TR_SH([sys/types.h]) AS_TR_CPP([HAVE_sys/types.h])["])])_AC_HEADERS_EXPANSION(_AC_LANG_ABBREV)])
m4trace:configure.ac:49: -1- AC_DEFUN([_AC_Header_unistd_h], [m4_divert_text([INIT_PREPARE],
[AS_VAR_APPEND([ac_header_]]_AC_LANG_ABBREV[[_list],
[" unistd.h ]AS_TR_SH([unistd.h]) AS_TR_CPP([HAVE_unistd.h])["])])_AC_HEADERS_EXPANSION(_AC_LANG_ABBREV)])
m4trace:configure.ac:49: -1- m4_pattern_allow([^STDC_HEADERS$])
m4trace:configure.ac:49: -1- AC_DEFUN([_AC_Header_wchar_h], [m4_divert_text([INIT_PREPARE],
[AS_VAR_APPEND([ac_header_]]_AC_LANG_ABBREV[[_list],
[" wchar.h ]AS_TR_SH([wchar.h]) AS_TR_CPP([HAVE_wchar.h])["])])_AC_HEADERS_EXPANSION(_AC_LANG_ABBREV)])
m4trace:configure.ac:49: -1- AC_DEFUN([_AC_Header_minix_config_h], [m4_divert_text([INIT_PREPARE],
[AS_VAR_APPEND([ac_header_]]_AC_LANG_ABBREV[[_list],
[" minix/config.h ]AS_TR_SH([minix/config.h]) AS_TR_CPP([HAVE_minix/config.h])["])])_AC_HEADERS_EXPANSION(_AC_LANG_ABBREV)])
m4trace:configure.ac:49: -1- m4_pattern_allow([^_ALL_SOURCE$])
m4trace:configure.ac:49: -1- m4_pattern_allow([^_DARWIN_C_SOURCE$])
m4trace:configure.ac:49: -1- m4_pattern_allow([^_GNU_SOURCE$])
m4trace:configure.ac:49: -1- m4_pattern_allow([^_HPUX_ALT_XOPEN_SOCKET_API$])
m4trace:configure.ac:49: -1- m4_pattern_allow([^_NETBSD_SOURCE$])
m4trace:configure.ac:49: -1- m4_pattern_allow([^_OPENBSD_SOURCE$])
m4trace:configure.ac:49: -1- m4_pattern_allow([^_POSIX_PTHREAD_SEMANTICS$])
m4trace:configure.ac:49: -1- m4_pattern_allow([^__STDC_WANT_IEC_60559_ATTRIBS_EXT__$])
m4trace:configure.ac:49: -1- m4_pattern_allow([^__STDC_WANT_IEC_60559_BFP_EXT__$])
m4trace:configure.ac:49: -1- m4_pattern_allow([^__STDC_WANT_IEC_60559_DFP_EXT__$])
m4trace:configure.ac:49: -1- m4_pattern_allow([^__STDC_WANT_IEC_60559_FUNCS_EXT__$])
m4trace:configure.ac:49: -1- m4_pattern_allow([^__STDC_WANT_IEC_60559_TYPES_EXT__$])
m4trace:configure.ac:49: -1- m4_pattern_allow([^__STDC_WANT_LIB_EXT2__$])
m4trace:configure.ac:49: -1- m4_pattern_allow([^__STDC_WANT_MATH_SPEC_FUNCS__$])
m4trace:configure.ac:49: -1- m4_pattern_allow([^_TANDEM_SOURCE$])
m4trace:configure.ac:49: -1- m4_pattern_allow([^_MINIX$])
m4trace:configure.ac:49: -1- m4_pattern_allow([^_POSIX_SOURCE$])
m4trace:configure.ac:49: -1- m4_pattern_allow([^_POSIX_1_SOURCE$])
m4trace:configure.ac:49: -1- m4_pattern_allow([^__EXTENSIONS__$])
m4trace:configure.ac:49: -1- m4_pattern_allow([^_XOPEN_SOURCE$])
m4trace:configure.ac:51: -1- m4_pattern_allow([^AWK$])
m4trace:configure.ac:53: -1- m4_pattern_allow([^INSTALL_PROGRAM$])
m4trace:configure.ac:53: -1- m4_pattern_allow([^INSTALL_SCRIPT$])
m4trace:configure.ac:53: -1- m4_pattern_allow([^INSTALL_DATA$])
m4trace:configure.ac:56: -1- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:56: the top level])
m4trace:configure.ac:57: -1- _m4_warn([obsolete], [The macro `AC_FD_MSG' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:400: AC_FD_MSG is expanded from...
configure.ac:57: the top level])
m4trace:configure.ac:64: -1- m4_pattern_allow([^SOCKDIR$])
m4trace:configure.ac:89: -1- m4_pattern_allow([^ISC$])
m4trace:configure.ac:100: -1- m4_pattern_allow([^sysV68$])
m4trace:configure.ac:104: -1- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:104: the top level])
m4trace:configure.ac:109: -1- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:109: the top level])
m4trace:configure.ac:110: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
configure.ac:110: the top level])
m4trace:configure.ac:114: -1- m4_pattern_allow([^MIPS$])
m4trace:configure.ac:115: -1- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:115: the top level])
m4trace:configure.ac:117: -2- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:117: the top level])
m4trace:configure.ac:123: -3- m4_pattern_allow([^USE_WAIT2$])
m4trace:configure.ac:118: -2- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
configure.ac:118: the top level])
m4trace:configure.ac:116: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
configure.ac:116: the top level])
m4trace:configure.ac:130: -1- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:130: the top level])
m4trace:configure.ac:140: -1- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:140: the top level])
m4trace:configure.ac:141: -2- m4_pattern_allow([^OSX$])
m4trace:configure.ac:141: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
configure.ac:141: the top level])
m4trace:configure.ac:147: -1- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:147: the top level])
m4trace:configure.ac:158: -1- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:158: the top level])
m4trace:configure.ac:167: -2- _m4_warn([obsolete], [The macro `AC_FD_MSG' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:400: AC_FD_MSG is expanded from...
configure.ac:167: the top level])
m4trace:configure.ac:167: -2- m4_pattern_allow([^POSIX$])
m4trace:configure.ac:170: -1- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:170: the top level])
m4trace:configure.ac:174: -2- m4_pattern_allow([^SYSV$])
m4trace:configure.ac:171: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2847: AC_TRY_COMPILE is expanded from...
configure.ac:171: the top level])
m4trace:configure.ac:176: -1- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:176: the top level])
m4trace:configure.ac:183: -1- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:183: the top level])
m4trace:configure.ac:189: -2- _m4_warn([obsolete], [The macro `AC_FD_MSG' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:400: AC_FD_MSG is expanded from...
configure.ac:189: the top level])
m4trace:configure.ac:189: -2- m4_pattern_allow([^SVR4$])
m4trace:configure.ac:193: -1- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:193: the top level])
m4trace:configure.ac:194: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
configure.ac:194: the top level])
m4trace:configure.ac:194: -2- m4_pattern_allow([^BUGGYGETLOGIN$])
m4trace:configure.ac:194: -2- m4_pattern_allow([^BUGGYGETLOGIN$])
m4trace:configure.ac:202: -1- m4_pattern_allow([^HAVE_STROPTS_H$])
m4trace:configure.ac:202: -1- m4_pattern_allow([^HAVE_STRING_H$])
m4trace:configure.ac:202: -1- m4_pattern_allow([^HAVE_STRINGS_H$])
m4trace:configure.ac:204: -1- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:204: the top level])
m4trace:configure.ac:234: -1- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:234: the top level])
m4trace:configure.ac:250: -2- _m4_warn([obsolete], [The macro `AC_FD_MSG' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:400: AC_FD_MSG is expanded from...
configure.ac:250: the top level])
m4trace:configure.ac:250: -2- m4_pattern_allow([^BSDJOBS$])
m4trace:configure.ac:250: -2- _m4_warn([obsolete], [The macro `AC_FD_MSG' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:400: AC_FD_MSG is expanded from...
configure.ac:250: the top level])
m4trace:configure.ac:235: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
configure.ac:235: the top level])
m4trace:configure.ac:255: -1- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:255: the top level])
m4trace:configure.ac:260: -2- m4_pattern_allow([^HAVE_SETRESUID$])
m4trace:configure.ac:256: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
configure.ac:256: the top level])
m4trace:configure.ac:262: -1- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:262: the top level])
m4trace:configure.ac:267: -2- m4_pattern_allow([^HAVE_SETREUID$])
m4trace:configure.ac:263: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
configure.ac:263: the top level])
m4trace:configure.ac:275: -1- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:275: the top level])
m4trace:configure.ac:284: -2- m4_pattern_allow([^HAVE_SETEUID$])
m4trace:configure.ac:276: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
configure.ac:276: the top level])
m4trace:configure.ac:287: -1- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:287: the top level])
m4trace:configure.ac:292: -2- m4_pattern_allow([^HAVE_EXECVPE$])
m4trace:configure.ac:288: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
configure.ac:288: the top level])
m4trace:configure.ac:299: -1- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:299: the top level])
m4trace:configure.ac:306: -2- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:306: the top level])
m4trace:configure.ac:307: -2- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
configure.ac:307: the top level])
m4trace:configure.ac:300: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
configure.ac:300: the top level])
m4trace:configure.ac:319: -1- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:319: the top level])
m4trace:configure.ac:385: -2- _m4_warn([obsolete], [The macro `AC_FD_MSG' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:400: AC_FD_MSG is expanded from...
configure.ac:385: the top level])
m4trace:configure.ac:386: -2- _m4_warn([obsolete], [The macro `AC_FD_MSG' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:400: AC_FD_MSG is expanded from...
configure.ac:386: the top level])
m4trace:configure.ac:387: -2- _m4_warn([obsolete], [The macro `AC_FD_MSG' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:400: AC_FD_MSG is expanded from...
configure.ac:387: the top level])
m4trace:configure.ac:320: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2997: AC_TRY_RUN is expanded from...
configure.ac:320: the top level])
m4trace:configure.ac:391: -1- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:391: the top level])
m4trace:configure.ac:436: -2- _m4_warn([obsolete], [The macro `AC_FD_MSG' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:400: AC_FD_MSG is expanded from...
configure.ac:436: the top level])
m4trace:configure.ac:437: -2- _m4_warn([obsolete], [The macro `AC_FD_MSG' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:400: AC_FD_MSG is expanded from...
configure.ac:437: the top level])
m4trace:configure.ac:437: -2- m4_pattern_allow([^BROKEN_PIPE$])
m4trace:configure.ac:438: -2- _m4_warn([obsolete], [The macro `AC_FD_MSG' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:400: AC_FD_MSG is expanded from...
configure.ac:438: the top level])
m4trace:configure.ac:392: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2997: AC_TRY_RUN is expanded from...
configure.ac:392: the top level])
m4trace:configure.ac:448: -1- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:448: the top level])
m4trace:configure.ac:503: -2- _m4_warn([obsolete], [The macro `AC_FD_MSG' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:400: AC_FD_MSG is expanded from...
configure.ac:503: the top level])
m4trace:configure.ac:504: -2- _m4_warn([obsolete], [The macro `AC_FD_MSG' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:400: AC_FD_MSG is expanded from...
configure.ac:504: the top level])
m4trace:configure.ac:505: -2- _m4_warn([obsolete], [The macro `AC_FD_MSG' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:400: AC_FD_MSG is expanded from...
configure.ac:505: the top level])
m4trace:configure.ac:449: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2997: AC_TRY_RUN is expanded from...
configure.ac:449: the top level])
m4trace:configure.ac:509: -1- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:509: the top level])
m4trace:configure.ac:545: -2- _m4_warn([obsolete], [The macro `AC_FD_MSG' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:400: AC_FD_MSG is expanded from...
configure.ac:545: the top level])
m4trace:configure.ac:546: -2- _m4_warn([obsolete], [The macro `AC_FD_MSG' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:400: AC_FD_MSG is expanded from...
configure.ac:546: the top level])
m4trace:configure.ac:547: -2- m4_pattern_allow([^SOCK_NOT_IN_FS$])
m4trace:configure.ac:548: -2- _m4_warn([obsolete], [The macro `AC_FD_MSG' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:400: AC_FD_MSG is expanded from...
configure.ac:548: the top level])
m4trace:configure.ac:510: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2997: AC_TRY_RUN is expanded from...
configure.ac:510: the top level])
m4trace:configure.ac:657: -2- _m4_warn([obsolete], [The macro `AC_FD_MSG' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:400: AC_FD_MSG is expanded from...
configure.ac:657: the top level])
m4trace:configure.ac:658: -2- _m4_warn([obsolete], [The macro `AC_FD_MSG' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:400: AC_FD_MSG is expanded from...
configure.ac:658: the top level])
m4trace:configure.ac:658: -2- m4_pattern_allow([^SELECT_BROKEN$])
m4trace:configure.ac:659: -2- _m4_warn([obsolete], [The macro `AC_FD_MSG' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:400: AC_FD_MSG is expanded from...
configure.ac:659: the top level])
m4trace:configure.ac:559: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2997: AC_TRY_RUN is expanded from...
configure.ac:559: the top level])
m4trace:configure.ac:664: -1- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:664: the top level])
m4trace:configure.ac:673: -2- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:673: the top level])
m4trace:configure.ac:685: -3- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:685: the top level])
m4trace:configure.ac:693: -4- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:693: the top level])
m4trace:configure.ac:701: -5- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:701: the top level])
m4trace:configure.ac:709: -6- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:709: the top level])
m4trace:configure.ac:717: -7- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:717: the top level])
m4trace:configure.ac:725: -8- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:725: the top level])
m4trace:configure.ac:726: -8- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
configure.ac:726: the top level])
m4trace:configure.ac:718: -7- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
configure.ac:718: the top level])
m4trace:configure.ac:710: -6- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
configure.ac:710: the top level])
m4trace:configure.ac:702: -5- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
configure.ac:702: the top level])
m4trace:configure.ac:694: -4- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
configure.ac:694: the top level])
m4trace:configure.ac:686: -3- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
configure.ac:686: the top level])
m4trace:configure.ac:674: -2- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
configure.ac:674: the top level])
m4trace:configure.ac:665: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
configure.ac:665: the top level])
m4trace:configure.ac:743: -2- _m4_warn([obsolete], [The macro `AC_FD_MSG' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:400: AC_FD_MSG is expanded from...
configure.ac:743: the top level])
m4trace:configure.ac:744: -2- _m4_warn([obsolete], [The macro `AC_FD_MSG' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:400: AC_FD_MSG is expanded from...
configure.ac:744: the top level])
m4trace:configure.ac:744: -2- m4_pattern_allow([^TERMINFO$])
m4trace:configure.ac:745: -2- _m4_warn([obsolete], [The macro `AC_FD_MSG' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:400: AC_FD_MSG is expanded from...
configure.ac:745: the top level])
m4trace:configure.ac:745: -2- m4_pattern_allow([^TERMINFO$])
m4trace:configure.ac:734: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2997: AC_TRY_RUN is expanded from...
configure.ac:734: the top level])
m4trace:configure.ac:746: -1- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:746: the top level])
m4trace:configure.ac:747: -2- m4_pattern_allow([^NEED_OSPEED$])
m4trace:configure.ac:747: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
configure.ac:747: the top level])
m4trace:configure.ac:753: -1- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:753: the top level])
m4trace:configure.ac:755: -1- m4_pattern_allow([^HAVE_DEV_PTC$])
m4trace:configure.ac:760: -1- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:760: the top level])
m4trace:configure.ac:763: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
configure.ac:763: the top level])
m4trace:configure.ac:763: -1- m4_pattern_allow([^HAVE_SVR4_PTYS$])
m4trace:configure.ac:772: -1- m4_pattern_allow([^HAVE_GETPT$])
m4trace:configure.ac:776: -1- m4_pattern_allow([^HAVE_OPENPTY$])
m4trace:configure.ac:776: -1- m4_pattern_allow([^HAVE_OPENPTY$])
m4trace:configure.ac:781: -1- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:781: the top level])
m4trace:configure.ac:801: -1- m4_pattern_allow([^PTYRANGE0$])
m4trace:configure.ac:802: -1- m4_pattern_allow([^PTYRANGE1$])
m4trace:configure.ac:813: -1- m4_pattern_allow([^PTYMODE$])
m4trace:configure.ac:814: -1- m4_pattern_allow([^PTYGROUP$])
m4trace:configure.ac:817: -1- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:817: the top level])
m4trace:configure.ac:895: -2- _m4_warn([obsolete], [The macro `AC_FD_MSG' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:400: AC_FD_MSG is expanded from...
configure.ac:895: the top level])
m4trace:configure.ac:819: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2997: AC_TRY_RUN is expanded from...
configure.ac:819: the top level])
m4trace:configure.ac:819: -1- _m4_warn([obsolete], [The macro `AC_FD_MSG' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:400: AC_FD_MSG is expanded from...
lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
./lib/autoconf/general.m4:2962: _AC_RUN_IFELSE is expanded from...
lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
./lib/autoconf/general.m4:2981: AC_RUN_IFELSE is expanded from...
./lib/autoconf/general.m4:2997: AC_TRY_RUN is expanded from...
configure.ac:819: the top level])
m4trace:configure.ac:819: -1- m4_pattern_allow([^PTYMODE$])
m4trace:configure.ac:819: -1- m4_pattern_allow([^PTYGROUP$])
m4trace:configure.ac:819: -1- _m4_warn([obsolete], [The macro `AC_FD_MSG' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:400: AC_FD_MSG is expanded from...
lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
./lib/autoconf/general.m4:2962: _AC_RUN_IFELSE is expanded from...
lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
./lib/autoconf/general.m4:2981: AC_RUN_IFELSE is expanded from...
./lib/autoconf/general.m4:2997: AC_TRY_RUN is expanded from...
configure.ac:819: the top level])
m4trace:configure.ac:819: -1- m4_pattern_allow([^WRITEPATH$])
m4trace:configure.ac:819: -1- m4_pattern_allow([^XTERMPATH$])
m4trace:configure.ac:819: -1- _m4_warn([obsolete], [The macro `AC_FD_MSG' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:400: AC_FD_MSG is expanded from...
lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
./lib/autoconf/general.m4:2962: _AC_RUN_IFELSE is expanded from...
lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
./lib/autoconf/general.m4:2981: AC_RUN_IFELSE is expanded from...
./lib/autoconf/general.m4:2997: AC_TRY_RUN is expanded from...
configure.ac:819: the top level])
m4trace:configure.ac:819: -1- m4_pattern_allow([^PTYMODE$])
m4trace:configure.ac:819: -1- m4_pattern_allow([^PTYGROUP$])
m4trace:configure.ac:819: -1- _m4_warn([obsolete], [The macro `AC_FD_MSG' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:400: AC_FD_MSG is expanded from...
lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
./lib/autoconf/general.m4:2962: _AC_RUN_IFELSE is expanded from...
lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
./lib/autoconf/general.m4:2981: AC_RUN_IFELSE is expanded from...
./lib/autoconf/general.m4:2997: AC_TRY_RUN is expanded from...
configure.ac:819: the top level])
m4trace:configure.ac:819: -1- _m4_warn([obsolete], [The macro `AC_FD_MSG' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:400: AC_FD_MSG is expanded from...
lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
./lib/autoconf/general.m4:2962: _AC_RUN_IFELSE is expanded from...
lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
./lib/autoconf/general.m4:2981: AC_RUN_IFELSE is expanded from...
./lib/autoconf/general.m4:2997: AC_TRY_RUN is expanded from...
configure.ac:819: the top level])
m4trace:configure.ac:903: -1- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:903: the top level])
m4trace:configure.ac:917: -2- m4_pattern_allow([^GETUTENT$])
m4trace:configure.ac:920: -2- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:920: the top level])
m4trace:configure.ac:934: -3- m4_pattern_allow([^GETUTENT$])
m4trace:configure.ac:921: -2- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
configure.ac:921: the top level])
m4trace:configure.ac:904: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
configure.ac:904: the top level])
m4trace:configure.ac:936: -1- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:936: the top level])
m4trace:configure.ac:946: -2- m4_pattern_allow([^UTHOST$])
m4trace:configure.ac:937: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2847: AC_TRY_COMPILE is expanded from...
configure.ac:937: the top level])
m4trace:configure.ac:949: -1- m4_pattern_allow([^HAVE_UTEMPTER$])
m4trace:configure.ac:957: -1- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:957: the top level])
m4trace:configure.ac:962: -1- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:962: the top level])
m4trace:configure.ac:967: -2- m4_pattern_allow([^LOADAV_GETLOADAVG$])
m4trace:configure.ac:971: -2- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:971: the top level])
m4trace:configure.ac:976: -3- m4_pattern_allow([^LOADAV_GETLOADAVG$])
m4trace:configure.ac:972: -2- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
configure.ac:972: the top level])
m4trace:configure.ac:963: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
configure.ac:963: the top level])
m4trace:configure.ac:988: -1- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:988: the top level])
m4trace:configure.ac:995: -1- _m4_warn([obsolete], [The macro `AC_FD_MSG' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:400: AC_FD_MSG is expanded from...
configure.ac:995: the top level])
m4trace:configure.ac:997: -1- _m4_warn([obsolete], [The macro `AC_FD_MSG' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:400: AC_FD_MSG is expanded from...
configure.ac:997: the top level])
m4trace:configure.ac:999: -1- m4_pattern_allow([^LOADAV_UNIX$])
m4trace:configure.ac:1000: -1- m4_pattern_allow([^NLIST_STRUCT$])
m4trace:configure.ac:1000: -1- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
./lib/autoconf/headers.m4:89: _AC_CHECK_HEADER_COMPILE is expanded from...
./lib/autoconf/headers.m4:56: AC_CHECK_HEADER is expanded from...
configure.ac:1000: the top level])
m4trace:configure.ac:1000: -2- m4_pattern_allow([^NLIST_NAME_UNION$])
m4trace:configure.ac:1000: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2847: AC_TRY_COMPILE is expanded from...
lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
./lib/autoconf/headers.m4:89: _AC_CHECK_HEADER_COMPILE is expanded from...
./lib/autoconf/headers.m4:56: AC_CHECK_HEADER is expanded from...
configure.ac:1000: the top level])
m4trace:configure.ac:1007: -1- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:1007: the top level])
m4trace:configure.ac:1014: -2- m4_pattern_allow([^NLIST_DECLARED$])
m4trace:configure.ac:1016: -1- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:1016: the top level])
m4trace:configure.ac:1019: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2997: AC_TRY_RUN is expanded from...
configure.ac:1019: the top level])
m4trace:configure.ac:1019: -1- _m4_warn([cross], [AC_RUN_IFELSE called without default to allow cross compiling], [./lib/autoconf/general.m4:2981: AC_RUN_IFELSE is expanded from...
./lib/autoconf/general.m4:2997: AC_TRY_RUN is expanded from...
configure.ac:1019: the top level])
m4trace:configure.ac:1056: -1- _m4_warn([obsolete], [The macro `AC_FD_MSG' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:400: AC_FD_MSG is expanded from...
configure.ac:1056: the top level])
m4trace:configure.ac:1058: -1- _m4_warn([obsolete], [The macro `AC_FD_MSG' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:400: AC_FD_MSG is expanded from...
configure.ac:1058: the top level])
m4trace:configure.ac:1059: -1- m4_pattern_allow([^LOADAV_AVENRUN$])
m4trace:configure.ac:1061: -1- _m4_warn([obsolete], [The macro `AC_FD_MSG' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:400: AC_FD_MSG is expanded from...
configure.ac:1061: the top level])
m4trace:configure.ac:1062: -1- m4_pattern_allow([^LOADAV_USE_NLIST64$])
m4trace:configure.ac:1067: -1- _m4_warn([obsolete], [The macro `AC_FD_MSG' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:400: AC_FD_MSG is expanded from...
configure.ac:1067: the top level])
m4trace:configure.ac:1068: -1- _m4_warn([obsolete], [The macro `AC_FD_MSG' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:400: AC_FD_MSG is expanded from...
configure.ac:1068: the top level])
m4trace:configure.ac:1069: -1- _m4_warn([obsolete], [The macro `AC_FD_MSG' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:400: AC_FD_MSG is expanded from...
configure.ac:1069: the top level])
m4trace:configure.ac:1070: -1- _m4_warn([obsolete], [The macro `AC_FD_MSG' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:400: AC_FD_MSG is expanded from...
configure.ac:1070: the top level])
m4trace:configure.ac:1071: -1- _m4_warn([obsolete], [The macro `AC_FD_MSG' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:400: AC_FD_MSG is expanded from...
configure.ac:1071: the top level])
m4trace:configure.ac:1072: -1- _m4_warn([obsolete], [The macro `AC_FD_MSG' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:400: AC_FD_MSG is expanded from...
configure.ac:1072: the top level])
m4trace:configure.ac:1073: -1- _m4_warn([obsolete], [The macro `AC_FD_MSG' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:400: AC_FD_MSG is expanded from...
configure.ac:1073: the top level])
m4trace:configure.ac:1078: -1- AC_PROGRAM_SOURCE([
#include <sys/types.h>
#include <sys/param.h>
], [
#if !defined(LOADAV_GETLOADAVG) && ((defined(hp300) && !defined(__hpux)) || defined(sun) || (defined(ultrix) && defined(mips)) || defined(_SEQUENT_) || defined(sgi) || (defined(SVR4) && !defined(__hpux)) || defined(sony_news) || (!defined(__osf__) && defined(__alpha)) || defined(_IBMR2) || defined(_AUX_SOURCE) || defined(AUX) || defined(m88k))
loadtype=long
# if defined(apollo) || defined(_IBMR2) || defined(_AUX_SOURCE) || defined(AUX)
loadscale=65536
# else
# if defined(FSCALE) && !defined(__osf__)
# undef FSCALE
loadscale=FSCALE
# else
# ifdef sgi
loadtype=int
loadscale=1024
# else
# if defined(MIPS) || defined(SVR4) || defined(m88k)
loadscale=256
# else /* not MIPS */
loadscale=1000 /* our default value */
# endif /* MIPS */
# endif /* sgi */
# endif /* not FSCALE */
# endif /* not apollo */
#else
loadtype=double
loadscale=1
#endif
#ifdef alliant
loadnum=4
#else
loadnum=3
#endif
])
m4trace:configure.ac:1114: -1- m4_pattern_allow([^LOADAV$])
m4trace:configure.ac:1115: -1- m4_pattern_allow([^LOADAV_TYPE$])
m4trace:configure.ac:1116: -1- m4_pattern_allow([^LOADAV_NUM$])
m4trace:configure.ac:1117: -1- m4_pattern_allow([^LOADAV_SCALE$])
m4trace:configure.ac:1125: -1- _m4_warn([obsolete], [The macro `AC_FD_MSG' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:400: AC_FD_MSG is expanded from...
configure.ac:1125: the top level])
m4trace:configure.ac:1126: -1- m4_pattern_allow([^SIGVOID$])
m4trace:configure.ac:1130: -1- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:1130: the top level])
m4trace:configure.ac:1137: -2- m4_pattern_allow([^SIGVOID$])
m4trace:configure.ac:1131: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2847: AC_TRY_COMPILE is expanded from...
configure.ac:1131: the top level])
m4trace:configure.ac:1139: -1- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:1139: the top level])
m4trace:configure.ac:1149: -2- m4_pattern_allow([^USESIGSET$])
m4trace:configure.ac:1140: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
configure.ac:1140: the top level])
m4trace:configure.ac:1151: -1- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:1151: the top level])
m4trace:configure.ac:1188: -2- m4_pattern_allow([^SYSVSIGS$])
m4trace:configure.ac:1152: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2997: AC_TRY_RUN is expanded from...
configure.ac:1152: the top level])
m4trace:configure.ac:1196: -1- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:1196: the top level])
m4trace:configure.ac:1202: -1- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:1202: the top level])
m4trace:configure.ac:1203: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
configure.ac:1203: the top level])
m4trace:configure.ac:1211: -1- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:1211: the top level])
m4trace:configure.ac:1212: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
configure.ac:1212: the top level])
m4trace:configure.ac:1214: -1- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:1214: the top level])
m4trace:configure.ac:1215: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
configure.ac:1215: the top level])
m4trace:configure.ac:1215: -1- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
./lib/autoconf/general.m4:2894: _AC_LINK_IFELSE is expanded from...
./lib/autoconf/general.m4:2911: AC_LINK_IFELSE is expanded from...
./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
configure.ac:1215: the top level])
m4trace:configure.ac:1215: -2- _m4_warn([obsolete], [The macro `AC_FD_MSG' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:400: AC_FD_MSG is expanded from...
lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
./lib/autoconf/general.m4:2894: _AC_LINK_IFELSE is expanded from...
./lib/autoconf/general.m4:2911: AC_LINK_IFELSE is expanded from...
./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
configure.ac:1215: the top level])
m4trace:configure.ac:1215: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
./lib/autoconf/general.m4:2894: _AC_LINK_IFELSE is expanded from...
./lib/autoconf/general.m4:2911: AC_LINK_IFELSE is expanded from...
./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
configure.ac:1215: the top level])
m4trace:configure.ac:1215: -1- _m4_warn([obsolete], [The macro `AC_FD_MSG' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:400: AC_FD_MSG is expanded from...
lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
./lib/autoconf/general.m4:2894: _AC_LINK_IFELSE is expanded from...
./lib/autoconf/general.m4:2911: AC_LINK_IFELSE is expanded from...
./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
./lib/autoconf/general.m4:2894: _AC_LINK_IFELSE is expanded from...
./lib/autoconf/general.m4:2911: AC_LINK_IFELSE is expanded from...
./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
configure.ac:1215: the top level])
m4trace:configure.ac:1215: -1- m4_pattern_allow([^NOSYSLOG$])
m4trace:configure.ac:1239: -1- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:1239: the top level])
m4trace:configure.ac:1248: -2- m4_pattern_allow([^BSDWAIT$])
m4trace:configure.ac:1240: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2847: AC_TRY_COMPILE is expanded from...
configure.ac:1240: the top level])
m4trace:configure.ac:1251: -1- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:1251: the top level])
m4trace:configure.ac:1252: -2- m4_pattern_allow([^TERMIO$])
m4trace:configure.ac:1254: -3- m4_pattern_allow([^TERMIO$])
m4trace:configure.ac:1254: -2- _m4_warn([obsolete], [The macro `AC_TRY_CPP' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2762: AC_TRY_CPP is expanded from...
configure.ac:1254: the top level])
m4trace:configure.ac:1252: -1- _m4_warn([obsolete], [The macro `AC_TRY_CPP' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2762: AC_TRY_CPP is expanded from...
configure.ac:1252: the top level])
m4trace:configure.ac:1260: -1- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:1260: the top level])
m4trace:configure.ac:1265: -2- m4_pattern_allow([^SHADOWPW$])
m4trace:configure.ac:1261: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
configure.ac:1261: the top level])
m4trace:configure.ac:1267: -1- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:1267: the top level])
m4trace:configure.ac:1272: -2- m4_pattern_allow([^GETTTYENT$])
m4trace:configure.ac:1268: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
configure.ac:1268: the top level])
m4trace:configure.ac:1274: -1- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:1274: the top level])
m4trace:configure.ac:1279: -2- m4_pattern_allow([^HAVE_FDWALK$])
m4trace:configure.ac:1275: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
configure.ac:1275: the top level])
m4trace:configure.ac:1281: -1- _m4_warn([obsolete], [The macro `AC_CHECKING' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2499: AC_CHECKING is expanded from...
configure.ac:1281: the top level])
m4trace:configure.ac:1299: -2- m4_pattern_allow([^USEBCOPY$])
m4trace:configure.ac:1282: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2997: AC_TRY_RUN is expanded from...
configure.ac:1282: the top level])
m4trace:configure.ac:1319: -2- m4_pattern_allow([^USEMEMMOVE$])
m4trace:configure.ac:1320: -2- _m4_warn([obsolete], [The macro `AC_FD_MSG' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:400: AC_FD_MSG is expanded from...
configure.ac:1320: the top level])
m4trace:configure.ac:1320: -2- m4_pattern_allow([^USEMEMMOVE$])
m4trace:configure.ac:1301: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2997: AC_TRY_RUN is expanded from...
configure.ac:1301: the top level])
m4trace:configure.ac:1340: -2- m4_pattern_allow([^USEMEMCPY$])
m4trace:configure.ac:1322: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2997: AC_TRY_RUN is expanded from...
configure.ac:1322: the top level])
m4trace:configure.ac:1342: -1- m4_pattern_allow([^HAVE_LONG_FILE_NAMES$])
m4trace:configure.ac:1350: -2- m4_pattern_allow([^USEVARARGS$])
m4trace:configure.ac:1345: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
configure.ac:1345: the top level])
m4trace:configure.ac:1356: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
configure.ac:1356: the top level])
m4trace:configure.ac:1363: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
configure.ac:1363: the top level])
m4trace:configure.ac:1370: -1- m4_pattern_allow([^USESETENV$])
m4trace:configure.ac:1372: -1- m4_pattern_allow([^HAVE_SETENV_3$])
m4trace:configure.ac:1374: -1- m4_pattern_allow([^HAVE_SETENV_2$])
m4trace:configure.ac:1379: -2- m4_pattern_allow([^NEEDPUTENV$])
m4trace:configure.ac:1379: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
configure.ac:1379: the top level])
m4trace:configure.ac:1386: -2- m4_pattern_allow([^HAVE_NL_LANGINFO$])
m4trace:configure.ac:1382: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
configure.ac:1382: the top level])
m4trace:configure.ac:1390: -1- m4_pattern_allow([^HAVE_RENAME$])
m4trace:configure.ac:1390: -1- m4_pattern_allow([^HAVE_FCHMOD$])
m4trace:configure.ac:1390: -1- m4_pattern_allow([^HAVE_FCHOWN$])
m4trace:configure.ac:1390: -1- m4_pattern_allow([^HAVE_STRERROR$])
m4trace:configure.ac:1390: -1- m4_pattern_allow([^HAVE_LSTAT$])
m4trace:configure.ac:1390: -1- m4_pattern_allow([^HAVE__EXIT$])
m4trace:configure.ac:1390: -1- m4_pattern_allow([^HAVE_UTIMES$])
m4trace:configure.ac:1390: -1- m4_pattern_allow([^HAVE_VSNPRINTF$])
m4trace:configure.ac:1390: -1- m4_pattern_allow([^HAVE_GETCWD$])
m4trace:configure.ac:1390: -1- m4_pattern_allow([^HAVE_SETLOCALE$])
m4trace:configure.ac:1390: -1- m4_pattern_allow([^HAVE_STRFTIME$])
m4trace:configure.ac:1403: -2- m4_pattern_allow([^USE_PAM$])
m4trace:configure.ac:1397: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete.
You should run autoupdate.], [./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
configure.ac:1397: the top level])
m4trace:configure.ac:1413: -1- m4_pattern_allow([^USE_LOCALE$])
m4trace:configure.ac:1417: -1- m4_pattern_allow([^BUILTIN_TELNET$])
m4trace:configure.ac:1421: -1- m4_pattern_allow([^COLORS256$])
m4trace:configure.ac:1425: -1- m4_pattern_allow([^RXVT_OSC$])
m4trace:configure.ac:1442: -1- m4_pattern_allow([^ETCSCREENRC$])
m4trace:configure.ac:1444: -1- _m4_warn([obsolete], [AC_OUTPUT should be used without arguments.
You should run autoupdate.], [])
m4trace:configure.ac:1444: -1- m4_pattern_allow([^LIB@&t@OBJS$])
m4trace:configure.ac:1444: -1- m4_pattern_allow([^LTLIBOBJS$])

1216
autom4te.cache/traces.1 Normal file

File diff suppressed because it is too large Load diff

1216
autom4te.cache/traces.2 Normal file

File diff suppressed because it is too large Load diff

945
braille.c Normal file
View file

@ -0,0 +1,945 @@
/*
* A braille interface to unix tty terminals
*
* Authors: Hadi Bargi Rangin bargi@dots.physics.orst.edu
* Bill Barry barryb@dots.physics.orst.edu
*
* Copyright (c) 1995 by Science Access Project, Oregon State University.
*
*
* 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 3, 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 (see the file COPYING); if not, see
* https://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*
****************************************************************
*/
#include <stdio.h>
#include <fcntl.h>
#include <sys/stat.h>
#include "config.h"
#include "screen.h"
#include "extern.h"
#include "braille.h"
#ifdef HAVE_BRAILLE
extern int bd_init_powerbraille_40 __P((void));
extern int bd_init_powerbraille_80 __P((void));
extern int bd_init_navigator_40 __P((void));
extern struct layer *flayer;
extern struct display *displays, *display;
extern char *rc_name;
/* global variables */
struct braille_display bd;
struct bd_type {
char *name;
int (*init) __P((void));
};
static struct bd_type bd_typelist[] =
{
{"powerbraille_40", bd_init_powerbraille_40},
{"powerbraille_80", bd_init_powerbraille_80},
{"navigator_40" , bd_init_navigator_40}
};
static void position_braille_cursor __P((void));
static int initialize_braille_display_type __P((char *));
static int open_braille_device __P(());
static int load_braille_table __P((char *));
static void bd_signal __P((void));
static void bd_bc_left __P((void));
static void bd_bc_right __P((void));
static void bd_bc_up __P((void));
static void bd_bc_down __P((void));
static void bd_upper_left __P((void));
static void bd_upper_right __P((void));
static void bd_lower_left __P((void));
static void bd_lower_right __P((void));
static int bd_do_search __P((int, int, int));
static void bd_normalize __P((int, int));
static void bd_readev_fn __P((struct event *, char *));
static void bd_writeev_fn __P((struct event *, char *));
static void bd_selectev_fn __P((struct event *, char *));
static unsigned char btable_local [] =
{
0xC8,0xC1,0xC3,0xC9,0xD9,0xD1,0xCB,0xDB,
0xD3,0xCA,0xDA,0xC5,0xC7,0xCD,0xDD,0xD5,
0xCF,0xDF,0xD7,0xCE,0xDE,0xE5,0xE7,0xFA,
0xED,0xFD,0xF5,0xEA,0xF3,0xFB,0xD8,0xF8,
0x00,0x2E,0x10,0x3C,0x2B,0x29,0x2F,0x04,
0x37,0x3E,0x21,0x2C,0x20,0x24,0x28,0x0C,
0x34,0x02,0x06,0x12,0x32,0x22,0x16,0x36,
0x26,0x14,0x31,0x30,0x23,0x3F,0x1C,0x39,
0x48,0x41,0x43,0x49,0x59,0x51,0x4B,0x5B,
0x53,0x4A,0x5A,0x45,0x47,0x4D,0x5D,0x55,
0x4F,0x5F,0x57,0x4E,0x5E,0x65,0x67,0x7A,
0x6D,0x7D,0x75,0x6A,0x73,0x7B,0x58,0x38,
0x08,0x01,0x03,0x09,0x19,0x11,0x0B,0x1B,
0x13,0x0A,0x1A,0x05,0x07,0x0D,0x1D,0x15,
0x0F,0x1F,0x17,0x0E,0x1E,0x25,0x27,0x3A,
0x2D,0x3D,0x35,0x2A,0x33,0x3B,0x18,0x78,
0x88,0x81,0x83,0x89,0x99,0x91,0x8B,0x9B,
0x93,0x8A,0x9A,0x85,0x87,0x8D,0x9D,0x95,
0x8F,0x9F,0x97,0x8E,0x9E,0xA5,0xA7,0xBA,
0xAD,0xBD,0xB5,0xAA,0xB3,0xBB,0x98,0xB8,
0x40,0x6E,0x50,0x7C,0x6B,0x69,0x6F,0x44,
0x77,0x7E,0x61,0x6C,0x60,0x64,0x68,0x4C,
0x74,0x42,0x46,0x52,0x72,0x62,0x56,0x76,
0x66,0x54,0x71,0x70,0x63,0x7F,0x5C,0x79,
0xC0,0xEE,0xD0,0xFC,0xEB,0xE9,0xEF,0xC4,
0xF7,0xFE,0xE1,0xEC,0xE0,0xE4,0xE8,0xCC,
0xF4,0xC2,0xC6,0xD2,0xF2,0xE2,0xD6,0xF6,
0xE6,0xD4,0xF1,0xF0,0xE3,0xFF,0xDC,0xF9,
0x80,0xAE,0x90,0xBC,0xAB,0xA9,0xAF,0x84,
0xB7,0xBE,0xA1,0xAC,0xA0,0xA4,0xA8,0x8C,
0xB4,0x82,0x86,0x92,0xB2,0xA2,0x96,0xB6,
0xA6,0x94,0xB1,0xB0,0xA3,0xBF,0x9C,0xB9
};
void
InitBraille()
{
bd.bd_start_braille=0;
bd.bd_port = 0;
bd.bd_braille_table = SaveStr("internal us-braille.tbl");
bd.bd_type = 0;
bd.bd_baud = 9600;
bd.bd_bell = 1;
bd.bd_eightdot = 1;
bd.bd_info = 0;
bd.bd_link = 1;
bd.bd_ncells = 0;
bd.bd_width = 0;
bd.bd_ncrc = 1;
bd.bd_scroll = 1;
bd.bd_skip = 0;
bd.bd_using_braille = 0;
bd.bd_obuflen = 0;
bd.bd_fd = -1;
bcopy((char *)btable_local, bd.bd_btable, 256);
}
static int
initialize_braille_display_type(s)
char *s;
{
int i;
for (i = 0; i < sizeof(bd_typelist)/sizeof(*bd_typelist); i++)
if (!strcmp(s, bd_typelist[i].name))
break;
if (i == sizeof(bd_typelist)/sizeof(*bd_typelist))
{
Msg(0, "No entry for bd_type: %s ", s);
return -1;
}
bd.bd_type = bd_typelist[i].name;
if ((*bd_typelist[i].init)())
return -1;
if (!bd.bd_width)
bd.bd_width = bd.bd_ncells;
return 0;
}
void
StartBraille()
{
bd.bd_dpy = displays;
debug("StartBraille called\n");
evdeq(&bd.bd_readev);
evdeq(&bd.bd_writeev);
evdeq(&bd.bd_selectev);
bd.bd_using_braille = 0;
if (!bd.bd_start_braille)
return;
if (bd.bd_type == 0 || bd.bd_port == 0)
return;
if (bd.bd_fd < 0 && open_braille_device())
{
Msg(0, "bd_port turned off");
free(bd.bd_port);
bd.bd_port = 0;
return;
}
/* check if braille display is connected and turned on */
if (bd.bd_response_test())
{
Msg(0, "Make sure that braille display is connected and turned on. ");
Msg(0, "start_braille turned off");
bd.bd_start_braille = 0;
}
else
{
bd.bd_using_braille = 1;
bd.bd_readev.fd = bd.bd_writeev.fd = bd.bd_fd;
bd.bd_readev.type = EV_READ;
bd.bd_writeev.type = EV_WRITE;
bd.bd_selectev.type = EV_ALWAYS;
bd.bd_readev.data = bd.bd_writeev.data = bd.bd_selectev.data = (char *)&bd;
bd.bd_readev.handler = bd_readev_fn;
bd.bd_writeev.handler = bd_writeev_fn;
bd.bd_selectev.handler = bd_selectev_fn;
evenq(&bd.bd_readev);
bd.bd_writeev.condpos = &bd.bd_obuflen;
bd.bd_writeev.condneg = 0;
evenq(&bd.bd_writeev);
bd.bd_selectev.pri = -20;
evenq(&bd.bd_selectev);
}
}
static int
load_braille_table(tablename)
char *tablename;
{
int i, j, c, p;
FILE *fp;
char buffer[80], a[10];
if ((fp = secfopen(tablename, "r")) == 0)
{
Msg(errno, "Braille table not found: %s ", tablename);
return -1;
}
bzero(bd.bd_btable, 256);
/* format:
* Dec Hex Braille Description
* 7 07 (12-45--8) BEL
*/
while (fgets(buffer, sizeof(buffer), fp))
{
if (buffer[0] == '#')
continue;
sscanf(buffer,"%d %x %8s", &i, &j, a);
if (i < 0 || i > 255)
continue;
for (j=1, p=1, c=0; j<9; j++, p*=2)
if (a[j] == '0' + j)
c += p;
bd.bd_btable[i] = c;
}
fclose(fp);
return 0;
}
static int
open_braille_device(s)
char *s;
{
char str[256];
sprintf(str, "%d cs8 -istrip ixon ixoff", bd.bd_baud);
bd.bd_fd = OpenTTY(bd.bd_port, str);
if (bd.bd_fd == -1)
{
Msg(errno, "open comm port failed: %s ", bd.bd_port);
return -1;
}
fcntl(bd.bd_fd, F_SETFL, FNBLOCK);
return 0;
}
static void
position_braille_cursor()
{
int sx = bd.bd_sx;
int bx = BD_FORE->w_bd_x;
int eol = BD_FORE->w_width;
int w = bd.bd_width;
if (bd.bd_scroll)
bx = sx - w + bd.bd_ncrc; /* keep rc centered in window */
else
bx = w * (int)(sx / w); /* increase bc in integral steps */
if (bx > eol - w)
bx = eol - w;
if (bx < 0)
bx = 0;
BD_FORE->w_bd_x = bx;
BD_FORE->w_bd_y = bd.bd_sy;
}
void
RefreshBraille()
{
int i, y, xs, xe;
int cursor_pos;
if (!bd.bd_using_braille)
return;
if (!BD_FORE)
return;
bcopy(bd.bd_line, bd.bd_oline, bd.bd_ncells);
bd.bd_refreshing = 1;
flayer = bd.bd_dpy->d_forecv->c_layer;
bd.bd_sx = flayer->l_x;
bd.bd_sy = flayer->l_y;
display = bd.bd_dpy;
if ((D_obufp != D_obuf) && bd.bd_link)
{
/* jump to real cursor */
debug("calling position_braille_cursor\n");
position_braille_cursor();
}
bclear(bd.bd_line, bd.bd_ncells);
y = BD_FORE->w_bd_y;
xs = BD_FORE->w_bd_x;
if (bd.bd_info & 1)
{
sprintf(bd.bd_line, "%02d%02d", (BD_FORE->w_bd_x + 1) % 100, (BD_FORE->w_bd_y + 1) % 100);
bd.bd_line[4] = ' ';
}
if (bd.bd_info & 2)
{
sprintf(bd.bd_line + bd.bd_ncells - 4, "%02d%02d",(bd.bd_sx +1) % 100, (bd.bd_sy +1) % 100);
}
xe = xs + bd.bd_width - 1;
if (xs > flayer->l_width - 1)
xs = flayer->l_width - 1;
if (xe > flayer->l_width - 1)
xe = flayer->l_width - 1;
if (D_status)
{
sprintf(bd.bd_line, "**%-*.*s", bd.bd_ncells - 2, bd.bd_ncells - 2, D_status_lastmsg ? D_status_lastmsg : "unknown msg");
xs = xe = -1;
}
else if (xs <= xe)
{
LayRedisplayLine(-1, xs, xe, 1);
LayRedisplayLine(y, xs, xe, 1);
}
debug1("Braille: got >%s<\n", bd.bd_line);
bd.bd_refreshing = 0;
if (y == bd.bd_sy && xs <= bd.bd_sx && bd.bd_sx <= xe)
cursor_pos = bd.bd_sx - xs + (bd.bd_info & 1 ? 4 : 0);
else
cursor_pos = bd.bd_ncells;
for (i = 0; i < bd.bd_ncells; i++)
if (bd.bd_line[i] != bd.bd_oline[i])
break;
if (bd.bd_cursorpos != cursor_pos || i < bd.bd_ncells)
bd.write_line_braille(bd.bd_line, bd.bd_ncells, cursor_pos);
bd.bd_cursorpos = cursor_pos;
}
/**********************************************************************
*
*/
/*
* So, why is there a Flush() down below? The reason is simple: the
* cursor warp (if bd_link is on) checks the obuf to see if something
* happened. If there would be no Flush, screen would warp the
* bd cursor if a bd movement command tries to ring the bell.
* (In other words: this is a gross hack!)
*/
static void
bd_signal()
{
if (!bd.bd_bell)
return;
display = bd.bd_dpy;
if (D_obufp != D_obuf)
AddCStr(D_BL);
else
{
AddCStr(D_BL);
Flush(0);
}
}
static int
bd_do_search(y, xs, xe)
int y, xs, xe;
{
int oy = BD_FORE->w_bd_y;
if (!bd.bd_skip) /* no skip mode, found it */
{
if (xs > xe)
return 0;
bd.bd_searchmin = xs;
bd.bd_searchmax = xe;
return 1;
}
flayer = bd.bd_dpy->d_forecv->c_layer;
bd.bd_searchmax = -1;
bd.bd_searchmin = flayer->l_width;
if (xs <= xe)
{
BD_FORE->w_bd_y = y; /* stupid hack */
bd.bd_refreshing = bd.bd_searching = 1;
bd.bd_searchstart = xs;
bd.bd_searchend = xe;
LayRedisplayLine(-1, xs, xe, 1);
LayRedisplayLine(y, xs, xe, 1);
bd.bd_refreshing = bd.bd_searching = 0;
BD_FORE->w_bd_y = oy;
}
return bd.bd_searchmax >= 0;
}
static void
bd_normalize(x, y)
int x, y;
{
if (x > BD_FORE->w_width - bd.bd_width)
x = BD_FORE->w_width - bd.bd_width;
if (x < 0)
x = 0;
if (y < 0)
{
bd_signal();
y = 0;
}
if (y >= BD_FORE->w_height)
{
bd_signal();
y = BD_FORE->w_height - 1;
}
if (x != BD_FORE->w_bd_x || y != BD_FORE->w_bd_y)
bd.bd_moved = 1;
BD_FORE->w_bd_x = x;
BD_FORE->w_bd_y = y;
}
static void
bd_bc_left()
{
int bx = BD_FORE->w_bd_x, by = BD_FORE->w_bd_y;
int ex;
ex = bx - 1;
bx = 0;
for (; by >= 0; by--)
{
if (bd_do_search(by, 0, ex))
{
if (!bd.bd_skip && by != BD_FORE->w_bd_y)
bd_signal();
bx = bd.bd_searchmax + 1 - bd.bd_width;
break;
}
ex = BD_FORE->w_width - 1;
}
bd_normalize(bx, by);
}
static void
bd_bc_right()
{
int bx = BD_FORE->w_bd_x, by = BD_FORE->w_bd_y;
int sx;
sx = bx + bd.bd_width;
bx = BD_FORE->w_width - bd.bd_width;
for (; by < BD_FORE->w_height; by++)
{
if (bd_do_search(by, sx, BD_FORE->w_width - 1))
{
if (!bd.bd_skip && by != BD_FORE->w_bd_y)
bd_signal();
bx = bd.bd_searchmin;
break;
}
sx = 0;
}
bd_normalize(bx, by);
}
static void
bd_bc_up()
{
int bx = BD_FORE->w_bd_x, by = BD_FORE->w_bd_y;
for (by--; by >= 0; by--)
if (bd_do_search(by, bx, bx + bd.bd_width - 1))
break;
bd_normalize(bx, by);
}
static void
bd_bc_down()
{
int bx = BD_FORE->w_bd_x, by = BD_FORE->w_bd_y;
for (by++; by < BD_FORE->w_height; by++)
if (bd_do_search(by, bx, bx + bd.bd_width - 1))
break;
bd_normalize(bx, by);
}
static void
bd_upper_left()
{
bd_normalize(0, 0);
}
static void
bd_upper_right()
{
bd_normalize(BD_FORE->w_width - bd.bd_width, 0);
}
static void
bd_lower_left()
{
bd_normalize(0, BD_FORE->w_height - 1);
}
static void
bd_lower_right()
{
bd_normalize(BD_FORE->w_width - bd.bd_width, BD_FORE->w_height -1);
}
/**********************************************************************
*
*/
static void
bd_check(x, c)
int x, c;
{
if (c == ' ')
return;
if (x < bd.bd_searchstart || x > bd.bd_searchend)
return;
if (x > bd.bd_searchmax)
bd.bd_searchmax = x;
if (x < bd.bd_searchmin)
bd.bd_searchmin = x;
}
/*ARGSUSED*/
void
BGotoPos(la, x, y)
struct layer *la;
int x, y;
{
}
/*ARGSUSED*/
void
BCDisplayLine(la, ml, y, xs, xe, isblank)
struct layer *la;
struct mline *ml;
int y, xs, xe;
int isblank;
{
int x;
int sx, ex;
char *l;
if (y != BD_FORE->w_bd_y)
return;
if (bd.bd_searching)
{
for (x = xs; x <= xe; x++)
bd_check(x, ml->image[x]);
return;
}
l = bd.bd_line;
sx = BD_FORE->w_bd_x;
ex = sx + bd.bd_width - 1;
if (bd.bd_info & 1)
l += 4;
for (x = xs; x <= xe; x++)
if (x >= sx && x <= ex)
l[x - sx] = ml->image[x];
}
/*ARGSUSED*/
void
BPutChar(la, c, x, y)
struct layer *la;
struct mchar *c;
int x, y;
{
int sx, ex;
char *l;
if (y != BD_FORE->w_bd_y)
return;
if (bd.bd_searching)
{
bd_check(x, c->image);
return;
}
l = bd.bd_line;
sx = BD_FORE->w_bd_x;
ex = sx + bd.bd_width - 1;
if (bd.bd_info & 1)
l += 4;
if (x >= sx && x <= ex)
l[x - sx] = c->image;
}
/*ARGSUSED*/
void
BPutStr(la, s, n, r, x, y)
struct layer *la;
char *s;
int n;
struct mchar *r;
int x, y;
{
int sx, ex;
char *l;
if (y != BD_FORE->w_bd_y)
return;
if (bd.bd_searching)
{
for (; n > 0; n--, s++, x++)
bd_check(x, *s);
return;
}
l = bd.bd_line;
sx = BD_FORE->w_bd_x;
ex = sx + bd.bd_width - 1;
if (bd.bd_info & 1)
l += 4;
for (; n > 0; n--, s++, x++)
if (x >= sx && x <= ex)
l[x - sx] = *s;
}
/**********************************************************************
*
*/
static char *infonames[] = {"none", "bc", "sc", "bc+sc"};
void
DoBrailleAction(act, msgok)
struct action *act;
int msgok;
{
int nr, dosig;
int n, l, o;
char *s, **args;
struct stat st;
nr = act->nr;
args = act->args;
dosig = display && !*rc_name;
switch(nr)
{
case RC_BD_BELL:
if (ParseSwitch(act, &bd.bd_bell) || !msgok)
{
bd_signal();
break;
}
Msg(0, bd.bd_bell ? "bd_bell is on." : "bd_bell is off.");
break;
case RC_BD_EIGHTDOT:
if (ParseSwitch(act, &bd.bd_eightdot) || !msgok)
break;
Msg(0, "switched to %d-dots system.", bd.bd_eightdot ? 8 : 6);
break;
case RC_BD_INFO:
n = bd.bd_info;
if (*args)
{
if (strlen(*args) == 4)
n = args[0][n] - '0';
else if (ParseNum(act, &n))
break;
}
if (n < 0 || n > 3)
{
Msg(0, "Out of range; 0 <= bd_info >= 3 ");
break;
}
/* bd_width at the beginning is unknown */
if (bd.bd_width == 0)
break;
o = (bd.bd_info * 2 + 2) & 12;
l = (n * 2 + 2) & 12;
if (l >= bd.bd_ncells)
{
Msg(0, "bd_info is too large for braille display.");
break;
}
if (l >= bd.bd_width + o)
{
Msg(0, "bd_info is too large for bd_width.");
break;
}
bd.bd_width += o - l;
bd.bd_info = n;
if (msgok)
Msg(0, "bd_info is %s.", infonames[n]);
position_braille_cursor();
break;
case RC_BD_LINK:
if (*args == 0 && bd.bd_moved)
bd.bd_link = 0;
if (ParseSwitch(act, &bd.bd_link))
break;
if (bd.bd_link)
{
bd.bd_moved = 0;
if (dosig)
bd_signal();
position_braille_cursor();
}
if (msgok)
Msg(0, bd.bd_link ? "bd_link is on." : "bd_link is off.");
break;
case RC_BD_SKIP:
if (ParseSwitch(act, &bd.bd_skip))
break;
if (bd.bd_skip && dosig)
bd_signal();
if (msgok)
Msg(0, bd.bd_skip ? "bd_skip is on." : "bd_skip is off.");
break;
case RC_BD_SCROLL:
if (ParseSwitch(act, &bd.bd_scroll) || !msgok)
{
position_braille_cursor();
break;
}
Msg(0, bd.bd_scroll ? "bd_scroll is on." : "bd_scroll is off.");
break;
case RC_BD_NCRC:
n = bd.bd_ncrc;
if (*args)
{
if (args[0][0] == '+')
n = (n + atoi(*args + 1)) % bd.bd_width + 1;
else if (args[0][0] == '-')
n = (n - atoi(*args + 1)) % bd.bd_width + 1;
else if (ParseNum(act, &n))
break;
}
if (n < 1 || n > bd.bd_width)
{
Msg(0, "Out of range; 1 <= bd_ncrc >= %d", bd.bd_width);
break;
}
bd.bd_ncrc = n;
if (msgok)
Msg(0, "bd_ncrc status is: %d ", bd.bd_ncrc);
position_braille_cursor();
break;
case RC_BD_BRAILLE_TABLE:
s = 0;
if (*args)
{
if (ParseSaveStr(act, &s))
break;
if (load_braille_table(s))
{
free(s);
break;
}
if (bd.bd_braille_table)
free(bd.bd_braille_table);
bd.bd_braille_table = s;
}
if (msgok)
Msg(0, "bd_braille_table is: %s ", bd.bd_braille_table);
break;
case RC_BD_PORT:
s = 0;
if (*args)
{
if (ParseSaveStr(act, &s))
break;
if (stat(s, &st) || !S_ISCHR(st.st_mode) || access(s, R_OK|W_OK))
{
Msg(0, "Cannot access braille device port %s", s);
free(s);
break;
}
if (bd.bd_fd >= 0)
close(bd.bd_fd);
bd.bd_fd = -1;
if (bd.bd_port)
free(bd.bd_port);
bd.bd_port = s;
}
if (msgok)
Msg(0, "bd_port is: %s ", bd.bd_port ? bd.bd_port : "not set");
StartBraille();
break;
case RC_BD_TYPE:
s = 0;
if (*args)
if (ParseSaveStr(act, &s) || initialize_braille_display_type(s))
break;
if (msgok)
Msg(0, "bd_type is: %s ", bd.bd_type ? bd.bd_type : "not set");
StartBraille();
break;
case RC_BD_START_BRAILLE:
if (ParseSwitch(act, &bd.bd_start_braille))
break;
if (msgok)
Msg(0, bd.bd_start_braille ? "bd_start_braille is on." : "bd_start_braille is off.");
StartBraille();
break;
case RC_BD_WIDTH:
n = bd.bd_width;
if (*args)
{
if (ParseNum(act, &n))
break;
}
if (n <= 0)
{
Msg(0, "Invalid value for bd_width: %d ", n);
break;
}
l = (bd.bd_info * 2 + 2) & 12;
if (n > bd.bd_ncells - l || n < l)
{
Msg(0, "bd_info is too large for bd_width.");
break;
}
bd.bd_width = n;
if (msgok)
Msg(0, "bd_width is: %d ", bd.bd_width);
break;
case RC_BD_BC_LEFT:
bd_bc_left();
break;
case RC_BD_BC_RIGHT:
bd_bc_right();
break;
case RC_BD_BC_UP:
bd_bc_up();
break;
case RC_BD_BC_DOWN:
bd_bc_down();
break;
case RC_BD_UPPER_LEFT:
bd_upper_left();
break;
case RC_BD_UPPER_RIGHT:
bd_upper_right();
break;
case RC_BD_LOWER_LEFT:
bd_lower_left();
break;
case RC_BD_LOWER_RIGHT:
bd_lower_right();
break;
default:
break;
}
}
static void
bd_readev_fn(ev, data)
struct event *ev;
char *data;
{
bd.buttonpress();
}
static void
bd_writeev_fn(ev, data)
struct event *ev;
char *data;
{
int len;
if (bd.bd_obuflen == 0)
return;
if ((len = write(bd.bd_fd, bd.bd_obuf, bd.bd_obuflen)) < 0)
len = bd.bd_obuflen; /* dead braille display */
if ((bd.bd_obuflen -= len))
bcopy(bd.bd_obuf + len, bd.bd_obuf, bd.bd_obuflen);
}
static void
bd_selectev_fn(ev, data)
struct event *ev;
char *data;
{
RefreshBraille();
}
#endif /* HAVE_BRAILLE */

83
braille.h Normal file
View file

@ -0,0 +1,83 @@
/*
* Authors: Hadi Bargi Rangin bargi@dots.physics.orst.edu
* Bill Barry barryb@dots.physics.orst.edu
* Randy Lundquist randyl@dots.physics.orst.edu
*
* Modifications Copyright (c) 1995 by
* Science Access Project, Oregon State University.
*
* 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 3, 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 (see the file COPYING); if not, see
* https://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*
****************************************************************
* $Id$ GNU
*/
#ifdef HAVE_BRAILLE
extern void StartBraille __P((void));
struct braille_display
{
struct display *bd_dpy; /* display we are connected to */
int bd_start_braille; /* screenrc var to request to turn braille on */
int bd_using_braille; /* all is fine, use braille */
struct event bd_readev;
struct event bd_writeev;
struct event bd_selectev;
int bd_fd; /* file descriptor */
int bd_obuflen; /* current number of charactors in output buffer */
char bd_obuf[IOSIZE];
int bd_info; /* default, no info, 0,1,2,3 */
int bd_ncrc; /* default 1, numbers of cells on the right side of real cursor, 1...bd_width */
int bd_skip; /* default off, on/off */
int bd_link; /* default, linked, on/off */
int bd_width; /* length of braille display to use, <=bd_ncells */
int bd_scroll; /* default on, scroll on/off */
char *bd_braille_table; /* braille code */
int bd_bell; /* bell used for navigation on/off */
int bd_ncells; /* real number of cells on braille display */
int bd_eightdot; /* eightdot on/off */
int bd_baud; /* communication baudrate between port and braille display */
char *bd_port; /* serial port to use */
char *bd_type; /* kind of braille display */
double bd_version; /* rom version of braille display */
char bd_btable[256]; /* braille translation table */
/* functions which communicate with braille displays */
int (*write_line_braille) __P((char [],int, int));
void (*buttonpress) __P((void));
int (*bd_response_test) __P((void));
int bd_refreshing; /* are we doing a refresh? */
char bd_line[40+1]; /* bd_ncells chars displayed on braille */
int bd_cursorpos; /* cursor position on braille */
char bd_oline[40+1]; /* bd_ncells chars displayed on braille */
int bd_sx, bd_sy; /* screen cursor pos */
int bd_moved; /* used braille move keys */
int bd_searching; /* are we seaching (bd_skip is on) */
int bd_searchmax; /* search: max x */
int bd_searchmin; /* search: min x */
int bd_searchstart;
int bd_searchend;
};
extern struct braille_display bd;
#define BD_FORE bd.bd_dpy->d_fore
#endif

314
braille_tsi.c Normal file
View file

@ -0,0 +1,314 @@
/* bd-tsi.c, TSI specific key bindings and display commands
*
* dotscreen
* A braille interface to unix tty terminals
* Authors: Hadi Bargi Rangin bargi@dots.physics.orst.edu
* Bill Barry barryb@dots.physics.orst.edu
*
* Copyright (c) 1995 by Science Access Project, Oregon State University.
*
*
* 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 3, 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 (see the file COPYING); if not, see
* https://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*
****************************************************************
*/
#include "config.h"
#include "screen.h"
#include "extern.h"
#include "braille.h"
#ifdef HAVE_BRAILLE
extern struct display *display;
struct key2rc {
int key;
int nr;
char *arg1;
char *arg2;
};
static int tsi_ctype = 1; /* cursor type, 0,1,2 */
static int tsi_line_type; /* indicates number of cells on powerbraille
display 01=20 cells 02=40 cells 03=80 cells */
static int display_status_tsi __P((void));
static int write_line_tsi __P((char*, int, int));
static void buttonpress_tsi __P((struct key2rc*));
static void buttonpress_navigator_40 __P((void));
static void buttonpress_powerbraille_40 __P((void));
static void buttonpress_powerbraille_80 __P((void));
int
bd_init_powerbraille_40()
{
bd.write_line_braille = write_line_tsi;
bd.buttonpress = buttonpress_powerbraille_40;
bd.bd_response_test = display_status_tsi;
bd.bd_ncells = 40;
tsi_line_type = 2;
return 0;
}
int
bd_init_powerbraille_80()
{
bd.write_line_braille = write_line_tsi;
bd.buttonpress = buttonpress_powerbraille_80;
bd.bd_response_test = display_status_tsi;
bd.bd_ncells = 80;
tsi_line_type = 3;
return 0;
}
int
bd_init_navigator_40()
{
bd.write_line_braille = write_line_tsi;
bd.buttonpress = buttonpress_navigator_40;
bd.bd_response_test = display_status_tsi;
bd.bd_ncells = 40;
tsi_line_type = 2;
return 0;
}
static int
display_status_tsi()
{
char obuf[3], ibuf[20];
int r;
obuf[0] = 0xff;
obuf[1] = 0xff;
obuf[2] = 0x0a;
r = read(bd.bd_fd, ibuf, 20); /* flush the input port */
r = write(bd.bd_fd, obuf, 3);
if (r != 3)
return -1;
/* we have written to the display asking for a response
we wait 1 second for the response, read it and if no
response we wait 2 seconds, if still no response,
return -1 to indicate no braille display available */
sleep(1);
r = read(bd.bd_fd, ibuf, 2);
if (r == -1) {
sleep(2);
r = read(bd.bd_fd, ibuf, 2);
}
debug2("first chars from braille display %d %d\n", ibuf[0], ibuf[1]);
if (r != 2 || ibuf[0] != 0 || ibuf[1] != 5)
return -1;
r = read(bd.bd_fd, ibuf, 2);
if (r != 2)
return -1;
debug2("braille display size:%d dots:%d\n", ibuf[0], ibuf[1]);
bd.bd_ncells = (unsigned char)ibuf[0];
if (bd.bd_ncells <= 1)
return -1;
r = read(bd.bd_fd, ibuf, 1);
if (r != 1)
return -1;
if (ibuf[0] == 'V')
r = read(bd.bd_fd, ibuf, 3);
else
r = read(bd.bd_fd, ibuf + 1, 2) + 1;
if (r != 3)
return -1;
ibuf[3] = 0;
debug1("braille display version %s\n", ibuf);
bd.bd_version = atof(ibuf);
return 0;
}
static int
write_line_tsi(char *bstr, int line_length, int cursor_pos)
{
int obp, i;
bd.bd_obuf[0] = 0xff;
bd.bd_obuf[1] = 0xff;
bd.bd_obuf[2] = tsi_line_type;
bd.bd_obuf[3] = 0x07;
bd.bd_obuf[4] = cursor_pos;
bd.bd_obuf[5] = tsi_ctype;
obp = 6;
for (i = 0; i < line_length; i++) {
bd.bd_obuf[2*i + obp] = 0;
bd.bd_obuf[2*i + 1 + obp] = bd.bd_btable[(int)(unsigned char)bstr[i]];
}
for (i = line_length; i < bd.bd_ncells; i++) {
bd.bd_obuf[2*i + obp] = 0;
bd.bd_obuf[2*i + 1 + obp] = bd.bd_btable[(int)' '];
}
bd.bd_obuflen = 2*bd.bd_ncells + obp;
return 0;
}
static struct key2rc keys_navigator_40[] = {
{0x4000000, RC_STUFF, "-k", "kl"}, /* 1 */
{0x10000000, RC_STUFF, "-k", "kr"}, /* 3 */
{0x8000000, RC_STUFF, "-k", "ku"}, /* 2 */
{0x20000000, RC_STUFF, "-k", "kd"}, /* 4 */
{0x2000, RC_BD_BC_LEFT, 0, 0}, /* 6 */
{0x8000, RC_BD_BC_RIGHT, 0, 0}, /* 8 */
{0x4000, RC_BD_BC_UP, 0, 0}, /* 7 */
{0x10000, RC_BD_BC_DOWN, 0, 0}, /* 9 */
{0x6000, RC_BD_UPPER_LEFT, 0, 0}, /* 6, 7 */
{0xc000, RC_BD_UPPER_RIGHT, 0, 0}, /* 7, 8 */
{0x12000, RC_BD_LOWER_LEFT, 0, 0}, /* 6, 9 */
{0x18000, RC_BD_LOWER_RIGHT, 0, 0}, /* 8, 9 */
{0xa000, RC_BD_INFO, "1032", 0}, /* bc 6, 8 */
{0x14000000, RC_BD_INFO, "2301", 0}, /* sc 1, 3 */
{0x4008000, RC_BD_INFO, "3330", 0}, /* bc+sc 1, 8 */
{0x8010000, RC_BD_BELL, 0, 0}, /* 2, 9 */
{0x8004000, RC_BD_EIGHTDOT, 0, 0}, /* 2, 7 */
{0x40000000, RC_STUFF, "\015", 0}, /* 5 */
{0x20000, RC_BD_LINK, 0, 0}, /* 10 */
{0x10002000, RC_BD_SCROLL, 0, 0}, /* 3, 6 */
{0x20010000, RC_BD_NCRC, "+", 0}, /* 4, 9 */
{0x14000, RC_BD_SKIP, 0, 0}, /* 7, 9*/
{-1, RC_ILLEGAL, 0, 0}
};
static struct key2rc keys_powerbraille_40[] = {
{0x4000000, RC_STUFF, "-k", "kl"}, /* 1 */
{0x10000000, RC_STUFF, "-k", "kr"}, /* 3 */
{0x8000000, RC_STUFF, "-k", "ku"}, /* 2 */
{0x20000000, RC_STUFF, "-k", "kd"}, /* 4 */
{0x2000, RC_BD_BC_LEFT, 0, 0}, /* 6 */
{0x8000, RC_BD_BC_RIGHT, 0, 0}, /* 8 */
{0x4000, RC_BD_BC_UP, 0, 0}, /* 7 */
{0x10000, RC_BD_BC_DOWN, 0, 0}, /* 9 */
{0x8002000, RC_BD_UPPER_LEFT, 0, 0}, /* 2, 6 */
{0xc000, RC_BD_UPPER_RIGHT, 0, 0}, /* 7, 8 */
{0x20002000, RC_BD_LOWER_LEFT, 0, 0}, /* 3, 6 */
{0x18000, RC_BD_LOWER_RIGHT, 0, 0}, /* 8, 9 */
{0x8008000, RC_BD_INFO, "1032", 0}, /* bc 2, 8 */
{0x6000, RC_BD_INFO, "2301", 0}, /* 6, 7 */
{0x8004000, RC_BD_INFO, "3330", 0}, /* bc+sc 2, 7 */
{0x8010000, RC_BD_BELL, 0, 0}, /* 2, 9 */
{0x20008000, RC_BD_EIGHTDOT, 0, 0}, /* 4, 6 */
{0x40000000, RC_STUFF, "\015", 0}, /* 5 */
{0x20000, RC_BD_LINK, 0, 0}, /* 10 */
{0xa000, RC_BD_SCROLL, 0, 0}, /* 6, 8 */
{0x20010000, RC_BD_NCRC, "+", 0}, /* 4, 9 */
{0x20004000, RC_BD_SKIP, 0, 0}, /* 4, 7 */
{-1, RC_ILLEGAL, 0, 0}
};
static struct key2rc keys_powerbraille_80[] = {
{0x4000000, RC_STUFF, "-k", "kl"}, /* 1 */
{0x10000000, RC_STUFF, "-k", "kr"}, /* 3 */
{0x8000000, RC_STUFF, "-k", "ku"}, /* 2 */
{0x20000000, RC_STUFF, "-k", "kd"}, /* 4 */
{0x40000, RC_BD_BC_LEFT, 0, 0}, /* 6 */
{0x100000, RC_BD_BC_RIGHT, 0, 0}, /* 8 */
{0x4000, RC_BD_BC_UP, 0, 0}, /* 7 */
{0x10000, RC_BD_BC_DOWN, 0, 0}, /* 9 */
{0x44000, RC_BD_UPPER_LEFT, 0, 0}, /* 6, 7 */
{0x104000, RC_BD_UPPER_RIGHT, 0, 0}, /* 7, 8 */
{0x50000, RC_BD_LOWER_LEFT, 0, 0}, /* 6, 9 */
{0x110000, RC_BD_LOWER_RIGHT, 0, 0}, /* 8, 9 */
{0x8100000, RC_BD_INFO, "1032", 0}, /* 2, 8 */
{0x8040000, RC_BD_INFO, "2301", 0}, /* 2, 6 */
{0x140000, RC_BD_INFO, "3330", 0}, /* 6, 8 */
{0x8010000, RC_BD_BELL, 0, 0}, /* 2, 9 */
{0x8004000, RC_BD_EIGHTDOT, 0, 0}, /* 2, 7 */
{0x40000000, RC_STUFF, "\015", 0}, /* 5 */
{0x20000, RC_BD_LINK, 0, 0}, /* 10 */
{0x20004000, RC_BD_SCROLL, 0, 0}, /* 4, 7 */
{0x20010000, RC_BD_NCRC, "+", 0}, /* 4, 9 */
{0x40010000, RC_BD_SKIP, 0, 0}, /* 5, 9 */
{-1, RC_ILLEGAL, 0, 0}
};
static void
buttonpress_tsi(struct key2rc *tab)
{
int i, nb;
int bkeys;
unsigned char buf[10];
nb = read(bd.bd_fd, buf, 10);
debug1("buttonpress_tsi: read %d bytes\n", nb);
for (i = 0, bkeys = 0; i < nb; i++) {
switch (buf[i] & 0xE0) {
case 0x00: bkeys += ((int)(buf[i] & 0x1f)); break;
case 0x20: bkeys += ((int)(buf[i] & 0x1f) << 5); break;
case 0x40: bkeys += ((int)(buf[i] & 0x1f) << 9); break;
case 0x60: bkeys += ((int)(buf[i] & 0x1f) << 13); break;
case 0xA0: bkeys += ((int)(buf[i] & 0x1f) << 18); break;
case 0xC0: bkeys += ((int)(buf[i] & 0x1f) << 22); break;
case 0xE0: bkeys += ((int)(buf[i] & 0x1f) << 26); break;
default: break;
}
}
debug1("bkeys %x\n", bkeys);
for (i = 0; tab[i].key != -1; i++)
if (bkeys == tab[i].key)
break;
debug1("bkey index %d\n", i);
if (tab[i].key != -1 && tab[i].nr != RC_ILLEGAL) {
char *args[3];
int argl[2];
struct action act;
args[0] = tab[i].arg1;
args[1] = tab[i].arg2;
args[2] = 0;
argl[0] = args[0] ? strlen(args[0]) : 0;
argl[1] = args[1] ? strlen(args[1]) : 0;
act.nr = tab[i].nr;
act.args = args;
act.argl = argl;
display = bd.bd_dpy;
DoAction(&act, -2);
}
}
static void
buttonpress_navigator_40()
{
buttonpress_tsi(keys_navigator_40);
}
static void
buttonpress_powerbraille_40()
{
buttonpress_tsi(keys_powerbraille_40);
}
static void
buttonpress_powerbraille_80()
{
buttonpress_tsi(keys_powerbraille_80);
}
#endif /* HAVE_BRAILLE */

918
canvas.c Normal file
View file

@ -0,0 +1,918 @@
/* Copyright (c) 2008, 2009
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Micah Cowan (micah@cowan.name)
* Sadrul Habib Chowdhury (sadrul@users.sourceforge.net)
* Copyright (c) 1993-2002, 2003, 2005, 2006, 2007
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
*
* 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 3, 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 (see the file COPYING); if not, see
* https://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*
****************************************************************
*/
#include "config.h"
#include "screen.h"
#include "extern.h"
#include "canvas.h"
#include "list_generic.h"
extern struct display *display;
extern struct win *fore, *windows;
extern struct layer *flayer;
extern int captionalways;
extern struct LayFuncs BlankLf;
extern int focusminwidth, focusminheight;
static void
CanvasInitBlank(cv)
struct canvas *cv;
{
cv->c_blank.l_cvlist = cv;
cv->c_blank.l_width = cv->c_xe - cv->c_xs + 1;
cv->c_blank.l_height = cv->c_ye - cv->c_ys + 1;
cv->c_blank.l_x = cv->c_blank.l_y = 0;
cv->c_blank.l_layfn = &BlankLf;
cv->c_blank.l_data = 0;
cv->c_blank.l_next = 0;
cv->c_blank.l_bottom = &cv->c_blank;
cv->c_blank.l_blocking = 0;
cv->c_layer = &cv->c_blank;
}
static void
FreePerp(pcv)
struct canvas *pcv;
{
struct canvas *cv;
if (!pcv->c_slperp)
return;
cv = pcv->c_slperp;
cv->c_slprev = pcv->c_slprev;
if (cv->c_slprev)
cv->c_slprev->c_slnext = cv;
cv->c_slback = pcv->c_slback;
if (cv->c_slback && cv->c_slback->c_slperp == pcv)
cv->c_slback->c_slperp = cv;
cv->c_slorient = pcv->c_slorient;
cv->c_slweight = pcv->c_slweight;
while (cv->c_slnext)
{
cv = cv->c_slnext;
cv->c_slorient = pcv->c_slorient;
cv->c_slback = pcv->c_slback;
cv->c_slweight = pcv->c_slweight;
}
cv->c_slnext = pcv->c_slnext;
if (cv->c_slnext)
cv->c_slnext->c_slprev = cv;
LayerCleanupMemory(&pcv->c_blank);
free(pcv);
}
void
FreeCanvas(cv)
struct canvas *cv;
{
struct viewport *vp, *nvp;
struct canvas **cvp;
struct win *p;
if (cv->c_slprev)
cv->c_slprev->c_slnext = cv->c_slnext;
if (cv->c_slnext)
cv->c_slnext->c_slprev = cv->c_slprev;
if (cv->c_slback && cv->c_slback->c_slperp == cv)
cv->c_slback->c_slperp = cv->c_slnext ? cv->c_slnext : cv->c_slprev;
if (cv->c_slperp)
{
while (cv->c_slperp)
FreeCanvas(cv->c_slperp);
LayerCleanupMemory(&cv->c_blank);
free(cv);
return;
}
if (display)
{
if (D_forecv == cv)
D_forecv = 0;
/* remove from canvas chain as SetCanvasWindow might call
* some layer function */
for (cvp = &D_cvlist; *cvp ; cvp = &(*cvp)->c_next)
if (*cvp == cv)
{
*cvp = cv->c_next;
break;
}
}
p = cv->c_layer ? Layer2Window(cv->c_layer) : 0;
SetCanvasWindow(cv, 0);
if (p)
WindowChanged(p, 'u');
if (flayer == cv->c_layer)
flayer = 0;
for (vp = cv->c_vplist; vp; vp = nvp)
{
vp->v_canvas = 0;
nvp = vp->v_next;
vp->v_next = 0;
free(vp);
}
evdeq(&cv->c_captev);
LayerCleanupMemory(&cv->c_blank);
free(cv);
}
int
CountCanvas(cv)
struct canvas *cv;
{
int num = 0;
for (; cv; cv = cv->c_slnext)
{
if (cv->c_slperp)
{
struct canvas *cvp;
int nump = 1, n;
for (cvp = cv->c_slperp; cvp; cvp = cvp->c_slnext)
if (cvp->c_slperp)
{
n = CountCanvas(cvp->c_slperp);
if (n > nump)
nump = n;
}
num += nump;
}
else
num++;
}
return num;
}
int
CountCanvasPerp(cv)
struct canvas *cv;
{
struct canvas *cvp;
int num = 1, n;
for (cvp = cv->c_slperp; cvp; cvp = cvp->c_slnext)
if (cvp->c_slperp)
{
n = CountCanvas(cvp->c_slperp);
if (n > num)
num = n;
}
return num;
}
struct canvas *
FindCanvas(x, y)
int x, y;
{
struct canvas *cv, *mcv = 0;
int m, mm = 0;
for (cv = D_cvlist; cv; cv = cv->c_next)
{
/* ye + 1 because of caption line */
if (x >= cv->c_xs && x <= cv->c_xe && y >= cv->c_ys && y <= cv->c_ye + 1)
return cv;
if (cv == D_forecv)
continue;
m = 0;
if (x >= D_forecv->c_xs && x <= D_forecv->c_xe)
{
if (x < cv->c_xs || x > cv->c_xe)
continue;
if (y < D_forecv->c_ys && y < cv->c_ys)
continue;
if (y > D_forecv->c_ye + 1 && y > cv->c_ye + 1)
continue;
if (y < cv->c_ys)
m = cv->c_ys - y;
if (y > cv->c_ye + 1)
m = y - (cv->c_ye + 1);
}
if (y >= D_forecv->c_ys && y <= D_forecv->c_ye + 1)
{
if (y < cv->c_ys || y > cv->c_ye + 1)
continue;
if (x < D_forecv->c_xs && x < cv->c_xs)
continue;
if (x > D_forecv->c_xe && x > cv->c_xe)
continue;
if (x < cv->c_xs)
m = cv->c_xs - x;
if (x > cv->c_xe)
m = x - cv->c_xe;
}
if (m && (!mm || m < mm))
{
mcv = cv;
mm = m;
}
}
return mcv ? mcv : D_forecv;
}
void
SetCanvasWindow(cv, wi)
struct canvas *cv;
struct win *wi;
{
struct win *p = 0, **pp;
struct layer *l;
struct canvas *cvp, **cvpp;
l = cv->c_layer;
display = cv->c_display;
if (l)
{
/* remove old layer */
for (cvpp = &l->l_cvlist; (cvp = *cvpp); cvpp = &cvp->c_lnext)
if (cvp == cv)
break;
ASSERT(cvp);
*cvpp = cvp->c_lnext;
p = Layer2Window(l);
l = cv->c_layer;
cv->c_layer = 0;
if (p && cv == D_forecv)
{
#ifdef MULTIUSER
ReleaseAutoWritelock(display, p);
#endif
if (p->w_silence)
{
SetTimeout(&p->w_silenceev, p->w_silencewait * 1000);
evenq(&p->w_silenceev);
}
D_other = fore;
D_fore = 0;
}
if (l->l_cvlist == 0 && (p == 0 || l != p->w_savelayer))
KillLayerChain(l);
}
/* find right layer to display on canvas */
if (wi && wi->w_type != W_TYPE_GROUP)
{
l = &wi->w_layer;
if (wi->w_savelayer && (wi->w_blocked || wi->w_savelayer->l_cvlist == 0))
l = wi->w_savelayer;
}
else
{
l = &cv->c_blank;
if (wi)
l->l_data = (char *)wi;
else
l->l_data = 0;
}
/* add our canvas to the layer's canvaslist */
ASSERT(l->l_cvlist != cv);
cv->c_lnext = l->l_cvlist;
l->l_cvlist = cv;
cv->c_layer = l;
cv->c_xoff = cv->c_xs;
cv->c_yoff = cv->c_ys;
RethinkViewportOffsets(cv);
if (flayer == 0)
flayer = l;
if (wi && wi->w_type == W_TYPE_GROUP)
{
/* auto-start windowlist on groups */
struct display *d = display;
struct layer *oldflayer = flayer;
flayer = l;
display_windows(0, 0, wi);
flayer = oldflayer;
display = d;
}
if (wi && D_other == wi)
D_other = wi->w_next; /* Might be 0, but that's OK. */
if (cv == D_forecv)
{
D_fore = wi;
fore = D_fore; /* XXX ? */
if (wi)
{
#ifdef MULTIUSER
ObtainAutoWritelock(display, wi);
#endif
/*
* Place the window at the head of the most-recently-used list
*/
if (windows != wi)
{
for (pp = &windows; (p = *pp); pp = &p->w_next)
if (p == wi)
break;
ASSERT(p);
*pp = p->w_next;
p->w_next = windows;
windows = p;
WListLinkChanged();
}
}
}
}
static void
cv_winid_fn(ev, data)
struct event *ev;
char *data;
{
int ox, oy;
struct canvas *cv = (struct canvas *)data;
display = cv->c_display;
if (D_status == STATUS_ON_WIN)
{
SetTimeout(ev, 1);
evenq(ev);
return;
}
ox = D_x;
oy = D_y;
if (cv->c_ye + 1 < D_height)
RefreshLine(cv->c_ye + 1, 0, D_width - 1, 0);
if (ox != -1 && oy != -1)
GotoPos(ox, oy);
}
int
MakeDefaultCanvas()
{
struct canvas *cv;
ASSERT(display);
if ((cv = (struct canvas *)calloc(1, sizeof *cv)) == 0)
return -1;
cv->c_xs = 0;
cv->c_xe = D_width - 1;
cv->c_ys = (D_has_hstatus == HSTATUS_FIRSTLINE);
cv->c_ye = D_height - 1 - (D_has_hstatus == HSTATUS_LASTLINE) - captionalways;
debug2("MakeDefaultCanvas 0,0 %d,%d\n", cv->c_xe, cv->c_ye);
cv->c_xoff = 0;
cv->c_yoff = 0;
cv->c_next = 0;
cv->c_display = display;
cv->c_vplist = 0;
cv->c_slnext = 0;
cv->c_slprev = 0;
cv->c_slperp = 0;
cv->c_slweight = 1;
cv->c_slback = &D_canvas;
D_canvas.c_slperp = cv;
D_canvas.c_xs = cv->c_xs;
D_canvas.c_xe = cv->c_xe;
D_canvas.c_ys = cv->c_ys;
D_canvas.c_ye = cv->c_ye;
cv->c_slorient = SLICE_UNKN;
cv->c_captev.type = EV_TIMEOUT;
cv->c_captev.data = (char *)cv;
cv->c_captev.handler = cv_winid_fn;
CanvasInitBlank(cv);
cv->c_lnext = 0;
D_cvlist = cv;
RethinkDisplayViewports();
D_forecv = cv; /* default input focus */
return 0;
}
static struct canvas **
CreateCanvasChainRec(cv, cvp)
struct canvas *cv;
struct canvas **cvp;
{
for (; cv; cv = cv->c_slnext)
{
if (cv->c_slperp)
cvp = CreateCanvasChainRec(cv->c_slperp, cvp);
else
{
*cvp = cv;
cvp = &cv->c_next;
}
}
return cvp;
}
void
RecreateCanvasChain()
{
struct canvas **cvp;
cvp = CreateCanvasChainRec(D_canvas.c_slperp, &D_cvlist);
*cvp = 0;
}
void
EqualizeCanvas(cv, gflag)
struct canvas *cv;
int gflag;
{
struct canvas *cv2;
for (; cv; cv = cv->c_slnext)
{
if (cv->c_slperp && gflag)
{
cv->c_slweight = CountCanvasPerp(cv);
for (cv2 = cv->c_slperp; cv2; cv2 = cv2->c_slnext)
if (cv2->c_slperp)
EqualizeCanvas(cv2->c_slperp, gflag);
}
else
cv->c_slweight = 1;
}
}
void
ResizeCanvas(cv)
struct canvas *cv;
{
struct canvas *cv2, *cvn, *fcv;
int nh, i, maxi, hh, m, w, wsum;
int need, got;
int xs, ys, xe, ye;
int focusmin = 0;
xs = cv->c_xs;
ys = cv->c_ys;
xe = cv->c_xe;
ye = cv->c_ye;
cv = cv->c_slperp;
debug2("ResizeCanvas: %d,%d", xs, ys);
debug2(" %d,%d\n", xe, ye);
if (cv == 0)
return;
if (cv->c_slorient == SLICE_UNKN)
{
ASSERT(!cv->c_slnext && !cv->c_slperp);
cv->c_xs = xs;
cv->c_xe = xe;
cv->c_ys = ys;
cv->c_ye = ye;
cv->c_xoff = cv->c_xs;
cv->c_yoff = cv->c_ys;
cv->c_blank.l_width = cv->c_xe - cv->c_xs + 1;
cv->c_blank.l_height = cv->c_ye - cv->c_ys + 1;
return;
}
fcv = 0;
if (focusminwidth || focusminheight)
{
debug("searching for focus canvas\n");
cv2 = D_forecv;
while (cv2->c_slback)
{
if (cv2->c_slback == cv->c_slback)
{
fcv = cv2;
focusmin = cv->c_slorient == SLICE_VERT ? focusminheight : focusminwidth;
if (focusmin > 0)
focusmin--;
else if (focusmin < 0)
focusmin = cv->c_slorient == SLICE_VERT ? ye - ys + 2 : xe - xs + 2;
debug1("found, focusmin=%d\n", focusmin);
}
cv2 = cv2->c_slback;
}
}
if (focusmin)
{
m = CountCanvas(cv) * 2;
nh = cv->c_slorient == SLICE_VERT ? ye - ys + 2 : xe - xs + 2;
nh -= m;
if (nh < 0)
nh = 0;
if (focusmin > nh)
focusmin = nh;
debug1("corrected to %d\n", focusmin);
}
/* pass 1: calculate weight sum */
for (cv2 = cv, wsum = 0; cv2; cv2 = cv2->c_slnext)
{
debug1(" weight %d\n", cv2->c_slweight);
wsum += cv2->c_slweight;
}
debug1("wsum = %d\n", wsum);
if (wsum == 0)
wsum = 1;
w = wsum;
/* pass 2: calculate need/excess space */
nh = cv->c_slorient == SLICE_VERT ? ye - ys + 2 : xe - xs + 2;
for (cv2 = cv, need = got = 0; cv2; cv2 = cv2->c_slnext)
{
m = cv2->c_slperp ? CountCanvasPerp(cv2) * 2 - 1 : 1;
if (cv2 == fcv)
m += focusmin;
hh = cv2->c_slweight ? nh * cv2->c_slweight / w : 0;
w -= cv2->c_slweight;
nh -= hh;
debug2(" should %d min %d\n", hh, m);
if (hh <= m + 1)
need += m + 1 - hh;
else
got += hh - m - 1;
}
debug2("need: %d, got %d\n", need, got);
if (need > got)
need = got;
/* pass 3: distribute space */
nh = cv->c_slorient == SLICE_VERT ? ye - ys + 2 : xe - xs + 2;
i = cv->c_slorient == SLICE_VERT ? ys : xs;
maxi = cv->c_slorient == SLICE_VERT ? ye : xe;
w = wsum;
for (; cv; cv = cvn)
{
cvn = cv->c_slnext;
if (i > maxi)
{
if (cv->c_slprev && !cv->c_slback->c_slback && !cv->c_slprev->c_slperp && !cv->c_slprev->c_slprev)
{
cv->c_slprev->c_slorient = SLICE_UNKN;
if (!captionalways)
{
cv->c_slback->c_ye++;
cv->c_slprev->c_ye++;
}
}
SetCanvasWindow(cv, 0);
FreeCanvas(cv);
continue;
}
m = cv->c_slperp ? CountCanvasPerp(cv) * 2 - 1 : 1;
if (cv == fcv)
m += focusmin;
hh = cv->c_slweight ? nh * cv->c_slweight / w : 0;
w -= cv->c_slweight;
nh -= hh;
debug2(" should %d min %d\n", hh, m);
if (hh <= m + 1)
{
hh = m + 1;
debug1(" -> %d\n", hh);
}
else
{
int hx = 1; //FIXME Division by zero (got) is posible. "hx = 1" is random number here!!!
if (got != 0)
hx = need * (hh - m - 1) / got;
else
debug(" got = 0\n");
debug3(" -> %d - %d = %d\n", hh, hx, hh - hx);
got -= (hh - m - 1);
hh -= hx;
need -= hx;
debug2(" now need=%d got=%d\n", need, got);
}
ASSERT(hh >= m + 1);
/* hh is window size plus pation line */
if (i + hh > maxi + 2)
{
hh = maxi + 2 - i;
debug1(" not enough space, reducing to %d\n", hh);
}
if (i + hh == maxi + 1)
{
hh++;
debug(" incrementing as no other canvas will fit\n");
}
if (cv->c_slorient == SLICE_VERT)
{
cv->c_xs = xs;
cv->c_xe = xe;
cv->c_ys = i;
cv->c_ye = i + hh - 2;
cv->c_xoff = xs;
cv->c_yoff = i;
}
else
{
cv->c_xs = i;
cv->c_xe = i + hh - 2;
cv->c_ys = ys;
cv->c_ye = ye;
cv->c_xoff = i;
cv->c_yoff = ys;
}
cv->c_xoff = cv->c_xs;
cv->c_yoff = cv->c_ys;
cv->c_blank.l_width = cv->c_xe - cv->c_xs + 1;
cv->c_blank.l_height = cv->c_ye - cv->c_ys + 1;
if (cv->c_slperp)
{
ResizeCanvas(cv);
if (!cv->c_slperp->c_slnext)
{
debug("deleting perp node\n");
FreePerp(cv->c_slperp);
FreePerp(cv);
}
}
i += hh;
}
}
static struct canvas *
AddPerp(cv)
struct canvas *cv;
{
struct canvas *pcv;
debug("Creating new perp node\n");
if ((pcv = (struct canvas *)calloc(1, sizeof *cv)) == 0)
return 0;
pcv->c_next = 0;
pcv->c_display = cv->c_display;
pcv->c_slnext = cv->c_slnext;
pcv->c_slprev = cv->c_slprev;
pcv->c_slperp = cv;
pcv->c_slback = cv->c_slback;
if (cv->c_slback && cv->c_slback->c_slperp == cv)
cv->c_slback->c_slperp = pcv;
pcv->c_slorient = cv->c_slorient;
pcv->c_xoff = 0;
pcv->c_yoff = 0;
pcv->c_xs = cv->c_xs;
pcv->c_xe = cv->c_xe;
pcv->c_ys = cv->c_ys;
pcv->c_ye = cv->c_ye;
if (pcv->c_slnext)
pcv->c_slnext->c_slprev = pcv;
if (pcv->c_slprev)
pcv->c_slprev->c_slnext = pcv;
pcv->c_slweight = cv->c_slweight;
CanvasInitBlank(pcv);
cv->c_slweight = 1;
cv->c_slnext = 0;
cv->c_slprev = 0;
cv->c_slperp = 0;
cv->c_slback = pcv;
cv->c_slorient = SLICE_UNKN;
return pcv;
}
int
AddCanvas(orient)
int orient;
{
struct canvas *cv;
int xs, xe, ys, ye;
int h, num;
cv = D_forecv;
debug2("AddCanvas orient %d, forecv is %d\n", orient, cv->c_slorient);
if (cv->c_slorient != SLICE_UNKN && cv->c_slorient != orient)
if (!AddPerp(cv))
return -1;
cv = D_forecv;
xs = cv->c_slback->c_xs;
xe = cv->c_slback->c_xe;
ys = cv->c_slback->c_ys;
ye = cv->c_slback->c_ye;
if (!captionalways && cv == D_canvas.c_slperp && !cv->c_slnext)
ye--; /* need space for caption */
debug2("Adding Canvas to slice %d,%d ", xs, ys);
debug2("%d,%d\n", xe, ye);
num = CountCanvas(cv->c_slback->c_slperp) + 1;
debug1("Num = %d\n", num);
if (orient == SLICE_VERT)
h = ye - ys + 1;
else
h = xe - xs + 1;
h -= 2 * num - 1;
if (h < 0)
return -1; /* can't fit in */
if ((cv = (struct canvas *)calloc(1, sizeof *cv)) == 0)
return -1;
D_forecv->c_slback->c_ye = ye; /* in case we modified it above */
D_forecv->c_slorient = orient; /* in case it was UNKN */
cv->c_slnext = D_forecv->c_slnext;
cv->c_slprev = D_forecv;
D_forecv->c_slnext = cv;
if (cv->c_slnext)
cv->c_slnext->c_slprev = cv;
cv->c_slorient = orient;
cv->c_slback = D_forecv->c_slback;
cv->c_xs = xs;
cv->c_xe = xe;
cv->c_ys = ys;
cv->c_ye = ye;
cv->c_xoff = 0;
cv->c_yoff = 0;
cv->c_display = display;
cv->c_vplist = 0;
cv->c_captev.type = EV_TIMEOUT;
cv->c_captev.data = (char *)cv;
cv->c_captev.handler = cv_winid_fn;
CanvasInitBlank(cv);
cv->c_lnext = 0;
cv->c_next = 0;
cv = cv->c_slback;
EqualizeCanvas(cv->c_slperp, 0);
ResizeCanvas(cv);
RecreateCanvasChain();
RethinkDisplayViewports();
ResizeLayersToCanvases();
return 0;
}
void
RemCanvas()
{
int ye;
struct canvas *cv;
debug("RemCanvas\n");
cv = D_forecv;
ye = cv->c_slback->c_ye;
if (cv->c_slorient == SLICE_UNKN)
return;
while (cv->c_slprev)
cv = cv->c_slprev;
if (!cv->c_slnext)
return;
if (!cv->c_slnext->c_slnext && cv->c_slback->c_slback)
{
/* two canvases in slice, kill perp node */
cv = D_forecv;
debug("deleting perp node\n");
FreePerp(cv->c_slprev ? cv->c_slprev : cv->c_slnext);
FreePerp(cv->c_slback);
}
/* free canvas */
cv = D_forecv;
D_forecv = cv->c_slprev;
if (!D_forecv)
D_forecv = cv->c_slnext;
FreeCanvas(cv);
cv = D_forecv;
while (D_forecv->c_slperp)
D_forecv = D_forecv->c_slperp;
/* if only one canvas left, set orient back to unknown */
if (!cv->c_slnext && !cv->c_slprev && !cv->c_slback->c_slback && !cv->c_slperp)
{
cv->c_slorient = SLICE_UNKN;
if (!captionalways)
cv->c_slback->c_ye = ++ye; /* caption line no longer needed */
}
cv = cv->c_slback;
EqualizeCanvas(cv->c_slperp, 0);
ResizeCanvas(cv);
D_fore = Layer2Window(D_forecv->c_layer);
flayer = D_forecv->c_layer;
RecreateCanvasChain();
RethinkDisplayViewports();
ResizeLayersToCanvases();
}
void
OneCanvas()
{
struct canvas *cv = D_forecv, *ocv = 0;
if (cv->c_slprev)
{
ocv = cv->c_slprev;
cv->c_slprev->c_slnext = cv->c_slnext;
}
if (cv->c_slnext)
{
ocv = cv->c_slnext;
cv->c_slnext->c_slprev = cv->c_slprev;
}
if (!ocv)
return;
if (cv->c_slback && cv->c_slback->c_slperp == cv)
cv->c_slback->c_slperp = ocv;
cv->c_slorient = SLICE_UNKN;
while (D_canvas.c_slperp)
FreeCanvas(D_canvas.c_slperp);
cv = D_forecv;
D_canvas.c_slperp = cv;
cv->c_slback = &D_canvas;
cv->c_slnext = 0;
cv->c_slprev = 0;
ASSERT(!cv->c_slperp);
if (!captionalways)
D_canvas.c_ye++; /* caption line no longer needed */
ResizeCanvas(&D_canvas);
RecreateCanvasChain();
RethinkDisplayViewports();
ResizeLayersToCanvases();
}
void
DupLayoutCv(cvf, cvt, save)
struct canvas *cvf, *cvt;
int save;
{
while(cvf)
{
cvt->c_slorient = cvf->c_slorient;
cvt->c_slweight = cvf->c_slweight;
if (cvf == D_forecv)
D_forecv = cvt;
if (!save)
{
cvt->c_display = display;
if (!cvf->c_slperp)
{
cvt->c_captev.type = EV_TIMEOUT;
cvt->c_captev.data = (char *)cvt;
cvt->c_captev.handler = cv_winid_fn;
cvt->c_blank.l_cvlist = 0;
cvt->c_blank.l_layfn = &BlankLf;
cvt->c_blank.l_bottom = &cvt->c_blank;
}
cvt->c_layer = cvf->c_layer;
}
else
{
struct win *p = cvf->c_layer ? Layer2Window(cvf->c_layer) : 0;
cvt->c_layer = p ? &p->w_layer : 0;
}
if (cvf->c_slperp)
{
cvt->c_slperp = (struct canvas *)calloc(1, sizeof(struct canvas));
cvt->c_slperp->c_slback = cvt;
CanvasInitBlank(cvt->c_slperp);
DupLayoutCv(cvf->c_slperp, cvt->c_slperp, save);
}
if (cvf->c_slnext)
{
cvt->c_slnext = (struct canvas *)calloc(1, sizeof(struct canvas));
cvt->c_slnext->c_slprev = cvt;
cvt->c_slnext->c_slback = cvt->c_slback;
CanvasInitBlank(cvt->c_slnext);
}
cvf = cvf->c_slnext;
cvt = cvt->c_slnext;
}
}
void
PutWindowCv(cv)
struct canvas *cv;
{
struct win *p;
for (; cv; cv = cv->c_slnext)
{
if (cv->c_slperp)
{
PutWindowCv(cv->c_slperp);
continue;
}
p = cv->c_layer ? (struct win *)cv->c_layer->l_data : 0;
cv->c_layer = 0;
SetCanvasWindow(cv, p);
}
}

101
canvas.h Normal file
View file

@ -0,0 +1,101 @@
/* Copyright (c) 2008, 2009
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Micah Cowan (micah@cowan.name)
* Sadrul Habib Chowdhury (sadrul@users.sourceforge.net)
* Copyright (c) 1993-2002, 2003, 2005, 2006, 2007
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
*
* 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 3, 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 (see the file COPYING); if not, see
* https://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*
****************************************************************
* $Id$ GNU
*/
#ifndef SCREEN_CANVAS_H
#define SCREEN_CANVAS_H
#define SLICE_UNKN 0
#define SLICE_VERT (1 << 0)
#define SLICE_HORI (1 << 1)
#define SLICE_THIS (1 << 2) /* used in equal test */
#define SLICE_GLOBAL (1 << 3)
struct canvas
{
struct canvas *c_next; /* next canvas on display */
struct display *c_display; /* back pointer to display */
struct canvas *c_slnext; /* next canvas in display slice */
struct canvas *c_slprev; /* prev canvas in display slice */
struct canvas *c_slperp; /* perpendicular slice */
struct canvas *c_slback; /* perpendicular slice back pointer */
int c_slorient; /* our slice orientation */
int c_slweight; /* size ratio */
struct viewport *c_vplist;
struct layer *c_layer; /* layer on this canvas */
struct canvas *c_lnext; /* next canvas that displays layer */
struct layer c_blank; /* bottom layer, always blank */
int c_xoff; /* canvas x offset on display */
int c_yoff; /* canvas y offset on display */
int c_xs;
int c_xe;
int c_ys;
int c_ye;
struct event c_captev; /* caption changed event */
};
struct win; /* forward declaration */
extern void SetCanvasWindow __P((struct canvas *, struct win *));
extern void SetForeCanvas __P((struct display *, struct canvas *));
extern struct canvas *FindCanvas __P((int, int));
extern int MakeDefaultCanvas __P((void));
extern int AddCanvas __P((int));
extern void RemCanvas __P((void));
extern void OneCanvas __P((void));
extern void FreeCanvas __P((struct canvas *));
extern void ResizeCanvas __P((struct canvas *));
extern void RecreateCanvasChain __P((void));
extern void RethinkViewportOffsets __P((struct canvas *));
extern int CountCanvasPerp __P((struct canvas *));
extern void EqualizeCanvas __P((struct canvas *, int));
extern void DupLayoutCv __P((struct canvas *, struct canvas *, int));
extern void PutWindowCv __P((struct canvas *));
#define CV_CALL(cv, cmd) \
{ \
struct display *olddisplay = display; \
struct layer *oldflayer = flayer; \
struct layer *l = cv->c_layer; \
struct canvas *cvlist = l->l_cvlist; \
struct canvas *cvlnext = cv->c_lnext; \
flayer = l; \
l->l_cvlist = cv; \
cv->c_lnext = 0; \
cmd; \
flayer = oldflayer; \
l->l_cvlist = cvlist; \
cv->c_lnext = cvlnext; \
display = olddisplay; \
}
#endif /* SCREEN_CANVAS_H */

348
comm.c Normal file
View file

@ -0,0 +1,348 @@
/* Copyright (c) 2008, 2009
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Micah Cowan (micah@cowan.name)
* Sadrul Habib Chowdhury (sadrul@users.sourceforge.net)
* Copyright (c) 1993-2002, 2003, 2005, 2006, 2007
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
*
#ifdef HAVE_BRAILLE
* Modified by:
* Authors: Hadi Bargi Rangin bargi@dots.physics.orst.edu
* Bill Barry barryb@dots.physics.orst.edu
*
* Modifications Copyright (c) 1995 by
* Science Access Project, Oregon State University.
#endif
*
* 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 3, 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 (see the file COPYING); if not, see
* https://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*
****************************************************************
*/
#include "config.h"
#include "os.h"
#include "acls.h"
#include "comm.h"
#define bcopy :-( /* or include screen.h here */
/* Must be in alpha order ! */
struct comm comms[RC_LAST + 1] =
{
#ifdef MULTIUSER
{ "acladd", ARGS_1234 },
{ "aclchg", ARGS_23 },
{ "acldel", ARGS_1 },
{ "aclgrp", ARGS_12 },
{ "aclumask", ARGS_1|ARGS_ORMORE },
#endif
{ "activity", ARGS_1 },
#ifdef MULTIUSER
{ "addacl", ARGS_1234 },
#endif
{ "allpartial", NEED_DISPLAY|ARGS_1 },
{ "altscreen", ARGS_01 },
{ "at", ARGS_2|ARGS_ORMORE },
#ifdef COLOR
{ "attrcolor", ARGS_12 },
#endif
{ "autodetach", ARGS_1 },
#ifdef AUTO_NUKE
{ "autonuke", NEED_DISPLAY|ARGS_1 },
#endif
{ "backtick", ARGS_1|ARGS_ORMORE },
#ifdef COLOR
{ "bce", NEED_FORE|ARGS_01 },
#endif
#ifdef HAVE_BRAILLE
/* keywords for braille display (bd) */
{ "bd_bc_down", ARGS_0 },
{ "bd_bc_left", ARGS_0 },
{ "bd_bc_right", ARGS_0 },
{ "bd_bc_up", ARGS_0 },
{ "bd_bell", ARGS_01 },
{ "bd_braille_table", ARGS_01 },
{ "bd_eightdot", ARGS_01 },
{ "bd_info", ARGS_01 },
{ "bd_link", ARGS_01 },
{ "bd_lower_left", ARGS_0 },
{ "bd_lower_right", ARGS_0 },
{ "bd_ncrc", ARGS_01 },
{ "bd_port", ARGS_01 },
{ "bd_scroll", ARGS_01 },
{ "bd_skip", ARGS_01 },
{ "bd_start_braille", ARGS_01 },
{ "bd_type", ARGS_01 },
{ "bd_upper_left", ARGS_0 },
{ "bd_upper_right", ARGS_0 },
{ "bd_width", ARGS_01 },
#endif
{ "bell", ARGS_01 },
{ "bell_msg", ARGS_01 },
{ "bind", ARGS_1|ARGS_ORMORE },
#ifdef MAPKEYS
{ "bindkey", ARGS_0|ARGS_ORMORE },
#endif
{ "blanker", NEED_DISPLAY|ARGS_0},
#ifdef BLANKER_PRG
{ "blankerprg", ARGS_0|ARGS_ORMORE },
#endif
{ "break", NEED_FORE|ARGS_01 },
{ "breaktype", NEED_FORE|ARGS_01 },
#ifdef COPY_PASTE
{ "bufferfile", ARGS_01 },
#endif
{ "bumpleft", NEED_FORE|ARGS_0 },
{ "bumpright", NEED_FORE|ARGS_0 },
{ "c1", NEED_FORE|ARGS_01 },
{ "caption", ARGS_12 },
#ifdef MULTIUSER
{ "chacl", ARGS_23 },
#endif
{ "charset", NEED_FORE|ARGS_1 },
{ "chdir", ARGS_01 },
#ifdef DW_CHARS
{ "cjkwidth", ARGS_01 },
#endif
{ "clear", NEED_FORE|ARGS_0 },
{ "collapse", ARGS_0 },
{ "colon", NEED_LAYER|ARGS_01 },
{ "command", NEED_DISPLAY|ARGS_02 },
#ifdef COPY_PASTE
{ "compacthist", ARGS_01 },
#endif
{ "console", NEED_FORE|ARGS_01 },
#ifdef COPY_PASTE
{ "copy", NEED_FORE|NEED_DISPLAY|ARGS_0 },
{ "crlf", ARGS_01 },
#endif
{ "debug", ARGS_01 },
#ifdef AUTO_NUKE
{ "defautonuke", ARGS_1 },
#endif
#ifdef COLOR
{ "defbce", ARGS_1 },
#endif
{ "defbreaktype", ARGS_01 },
{ "defc1", ARGS_1 },
{ "defcharset", ARGS_01 },
{ "defdynamictitle", ARGS_1 },
#ifdef ENCODINGS
{ "defencoding", ARGS_1 },
#endif
{ "defescape", ARGS_1 },
{ "defflow", ARGS_12 },
{ "defgr", ARGS_1 },
{ "defhstatus", ARGS_01 },
#ifdef ENCODINGS
{ "defkanji", ARGS_1 },
#endif
{ "deflog", ARGS_1 },
#if defined(UTMPOK) && defined(LOGOUTOK)
{ "deflogin", ARGS_1 },
#endif
{ "defmode", ARGS_1 },
{ "defmonitor", ARGS_1 },
{ "defmousetrack", ARGS_1 },
#ifdef MULTI
{ "defnonblock", ARGS_1 },
#endif
{ "defobuflimit", ARGS_1 },
#ifdef COPY_PASTE
{ "defscrollback", ARGS_1 },
#endif
{ "defshell", ARGS_1 },
{ "defsilence", ARGS_1 },
{ "defslowpaste", ARGS_1 },
#ifdef UTF8
{ "defutf8", ARGS_1 },
#endif
{ "defwrap", ARGS_1 },
{ "defwritelock", ARGS_1 },
#ifdef DETACH
{ "detach", NEED_DISPLAY|ARGS_01 },
#endif
{ "digraph", NEED_LAYER|ARGS_012 },
{ "dinfo", NEED_DISPLAY|ARGS_0 },
{ "displays", NEED_LAYER|ARGS_0 },
{ "dumptermcap", NEED_FORE|ARGS_0 },
{ "dynamictitle", ARGS_1 },
{ "echo", CAN_QUERY|ARGS_12 },
#ifdef ENCODINGS
{ "encoding", ARGS_12 },
#endif
{ "escape", ARGS_1 },
{ "eval", ARGS_1|ARGS_ORMORE },
#ifdef PSEUDOS
{ "exec", ARGS_0|ARGS_ORMORE },
#endif
{ "fit", NEED_DISPLAY|ARGS_0 },
{ "flow", NEED_FORE|ARGS_01 },
{ "focus", NEED_DISPLAY|ARGS_01 },
{ "focusminsize", ARGS_02 },
{ "gr", NEED_FORE|ARGS_01 },
{ "group", NEED_FORE|ARGS_01 },
{ "hardcopy", NEED_FORE|ARGS_012 },
{ "hardcopy_append", ARGS_1 },
{ "hardcopydir", ARGS_01 },
{ "hardstatus", ARGS_012 },
{ "height", ARGS_0123 },
{ "help", NEED_LAYER|ARGS_02 },
#ifdef COPY_PASTE
{ "history", NEED_DISPLAY|NEED_FORE|ARGS_0 },
#endif
{ "hstatus", NEED_FORE|ARGS_1 },
{ "idle", ARGS_0|ARGS_ORMORE },
{ "ignorecase", ARGS_01 },
{ "info", CAN_QUERY|NEED_LAYER|ARGS_0 },
#ifdef ENCODINGS
{ "kanji", NEED_FORE|ARGS_12 },
#endif
{ "kill", NEED_FORE|ARGS_0 },
{ "lastmsg", CAN_QUERY|NEED_DISPLAY|ARGS_0 },
{ "layout", ARGS_1|ARGS_ORMORE},
{ "license", NEED_LAYER|ARGS_0 },
#ifdef LOCK
{ "lockscreen", NEED_DISPLAY|ARGS_0 },
#endif
{ "log", NEED_FORE|ARGS_01 },
{ "logfile", ARGS_012 },
#if defined(UTMPOK) && defined(LOGOUTOK)
{ "login", NEED_FORE|ARGS_01 },
#endif
{ "logtstamp", ARGS_012 },
#ifdef MAPKEYS
{ "mapdefault", NEED_DISPLAY|ARGS_0 },
{ "mapnotnext", NEED_DISPLAY|ARGS_0 },
{ "maptimeout", ARGS_01 },
#endif
#ifdef COPY_PASTE
{ "markkeys", ARGS_1 },
#endif
{ "maxwin", ARGS_01 },
{ "meta", NEED_LAYER|ARGS_0 },
{ "monitor", NEED_FORE|ARGS_01 },
{ "mousetrack", NEED_DISPLAY | ARGS_01 },
{ "msgminwait", ARGS_1 },
{ "msgwait", ARGS_1 },
#ifdef MULTIUSER
{ "multiuser", ARGS_1 },
#endif
{ "nethack", ARGS_1 },
{ "next", ARGS_0 },
#ifdef MULTI
{ "nonblock", NEED_DISPLAY|ARGS_01 },
#endif
{ "number", CAN_QUERY|NEED_FORE|ARGS_01 },
{ "obuflimit", NEED_DISPLAY|ARGS_01 },
{ "only", NEED_DISPLAY|ARGS_0 },
{ "other", ARGS_0 },
{ "partial", NEED_FORE|ARGS_01 },
#ifdef PASSWORD
{ "password", ARGS_01 },
#endif
#ifdef COPY_PASTE
{ "paste", NEED_LAYER|ARGS_012 },
{ "pastefont", ARGS_01 },
#endif
{ "pow_break", NEED_FORE|ARGS_01 },
#if defined(DETACH) && defined(POW_DETACH)
{ "pow_detach", NEED_DISPLAY|ARGS_0 },
{ "pow_detach_msg", ARGS_01 },
#endif
{ "prev", ARGS_0 },
{ "printcmd", ARGS_01 },
{ "process", NEED_DISPLAY|ARGS_01 },
{ "quit", ARGS_0 },
#ifdef COPY_PASTE
{ "readbuf", ARGS_0123 },
#endif
{ "readreg", ARGS_0|ARGS_ORMORE },
{ "redisplay", NEED_DISPLAY|ARGS_0 },
{ "register", ARGS_24 },
{ "remove", NEED_DISPLAY|ARGS_0 },
#ifdef COPY_PASTE
{ "removebuf", ARGS_0 },
#endif
{ "rendition", ARGS_23 },
{ "reset", NEED_FORE|ARGS_0 },
{ "resize", NEED_DISPLAY|ARGS_0|ARGS_ORMORE },
{ "screen", ARGS_0|ARGS_ORMORE },
#ifdef COPY_PASTE
{ "scrollback", NEED_FORE|ARGS_1 },
#endif
{ "select", CAN_QUERY|ARGS_01 },
{ "sessionname", ARGS_01 },
{ "setenv", ARGS_012 },
{ "setsid", ARGS_1 },
{ "shell", ARGS_1 },
{ "shelltitle", ARGS_1 },
{ "silence", NEED_FORE|ARGS_01 },
{ "silencewait", ARGS_1 },
{ "sleep", ARGS_1 },
{ "slowpaste", NEED_FORE|ARGS_01 },
{ "sorendition", ARGS_012 },
{ "sort", ARGS_0},
{ "source", ARGS_1 },
{ "split", NEED_DISPLAY|ARGS_01 },
{ "startup_message", ARGS_1 },
{ "stuff", NEED_LAYER|ARGS_012 },
#ifdef MULTIUSER
{ "su", NEED_DISPLAY|ARGS_012 },
#endif
#ifdef BSDJOBS
{ "suspend", NEED_DISPLAY|ARGS_0 },
#endif
{ "term", ARGS_1 },
{ "termcap", ARGS_23 },
{ "termcapinfo", ARGS_23 },
{ "terminfo", ARGS_23 },
{ "time", CAN_QUERY|ARGS_01 },
{ "title", CAN_QUERY|NEED_FORE|ARGS_01 },
{ "umask", ARGS_1|ARGS_ORMORE },
{ "unbindall", ARGS_0 },
{ "unsetenv", ARGS_1 },
#ifdef UTF8
{ "utf8", NEED_FORE|ARGS_012 },
#endif
{ "vbell", ARGS_01 },
{ "vbell_msg", ARGS_01 },
{ "vbellwait", ARGS_1 },
{ "verbose", ARGS_01 },
{ "version", ARGS_0 },
{ "wall", NEED_DISPLAY|ARGS_1},
{ "width", ARGS_0123 },
{ "windowlist", ARGS_012 },
{ "windows", CAN_QUERY|ARGS_01 },
{ "wrap", NEED_FORE|ARGS_01 },
#ifdef COPY_PASTE
{ "writebuf", ARGS_0123 },
#endif
{ "writelock", NEED_FORE|ARGS_01 },
{ "xoff", NEED_LAYER|ARGS_0 },
{ "xon", NEED_LAYER|ARGS_0 },
#ifdef ZMODEM
{ "zmodem", ARGS_012 },
#endif
{ "zombie", ARGS_012 },
{ "zombie_timeout", ARGS_1 }
};

96
comm.sh Normal file
View file

@ -0,0 +1,96 @@
#! /bin/sh
if test -z "$AWK"; then
AWK=awk
fi
if test -z "$CC"; then
CC=cc
fi
if test -z "$srcdir"; then
srcdir=.
fi
LC_ALL=C
export LC_ALL
rm -f comm.h
cat << EOF > comm.h
/*
* This file is automagically created from comm.c -- DO NOT EDIT
*/
struct comm
{
char *name;
int flags;
#ifdef MULTIUSER
AclBits userbits[ACL_BITS_PER_CMD];
#endif
};
#define ARGS_MASK (3)
#define ARGS_0 (0)
#define ARGS_1 (1)
#define ARGS_2 (2)
#define ARGS_3 (3)
#define ARGS_PLUS1 (1<<2)
#define ARGS_PLUS2 (1<<3)
#define ARGS_PLUS3 (1<<4)
#define ARGS_ORMORE (1<<5)
#define NEED_FORE (1<<6) /* this command needs a fore window */
#define NEED_DISPLAY (1<<7) /* this command needs a display */
#define NEED_LAYER (1<<8) /* this command needs a layer */
#define CAN_QUERY (1<<9) /* this command can be queried, i.e. used with -Q to
get back a result to stdout */
#define ARGS_01 (ARGS_0 | ARGS_PLUS1)
#define ARGS_02 (ARGS_0 | ARGS_PLUS2)
#define ARGS_12 (ARGS_1 | ARGS_PLUS1)
#define ARGS_23 (ARGS_2 | ARGS_PLUS1)
#define ARGS_24 (ARGS_2 | ARGS_PLUS2)
#define ARGS_34 (ARGS_3 | ARGS_PLUS1)
#define ARGS_012 (ARGS_0 | ARGS_PLUS1 | ARGS_PLUS2)
#define ARGS_0123 (ARGS_0 | ARGS_PLUS1 | ARGS_PLUS2 | ARGS_PLUS3)
#define ARGS_123 (ARGS_1 | ARGS_PLUS1 | ARGS_PLUS2)
#define ARGS_124 (ARGS_1 | ARGS_PLUS1 | ARGS_PLUS3)
#define ARGS_1234 (ARGS_1 | ARGS_PLUS1 | ARGS_PLUS2 | ARGS_PLUS3)
struct action
{
int nr;
char **args;
int *argl;
int quiet; /* Suppress (currently unused)
0x01 - Error message
0x02 - Normal message
*/
};
#define RC_ILLEGAL -1
EOF
$AWK < ${srcdir}/comm.c >> comm.h '
/^ [{] ".*/ { if (old > $2) {
printf("***ERROR: %s <= %s !!!\n\n", $2, old);
exit 1;
}
old = $2;
}
'
$CC -E -I. -I${srcdir} ${srcdir}/comm.c > comm.cpp
sed < comm.cpp \
-n \
-e '/^ *{ "/y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \
-e '/^ *{ "/s/^ *{ "\([^"]*\)".*/\1/p' \
| $AWK '
/.*/ { printf "#define RC_%s %d\n",$0,i++;
}
END { printf "\n#define RC_LAST %d\n",i-1;
}
' >> comm.h
chmod a-w comm.h
rm -f comm.cpp

784
config.h.in Normal file
View file

@ -0,0 +1,784 @@
/* config.h.in. Generated from configure.ac by autoheader. */
/* Copyright (c) 1993-2000
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
*
* 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 3, 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 (see the file COPYING); if not, see
* https://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*
****************************************************************
* $Id$ GNU
*/
/**********************************************************************
*
* User Configuration Section
*/
/*
* Maximum of simultaneously allowed windows per screen session.
*/
#ifndef MAXWIN
# define MAXWIN 100
#endif
/*
* Define SOCKDIR to be the directory to contain the named sockets
* screen creates. This should be in a common subdirectory, such as
* /usr/local or /tmp. It makes things a little more secure if you
* choose a directory which is not writable by everyone or where the
* "sticky" bit is on, but this isn't required.
* If SOCKDIR is not defined screen will put the named sockets in
* the user's home directory. Notice that this can cause you problems
* if some user's HOME directories are AFS- or NFS-mounted. Especially
* AFS is unlikely to support named sockets.
*
* Screen will name the subdirectories "S-$USER" (e.g /tmp/S-davison).
*/
#undef SOCKDIR
/*
* Define this if the SOCKDIR is not shared between hosts.
*/
#define SOCKDIR_IS_LOCAL_TO_HOST
/*
* Screen can look for the environment variable $SYSSCREENRC and -if it
* exists- load the file specified in that variable as global screenrc.
* If you want to enable this feature, define ALLOW_SYSSCREENRC to one (1).
* Otherwise ETCSCREENRC is always loaded.
*/
#define ALLOW_SYSSCREENRC 1
/*
* Define CHECKLOGIN to force Screen users to enter their Unix password
* in addition to the screen password.
*
* Define NOSYSLOG if yo do not have logging facilities. Currently
* syslog() will be used to trace ``su'' commands only.
*/
#define CHECKLOGIN 1
#undef NOSYSLOG
/*
* define PTYMODE if you do not like the default of 0622, which allows
* public write to your pty.
* define PTYGROUP to some numerical group-id if you do not want the
* tty to be in "your" group.
* Note, screen is unable to change mode or group of the pty if it
* is not installed with sufficient privilege. (e.g. set-uid-root)
* define PTYROFS if the /dev/pty devices are mounted on a read-only
* filesystem so screen should not even attempt to set mode or group
* even if running as root (e.g. on TiVo).
*/
#undef PTYMODE
#undef PTYGROUP
#undef PTYROFS
/*
* If screen is NOT installed set-uid root, screen can provide tty
* security by exclusively locking the ptys. While this keeps other
* users from opening your ptys, it also keeps your own subprocesses
* from being able to open /dev/tty. Define LOCKPTY to add this
* exclusive locking.
*/
#undef LOCKPTY
/*
* If you'd rather see the status line on the first line of your
* terminal rather than the last, define TOPSTAT.
*/
#undef TOPSTAT
/*
* define DETACH can detach a session. An absolute 'must'.
*/
#define DETACH
/*
* here come the erlangen extensions to screen:
* define LOCK if you want to use a lock program for a screenlock.
* define PASSWORD for secure reattach of your screen.
* define COPY_PASTE to use the famous hacker's treasure zoo.
* define POW_DETACH to have a detach_and_logout key (requires DETACH).
* define REMOTE_DETACH (-d option) to move screen between terminals.
* define AUTO_NUKE to enable Tim MacKenzies clear screen nuking
* define PSEUDOS to allow window input/output filtering
* define MULTI to allow multiple attaches.
* define MULTIUSER to allow other users attach to your session
* (if they are in the acl, of course)
* define MAPKEYS to include input keyboard translation.
* define FONT to support ISO2022/alternet charset support
* define COLOR to include ansi color support. This may expose
* a bug in x11r6-color-xterm.
* define DW_CHARS to include support for double-width character
* sets.
* define ENCODINGS to include support for encodings like euc or big5.
* Needs FONT to work.
* define UTF8 if you want support for UTF-8 encoding.
* Needs FONT and ENCODINGS to work.
* define COLORS16 if you want 16 colors.
* Needs COLOR to work.
* define BUILTIN_TELNET to add telnet support to screen.
* Syntax: screen //telnet host [port]
* define RXVT_OSC if you want support for rxvts special
* change fgcolor/bgcolor/bgpicture sequences
*/
#undef SIMPLESCREEN
#ifndef SIMPLESCREEN
# define LOCK
# define PASSWORD
# define COPY_PASTE
# define REMOTE_DETACH
# define POW_DETACH
# define AUTO_NUKE
# define PSEUDOS
# define MULTI
# define MULTIUSER
# define MAPKEYS
# define COLOR
# define FONT
# define DW_CHARS
# define ENCODINGS
# define UTF8
# define COLORS16
# define ZMODEM
# define BLANKER_PRG
#endif /* SIMPLESCREEN */
#undef BUILTIN_TELNET
#undef RXVT_OSC
#undef COLORS256
/*
* If you have a braille display you should define HAVE_BRAILLE.
* The code inside #ifdef HAVE_BRAILLE was contributed by Hadi Bargi
* Rangin (bargi@dots.physics.orst.edu).
* WARNING: this is more or less unsupported code, it may be full of
* bugs leading to security holes, enable at your own risk!
*/
#undef HAVE_BRAILLE
/*
* As error messages are mostly meaningless to the user, we
* try to throw out phrases that are somewhat more familiar
* to ...well, at least familiar to us NetHack players.
*/
#ifndef NONETHACK
# define NETHACK
#endif /* NONETHACK */
/*
* If screen is installed with permissions to update /etc/utmp (such
* as if it is installed set-uid root), define UTMPOK.
*/
#define UTMPOK
/* Set LOGINDEFAULT to one (1)
* if you want entries added to /etc/utmp by default, else set it to
* zero (0).
* LOGINDEFAULT will be one (1) whenever LOGOUTOK is undefined!
*/
#define LOGINDEFAULT 1
/* Set LOGOUTOK to one (1)
* if you want the user to be able to log her/his windows out.
* (Meaning: They are there, but not visible in /etc/utmp).
* Disabling this feature only makes sense if you have a secure /etc/utmp
* database.
* Negative examples: suns usually have a world writable utmp file,
* xterm will run perfectly without s-bit.
*
* If LOGOUTOK is undefined and UTMPOK is defined, all windows are
* initially and permanently logged in.
*
* Set CAREFULUTMP to one (1) if you want that users have at least one
* window per screen session logged in.
*/
#define LOGOUTOK 1
#undef CAREFULUTMP
/*
* If UTMPOK is defined and your system (incorrectly) counts logins by
* counting non-null entries in /etc/utmp (instead of counting non-null
* entries with no hostname that are not on a pseudo tty), define USRLIMIT
* to have screen put an upper-limit on the number of entries to write
* into /etc/utmp. This helps to keep you from exceeding a limited-user
* license.
*/
#undef USRLIMIT
/*
* both must be defined if you want to favor tcsendbreak over
* other calls to generate a break condition on serial lines.
* (Do not bother, if you are not using plain tty windows.)
*/
#define POSIX_HAS_A_GOOD_TCSENDBREAK
#define SUNOS4_AND_WE_TRUST_TCSENDBREAK
/*
* to lower the interrupt load on the host machine, you may want to
* adjust the VMIN and VTIME settings used for plain tty windows.
* See the termio(4) manual page (Non-Canonical Mode Input Processing)
* for details.
* if undefined, VMIN=1, VTIME=0 is used as a default - this gives you
* best user responsiveness, but highest interrupt frequency.
* (Do not bother, if you are not using plain tty windows.)
*/
#define TTYVMIN 100
#define TTYVTIME 2
/*
* looks like the above values are ignored by setting FNDELAY.
* This is default for all pty/ttys, you may disable it for
* ttys here. After playing with it for a while, one may find out
* that this feature may cause screen to lock up.
*/
#ifdef bsdi
# define TTY_DISABLE_FNBLOCK /* select barfs without it ... */
#endif
/*
* Some terminals, e.g. Wyse 120, use a bitfield to select attributes.
* This doesn't work with the standard so/ul/m? terminal entries,
* because they will cancel each other out.
* On TERMINFO machines, "sa" (sgr) may work. If you want screen
* to switch attributes only with sgr, define USE_SGR.
* This is *not* recomended, do this only if you must.
*/
#undef USE_SGR
/*
* Define USE_LOCALE if you want screen to use the locale names
* for the name of the month and day of the week.
*/
#undef USE_LOCALE
/*
* Define USE_PAM if your system supports PAM (Pluggable Authentication
* Modules) and you want screen to use it instead of calling crypt().
* (You may also need to add -lpam to LIBS in the Makefile.)
*/
#undef USE_PAM
/*
* Define CHECK_SCREEN_W if you want screen to set TERM to screen-w
* if the terminal width is greater than 131 columns. No longer needed
* on modern systems which use $COLUMNS or the tty settings instead.
*/
#undef CHECK_SCREEN_W
/**********************************************************************
*
* End of User Configuration Section
*
* Rest of this file is modified by 'configure'
* Change at your own risk!
*
*/
/*
* Some defines to identify special unix variants
*/
#ifndef SVR4
#undef SVR4
#endif
/* #ifndef __osf__ */
#ifndef MIPS
#undef MIPS
#endif
/* #endif */
#ifndef OSX
#undef OSX
#endif
#ifndef ISC
#undef ISC
#endif
#ifndef sysV68
#undef sysV68
#endif
#ifndef _POSIX_SOURCE
#undef _POSIX_SOURCE
#endif
/*
* Define POSIX if your system supports IEEE Std 1003.1-1988 (POSIX).
*/
#undef POSIX
/*
* Define BSDJOBS if you have BSD-style job control (both process
* groups and a tty that deals correctly with them).
*/
#undef BSDJOBS
/*
* Define TERMIO if you have struct termio instead of struct sgttyb.
* This is usually the case for SVID systems, where BSD uses sgttyb.
* POSIX systems should define this anyway, even though they use
* struct termios.
*/
#undef TERMIO
/*
* Define CYTERMIO if you have cyrillic termio modes.
*/
#undef CYTERMIO
/*
* Define TERMINFO if your machine emulates the termcap routines
* with the terminfo database.
* Thus the .screenrc file is parsed for
* the command 'terminfo' and not 'termcap'.
*/
#undef TERMINFO
/*
* If your library does not define ospeed, define this.
*/
#undef NEED_OSPEED
/*
* Define SYSV if your machine is SYSV complient (Sys V, HPUX, A/UX)
*/
#ifndef SYSV
#undef SYSV
#endif
/*
* Define SIGVOID if your signal handlers return void. On older
* systems, signal returns int, but on newer ones, it returns void.
*/
#undef SIGVOID
/*
* Define USESIGSET if you have sigset for BSD 4.1 reliable signals.
*/
#undef USESIGSET
/*
* Define SYSVSIGS if signal handlers must be reinstalled after
* they have been called.
*/
#undef SYSVSIGS
/*
* Define BSDWAIT if your system defines a 'union wait' in <sys/wait.h>
*
* Only allow BSDWAIT i.e. wait3 on nonposix systems, since
* posix implies wait(3) and waitpid(3). vdlinden@fwi.uva.nl
*
*/
#ifndef POSIX
#undef BSDWAIT
#endif
/*
* On RISCOS we prefer wait2() over wait3(). rouilj@sni-usa.com
*/
#ifdef BSDWAIT
#undef USE_WAIT2
#endif
/*
* If your system has getutent(), pututline(), etc. to write to the
* utmp file, define GETUTENT.
*/
#undef GETUTENT
/*
* Define UTHOST if the utmp file has a host field.
*/
#undef UTHOST
/*
* Define if you have the utempter utmp helper program
*/
#undef HAVE_UTEMPTER
/*
* If ttyslot() breaks getlogin() by returning indexes to utmp entries
* of type DEAD_PROCESS, then our getlogin() replacement should be
* selected by defining BUGGYGETLOGIN.
*/
#undef BUGGYGETLOGIN
/*
* If your system has the calls setreuid() and setregid(),
* define HAVE_SETREUID. Otherwise screen will use a forked process to
* safely create output files without retaining any special privileges.
*/
#undef HAVE_SETRESUID
#undef HAVE_SETREUID
/*
* If your system supports BSD4.4's seteuid() and setegid(), define
* HAVE_SETEUID.
*/
#undef HAVE_SETEUID
/*
* execvpe is now defined in some systems.
*/
#undef HAVE_EXECVPE
/*
* If you want the "time" command to display the current load average
* define LOADAV. Maybe you must install screen with the needed
* privileges to read /dev/kmem.
* Note that NLIST_ stuff is only checked, when getloadavg() is not available.
*/
#undef LOADAV
#undef LOADAV_NUM
#undef LOADAV_TYPE
#undef LOADAV_SCALE
#undef LOADAV_GETLOADAVG
#undef LOADAV_UNIX
#undef LOADAV_AVENRUN
#undef LOADAV_USE_NLIST64
#undef NLIST_DECLARED
#undef NLIST_STRUCT
#undef NLIST_NAME_UNION
/*
* If your system has the new format /etc/ttys (like 4.3 BSD) and the
* getttyent(3) library functions, define GETTTYENT.
*/
#undef GETTTYENT
/*
* Define USEBCOPY if the bcopy/memcpy from your system's C library
* supports the overlapping of source and destination blocks. When
* undefined, screen uses its own (probably slower) version of bcopy().
*
* SYSV machines may have a working memcpy() -- Oh, this is
* quite unlikely. Tell me if you see one.
* "But then, memmove() should work, if at all available" he thought...
* Boing, never say "works everywhere" unless you checked SCO UNIX.
* Their memove fails the test in the configure script. Sigh. (Juergen)
*/
#undef USEBCOPY
#undef USEMEMCPY
#undef USEMEMMOVE
/*
* If your system has vsprintf() and requires the use of the macros in
* "varargs.h" to use functions with variable arguments,
* define USEVARARGS.
*/
#undef USEVARARGS
/*
* If the select return value doesn't treat a descriptor that is
* usable for reading and writing as two hits, define SELECT_BROKEN.
*/
#undef SELECT_BROKEN
/*
* Define this if your system exits select() immediatly if a pipe is
* opened read-only and no writer has opened it.
*/
#undef BROKEN_PIPE
/*
* Define this if the unix-domain socket implementation doesn't
* create a socket in the filesystem.
*/
#undef SOCK_NOT_IN_FS
/*
* If your system has setenv() and unsetenv() define USESETENV
*/
#undef USESETENV
/*
* If setenv() takes 3 arguments define HAVE_SETENV_3
*/
#undef HAVE_SETENV_3
/*
* If setenv() takes 2 arguments define HAVE_SETENV_2
*/
#undef HAVE_SETENV_2
/*
* If your system does not come with a setenv()/putenv()/getenv()
* functions, you may bring in our own code by defining NEEDPUTENV.
*/
#undef NEEDPUTENV
/*
* If the passwords are stored in a shadow file and you want the
* builtin lock to work properly, define SHADOWPW.
*/
#undef SHADOWPW
/*
* define HAVE_NL_LANGINFO if your system has the nl_langinfo() call
* and <langinfo.h> defines CODESET.
*/
#undef HAVE_NL_LANGINFO
/*
* Newer versions of Solaris include fdwalk, which can greatly improve
* the startup time of screen; otherwise screen spends a lot of time
* closing file descriptors.
*/
#undef HAVE_FDWALK
/*
* define HAVE_DEV_PTC if you have a /dev/ptc character special
* device.
*/
#undef HAVE_DEV_PTC
/*
* define HAVE_SVR4_PTYS if you have a /dev/ptmx character special
* device and support the ptsname(), grantpt(), unlockpt() functions.
*/
#undef HAVE_SVR4_PTYS
/*
* define PTYRANGE0 and or PTYRANGE1 if you want to adapt screen
* to unusual environments. E.g. For SunOs the defaults are "qpr" and
* "0123456789abcdef". For SunOs 4.1.2
* #define PTYRANGE0 "pqrstuvwxyzPQRST"
* is recommended by Dan Jacobson.
*/
#undef PTYRANGE0
#undef PTYRANGE1
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
*/
#undef HAVE_DIRENT_H
/* Define to 1 if you have the `fchmod' function. */
#undef HAVE_FCHMOD
/* Define to 1 if you have the `fchown' function. */
#undef HAVE_FCHOWN
/* Define to 1 if you have the `getcwd' function. */
#undef HAVE_GETCWD
/* Define to 1 if you have the `getpt' function. */
#undef HAVE_GETPT
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you support file names longer than 14 characters. */
#undef HAVE_LONG_FILE_NAMES
/* Define to 1 if you have the `lstat' function. */
#undef HAVE_LSTAT
/* Define to 1 if you have the <minix/config.h> header file. */
#undef HAVE_MINIX_CONFIG_H
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
#undef HAVE_NDIR_H
/* Define to 1 if you have the `openpty' function. */
#undef HAVE_OPENPTY
/* Define to 1 if you have the `rename' function. */
#undef HAVE_RENAME
/* Define to 1 if you have the `setlocale' function. */
#undef HAVE_SETLOCALE
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdio.h> header file. */
#undef HAVE_STDIO_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the `strerror' function. */
#undef HAVE_STRERROR
/* Define to 1 if you have the `strftime' function. */
#undef HAVE_STRFTIME
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the <stropts.h> header file. */
#undef HAVE_STROPTS_H
/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
*/
#undef HAVE_SYS_DIR_H
/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
*/
#undef HAVE_SYS_NDIR_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to 1 if you have the `utimes' function. */
#undef HAVE_UTIMES
/* Define to 1 if you have the `vsnprintf' function. */
#undef HAVE_VSNPRINTF
/* Define to 1 if you have the <wchar.h> header file. */
#undef HAVE_WCHAR_H
/* Define to 1 if you have the `_exit' function. */
#undef HAVE__EXIT
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to 1 if all of the C90 standard headers exist (not just the ones
required in a freestanding environment). This macro is provided for
backward compatibility; new code need not use it. */
#undef STDC_HEADERS
/* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
#endif
/* Enable general extensions on macOS. */
#ifndef _DARWIN_C_SOURCE
# undef _DARWIN_C_SOURCE
#endif
/* Enable general extensions on Solaris. */
#ifndef __EXTENSIONS__
# undef __EXTENSIONS__
#endif
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# undef _GNU_SOURCE
#endif
/* Enable X/Open compliant socket functions that do not require linking
with -lxnet on HP-UX 11.11. */
#ifndef _HPUX_ALT_XOPEN_SOCKET_API
# undef _HPUX_ALT_XOPEN_SOCKET_API
#endif
/* Identify the host operating system as Minix.
This macro does not affect the system headers' behavior.
A future release of Autoconf may stop defining this macro. */
#ifndef _MINIX
# undef _MINIX
#endif
/* Enable general extensions on NetBSD.
Enable NetBSD compatibility extensions on Minix. */
#ifndef _NETBSD_SOURCE
# undef _NETBSD_SOURCE
#endif
/* Enable OpenBSD compatibility extensions on NetBSD.
Oddly enough, this does nothing on OpenBSD. */
#ifndef _OPENBSD_SOURCE
# undef _OPENBSD_SOURCE
#endif
/* Define to 1 if needed for POSIX-compatible behavior. */
#ifndef _POSIX_SOURCE
# undef _POSIX_SOURCE
#endif
/* Define to 2 if needed for POSIX-compatible behavior. */
#ifndef _POSIX_1_SOURCE
# undef _POSIX_1_SOURCE
#endif
/* Enable POSIX-compatible threading on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# undef _POSIX_PTHREAD_SEMANTICS
#endif
/* Enable extensions specified by ISO/IEC TS 18661-5:2014. */
#ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__
# undef __STDC_WANT_IEC_60559_ATTRIBS_EXT__
#endif
/* Enable extensions specified by ISO/IEC TS 18661-1:2014. */
#ifndef __STDC_WANT_IEC_60559_BFP_EXT__
# undef __STDC_WANT_IEC_60559_BFP_EXT__
#endif
/* Enable extensions specified by ISO/IEC TS 18661-2:2015. */
#ifndef __STDC_WANT_IEC_60559_DFP_EXT__
# undef __STDC_WANT_IEC_60559_DFP_EXT__
#endif
/* Enable extensions specified by ISO/IEC TS 18661-4:2015. */
#ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__
# undef __STDC_WANT_IEC_60559_FUNCS_EXT__
#endif
/* Enable extensions specified by ISO/IEC TS 18661-3:2015. */
#ifndef __STDC_WANT_IEC_60559_TYPES_EXT__
# undef __STDC_WANT_IEC_60559_TYPES_EXT__
#endif
/* Enable extensions specified by ISO/IEC TR 24731-2:2010. */
#ifndef __STDC_WANT_LIB_EXT2__
# undef __STDC_WANT_LIB_EXT2__
#endif
/* Enable extensions specified by ISO/IEC 24747:2009. */
#ifndef __STDC_WANT_MATH_SPEC_FUNCS__
# undef __STDC_WANT_MATH_SPEC_FUNCS__
#endif
/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
# undef _TANDEM_SOURCE
#endif
/* Enable X/Open extensions. Define to 500 only if necessary
to make mbstate_t available. */
#ifndef _XOPEN_SOURCE
# undef _XOPEN_SOURCE
#endif

8813
configure vendored Executable file

File diff suppressed because it is too large Load diff

1462
configure.ac Normal file

File diff suppressed because it is too large Load diff

4083
display.c Normal file

File diff suppressed because it is too large Load diff

338
display.h Normal file
View file

@ -0,0 +1,338 @@
/* Copyright (c) 2008, 2009
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Micah Cowan (micah@cowan.name)
* Sadrul Habib Chowdhury (sadrul@users.sourceforge.net)
* Copyright (c) 1993-2002, 2003, 2005, 2006, 2007
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
*
* 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 3, 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 (see the file COPYING); if not, see
* https://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*
****************************************************************
* $Id$ GNU
*/
#ifndef SCREEN_DISPLAY_H
#define SCREEN_DISPLAY_H
#include "layout.h"
#include "canvas.h"
#include "viewport.h"
#ifdef MAPKEYS
#define KMAP_KEYS (T_OCAPS-T_CAPS)
#define KMAP_AKEYS (T_OCAPS-T_CURSOR)
#define KMAP_NOTIMEOUT 0x4000
struct kmap_ext
{
char *str;
int fl;
struct action um;
struct action dm;
struct action mm;
};
#else
#define KMAP_KEYS 0
#endif
struct win; /* forward declaration */
struct mouse_parse
{
char sgrmode; /* non-zero if parsing an SGR sequence */
int state; /* current state of parsing */
int params[3]; /* parsed params: button, x, y */
};
struct display
{
struct display *d_next; /* linked list */
struct acluser *d_user; /* user who owns that display */
struct canvas d_canvas; /* our canvas slice */
struct canvas *d_cvlist; /* the canvases of this display */
struct canvas *d_forecv; /* current input focus */
struct layout *d_layout; /* layout we're using */
void (*d_processinput) __P((char *, int));
char *d_processinputdata; /* data for processinput */
int d_vpxmin, d_vpxmax; /* min/max used position on display */
struct win *d_fore; /* pointer to fore window */
struct win *d_other; /* pointer to other window */
int d_nonblock; /* -1 don't block if obufmax reached */
/* >0: block after nonblock secs */
char d_termname[MAXTERMLEN + 1]; /* $TERM */
char *d_tentry; /* buffer for tgetstr */
char d_tcinited; /* termcap inited flag */
int d_width, d_height; /* width/height of the screen */
int d_defwidth, d_defheight; /* default width/height of windows */
int d_top, d_bot; /* scrollregion start/end */
int d_x, d_y; /* cursor position */
struct mchar d_rend; /* current rendition */
int d_col16change; /* the 16col bits changed in attr */
char d_atyp; /* current attribute types */
#ifdef DW_CHARS
int d_mbcs; /* saved char for multibytes charset */
#endif
#ifdef ENCODINGS
int d_encoding; /* what encoding type the display is */
int d_decodestate; /* state of our decoder */
int d_realfont; /* real font of terminal */
#endif
int d_insert; /* insert mode flag */
int d_keypad; /* application keypad flag */
int d_cursorkeys; /* application cursorkeys flag */
int d_revvid; /* reverse video */
int d_curvis; /* cursor visibility */
int d_has_hstatus; /* display has hardstatus line */
int d_hstatus; /* hardstatus used */
int d_lp_missing; /* last character on bot line missing */
int d_mouse; /* mouse mode */
int d_extmouse; /* extended mouse mode */
struct mouse_parse d_mouse_parse; /* state of mouse code parsing */
int d_mousetrack; /* set when user wants to use mouse even when the window
does not */
#ifdef RXVT_OSC
int d_xtermosc[5]; /* osc used */
#endif
struct mchar d_lpchar; /* missing char */
struct timeval d_status_time; /* time of status display */
int d_status; /* is status displayed? */
char d_status_bell; /* is it only a vbell? */
int d_status_len; /* length of status line */
char *d_status_lastmsg; /* last displayed message */
int d_status_buflen; /* last message buffer len */
int d_status_lastx; /* position of the cursor */
int d_status_lasty; /* before status was displayed */
int d_status_obuflen; /* saved obuflen */
int d_status_obuffree; /* saved obuffree */
int d_status_obufpos; /* end of status position in obuf */
struct event d_statusev; /* timeout event */
struct event d_hstatusev; /* hstatus changed event */
int d_kaablamm; /* display kaablamm msg */
struct action *d_ESCseen; /* Was the last char an ESC (^a) */
int d_userpid; /* pid of attacher */
char d_usertty[MAXPATHLEN]; /* tty we are attached to */
int d_userfd; /* fd of the tty */
struct event d_readev; /* userfd read event */
struct event d_writeev; /* userfd write event */
struct event d_blockedev; /* blocked timeout */
struct mode d_OldMode; /* tty mode when screen was started */
struct mode d_NewMode; /* New tty mode */
int d_flow; /* tty's flow control on/off flag*/
int d_intrc; /* current intr when flow is on */
char *d_obuf; /* output buffer */
int d_obuflen; /* len of buffer */
int d_obufmax; /* len where we are blocking the pty */
int d_obuflenmax; /* len - max */
char *d_obufp; /* pointer in buffer */
int d_obuffree; /* free bytes in buffer */
#ifdef AUTO_NUKE
int d_auto_nuke; /* autonuke flag */
#endif
#ifdef MAPKEYS
int d_nseqs; /* number of valid mappings */
int d_aseqs; /* number of allocated mappings */
unsigned char *d_kmaps; /* keymaps */
unsigned char *d_seqp; /* pointer into keymap array */
int d_seql; /* number of parsed chars */
unsigned char *d_seqh; /* last hit */
struct event d_mapev; /* timeout event */
int d_dontmap; /* do not map next */
int d_mapdefault; /* do map next to default */
#endif
union tcu d_tcs[T_N]; /* terminal capabilities */
char *d_attrtab[NATTR]; /* attrib emulation table */
char d_attrtyp[NATTR]; /* attrib group table */
int d_hascolor; /* do we support color */
short d_dospeed; /* baudrate of tty */
#ifdef FONT
char d_c0_tab[256]; /* conversion for C0 */
char ***d_xtable; /* char translation table */
#endif
int d_UPcost, d_DOcost, d_LEcost, d_NDcost;
int d_CRcost, d_IMcost, d_EIcost, d_NLcost;
int d_printfd; /* fd for vt100 print sequence */
#ifdef UTMPOK
slot_t d_loginslot; /* offset, where utmp_logintty belongs */
struct utmp d_utmp_logintty; /* here the original utmp structure is stored */
int d_loginttymode;
# ifdef _SEQUENT_
char d_loginhost[100+1];
# endif /* _SEQUENT_ */
#endif
int d_blocked;
int d_blocked_fuzz;
struct event d_idleev; /* screen blanker */
#ifdef BLANKER_PRG
int d_blankerpid;
struct event d_blankerev;
#endif
};
#ifdef MULTI
# define DISPLAY(x) display->x
#else
extern struct display TheDisplay;
# define DISPLAY(x) TheDisplay.x
#endif
#define D_user DISPLAY(d_user)
#define D_username (DISPLAY(d_user) ? DISPLAY(d_user)->u_name : 0)
#define D_canvas DISPLAY(d_canvas)
#define D_cvlist DISPLAY(d_cvlist)
#define D_layout DISPLAY(d_layout)
#define D_forecv DISPLAY(d_forecv)
#define D_processinput DISPLAY(d_processinput)
#define D_processinputdata DISPLAY(d_processinputdata)
#define D_vpxmin DISPLAY(d_vpxmin)
#define D_vpxmax DISPLAY(d_vpxmax)
#define D_fore DISPLAY(d_fore)
#define D_other DISPLAY(d_other)
#define D_nonblock DISPLAY(d_nonblock)
#define D_termname DISPLAY(d_termname)
#define D_tentry DISPLAY(d_tentry)
#define D_tcinited DISPLAY(d_tcinited)
#define D_width DISPLAY(d_width)
#define D_height DISPLAY(d_height)
#define D_defwidth DISPLAY(d_defwidth)
#define D_defheight DISPLAY(d_defheight)
#define D_top DISPLAY(d_top)
#define D_bot DISPLAY(d_bot)
#define D_x DISPLAY(d_x)
#define D_y DISPLAY(d_y)
#define D_rend DISPLAY(d_rend)
#define D_col16change DISPLAY(d_col16change)
#define D_atyp DISPLAY(d_atyp)
#define D_mbcs DISPLAY(d_mbcs)
#define D_encoding DISPLAY(d_encoding)
#define D_decodestate DISPLAY(d_decodestate)
#define D_realfont DISPLAY(d_realfont)
#define D_insert DISPLAY(d_insert)
#define D_keypad DISPLAY(d_keypad)
#define D_cursorkeys DISPLAY(d_cursorkeys)
#define D_revvid DISPLAY(d_revvid)
#define D_curvis DISPLAY(d_curvis)
#define D_has_hstatus DISPLAY(d_has_hstatus)
#define D_hstatus DISPLAY(d_hstatus)
#define D_lp_missing DISPLAY(d_lp_missing)
#define D_mouse DISPLAY(d_mouse)
#define D_mouse_parse DISPLAY(d_mouse_parse)
#define D_extmouse DISPLAY(d_extmouse)
#define D_mousetrack DISPLAY(d_mousetrack)
#define D_xtermosc DISPLAY(d_xtermosc)
#define D_lpchar DISPLAY(d_lpchar)
#define D_status DISPLAY(d_status)
#define D_status_time DISPLAY(d_status_time)
#define D_status_bell DISPLAY(d_status_bell)
#define D_status_len DISPLAY(d_status_len)
#define D_status_lastmsg DISPLAY(d_status_lastmsg)
#define D_status_buflen DISPLAY(d_status_buflen)
#define D_status_lastx DISPLAY(d_status_lastx)
#define D_status_lasty DISPLAY(d_status_lasty)
#define D_status_obuflen DISPLAY(d_status_obuflen)
#define D_status_obuffree DISPLAY(d_status_obuffree)
#define D_status_obufpos DISPLAY(d_status_obufpos)
#define D_statusev DISPLAY(d_statusev)
#define D_hstatusev DISPLAY(d_hstatusev)
#define D_kaablamm DISPLAY(d_kaablamm)
#define D_ESCseen DISPLAY(d_ESCseen)
#define D_userpid DISPLAY(d_userpid)
#define D_usertty DISPLAY(d_usertty)
#define D_userfd DISPLAY(d_userfd)
#define D_OldMode DISPLAY(d_OldMode)
#define D_NewMode DISPLAY(d_NewMode)
#define D_flow DISPLAY(d_flow)
#define D_intr DISPLAY(d_intr)
#define D_obuf DISPLAY(d_obuf)
#define D_obuflen DISPLAY(d_obuflen)
#define D_obufmax DISPLAY(d_obufmax)
#define D_obuflenmax DISPLAY(d_obuflenmax)
#define D_obufp DISPLAY(d_obufp)
#define D_obuffree DISPLAY(d_obuffree)
#define D_auto_nuke DISPLAY(d_auto_nuke)
#define D_nseqs DISPLAY(d_nseqs)
#define D_aseqs DISPLAY(d_aseqs)
#define D_seqp DISPLAY(d_seqp)
#define D_seql DISPLAY(d_seql)
#define D_seqh DISPLAY(d_seqh)
#define D_dontmap DISPLAY(d_dontmap)
#define D_mapdefault DISPLAY(d_mapdefault)
#define D_kmaps DISPLAY(d_kmaps)
#define D_tcs DISPLAY(d_tcs)
#define D_attrtab DISPLAY(d_attrtab)
#define D_attrtyp DISPLAY(d_attrtyp)
#define D_hascolor DISPLAY(d_hascolor)
#define D_dospeed DISPLAY(d_dospeed)
#define D_c0_tab DISPLAY(d_c0_tab)
#define D_xtable DISPLAY(d_xtable)
#define D_UPcost DISPLAY(d_UPcost)
#define D_DOcost DISPLAY(d_DOcost)
#define D_LEcost DISPLAY(d_LEcost)
#define D_NDcost DISPLAY(d_NDcost)
#define D_CRcost DISPLAY(d_CRcost)
#define D_IMcost DISPLAY(d_IMcost)
#define D_EIcost DISPLAY(d_EIcost)
#define D_NLcost DISPLAY(d_NLcost)
#define D_printfd DISPLAY(d_printfd)
#define D_loginslot DISPLAY(d_loginslot)
#define D_utmp_logintty DISPLAY(d_utmp_logintty)
#define D_loginttymode DISPLAY(d_loginttymode)
#define D_loginhost DISPLAY(d_loginhost)
#define D_readev DISPLAY(d_readev)
#define D_writeev DISPLAY(d_writeev)
#define D_blockedev DISPLAY(d_blockedev)
#define D_mapev DISPLAY(d_mapev)
#define D_blocked DISPLAY(d_blocked)
#define D_blocked_fuzz DISPLAY(d_blocked_fuzz)
#define D_idleev DISPLAY(d_idleev)
#define D_blankerev DISPLAY(d_blankerev)
#define D_blankerpid DISPLAY(d_blankerpid)
#define GRAIN 4096 /* Allocation grain size for output buffer */
#define OBUF_MAX 256 /* default for obuflimit */
#define OUTPUT_BLOCK_SIZE 256 /* Block size of output to tty */
#define AddChar(c) \
do \
{ \
if (--D_obuffree <= 0) \
Resize_obuf(); \
*D_obufp++ = (c); \
} \
while (0)
#define STATUS_OFF 0
#define STATUS_ON_WIN 1
#define STATUS_ON_HS 2
#define HSTATUS_IGNORE 0
#define HSTATUS_LASTLINE 1
#define HSTATUS_MESSAGE 2
#define HSTATUS_HS 3
#define HSTATUS_FIRSTLINE 4
#define HSTATUS_ALWAYS (1<<3)
#endif /* SCREEN_DISPLAY_H */

2
doc/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
Makefile
screen.info*

253
doc/FAQ Normal file
View file

@ -0,0 +1,253 @@
jw 21.10.93
05.05.94
screen: frequently asked questions -- known problems -- unimplemented bugs
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Q: Why is it impossible to download a file with Kermit/sz/rz when
screen is running? Do I need to set some special variables?
A: Screen always interprets control-sequences sent by the
applications and translates/optimizes them for the current
terminal type. Screen always parses the user input for its
escape character (CTRL-A). Both are basic screen features and
cannot be switched off. Even if it were possible to switch
screen into a completely transparent mode, you could never switch
between windows, while kermit/sz/rz is downloading a file. You
must wait till the end as kermit/sz/rz will not transmit your
input during a file transfer and as kermit/sz/rz would be very
confused if screen switched away the window containing the
other kermit/sz/rz. Simply detach your screen session for each
file transfer and start the transfer program only from the shell
where you started screen.
Q: I am using screen with a YYY terminal, which supports the XXX
graphic language. I am very happy with it, except one thing: I
cannot render graphics into screen windows.
A: You are out of luck there. Screen provides a fixed set of escape
sequences in order to make it possible to switch terminal types.
Screen has to know exactly what the escape sequences do to the
terminal because it must hold an image in memory. Otherwise
screen could not restore the image if you switch to another
window. Because of this you have to change screens escape
sequence parser (ansi.c) to pass the XXX graphics sequences to
the terminal. Of course the graphics will be lost if you switch
to another window. Screen will only honour graphics sequences
that are demanded by an overwhelming majority.
Q: For some unknown reason, the fifo in /tmp/screens/S-myname is
gone, and i can't resume my screen session. Is there a way to
recreate the fifo?
A: Screen checks the fifo/socket whenever it receives a SIGCHLD
signal. If missing, the fifo/socket is recreated then. If screen
is running non set-uid the user can issue a 'kill -CHLD
screenpid' directly (it is -CHILD on some systems). Screenpid is
the process-id of the screen process found in a 'ps -x' listing.
But usually this won't work, as screen should be installed set-
uid root. In this case you will not be able to send it a signal,
but the kernel will. It does so, whenever a child of screen
changes its state. Find the process-id (shellpid below) of the
"least important" shell running inside screen. The try 'kill
-STOP shellpid'. If the fifo/socket does not reappear, destroy
the shell process. You sacrify one shell to save the rest. If
nothing works, please do not forget to remove all processes
running in the lost screen session.
Q: When you start "screen" a page of text comes up to start you
off. Is there a way to get rid of this text as a command line
argument or by using a switch of some sort.
A: Just put the following line in your ~/.screenrc:
startup_message off
Many people ask this, although it is in the man page, too :-)
Q: Start "screen emacs" and run emacs function suspend-emacs
(ctrl-z). The window containing emacs vanishes.
A: This is a known bug. Unfortunatly there is no easy fix
because this is specified in the POSIX standard. When a new
window is created Screen opens up a new session because the
window has to get the pty as a controlling terminal (a
session can only have one controlling terminal). With the
setsid() call the process also creates a new process
group. This process group is orphaned, because there is no
process in the session which is not in the process
group. Now if the process group leader (i.e. your program)
gets a TTIN/TTOU/TSTP, POSIX states that the kernel must
send a KILL signal to the process group because there is no
one left to continue the process. Even if screen would
try to restart the program, that would be after it received the
KILL signal which cannot be caught or ignored.
tromey@klab.caltech.edu (Tom Tromey): I've noticed this exact
same problem. I put this in my .emacs file. It seems to work:
;; If running under screen, disable C-z.
(if (and (getenv "STY") (not window-system))
(global-unset-key "\C-z"))
Q: Screen gets the terminal size wrong and messes up.
A: Before you start screen: Check with 'stty -a' what the terminal
driver thinks about rows and columns. Check the environment
variables LINES and COLUMNS. Then from within screen check with
the info command (CTRL-A i) what size screen thinks your terminal
is. If correcting tty driver setting and environment variables
does not help, look up the terminal capability definition. First
the TERMCAP environment variable. If this is not set, look up the
terminals name as defined in the environment variable TERM in
/etc/termcap or in the terminfo database with untic or infocmp.
There may be :li=...: and :co=...: or even :ll=...: entries
(cols#... and lines#... when it's terminfo) defined incorrectly.
Either construct your own TERMCAP environment variables with
correct settings, use screens terminfo/termcap command in your
.screenrc file or have the database corrected by the system
administrator.
Q: Screen messes up the terminal output when I use my favourite ap-
plication. Setting the terminal size does not help.
A: Probably you got the termcap/terminfo entries wrong. Fixing this
is a three stage procedure. First, find out if terminfo or
termcap is used. If your system only has /etc/termcap,
but not /usr/lib/terminfo/... then you are using termcap.
Easy. But if your system has both, then it depends how the appli-
cation and how screen were linked. Beware, if your applica-
tion runs on another host via rlogin, telnet or the like, you
should check the terminfo/termcap databases there. If you cannot
tell if terminfo or termcap is used (or you just want to be
save), the do all steps in stage 3 in parallel for both
systems (on all involved hosts). Second: Understand the basic
rules how screen does its terminal emulation. When screen is
started or reattached, it relies on the TERM environment variable
to correctly reflect the terminal type you have physically
in front of you. And the entry should either exist in the system
terminfo/termcap database or be specified via the TERMCAP en-
vironment variable (if screen is using the termcap system). On
the other end, screen understands one set of control codes. It
relies on the application using these codes. This means applica-
tions that run under screen must be able to adapt their con-
trol codes to screen. The application should use the TERM vari-
able and termcap or terminfo library to find out how to drive
its terminal. When running under screen, the terminal is virtual
and is only defined by the set of control codes that screen
understands. The TERM variable is automatically set to
"screen" and the "screen"-entries should exist in the data-
bases. If your application uses hardcoded control codes rather
than a database, you are on your own. Hint: The codes under-
stood by screen are a superset of the very common definition
named "vt100". Look at the documentation of screen. The
codes are listed there. Third: Have the entry "screen" in-
stalled on all hosts or make sure you can live with "vt100".
Check the codes sent by your application, when the TERM variable
is set to "screen". Do not try to set the TERM variable inside
screen to anything other than "screen" or "vt100" or compati-
ble. Thus your application can drive screen correctly. Also take
care that a good entry is installed for your physical terminal
that screen has to drive. Even if the entry was good enough
for your application to drive the terminal directly, screen may
find flaws, as it tries to use other capabilities while op-
timizing the screen output. The screenrc commands
"termcap" and/or "terminfo" may help to fine-tune capabilities
without calling the supervisor to change the database.
Q: I cannot configure screen. Sed does not work.
A: The regular expressions used in our configure script are too
complicated for GNU sed version 2.03. In this regard it is bug
compatible with Ultrix 3.1 "sed": GNU sed version 2.03 dumps
core with our configure script. Try an older release. E.g. from
ftp.uni-erlangen.de:/pub/utilities/screen/sed-2.02b.tar.gz
Q: When reattaching a session from a different Workstation, the
DISPLAY environment variable should be updated. Even ``CTLR-A
: setenv DISPLAY newhost:0'' does not work as expected.
A: Under unix every process has its own environment. The environ-
ment of the SCREEN process can be changed with the `setenv' com-
mand. This however cannot affect the environment of the
shells or applications already running under screen. Subsequently
spawned processes will reflect the changes. One should be aware
of this problem when running applications from very old shells.
Screen is a means for keeping processes alive.
Q: About once every 5 times I ran the program, rather than getting
a "screen," I got someone elses IRC output/input.
A: What probably happened is that an IRC process was left running on
a pseudo tty in such a way that the kernel thought the tty was
available for reallocation. You can fix this behaviour by
applying the SunOS 4.1.x tty jumbo patch (100513-04).
Q: Screen compiled on SunOS 5.3 cannot reattach a detached session.
A: You are using /usr/ucb/cc, this compiler is wrong. Actually it
links with a C-library that mis-interprets dirent. Try again
with /opt/SUNWspro/bin/cc!
Q: The "talk" command does not work when Screen is active.
A: Talk and several other programs rely on entries in the Utmp-
Database (/etc/utmp). On some systems this Database is world
writable, on others it is not. If it is not, screen must be
installed with the appropriate permissions (user or group s-bit)
just like any program that uses PTYs (rlogin, xterm, ...). When
screen cannot write to utmp, you will see messages on you display
which do not belong to any screen window.
When screen can update utmp, it is not guaranteed that it does as
you expect. First this depends on the config.h file defining
UTMPOK, LOGINDEFAULT, and perhaps CAREFULUTMP. Second it depends
on the screenrc files (system wide and per user), if utmp entries
are done. Third, you can control whether windows are logged in
with screens ``login'' command.
Q: Seteuid() does not work as expected in AIX. Attempting a multi-
user-attach results in a screen-panic: "seteuid: not owner".
A: This is not a screen problem. According to Kay Nettle
(pkn@cs.utexas.edu) you need the AIX patch PTF 423674.
Q: When I type cd directory (any directory or just blank) from
within one of the windows in screen, the whole thing just freezes
up.
A: You display the current working directory in xterm's title bar,
This may be caused by hardcoded ESC-sequences in the shell prompt
or in an cd alias. In Xterm the coding is
ESC ] n ; string_to_display ^G
where n = 1, 2, 3 selects the location of the displayed string.
Screen misinterprets this as the ansi operating system comment
sequence:
ESC ] osc_string
and waits (according to ansi) for the string terminator
ESC \
Screen versions after 3.5.12 may provide a workaround.
Q: Mesg or biff cannot be turned on or off while running screen.
A: Screen failed to change the owner of the pty it uses. You need to
install screen setuid-root. See the file INSTALL for details.
Q: The cursor left key deletes the characters instead of just moving the
cursor. A redisplay (^Al) brings everything back.
A: Your terminal emulator treats the backspace as "destructive". You
can probably change this somewhere in the setup. We can't think
of a reason why anybody would want a destructive backspace, but
if you really must have it, add the lines
termcap <TERM> 'bc@:bs@'
terminfo <TERM> 'bc@:bs@'
to your ~/.screenrc (replace <TERM> with the terminal type your
emulator uses).
Q: I have an old SysV OS (like Motorola SysV68) and sometimes screen
doesn't reset the attributes correctly. A redisplay (^Al) doesn't
make things better.
A: The libcurses library has a bug if attributes are cleared with
the special ue/se capabilities. As a workaround (other than upgrading
your system) modify 'rmul' (and 'rmso'?) in screen's terminfo entry:
rmul=\E[m, rmso=\E[m

62
doc/Makefile.in Normal file
View file

@ -0,0 +1,62 @@
# Makefile for Screen documentation
srcdir = @srcdir@
VPATH = @srcdir@
DESTDIR =
prefix = @prefix@
datarootdir = @datarootdir@
mandir = @mandir@
infodir = @infodir@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
MAKEINFO = makeinfo
TEXI2DVI = texi2dvi
TEXI2PDF = texi2pdf
SHELL = /bin/sh
all: screen.info
dvi screen.dvi: screen.texinfo mostlyclean
$(TEXI2DVI) $(srcdir)/screen.texinfo
pdf screen.pdf: screen.texinfo mostlyclean
$(TEXI2PDF) $(srcdir)/screen.texinfo
info screen.info: screen.texinfo
@rm -f screen.info*
$(MAKEINFO) $(srcdir)/screen.texinfo -o screen.info
install: installdirs
$(INSTALL_DATA) $(srcdir)/screen.1 $(DESTDIR)$(mandir)/man1/screen.1
-$(MAKE) screen.info
-if test -f screen.info; then d=.; else d=$(srcdir); fi; \
if test -f $$d/screen.info; then \
for f in $$d/screen.info*; do $(INSTALL_DATA) $$f $(DESTDIR)$(infodir);done; \
if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
install-info --info-dir=$(DESTDIR)$(infodir) $$d/screen.info; \
else true; fi; \
fi
uninstall:
rm -f $(DESTDIR)$(mandir)/man1/screen.1
rm -f $(DESTDIR)$(infodir)/screen.info*
installdirs:
$(srcdir)/../etc/mkinstalldirs $(DESTDIR)$(mandir)/man1 $(DESTDIR)$(infodir)
mostlyclean:
-rm -f *.cp *.cps *.fn *.fns *.ky *.kys *.pg *.tp *.vr
-rm -f *.log *.aux *.toc *~
clean distclean clobber: mostlyclean
-rm -f *.dvi
realclean: clean
-rm -f *.info*
check installcheck:

151
doc/README.DOTSCREEN Normal file
View file

@ -0,0 +1,151 @@
From bargi@dots.physics.orst.edu Thu Aug 31 23:42 MET 1995
Received: from faui45.informatik.uni-erlangen.de (root@faui45.informatik.uni-erlangen.de [131.188.34.45]) by immd4.informatik.uni-erlangen.de with ESMTP
id XAA14775 (8.6.12/7.4f-FAU);; Thu, 31 Aug 1995 23:42:15 +0200
Received: from dots.physics.orst.edu (bargi@dots.PHYSICS.ORST.EDU [128.193.96.106]) by uni-erlangen.de with ESMTP
id XAA03048 (8.6.12/7.4f-FAU); for <screen@uni-erlangen.de>; Thu, 31 Aug 1995 23:42:03 +0200
Received: (from bargi@localhost) by dots.physics.orst.edu (8.6.11/8.6.9) id OAA15627; Thu, 31 Aug 1995 14:41:47 -0700
From: Hadi Bargi Rangin <bargi@dots.physics.orst.edu>
Message-Id: <199508312141.OAA15627@dots.physics.orst.edu>
Subject: README.DOTSCREEN
To: screen@uni-erlangen.de
Date: Thu, 31 Aug 1995 14:41:47 -0700 (PDT)
Cc: bargi@dots.physics.orst.edu (Hadi Bargi Rangin)
X-Mailer: ELM [version 2.4 PL24]
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=US-ASCII
Content-Length: 5423
Status: RO
Hallo,
leider war readme file fuer dotscreen nicht in unserem dotscreen-Packet,
deshalb schicke ich es Euch nachtraeglich. Nachdem Ihr unseren packet
getestet habt, koennen wir Euch anrufen und vielleicht mehr ueber die
Einzelnheiten sprechen, ob wir unsere Weiterentwicklung koordinieren
wollen.
Danke,
Gruss,
Hadi
===============================================================================
Quick introduction to dotscreen
-------------------------------
1. Introduction
2. Is dotscreen different as screen?
3. Installation instructions
4. Functions description
5. Further development
1. Introduction
===============
Dotscreen, is a system which allow a person direct access to unix via
a braille display. The emphasis is on direct, because the braille
display is connected directly to the serial port on the unix
machine. You no longer must use a dos machine running a terminal
emulation logged into a unix machine. Dotscreen is built on top of
screen, a powerful full-screen window manager for unix tty terminals.
Screen keeps track of what is being displayed in each window that it
is managing so that it can easily switch back and forth between these
windows. Dotscreen makes this stored window information available via
a braille display. Dotscreen only allows access to tty terminal
sessions, it does not allow access to X-Windows, however, it will run
in an xterm window. Currently, it works with the TSI Navigator 40 and
the TSI PowerBraille 40 braille displays. We plan to support other
displays as demand and information about other displays is made
available to us
2. Is dotscreen different than screen?
======================================
All of screens functions still work in dotscreen. A few of the
functions are not accessible via braille, but we expect to remedy that
in future releases.
3. Installation instructions
============================
Please read the INSTALL file for full installation instructions.
In addition to those instructions, note that you must create
a .screenrc file and that file must contain the type of braille
display that you are using and the serial device that the display
is connected to. A minimal .screenrc file should contain something
like the following four lines, (these are only examples, please
customize them for your configuration)
# example of .screenrc when using braille display
bd_start_braille on
bd_type powerbraille_40
bd_port /dev/ttyS0
bd_braille_table /home/gardner/us-braille.tbl
# end of example
4. Functions description
========================
The basic operation of screen is described in README. The braille
navigation commands are similar to commands usually found on dos
braille screenreaders. Also, because dotscreen is built on top of
screen, the user can switch back and forth easily between many running
applications. The braille commands can be changed any time after
starting screen using the internal screen "C-a :" command line. All
braille commands begin with "bd_"; following is the list of braille
commands:
bd_start_braille on/off # Starts/stops using braille features on screen
bd_link on/off # links/unlinks braille cursor to/from screen cursor
bd_bell on/off # turn on/off sending bell-signal to terminal
bd_scroll on/off # enables/disables scrolling
bd_skip on/off # skip/don't skip balnk lines
bd_width <integer-value> # number of braille cells that user want to use,
# this value is always <= total number of cells
bd_ncrc <interger-value> # number of cells displayed on the right side
# of physical cursor (default = 1)
bd_info <integer-value> # displays braille/screen cursor position
# depending on its value, (no info: 0, only
# bc-info: 1, only sc-info: 2, bc- and sc-info: 3
bd_port <serial-device> # serial port which braille display is connected to
bd_braille_table <bl-table> # braille table to be used. German, US and GS
# braille tables are provided
bd_type <braille-display-type>
# braille display type being used
Note: currently valid value for some parameters:
bd_type:
1. navigator_40
2. powerbraille_40.
bd_braille_table:
1. gr-braille.tbl German braille code
2. us-braille.tbl US computer braille code
3. gs-braille.tbl GS braille code
Since the braille tables are in files, you should give the full
pathnames of the files either in .screenrc or using the
internal screen "C-a :" command line.
5. Further development
======================
As mentioned above, currently Dotscreen works with Telesensory braille
displays the PowerBraille and the Navigator because Telesensory has
given us the information needed to program their braille display. We
plan to add support for other braille displays when and if we get the
requisite information from the braille display manufacturer.
Also some things such as cursor navigation from the braille display
have not been implemented. If you find a feature missing that
you wish to have, please contact us.
This software has been developed within the Science Access Project at
Oregon State University under the direction of John Gardner.
Authors: Hadi Bargi Rangin (bargi@dots.physics.orst.edu)
Bill Barry (barryb@dots.physics.orst.edu)

6501
doc/fdpat.ps Normal file

File diff suppressed because it is too large Load diff

1
doc/install.sh Symbolic link
View file

@ -0,0 +1 @@
../install.sh

51
doc/make.help Normal file
View file

@ -0,0 +1,51 @@
######
######
###### The following lines should be obsolete because of the 'configure' script.
###### It is here only for reference if 'configure' needs human help.
######
### If you choose to compile with the tried and true:
#CC= cc
#CFLAGS= -O
#CFLAGS= -g
### gcc specific CFLAGS:
#CC= gcc
# If your system include files are bad, don't use -Wall
#CFLAGS= -O6 -g #-Wall
#CFLAGS = -g -fstrength-reduce -fcombine-regs -finline-functions #-Wall
### On some machines special CFLAGS are required:
#M_CFLAGS=
#M_CFLAGS= -D__NetBSD__ # NetBsd Machines like this (a.kalb@rrze)
#M_CFLAGS= -Dapollo -A cpu,mathchip -A nansi # Apollo DN3000/4000/4500
#M_CFLAGS= -DISC -D_POSIX_SOURCE # isc
#M_CFLAGS= -systype bsd43 -DMIPS # mips
#M_CFLAGS= -fforce-mem -fforce-addr\
# -fomit-frame-pointer -finline-functions -bsd # NeXT
#M_CFLAGS= -qlanglvl=ansi # RS6000/AIX
#M_CFLAGS= -qlanglvl=ansi -D_AIX32 # RS6000/AIX 3.2
#M_CFLAGS= -ansi # sgi/IRIX 3.x ansi
#M_CFLAGS= -xansi # sgi/IRIX 4.x ext ansi
#M_CFLAGS= -YBSD # Ultrix 4.x
#M_CFLAGS= -DSVR4=1 # Bob Kline rvk@blink.att.com 80386 Unix SVR4.0
#M_CFLAGS= -D_CX_UX # Ken Beal kbeal@amber.ssd.csd.harris.com Harris CX/UX
#M_CFLAGS= -K pentium # Thanh Ma tma@encore.com Unixware, SVR4-2
### Choose one of the LIBS setting below:
#LIBS= -ltermcap -lc -lsocket -linet -lsec -lseq # Sequent/ptx
#LIBS= -lcurses -lelf -lcrypt -lsocket -lnsl # Solaris, when it sucks
#LIBS= -ltermcap # SunOS, Linux, Apollo,
# gould_np1, NeXT, Ultrix
#LIBS= -ltermcap -lelf # SVR4
#LIBS= -ltermlib -linet -lcposix # isc
#LIBS= -ltermcap -lmld # mips (nlist is in mld)
#LIBS= -ltermlib -lsun -lmld #-lc_s # sgi/IRIX
#LIBS= -lcurses # RS6000/AIX
#LIBS= -lcrypt_d -ltinfo # sco32
#LIBS= -lcrypt_i -ltinfo # sco32
#LIBS= -lcrypt -lsec # sco322 (msilano@sra.com)
#LIBS= -ltermcap -lcrypt.o -ldir -lx # SCO XENIX 2.3.4
#LIBS= -ltermcap -lcrypt -ldir -l2.3 -lx # SCO UNIX XENIX cross dev.
#LIBS= -ltermcap -lelf -lcrypt -lsocket -lnet -lnsl # Bob Kline SVR4
#LIBS= -lcurses -lelf -lcrypt -lgen # Thanh Ma, Unixware, SVR4-2

5411
doc/screen.1 Normal file

File diff suppressed because it is too large Load diff

6108
doc/screen.texinfo Normal file

File diff suppressed because it is too large Load diff

2959
doc/window_to_display.ps Normal file

File diff suppressed because it is too large Load diff

2141
encoding.c Normal file

File diff suppressed because it is too large Load diff

46
etc/ccdefs Executable file
View file

@ -0,0 +1,46 @@
#!/bin/sh
cd /tmp
umask 022
CC=cc
CPP=cpp
PATH="$PATH:/lib"
TEMP=def$$
trap 'rm -f ${TEMP}*; trap 0; exit' 0 1 2 3 15
set `type $CC`
q=$#
set x `type $CC`
shift $q
cc=$1
set `type $CPP`
q=$#
set x `type $CPP`
shift $q
cpp=$1
strings - "$cc" 2>/dev/null | tr ' ' '\012' > ${TEMP}.x
if test -x "$cpp"; then
strings - "$cpp" 2>/dev/null | tr ' ' '\012' >> ${TEMP}.x
else
echo "Warning: cpp not found."
fi
sort < ${TEMP}.x | uniq | awk '
/^-D[A-Za-z_][A-Za-z_0-9]*$/ {
printf("#ifdef %s\n", substr($0,3))
printf("\"%s\": %s\n", substr($0,3), substr($0,3))
print "#endif"
}
/^[A-Za-z_][A-Za-z_0-9]*$/ {
printf("#ifdef %s\n", $0)
printf("\"%s\": %s\n", $0, $0)
print "#endif"
}
' > ${TEMP}.c
echo "Defines in cc are:"
cc -E ${TEMP}.c | sed -n -e 's/"\([^:]*\)":/\1:/p' | sort | uniq

53
etc/completer.zsh Normal file
View file

@ -0,0 +1,53 @@
#compdef screen
#Generated by
# help2simple.pl -c screen -p -f
# simple2long.xsl
# args.xsl
# For details see:
# http://www.geocities.com/f_rosencrantz/xml_completion.htm
local context state line
typeset -A opt_args
_arguments \
"-a[Force all capabilities into each window's termcap.]" \
'-A:Adapt all windows to the new display width & height.' \
"-c:Read configuration file instead of '.screenrc'.:_files -/" \
'-d:Detach the elsewhere running screen (with -r: reattach here).:->sessionname' \
'-dmS:Start as daemon: Screen session in detached mode.' \
'-D:Detach and logout remote (with -r: reattach here).' \
'-e:Change command characters.' \
'-f-:Flow control on, -fn = off, -fa = auto.:((n\:Flow\ conrol\ off a\:Flow\ conrol\ auto))' \
'-h:Set the size of the scrollback history buffer.' \
'-i[Interrupt output sooner when flow control is on.]' \
'-l[Login mode on (update /var/run/utmp), -ln = off.]' \
'-list[Do nothing, just list our SockDir.]' \
'-ls[Do nothing, just list our SockDir.]' \
"-L[Terminal's last character can be safely updated.]" \
'-m[ignore $STY variable, do create a new screen session.]' \
'-O[Choose optimal output rather than exact vt100 emulation.]' \
'-p:Preselect the named window if it exists.' \
'-q[Quiet startup. Exits with non-zero return code if unsuccessful.]' \
'-r[Reattach to a detached screen process.]:Handling Tag sessionname:->sessionname' \
'-R[Reattach if possible, otherwise start a new session.]' \
'-s:Shell to execute rather than $SHELL.' \
'-S:Name this session <pid>.sockname instead of <pid>.<tty>.<host>.' \
"-t:Set title. (window's name)." \
'-T:Use term as $TERM for windows, rather than "screen".' \
'-U[Tell screen to use UTF-8 encoding.]' \
'-v[Print "Screen version 3.09.11beta (FAU) 11-Oct-01".]' \
'-wipe[Do nothing, just clean up SockDir.]' \
'-x[Attach to a not detached screen. (Multi display mode).]' \
'-X[Execute <cmd> as a screen command in the specified session.]:Handling Tag screencmd:( acladd addacl aclchg acldel aclgrp aclumask activity allpartial at attrcolor autodetach autonuke bce bell_msg bind bindkey break breaktype bufferfile c1 caption charset chdir clear colon command compacthist console copy copy_reg crlf debug defc1 defautonuke defbce defbreaktype defcharset defescape defflow defgr defhstatus defkanji deflogin defmode defmonitor defobuflimit defscrollback defshell defsilence defslowpaste defutf8 defwrap defwritelock detach dinfo displays digraph dumptermcap echo escape exec fit flow focus gr hardcopy hardcopy_append hardcopydir hardstatus height help history hstatus info ins_reg kill lastmsg license lockscreen log logfile login logtstamp mapdefault mapnotnext maptimeout markkeys meta monitor msgminwait msgwait multiuser nethack next nonblock number obu!
!
flimit only other partial password paste pastefont pow_break pow_detach pow_detach_msg prev printcmd process quit readbuf readreg redisplay register remove removebuf reset resize screen scrollback select sessionname setenv shell shelltitle silence silencewait sleep slowpaste sorendition split startup_message stuff su term termcap terminfo termcapinfo time title unsetenv utf8 vbell vbell_msg vbellwait verbose version wall width windows wrap writebuf writelock xoff xon zombie)'
case $state in
"sessionname")
# Complete folder names.
local screendir
screendir=(`screen -ls | grep Socket | sed -n -e 's/\.$//' -e '$p' | awk '{print $NF;}'`)
_wanted files expl 'screen process' _path_files -W screendir
;;
esac

67
etc/countmail Executable file
View file

@ -0,0 +1,67 @@
#!/usr/bin/perl
sub countmsgs {
return -1 unless open(M, "<$mbox");
my $inhdr = 0;
my $cl = undef;
my $msgread = 0;
my $count = 0;
while(<M>) {
if (!$inhdr && /^From\s+\S+\s+(?i:sun|mon|tue|wed|thu|fri|sat)\s+(?i:jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\s+\d+\s/) {
$inhdr = 1;
$msgread = 0;
undef $cl;
next;
}
if ($inhdr) {
if (/^content-length:\s+(\d+)/i) {
$cl = 0+$1;
next;
}
if (/^status:\s+(\S)/i) {
$msgread = 1 unless $1 eq 'N' || $1 eq 'U';
next;
}
if ($_ eq "\n") {
$count++ if !$msgread;
seek(M, $cl, 1) if defined $cl;
$inhdr = 0;
}
}
}
close M;
return $count;
}
$| = 1;
$mbox = $ARGV[0] || $ENV{'MAIL'};
$oldfmt = $ARGV[1] || "%4d ";
$newfmt = $ARGV[2] || "\005{Rk}%4d \005{-}";
@oldstat = stat($mbox);
if (!@oldstat) {
print "\005{Rk} ??? \005{-}\n";
exit 1;
}
$oldcount = 0;
while(1) {
$count = countmsgs($mbox);
if ($count == -1) {
print "\005{Rk} ??? \005{-}\n";
} elsif ($count < $oldcount || $count == 0) {
printf "$oldfmt\n", $count;
} else {
printf "$newfmt\n", $count;
}
$oldcount = $count;
while (1) {
@newstat = stat($mbox);
if (!@newstat) {
print "\005{Rk} ??? \005{-}\n";
exit 1;
}
last if $newstat[7] != $oldstat[7] || $newstat[9] != $oldstat[9];
sleep 1;
}
@oldstat = @newstat;
}

94
etc/etcscreenrc Normal file
View file

@ -0,0 +1,94 @@
#
# This is an example for the global screenrc file.
# You may want to install this file as /usr/local/etc/screenrc.
# Check config.h for the exact location.
#
# Flaws of termcap and standard settings are done here.
#
#startup_message off
#defflow on # will force screen to process ^S/^Q
deflogin on
#autodetach off
vbell on
vbell_msg " Wuff ---- Wuff!! "
# all termcap entries are now duplicated as terminfo entries.
# only difference should be the slightly modified syntax, and check for
# terminfo entries, that are already corected in the database.
#
# G0 we have a SEMI-GRAPHICS-CHARACTER-MODE
# WS this sequence resizes our window.
# cs this sequence changes the scrollregion
# hs@ we have no hardware statusline. screen will only believe that
# there is a hardware status line if hs,ts,fs,ds are all set.
# ts to statusline
# fs from statusline
# ds delete statusline
# al add one line
# AL add multiple lines
# dl delete one line
# DL delete multiple lines
# ic insert one char (space)
# IC insert multiple chars
# nx terminal uses xon/xoff
termcap facit|vt100|xterm LP:G0
terminfo facit|vt100|xterm LP:G0
#the vt100 description does not mention "dl". *sigh*
termcap vt100 dl=5\E[M
terminfo vt100 dl=5\E[M
#facit's "al" / "dl" are buggy if the current / last line
#contain attributes...
termcap facit al=\E[L\E[K:AL@:dl@:DL@:cs=\E[%i%d;%dr:ic@
terminfo facit al=\E[L\E[K:AL@:dl@:DL@:cs=\E[%i%p1%d;%p2%dr:ic@
#make sun termcap/info better
termcap sun 'up=^K:AL=\E[%dL:DL=\E[%dM:UP=\E[%dA:DO=\E[%dB:LE=\E[%dD:RI=\E[%dC:IC=\E[%d@:WS=1000\E[8;%d;%dt'
terminfo sun 'up=^K:AL=\E[%p1%dL:DL=\E[%p1%dM:UP=\E[%p1%dA:DO=\E[%p1%dB:LE=\E[%p1%dD:RI=\E[%p1%dC:IC=\E[%p1%d@:WS=\E[8;%p1%d;%p2%dt$<1000>'
#xterm understands both im/ic and doesn't have a status line.
#Note: Do not specify im and ic in the real termcap/info file as
#some programs (e.g. vi) will (no,no, may (jw)) not work anymore.
termcap xterm|fptwist hs@:cs=\E[%i%d;%dr:im=\E[4h:ei=\E[4l
terminfo xterm|fptwist hs@:cs=\E[%i%p1%d;%p2%dr:im=\E[4h:ei=\E[4l
# Long time I had this in my private screenrc file. But many people
# seem to want it (jw):
# we do not want the width to change to 80 characters on startup:
# on suns, /etc/termcap has :is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l:
termcap xterm 'is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l'
terminfo xterm 'is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l'
#
# Do not use xterms alternate window buffer.
# This one would not add lines to the scrollback buffer.
termcap xterm|xterms|xs ti=\E7\E[?47l
terminfo xterm|xterms|xs ti=\E7\E[?47l
#make hp700 termcap/info better
termcap hp700 'Z0=\E[?3h:Z1=\E[?3l:hs:ts=\E[62"p\E[0$~\E[2$~\E[1$}:fs=\E[0}\E[61"p:ds=\E[62"p\E[1$~\E[61"p:ic@'
terminfo hp700 'Z0=\E[?3h:Z1=\E[?3l:hs:ts=\E[62"p\E[0$~\E[2$~\E[1$}:fs=\E[0}\E[61"p:ds=\E[62"p\E[1$~\E[61"p:ic@'
#wyse-75-42 must have defflow control (xo = "terminal uses xon/xoff")
#(nowadays: nx = padding doesn't work, have to use xon/off)
#essential to have it here, as this is a slow terminal.
termcap wy75-42 nx:xo:Z0=\E[?3h\E[31h:Z1=\E[?3l\E[31h
terminfo wy75-42 nx:xo:Z0=\E[?3h\E[31h:Z1=\E[?3l\E[31h
#remove some stupid / dangerous key bindings
bind ^k
#bind L
bind ^\
#make them better
bind \\ quit
bind K kill
bind I login on
bind O login off
bind } history

260
etc/gr-braille.tbl Normal file
View file

@ -0,0 +1,260 @@
# GERMAN BRAILLE TABLE
#
# Dec Hex Braille Description
# ------------------------------------------------------------------------
0 00 (--345--8) NUL
1 01 (1------8) SOH
2 02 (12-----8) STX
3 03 (1--4---8) ETX
4 04 (1--45--8) EOT
5 05 (1---5--8) ENQ
6 06 (12-4---8) ACK
7 07 (12-45--8) BEL
8 08 (12--5--8) BS
9 09 (-2-4---8) HT
10 OA (-2-45--8) LF
11 0B (1-3----8) VT
12 OC (123----8) FF
13 0D (1-34---8) CR
14 0E (1-345--8) SO
15 OF (1-3-5--8) SI
16 10 (1234---8) DLE
17 11 (12345--8) DC1
18 12 (123-5--8) DC2
19 13 (-234---8) DC3
20 14 (-2345--8) DC4
21 15 (1-3--6-8) NAK
22 16 (123--6-8) SYN
23 17 (-2-456-8) ETB
24 18 (1-34-6-8) CAN
25 19 (1-3456-8) EM
26 1A (1-3-56-8) SUB
27 lB (123-56-8) ESC
28 lC (--34---8) FS
29 1D (-23456-8) GS
30 lE (-234-6-8) RS
31 1F (---456-8) US
32 20 (--------) Space
33 21 (----5---) !
34 22 (---4----) "
35 23 (--3456--) #
36 24 (---4-6--) $
37 25 (123456--) %
38 26 (1234-6--) &
39 27 (-----6--) '
40 28 (-23--6--) (
41 29 (--3-56--) )
42 2A (--3-5---) *
43 2B (-23-5---) +
44 2C (-2------) ,
45 2D (--3--6--) -
46 2E (--3-----) .
47 2F (-2--56--) /
48 30 (--34-6--) 0
49 31 (1----6--) 1
50 32 (12---6--) 2
51 33 (1--4-6--) 3
52 34 (1--456--) 4
53 35 (1---56--) 5
54 36 (12-4-6--) 6
55 37 (12-456--) 7
56 38 (12--56--) 8
57 39 (-2-4-6--) 9
58 3A (-2--5---) :
59 3B (-23-----) ;
60 3C (----56--) <
61 3D (-23-56--)
62 3E (---45---) >
63 3F (-2---6--) ?
64 40 (--345---) Special sign
65 41 (1-----7-) A
66 42 (12----7-) B
67 43 (1--4--7-) C
68 44 (1--45-7-) D
69 45 (1---5-7-) E
70 46 (12-4--7-) F
71 47 (12-45-7-) G
72 48 (12--5-7-) H
73 49 (-2-4--7-) I
74 4A (-2-45-7-) j
75 4B (1-3---7-) K
76 4C (123---7-) L
77 4D (1-34--7-) M
78 4E (1-345-7-) N
79 4F (1-3-5-7-) O
80 50 (1234--7-) P
81 51 (12345-7-) Q
82 52 (123-5-7-) R
83 53 (-234--7-) S
84 54 (-2345-7-) T
85 55 (1-3--67-) U
86 56 (123--67-) V
87 57 (-2-4567-) W
88 58 (1-34-67-) X
89 59 (1-34567-) Y
90 5A (1-3-567-) Z
91 5B (123-567-) [ or A umlaut
92 5C (--34--7-) \ or umlaut O
93 5D (-234567-) ] or umlaut U
94 5E (-234-67-) ^ or tilde
95 5F (---456--) _
96 60 (--345--8) '
97 61 (1-------) a
98 62 (12------) b
99 63 (1--4----) c
100 64 (1--45---) d
101 65 (1---5---) e
102 66 (12-4----) f
103 67 (12-45---) g
104 68 (12--5---) h
105 69 (-2-4----) i
106 6A (-2-45---) j
107 6B (1-3-----) k
108 6C (123-----) l
109 6D (1-34----) m
110 6E (1-345---) n
111 6F (1-3-5---) o
112 70 (1234----) p
113 71 (12345---) q
114 72 (123-5---) r
115 73 (-234----) s
116 74 (-2345---) t
117 75 (1-3--6--) u
118 76 (123--6--) v
119 77 (-2-456--) w
120 78 (1-34-6--) x
121 79 (1-3456--) y
122 7A (1-3-56--) z
123 7B (123-56--) { or umlaut a
124 7C (--34----) | or umlaut o
125 7D (-23456--) } or umlaut u
126 7E (-234-6--) '
127 7F (---456-8) DEL
128 80 (1234-67-) C Cedilla (upper case)
129 81 (12-456--) u Umlaut (lower case)
130 82 (123456-8) e Acute (lower case)
131 83 (1----6-8) a Circumflex
132 84 (123-56--) a Umlaut (lower case)
133 85 (123-56-8) a Grave
134 86 (-2-----8) a Ring (lower case)
135 87 (1234-6-8) c Cedilla (lower case)
136 88 (12---6-8) e Circumflex
137 89 (12-4-6-8) e Umlaut (lower case)
138 8A (-234-6-8) e Grave
139 8B (12-456-8) i Umlaut (lower case)
140 8C (1--4-6-8) i Circumflex
141 8D (-2-4---8) I Grave
142 8E (123-567-) A Umlaut (upper case)
143 8F (1----67-) A Ring (upper case)
144 90 (1234567-) E Acute (upper case)
145 91 (123-56--) ae Digraph (lower case)
146 92 (123-567-) AE Digraph (upper case)
147 93 (1--456-8) o Circumflex
148 94 (--34----) o Umlaut (lower case)
149 95 (--34-6-8) o Grave
150 96 (1---56-8) u Circumflex
151 97 (-23456-8) u Grave
152 98 (1-3456-8) y Umlaut
153 99 (--34--7-) O Umlaut (upper case)
154 9A (-234567-) U Umlaut (upper case)
155 9B (-23-5678) Cent
156 9C (----56-8) Pound/Sterling
157 9D (-2--5678) Yen
158 9E (-23-5--8) Peseta
159 9F (12-4---8) Franc
160 A0 (-23--678) a Acute (lower case)
161 Al (----5-7-) i Acute (lower case)
162 A2 (----5-78) o Acute (lower case)
163 A3 (--3-5678) u Acute (lower case)
164 A4 (1-345--8) n Tilde (lower case)
165 A5 (--345-7-) N Tilde (upper case)
166 A6 (1------8) Feminine Spanish Ordinal
167 A7 (1-3-5--8) Masculine Spanish Ordinal
168 A8 (--3----8) Inverted Question Mark
169 A9 (--3--67-) Left square corner
170 AA (--3--6-8) Right square corner
171 AB (-23----8) 1/2
172 AC (-2--56-8) 1/4
173 AD (----5--8) Inverted Exclamation Mark
174 AE (--3----8) Left Double Guillemet
175 AF (--3---7-) Right Double Guillemet
176 B0 (--34-67-) Box [Shade 1]
177 B1 (---4-678) Box [Shade 2]
178 B2 (12---67-) Box [Shade 3]
179 B3 (1--4-67-) Box [top bottom]
180 B4 (1--4567-) Box [left top bottom]
181 B5 (1---567-) Box [LEFT top bottom]
182 B6 (12-4-67-) Box [left TOP BOTTOM]
183 B7 (12-4567-) Box [left BOTTOM]
184 B8 (12--567-) Box [LEFT bottom]
185 B9 (-2-4-67-) Box [LEFT TOP BOTTOM]
186 BA (-2--5-7-) Box [TOP BOTTOM]
187 BB (-23---7-) Box [LEFT BOTTOM]
188 BC (----567-) Box [LEFT TOP]
189 BD (-23-567-) Box [left TOP]
190 BE (---45-7-) Box [LEFT top]
191 BF (-2---67-) Box [left bottom]
192 CO (--345--8) Box [top right]
193 C1 (--3---78) Box [left top right]
194 C2 (1--45678) Box [left right bottom]
195 C3 (-2-4-678) Box [top right bottom]
196 C4 (1--45--8) Box [left right]
197 C5 (1---5--8) Box [left top right bottom]
198 C6 (-2--5-78) Box [top RIGHT bottom]
199 C7 (12-45--8) Box [TOP right BOTTOM]
200 C8 (------78) Box [TOP RIGHT]
201 C9 (-2--5--8) Box [RIGHT BOTTOM]
202 CA (-2-45--8) Box [LEFT TOP RIGHT]
203 CB (1-3----8) Box [LEFT RIGHT BOTTOM]
204 CC (123----8) Box [TOP RIGHT BOTTOM]
205 CD (1-34---8) Box [LEFT RIGHT]
206 CE (---4--78) Box [LEFT TOP RIGHT BOTTOM]
207 CF (--345678) Box [LEFT top RIGHT]
208 DO (123----8) Box [left TOP right]
209 D1 (12345--8) Box [LEFT RIGHT bottom]
210 D2 (123-5--8) Box [left right BOTTOM]
211 D3 (-234---8) Box [TOP right]
212 D4 (-2345--8) Box [top RIGHT]
213 D5 (1-3--6-8) Box [RIGHT bottom]
214 D6 (123--6-8) Box [right BOTTOM]
215 D7 (-2-456-8) Box [left TOP right BOTTOM]
216 D8 (1-34-6-8) Box [LEFT top RIGHT bottom]
217 D9 (12345678) Box [left top]
218 DA (1-3-56-8) Box [right bottom]
219 DB (-----678) Box [Shade 4]
220 DC (--34-678) Box [box bottom]
221 DD (1234-678) Box [box right]
222 DE (--3-5-78) Box [box left]
223 DF (---4567-) Box [box top]
224 E0 (------7-) Alpha (lower case)
225 E1 (-234-6--) Beta (lower case)
226 E2 (-23-5-78) Gamma (upper case)
227 E3 (-23-5-7-) Pi (lower case)
228 E4 (---4-6-8) Sigma (upper case)
229 E5 (-2----78) Sigma (lower case)
230 E6 (--3--678) Mu (lower case)
231 E7 (-----6-8) Tau (lower case)
232 E8 (-23--6-8) Phi (upper case)
233 E9 (--3-56-8) Theta (lower case)
234 EA (--3-5--8) Omega (upper case)
235 EB (1----678) Delta (lower case)
236 EC (12---678) infinity
237 ED (1--4-678) Phi (lower case)
238 EE (1---5678) Epsilon (lower case)
239 EF (12-4-678) Intersection
240 F0 (12-45678) Equivalent (Member)
241 F1 (12--5678) Plus or minus
242 F2 (------7-) Greater than or equal
243 F3 (--34567-) Less than or equal
244 F4 (---4-67-) Integral [top]
245 F5 (-23---78) Integral [bottom]
246 F6 (-----67-) Division
247 F7 (-23--67-) Approximately equal
248 F8 (12--56-8) Small circle
249 F9 (-2-4-6-8) Bullet
250 FA (-2--5--8) Small bullet
251 FB (--3-567-) Bent Radical
252 FC (----56-8) Power of n
253 FD (-23-56-8) Power of 2
254 FE (---45--8) Large square bullet
255 FF (-2---6-8) blank (hard space)

261
etc/gs-braille.tbl Normal file
View file

@ -0,0 +1,261 @@
# GS BRAILLE TABLE
#
# Dec Hex Braille Description
# ------------------------------------------------------------------------
0 0 (--------) NUL
1 1 (--------) SOH
2 2 (--------) STX
3 3 (--------) ETX
4 4 (--------) EOT
5 5 (--------) ENQ
6 6 (--------) ACK
7 7 (--------) BEL
8 8 (--------) BS
9 9 (--------) HT
10 A (--------) LF
11 B (--------) VT
12 C (--------) FF
13 D (--------) CR
14 E (--------) SO
15 F (--------) SI
16 10 (--------) DLE
17 11 (--------) DC1
18 12 (--------) DC2
19 13 (--------) DC3
20 14 (--------) DC4
21 15 (--------) NAK
22 16 (--------) SYN
23 17 (--------) ETB
24 18 (--------) CAN
25 19 (--------) EM
26 1A (--------) SUB
27 1B (--------) ESC
28 1C (--------) FS
29 1D (--------) GS
30 1E (--------) RS
31 1F (--------) US
32 20 (--------) space
33 21 (-23-5---) bang
34 22 (--3--678) unidirectional double quote
35 23 (----5678) # (number or hash) symbol
36 24 (--34567-) $
37 25 (--34---8) % symbol
38 26 (-23-5-78) & symbol
39 27 (--3-----) apostrophe
40 28 (-23----8) left parenthesis symbol
41 29 (----567-) right parenthesis symbol
42 2A (--34--7-) asterisk
43 2B (-2--5-7-) plus symbol
44 2C (-2------) comma
45 2D (--3--6--) dash, also used as over/under bar.
46 2E (-2--56--) period, decimal point
47 2F (--34--78) / symbol
48 30 (-2-45-78) zero
49 31 (1-----78) one
50 32 (12----78) two
51 33 (1--4--78) three
52 34 (1--45-78) four
53 35 (1---5-78) five
54 36 (12-4--78) six
55 37 (12-45-78) seven
56 38 (12--5-78) eight
57 39 (-2-4--78) nine
58 3A (-2--5---) colon
59 3B (-23-----) semicolon
60 3C (1234567-) open angle bracket
61 3D (-2--5-78) equals symbol
62 3E (123456-8) close angle bracket
63 3F (-23--6--) question mark
64 40 (--345-78) @ sign
65 41 (1-----7-) A
66 42 (12----7-) B
67 43 (1--4--7-) C
68 44 (1--45-7-) D
69 45 (1---5-7-) E
70 46 (12-4--7-) F
71 47 (12-45-7-) G
72 48 (12--5-7-) H
73 49 (-2-4--7-) I
74 4A (-2-45-7-) J
75 4B (1-3---7-) K
76 4C (123---7-) L
77 4D (1-34--7-) M
78 4E (1-345-7-) N
79 4F (1-3-5-7-) O
80 50 (1234--7-) P
81 51 (12345-7-) Q
82 52 (123-5-7-) R
83 53 (-234--7-) S
84 54 (-2345-7-) T
85 55 (1-3--67-) U
86 56 (123--67-) V
87 57 (-2-4567-) W
88 58 (1-34-67-) X
89 59 (1-34567-) Y
90 5A (1-3-567-) Z
91 5B (-23--678) [ symbol
92 5C (1----678) \ symbol
93 5D (--3-5678) ] symbol
94 5E (--345-7-) ^
95 5F (-2---6-8) _
96 60 (--3----8) opening single quote
97 61 (1-------) a
98 62 (12------) b
99 63 (1--4----) c
100 64 (1--45---) d
101 65 (1---5---) e
102 66 (12-4----) f
103 67 (12-45---) g
104 68 (12--5---) h
105 69 (-2-4----) i
106 6A (-2-45---) j
107 6B (1-3-----) k
108 6C (123-----) l
109 6D (1-34----) m
110 6E (1-345---) n
111 6F (1-3-5---) o
112 70 (1234----) p
113 71 (12345---) q
114 72 (123-5---) r
115 73 (-234----) s
116 74 (-2345---) t
117 75 (1-3--6--) u
118 76 (123--6--) v
119 77 (-2-456--) w
120 78 (1-34-6--) x
121 79 (1-3456--) y
122 7A (1-3-56--) z
123 7B (123-5678) { symbol
124 7C (--34-678) |
125 7D (-2345678) } symbol
126 7E (--34-67-) ~
127 7F (1--4-678) del, nabla sign
128 80 (--3-5-7-) negative power indicator
129 81 (--34-67-) ~
130 82 (--3---78) opening double quote
131 83 (--34----) complex fraction line indicator
132 84 (--3-5-78) left superscript
133 85 (--345678) start extended math mode
134 86 (-23---7-) end of line in 2-D array
135 87 (-23--67-) right arrow sign
136 88 (-23-567-) proportional to sign
137 89 (-23---78) ` (grave accent)
138 8A (-234-678) integral sign
139 8B (-23-5678) identically equals sign
140 8C (--3-5--8) < (less) symbol
141 8D (-2---67-) > (greater) symbol
142 8E (123--678) end extended math mode.
143 8F (12345678) infinity sign
144 90 (1--4-6--) overscript indicator
145 91 (1---56--) slashed symbol or NOT indicator
146 92 (1--456--) function indicator
147 93 (---45-7-) bold symbol indicator
148 94 (---4-67-) italic symbol indicator
149 95 (---4567-) special (text default=underlined) symbol indicator
150 96 (------78) minus sign
151 97 (---4--78) gothic font symbol indicator
152 98 (----5-78) divide by sign
153 99 (---45-78) special font 1 symbol indicator
154 9A (-----678) closing double quote
155 9B (---4-678) special font 2 symbol indicator
156 9C (---45678) special font 3 symbol indicator
157 9D (-2----78) times cross sign
158 9E (-2---678) left subscript
159 9F (--3---7-) end of element in 2-D array
160 A0 (-2-4-6--) radical indicator
161 A1 (-----67-) closing single quote
162 A2 (----5---) In 8 dot code in shapes and as a soft hyphen.
163 A3 (---45---) To be used for foreign indicators and/or phonetic indicators.
164 A4 (-----6--) 04 never appears in 8 dot code except shapes.
165 A5 (---4-6--) 05 never appears in 8 dot code except shapes.
166 A6 (----56--) grade 1 indicator in both codes.
167 A7 (---456--) Converts upper cell to cell + dot-67, other root to root + dot-78.
168 A8 (-------8) Under user control can indicate hyperlinks or font enhancements or...
169 A9 (---4---8) start shape beginning with 01 and ending at first root cell
170 AA (----5--8) start shape beginning with 02
171 AB (---45--8) start shape beginning with 03
172 AC (-----6-8) start shape beginning with 04
173 AD (---4-6-8) start shape beginning with 05
174 AE (----56-8) start shape beginning with 06
175 AF (---456-8) start shape beginning with 07
176 B0 (1--4---8) Copyright sign
177 B1 (1--4-6-8) partial differential sign
178 B2 (-2---6--) subscript indicator
179 B3 (1------8) alpha
180 B4 (12-----8) beta
181 B5 (12-45--8) gamma
182 B6 (1--45--8) delta
183 B7 (1---5--8) epsilon
184 B8 (1-3-56-8) zeta
185 B9 (1---56-8) eta
186 BA (1--456-8) theta
187 BB (-2-4---8) iota
188 BC (1-3----8) kappa
189 BD (123----8) lambda
190 BE (1-34---8) mu
191 BF (1-345--8) nu
192 C0 (1-34-6-8) xi
193 C1 (1-3-5--8) omichron
194 C2 (1234---8) pi
195 C3 (123-5--8) rho
196 C4 (-234---8) sigma
197 C5 (-2345--8) tau
198 C6 (1-3--6-8) upsilon
199 C7 (12-4---8) phi
200 C8 (1234-6-8) chi
201 C9 (1-3456-8) psi
202 CA (-2-456-8) omega
203 CB (1----67-) cap Alpha
204 CC (12---67-) cap Beta
205 CD (12-4567-) cap Gamma
206 CE (1--4567-) cap Delta
207 CF (1---567-) cap Epsilon
208 D0 (1-3-5678) cap zeta
209 D1 (1---5678) cap Eta
210 D2 (1--45678) cap Theta
211 D3 (-2-4-67-) cap Iota
212 D4 (1-3---78) cap kappa
213 D5 (123---78) cap lambda
214 D6 (1-34--78) cap mu
215 D7 (1-345-78) cap nu
216 D8 (1-34-678) cap xi
217 D9 (1-3-5-78) cap omichron
218 DA (1234--78) cap pi
219 DB (123-5-78) cap rho
220 DC (-234--78) cap sigma
221 DD (-2345-78) cap tau
222 DE (1-3--678) cap upsilon
223 DF (12-4-67-) cap Phi
224 E0 (1234-678) cap chi
225 E1 (1-345678) cap psi
226 E2 (-2-45678) cap omega
227 E3 (-2--5--8) times dot sign
228 E4 (-2-45--8) small circle sign
229 E5 (-2-4-6-8) radical sign, not operator
230 E6 (12---6--) open braille bracket
231 E7 (12-4-6--) horizontal combination symbol indicator
232 E8 (12--56--) vertical stack symbol indicator
233 E9 (12-456--) superimposed combination symbol indicator
234 EA (12--56-8) absolute value bar sign
235 EB (--3-5---) superscript indicator
236 EC (--345---) close braille bracket
237 ED (--34-6--) underscript indicator
238 EE (--3-56--) start math word indicator
239 EF (--3456--) Number indicator (6 dot code)
240 F0 (---4----) Accent mark
241 F1 (--3--6-8) ellipses sign
242 F2 (--34-6-8) dagger, transpose sign
243 F3 (--3-56-8) left arrow sign
244 F4 (--3456-8) UK pound
245 F5 (-234-6--) two dimensional array indicator
246 F6 (1----6--) simple fraction line indicator
247 F7 (-23-56--) contraction indicator.
248 F8 (-23456--) close fraction indicator
249 F9 (-234-6-8) end of two dimensional array
250 FA (-23-56-8) approximately equals sign, single tilde over single bar.
251 FB (1234-6--) Large symbol indicator.
252 FC (123-56--) open fraction indicator
253 FD (123456--) quantity indicator
254 FE (------7-) prime mark
255 FF (---4--7-) script font symbol indicator

35
etc/mkinstalldirs Executable file
View file

@ -0,0 +1,35 @@
#!/bin/sh
# Make directory hierarchy.
# Written by Noah Friedman <friedman@prep.ai.mit.edu>
# Public domain.
defaultIFS='
'
IFS="${IFS-${defaultIFS}}"
errstatus=0
for file in ${1+"$@"} ; do
oIFS="${IFS}"
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo ${file} | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS="${oIFS}"
pathcomp=''
for d in ${1+"$@"} ; do
pathcomp="${pathcomp}${d}"
if test ! -d "${pathcomp}"; then
echo "mkdir $pathcomp" 1>&2
mkdir "${pathcomp}" || errstatus=$?
fi
pathcomp="${pathcomp}/"
done
done
exit $errstatus
# eof

64
etc/newsyntax Executable file
View file

@ -0,0 +1,64 @@
#!/bin/sh
#
# newsyntax -- update a screenrc file from 3.2 to 3.3 syntax
#
# please check all comments after running this script and watch out
# for funny passages.
#
if [ $# != 1 ]; then
echo "usage $0 screenrcfile"
exit 1;
fi
#Ultrix 4.2 /bin/sh does not handle "read a < $1"
#Dean Gaudet <dgaudet@watdragon.uwaterloo.ca>
exec < $1
read a
if [ ."$a" = '.#3.3' ]; then
echo "$1 already updated"
exit 0
fi
cp $1 $1.old
echo "#3.3" > $1
echo "# Do not remove the above line. This screen rc file was updated" >> $1
echo "# by the newsyntax script." >> $1
sed < $1.old >> $1 \
-e 's/\([ #]\)flow/\1defflow/g' \
-e 's/^flow/defflow/g' \
-e 's/\([ #]\)set[ ]*defflow/\1flow/g' \
-e 's/^set[ ]*defflow/flow/g' \
-e 's/\([ #]\)mode/\1defmode/g' \
-e 's/^mode/defmode/g' \
-e 's/\([ #]\)set[ ]*defmode/\1defmode/g' \
-e 's/^set[ ]*defmode/defmode/g' \
-e 's/\([ #]\)monitor/\1defmonitor/g' \
-e 's/^monitor/defmonitor/g' \
-e 's/\([ #]\)set[ ]*defmonitor/\1monitor/g' \
-e 's/^set[ ]*defmonitor/monitor/g' \
-e 's/\([ #]\)login/\1deflogin/g' \
-e 's/^login/deflogin/g' \
-e 's/\([ #]\)set[ ]*deflogin/\1login/g' \
-e 's/^set[ ]*deflogin/login/g' \
-e 's/\([ #]\)wrap/\1defwrap/g' \
-e 's/^wrap/defwrap/g' \
-e 's/\([ #]\)set[ ]*defwrap/\1wrap/g' \
-e 's/^set[ ]*defwrap/wrap/g' \
-e 's/\([ #]\)scrollback/\1defscrollback/g' \
-e 's/^scrollback/defscrollback/g' \
-e 's/\([ #]\)set[ ]*defscrollback/\1scrollback/g' \
-e 's/^set[ ]*defscrollback/scrollback/g' \
-e 's/\([ #]\)refresh/\1allPARtial/g' \
-e 's/^refresh/allPARtial/g' \
-e 's/\([ #]\)redraw/\1allPARtial/g' \
-e 's/^redraw/allPARtial/g' \
-e 's/\([ #]\)set[ ]*allPARtial/\1PARtial/g' \
-e 's/^set[ ]*allPARtial/PARtial/g' \
-e 's/\([ #]\)visualbell/\1vbell/g' \
-e 's/^visualbell/vbell/g' \
-e 's/PARtial\([ ]*\)on/partial\1off/g' \
-e 's/PARtial\([ ]*\)off/partial\1on/g' \
-e 's/allPARtial/refresh/g' \
-e 's/^set[ ]//g'

71
etc/newsyntax38 Executable file
View file

@ -0,0 +1,71 @@
#! /bin/sh
#
# newsyntax38 -- update a screenrc file from 3.3 to 3.8 syntax
#
# Please bring your scripts up to syntax level 3.3 before running this script.
# Please check all comments after running this script and watch out
# for funny passages.
#
# * aka and shellaka are replaced by title and shelltitle.
#
# * Pairs of termcap and terminfo commands are folded into a single
# termcapinfo command where possible.
#
# * trailing blanks are zapped. Unintentionally.
#
# 12.10.95, jnweiger, use at your own risk.
#
if [ $# != 1 ]; then
echo "usage $0 screenrcfile"
echo ""
echo "The named file will be updated in place to the syntax of screen 3.8"
echo "A backup copy will be written to <screenrcfile>.bak"
exit 1;
fi
#Ultrix 4.2 /bin/sh does not handle "read a < $1"
#Dean Gaudet <dgaudet@watdragon.uwaterloo.ca>
exec < $1
read a
if [ "$a" = "#3.8" ]; then
echo "$1 already updated"
exit 0
fi
rm -f $1.old $1.dups
cp $1 $1.old
echo "#3.8" > $1
echo "# Do not remove the above line. This screen rc file was updated" >> $1
echo "# by the newsyntax script." >> $1
# termcap and terminfo lines can only be folded when there is no parameter
# expansion in the codes. Parameters are denoted differently in
# termcap and termcap syntax. Everything else is identical, I assume.
# Thus codes not containing '%' can be savely folded.
sed < $1.old > $1.dups \
-e 's/^\([ #]*\)aka/\1title/' \
-e 's/^\([ #]*\)shellaka/\1shelltitle/' \
-e 's/^\([ #]*\)termcap[ ][ ]*\([^%]*$\)/\1termcapinfo \2/' \
-e 's/^\([ #]*\)terminfo[ ][ ]*\([^%]*$\)/\1termcapinfo \2/' \
-e 's/\\/\\\\/g'
# Oh, my bourne shell seems to gobble backslashes while reading.
# Thus the sed above duplicates them in advance.
# Hope this is not just another silly bash featureism.
# It still zaps trailing blanks. I do not know why. But that is nice.
exec < $1.dups
while read a ; do
if [ "$a" = "$b" ]; then
case "$a" in
*termcapinfo*) continue ;;
esac
fi
echo "$a" >> $1
b="$a"
done
rm -f $1.dups

153
etc/screenrc Normal file
View file

@ -0,0 +1,153 @@
#
# Example of a user's .screenrc file
#
# This is how one can set a reattach password:
# password ODSJQf.4IJN7E # "1234"
# no annoying audible bell, please
vbell on
# detach on hangup
autodetach on
# don't display the copyright page
startup_message off
# emulate .logout message
pow_detach_msg "Screen session of \$LOGNAME \$:cr:\$:nl:ended."
# advertise hardstatus support to $TERMCAP
# termcapinfo * '' 'hs:ts=\E_:fs=\E\\:ds=\E_\E\\'
# make the shell in every window a login shell
#shell -$SHELL
# autoaka testing
# shellaka '> |tcsh'
# shellaka '$ |sh'
# set every new windows hardstatus line to somenthing descriptive
# defhstatus "screen: ^En (^Et)"
defscrollback 1000
# don't kill window after the process died
# zombie "^["
# enable support for the "alternate screen" capability in all windows
# altscreen on
################
#
# xterm tweaks
#
#xterm understands both im/ic and doesn't have a status line.
#Note: Do not specify im and ic in the real termcap/info file as
#some programs (e.g. vi) will not work anymore.
termcap xterm hs@:cs=\E[%i%d;%dr:im=\E[4h:ei=\E[4l
terminfo xterm hs@:cs=\E[%i%p1%d;%p2%dr:im=\E[4h:ei=\E[4l
#80/132 column switching must be enabled for ^AW to work
#change init sequence to not switch width
termcapinfo xterm Z0=\E[?3h:Z1=\E[?3l:is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l
# Make the output buffer large for (fast) xterms.
#termcapinfo xterm* OL=10000
termcapinfo xterm* OL=100
# tell screen that xterm can switch to dark background and has function
# keys.
termcapinfo xterm 'VR=\E[?5h:VN=\E[?5l'
termcapinfo xterm 'k1=\E[11~:k2=\E[12~:k3=\E[13~:k4=\E[14~'
termcapinfo xterm 'kh=\EOH:kI=\E[2~:kD=\E[3~:kH=\EOF:kP=\E[5~:kN=\E[6~'
# special xterm hardstatus: use the window title.
termcapinfo xterm 'hs:ts=\E]2;:fs=\007:ds=\E]2;screen\007'
#terminfo xterm 'vb=\E[?5h$<200/>\E[?5l'
termcapinfo xterm 'vi=\E[?25l:ve=\E[34h\E[?25h:vs=\E[34l'
# emulate part of the 'K' charset
termcapinfo xterm 'XC=K%,%\E(B,[\304,\\\\\326,]\334,{\344,|\366,}\374,~\337'
# xterm-52 tweaks:
# - uses background color for delete operations
termcapinfo xterm* be
################
#
# wyse terminals
#
#wyse-75-42 must have flow control (xo = "terminal uses xon/xoff")
#essential to have it here, as this is a slow terminal.
termcapinfo wy75-42 xo:hs@
# New termcap sequences for cursor application mode.
termcapinfo wy* CS=\E[?1h:CE=\E[?1l:vi=\E[?25l:ve=\E[?25h:VR=\E[?5h:VN=\E[?5l:cb=\E[1K:CD=\E[1J
################
#
# other terminals
#
# make hp700 termcap/info better
termcapinfo hp700 'Z0=\E[?3h:Z1=\E[?3l:hs:ts=\E[62"p\E[0$~\E[2$~\E[1$}:fs=\E[0}\E[61"p:ds=\E[62"p\E[1$~\E[61"p:ic@'
# Extend the vt100 desciption by some sequences.
termcap vt100* ms:AL=\E[%dL:DL=\E[%dM:UP=\E[%dA:DO=\E[%dB:LE=\E[%dD:RI=\E[%dC
terminfo vt100* ms:AL=\E[%p1%dL:DL=\E[%p1%dM:UP=\E[%p1%dA:DO=\E[%p1%dB:LE=\E[%p1%dD:RI=\E[%p1%dC
termcapinfo linux C8
# old rxvt versions also need this
# termcapinfo rxvt C8
################
#
# keybindings
#
#remove some stupid / dangerous key bindings
bind k
bind ^k
bind .
bind ^\
bind \\
bind ^h
bind h
#make them better
bind 'K' kill
bind 'I' login on
bind 'O' login off
bind '}' history
# Yet another hack:
# Prepend/append register [/] to the paste if ^a^] is pressed.
# This lets me have autoindent mode in vi.
register [ "\033:se noai\015a"
register ] "\033:se ai\015a"
bind ^] paste [.]
################
#
# default windows
#
# screen -t local 0
# screen -t mail 1 mutt
# screen -t 40 2 rlogin server
# caption always "%3n %t%? @%u%?%? [%h]%?%=%c"
# hardstatus alwaysignore
# hardstatus alwayslastline "%Lw"
# bind = resize =
# bind + resize +1
# bind - resize -1
# bind _ resize max
#
# defnonblock 1
# blankerprg rain -d 100
# idle 30 blanker

44
etc/toolcheck Executable file
View file

@ -0,0 +1,44 @@
#!/bin/sh
# toolcheck -- check for tools that have severe bugs. Good that all the buggy
# tools identify by version numbers. This is the spirit of GNU :-)
#
# 24.7.95 jw.
retval=0
reply="`sh -version 2>&1 < /dev/null | sed q`"
case "$reply" in
GNU*1.14.3*)
echo "- sh is '$reply'";
echo " CAUTION: This shell has a buggy 'trap' command.";
echo " The configure script may fail silently.";
retval=1;
;;
GNU*1.14.2*|GNU*1.14.4*|GNU*1.13.*)
echo "- sh is '$reply' - good.";
;;
GNU*) echo "- sh is '$reply'.";
;;
*) ;;
esac
reply="`sed --version 2>&1 < /dev/null | sed q`"
case "$reply" in
GNU\ sed\ version\ 2.0[34])
echo "- sed is '$reply'";
echo " CAUTION: This sed cannot configure screen properly."
retval=1;
;;
GNU\ sed\ version\ 2.05|GNU\ sed\ version\ 2.03\ kevin)
echo "- sed is '$reply' - good.";
;;
GNU*) echo "- sed is '$reply'.";
;;
*) ;;
esac
if [ "$retval" != 0 ]; then
echo " ***********************************************************"
echo " Please fix the above problem before reporting a screen bug!"
echo " ***********************************************************"
fi
exit $retval

260
etc/us-braille.tbl Normal file
View file

@ -0,0 +1,260 @@
# U.S. BRAILLE TABLE
#
# Dec Hex Braille Description
# ------------------------------------------------------------------------
0 00 (---4--78) NUL
1 01 (1-----78) SOH
2 02 (12----78) STX
3 03 (1--4--78) ETX
4 04 (1--45-78) EOT
5 05 (1---5-78) ENQ
6 06 (12-4--78) ACK
7 07 (12-45-78) BEL
8 08 (12--5-78) BS
9 09 (-2-4--78) HT
10 OA (-2-45-78) LF
11 0B (1-3---78) VT
12 OC (123---78) FF
13 0D (1-34--78) CR
14 0E (1-345-78) SO
15 OF (1-3-5-78) SI
16 10 (1234--78) DLE
17 11 (12345-78) DC1
18 12 (123-5-78) DC2
19 13 (-234--78) DC3
20 14 (-2345-78) DC4
21 15 (1-3--678) NAK
22 16 (123--678) SYN
23 17 (-2-45678) ETB
24 18 (1-34-678) CAN
25 19 (1-345678) EM
26 1A (1-3-5678) SUB
27 lB (-2-4-678) ESC
28 lC (12--5678) FS
29 1D (12-45678) GS
30 lE (---45-78) RS
31 1F (---45678) US
32 20 (--------) Space
33 21 (-234-6--) !
34 22 (----5---) "
35 23 (--3456--) #
36 24 (12-4-6--) $
37 25 (1--4-6--) %
38 26 (1234-6--) &
39 27 (--3-----) '
40 28 (123-56--) (
41 29 (-23456--) )
42 2A (1----6--) *
43 2B (--34-6--) +
44 2C (-----6--) ,
45 2D (--3--6--) -
46 2E (---4-6--) .
47 2F (--34----) /
48 30 (--3-56--) 0
49 31 (-2------) 1
50 32 (-23-----) 2
51 33 (-2--5---) 3
52 34 (-2--56--) 4
53 35 (-2---6--) 5
54 36 (-23-5---) 6
55 37 (-23-56--) 7
56 38 (-23--6--) 8
57 39 (--3-5---) 9
58 3A (1---56--) :
59 3B (----56--) ;
60 3C (12---6--) <
61 3D (123456--) -
62 3E (--345---) >
63 3F (1--456--) ?
64 40 (---4--7-) @
65 41 (1-----7-) A
66 42 (12----7-) B
67 43 (1--4--7-) C
68 44 (1--45-7-) D
69 45 (1---5-7-) E
70 46 (12-4--7-) F
71 47 (12-45-7-) G
72 48 (12--5-7-) H
73 49 (-2-4--7-) I
74 4A (-2-45-7-) J
75 4B (1-3---7-) K
76 4C (123---7-) L
77 4D (1-34--7-) M
78 4E (1-345-7-) N
79 4F (1-3-5-7-) O
80 50 (1234--7-) P
81 51 (12345-7-) Q
82 52 (123-5-7-) R
83 53 (-234--7-) S
84 54 (-2345-7-) T
85 55 (1-3--67-) U
86 56 (123--67-) V
87 57 (-2-4567-) W
88 58 (1-34-67-) X
89 59 (1-34567-) Y
90 5A (1-3-567-) Z
91 5B (-2-4-67-) [
92 5C (12--567-) \
93 5D (12-4567-) ]
94 5E (---45-7-) ^
95 5F (---4567-) _
96 60 (---4----) '
97 61 (1-------) a
98 62 (12------) b
99 63 (1--4----) c
100 64 (1--45---) d
101 65 (1---5---) e
102 66 (12-4----) f
103 67 (12-45---) g
104 68 (12--5---) h
105 69 (-2-4----) i
106 6A (-2-45---) j
107 6B (1-3-----) k
108 6C (123-----) l
109 6D (1-34----) m
110 6E (1-345---) n
111 6F (1-3-5---) o
112 70 (1234----) p
113 71 (12345---) q
114 72 (123-5---) r
115 73 (-234----) s
116 74 (-2345---) t
117 75 (1-3--6--) u
118 76 (123--6--) v
119 77 (-2-456--) w
120 78 (1-34-6--) x
121 79 (1-3456--) y
122 7A (1-3-56--) z
123 7B (-2-4-6--) {
124 7C (12--56--) |
125 7D (12-456--) }
126 7E (---45---) ~
127 7F (---456--) DEL
128 80 (---4---8) C Cedilla (upper case)
129 81 (1------8) u Umlaut (lower case)
130 82 (12-----8) e Acute (lower case)
131 83 (1--4---8) a Circumflex
132 84 (1--45--8) a Umlaut (lower case)
133 85 (1---5--8) a Grave
134 86 (12-4---8) a Ring (lower case)
135 87 (12-45--8) c Cedilla (lower case)
136 88 (12--5--8) e Circumflex
137 89 (-2-4---8) e Umlaut (lower case)
138 8A (--2-45-8) e Grave
139 8B (1-3----8) i Umlaut (lower case)
140 8C (123----8) i Circumflex
141 8D (1-34---8) I Grave
142 8E (1-345--8) A Umlaut (upper case)
143 8F (1-3-5--8) A Ring (upper case)
144 90 (1234---8) E Acute (upper case)
145 91 (12345--8) ae Digraph (lower case)
146 92 (123-5--8) AE Digraph (upper case)
147 93 (-234---8) o Circumflex
148 94 (-2345--8) o Umlaut (lower case)
149 95 (1-3--6-8) o Grave
150 96 (123--6-8) u Circumflex
151 97 (-2-456-8) u Grave
152 98 (1-34-6-8) y Umlaut
153 99 (1-3456-8) O Umlaut (upper case)
154 9A (1-3-56-8) U Umlaut (upper case)
155 9B (-2-4-6-8) Cent
156 9C (12--56-8) Pound/Sterling
157 9D (12-456-8) Yen
158 9E (---45--8) Peseta
159 9F (---456-8) Franc
160 A0 (------7-) a Acute (lower case)
161 Al (-234-67-) i Acute (lower case)
162 A2 (----5-7-) o Acute (lower case)
163 A3 (--34567-) u Acute (lower case)
164 A4 (12-4-67-) n Tilde (lower case)
165 A5 (1--4-67-) N Tilde (upper case)
166 A6 (1234-67-) Feminine Spanish Ordinal
167 A7 (--3---7-) Masculine Spanish Ordinal
168 A8 (123-567-) Inverted Question Mark
169 A9 (-234567-) Left square corner
170 AA (1----67-) Right square corner
171 AB (--34-67-) 1/2
172 AC (-----67-) 1/4
173 AD (--3--67-) Inverted Exclamation Mark
174 AE (---4-67-) Left Double Guillemet
175 AF (--34--7-) Right Double Guillemet
176 B0 (--3-567-) Box [Shade 1]
177 B1 (-2----7-) Box [Shade 2]
178 B2 (-23---7-) Box [Shade 3]
179 B3 (-2--5-7-) Box [top bottom]
180 B4 (-2--567-) Box [left top bottom]
181 B5 (-2---67-) Box [LEFT top bottom]
182 B6 (-23-5-7-) Box [left TOP BOTTOM]
183 B7 (-23-567-) Box [left BOTTOM]
184 B8 (-23--67-) Box [LEFT bottom]
185 B9 (--3-5-7-) Box [LEFT TOP BOTTOM]
186 BA (1---567-) Box [TOP BOTTOM]
187 BB (----567-) Box [LEFT BOTTOM]
188 BC (12---67-) Box [LEFT TOP]
189 BD (1234567-) Box [left TOP]
190 BE (--345-7-) Box [LEFT top]
191 BF (1--4567-) Box [left bottom]
192 CO (------78) Box [top right]
193 C1 (-234-678) Box [left top right]
194 C2 (----5-78) Box [left right bottom]
195 C3 (--345678) Box [top right bottom]
196 C4 (12-4-678) Box [left right]
197 C5 (1--4-678) Box [left top right bottom]
198 C6 (1234-678) Box [top RIGHT bottom]
199 C7 (--3---78) Box [TOP right BOTTOM]
200 C8 (123-5678) Box [TOP RIGHT]
201 C9 (-2345678) Box [RIGHT BOTTOM]
202 CA (1----678) Box [LEFT TOP RIGHT]
203 CB (--34-678) Box [LEFT RIGHT BOTTOM]
204 CC (-----678) Box [TOP RIGHT BOTTOM]
205 CD (--3--678) Box [LEFT RIGHT]
206 CE (---4-678) Box [LEFT TOP RIGHT BOTTOM]
207 CF (--34--78) Box [LEFT top RIGHT]
208 DO (--3-5678) Box [left TOP right]
209 D1 (-2----78) Box [LEFT RIGHT bottom]
210 D2 (-23---78) Box [left right BOTTOM]
211 D3 (-2--5-78) Box [TOP right]
212 D4 (-2--5678) Box [top RIGHT]
213 D5 (-2---678) Box [RIGHT bottom]
214 D6 (-23-5-78) Box [right BOTTOM]
215 D7 (-23-5678) Box [left TOP right BOTTOM]
216 D8 (-23--678) Box [LEFT top RIGHT bottom]
217 D9 (--3-5-78) Box [left top]
218 DA (1---5678) Box [right bottom]
219 DB (----5678) Box [Shade 4]
220 DC (12---678) Box [box bottom]
221 DD (12345678) Box [box right]
222 DE (--345-78) Box [box left]
223 DF (1--45678) Box [box top]
224 E0 (-------8) Alpha (lower case)
225 E1 (-234-6-8) Beta (lower case)
226 E2 (----5--8) Gamma (upper case)
227 E3 (--3456-8) Pi (lower case)
228 E4 (12-4-6-8) Sigma (upper case)
229 E5 (1--4-6-8) Sigma (lower case)
230 E6 (1234-6-8) Mu (lower case)
231 E7 (--3----8) Tau (lower case)
232 E8 (123-56-8) Phi (upper case)
233 E9 (-23456-8) Theta (lower case)
234 EA (1----6-8) Omega (upper case)
235 EB (--34-6-8) Delta (lower case)
236 EC (-----6-8) infinity
237 ED (--3--6-8) Phi (lower case)
238 EE (---4-6-8) Epsilon (lower case)
239 EF (--34---8) Intersection
240 F0 (--3-56-8) Equivalent (Member)
241 F1 (-2-----8) Plus or minus
242 F2 (-23----8) Greater than or equal
243 F3 (-2--5--8) Less than or equal
244 F4 (-2--56-8) Integral [top]
245 F5 (-2---6-8) Integral [bottom]
246 F6 (-23-5--8) Division
247 F7 (-23-56-8) Approximately equal
248 F8 (-23--6-8) Small circle
249 F9 (--3-5--8) Bullet
250 FA (1---56-8) Small bullet
251 FB (----56-8) Bent Radical
252 FC (12---6-8) Power of n
253 FD (123456-8) Power of 2
254 FE (--345--8) Large square bullet
255 FF (1--456-8) blank (hard space)

514
extern.h Normal file
View file

@ -0,0 +1,514 @@
/* Copyright (c) 2008, 2009
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Micah Cowan (micah@cowan.name)
* Sadrul Habib Chowdhury (sadrul@users.sourceforge.net)
* Copyright (c) 1993-2002, 2003, 2005, 2006, 2007
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
*
* 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 3, 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 (see the file COPYING); if not, see
* https://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*
****************************************************************
* $Id$ GNU
*/
#if !defined(__GNUC__) || __GNUC__ < 2
#undef __attribute__
#define __attribute__(x)
#endif
#include <stdbool.h>
/* screen.c */
extern int main __P((int, char **));
extern sigret_t SigHup __P(SIGPROTOARG);
extern void eexit __P((int)) __attribute__((__noreturn__));
extern void Detach __P((int));
extern void Hangup __P((void));
extern void Kill __P((int, int));
#ifdef USEVARARGS
extern void Msg __P((int, const char *, ...)) __attribute__((format(printf, 2, 3)));
extern void Panic __P((int, const char *, ...)) __attribute__((format(printf, 2, 3))) __attribute__((__noreturn__));
extern void QueryMsg __P((int, const char *, ...)) __attribute__((format(printf, 2, 3)));
extern void Dummy __P((int, const char *, ...)) __attribute__((format(printf, 2, 3)));
#else
extern void Msg __P(());
extern void Panic __P(());
extern void QueryMsg __P(());
extern void Dummy __P(());
#endif
extern void Finit __P((int));
extern void MakeNewEnv __P((void));
extern char *MakeWinMsg __P((char *, struct win *, int));
extern char *MakeWinMsgEv __P((char *, struct win *, int, int, struct event *, int));
extern int AddWinMsgRend __P((const char *, int));
extern void PutWinMsg __P((char *, int, int));
#ifdef BSDWAIT
extern void WindowDied __P((struct win *, union wait, int));
#else
extern void WindowDied __P((struct win *, int, int));
#endif
extern void setbacktick __P((int, int, int, char **));
/* ansi.c */
extern void ResetAnsiState __P((struct win *));
extern void ResetWindow __P((struct win *));
extern void ResetCharsets __P((struct win *));
extern void WriteString __P((struct win *, char *, int));
extern void ChangeAKA __P((struct win *, char *, int));
extern void SetCharsets __P((struct win *, char *));
extern int GetAnsiStatus __P((struct win *, char *));
extern void WNewAutoFlow __P((struct win *, int));
extern void WBell __P((struct win *, int));
extern void WMsg __P((struct win *, int, char *));
extern void WChangeSize __P((struct win *, int, int));
extern void WindowChanged __P((struct win *, int));
extern int MFindUsedLine __P((struct win *, int, int));
/* fileio.c */
extern int StartRc __P((char *, int));
extern void FinishRc __P((char *));
extern void RcLine __P((char *, int));
extern FILE *secfopen __P((char *, char *));
extern int secopen __P((char *, int, int));
extern void WriteFile __P((struct acluser *, char *, int));
extern char *ReadFile __P((char *, int *));
extern void KillBuffers __P((void));
extern int printpipe __P((struct win *, char *));
extern int readpipe __P((char **));
extern void RunBlanker __P((char **));
extern void do_source __P((char *));
/* tty.c */
extern int OpenTTY __P((char *, char *));
extern void InitTTY __P((struct mode *, int));
extern void GetTTY __P((int, struct mode *));
extern void SetTTY __P((int, struct mode *));
extern void SetMode __P((struct mode *, struct mode *, int, int));
extern void SetFlow __P((int));
extern void SendBreak __P((struct win *, int, int));
extern int TtyGrabConsole __P((int, int, char *));
extern char *TtyGetModemStatus __P((int, char *));
#ifdef DEBUG
extern void DebugTTY __P((struct mode *));
#endif /* DEBUG */
extern int fgtty __P((int));
extern void brktty __P((int));
extern struct baud_values *lookup_baud __P((int bps));
extern int SetBaud __P((struct mode *, int, int));
extern int SttyMode __P((struct mode *, char *));
extern int CheckTtyname __P((char *));
extern char *GetPtsPathOrSymlink __P((int));
/* mark.c */
extern int GetHistory __P((void));
extern void MarkRoutine __P((void));
extern void revto_line __P((int, int, int));
extern void revto __P((int, int));
extern int InMark __P((void));
extern void MakePaster __P((struct paster *, char *, int, int));
extern void FreePaster __P((struct paster *));
/* search.c */
extern void Search __P((int));
extern void ISearch __P((int));
/* input.c */
extern void inp_setprompt __P((char *, char *));
extern void Input __P((char *, int, int, void (*)(char *, int, char *), char *, int));
extern int InInput __P((void));
/* help.c */
extern void exit_with_usage __P((char *, char *, char *));
extern void display_help __P((char *, struct action *));
extern void display_copyright __P((void));
extern void display_displays __P((void));
extern void display_bindkey __P((char *, struct action *));
extern int InWList __P((void));
extern void WListUpdatecv __P((struct canvas *, struct win *));
extern void WListLinkChanged __P((void));
#ifdef ZMODEM
extern void ZmodemPage __P((void));
#endif
/* window.c */
extern int MakeWindow __P((struct NewWindow *));
extern int RemakeWindow __P((struct win *));
extern void FreeWindow __P((struct win *));
#ifdef PSEUDOS
extern int winexec __P((char **));
extern void FreePseudowin __P((struct win *));
#endif
extern void nwin_compose __P((struct NewWindow *, struct NewWindow *, struct NewWindow *));
extern int DoStartLog __P((struct win *, char *, int));
extern int ReleaseAutoWritelock __P((struct display *, struct win *));
extern int ObtainAutoWritelock __P((struct display *, struct win *));
extern void CloseDevice __P((struct win *));
#ifdef ZMODEM
extern void zmodem_abort __P((struct win *, struct display *));
#endif
#ifndef HAVE_EXECVPE
extern void execvpe __P((char *, char **, char **));
#endif
/* utmp.c */
#ifdef UTMPOK
extern void InitUtmp __P((void));
extern void RemoveLoginSlot __P((void));
extern void RestoreLoginSlot __P((void));
extern int SetUtmp __P((struct win *));
extern int RemoveUtmp __P((struct win *));
#endif /* UTMPOK */
extern void SlotToggle __P((int));
#ifdef USRLIMIT
extern int CountUsers __P((void));
#endif
#ifdef CAREFULUTMP
extern void CarefulUtmp __P((void));
#else
# define CarefulUtmp() /* nothing */
#endif /* CAREFULUTMP */
/* loadav.c */
#ifdef LOADAV
extern void InitLoadav __P((void));
extern void AddLoadav __P((char *));
#endif
/* pty.c */
extern int OpenPTY __P((char **));
extern void InitPTY __P((int));
/* process.c */
extern void InitKeytab __P((void));
extern void ProcessInput __P((char *, int));
#ifdef MAPKEYS
extern void ProcessInput2 __P((char *, int));
#endif
extern void DoProcess __P((struct win *, char **, int *, struct paster *));
extern void DoAction __P((struct action *, int));
extern int FindCommnr __P((const char *));
extern void DoCommand __P((char **, int *));
extern void Activate __P((int));
extern void KillWindow __P((struct win *));
extern void SetForeWindow __P((struct win *));
extern int Parse __P((char *, int, char **, int *));
extern void SetEscape __P((struct acluser *, int, int));
extern void DoScreen __P((char *, char **));
extern int IsNumColon __P((char *, int, char *, int));
extern void ShowWindows __P((int));
extern char *AddWindows __P((char *, int, int, int));
extern char *AddWindowFlags __P((char *, int, struct win *));
extern char *AddOtherUsers __P((char *, int, struct win *));
extern int WindowByNoN __P((char *));
extern struct win *FindNiceWindow __P((struct win *, char *));
#ifdef COPY_PASTE
extern int CompileKeys __P((char *, int, unsigned char *));
#endif
#ifdef RXVT_OSC
extern void RefreshXtermOSC __P((void));
#endif
extern int ParseSaveStr __P((struct action *act, char **));
extern int ParseNum __P((struct action *act, int *));
extern int ParseSwitch __P((struct action *, int *));
extern int ParseAttrColor __P((char *, char *, int));
extern void ApplyAttrColor __P((int, struct mchar *));
extern void SwitchWindow __P((int));
extern int StuffKey __P((int));
/* termcap.c */
extern int InitTermcap __P((int, int));
extern char *MakeTermcap __P((int));
extern void DumpTermcap __P((int, FILE *));
extern char *gettermcapstring __P((char *));
#ifdef MAPKEYS
extern int remap __P((int, int));
extern void CheckEscape __P((void));
#endif
extern int CreateTransTable __P((char *));
extern void FreeTransTable __P((void));
/* attacher.c */
extern int Attach __P((int));
extern void Attacher __P((void));
extern sigret_t AttacherFinit __P(SIGPROTOARG);
extern void SendCmdMessage __P((char *, char *, char **, int));
/* display.c */
extern struct display *MakeDisplay __P((char *, char *, char *, int, int, struct mode *));
extern void FreeDisplay __P((void));
extern void DefProcess __P((char **, int *));
extern void DefRedisplayLine __P((int, int, int, int));
extern void DefClearLine __P((int, int, int, int));
extern int DefRewrite __P((int, int, int, struct mchar *, int));
extern int DefResize __P((int, int));
extern void DefRestore __P((void));
extern void AddCStr __P((char *));
extern void AddCStr2 __P((char *, int));
extern void InitTerm __P((int));
extern void FinitTerm __P((void));
extern void PUTCHAR __P((int));
extern void PUTCHARLP __P((int));
extern void ClearAll __P((void));
extern void ClearArea __P((int, int, int, int, int, int, int, int));
extern void ClearLine __P((struct mline *, int, int, int, int));
extern void RefreshAll __P((int));
extern void RefreshArea __P((int, int, int, int, int));
extern void RefreshLine __P((int, int, int, int));
extern void Redisplay __P((int));
extern void RedisplayDisplays __P((int));
extern void ShowHStatus __P((char *));
extern void RefreshHStatus __P((void));
extern void DisplayLine __P((struct mline *, struct mline *, int, int, int));
extern void GotoPos __P((int, int));
extern int CalcCost __P((char *));
extern void ScrollH __P((int, int, int, int, int, struct mline *));
extern void ScrollV __P((int, int, int, int, int, int));
extern void PutChar __P((struct mchar *, int, int));
extern void InsChar __P((struct mchar *, int, int, int, struct mline *));
extern void WrapChar __P((struct mchar *, int, int, int, int, int, int, int));
extern void ChangeScrollRegion __P((int, int));
extern void InsertMode __P((int));
extern void KeypadMode __P((int));
extern void CursorkeysMode __P((int));
extern void ReverseVideo __P((int));
extern void CursorVisibility __P((int));
extern void MouseMode __P((int));
extern void ExtMouseMode __P((int));
extern void SetFont __P((int));
extern void SetAttr __P((int));
extern void SetColor __P((int, int));
extern void SetRendition __P((struct mchar *));
extern void SetRenditionMline __P((struct mline *, int));
extern void MakeStatus __P((char *));
extern void RemoveStatus __P((void));
extern int ResizeDisplay __P((int, int));
extern void AddStr __P((char *));
extern void AddStrn __P((char *, int));
extern void Flush __P((int));
extern void freetty __P((void));
extern void Resize_obuf __P((void));
#ifdef AUTO_NUKE
extern void NukePending __P((void));
#endif
#ifdef RXVT_OSC
extern void ClearAllXtermOSC __P((void));
extern void SetXtermOSC __P((int, char *, char *));
#endif
#ifdef COLOR
extern int color256to16 __P((int));
# ifdef COLORS256
extern int color256to88 __P((int));
# endif
#endif
extern void ResetIdle __P((void));
extern void KillBlanker __P((void));
extern void DisplaySleep1000 __P((int, int));
/* resize.c */
extern int ChangeWindowSize __P((struct win *, int, int, int));
extern void ChangeScreenSize __P((int, int, int));
extern void CheckScreenSize __P((int));
extern char *xrealloc __P((char *, int));
extern void ResizeLayersToCanvases __P((void));
extern void ResizeLayer __P((struct layer *, int, int, struct display *));
extern int MayResizeLayer __P((struct layer *));
extern void FreeAltScreen __P((struct win *));
extern void EnterAltScreen __P((struct win *));
extern void LeaveAltScreen __P((struct win *));
/* sched.c */
extern void evenq __P((struct event *));
extern void evdeq __P((struct event *));
extern void SetTimeout __P((struct event *, int));
extern void sched __P((void));
/* socket.c */
extern int FindSocket __P((int *, int *, int *, char *, bool *));
extern int MakeClientSocket __P((int, bool));
extern int MakeServerSocket __P((bool));
extern int RecoverSocket __P((void));
extern int chsock __P((void));
extern void ReceiveMsg __P((void));
extern void SendCreateMsg __P((char *, struct NewWindow *));
extern int SendErrorMsg __P((char *, char *));
extern int SendAttachMsg __P((int, struct msg *, int));
extern void ReceiveRaw __P((int));
extern bool IsSocket __P((const char *));
/* misc.c */
extern char *SaveStr __P((const char *));
extern char *SaveStrn __P((const char *, int));
extern char *InStr __P((char *, const char *));
#ifndef HAVE_STRERROR
extern char *strerror __P((int));
#endif
extern void centerline __P((char *, int));
extern void leftline __P((char *, int, struct mchar *));
extern char *Filename __P((char *));
extern char *stripdev __P((char *));
#ifdef NEED_OWN_BCOPY
extern void xbcopy __P((char *, char *, int));
#endif
extern void bclear __P((char *, int));
extern void closeallfiles __P((int));
extern int UserContext __P((void));
extern void UserReturn __P((int));
extern int UserStatus __P((void));
#if defined(POSIX) || defined(hpux)
extern void (*xsignal __P((int, void (*)SIGPROTOARG))) __P(SIGPROTOARG);
#endif
#ifndef HAVE_RENAME
extern int rename __P((char *, char *));
#endif
#if defined(HAVE_SETEUID) || defined(HAVE_SETREUID)
extern void xseteuid __P((int));
extern void xsetegid __P((int));
#endif
extern int AddXChar __P((char *, int));
extern int AddXChars __P((char *, int, char *));
extern void xsetenv __P((char *, char *));
extern void sleep1000 __P((int));
#ifdef DEBUG
extern void opendebug __P((int, int));
#endif
#ifdef USEVARARGS
# ifndef HAVE_VSNPRINTF
extern int xvsnprintf __P((char *, int, char *, va_list));
# endif
#else
extern int xsnprintf __P(());
#endif
/* acl.c */
#ifdef MULTIUSER
extern int AclCheckPermWin __P((struct acluser *, int, struct win *));
extern int AclCheckPermCmd __P((struct acluser *, int, struct comm *));
extern int AclSetPerm __P((struct acluser *, struct acluser *, char *, char *));
extern int AclUmask __P((struct acluser *, char *, char **));
extern int UsersAcl __P((struct acluser *, int, char **));
extern void AclWinSwap __P((int, int));
extern int NewWindowAcl __P((struct win *, struct acluser *));
extern void FreeWindowAcl __P((struct win *));
extern char *DoSu __P((struct acluser **, char *, char *, char *));
extern int AclLinkUser __P((char *, char *));
#endif /* MULTIUSER */
extern int UserFreeCopyBuffer __P((struct acluser *));
extern struct acluser **FindUserPtr __P((char *));
extern int UserAdd __P((char *, char *, struct acluser **));
extern int UserDel __P((char *, struct acluser **));
/* braile.c */
#ifdef HAVE_BRAILLE
extern void InitBraille __P((void));
extern void RefreshBraille __P((void));
extern void DoBrailleAction __P((struct action *, int));
extern void BGotoPos __P((struct layer *, int, int));
extern void BPutChar __P((struct layer *, struct mchar *, int, int));
extern void BPutStr __P((struct layer *, char *, int, struct mchar *, int, int));
extern void BCDisplayLine __P((struct layer *, struct mline *, int, int, int, int));
#endif
/* layer.c */
extern void LGotoPos __P((struct layer *, int, int));
extern void LPutChar __P((struct layer *, struct mchar *, int, int));
extern void LInsChar __P((struct layer *, struct mchar *, int, int, struct mline *));
extern void LPutStr __P((struct layer *, char *, int, struct mchar *, int, int));
extern void LPutWinMsg __P((struct layer *, char *, int, struct mchar *, int, int));
extern void LScrollH __P((struct layer *, int, int, int, int, int, struct mline *));
extern void LScrollV __P((struct layer *, int, int, int, int));
extern void LClearAll __P((struct layer *, int));
extern void LClearArea __P((struct layer *, int, int, int, int, int, int));
extern void LClearLine __P((struct layer *, int, int, int, int, struct mline *));
extern void LRefreshAll __P((struct layer *, int));
extern void LCDisplayLine __P((struct layer *, struct mline *, int, int, int, int));
extern void LCDisplayLineWrap __P((struct layer *, struct mline *, int, int, int, int));
extern void LSetRendition __P((struct layer *, struct mchar *));
extern void LWrapChar __P((struct layer *, struct mchar *, int, int, int, int));
extern void LCursorVisibility __P((struct layer *, int));
extern void LSetFlow __P((struct layer *, int));
extern void LKeypadMode __P((struct layer *, int));
extern void LCursorkeysMode __P((struct layer *, int));
extern void LMouseMode __P((struct layer *, int));
extern void LExtMouseMode __P((struct layer *, int));
#if defined(USEVARARGS)
extern void LMsg __P((int, const char *, ...)) __attribute__((format(printf, 2, 3)));
#else
extern void LMsg __P(());
#endif
extern void KillLayerChain __P((struct layer *));
extern int InitOverlayPage __P((int, struct LayFuncs *, int));
extern void ExitOverlayPage __P((void));
extern int LayProcessMouse __P((struct layer *, unsigned char));
extern void LayProcessMouseSwitch __P((struct layer *, int));
/* teln.c */
#ifdef BUILTIN_TELNET
extern int TelOpenAndConnect __P((struct win *));
extern int TelIsline __P((struct win *p));
extern void TelProcessLine __P((char **, int *));
extern int DoTelnet __P((char *, int *, int));
extern int TelIn __P((struct win *, char *, int, int));
extern void TelBreak __P((struct win *));
extern void TelWindowSize __P((struct win *));
extern void TelStatus __P((struct win *, char *, int));
#endif
/* nethack.c */
extern const char *DoNLS __P((const char *));
/* encoding.c */
#ifdef ENCODINGS
# ifdef UTF8
extern void InitBuiltinTabs __P((void));
extern struct mchar *recode_mchar __P((struct mchar *, int, int));
extern struct mline *recode_mline __P((struct mline *, int, int, int));
extern int FromUtf8 __P((int, int *));
extern void AddUtf8 __P((int));
extern int ToUtf8 __P((char *, int));
extern int ToUtf8_comb __P((char *, int));
extern int utf8_isdouble __P((int));
extern int utf8_iscomb __P((int));
extern void utf8_handle_comb __P((int, struct mchar *));
extern int ContainsSpecialDeffont __P((struct mline *, int, int, int));
extern int LoadFontTranslation __P((int, char *));
extern void LoadFontTranslationsForEncoding __P((int));
# endif /* UTF8 */
extern void WinSwitchEncoding __P((struct win *, int));
extern int FindEncoding __P((char *));
extern char *EncodingName __P((int));
extern int EncodingDefFont __P((int));
extern void ResetEncoding __P((struct win *));
extern int CanEncodeFont __P((int, int));
extern int DecodeChar __P((int, int, int *));
extern int RecodeBuf __P((unsigned char *, int, int, int, unsigned char *));
# ifdef DW_CHARS
extern int PrepareEncodedChar __P((int));
# endif
#endif
extern int EncodeChar __P((char *, int, int, int *));
/* layout.c */
extern void RemoveLayout __P((struct layout *));
extern int LayoutDumpCanvas __P((struct canvas *, char *));

788
fileio.c Normal file
View file

@ -0,0 +1,788 @@
/* Copyright (c) 2008, 2009
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Micah Cowan (micah@cowan.name)
* Sadrul Habib Chowdhury (sadrul@users.sourceforge.net)
* Copyright (c) 1993-2002, 2003, 2005, 2006, 2007
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
*
* 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 3, 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 (see the file COPYING); if not, see
* https://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*
****************************************************************
*/
#include <sys/types.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <pwd.h>
#ifndef SIGINT
# include <signal.h>
#endif
#include "config.h"
#include "screen.h"
#include "extern.h"
extern struct display *display, *displays;
extern struct win *fore;
extern struct layer *flayer;
extern int ServerSocket;
extern int real_uid, eff_uid;
extern int real_gid, eff_gid;
extern char *extra_incap, *extra_outcap;
extern char *home, *RcFileName;
extern char SockPath[], *SockName;
#ifdef COPY_PASTE
extern char *BufferFile;
#endif
extern int hardcopy_append;
extern char *hardcopydir;
static char *CatExtra __P((char *, char *));
static char *findrcfile __P((char *));
char *rc_name = "";
int rc_recursion = 0;
static char *
CatExtra(register char *str1, register char *str2)
{
register char *cp;
register int len1, len2, add_colon;
len1 = strlen(str1);
if (len1 == 0)
return str2;
add_colon = (str1[len1 - 1] != ':');
if (str2) {
len2 = strlen(str2);
if ((cp = realloc(str2, (unsigned)len1 + len2 + add_colon + 1)) == NULL)
Panic(0, "%s", strnomem);
bcopy(cp, cp + len1 + add_colon, len2 + 1);
} else {
if ((cp = malloc((unsigned)len1 + add_colon + 1)) == NULL)
Panic(0, "%s", strnomem);
cp[len1 + add_colon] = '\0';
}
bcopy(str1, cp, len1);
if (add_colon)
cp[len1] = ':';
return cp;
}
static char *
findrcfile(char *rcfile)
{
char buf[256];
char *p;
/* Tilde prefix support courtesy <hesso@pool.math.tu-berlin.de>,
* taken from a Debian patch. */
if (rcfile && *rcfile == '~') {
static char rcfilename_tilde_exp[MAXPATHLEN + 1];
char *slash_position = strchr(rcfile, '/');
if (slash_position == rcfile + 1) {
char *home = getenv("HOME");
if (!home) {
Msg(0, "%s: source: tilde expansion failed", rc_name);
return NULL;
}
snprintf(rcfilename_tilde_exp, MAXPATHLEN, "%s/%s", home, rcfile + 2);
} else if (slash_position) {
struct passwd *p;
*slash_position = 0;
p = getpwnam(rcfile + 1);
if (!p) {
Msg(0, "%s: source: tilde expansion failed for user %s", rc_name, rcfile + 1);
return NULL;
}
snprintf(rcfilename_tilde_exp, MAXPATHLEN, "%s/%s", p->pw_dir, slash_position + 1);
} else {
Msg(0, "%s: source: illegal tilde expression.", rc_name);
return NULL;
}
rcfile = rcfilename_tilde_exp;
}
if (rcfile) {
char *rcend = rindex(rc_name, '/');
if (*rcfile != '/' && rcend && (rcend - rc_name) + strlen(rcfile) + 2 < sizeof(buf)) {
strncpy(buf, rc_name, rcend - rc_name + 1);
strcpy(buf + (rcend - rc_name) + 1, rcfile);
if (access(buf, R_OK) == 0)
return SaveStr(buf);
}
debug1("findrcfile: you specified '%s'\n", rcfile);
return SaveStr(rcfile);
}
debug("findrcfile: you specified nothing...\n");
if ((p = getenv("SCREENRC")) != NULL && *p != '\0') {
debug1(" $SCREENRC has: '%s'\n", p);
return SaveStr(p);
} else {
debug(" ...nothing in $SCREENRC, defaulting $HOME/.screenrc\n");
if (strlen(home) > sizeof(buf) - 12)
Panic(0, "Rc: home too large");
sprintf(buf, "%s/.screenrc", home);
return SaveStr(buf);
}
}
/*
* this will be called twice:
* 1) rcfilename = "/etc/screenrc"
* 2) rcfilename = RcFileName
*/
int
StartRc(char *rcfilename, int nopanic)
{
register int argc, len;
register char *p, *cp;
char buf[2048];
char *args[MAXARGS];
int argl[MAXARGS];
FILE *fp;
char *oldrc_name = rc_name;
/* always fix termcap/info capabilities */
extra_incap = CatExtra("TF", extra_incap);
/* Special settings for vt100 and others */
if (display && (!strncmp(D_termname, "vt", 2) || !strncmp(D_termname, "xterm", 5)))
extra_incap = CatExtra("xn:f0=\033Op:f1=\033Oq:f2=\033Or:f3=\033Os:f4=\033Ot:f5=\033Ou:f6=\033Ov:f7=\033Ow:f8=\033Ox:f9=\033Oy:f.=\033On:f,=\033Ol:fe=\033OM:f+=\033Ok:f-=\033Om:f*=\033Oj:f/=\033Oo:fq=\033OX", extra_incap);
rc_name = findrcfile(rcfilename);
if (rc_name == NULL || (fp = secfopen(rc_name, "r")) == NULL) {
const char *rc_nonnull = rc_name ? rc_name : rcfilename;
if (!rc_recursion && RcFileName && !strcmp(RcFileName, rc_nonnull)) {
/*
* User explicitly gave us that name,
* this is the only case, where we get angry, if we can't read
* the file.
*/
debug3("StartRc: '%s','%s', '%s'\n", RcFileName, rc_name ? rc_name : "(null)", rcfilename);
if (!nopanic)
Panic(0, "Unable to open \"%s\".", rc_nonnull);
/* possibly NOTREACHED */
}
debug1("StartRc: '%s' no good. ignored\n", rc_nonnull);
if (rc_name)
Free(rc_name);
rc_name = oldrc_name;
return 1;
}
while (fgets(buf, sizeof buf, fp) != NULL) {
if ((p = rindex(buf, '\n')) != NULL)
*p = '\0';
if ((argc = Parse(buf, sizeof buf, args, argl)) == 0)
continue;
if (strcmp(args[0], "echo") == 0) {
if (!display)
continue;
if (argc < 2 || (argc == 3 && strcmp(args[1], "-n")) || argc > 3) {
Msg(0, "%s: 'echo [-n] \"string\"' expected.", rc_name);
continue;
}
AddStr(args[argc - 1]);
if (argc != 3) {
AddStr("\r\n");
Flush(0);
}
} else if (strcmp(args[0], "sleep") == 0) {
if (!display)
continue;
debug("sleeeeeeep\n");
if (argc != 2) {
Msg(0, "%s: sleep: one numeric argument expected.", rc_name);
continue;
}
DisplaySleep1000(1000 * atoi(args[1]), 1);
}
#ifdef TERMINFO
else if (!strcmp(args[0], "termcapinfo") || !strcmp(args[0], "terminfo")) {
#else
else if (!strcmp(args[0], "termcapinfo") || !strcmp(args[0], "termcap")) {
#endif
if (!display)
continue;
if (argc < 3 || argc > 4) {
Msg(0, "%s: %s: incorrect number of arguments.", rc_name, args[0]);
continue;
}
for (p = args[1]; p && *p; p = cp) {
if ((cp = index(p, '|')) != 0)
*cp++ = '\0';
len = strlen(p);
if (p[len - 1] == '*') {
if (!(len - 1) || !strncmp(p, D_termname, len - 1))
break;
} else if (!strcmp(p, D_termname))
break;
}
if (!(p && *p))
continue;
extra_incap = CatExtra(args[2], extra_incap);
if (argc == 4)
extra_outcap = CatExtra(args[3], extra_outcap);
} else if (!strcmp(args[0], "source")) {
if (rc_recursion <= 10) {
rc_recursion++;
(void)StartRc(args[1], 0);
rc_recursion--;
}
}
}
fclose(fp);
Free(rc_name);
rc_name = oldrc_name;
return 0;
}
void
FinishRc(char *rcfilename)
{
char buf[2048];
FILE *fp;
char *oldrc_name = rc_name;
rc_name = findrcfile(rcfilename);
if (rc_name == NULL || (fp = secfopen(rc_name, "r")) == NULL) {
const char *rc_nonnull = rc_name ? rc_name : rcfilename;
if (rc_recursion)
Msg(errno, "%s: source %s", oldrc_name, rc_nonnull);
else if (RcFileName && !strcmp(RcFileName, rc_nonnull)) {
/*
* User explicitly gave us that name,
* this is the only case, where we get angry, if we can't read
* the file.
*/
debug3("FinishRc:'%s','%s','%s'\n", RcFileName, rc_name ? rc_name : "(null)", rcfilename);
Panic(0, "Unable to open \"%s\".", rc_nonnull);
/* NOTREACHED */
}
debug1("FinishRc: '%s' no good. ignored\n", rc_nonnull);
if (rc_name)
Free(rc_name);
rc_name = oldrc_name;
return;
}
debug("finishrc is going...\n");
while (fgets(buf, sizeof buf, fp) != NULL)
RcLine(buf, sizeof buf);
(void)fclose(fp);
Free(rc_name);
rc_name = oldrc_name;
}
void
do_source(char *rcfilename)
{
if (rc_recursion > 10) {
Msg(0, "%s: source: recursion limit reached", rc_name);
return;
}
rc_recursion++;
FinishRc(rcfilename);
rc_recursion--;
}
/*
* Running a Command Line in the environment determined by the display.
* The fore window is taken from the display as well as the user.
* This is bad when we run detached.
*/
void
RcLine(char *ubuf, int ubufl)
{
char *args[MAXARGS];
int argl[MAXARGS];
#ifdef MULTIUSER
extern struct acluser *EffectiveAclUser; /* acl.c */
extern struct acluser *users; /* acl.c */
#endif
if (display) {
fore = D_fore;
flayer = D_forecv->c_layer;
} else
flayer = fore ? fore->w_savelayer : 0;
if (Parse(ubuf, ubufl, args, argl) <= 0)
return;
#ifdef MULTIUSER
if (!display) {
/* the session owner does it, when there is no display here */
EffectiveAclUser = users;
debug("RcLine: WARNING, no display no user! Session owner executes command\n");
}
#endif
DoCommand(args, argl);
#ifdef MULTIUSER
EffectiveAclUser = 0;
#endif
}
/* needs display for copybuffer access and termcap dumping */
void
WriteFile(struct acluser *user, char *fn, int dump)
{
/* dump==0: create .termcap,
* dump==1: hardcopy,
* #ifdef COPY_PASTE
* dump==2: BUFFERFILE
* #endif COPY_PASTE
* dump==1: scrollback,
*/
register int i, j, k;
register char *p;
register FILE *f;
char fnbuf[1024];
char *mode = "w";
#ifdef COPY_PASTE
int public = 0;
# ifdef HAVE_LSTAT
struct stat stb, stb2;
int fd, exists = 0;
# endif
#endif
switch (dump) {
case DUMP_TERMCAP:
if (fn == 0) {
i = SockName - SockPath;
if (i > (int)sizeof(fnbuf) - 9)
i = 0;
strncpy(fnbuf, SockPath, i);
strcpy(fnbuf + i, ".termcap");
fn = fnbuf;
}
break;
case DUMP_HARDCOPY:
case DUMP_SCROLLBACK:
if (fn == 0) {
if (fore == 0)
return;
if (hardcopydir && *hardcopydir && strlen(hardcopydir) < sizeof(fnbuf) - 21)
sprintf(fnbuf, "%s/hardcopy.%d", hardcopydir, fore->w_number);
else
sprintf(fnbuf, "hardcopy.%d", fore->w_number);
fn = fnbuf;
}
if (hardcopy_append && !access(fn, W_OK))
mode = "a";
break;
#ifdef COPY_PASTE
case DUMP_EXCHANGE:
if (fn == 0) {
strncpy(fnbuf, BufferFile, sizeof(fnbuf) - 1);
fnbuf[sizeof(fnbuf) - 1] = 0;
fn = fnbuf;
}
public = !strcmp(fn, DEFAULT_BUFFERFILE);
# ifdef HAVE_LSTAT
exists = !lstat(fn, &stb);
if (public && exists && (S_ISLNK(stb.st_mode) || stb.st_nlink > 1)) {
Msg(0, "No write to links, please.");
return;
}
# endif
break;
#endif
}
debug2("WriteFile(%d) %s\n", dump, fn);
if (UserContext() > 0) {
debug("Writefile: usercontext\n");
#ifdef COPY_PASTE
if (dump == DUMP_EXCHANGE && public) {
# ifdef HAVE_LSTAT
if (exists) {
if ((fd = open(fn, O_WRONLY, 0666)) >= 0) {
if (fstat(fd, &stb2) == 0 && stb.st_dev == stb2.st_dev && stb.st_ino == stb2.st_ino)
ftruncate(fd, 0);
else {
close(fd);
fd = -1;
}
}
} else
fd = open(fn, O_WRONLY|O_CREAT|O_EXCL, 0666);
f = fd >= 0 ? fdopen(fd, mode) : 0;
# else
f = fopen(fn, mode);
# endif
} else
#endif /* COPY_PASTE */
f = fopen(fn, mode);
if (f == NULL) {
debug2("WriteFile: fopen(%s,\"%s\") failed\n", fn, mode);
UserReturn(0);
} else {
switch (dump) {
case DUMP_HARDCOPY:
case DUMP_SCROLLBACK:
if (!fore)
break;
if (*mode == 'a') {
putc('>', f);
for (j = fore->w_width - 2; j > 0; j--)
putc('=', f);
fputs("<\n", f);
}
if (dump == DUMP_SCROLLBACK) {
#ifdef COPY_PASTE
for (i = fore->w_histheight - fore->w_scrollback_height; i < fore->w_histheight; i++) {
p = (char *)(WIN(i)->image);
for (k = fore->w_width - 1;
k >= 0 && p[k] == ' '; k--)
;
for (j = 0; j <= k; j++)
putc(p[j], f);
putc('\n', f);
}
#endif
}
for (i = 0; i < fore->w_height; i++) {
p = (char *)fore->w_mlines[i].image;
for (k = fore->w_width - 1;
k >= 0 && p[k] == ' '; k--)
;
for (j = 0; j <= k; j++)
putc(p[j], f);
putc('\n', f);
}
break;
case DUMP_TERMCAP:
DumpTermcap(fore->w_aflag, f);
break;
#ifdef COPY_PASTE
case DUMP_EXCHANGE:
p = user->u_plop.buf;
for (i = user->u_plop.len; i-- > 0; p++)
if (*p == '\r' && (i == 0 || p[1] != '\n'))
putc('\n', f);
else
putc(*p, f);
break;
#endif
}
(void)fclose(f);
UserReturn(1);
}
}
if (UserStatus() <= 0)
Msg(0, "Cannot open \"%s\"", fn);
else if (display && !*rc_name) {
switch (dump) {
case DUMP_TERMCAP:
Msg(0, "Termcap entry written to \"%s\".", fn);
break;
case DUMP_HARDCOPY:
case DUMP_SCROLLBACK:
Msg(0, "Screen image %s to \"%s\".", (*mode == 'a') ? "appended" : "written", fn);
break;
#ifdef COPY_PASTE
case DUMP_EXCHANGE:
Msg(0, "Copybuffer written to \"%s\".", fn);
#endif
}
}
}
#ifdef COPY_PASTE
/*
* returns an allocated buffer which holds a copy of the file named fn.
* lenp (if nonzero) points to a location, where the buffer size should be
* stored.
*/
char *
ReadFile(char *fn, int *lenp)
{
int i, l, size;
char c, *bp, *buf;
struct stat stb;
ASSERT(lenp);
debug1("ReadFile(%s)\n", fn);
if ((i = secopen(fn, O_RDONLY, 0)) < 0) {
Msg(errno, "no %s -- no slurp", fn);
return NULL;
}
if (fstat(i, &stb)) {
Msg(errno, "no good %s -- no slurp", fn);
close(i);
return NULL;
}
size = stb.st_size;
if ((buf = malloc(size)) == NULL) {
close(i);
Msg(0, "%s", strnomem);
return NULL;
}
errno = 0;
if ((l = read(i, buf, size)) != size) {
if (l < 0)
l = 0;
Msg(errno, "Got only %d bytes from %s", l, fn);
} else {
if (read(i, &c, 1) > 0)
Msg(0, "Slurped only %d characters (of %d) into buffer - try again", l, size);
else
Msg(0, "Slurped %d characters into buffer", l);
}
close(i);
*lenp = l;
for (bp = buf; l-- > 0; bp++)
if (*bp == '\n' && (bp == buf || bp[-1] != '\r'))
*bp = '\r';
return buf;
}
void
KillBuffers()
{
if (UserContext() > 0)
UserReturn(unlink(BufferFile) ? errno : 0);
errno = UserStatus();
Msg(errno, "%s %sremoved", BufferFile, errno ? "not " : "");
}
#endif /* COPY_PASTE */
/* (Almost) secure open and fopen... */
FILE *
secfopen(char *name, char *mode)
{
FILE *fi;
#ifndef USE_SETEUID
int flags, fd;
#endif
debug2("secfopen(%s, %s)\n", name, mode);
#ifdef USE_SETEUID
xseteuid(real_uid);
xsetegid(real_gid);
fi = fopen(name, mode);
xseteuid(eff_uid);
xsetegid(eff_gid);
return fi;
#else
if (eff_uid == real_uid)
return fopen(name, mode);
if (mode[0] && mode[1] == '+')
flags = O_RDWR;
else
flags = (mode[0] == 'r') ? O_RDONLY : O_WRONLY;
if (mode[0] == 'w')
flags |= O_CREAT | O_TRUNC;
else if (mode[0] == 'a')
flags |= O_CREAT | O_APPEND;
else if (mode[0] != 'r') {
errno = EINVAL;
return 0;
}
if ((fd = secopen(name, flags, 0666)) < 0)
return 0;
if ((fi = fdopen(fd, mode)) == 0) {
close(fd);
return 0;
}
return fi;
#endif
}
int
secopen(char *name, int flags, int mode)
{
int fd;
#ifndef USE_SETEUID
int q;
struct stat stb;
#endif
debug3("secopen(%s, 0x%x, 0%03o)\n", name, flags, mode);
#ifdef USE_SETEUID
xseteuid(real_uid);
xsetegid(real_gid);
fd = open(name, flags, mode);
xseteuid(eff_uid);
xsetegid(eff_gid);
return fd;
#else
if (eff_uid == real_uid)
return open(name, flags, mode);
/* Truncation/creation is done in UserContext */
if ((flags & O_TRUNC) || ((flags & O_CREAT) && access(name, F_OK))) {
if (UserContext() > 0) {
if ((fd = open(name, flags, mode)) >= 0) {
close(fd);
UserReturn(0);
}
if (errno == 0)
errno = EACCES;
UserReturn(errno);
}
if ((q = UserStatus())) {
if (q > 0)
errno = q;
return -1;
}
}
if (access(name, F_OK))
return -1;
if ((fd = open(name, flags & ~(O_TRUNC | O_CREAT), 0)) < 0)
return -1;
debug("open successful\n");
if (fstat(fd, &stb)) {
close(fd);
return -1;
}
debug("fstat successful\n");
if (stb.st_uid != real_uid) {
switch (flags & (O_RDONLY | O_WRONLY | O_RDWR)) {
case O_RDONLY:
q = 0004;
break;
case O_WRONLY:
q = 0002;
break;
default:
q = 0006;
break;
}
if ((stb.st_mode & q) != q) {
debug1("secopen: permission denied (%03o)\n", stb.st_mode & 07777);
close(fd);
errno = EACCES;
return -1;
}
}
debug1("secopen ok - returning %d\n", fd);
return fd;
#endif
}
int
printpipe(struct win *p, char *cmd)
{
int pi[2];
if (pipe(pi)) {
WMsg(p, errno, "printing pipe");
return -1;
}
switch (fork()) {
case -1:
WMsg(p, errno, "printing fork");
return -1;
case 0:
display = p->w_pdisplay;
displays = 0;
ServerSocket = -1;
#ifdef DEBUG
if (dfp && dfp != stderr)
fclose(dfp);
#endif
close(0);
dup(pi[0]);
closeallfiles(0);
if (setgid(real_gid) || setuid(real_uid))
Panic(errno, "printpipe setuid");
eff_uid = real_uid;
eff_gid = real_gid;
#ifdef SIGPIPE
signal(SIGPIPE, SIG_DFL);
#endif
execl("/bin/sh", "sh", "-c", cmd, (char *)0);
Panic(errno, "/bin/sh");
default:
break;
}
close(pi[0]);
return pi[1];
}
int
readpipe(char **cmdv)
{
int pi[2];
if (pipe(pi)) {
Msg(errno, "pipe");
return -1;
}
switch (fork()) {
case -1:
Msg(errno, "fork");
return -1;
case 0:
displays = 0;
ServerSocket = -1;
#ifdef DEBUG
if (dfp && dfp != stderr)
fclose(dfp);
#endif
close(1);
if (dup(pi[1]) != 1) {
close(pi[1]);
Panic(0, "dup");
}
closeallfiles(1);
if (setgid(real_gid) || setuid(real_uid)) {
close(1);
Panic(errno, "setuid/setgid");
}
eff_uid = real_uid;
eff_gid = real_gid;
#ifdef SIGPIPE
signal(SIGPIPE, SIG_DFL);
#endif
execvp(*cmdv, cmdv);
close(1);
Panic(errno, "%s", *cmdv);
default:
break;
}
close(pi[1]);
return pi[0];
}

936
help.c Normal file
View file

@ -0,0 +1,936 @@
/* Copyright (c) 2010
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Sadrul Habib Chowdhury (sadrul@users.sourceforge.net)
* Copyright (c) 2008, 2009
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Micah Cowan (micah@cowan.name)
* Sadrul Habib Chowdhury (sadrul@users.sourceforge.net)
* Copyright (c) 1993-2002, 2003, 2005, 2006, 2007
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
*
* 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 3, 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 (see the file COPYING); if not, see
* https://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*
****************************************************************
*/
#include <sys/types.h>
#include "config.h"
#include "screen.h"
#include "extern.h"
#include "list_generic.h"
char version[60]; /* initialised by main() */
extern struct layer *flayer;
extern struct display *display, *displays;
extern struct win *windows;
extern int maxwin;
extern char *noargs[];
extern struct mchar mchar_blank, mchar_so;
extern int renditions[];
extern unsigned char *blank;
extern struct win **wtab;
#ifdef MAPKEYS
extern struct term term[];
#endif
extern struct LayFuncs ListLf;
static void PadStr __P((char *, int, int, int));
extern char *wliststr;
extern char *wlisttit;
void exit_with_usage(char *myname, char *message, char *arg)
{
printf("Use: %s [-opts] [cmd [args]]\n", myname);
printf(" or: %s -r [host.tty]\n\nOptions:\n", myname);
#ifdef BUILTIN_TELNET
printf("-4 Resolve hostnames only to IPv4 addresses.\n");
printf("-6 Resolve hostnames only to IPv6 addresses.\n");
#endif
printf("-a Force all capabilities into each window's termcap.\n");
printf("-A -[r|R] Adapt all windows to the new display width & height.\n");
printf("-c file Read configuration file instead of '.screenrc'.\n");
#ifdef REMOTE_DETACH
printf("-d (-r) Detach the elsewhere running screen (and reattach here).\n");
printf("-dmS name Start as daemon: Screen session in detached mode.\n");
printf("-D (-r) Detach and logout remote (and reattach here).\n");
printf("-D -RR Do whatever is needed to get a screen session.\n");
#endif
printf("-e xy Change command characters.\n");
printf("-f Flow control on, -fn = off, -fa = auto.\n");
printf("-h lines Set the size of the scrollback history buffer.\n");
printf("-i Interrupt output sooner when flow control is on.\n");
#if defined(LOGOUTOK) && defined(UTMPOK)
printf("-l Login mode on (update %s), -ln = off.\n", UTMPFILE);
#endif
printf("-ls [match] or\n");
printf("-list Do nothing, just list our SockDir [on possible matches].\n");
printf("-L Turn on output logging.\n");
printf("-Logfile file Set logfile name.\n");
printf("-m ignore $STY variable, do create a new screen session.\n");
printf("-O Choose optimal output rather than exact vt100 emulation.\n");
printf("-p window Preselect the named window if it exists.\n");
printf("-q Quiet startup. Exits with non-zero return code if unsuccessful.\n");
printf("-Q Commands will send the response to the stdout of the querying process.\n");
printf("-r [session] Reattach to a detached screen process.\n");
printf("-R Reattach if possible, otherwise start a new session.\n");
printf("-s shell Shell to execute rather than $SHELL.\n");
printf("-S sockname Name this session <pid>.sockname instead of <pid>.<tty>.<host>.\n");
printf("-t title Set title. (window's name).\n");
printf("-T term Use term as $TERM for windows, rather than \"screen\".\n");
#ifdef UTF8
printf("-U Tell screen to use UTF-8 encoding.\n");
#endif
printf("-v Print \"Screen version %s\".\n", version);
printf("-wipe [match] Do nothing, just clean up SockDir [on possible matches].\n");
#ifdef MULTI
printf("-x Attach to a not detached screen. (Multi display mode).\n");
#endif /* MULTI */
printf("-X Execute <cmd> as a screen command in the specified session.\n");
if (message && *message) {
printf("\nError: ");
printf(message, arg);
printf("\n");
exit(1);
}
exit(0);
}
/* Here come the help page routines */
extern struct comm comms[];
extern struct action ktab[];
static void HelpProcess __P((char **, int *));
static void HelpAbort __P((void));
static void HelpRedisplayLine __P((int, int, int, int));
static void add_key_to_buf __P((char *, int));
static void AddAction __P((struct action *, int, int));
static int helppage __P((void));
struct helpdata {
char *class;
struct action *ktabp;
int maxrow, grow, numcols, numrows, num_names;
int numskip, numpages;
int command_search, command_bindings;
int refgrow, refcommand_search;
int inter, mcom, mkey;
int nact[RC_LAST + 1];
};
#define MAXKLEN 256
static struct LayFuncs HelpLf =
{
HelpProcess,
HelpAbort,
HelpRedisplayLine,
DefClearLine,
DefRewrite,
DefResize,
DefRestore,
0
};
void display_help(char *class, struct action *ktabp) {
int i, n, key, mcom, mkey, l, used[RC_LAST + 1];
struct helpdata *helpdata;
if (flayer->l_height < 6) {
LMsg(0, "Window height too small for help page");
return;
}
if (InitOverlayPage(sizeof(*helpdata), &HelpLf, 0))
return;
helpdata = (struct helpdata *)flayer->l_data;
helpdata->class = class;
helpdata->ktabp = ktabp;
helpdata->num_names = helpdata->command_bindings = 0;
helpdata->command_search = 0;
for (n = 0; n <= RC_LAST; n++)
used[n] = 0;
mcom = 0;
mkey = 0;
for (key = 0; key < 256 + KMAP_KEYS; key++) {
n = ktabp[key].nr;
if (n == RC_ILLEGAL)
continue;
if (ktabp[key].args == noargs) {
used[n] += (key <= ' ' || key == 0x7f) ? 3 : (key > 0x7f) ? 5 : 2;
}
else
helpdata->command_bindings++;
}
for (n = i = 0; n <= RC_LAST; n++)
if (used[n]) {
l = strlen(comms[n].name);
if (l > mcom)
mcom = l;
if (used[n] > mkey)
mkey = used[n];
helpdata->nact[i++] = n;
}
debug1("help: %d commands bound to keys with no arguments\n", i);
debug2("mcom: %d mkey: %d\n", mcom, mkey);
helpdata->num_names = i;
if (mkey > MAXKLEN)
mkey = MAXKLEN;
helpdata->numcols = flayer->l_width / (mcom + mkey + 1);
if (helpdata->numcols == 0) {
HelpAbort();
LMsg(0, "Width too small");
return;
}
helpdata->inter = (flayer->l_width - (mcom + mkey) * helpdata->numcols) / (helpdata->numcols + 1);
if (helpdata->inter <= 0)
helpdata->inter = 1;
debug1("inter: %d\n", helpdata->inter);
helpdata->mcom = mcom;
helpdata->mkey = mkey;
helpdata->numrows = (helpdata->num_names + helpdata->numcols - 1) / helpdata->numcols;
debug1("Numrows: %d\n", helpdata->numrows);
helpdata->numskip = flayer->l_height-5 - (2 + helpdata->numrows);
while (helpdata->numskip < 0)
helpdata->numskip += flayer->l_height-5;
helpdata->numskip %= flayer->l_height-5;
debug1("Numskip: %d\n", helpdata->numskip);
if (helpdata->numskip > flayer->l_height/3 || helpdata->numskip > helpdata->command_bindings)
helpdata->numskip = 1;
helpdata->maxrow = 2 + helpdata->numrows + helpdata->numskip + helpdata->command_bindings;
helpdata->grow = 0;
helpdata->numpages = (helpdata->maxrow + flayer->l_height-6) / (flayer->l_height-5);
flayer->l_x = 0;
flayer->l_y = flayer->l_height - 1;
helppage();
}
static void HelpProcess(char **ppbuf, int *plen) {
int done = 0;
while (!done && *plen > 0) {
switch (**ppbuf) {
case ' ':
if (helppage() == 0)
break;
/* FALLTHROUGH */
case '\r':
case '\n':
done = 1;
break;
default:
break;
}
++*ppbuf;
--*plen;
}
if (done)
HelpAbort();
}
static void HelpAbort() {
LAY_CALL_UP(LRefreshAll(flayer, 0));
ExitOverlayPage();
}
static int helppage() {
struct helpdata *helpdata;
int col, crow, n, key, x;
char buf[MAXKLEN], Esc_buf[6], cbuf[MAXKLEN + 50];
struct action *ktabp;
helpdata = (struct helpdata *)flayer->l_data;
ktabp = helpdata->ktabp;
if (helpdata->grow >= helpdata->maxrow)
return -1;
helpdata->refgrow = helpdata->grow;
helpdata->refcommand_search = helpdata->command_search;
/* Clear the help screen */
LClearAll(flayer, 0);
sprintf(cbuf,"Screen key bindings, page %d of %d.", helpdata->grow / (flayer->l_height-5) + 1, helpdata->numpages);
centerline(cbuf, 0);
crow = 2;
*Esc_buf = '\0';
*buf = '\0';
/* XXX fix escape character */
if (flayer->l_cvlist && flayer->l_cvlist->c_display) {
add_key_to_buf(buf, flayer->l_cvlist->c_display->d_user->u_MetaEsc);
add_key_to_buf(Esc_buf, flayer->l_cvlist->c_display->d_user->u_Esc);
}
else {
strcpy(Esc_buf, "??");
strcpy(buf, "??");
}
for (; crow < flayer->l_height - 3; crow++) {
if (helpdata->grow < 1) {
if (ktabp == ktab)
sprintf(cbuf,"Command key: %s Literal %s: %s", Esc_buf, Esc_buf, buf);
else
sprintf(cbuf,"Command class: '%.80s'", helpdata->class);
centerline(cbuf, crow);
helpdata->grow++;
}
else if (helpdata->grow >= 2 && helpdata->grow-2 < helpdata->numrows) {
x = 0;
for (col = 0; col < helpdata->numcols && (n = helpdata->numrows * col + (helpdata->grow-2)) < helpdata->num_names; col++) {
x += helpdata->inter - !col;
n = helpdata->nact[n];
buf[0] = '\0';
for (key = 0; key < 256 + KMAP_KEYS; key++)
if (ktabp[key].nr == n && ktabp[key].args == noargs && strlen(buf) < sizeof(buf) - 7) {
strcat(buf, " ");
add_key_to_buf(buf, key);
}
PadStr(comms[n].name, helpdata->mcom, x, crow);
x += helpdata->mcom;
PadStr(buf, helpdata->mkey, x, crow);
x += helpdata->mkey;
}
helpdata->grow++;
}
else if (helpdata->grow-2-helpdata->numrows >= helpdata->numskip
&& helpdata->grow-2-helpdata->numrows-helpdata->numskip < helpdata->command_bindings) {
while ((n = ktabp[helpdata->command_search].nr) == RC_ILLEGAL || ktabp[helpdata->command_search].args == noargs) {
if (++helpdata->command_search >= 256 + KMAP_KEYS)
return -1;
}
buf[0] = '\0';
add_key_to_buf(buf, helpdata->command_search);
PadStr(buf, 5, 0, crow);
AddAction(&ktabp[helpdata->command_search++], 5, crow);
helpdata->grow++;
}
else
helpdata->grow++;
}
sprintf(cbuf,"[Press Space %s Return to end.]", helpdata->grow < helpdata->maxrow ? "for next page;" : "or");
centerline(cbuf, flayer->l_height - 2);
LaySetCursor();
return 0;
}
static void AddAction(struct action *act, int x, int y) {
char buf[256];
int del, l, fr;
char *bp, *cp, **pp;
int *lp, ll;
struct mchar mchar_dol;
mchar_dol = mchar_blank;
mchar_dol.image = '$';
fr = flayer->l_width - 1 - x;
if (fr <= 0)
return;
l = strlen(comms[act->nr].name);
if (l + 1 > fr)
l = fr - 1;
PadStr(comms[act->nr].name, l, x, y);
x += l;
fr -= l + 1;
LPutChar(flayer, fr ? &mchar_blank : &mchar_dol, x++, y);
pp = act->args;
lp = act->argl;
while (pp && (cp = *pp) != NULL) {
del = 0;
bp = buf;
ll = *lp++;
if (!ll || (index(cp, ' ') != NULL)) {
if (index(cp, '\'') != NULL)
*bp++ = del = '"';
else
*bp++ = del = '\'';
}
while (ll-- && bp < buf + 250)
bp += AddXChar(bp, *(unsigned char *)cp++);
if (del)
*bp++ = del;
*bp = 0;
if ((fr -= (bp - buf) + 1) < 0) {
fr += bp - buf;
if (fr > 0)
PadStr(buf, fr, x, y);
if (fr == 0)
LPutChar(flayer, &mchar_dol, x, y);
return;
}
PadStr(buf, strlen(buf), x, y);
x += strlen(buf);
pp++;
if (*pp)
LPutChar(flayer, fr ? &mchar_blank : &mchar_dol, x++, y);
}
}
static void add_key_to_buf(char *buf, int key) {
buf += strlen(buf);
if (key < 0)
strcpy(buf, "unset");
else if (key == ' ')
strcpy(buf, "sp");
#ifdef MAPKEYS
else if (key >= 256) {
key = key - 256 + T_CAPS;
buf[0] = ':';
buf[1] = term[key].tcname[0];
buf[2] = term[key].tcname[1];
buf[3] = ':';
buf[4] = 0;
}
#endif
else
buf[AddXChar(buf, key)] = 0;
}
static void HelpRedisplayLine(int y, int xs, int xe, int isblank) {
if (y < 0) {
struct helpdata *helpdata;
helpdata = (struct helpdata *)flayer->l_data;
helpdata->grow = helpdata->refgrow;
helpdata->command_search = helpdata->refcommand_search;
helppage();
return;
}
if (y != 0 && y != flayer->l_height - 1)
return;
if (!isblank)
LClearArea(flayer, xs, y, xe, y, 0, 0);
}
/* here is all the copyright stuff */
static void CopyrightProcess __P((char **, int *));
static void CopyrightRedisplayLine __P((int, int, int, int));
static void CopyrightAbort __P((void));
static void copypage __P((void));
struct copydata {
char *cps, *savedcps; /* position in the message */
char *refcps, *refsavedcps; /* backup for redisplaying */
};
static struct LayFuncs CopyrightLf = {
CopyrightProcess,
CopyrightAbort,
CopyrightRedisplayLine,
DefClearLine,
DefRewrite,
DefResize,
DefRestore,
0
};
static const char cpmsg[] = "\
\n\
GNU Screen version %v\n\
\n\
Copyright (c) 2018-2023 Alexander Naumov, Amadeusz Slawinski\n\
Copyright (c) 2015-2017 Juergen Weigert, Alexander Naumov, Amadeusz Slawinski\n\
Copyright (c) 2010-2014 Juergen Weigert, Sadrul Habib Chowdhury\n\
Copyright (c) 2008-2009 Juergen Weigert, Michael Schroeder, Micah Cowan, Sadrul Habib Chowdhury\n\
Copyright (c) 1993-2007 Juergen Weigert, Michael Schroeder\n\
Copyright (c) 1987 Oliver Laumann\n\
\n\
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 3, or (at your option) \
any later version.\n\
\n\
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.\n\
\n\
You should have received a copy of the GNU General Public License \
along with this program (see the file COPYING); if not, see \
https://www.gnu.org/licenses/, or contact Free Software Foundation, Inc., \
51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA.\n\
\n\
Send bugreports, fixes, enhancements, t-shirts, money, beer & pizza to \
screen-devel@gnu.org\n\n\n"
"Capabilities:\n"
#ifdef COPY_PASTE
"+copy "
#else
"-copy "
#endif
#ifdef REMOTE_DETACH
"+remote-detach "
#else
"-remote-detach "
#endif
#ifdef POW_DETACH
"+power-detach "
#else
"-power-detach "
#endif
#ifdef MULTI
"+multi-attach "
#else
"-multi-attach "
#endif
#ifdef MULTIUSER
"+multi-user "
#else
"-multi-user "
#endif
#ifdef FONT
"+font "
#else
"-font "
#endif
#ifdef COLORS256
"+color-256 "
#elif defined(COLORS16)
"+color-16 "
#elif defined(COLOR)
"+color "
#else
"-color "
#endif
#ifdef UTF8
"+utf8 "
#else
"-utf8 "
#endif
#ifdef RXVT_OSC
"+rxvt "
#else
"-rxvt "
#endif
#ifdef BUILTIN_TELNET
"+builtin-telnet "
#else
"-builtin-telnet "
#endif
;
static void CopyrightProcess(char **ppbuf, int *plen) {
int done = 0;
struct copydata *copydata;
copydata = (struct copydata *)flayer->l_data;
while (!done && *plen > 0) {
switch (**ppbuf) {
case ' ':
if (*copydata->cps) {
copypage();
break;
}
/* FALLTHROUGH */
case '\r':
case '\n':
CopyrightAbort();
done = 1;
break;
default:
break;
}
++*ppbuf;
--*plen;
}
}
static void CopyrightAbort() {
LAY_CALL_UP(LRefreshAll(flayer, 0));
ExitOverlayPage();
}
void display_copyright() {
struct copydata *copydata;
if (flayer->l_width < 10 || flayer->l_height < 5) {
LMsg(0, "Window size too small for copyright page");
return;
}
if (InitOverlayPage(sizeof(*copydata), &CopyrightLf, 0))
return;
copydata = (struct copydata *)flayer->l_data;
copydata->cps = (char *)cpmsg;
copydata->savedcps = 0;
flayer->l_x = 0;
flayer->l_y = flayer->l_height - 1;
copypage();
}
static void copypage() {
register char *cps;
char *ws;
int x, y, l;
char cbuf[80];
struct copydata *copydata;
ASSERT(flayer);
copydata = (struct copydata *)flayer->l_data;
LClearAll(flayer, 0);
x = y = 0;
cps = copydata->cps;
copydata->refcps = cps;
copydata->refsavedcps = copydata->savedcps;
while (*cps && y < flayer->l_height - 3) {
ws = cps;
while (*cps == ' ')
cps++;
if (strncmp(cps, "%v", 2) == 0) {
copydata->savedcps = cps + 2;
cps = version;
continue;
}
while (*cps && *cps != ' ' && *cps != '\n')
cps++;
l = cps - ws;
cps = ws;
if (l > flayer->l_width - 1)
l = flayer->l_width - 1;
if (x && x + l >= flayer->l_width - 2) {
x = 0;
y++;
continue;
}
if (x) {
LPutChar(flayer, &mchar_blank, x, y);
x++;
}
if (l)
LPutStr(flayer, ws, l, &mchar_blank, x, y);
x += l;
cps += l;
if (*cps == 0 && copydata->savedcps) {
cps = copydata->savedcps;
copydata->savedcps = 0;
}
if (*cps == '\n') {
x = 0;
y++;
}
if (*cps == ' ' || *cps == '\n')
cps++;
}
while (*cps == '\n')
cps++;
sprintf(cbuf,"[Press Space %s Return to end.]", *cps ? "for next page;" : "or");
centerline(cbuf, flayer->l_height - 2);
copydata->cps = cps;
LaySetCursor();
}
static void CopyrightRedisplayLine(int y, int xs, int xe, int isblank) {
ASSERT(flayer);
if (y < 0) {
struct copydata *copydata;
copydata = (struct copydata *)flayer->l_data;
copydata->cps = copydata->refcps;
copydata->savedcps = copydata->refsavedcps;
copypage();
return;
}
if (y != 0 && y != flayer->l_height - 1)
return;
if (isblank)
return;
LClearArea(flayer, xs, y, xe, y, 0, 0);
}
/* The bindkey help page */
#ifdef MAPKEYS
extern struct kmap_ext *kmap_exts;
extern int kmap_extn;
extern struct action dmtab[];
extern struct action mmtab[];
static void BindkeyProcess __P((char **, int *));
static void BindkeyAbort __P((void));
static void BindkeyRedisplayLine __P((int, int, int, int));
static void bindkeypage __P((void));
struct bindkeydata {
char *title;
struct action *tab;
int pos;
int last;
int page;
int pages;
};
static struct LayFuncs BindkeyLf = {
BindkeyProcess,
BindkeyAbort,
BindkeyRedisplayLine,
DefClearLine,
DefRewrite,
DefResize,
DefRestore,
0
};
void display_bindkey(char *title, struct action *tab) {
struct bindkeydata *bindkeydata;
int i, n;
if (flayer->l_height < 6) {
LMsg(0, "Window height too small for bindkey page");
return;
}
if (InitOverlayPage(sizeof(*bindkeydata), &BindkeyLf, 0))
return;
bindkeydata = (struct bindkeydata *)flayer->l_data;
bindkeydata->title = title;
bindkeydata->tab = tab;
n = 0;
for (i = 0; i < KMAP_KEYS+KMAP_AKEYS+kmap_extn; i++) {
if (tab[i].nr != RC_ILLEGAL)
n++;
}
bindkeydata->pos = 0;
bindkeydata->page = 1;
bindkeydata->pages = (n + flayer->l_height - 6) / (flayer->l_height - 5);
if (bindkeydata->pages == 0)
bindkeydata->pages = 1;
flayer->l_x = 0;
flayer->l_y = flayer->l_height - 1;
bindkeypage();
}
static void BindkeyAbort() {
LAY_CALL_UP(LRefreshAll(flayer, 0));
ExitOverlayPage();
}
static void bindkeypage() {
struct bindkeydata *bindkeydata;
struct kmap_ext *kme;
char tbuf[256];
int del, i, y, sl;
struct action *act;
char *xch, *s, *p;
bindkeydata = (struct bindkeydata *)flayer->l_data;
LClearAll(flayer, 0);
sprintf(tbuf, "%s key bindings, page %d of %d.", bindkeydata->title, bindkeydata->page, bindkeydata->pages);
centerline(tbuf, 0);
y = 2;
for (i = bindkeydata->pos; i < KMAP_KEYS+KMAP_AKEYS+kmap_extn && y < flayer->l_height - 3; i++) {
p = tbuf;
xch = " ";
if (i < KMAP_KEYS) {
act = &bindkeydata->tab[i];
if (act->nr == RC_ILLEGAL)
continue;
del = *p++ = ':';
s = term[i + T_CAPS].tcname;
sl = s ? strlen(s) : 0;
}
else if (i < KMAP_KEYS+KMAP_AKEYS) {
act = &bindkeydata->tab[i];
if (act->nr == RC_ILLEGAL)
continue;
del = *p++ = ':';
s = term[i + (T_CAPS - T_OCAPS + T_CURSOR)].tcname;
sl = s ? strlen(s) : 0;
xch = "[A]";
}
else {
kme = kmap_exts + (i - (KMAP_KEYS+KMAP_AKEYS));
del = 0;
s = kme->str;
sl = kme->fl & ~KMAP_NOTIMEOUT;
if ((kme->fl & KMAP_NOTIMEOUT) != 0)
xch = "[T]";
act = bindkeydata->tab == dmtab ? &kme->dm : bindkeydata->tab == mmtab ? &kme->mm : &kme->um;
if (act->nr == RC_ILLEGAL)
continue;
}
while (sl-- > 0)
p += AddXChar(p, *(unsigned char *)s++);
if (del)
*p++ = del;
*p++ = ' ';
while (p < tbuf + 15)
*p++ = ' ';
sprintf(p, "%s -> ", xch);
p += 7;
if (p - tbuf > flayer->l_width - 1) {
tbuf[flayer->l_width - 2] = '$';
tbuf[flayer->l_width - 1] = 0;
}
PadStr(tbuf, strlen(tbuf), 0, y);
AddAction(act, strlen(tbuf), y);
y++;
}
y++;
bindkeydata->last = i;
sprintf(tbuf,"[Press Space %s Return to end.]", bindkeydata->page < bindkeydata->pages ? "for next page;" : "or");
centerline(tbuf, flayer->l_height - 2);
LaySetCursor();
}
static void BindkeyProcess(char **ppbuf, int *plen) {
int done = 0;
struct bindkeydata *bindkeydata;
bindkeydata = (struct bindkeydata *)flayer->l_data;
while (!done && *plen > 0) {
switch (**ppbuf) {
case ' ':
if (bindkeydata->page < bindkeydata->pages) {
bindkeydata->pos = bindkeydata->last;
bindkeydata->page++;
bindkeypage();
break;
}
/* FALLTHROUGH */
case '\r':
case '\n':
done = 1;
break;
default:
break;
}
++*ppbuf;
--*plen;
}
if (done)
BindkeyAbort();
}
static void BindkeyRedisplayLine(int y, int xs, int xe, int isblank) {
if (y < 0) {
bindkeypage();
return;
}
if (y != 0 && y != flayer->l_height - 1)
return;
if (!isblank)
LClearArea(flayer, xs, y, xe, y, 0, 0);
}
#endif /* MAPKEYS */
/* The zmodem active page */
#ifdef ZMODEM
static void ZmodemRedisplayLine __P((int, int, int, int));
static int ZmodemResize __P((int, int));
static struct LayFuncs ZmodemLf = {
DefProcess,
0,
ZmodemRedisplayLine,
DefClearLine,
DefRewrite,
ZmodemResize,
DefRestore,
0
};
/*ARGSUSED*/
static int ZmodemResize(int wi, int he) {
flayer->l_width = wi;
flayer->l_height = he;
flayer->l_x = flayer->l_width > 32 ? 32 : 0;
return 0;
}
static void ZmodemRedisplayLine(int y, int xs, int xe, int isblank) {
DefRedisplayLine(y, xs, xe, isblank);
if (y == 0 && xs == 0)
LPutStr(flayer, "Zmodem active on another display", flayer->l_width > 32 ? 32 : flayer->l_width, &mchar_blank, 0, 0);
}
void ZmodemPage() {
if (InitOverlayPage(1, &ZmodemLf, 1))
return;
LRefreshAll(flayer, 0);
flayer->l_x = flayer->l_width > 32 ? 32 : 0;
flayer->l_y = 0;
}
#endif
static void PadStr(char *str, int n, int x, int y) {
int l;
l = strlen(str);
if (l > n)
l = n;
LPutStr(flayer, str, l, &mchar_blank, x, y);
if (l < n)
LPutStr(flayer, (char *)blank, n - l, &mchar_blank, x + l, y);
}

189
image.h Normal file
View file

@ -0,0 +1,189 @@
/* Copyright (c) 2008, 2009
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Micah Cowan (micah@cowan.name)
* Sadrul Habib Chowdhury (sadrul@users.sourceforge.net)
* Copyright (c) 1993-2002, 2003, 2005, 2006, 2007
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
*
* 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 3, 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 (see the file COPYING); if not, see
* https://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*
****************************************************************
* $Id$ GNU
*/
#undef IFFONT
#undef IFCOLOR
#ifdef FONT
# define IFFONT(x) x
# define IFFONTX(x) x
#else
# define IFFONT(x)
# define IFFONTX(x)
#endif
#ifdef COLOR
# define IFCOLOR(x) x
#else
# define IFCOLOR(x)
#endif
#if defined(COLOR) && defined(COLORS16) && defined(COLORS256)
# define IFCOLORX(x) x
#else
# define IFCOLORX(x)
#endif
#ifdef DW_CHARS
# define IFDWCHAR(x) x
#else
# define IFDWCHAR(x)
#endif
struct mchar {
unsigned char image;
unsigned char attr;
IFFONT( unsigned char font; )
IFFONTX( unsigned char fontx; )
IFCOLOR( unsigned char color; )
IFCOLORX(unsigned char colorx; )
IFDWCHAR(unsigned char mbcs; )
};
struct mline {
unsigned char *image;
unsigned char *attr;
IFFONT( unsigned char *font; )
IFFONTX( unsigned char *fontx; )
IFCOLOR( unsigned char *color; )
IFCOLORX(unsigned char *colorx; )
};
#define save_mline(ml, n) do { \
bcopy((char *)(ml)->image, (char *)mline_old.image, (n)); \
bcopy((char *)(ml)->attr, (char *)mline_old.attr, (n)); \
IFFONT( bcopy((char *)(ml)->font, (char *)mline_old.font, (n)); ) \
IFFONTX( bcopy((char *)(ml)->fontx, (char *)mline_old.fontx, (n)); ) \
IFCOLOR( bcopy((char *)(ml)->color, (char *)mline_old.color, (n)); ) \
IFCOLORX(bcopy((char *)(ml)->colorx, (char *)mline_old.colorx, (n)); ) \
} while (0)
#define bcopy_mline(ml, xf, xt, n) do { \
bcopy((char *)(ml)->image + (xf), (char *)(ml)->image + (xt), (n)); \
bcopy((char *)(ml)->attr + (xf), (char *)(ml)->attr + (xt), (n)); \
IFFONT( bcopy((char *)(ml)->font + (xf), (char *)(ml)->font + (xt), (n)); ) \
IFFONTX( bcopy((char *)(ml)->fontx + (xf), (char *)(ml)->fontx + (xt), (n)); ) \
IFCOLOR( bcopy((char *)(ml)->color + (xf), (char *)(ml)->color + (xt), (n)); ) \
IFCOLORX(bcopy((char *)(ml)->colorx + (xf), (char *)(ml)->colorx + (xt), (n));) \
} while (0)
#define clear_mline(ml, x, n) do { \
bclear((char *)(ml)->image + (x), (n)); \
if ((ml)->attr != null) bzero((char *)(ml)->attr + (x), (n)); \
IFFONT( if ((ml)->font != null) bzero((char *)(ml)->font + (x), (n)); ) \
IFFONTX( if ((ml)->fontx != null) bzero((char *)(ml)->fontx + (x), (n)); ) \
IFCOLOR( if ((ml)->color!= null) bzero((char *)(ml)->color + (x), (n)); ) \
IFCOLORX(if ((ml)->colorx!= null) bzero((char *)(ml)->colorx + (x), (n)); ) \
} while (0)
#define cmp_mline(ml1, ml2, x) ( \
(ml1)->image[x] == (ml2)->image[x] \
&& (ml1)->attr[x] == (ml2)->attr[x] \
IFFONT( && (ml1)->font[x] == (ml2)->font[x] ) \
IFFONTX( && (ml1)->fontx[x] == (ml2)->fontx[x] ) \
IFCOLOR( && (ml1)->color[x] == (ml2)->color[x] ) \
IFCOLORX(&& (ml1)->colorx[x] == (ml2)->colorx[x] ) \
)
#define cmp_mchar(mc1, mc2) ( \
(mc1)->image == (mc2)->image \
&& (mc1)->attr == (mc2)->attr \
IFFONT( && (mc1)->font == (mc2)->font ) \
IFFONTX( && (mc1)->fontx == (mc2)->fontx ) \
IFCOLOR( && (mc1)->color == (mc2)->color ) \
IFCOLORX(&& (mc1)->colorx == (mc2)->colorx ) \
)
#define cmp_mchar_mline(mc, ml, x) ( \
(mc)->image == (ml)->image[x] \
&& (mc)->attr == (ml)->attr[x] \
IFFONT( && (mc)->font == (ml)->font[x] ) \
IFFONTX( && (mc)->fontx == (ml)->fontx[x] ) \
IFCOLOR( && (mc)->color == (ml)->color[x] ) \
IFCOLORX(&& (mc)->colorx == (ml)->colorx[x] ) \
)
#define copy_mchar2mline(mc, ml, x) do { \
(ml)->image[x] = (mc)->image; \
(ml)->attr[x] = (mc)->attr; \
IFFONT( (ml)->font[x] = (mc)->font; ) \
IFFONTX( (ml)->fontx[x] = (mc)->fontx; ) \
IFCOLOR( (ml)->color[x] = (mc)->color; ) \
IFCOLORX((ml)->colorx[x] = (mc)->colorx; ) \
} while (0)
#define copy_mline2mchar(mc, ml, x) do { \
(mc)->image = (ml)->image[x]; \
(mc)->attr = (ml)->attr[x]; \
IFFONT( (mc)->font = (ml)->font[x]; ) \
IFFONTX( (mc)->fontx = (ml)->fontx[x]; ) \
IFCOLOR( (mc)->color = (ml)->color[x]; ) \
IFCOLORX((mc)->colorx = (ml)->colorx[x]; ) \
IFDWCHAR((mc)->mbcs = 0; ) \
} while (0)
#ifdef COLOR
# ifdef COLORS16
# ifdef COLORS256
# define rend_getbg(mc) (((mc)->color & 0xf0) >> 4 | ((mc)->attr & A_BBG ? 0x100 : 0) | ((mc)->colorx & 0xf0))
# define rend_setbg(mc, c) ((mc)->color = ((mc)->color & 0x0f) | (c << 4 & 0xf0), (mc)->colorx = ((mc)->colorx & 0x0f) | (c & 0xf0), (mc)->attr = ((mc)->attr | A_BBG) ^ (c & 0x100 ? 0 : A_BBG))
# define rend_getfg(mc) (((mc)->color & 0x0f) | ((mc)->attr & A_BFG ? 0x100 : 0) | (((mc)->colorx & 0x0f) << 4))
# define rend_setfg(mc, c) ((mc)->color = ((mc)->color & 0xf0) | (c & 0x0f), (mc)->colorx = ((mc)->colorx & 0xf0) | ((c & 0xf0) >> 4), (mc)->attr = ((mc)->attr | A_BFG) ^ (c & 0x100 ? 0 : A_BFG))
# define rend_setdefault(mc) ((mc)->color = (mc)->colorx = 0, (mc)->attr &= ~(A_BBG|A_BFG))
# else
# define rend_getbg(mc) (((mc)->color & 0xf0) >> 4 | ((mc)->attr & A_BBG ? 0x100 : 0))
# define rend_setbg(mc, c) ((mc)->color = ((mc)->color & 0x0f) | (c << 4 & 0xf0), (mc)->attr = ((mc)->attr | A_BBG) ^ (c & 0x100 ? 0 : A_BBG))
# define rend_getfg(mc) (((mc)->color & 0x0f) | ((mc)->attr & A_BFG ? 0x100 : 0))
# define rend_setfg(mc, c) ((mc)->color = ((mc)->color & 0xf0) | (c & 0x0f), (mc)->attr = ((mc)->attr | A_BFG) ^ (c & 0x100 ? 0 : A_BFG))
# define rend_setdefault(mc) ((mc)->color = 0, (mc)->attr &= ~(A_BBG|A_BFG))
# endif
# define coli2e(c) ((((c) & 0x1f8) == 0x108 ? (c) ^ 0x108 : (c & 0xff)) ^ 9)
# define cole2i(c) ((c) >= 8 && (c) < 16 ? (c) ^ 0x109 : (c) ^ 9)
# else
# define rend_getbg(mc) (((mc)->color & 0xf0) >> 4)
# define rend_setbg(mc, c) ((mc)->color = ((mc)->color & 0x0f) | (c << 4 & 0xf0))
# define rend_getfg(mc) ((mc)->color & 0x0f)
# define rend_setfg(mc, c) ((mc)->color = ((mc)->color & 0xf0) | (c & 0x0f))
# define rend_setdefault(mc) ((mc)->color = 0)
# define coli2e(c) ((c) ^ 9)
# define cole2i(c) ((c) ^ 9)
# endif
#endif
enum
{
REND_BELL = 0,
REND_MONITOR,
REND_SILENCE,
NUM_RENDS
};

528
input.c Normal file
View file

@ -0,0 +1,528 @@
/* Copyright (c) 2008, 2009
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Micah Cowan (micah@cowan.name)
* Sadrul Habib Chowdhury (sadrul@users.sourceforge.net)
* Copyright (c) 1993-2002, 2003, 2005, 2006, 2007
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
*
* 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 3, 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 (see the file COPYING); if not, see
* https://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*
****************************************************************
*/
#include <sys/types.h>
#include "config.h"
#include "screen.h"
#include "extern.h"
#define INPUTLINE (flayer->l_height - 1)
static void InpProcess __P((char **, int *));
static void InpAbort __P((void));
static void InpRedisplayLine __P((int, int, int, int));
extern struct layer *flayer;
extern struct display *display;
extern struct mchar mchar_blank, mchar_so;
struct inpline
{
char buf[MAXSTR+1]; /* text buffer */
int len; /* length of the editible string */
int pos; /* cursor position in editable string */
struct inpline *next, *prev;
};
/* 'inphist' is used to store the current input when scrolling through history.
* inpline->prev == history-prev
* inpline->next == history-next
*/
static struct inpline inphist;
struct inpdata
{
struct inpline inp;
int inpmaxlen; /* MAXSTR, or less, if caller has shorter buffer */
char *inpstring; /* the prompt */
int inpstringlen; /* length of the prompt */
int inpmode; /* INP_NOECHO, INP_RAW, INP_EVERY */
void (*inpfinfunc) __P((char *buf, int len, char *priv));
char *priv; /* private data for finfunc */
int privdata; /* private data space */
char *search; /* the search string */
};
static struct LayFuncs InpLf =
{
InpProcess,
InpAbort,
InpRedisplayLine,
DefClearLine,
DefRewrite,
DefResize,
DefRestore,
0
};
/*
** Here is the input routine
*/
/* called once, after InitOverlayPage in Input() or Isearch() */
void
inp_setprompt(p, s)
char *p, *s;
{
struct inpdata *inpdata;
inpdata = (struct inpdata *)flayer->l_data;
if (p)
{
inpdata->inpstringlen = strlen(p);
inpdata->inpstring = p;
}
if (s)
{
if (s != inpdata->inp.buf)
strncpy(inpdata->inp.buf, s, sizeof(inpdata->inp.buf) - 1);
inpdata->inp.buf[sizeof(inpdata->inp.buf) - 1] = 0;
inpdata->inp.pos = inpdata->inp.len = strlen(inpdata->inp.buf);
}
InpRedisplayLine(INPUTLINE, 0, flayer->l_width - 1, 0);
flayer->l_x = inpdata->inpstringlen + (inpdata->inpmode & INP_NOECHO ? 0 : inpdata->inp.pos);
flayer->l_y = INPUTLINE;
}
/*
* We dont use HS status line with Input().
* If we would use it, then we should check e_tgetflag("es") if
* we are allowed to use esc sequences there.
*
* mode is an OR of
* INP_NOECHO == suppress echoing of characters.
* INP_RAW == raw mode. call finfunc after each character typed.
* INP_EVERY == digraph mode.
*/
void
Input(istr, len, mode, finfunc, priv, data)
char *istr;
int len;
int mode;
void (*finfunc) __P((char *buf, int len, char *priv));
char *priv;
int data;
{
int maxlen;
struct inpdata *inpdata;
if (!flayer)
return;
if (len > MAXSTR)
len = MAXSTR;
if (!(mode & INP_NOECHO))
{
maxlen = flayer->l_width - 1 - strlen(istr);
if (len > maxlen)
len = maxlen;
}
if (len < 0)
{
LMsg(0, "Width %d chars too small", -len);
return;
}
if (InitOverlayPage(sizeof(*inpdata), &InpLf, 1))
return;
flayer->l_mode = 1;
inpdata = (struct inpdata *)flayer->l_data;
inpdata->inpmaxlen = len;
inpdata->inpfinfunc = finfunc;
inpdata->inp.pos = inpdata->inp.len = 0;
inpdata->inp.prev = inphist.prev;
inpdata->inpmode = mode;
inpdata->privdata = data;
if (!priv)
priv = (char*)&inpdata->privdata;
inpdata->priv = priv;
inpdata->inpstringlen = 0;
inpdata->inpstring = NULL;
inpdata->search = NULL;
if (istr)
inp_setprompt(istr, (char *)NULL);
}
static void
erase_chars(inpdata, from, to, x, mv)
struct inpdata *inpdata;
char *from;
char *to;
int x;
int mv;
{
int chng;
ASSERT(from < to);
if (inpdata->inp.len > to - inpdata->inp.buf)
bcopy(to, from, inpdata->inp.len - (to - inpdata->inp.buf));
chng = to - from;
if (mv)
{
x -= chng;
inpdata->inp.pos -= chng;
}
inpdata->inp.len -= chng;
if (!(inpdata->inpmode & INP_NOECHO))
{
struct mchar mc;
char *s = from < to ? from : to;
mc = mchar_so;
while (s < inpdata->inp.buf+inpdata->inp.len)
{
mc.image = *s++;
LPutChar(flayer, &mc, x++, INPUTLINE);
}
while (chng--)
LPutChar(flayer, &mchar_blank, x++, INPUTLINE);
x = inpdata->inpstringlen + inpdata->inp.pos;
LGotoPos(flayer, x, INPUTLINE);
}
}
static void
InpProcess(ppbuf, plen)
char **ppbuf;
int *plen;
{
int len, x;
char *pbuf;
char ch;
struct inpdata *inpdata;
struct display *inpdisplay;
int prev, next, search = 0;
inpdata = (struct inpdata *)flayer->l_data;
inpdisplay = display;
#define RESET_SEARCH do { if (inpdata->search) Free(inpdata->search); } while (0)
LGotoPos(flayer, inpdata->inpstringlen + (inpdata->inpmode & INP_NOECHO ? 0 : inpdata->inp.pos), INPUTLINE);
if (ppbuf == 0)
{
InpAbort();
return;
}
x = inpdata->inpstringlen + inpdata->inp.pos;
len = *plen;
pbuf = *ppbuf;
while (len)
{
char *p = inpdata->inp.buf + inpdata->inp.pos;
ch = *pbuf++;
len--;
if (inpdata->inpmode & INP_EVERY)
{
inpdata->inp.buf[inpdata->inp.len] = ch;
if (ch)
{
display = inpdisplay;
(*inpdata->inpfinfunc)(inpdata->inp.buf, inpdata->inp.len, inpdata->priv);
ch = inpdata->inp.buf[inpdata->inp.len];
}
}
else if (inpdata->inpmode & INP_RAW)
{
display = inpdisplay;
(*inpdata->inpfinfunc)(&ch, 1, inpdata->priv); /* raw */
if (ch)
continue;
}
if (((unsigned char)ch & 0177) >= ' ' && ch != 0177 && inpdata->inp.len < inpdata->inpmaxlen)
{
if (inpdata->inp.len > inpdata->inp.pos)
bcopy(p, p+1, inpdata->inp.len - inpdata->inp.pos);
inpdata->inp.buf[inpdata->inp.pos++] = ch;
inpdata->inp.len++;
if (!(inpdata->inpmode & INP_NOECHO))
{
struct mchar mc;
mc = mchar_so;
mc.image = *p++;
LPutChar(flayer, &mc, x, INPUTLINE);
x++;
if (p < inpdata->inp.buf+inpdata->inp.len)
{
while (p < inpdata->inp.buf+inpdata->inp.len)
{
mc.image = *p++;
LPutChar(flayer, &mc, x++, INPUTLINE);
}
x = inpdata->inpstringlen + inpdata->inp.pos;
LGotoPos(flayer, x, INPUTLINE);
}
}
RESET_SEARCH;
}
else if ((ch == '\b' || ch == 0177) && inpdata->inp.pos > 0)
{
erase_chars(inpdata, p-1, p, x, 1);
RESET_SEARCH;
}
else if (ch == '\025') /* CTRL-U */
{
x = inpdata->inpstringlen;
if (inpdata->inp.len && !(inpdata->inpmode & INP_NOECHO))
{
LClearArea(flayer, x, INPUTLINE, x + inpdata->inp.len - 1, INPUTLINE, 0, 0);
LGotoPos(flayer, x, INPUTLINE);
}
inpdata->inp.len = inpdata->inp.pos = 0;
}
else if (ch == '\013') /* CTRL-K */
{
x = inpdata->inpstringlen + inpdata->inp.pos;
if (inpdata->inp.len > inpdata->inp.pos && !(inpdata->inpmode & INP_NOECHO))
{
LClearArea(flayer, x, INPUTLINE, x + inpdata->inp.len - inpdata->inp.pos - 1, INPUTLINE, 0, 0);
LGotoPos(flayer, x, INPUTLINE);
}
inpdata->inp.len = inpdata->inp.pos;
}
else if (ch == '\027' && inpdata->inp.pos > 0) /* CTRL-W */
{
char *oldp = p--;
while (p > inpdata->inp.buf && *p == ' ')
p--;
while (p > inpdata->inp.buf && *(p - 1) != ' ')
p--;
erase_chars(inpdata, p, oldp, x, 1);
RESET_SEARCH;
}
else if (ch == '\004' && inpdata->inp.pos < inpdata->inp.len) /* CTRL-D */
{
erase_chars(inpdata, p, p+1, x, 0);
RESET_SEARCH;
}
else if (ch == '\001' || (unsigned char)ch == 0201) /* CTRL-A */
{
LGotoPos(flayer, x -= inpdata->inp.pos, INPUTLINE);
inpdata->inp.pos = 0;
}
else if ((ch == '\002' || (unsigned char)ch == 0202) && inpdata->inp.pos > 0) /* CTRL-B */
{
LGotoPos(flayer, --x, INPUTLINE);
inpdata->inp.pos--;
}
else if (ch == '\005' || (unsigned char)ch == 0205) /* CTRL-E */
{
LGotoPos(flayer, x += inpdata->inp.len - inpdata->inp.pos, INPUTLINE);
inpdata->inp.pos = inpdata->inp.len;
}
else if ((ch == '\006' || (unsigned char)ch == 0206) && inpdata->inp.pos < inpdata->inp.len) /* CTRL-F */
{
LGotoPos(flayer, ++x, INPUTLINE);
inpdata->inp.pos++;
}
else if ((prev = ((ch == '\020' || (unsigned char)ch == 0220) && /* CTRL-P */
inpdata->inp.prev)) ||
(next = ((ch == '\016' || (unsigned char)ch == 0216) && /* CTRL-N */
inpdata->inp.next)) ||
(search = ((ch == '\022' || (unsigned char)ch == 0222) && inpdata->inp.prev)))
{
struct mchar mc;
struct inpline *sel;
int pos = -1;
mc = mchar_so;
if (prev)
sel = inpdata->inp.prev;
else if (next)
sel = inpdata->inp.next;
else
{
/* search */
inpdata->inp.buf[inpdata->inp.len] = 0; /* Remove the ctrl-r from the end */
if (!inpdata->search)
inpdata->search = SaveStr(inpdata->inp.buf);
for (sel = inpdata->inp.prev; sel; sel = sel->prev)
{
char *f;
if ((f = strstr(sel->buf, inpdata->search)))
{
pos = f - sel->buf;
break;
}
}
if (!sel)
continue; /* Did not find a match. Process the next input. */
}
if (inpdata->inp.len && !(inpdata->inpmode & INP_NOECHO))
LClearArea(flayer, inpdata->inpstringlen, INPUTLINE, inpdata->inpstringlen + inpdata->inp.len - 1, INPUTLINE, 0, 0);
if ((prev || search) && !inpdata->inp.next)
inphist = inpdata->inp;
memcpy(&inpdata->inp, sel, sizeof(struct inpline));
if (pos != -1)
inpdata->inp.pos = pos;
if (inpdata->inp.len > inpdata->inpmaxlen)
inpdata->inp.len = inpdata->inpmaxlen;
if (inpdata->inp.pos > inpdata->inp.len)
inpdata->inp.pos = inpdata->inp.len;
x = inpdata->inpstringlen;
p = inpdata->inp.buf;
if (!(inpdata->inpmode & INP_NOECHO))
{
while (p < inpdata->inp.buf+inpdata->inp.len)
{
mc.image = *p++;
LPutChar(flayer, &mc, x++, INPUTLINE);
}
}
x = inpdata->inpstringlen + inpdata->inp.pos;
LGotoPos(flayer, x, INPUTLINE);
}
else if (ch == '\003' || ch == '\007' || ch == '\033' ||
ch == '\000' || ch == '\n' || ch == '\r')
{
if (ch != '\n' && ch != '\r')
inpdata->inp.len = 0;
inpdata->inp.buf[inpdata->inp.len] = 0;
if (inpdata->inp.len && !(inpdata->inpmode & (INP_NOECHO | INP_RAW)))
{
struct inpline *store;
/* Look for a duplicate first */
for (store = inphist.prev; store; store = store->prev)
{
if (strcmp(store->buf, inpdata->inp.buf) == 0)
{
if (store->next)
store->next->prev = store->prev;
if (store->prev)
store->prev->next = store->next;
store->pos = inpdata->inp.pos;
break;
}
}
if (!store)
{
store = malloc(sizeof(struct inpline));
memcpy(store, &inpdata->inp, sizeof(struct inpline));
}
store->next = &inphist;
store->prev = inphist.prev;
if (inphist.prev)
inphist.prev->next = store;
inphist.prev = store;
}
flayer->l_data = 0; /* so inpdata does not get freed */
InpAbort(); /* redisplays... */
*ppbuf = pbuf;
*plen = len;
display = inpdisplay;
if ((inpdata->inpmode & INP_RAW) == 0)
(*inpdata->inpfinfunc)(inpdata->inp.buf, inpdata->inp.len, inpdata->priv);
else
(*inpdata->inpfinfunc)(pbuf - 1, 0, inpdata->priv);
if (inpdata->search)
free(inpdata->search);
free(inpdata);
return;
}
else
{
/* The user was searching, and then pressed some non-control input. So reset
* the search string. */
RESET_SEARCH;
}
}
if (!(inpdata->inpmode & INP_RAW))
{
flayer->l_x = inpdata->inpstringlen + (inpdata->inpmode & INP_NOECHO ? 0 : inpdata->inp.pos);
flayer->l_y = INPUTLINE;
}
*ppbuf = pbuf;
*plen = len;
}
static void
InpAbort()
{
LAY_CALL_UP(LayRedisplayLine(INPUTLINE, 0, flayer->l_width - 1, 0));
ExitOverlayPage();
}
static void
InpRedisplayLine(y, xs, xe, isblank)
int y, xs, xe, isblank;
{
int q, r, s, l, v;
struct inpdata *inpdata;
inpdata = (struct inpdata *)flayer->l_data;
if (y != INPUTLINE)
{
LAY_CALL_UP(LayRedisplayLine(y, xs, xe, isblank));
return;
}
inpdata->inp.buf[inpdata->inp.len] = 0;
q = xs;
v = xe - xs + 1;
s = 0;
r = inpdata->inpstringlen;
if (v > 0 && q < r)
{
l = v;
if (l > r - q)
l = r - q;
LPutStr(flayer, inpdata->inpstring + q - s, l, &mchar_so, q, y);
q += l;
v -= l;
}
s = r;
r += inpdata->inp.len;
if (!(inpdata->inpmode & INP_NOECHO) && v > 0 && q < r)
{
l = v;
if (l > r - q)
l = r - q;
LPutStr(flayer, inpdata->inp.buf + q - s, l, &mchar_so, q, y);
q += l;
v -= l;
}
s = r;
r = flayer->l_width;
if (!isblank && v > 0 && q < r)
{
l = v;
if (l > r - q)
l = r - q;
LClearArea(flayer, q, y, q + l - 1, y, 0, 0);
q += l;
}
}

541
install-sh Executable file
View file

@ -0,0 +1,541 @@
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2020-11-14.01; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# 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.
tab=' '
nl='
'
IFS=" $tab$nl"
# Set DOITPROG to "echo" to test this script.
doit=${DOITPROG-}
doit_exec=${doit:-exec}
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
chgrpprog=${CHGRPPROG-chgrp}
chmodprog=${CHMODPROG-chmod}
chownprog=${CHOWNPROG-chown}
cmpprog=${CMPPROG-cmp}
cpprog=${CPPROG-cp}
mkdirprog=${MKDIRPROG-mkdir}
mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}
posix_mkdir=
# Desired mode of installed file.
mode=0755
# Create dirs (including intermediate dirs) using mode 755.
# This is like GNU 'install' as of coreutils 8.32 (2020).
mkdir_umask=22
backupsuffix=
chgrpcmd=
chmodcmd=$chmodprog
chowncmd=
mvcmd=$mvprog
rmcmd="$rmprog -f"
stripcmd=
src=
dst=
dir_arg=
dst_arg=
copy_on_change=false
is_target_a_directory=possibly
usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options:
--help display this help and exit.
--version display version info and exit.
-c (ignored)
-C install only if different (preserve data modification time)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-p pass -p to $cpprog.
-s $stripprog installed files.
-S SUFFIX attempt to back up existing files, with suffix SUFFIX.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
RMPROG STRIPPROG
By default, rm is invoked with -f; when overridden with RMPROG,
it's up to you to specify -f if you want it.
If -S is not specified, no backups are attempted.
Email bug reports to bug-automake@gnu.org.
Automake home page: https://www.gnu.org/software/automake/
"
while test $# -ne 0; do
case $1 in
-c) ;;
-C) copy_on_change=true;;
-d) dir_arg=true;;
-g) chgrpcmd="$chgrpprog $2"
shift;;
--help) echo "$usage"; exit $?;;
-m) mode=$2
case $mode in
*' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
echo "$0: invalid mode: $mode" >&2
exit 1;;
esac
shift;;
-o) chowncmd="$chownprog $2"
shift;;
-p) cpprog="$cpprog -p";;
-s) stripcmd=$stripprog;;
-S) backupsuffix="$2"
shift;;
-t)
is_target_a_directory=always
dst_arg=$2
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
shift;;
-T) is_target_a_directory=never;;
--version) echo "$0 $scriptversion"; exit $?;;
--) shift
break;;
-*) echo "$0: invalid option: $1" >&2
exit 1;;
*) break;;
esac
shift
done
# We allow the use of options -d and -T together, by making -d
# take the precedence; this is for compatibility with GNU install.
if test -n "$dir_arg"; then
if test -n "$dst_arg"; then
echo "$0: target directory not allowed when installing a directory." >&2
exit 1
fi
fi
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dst_arg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dst_arg"
shift # fnord
fi
shift # arg
dst_arg=$arg
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
done
fi
if test $# -eq 0; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call 'install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
if test -z "$dir_arg"; then
if test $# -gt 1 || test "$is_target_a_directory" = always; then
if test ! -d "$dst_arg"; then
echo "$0: $dst_arg: Is not a directory." >&2
exit 1
fi
fi
fi
if test -z "$dir_arg"; then
do_exit='(exit $ret); exit $ret'
trap "ret=129; $do_exit" 1
trap "ret=130; $do_exit" 2
trap "ret=141; $do_exit" 13
trap "ret=143; $do_exit" 15
# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
case $mode in
# Optimize common cases.
*644) cp_umask=133;;
*755) cp_umask=22;;
*[0-7])
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
fi
for src
do
# Protect names problematic for 'test' and other utilities.
case $src in
-* | [=\(\)!]) src=./$src;;
esac
if test -n "$dir_arg"; then
dst=$src
dstdir=$dst
test -d "$dstdir"
dstdir_status=$?
# Don't chown directories that already exist.
if test $dstdir_status = 0; then
chowncmd=""
fi
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dst_arg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dst_arg
# If destination is a directory, append the input filename.
if test -d "$dst"; then
if test "$is_target_a_directory" = never; then
echo "$0: $dst_arg: Is a directory" >&2
exit 1
fi
dstdir=$dst
dstbase=`basename "$src"`
case $dst in
*/) dst=$dst$dstbase;;
*) dst=$dst/$dstbase;;
esac
dstdir_status=0
else
dstdir=`dirname "$dst"`
test -d "$dstdir"
dstdir_status=$?
fi
fi
case $dstdir in
*/) dstdirslash=$dstdir;;
*) dstdirslash=$dstdir/;;
esac
obsolete_mkdir_used=false
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
# With -d, create the new directory with the user-specified mode.
# Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then
mkdir_mode=-m$mode
else
mkdir_mode=
fi
posix_mkdir=false
# The $RANDOM variable is not portable (e.g., dash). Use it
# here however when possible just to lower collision chance.
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap '
ret=$?
rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null
exit $ret
' 0
# Because "mkdir -p" follows existing symlinks and we likely work
# directly in world-writeable /tmp, make sure that the '$tmpdir'
# directory is successfully created first before we actually test
# 'mkdir -p'.
if (umask $mkdir_umask &&
$mkdirprog $mkdir_mode "$tmpdir" &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
then
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
test_tmpdir="$tmpdir/a"
ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
$mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
else
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
fi
trap '' 0;;
esac
if
$posix_mkdir && (
umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
# mkdir does not conform to POSIX,
# or it failed possibly due to a race condition. Create the
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
/*) prefix='/';;
[-=\(\)!]*) prefix='./';;
*) prefix='';;
esac
oIFS=$IFS
IFS=/
set -f
set fnord $dstdir
shift
set +f
IFS=$oIFS
prefixes=
for d
do
test X"$d" = X && continue
prefix=$prefix$d
if test -d "$prefix"; then
prefixes=
else
if $posix_mkdir; then
(umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1
else
case $prefix in
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
*) qprefix=$prefix;;
esac
prefixes="$prefixes '$qprefix'"
fi
fi
prefix=$prefix/
done
if test -n "$prefixes"; then
# Don't fail if two instances are running concurrently.
(umask $mkdir_umask &&
eval "\$doit_exec \$mkdirprog $prefixes") ||
test -d "$dstdir" || exit 1
obsolete_mkdir_used=true
fi
fi
fi
if test -n "$dir_arg"; then
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
else
# Make a couple of temp file names in the proper directory.
dsttmp=${dstdirslash}_inst.$$_
rmtmp=${dstdirslash}_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
# Copy the file name to the temp name.
(umask $cp_umask &&
{ test -z "$stripcmd" || {
# Create $dsttmp read-write so that cp doesn't create it read-only,
# which would cause strip to fail.
if test -z "$doit"; then
: >"$dsttmp" # No need to fork-exec 'touch'.
else
$doit touch "$dsttmp"
fi
}
} &&
$doit_exec $cpprog "$src" "$dsttmp") &&
# 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 $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
# If -C, don't bother to copy if it wouldn't change the file.
if $copy_on_change &&
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
set -f &&
set X $old && old=:$2:$4:$5:$6 &&
set X $new && new=:$2:$4:$5:$6 &&
set +f &&
test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then
rm -f "$dsttmp"
else
# If $backupsuffix is set, and the file being installed
# already exists, attempt a backup. Don't worry if it fails,
# e.g., if mv doesn't support -f.
if test -n "$backupsuffix" && test -f "$dst"; then
$doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null
fi
# Rename the file to the real destination.
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
{
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
test ! -f "$dst" ||
$doit $rmcmd "$dst" 2>/dev/null ||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
{ $doit $rmcmd "$rmtmp" 2>/dev/null; :; }
} ||
{ echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1
}
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst"
}
fi || exit 1
trap '' 0
fi
done
# Local variables:
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:

119
install.sh Executable file
View file

@ -0,0 +1,119 @@
#! /bin/sh
#
# install - install a program, script, or datafile
# This comes from X11R5; it is not part of GNU.
#
# $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $
#
# 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}"
instcmd="$mvprog"
chmodcmd=""
chowncmd=""
chgrpcmd=""
stripcmd=""
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=""
dst=""
while [ x"$1" != x ]; do
case $1 in
-c) instcmd="$cpprog"
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;;
*) if [ x"$src" = x ]
then
src=$1
else
dst=$1
fi
shift
continue;;
esac
done
if [ x"$src" = x ]
then
echo "install: no input file specified"
exit 1
fi
if [ x"$dst" = x ]
then
echo "install: no destination specified"
exit 1
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`
fi
# Make a temp file name in the proper directory.
dstdir=`dirname $dst`
dsttmp=$dstdir/#inst.$$#
# Move or copy the file name to the temp name
$doit $instcmd $src $dsttmp
# and set any options; do chmod last to preserve setuid bits
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; fi
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; fi
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; fi
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; fi
# Now rename the file to the real destination.
$doit $rmcmd $dst
$doit $mvcmd $dsttmp $dst
exit 0

1247
layer.c Normal file

File diff suppressed because it is too large Load diff

163
layer.h Normal file
View file

@ -0,0 +1,163 @@
/* Copyright (c) 2008, 2009
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Micah Cowan (micah@cowan.name)
* Sadrul Habib Chowdhury (sadrul@users.sourceforge.net)
* Copyright (c) 1993-2002, 2003, 2005, 2006, 2007
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
*
* 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 3, 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 (see the file COPYING); if not, see
* https://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*
****************************************************************
* $Id$ GNU
*/
#ifndef SCREEN_LAYER_H
#define SCREEN_LAYER_H
/*
* This is the overlay structure. It is used to create a seperate
* layer over the current windows.
*/
struct mchar; /* forward declaration */
struct LayFuncs
{
void (*lf_LayProcess) __P((char **, int *));
void (*lf_LayAbort) __P((void));
void (*lf_LayRedisplayLine) __P((int, int, int, int));
void (*lf_LayClearLine) __P((int, int, int, int));
int (*lf_LayRewrite) __P((int, int, int, struct mchar *, int));
int (*lf_LayResize) __P((int, int));
void (*lf_LayRestore) __P((void));
void (*lf_LayFree) __P((void *)); /* Should only free any data kept in
flayer->l_data (but not flayer->l_data itself). */
};
struct layer
{
struct canvas *l_cvlist; /* list of canvases displaying layer */
int l_width;
int l_height;
int l_x; /* cursor position */
int l_y;
int l_encoding;
struct LayFuncs *l_layfn;
void *l_data;
struct layer *l_next; /* layer stack, should be in data? */
struct layer *l_bottom; /* bottom element of layer stack */
int l_blocking;
int l_mode; /* non-zero == edit mode */
struct {
unsigned char buffer[3]; /* [0]: the button
[1]: x
[2]: y
*/
int len;
int start;
} l_mouseevent;
struct {
int d : 1; /* Is the output for the layer blocked? */
/* After unpausing, what region should we refresh? */
int *left, *right;
int top, bottom;
int lines;
} l_pause;
};
#define LayProcess (*flayer->l_layfn->lf_LayProcess)
#define LayAbort (*flayer->l_layfn->lf_LayAbort)
#define LayRedisplayLine (*flayer->l_layfn->lf_LayRedisplayLine)
#define LayClearLine (*flayer->l_layfn->lf_LayClearLine)
#define LayRewrite (*flayer->l_layfn->lf_LayRewrite)
#define LayResize (*flayer->l_layfn->lf_LayResize)
#define LayRestore (*flayer->l_layfn->lf_LayRestore)
#define LayFree (*flayer->l_layfn->lf_LayFree)
#define LaySetCursor() LGotoPos(flayer, flayer->l_x, flayer->l_y)
#define LayCanResize(l) (l->l_layfn->LayResize != DefResize)
/* XXX: AArgh! think again! */
#define LAY_CALL_UP(fn) do \
{ \
struct layer *oldlay = flayer; \
struct canvas *oldcvlist, *cv; \
debug("LayCallUp\n"); \
flayer = flayer->l_next; \
oldcvlist = flayer->l_cvlist; \
debug1("oldcvlist: %lx\n", (long)oldcvlist); \
flayer->l_cvlist = oldlay->l_cvlist; \
for (cv = flayer->l_cvlist; cv; cv = cv->c_lnext) \
cv->c_layer = flayer; \
fn; \
flayer = oldlay; \
for (cv = flayer->l_cvlist; cv; cv = cv->c_lnext) \
cv->c_layer = flayer; \
flayer->l_next->l_cvlist = oldcvlist; \
} while(0)
#define LAY_DISPLAYS(l, fn) do \
{ \
struct display *olddisplay = display; \
struct canvas *cv; \
for (display = displays; display; display = display->d_next) \
{ \
for (cv = D_cvlist; cv; cv = cv->c_next) \
if (cv->c_layer == l) \
break; \
if (cv == 0) \
continue; \
fn; \
} \
display = olddisplay; \
} while(0)
#endif /* SCREEN_LAYER_H */
/**
* (Un)Pauses a layer.
*
* @param layer The layer that should be (un)paused.
* @param pause Should we pause the layer?
*/
void LayPause __P((struct layer *layer, int pause));
/**
* Update the region to refresh after a layer is unpaused.
*
* @param layer The layer.
* @param xs The left-end of the region.
* @param xe The right-end of the region.
* @param ys The top-end of the region.
* @param ye The bottom-end of the region.
*/
void LayPauseUpdateRegion __P((struct layer *layer, int xs, int xe, int ys, int ye));
/**
* Free any internal memory for the layer.
*
* @param layer The layer.
*/
void LayerCleanupMemory __P((struct layer *layer));

350
layout.c Normal file
View file

@ -0,0 +1,350 @@
/* Copyright (c) 2008, 2009
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Micah Cowan (micah@cowan.name)
* Sadrul Habib Chowdhury (sadrul@users.sourceforge.net)
* Copyright (c) 1993-2002, 2003, 2005, 2006, 2007
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
*
* 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 3, 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 (see the file COPYING); if not, see
* https://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*
****************************************************************
*/
#include "config.h"
#include "screen.h"
#include "extern.h"
#include "layout.h"
extern struct display *display;
extern int captionalways;
struct layout *layouts;
struct layout *laytab[MAXLAY];
struct layout *layout_last, layout_last_marker;
struct layout *layout_attach = &layout_last_marker;
void FreeLayoutCv(struct canvas *cv)
{
struct canvas *cnext, *c = cv;
for (; cv; cv = cnext) {
if (cv->c_slperp) {
FreeLayoutCv(cv->c_slperp);
free(cv->c_slperp);
cv->c_slperp = 0;
}
cnext = cv->c_slnext;
cv->c_slnext = 0;
if (cv != c)
free(cv);
}
}
struct layout *CreateLayout(char *title, int startat)
{
struct layout *lay, **pl;
int i;
if (startat >= MAXLAY || startat < 0)
startat = 0;
for (i = startat; ;) {
if (!laytab[i])
break;
if (++i == MAXLAY)
i = 0;
if (i == startat) {
Msg(0, "No more layouts\n");
return 0;
}
}
lay = (struct layout *)calloc(1, sizeof(*lay));
lay->lay_title = SaveStr(title);
lay->lay_autosave = 1;
lay->lay_number = i;
laytab[i] = lay;
lay->lay_next = 0;
pl = &layouts;
while (*pl)
pl = &(*pl)->lay_next;
*pl = lay;
return lay;
}
void SaveLayout(char *name, struct canvas *cv)
{
struct layout *lay;
struct canvas *fcv;
for (lay = layouts; lay; lay = lay->lay_next)
if (!strcmp(lay->lay_title, name))
break;
if (lay)
FreeLayoutCv(&lay->lay_canvas);
else
lay = CreateLayout(name, 0);
if (!lay)
return;
fcv = D_forecv;
DupLayoutCv(cv, &lay->lay_canvas, 1);
lay->lay_forecv = D_forecv;
D_forecv = fcv;
D_layout = lay;
}
void AutosaveLayout(struct layout *lay)
{
struct canvas *fcv;
if (!lay || !lay->lay_autosave)
return;
FreeLayoutCv(&lay->lay_canvas);
fcv = D_forecv;
DupLayoutCv(&D_canvas, &lay->lay_canvas, 1);
lay->lay_forecv = D_forecv;
D_forecv = fcv;
}
struct layout *FindLayout(char *name)
{
struct layout *lay;
char *s;
int i;
for (i = 0, s = name; *s >= '0' && *s <= '9'; s++)
i = i * 10 + (*s - '0');
if (!*s && s != name && i >= 0 && i < MAXLAY)
return laytab[i];
for (lay = layouts; lay; lay = lay->lay_next)
if (!strcmp(lay->lay_title, name))
break;
return lay;
}
void LoadLayout(struct layout *lay, struct canvas *cv)
{
AutosaveLayout(D_layout);
if (!lay) {
while (D_canvas.c_slperp)
FreeCanvas(D_canvas.c_slperp);
MakeDefaultCanvas();
SetCanvasWindow(D_forecv, 0);
D_layout = 0;
return;
}
while (D_canvas.c_slperp)
FreeCanvas(D_canvas.c_slperp);
D_cvlist = 0;
D_forecv = lay->lay_forecv;
if (!D_forecv)
MakeDefaultCanvas();
DupLayoutCv(&lay->lay_canvas, &D_canvas, 0);
D_canvas.c_ys = (D_has_hstatus == HSTATUS_FIRSTLINE);
D_canvas.c_ye = D_height - 1 - ((D_canvas.c_slperp && D_canvas.c_slperp->c_slnext) ||
captionalways) - (D_has_hstatus == HSTATUS_LASTLINE);
ResizeCanvas(&D_canvas);
RecreateCanvasChain();
RethinkDisplayViewports();
PutWindowCv(&D_canvas);
ResizeLayersToCanvases();
D_layout = lay;
}
void NewLayout(char *title, int startat)
{
struct layout *lay;
struct canvas *fcv;
lay = CreateLayout(title, startat);
if (!lay)
return;
if (display) {
LoadLayout(0, &D_canvas);
fcv = D_forecv;
DupLayoutCv(&D_canvas, &lay->lay_canvas, 1);
lay->lay_forecv = D_forecv;
D_forecv = fcv;
D_layout = lay;
}
else
layout_attach = lay;
lay->lay_autosave = 1;
}
static char *AddLayoutsInfo(char *buf, int len, int where)
{
char *s, *ss, *t;
struct layout *p, **pp;
int l;
s = ss = buf;
for (pp = laytab; pp < laytab + MAXLAY; pp++) {
if (pp - laytab == where && ss == buf)
ss = s;
if ((p = *pp) == 0)
continue;
t = p->lay_title;
l = strlen(t);
if (l > 20)
l = 20;
if (s - buf + l > len - 24)
break;
if (s > buf) {
*s++ = ' ';
*s++ = ' ';
}
sprintf(s, "%d", p->lay_number);
if (p->lay_number == where)
ss = s;
s += strlen(s);
if (display && p == D_layout)
*s++ = '*';
*s++ = ' ';
strncpy(s, t, l);
s += l;
}
*s = 0;
return ss;
}
void ShowLayouts(int where)
{
char buf[1024];
char *s, *ss;
if (!display)
return;
if (!layouts) {
Msg(0, "No layouts defined\n");
return;
}
if (where == -1 && D_layout)
where = D_layout->lay_number;
ss = AddLayoutsInfo(buf, sizeof(buf), where);
s = buf + strlen(buf);
if (ss - buf > D_width / 2) {
ss -= D_width / 2;
if (s - ss < D_width) {
ss = s - D_width;
if (ss < buf)
ss = buf;
}
}
else
ss = buf;
Msg(0, "%s", ss);
}
void RemoveLayout(struct layout *lay)
{
struct layout **layp = &layouts;
for (; *layp; layp = &(*layp)->lay_next) {
if (*layp == lay) {
*layp = lay->lay_next;
break;
}
}
laytab[lay->lay_number] = (struct layout *)0;
if (display && D_layout == lay)
D_layout = (struct layout *)0;
FreeLayoutCv(&lay->lay_canvas);
if (lay->lay_title)
free(lay->lay_title);
free(lay);
if (layouts)
LoadLayout((display && D_layout) ? D_layout : *layp ? *layp : layouts,
display ? &D_canvas : (struct canvas *)0);
Activate(0);
}
void UpdateLayoutCanvas(struct canvas *cv, struct win * wi)
{
for (; cv; cv = cv->c_slnext) {
if (cv->c_layer && Layer2Window(cv->c_layer) == wi) {
/* A simplistic version of SetCanvasWindow(cv, 0) */
struct layer *l = cv->c_layer;
cv->c_layer = 0;
if (l->l_cvlist == 0 && (wi == 0 || l != wi->w_savelayer))
KillLayerChain(l);
l = &cv->c_blank;
l->l_data = 0;
if (l->l_cvlist != cv) {
cv->c_lnext = l->l_cvlist;
l->l_cvlist = cv;
}
cv->c_layer = l;
/* Do not end here. Multiple canvases can have the same window */
}
if (cv->c_slperp)
UpdateLayoutCanvas(cv->c_slperp, wi);
}
}
static void dump_canvas(struct canvas *cv, FILE *file)
{
struct canvas *c;
for (c = cv->c_slperp; c && c->c_slnext; c = c->c_slnext)
fprintf(file, "split%s\n", c->c_slorient == SLICE_HORI ? " -v" : "");
for (c = cv->c_slperp; c; c = c->c_slnext) {
if (c->c_slperp)
dump_canvas(c, file);
else
fprintf(file, "focus\n");
}
}
int LayoutDumpCanvas(struct canvas *cv, char *filename)
{
FILE *file = secfopen(filename, "a");
if (!file)
return 0;
dump_canvas(cv, file);
fclose(file);
return 1;
}
void RenameLayout(struct layout *layout, const char *name)
{
free(layout->lay_title);
layout->lay_title = SaveStr(name);
}
int RenumberLayout(struct layout *layout, int number)
{
int old;
struct layout *lay;
old = layout->lay_number;
if (number < 0 || number >= MAXLAY)
return 0;
lay = laytab[number];
laytab[number] = layout;
layout->lay_number = number;
laytab[old] = lay;
if (lay)
lay->lay_number = old;
return 1;
}

63
layout.h Normal file
View file

@ -0,0 +1,63 @@
/* Copyright (c) 2008, 2009
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Micah Cowan (micah@cowan.name)
* Sadrul Habib Chowdhury (sadrul@users.sourceforge.net)
* Copyright (c) 1993-2002, 2003, 2005, 2006, 2007
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
*
* 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 3, 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 (see the file COPYING); if not, see
* https://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*
****************************************************************
* $Id$ GNU
*/
#ifndef SCREEN_LAYOUT_H
#define SCREEN_LAYOUT_H
#include "canvas.h"
#define MAXLAY 10
struct layout
{
struct layout *lay_next;
char *lay_title;
int lay_number;
struct canvas lay_canvas;
struct canvas *lay_forecv;
struct canvas *lay_cvlist;
int lay_autosave;
};
extern void AutosaveLayout __P((struct layout *));
extern void LoadLayout __P((struct layout *, struct canvas *));
extern void NewLayout __P((char *, int));
extern void SaveLayout __P((char *, struct canvas *));
extern void ShowLayouts __P((int));
extern struct layout *FindLayout __P((char *));
extern void UpdateLayoutCanvas __P((struct canvas *, struct win *));
extern struct layout *CreateLayout __P((char *, int));
extern void RemoveLayout __P((struct layout *));
extern int LayoutDumpCanvas __P((struct canvas *, char *));
extern void RenameLayout __P((struct layout *, const char *));
extern int RenumberLayout __P((struct layout *, int));
#endif /* SCREEN_LAYOUT_H */

245
list_display.c Normal file
View file

@ -0,0 +1,245 @@
/* Copyright (c) 2010
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Sadrul Habib Chowdhury (sadrul@users.sourceforge.net)
* Copyright (c) 2008, 2009
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Micah Cowan (micah@cowan.name)
* Sadrul Habib Chowdhury (sadrul@users.sourceforge.net)
* Copyright (c) 1993-2002, 2003, 2005, 2006, 2007
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
*
* 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 3, 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 (see the file COPYING); if not, see
* https://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*
****************************************************************
*/
/* Deals with the list of displays */
#include "config.h"
#include "screen.h"
#include "extern.h"
#include "list_generic.h"
#ifdef MULTI
extern struct layer *flayer;
extern struct display *display, *displays;
extern struct mchar mchar_blank, mchar_so;
static char ListID[] = "display";
/*
* layout of the displays page is as follows:
xterm 80x42 jnweiger@/dev/ttyp4 0(m11) &rWx
facit 80x24 nb mlschroe@/dev/ttyhf 11(tcsh) rwx
xterm 80x42 jnhollma@/dev/ttyp5 0(m11) &R.x
| | | | | | | | ¦___ window permissions
| | | | | | | | (R. is locked r-only,
| | | | | | | | W has wlock)
| | | | | | | |___ Window is shared
| | | | | | |___ Name/Title of window
| | | | | |___ Number of window
| | | | |___ Name of the display (the attached device)
| | | |___ Username who is logged in at the display
| | |___ Display is in nonblocking mode. Shows 'NB' if obuf is full.
| |___ Displays geometry as width x height.
|___ the terminal type known by screen for this display.
*/
static int
gl_Display_header(struct ListData *ldata)
{
leftline("term-type size user interface window Perms", 0, 0);
leftline("---------- ------- ---------- ----------------- ---------- -----", 1, 0);
return 2;
}
static int
gl_Display_footer(struct ListData *ldata)
{
centerline("[Press Space to refresh; Return to end.]", flayer->l_height - 1);
return 1;
}
static int
gl_Display_row(struct ListData *ldata, struct ListRow *lrow)
{
struct display *d = lrow->data;
char tbuf[80];
static char *blockstates[5] = {"nb", "NB", "Z<", "Z>", "BL"};
struct win *w = d->d_fore;
struct mchar m_current = mchar_blank;
m_current.attr = A_BD;
sprintf(tbuf, " %-10.10s%4dx%-4d%10.10s@%-16.16s%s",
d->d_termname, d->d_width, d->d_height, d->d_user->u_name,
d->d_usertty,
(d->d_blocked || d->d_nonblock >= 0) && d->d_blocked <= 4 ? blockstates[d->d_blocked] : " ");
if (w)
{
int l = 10 - strlen(w->w_title);
if (l < 0)
l = 0;
sprintf(tbuf + strlen(tbuf), "%3d(%.10s)%*s%c%c%c%c",
w->w_number, w->w_title, l, "",
/* w->w_dlist->next */ 0 ? '&' : ' ',
/*
* The rwx triple:
* -,r,R no read, read, read only due to foreign wlock
* -,.,w,W no write, write suppressed by foreign wlock,
* write, own wlock
* -,x no execute, execute
*/
#ifdef MULTIUSER
(AclCheckPermWin(d->d_user, ACL_READ, w) ? '-' :
((w->w_wlock == WLOCK_OFF || d->d_user == w->w_wlockuser) ?
'r' : 'R')),
(AclCheckPermWin(d->d_user, ACL_READ, w) ? '-' :
((w->w_wlock == WLOCK_OFF) ? 'w' :
((d->d_user == w->w_wlockuser) ? 'W' : 'v'))),
(AclCheckPermWin(d->d_user, ACL_READ, w) ? '-' : 'x')
#else
'r', 'w', 'x'
#endif
);
}
leftline(tbuf, lrow->y, lrow == ldata->selected ? &mchar_so : d == display ? &m_current : 0);
return 1;
}
static void
gl_Display_rebuild(struct ListData *ldata)
{
/* recreate the rows */
struct display *d;
struct ListRow *row = NULL;
for (d = displays; d; d = d->d_next)
{
row = glist_add_row(ldata, d, row);
if (d == display)
ldata->selected = row;
}
glist_display_all(ldata);
}
static int
gl_Display_input(struct ListData *ldata, char **inp, int *len)
{
struct display *cd = display;
unsigned char ch;
if (!ldata->selected)
return 0;
ch = (unsigned char) **inp;
++*inp;
--*len;
switch (ch)
{
case ' ': /* Space to refresh */
glist_remove_rows(ldata);
gl_Display_rebuild(ldata);
break;
case '\r':
case '\n':
glist_abort();
*len = 0;
break;
#ifdef REMOTE_DETACH
case 'd': /* Detach */
case 'D': /* Power detach */
display = ldata->selected->data;
if (display == cd) /* We do not allow detaching the current display */
break;
Detach(
#ifdef POW_DETACH
ch == 'D' ? D_REMOTE_POWER : D_REMOTE
#else
D_REMOTE
#endif
);
display = cd;
glist_remove_rows(ldata);
gl_Display_rebuild(ldata);
break;
#endif
default:
/* We didn't actually process the input. */
--*inp;
++*len;
return 0;
}
return 1;
}
static int
gl_Display_freerow(struct ListData *ldata, struct ListRow *row)
{
/* There was no allocation when row->data was set. So nothing to do here. */
return 0;
}
static int
gl_Display_free(struct ListData *ldata)
{
/* There was no allocation in ldata->data. So nothing to do here. */
return 0;
}
static struct GenericList gl_Display =
{
gl_Display_header,
gl_Display_footer,
gl_Display_row,
gl_Display_input,
gl_Display_freerow,
gl_Display_free,
NULL /* We do not allow searching in the display list, at the moment */
};
void
display_displays()
{
struct ListData *ldata;
if (flayer->l_width < 10 || flayer->l_height < 5)
{
LMsg(0, "Window size too small for displays page");
return;
}
ldata = glist_display(&gl_Display, ListID);
if (!ldata)
return;
gl_Display_rebuild(ldata);
}
#endif /* MULTI */

486
list_generic.c Normal file
View file

@ -0,0 +1,486 @@
/* Copyright (c) 2010
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Sadrul Habib Chowdhury (sadrul@users.sourceforge.net)
*
* 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 3, 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 (see the file COPYING); if not, see
* https://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*
****************************************************************
*/
#include "config.h"
#include "screen.h"
#include "list_generic.h"
#include "layer.h"
#include "extern.h"
/* Deals with a generic list display */
extern struct layer *flayer;
static void ListProcess __P((char **, int *));
static void ListAbort __P((void));
static void ListRedisplayLine __P((int, int, int, int));
static void ListClearLine __P((int, int, int, int));
static int ListRewrite __P((int, int, int, struct mchar *, int));
static int ListResize __P((int, int));
static void ListRestore __P((void));
static void ListFree __P((void *));
struct LayFuncs ListLf =
{
ListProcess,
ListAbort,
ListRedisplayLine,
ListClearLine,
ListRewrite,
ListResize,
ListRestore,
ListFree
};
/** Returns non-zero on success. */
struct ListData *
glist_display(struct GenericList *list, const char *name)
{
struct ListData *ldata;
if (InitOverlayPage(sizeof(struct ListData), &ListLf, 0))
return NULL;
ldata = flayer->l_data;
ldata->name = name; /* We do not SaveStr, since the strings should be all static literals */
ldata->list_fn = list;
flayer->l_mode = 1;
flayer->l_x = 0;
flayer->l_y = flayer->l_height - 1;
return ldata;
}
static void
glist_decide_top(struct ListData *ldata)
{
int count = flayer->l_height - 5; /* 2 for header, 1 for footer */
struct ListRow *top = ldata->selected;
for (; count && top != ldata->root; top = top->prev, count--)
;
ldata->top = top;
}
static struct ListRow *
glist_search_dir(struct ListData *ldata, struct ListRow *start, int dir)
{
struct ListRow *row = (dir == 1) ? start->next : start->prev;
for (; row; row = (dir == 1) ? row->next : row->prev)
if (ldata->list_fn->gl_matchrow(ldata, row, ldata->search))
return row;
if (dir == 1)
row = ldata->root;
else
{
/* First, go to the end */
if (!start->next)
row = start;
else
for (row = start->next; row->next; row = row->next)
;
}
for (; row != start; row = (dir == 1) ? row->next : row->prev)
if (ldata->list_fn->gl_matchrow(ldata, row, ldata->search))
break;
return row;
}
static void
glist_search(char *buf, int len, char *data)
{
struct ListData *ldata = (struct ListData *)data;
struct ListRow *row;
if (ldata->search)
Free(ldata->search);
if (len > 0)
ldata->search = SaveStr(buf);
else
return;
for (row = ldata->selected; row; row = row->next)
if (ldata->list_fn->gl_matchrow(ldata, row, ldata->search))
break;
if (!row)
for (row = ldata->root; row != ldata->selected; row = row->next)
if (ldata->list_fn->gl_matchrow(ldata, row, ldata->search))
break;
if (row == ldata->selected)
return;
ldata->selected = row;
if (ldata->selected->y == -1)
glist_decide_top(ldata);
glist_display_all(ldata);
}
static void ListProcess(char **ppbuf, int *plen)
{
struct ListData *ldata = flayer->l_data;
int count = 0;
while (*plen > 0)
{
struct ListRow *old;
unsigned char ch;
if (!flayer->l_mouseevent.start && ldata->list_fn->gl_pinput &&
ldata->list_fn->gl_pinput(ldata, ppbuf, plen))
continue;
ch = **ppbuf;
++*ppbuf;
--*plen;
if (flayer->l_mouseevent.start)
{
int r = LayProcessMouse(flayer, ch);
if (r == -1)
{
LayProcessMouseSwitch(flayer, 0);
continue;
}
else
{
if (r)
ch = 0222;
else
continue;
}
}
if (!ldata->selected)
{
*plen = 0;
break;
}
old = ldata->selected;
processchar:
switch (ch)
{
case ' ':
break;
case '\r':
case '\n':
break;
case 0220: /* up */
case 16: /* ^P */
case 'k':
if (!ldata->selected->prev) /* There's no where to go */
break;
ldata->selected = old->prev;
break;
case 0216: /* down */
case 14: /* ^N like emacs */
case 'j':
if (!ldata->selected->next) /* Nothing to do */
break;
ldata->selected = old->next;
break;
case 033: /* escape */
case 007: /* ^G */
ListAbort();
*plen = 0;
return;
case 0201: /* home */
case 0001: /* ^A */
ldata->selected = ldata->root;
break;
case 0205: /* end */
case 0005: /* ^E */
while (ldata->selected->next)
ldata->selected = ldata->selected->next;
if (ldata->selected->y != -1)
{
/* Both old and current selections are on the screen. So we can just
* redraw these two affected rows. */
}
break;
case 0004: /* ^D (half-page down) */
case 0006: /* page-down, ^F */
count = (flayer->l_height - 4) >> (ch == 0004);
for (; ldata->selected->next && --count;
ldata->selected = ldata->selected->next)
;
break;
case 0025: /* ^U (half-page up) */
case 0002: /* page-up, ^B */
count = (flayer->l_height - 4) >> (ch == 0025);
for (; ldata->selected->prev && --count;
ldata->selected = ldata->selected->prev)
;
break;
case '/': /* start searching */
if (ldata->list_fn->gl_matchrow)
{
char *s;
Input("Search: ", 80, INP_COOKED, glist_search, (char *)ldata, 0);
if ((s = ldata->search))
{
for (; *s; s++)
{
char *ss = s;
int n = 1;
LayProcess(&ss, &n);
}
}
}
break;
/* The following deal with searching. */
case 'n': /* search next */
if (ldata->list_fn->gl_matchrow && ldata->search)
ldata->selected = glist_search_dir(ldata, ldata->selected, 1);
break;
case 'N': /* search prev */
if (ldata->list_fn->gl_matchrow && ldata->search)
ldata->selected = glist_search_dir(ldata, ldata->selected, -1);
break;
/* Now, mouse events. */
case 0222:
if (flayer->l_mouseevent.start)
{
int button = flayer->l_mouseevent.buffer[0];
if (button == 'a') /* Scroll down */
ch = 'j';
else if (button == '`') /* Scroll up */
ch = 'k';
else if (button == ' ') /* Left click */
{
int y = flayer->l_mouseevent.buffer[2];
struct ListRow *r = ldata->top;
for (r = ldata->top; r && r->y != -1 && r->y != y; r = r->next)
;
if (r && r->y == y)
ldata->selected = r;
ch = 0;
}
else
ch = 0;
LayProcessMouseSwitch(flayer, 0);
if (ch)
goto processchar;
}
else
LayProcessMouseSwitch(flayer, 1);
break;
}
if (old == ldata->selected) /* The selection didn't change */
continue;
if (ldata->selected->y == -1)
{
/* We need to list all the rows, since we are scrolling down. But first,
* find the top of the visible list. */
glist_decide_top(ldata);
glist_display_all(ldata);
}
else
{
/* just redisplay the two lines. */
ldata->list_fn->gl_printrow(ldata, old);
ldata->list_fn->gl_printrow(ldata, ldata->selected);
flayer->l_y = ldata->selected->y;
LaySetCursor();
}
}
}
static void ListAbort(void)
{
LAY_CALL_UP(LRefreshAll(flayer, 0));
ExitOverlayPage();
}
static void ListFree(void *d)
{
struct ListData *ldata = d;
glist_remove_rows(ldata);
if (ldata->list_fn->gl_free)
ldata->list_fn->gl_free(ldata);
if (ldata->search)
Free(ldata->search);
}
static void ListRedisplayLine(int y, int xs, int xe, int isblank)
{
struct ListData *ldata;
ASSERT(flayer);
ldata = flayer->l_data;
if (y < 0)
{
glist_display_all(ldata);
return;
}
if (!isblank)
LClearArea(flayer, xs, y, xe, y, 0, 0);
if (ldata->top && y < ldata->top->y)
ldata->list_fn->gl_printheader(ldata);
else if (y + 1 == flayer->l_height)
ldata->list_fn->gl_printfooter(ldata);
else
{
struct ListRow *row;
for (row = ldata->top; row && row->y != -1; row = row->next)
if (row->y == y)
{
ldata->list_fn->gl_printrow(ldata, row);
break;
}
}
}
static void ListClearLine(int y, int xs, int xe, int bce)
{
DefClearLine(y, xs, xe, bce);
}
static int ListRewrite(int y, int xs, int xe, struct mchar *rend, int doit)
{
return EXPENSIVE;
}
static int ListResize (int wi, int he)
{
if (wi < 10 || he < 5)
return -1;
flayer->l_width = wi;
flayer->l_height = he;
flayer->l_y = he - 1;
return 0;
}
static void ListRestore (void)
{
DefRestore();
}
struct ListRow *
glist_add_row(struct ListData *ldata, void *data, struct ListRow *after)
{
struct ListRow *r = calloc(1, sizeof(struct ListRow));
r->data = data;
if (after)
{
r->next = after->next;
r->prev = after;
after->next = r;
if (r->next)
r->next->prev = r;
}
else
{
r->next = ldata->root;
if (ldata->root)
ldata->root->prev = r;
ldata->root = r;
}
return r;
}
void
glist_remove_rows(struct ListData *ldata)
{
struct ListRow *row;
for (row = ldata->root; row; )
{
struct ListRow *r = row;
row = row->next;
ldata->list_fn->gl_freerow(ldata, r);
free(r);
}
ldata->root = ldata->selected = ldata->top = NULL;
}
void
glist_display_all(struct ListData *list)
{
int y;
struct ListRow *row;
LClearAll(flayer, 0);
y = list->list_fn->gl_printheader(list);
if (!list->top)
list->top = list->root;
if (!list->selected)
list->selected = list->root;
for (row = list->root; row != list->top; row = row->next)
row->y = -1;
for (row = list->top; row; row = row->next)
{
row->y = y++;
if (!list->list_fn->gl_printrow(list, row))
{
row->y = -1;
y--;
}
if (y + 1 == flayer->l_height)
break;
}
for (; row; row = row->next)
row->y = -1;
list->list_fn->gl_printfooter(list);
if (list->selected && list->selected->y != -1)
flayer->l_y = list->selected->y;
else
flayer->l_y = flayer->l_height - 1;
LaySetCursor();
}
void glist_abort(void)
{
ListAbort();
}

73
list_generic.h Normal file
View file

@ -0,0 +1,73 @@
/* Copyright (c) 2010
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Sadrul Habib Chowdhury (sadrul@users.sourceforge.net)
*
* 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 3, 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 (see the file COPYING); if not, see
* https://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*
****************************************************************
*/
struct ListData;
struct ListRow
{
void *data; /* Some data relevant to this row */
struct ListRow *next, *prev; /* doubly linked list */
int y; /* -1 if not on display */
};
struct GenericList
{
int (*gl_printheader) __P((struct ListData *)); /* Print the header */
int (*gl_printfooter) __P((struct ListData *)); /* Print the footer */
int (*gl_printrow) __P((struct ListData *, struct ListRow *)); /* Print one row */
int (*gl_pinput) __P((struct ListData *, char **inp, int *len)); /* Process input */
int (*gl_freerow) __P((struct ListData *, struct ListRow *)); /* Free data for a row */
int (*gl_free) __P((struct ListData *)); /* Free data for the list */
int (*gl_matchrow) __P((struct ListData *, struct ListRow *, const char *));
};
struct ListData
{
const char *name; /* An identifier for the list */
struct ListRow *root; /* The first item in the list */
struct ListRow *selected; /* The selected row */
struct ListRow *top; /* The topmost visible row */
struct GenericList *list_fn; /* The functions that deal with the list */
char *search; /* The search term, if any */
void *data; /* List specific data */
};
extern struct LayFuncs ListLf;
struct ListRow * glist_add_row __P((struct ListData *ldata, void *data, struct ListRow *after));
void glist_remove_rows __P((struct ListData *ldata));
void glist_display_all __P((struct ListData *list));
struct ListData * glist_display __P((struct GenericList *list, const char *name));
void glist_abort __P((void));
void display_displays __P((void));
void display_windows __P((int onblank, int order, struct win *group));

706
list_window.c Normal file
View file

@ -0,0 +1,706 @@
/* Copyright (c) 2010
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Sadrul Habib Chowdhury (sadrul@users.sourceforge.net)
*
* 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 3, 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 (see the file COPYING); if not, see
* https://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*
****************************************************************
*/
/* Deals with the list of windows */
/* NOTE: A 'struct win *' is used as the 'data' for each row. It might make more sense
* to use 'struct win* ->w_number' as the 'data', instead, because that way, we can
* verify that the window does exist (by looking at wtab[]).
*/
#include "config.h"
#include "screen.h"
#include "layer.h"
#include "extern.h"
#include "list_generic.h"
extern struct layer *flayer;
extern struct display *display, *displays;
extern char *wlisttit;
extern char *wliststr;
extern struct mchar mchar_blank, mchar_so;
extern int renditions[];
extern struct win **wtab, *windows, *fore;
extern int maxwin;
extern char *noargs[];
static char ListID[] = "window";
struct gl_Window_Data
{
struct win *group; /* Set only for a W_TYPE_GROUP window */
int order; /* MRU? NUM? */
int onblank;
int nested;
struct win *fore; /* The foreground window we had. */
};
/* Is this wdata for a group window? */
#define WLIST_FOR_GROUP(wdate) ((wdata)->group && !(wdata)->onblank && Layer2Window(flayer) && Layer2Window(flayer)->w_type == W_TYPE_GROUP)
/* This macro should not be used if 'fn' is expected to update the window list */
#define FOR_EACH_WINDOW(_wdata, _w, fn) do { \
if ((_wdata)->order == WLIST_MRU) \
{ \
struct win *_ww; \
for (_ww = windows; _ww; _ww = _ww->w_next) \
{ \
_w = _ww; \
fn \
} \
} \
else \
{ \
struct win **_ww, *_witer; \
for (_ww = wtab, _witer = windows; _witer && _ww - wtab < maxwin; _ww++) \
{ \
if (!(_w = *_ww)) continue; \
fn \
_witer = _witer->w_next; \
} \
} \
} while (0)
/* Is 'a' an ancestor of 'd'? */
static int
window_ancestor(struct win *a, struct win *d)
{
if (!a)
return 1; /* Every window is a descendant of the 'null' group */
for (; d; d = d->w_group)
if (d->w_group == a)
return 1;
return 0;
}
static void
window_kill_confirm(char *buf, int len, char *data)
{
struct win *w = windows;
struct action act;
if (len || (*buf != 'y' && *buf != 'Y'))
{
memset(buf, 0, len);
return;
}
/* Loop over the windows to make sure that the window actually still exists. */
for (; w; w = w->w_next)
if (w == (struct win *)data)
break;
if (!w)
return;
/* Pretend the selected window is the foreground window. Then trigger a non-interactive 'kill' */
fore = w;
act.nr = RC_KILL;
act.args = noargs;
act.argl = 0;
act.quiet = 0;
DoAction(&act, -1);
}
static struct ListRow *
gl_Window_add_group(struct ListData *ldata, struct ListRow *row)
{
/* Right now, 'row' doesn't have any child. */
struct gl_Window_Data *wdata = ldata->data;
struct win *group = row->data, *w;
struct ListRow *cur = row;
ASSERT(wdata->nested);
FOR_EACH_WINDOW(wdata, w,
if (w->w_group != group)
continue;
cur = glist_add_row(ldata, w, cur);
if (w == wdata->fore)
ldata->selected = cur;
if (w->w_type == W_TYPE_GROUP)
cur = gl_Window_add_group(ldata, cur);
);
return cur;
}
static void
gl_Window_rebuild(struct ListData *ldata)
{
struct ListRow *row = NULL;
struct gl_Window_Data *wdata = ldata->data;
struct win *w;
FOR_EACH_WINDOW(wdata, w,
if (w->w_group != wdata->group)
continue;
row = glist_add_row(ldata, w, row);
if (w == wdata->fore)
ldata->selected = row;
if (w->w_type == W_TYPE_GROUP && wdata->nested)
row = gl_Window_add_group(ldata, row);
);
glist_display_all(ldata);
}
static struct ListRow *
gl_Window_findrow(struct ListData *ldata, struct win *p)
{
struct ListRow *row = ldata->root;
for (; row; row = row->next)
{
if (row->data == p)
break;
}
return row;
}
static int
gl_Window_remove(struct ListData *ldata, struct win *p)
{
struct ListRow *row = gl_Window_findrow(ldata, p);
if (!row)
return 0;
/* Remove 'row'. Update 'selected', 'top', 'root' if necessary. */
if (row->next)
row->next->prev = row->prev;
if (row->prev)
row->prev->next = row->next;
if (ldata->selected == row)
ldata->selected = row->prev ? row->prev : row->next;
if (ldata->top == row)
ldata->top = row->prev ? row->prev : row->next;
if (ldata->root == row)
ldata->root = row->next;
ldata->list_fn->gl_freerow(ldata, row);
free(row);
return 1;
}
static int
gl_Window_header(struct ListData *ldata)
{
char *str;
struct gl_Window_Data *wdata = ldata->data;
int g;
if ((g = (wdata->group != NULL)))
{
LPutWinMsg(flayer, "Group: ", 7, &mchar_blank, 0, 0);
LPutWinMsg(flayer, wdata->group->w_title, strlen(wdata->group->w_title), &mchar_blank, 7, 0);
}
str = MakeWinMsgEv(wlisttit, (struct win *)0, '%', flayer->l_width, (struct event *)0, 0);
LPutWinMsg(flayer, str, strlen(str), &mchar_blank, 0, g);
return 2 + g;
}
static int
gl_Window_footer(struct ListData *ldata)
{
return 0;
}
static int
gl_Window_row(struct ListData *ldata, struct ListRow *lrow)
{
char *str;
struct win *w, *g;
int xoff;
struct mchar *mchar;
struct mchar mchar_rend = mchar_blank;
struct gl_Window_Data *wdata = ldata->data;
w = lrow->data;
/* First, make sure we want to display this window in the list.
* If we are showing a list for a group, and not on blank, then we must
* only show the windows directly belonging to that group.
* Otherwise, do some more checks. */
for (xoff = 0, g = w->w_group; g != wdata->group; g = g->w_group)
xoff += 2;
str = MakeWinMsgEv(wliststr, w, '%', flayer->l_width - xoff, NULL, 0);
if (ldata->selected == lrow)
mchar = &mchar_so;
else if (w->w_monitor == MON_DONE && renditions[REND_MONITOR] != -1)
{
mchar = &mchar_rend;
ApplyAttrColor(renditions[REND_MONITOR], mchar);
}
else if ((w->w_bell == BELL_DONE || w->w_bell == BELL_FOUND) && renditions[REND_BELL] != -1)
{
mchar = &mchar_rend;
ApplyAttrColor(renditions[REND_BELL], mchar);
}
else if ((w->w_silence == SILENCE_FOUND || w->w_silence == SILENCE_DONE) && renditions[REND_SILENCE] != -1)
{
mchar = &mchar_rend;
ApplyAttrColor(renditions[REND_SILENCE], mchar);
}
else
mchar = &mchar_blank;
LPutWinMsg(flayer, str, flayer->l_width, mchar, xoff, lrow->y);
if (xoff)
LPutWinMsg(flayer, "", xoff, mchar, 0, lrow->y);
return 1;
}
static int
gl_Window_input(struct ListData *ldata, char **inp, int *len)
{
struct win *win;
unsigned char ch;
struct display *cd = display;
struct gl_Window_Data *wdata = ldata->data;
if (!ldata->selected)
return 0;
ch = (unsigned char) **inp;
++*inp;
--*len;
win = ldata->selected->data;
switch (ch)
{
case ' ':
case '\n':
case '\r':
if (!win)
break;
#ifdef MULTIUSER
if (display && AclCheckPermWin(D_user, ACL_READ, win))
return 0; /* Not allowed to switch to this window. */
#endif
if (WLIST_FOR_GROUP(wdata))
SwitchWindow(win->w_number);
else
{
/* Abort list only when not in a group window. */
glist_abort();
display = cd;
if (D_fore != win)
SwitchWindow(win->w_number);
}
*len = 0;
break;
case 'm':
/* Toggle MRU-ness */
wdata->order = wdata->order == WLIST_MRU ? WLIST_NUM : WLIST_MRU;
glist_remove_rows(ldata);
gl_Window_rebuild(ldata);
break;
case 'g':
/* Toggle nestedness */
wdata->nested = !wdata->nested;
glist_remove_rows(ldata);
gl_Window_rebuild(ldata);
break;
case 'a':
/* All-window view */
if (wdata->group)
{
int order = wdata->order | (wdata->nested ? WLIST_NESTED : 0);
glist_abort();
display = cd;
display_windows(1, order, NULL);
*len = 0;
}
else if (!wdata->nested)
{
wdata->nested = 1;
glist_remove_rows(ldata);
gl_Window_rebuild(ldata);
}
break;
case 010: /* ^H */
case 0177: /* Backspace */
if (!wdata->group)
break;
if (wdata->group->w_group)
{
/* The parent is another group window. So switch to that window. */
struct win *g = wdata->group->w_group;
glist_abort();
display = cd;
SetForeWindow(g);
*len = 0;
}
else
{
/* We were in a group view. Now we are moving to an all-window view.
* So treat it as 'windowlist on blank'. */
int order = wdata->order | (wdata->nested ? WLIST_NESTED : 0);
glist_abort();
display = cd;
display_windows(1, order, NULL);
*len = 0;
}
break;
case ',': /* Switch numbers with the previous window. */
if (wdata->order == WLIST_NUM && ldata->selected->prev)
{
struct win *pw = ldata->selected->prev->data;
if (win->w_group != pw->w_group)
break; /* Do not allow switching with the parent group */
/* When a windows's number is successfully changed, it triggers a WListUpdatecv
* with NULL window. So that causes a redraw of the entire list. So reset the
* 'selected' after that. */
wdata->fore = win;
WindowChangeNumber(win->w_number, pw->w_number);
}
break;
case '.': /* Switch numbers with the next window. */
if (wdata->order == WLIST_NUM && ldata->selected->next)
{
struct win *nw = ldata->selected->next->data;
if (win->w_group != nw->w_group)
break; /* Do not allow switching with the parent group */
wdata->fore = win;
WindowChangeNumber(win->w_number, nw->w_number);
}
break;
case 'K': /* Kill a window */
{
char str[MAXSTR];
snprintf(str, sizeof(str) - 1, "Really kill window %d (%s) [y/n]",
win->w_number, win->w_title);
Input(str, 1, INP_RAW, window_kill_confirm, (char *)win, 0);
}
break;
case 033: /* escape */
case 007: /* ^G */
if (!WLIST_FOR_GROUP(wdata))
{
int fnumber = wdata->onblank ? wdata->fore->w_number : -1;
glist_abort();
display = cd;
if (fnumber >= 0)
SwitchWindow(fnumber);
*len = 0;
}
break;
default:
if (ch >= '0' && ch <= '9')
{
struct ListRow *row = ldata->root;
for (; row; row = row->next)
{
struct win *w = row->data;
if (w->w_number == ch - '0')
{
struct ListRow *old = ldata->selected;
if (old == row)
break;
ldata->selected = row;
if (ldata->selected->y == -1)
{
/* We need to list all the rows, since we are scrolling down. But first,
* find the top of the visible list. */
ldata->top = row;
glist_display_all(ldata);
}
else
{
/* just redisplay the two lines. */
ldata->list_fn->gl_printrow(ldata, old);
ldata->list_fn->gl_printrow(ldata, ldata->selected);
flayer->l_y = ldata->selected->y;
LaySetCursor();
}
break;
}
}
break;
}
--*inp;
++*len;
return 0;
}
return 1;
}
static int
gl_Window_freerow(struct ListData *ldata, struct ListRow *row)
{
return 0;
}
static int
gl_Window_free(struct ListData *ldata)
{
Free(ldata->data);
return 0;
}
static int
gl_Window_match(struct ListData *ldata, struct ListRow *row, const char *needle)
{
struct win *w = row->data;
if (InStr(w->w_title, needle))
return 1;
return 0;
}
static struct GenericList gl_Window =
{
gl_Window_header,
gl_Window_footer,
gl_Window_row,
gl_Window_input,
gl_Window_freerow,
gl_Window_free,
gl_Window_match
};
void
display_windows(int onblank, int order, struct win *group)
{
struct win *p;
struct ListData *ldata;
struct gl_Window_Data *wdata;
if (flayer->l_width < 10 || flayer->l_height < 6)
{
LMsg(0, "Window size too small for window list page");
return;
}
if (group)
onblank = 0; /* When drawing a group window, ignore 'onblank' */
if (onblank)
{
debug3("flayer %lx %d %x\n", (long)flayer, flayer->l_width, flayer->l_height);
if (!display)
{
LMsg(0, "windowlist -b: display required");
return;
}
p = D_fore;
if (p)
{
SetForeWindow((struct win *)0);
if (p->w_group)
{
D_fore = p->w_group;
flayer->l_data = (char *)p->w_group;
}
Activate(0);
}
if (flayer->l_width < 10 || flayer->l_height < 6)
{
LMsg(0, "Window size too small for window list page");
return;
}
}
else
p = Layer2Window(flayer);
if (!group && p)
group = p->w_group;
ldata = glist_display(&gl_Window, ListID);
if (!ldata)
{
if (onblank && p)
{
/* Could not display the list. So restore the window. */
SetForeWindow(p);
Activate(1);
}
return;
}
wdata = calloc(1, sizeof(struct gl_Window_Data));
wdata->group = group;
wdata->order = (order & ~WLIST_NESTED);
wdata->nested = !!(order & WLIST_NESTED);
wdata->onblank = onblank;
/* Set the most recent window as selected. */
wdata->fore = windows;
while (wdata->fore && wdata->fore->w_group != group)
wdata->fore = wdata->fore->w_next;
ldata->data = wdata;
gl_Window_rebuild(ldata);
}
static void
WListUpdate(struct win *p, struct ListData *ldata)
{
struct gl_Window_Data *wdata = ldata->data;
struct ListRow *row, *rbefore;
struct win *before;
int d = 0, sel = 0;
if (!p)
{
if (ldata->selected)
wdata->fore = ldata->selected->data; /* Try to retain the current selection */
glist_remove_rows(ldata);
gl_Window_rebuild(ldata);
return;
}
/* First decide if this window should be displayed at all. */
d = 1;
if (wdata->order == WLIST_NUM || wdata->order == WLIST_MRU)
{
if (p->w_group != wdata->group)
{
if (!wdata->nested)
d = 0;
else
d = window_ancestor(wdata->group, p);
}
}
if (!d)
{
if (gl_Window_remove(ldata, p))
glist_display_all(ldata);
return;
}
/* OK, so we keep the window in the list. Update the ordering.
* First, find the row where this window should go to. Then, either create
* a new row for that window, or move the exising row for the window to the
* correct place. */
before = NULL;
if (wdata->order == WLIST_MRU)
{
if (windows != p)
for (before = windows; before; before = before->w_next)
if (before->w_next == p)
break;
}
else if (wdata->order == WLIST_NUM)
{
if (p->w_number != 0)
{
struct win **w = wtab + p->w_number - 1;
for (; w >= wtab; w--)
{
if (*w && (*w)->w_group == wdata->group)
{
before = *w;
break;
}
}
}
}
/* Now, find the row belonging to 'before' */
if (before)
rbefore = gl_Window_findrow(ldata, before);
else if (wdata->nested && p->w_group) /* There's no 'before'. So find the group window */
rbefore = gl_Window_findrow(ldata, p->w_group);
else
rbefore = NULL;
/* For now, just remove the row containing 'p' if it is not already in the right place . */
row = gl_Window_findrow(ldata, p);
if (row)
{
if (row->prev != rbefore)
{
sel = ldata->selected->data == p;
gl_Window_remove(ldata, p);
}
else
p = NULL; /* the window is in the correct place */
}
if (p)
{
row = glist_add_row(ldata, p, rbefore);
if (sel)
ldata->selected = row;
}
glist_display_all(ldata);
}
void
WListUpdatecv(cv, p)
struct canvas *cv;
struct win *p;
{
struct ListData *ldata;
if (cv->c_layer->l_layfn != &ListLf)
return;
ldata = cv->c_layer->l_data;
if (ldata->name != ListID)
return;
CV_CALL(cv, WListUpdate(p, ldata));
}
void
WListLinkChanged()
{
struct display *olddisplay = display;
struct canvas *cv;
struct ListData *ldata;
struct gl_Window_Data *wdata;
for (display = displays; display; display = display->d_next)
for (cv = D_cvlist; cv; cv = cv->c_next)
{
if (!cv->c_layer || cv->c_layer->l_layfn != &ListLf)
continue;
ldata = cv->c_layer->l_data;
if (ldata->name != ListID)
continue;
wdata = ldata->data;
if (!(wdata->order & WLIST_MRU))
continue;
CV_CALL(cv, WListUpdate(0, ldata));
}
display = olddisplay;
}

396
loadav.c Normal file
View file

@ -0,0 +1,396 @@
/* Copyright (c) 2008, 2009
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Micah Cowan (micah@cowan.name)
* Sadrul Habib Chowdhury (sadrul@users.sourceforge.net)
* Copyright (c) 1993-2002, 2003, 2005, 2006, 2007
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
*
* 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 3, 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 (see the file COPYING); if not, see
* https://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*
****************************************************************
*/
#include <sys/types.h>
#include <fcntl.h>
#ifdef ultrix
# include <sys/fixpoint.h>
#endif
/* mach stuff included here to prevent index macro conflict */
#ifdef NeXT
# include <sys/version.h>
# if KERNEL_MAJOR_VERSION > 2
# include <mach/mach.h>
# else
# include <mach.h>
# endif
#endif
#ifdef _AIX
#include <sys/kinfo.h>
extern int getkerninfo(int op, char *buf, int *buf_size, int32long64_t arg);
#endif
#include "config.h"
#include "screen.h"
#include "extern.h"
#ifdef LOADAV
static int GetLoadav __P((void));
static LOADAV_TYPE loadav[LOADAV_NUM];
static int loadok;
/***************************************************************/
#if defined(linux) && !defined(LOADAV_DONE)
#define LOADAV_DONE
/*
* This is the easy way. It relies in /proc being mounted.
* For the big and ugly way refer to previous screen version.
*/
void
InitLoadav()
{
loadok = 1;
}
static int
GetLoadav()
{
FILE *fp;
char buf[128], *s;
int i;
double d, e;
if ((fp = secfopen("/proc/loadavg", "r")) == NULL)
return 0;
*buf = 0;
fgets(buf, sizeof(buf), fp);
fclose(fp);
/* can't use fscanf because the decimal point symbol depends on
* the locale but the kernel uses always '.'.
*/
s = buf;
for (i = 0; i < (LOADAV_NUM > 3 ? 3 : LOADAV_NUM); i++)
{
d = e = 0;
while(*s == ' ')
s++;
if (*s == 0)
break;
for(;;)
{
if (*s == '.')
e = 1;
else if (*s >= '0' && *s <= '9')
{
d = d * 10 + (*s - '0');
if (e)
e *= 10;
}
else
break;
s++;
}
loadav[i] = e ? d / e : d;
}
return i;
}
#endif /* linux */
/***************************************************************/
#if defined(LOADAV_GETLOADAVG) && !defined(LOADAV_DONE)
#define LOADAV_DONE
void
InitLoadav()
{
loadok = 1;
}
static int
GetLoadav()
{
return getloadavg(loadav, LOADAV_NUM);
}
#endif
/***************************************************************/
#if defined(apollo) && !defined(LOADAV_DONE)
#define LOADAV_DONE
void
InitLoadav()
{
loadok = 1;
}
static int
GetLoadav()
{
proc1_$get_loadav(loadav);
return LOADAV_NUM;
}
#endif
/***************************************************************/
#if defined(NeXT) && !defined(LOADAV_DONE)
#define LOADAV_DONE
static processor_set_t default_set;
void
InitLoadav()
{
kern_return_t error;
error = processor_set_default(host_self(), &default_set);
if (error != KERN_SUCCESS)
mach_error("Error calling processor_set_default", error);
else
loadok = 1;
}
static int
GetLoadav()
{
unsigned int info_count;
struct processor_set_basic_info info;
host_t host;
info_count = PROCESSOR_SET_BASIC_INFO_COUNT;
if (processor_set_info(default_set, PROCESSOR_SET_BASIC_INFO, &host, (processor_set_info_t)&info, &info_count) != KERN_SUCCESS)
return 0;
loadav[0] = (float)info.load_average / LOAD_SCALE;
return 1;
}
#endif
/***************************************************************/
#if defined(sun) && defined(SVR4) && !defined(LOADAV_DONE)
#define LOADAV_DONE
#include <kstat.h>
static kstat_ctl_t *kc;
void
InitLoadav()
{
loadok = (kc = kstat_open()) != 0;
}
static int
GetLoadav()
{
kstat_t *ks;
kstat_named_t *avgs[3];
int i;
kstat_chain_update(kc);
if ((ks = kstat_lookup(kc, "unix", -1, "system_misc")) == 0 || kstat_read(kc, ks, (void *)0) == -1)
return (loadok = 0);
avgs[0] = kstat_data_lookup(ks, "avenrun_1min");
avgs[1] = kstat_data_lookup(ks, "avenrun_5min");
avgs[2] = kstat_data_lookup(ks, "avenrun_15min");
for (i = 0; i < 3; i++)
{
if (avgs[i] == 0 || avgs[i]->data_type != KSTAT_DATA_ULONG)
return (loadok = 0);
loadav[i] = avgs[i]->value.ul;
}
return 3;
}
#endif
/***************************************************************/
#if defined(__osf__) && defined(__alpha) && !defined(LOADAV_DONE)
#define LOADAV_DONE
struct rtentry; struct mbuf; /* shut up gcc on OSF/1 4.0 */
#include <sys/table.h>
void
InitLoadav()
{
loadok = 1;
}
static int
GetLoadav()
{
struct tbl_loadavg tbl;
int i;
if (table(TBL_LOADAVG, 0, &tbl, 1, sizeof(struct tbl_loadavg)) != 1)
return 0;
if (tbl.tl_lscale)
{
/* in long */
for (i = 0; i < LOADAV_NUM; i++)
loadav[i] = (double) tbl.tl_avenrun.l[i] / tbl.tl_lscale;
}
else
{
/* in double */
for (i = 0; i < LOADAV_NUM; i++)
loadav[i] = tbl.tl_avenrun.d[i];
}
return LOADAV_NUM;
}
#endif
/***************************************************************/
#if defined(_AIX) && !defined(LOADAV_DONE)
#define LOADAV_DONE
/*
* AIX uses KINFO_GET_AVENRUN syscall
*/
void
InitLoadav()
{
loadok = 1;
}
static int
GetLoadav()
{
long long avenrun[3];
int avsize = 3 * sizeof(long long);
int i;
if (getkerninfo(KINFO_GET_AVENRUN, (char *)&avenrun, &avsize, 0) < 0)
{
return 0;
}
for (i = 0; i < (LOADAV_NUM > 3 ? 3 : LOADAV_NUM); i++)
{
loadav[i] = avenrun[i];
}
return i;
}
#endif /* _AIX */
/***************************************************************/
#if !defined(LOADAV_DONE)
/*
* The old fashion way: open kernel and read avenrun
*
* Header File includes
*/
# ifdef NLIST_STRUCT
# include <nlist.h>
# else
# include <a.out.h>
# endif
# ifndef NLIST_DECLARED
extern int nlist __P((char *, struct nlist *));
# endif
#ifdef LOADAV_USE_NLIST64
# define nlist nlist64
#endif
static struct nlist nl[2];
static int kmemf;
#ifdef _IBMR2
# define nlist(u,l) knlist(l,1,sizeof(*l))
#endif
void
InitLoadav()
{
debug("Init Kmem...\n");
if ((kmemf = open("/dev/kmem", O_RDONLY)) == -1)
return;
# if !defined(_AUX_SOURCE) && !defined(AUX)
# ifdef NLIST_NAME_UNION
nl[0].n_un.n_name = LOADAV_AVENRUN;
# else
nl[0].n_name = LOADAV_AVENRUN;
# endif
# else
strncpy(nl[0].n_name, LOADAV_AVENRUN, sizeof(nl[0].n_name));
# endif
debug2("Searching in %s for %s\n", LOADAV_UNIX, nl[0].n_name);
nlist(LOADAV_UNIX, nl);
if (nl[0].n_value == 0)
{
close(kmemf);
return;
}
# if 0 /* no longer needed (Al.Smith@aeschi.ch.eu.org) */
# ifdef sgi
nl[0].n_value &= (unsigned long)-1 >> 1; /* clear upper bit */
# endif /* sgi */
# endif
debug1("AvenrunSym found (0x%lx)!!\n", nl[0].n_value);
loadok = 1;
}
static int
GetLoadav()
{
if (lseek(kmemf, (off_t) nl[0].n_value, 0) == (off_t)-1)
return 0;
if (read(kmemf, (char *) loadav, sizeof(loadav)) != sizeof(loadav))
return 0;
return LOADAV_NUM;
}
#endif
/***************************************************************/
#ifndef FIX_TO_DBL
#define FIX_TO_DBL(l) ((double)(l) / LOADAV_SCALE)
#endif
void
AddLoadav(p)
char *p;
{
int i, j;
if (loadok == 0)
return;
j = GetLoadav();
for (i = 0; i < j; i++)
{
sprintf(p, " %2.2f" + !i, FIX_TO_DBL(loadav[i]));
p += strlen(p);
}
}
#endif /* LOADAV */

251
logfile.c Normal file
View file

@ -0,0 +1,251 @@
/* Copyright (c) 2008, 2009
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Micah Cowan (micah@cowan.name)
* Sadrul Habib Chowdhury (sadrul@users.sourceforge.net)
* Copyright (c) 1993-2002, 2003, 2005, 2006, 2007
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
*
* 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 3, 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 (see the file COPYING); if not, see
* https://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*
****************************************************************
*/
#include <sys/types.h> /* dev_t, ino_t, off_t, ... */
#include <sys/stat.h> /* struct stat */
#include <fcntl.h> /* O_WRONLY for logfile_reopen */
#include "config.h"
#include "screen.h"
#include "extern.h"
#include "logfile.h"
static void changed_logfile __P((struct logfile *));
static struct logfile *lookup_logfile __P((char *));
static int stolen_logfile __P((struct logfile *));
static struct logfile *logroot = NULL;
static void changed_logfile(struct logfile *l) {
struct stat o, *s = l->st;
if (fstat(fileno(l->fp), &o) < 0) /* get trouble later */
return;
if (o.st_size > s->st_size) { /* aha, appended text */
s->st_size = o.st_size; /* this should have changed */
s->st_mtime = o.st_mtime; /* only size and mtime */
}
}
/*
* Requires fd to be open and need_fd to be closed.
* If possible, need_fd will be open afterwards and refer to
* the object originally reffered by fd. fd will be closed then.
* Works just like ``fcntl(fd, DUPFD, need_fd); close(fd);''
*
* need_fd is returned on success, else -1 is returned.
*/
int lf_move_fd(int fd, int need_fd) {
int r = -1;
if (fd == need_fd)
return fd;
if (fd >=0 && fd < need_fd)
r = lf_move_fd(dup(fd), need_fd);
close(fd);
return r;
}
static int logfile_reopen(char *name, int wantfd, struct logfile *l) {
int got_fd;
close(wantfd);
if (((got_fd = open(name, O_WRONLY | O_CREAT | O_APPEND, 0666)) < 0) || lf_move_fd(got_fd, wantfd) < 0) {
logfclose(l);
debug1("logfile_reopen: failed for %s\n", name);
return -1;
}
changed_logfile(l);
debug2("logfile_reopen: %d = %s\n", wantfd, name);
return 0;
}
static int (* lf_reopen_fn)() = logfile_reopen;
/*
* Whenever logfwrite discoveres that it is required to close and
* reopen the logfile, the function registered here is called.
* If you do not register anything here, the above logfile_reopen()
* will be used instead.
* Your function should perform the same steps as logfile_reopen():
* a) close the original filedescriptor without flushing any output
* b) open a new logfile for future output on the same filedescriptor number.
* c) zero out st_dev, st_ino to tell the stolen_logfile() indcator to
* reinitialise itself.
* d) return 0 on success.
*/
void logreopen_register(fn)
int (*fn) __P((char *, int, struct logfile *));
{
lf_reopen_fn = fn ? fn : logfile_reopen;
}
/*
* If the logfile has been removed, truncated, unlinked or the like,
* return nonzero.
* The l->st structure initialised by logfopen is updated
* on every call.
*/
static int stolen_logfile(struct logfile *l) {
struct stat o, *s = l->st;
o = *s;
if (fstat(fileno(l->fp), s) < 0) /* remember that stat failed */
s->st_ino = s->st_dev = 0;
ASSERT(s == l->st);
if (!o.st_dev && !o.st_ino) /* nothing to compare with */
return 0;
if ((!s->st_dev && !s->st_ino) || /* stat failed, that's new! */
!s->st_nlink || /* red alert: file unlinked */
(s->st_size < o.st_size) || /* file truncated */
(s->st_mtime != o.st_mtime) || /* file modified */
((s->st_ctime != o.st_ctime) && /* file changed (moved) */
!(s->st_mtime == s->st_ctime && /* and it was not a change */
o.st_ctime < s->st_ctime))) /* due to delayed nfs write */
{
debug1("stolen_logfile: %s stolen!\n", l->name);
debug3("st_dev %d, st_ino %d, st_nlink %d\n", (int)s->st_dev, (int)s->st_ino, (int)s->st_nlink);
debug2("s->st_size %d, o.st_size %d\n", (int)s->st_size, (int)o.st_size);
debug2("s->st_mtime %d, o.st_mtime %d\n", (int)s->st_mtime, (int)o.st_mtime);
debug2("s->st_ctime %d, o.st_ctime %d\n", (int)s->st_ctime, (int)o.st_ctime);
return -1;
}
debug1("stolen_logfile: %s o.k.\n", l->name);
return 0;
}
static struct logfile *lookup_logfile(char *name) {
struct logfile *l;
for (l = logroot; l; l = l->next)
if (!strcmp(name, l->name))
return l;
return NULL;
}
struct logfile *logfopen(char *name, FILE *fp) {
struct logfile *l;
if (!fp) {
if (!(l = lookup_logfile(name)))
return NULL;
l->opencount++;
return l;
}
if (!(l = (struct logfile *)malloc(sizeof(struct logfile))))
return NULL;
if (!(l->st = (struct stat *)malloc(sizeof(struct stat)))) {
free((char *)l);
return NULL;
}
if (!(l->name = SaveStr(name))) {
free((char *)l->st);
free((char *)l);
return NULL;
}
l->fp = fp;
l->opencount = 1;
l->writecount = 0;
l->flushcount = 0;
changed_logfile(l);
l->next = logroot;
logroot = l;
return l;
}
int islogfile(char *name) {
if (!name)
return logroot ? 1 : 0;
return lookup_logfile(name) ? 1 : 0;
}
int logfclose(struct logfile *l) {
struct logfile **lp;
for (lp = &logroot; *lp; lp = &(*lp)->next)
if (*lp == l)
break;
if (!*lp)
return -1;
if ((--l->opencount) > 0)
return 0;
if (l->opencount < 0)
abort();
*lp = l->next;
fclose(l->fp);
free(l->name);
free((char *)l);
return 0;
}
/*
* XXX
* write and flush both *should* check the file's stat, if it disappeared
* or changed, re-open it.
*/
int logfwrite(struct logfile *l, char *buf, int n) {
int r;
if (stolen_logfile(l) && lf_reopen_fn(l->name, fileno(l->fp), l))
return -1;
r = fwrite(buf, n, 1, l->fp);
l->writecount += l->flushcount + 1;
l->flushcount = 0;
changed_logfile(l);
return r;
}
int logfflush(struct logfile *l) {
int r = 0;
if (!l)
for (l = logroot; l; l = l->next) {
if (stolen_logfile(l) && lf_reopen_fn(l->name, fileno(l->fp), l))
return -1;
r |= fflush(l->fp);
l->flushcount++;
changed_logfile(l);
}
else {
if (stolen_logfile(l) && lf_reopen_fn(l->name, fileno(l->fp), l))
return -1;
r = fflush(l->fp);
l->flushcount++;
changed_logfile(l);
}
return r;
}

87
logfile.h Normal file
View file

@ -0,0 +1,87 @@
/* Copyright (c) 2008, 2009
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Micah Cowan (micah@cowan.name)
* Sadrul Habib Chowdhury (sadrul@users.sourceforge.net)
* Copyright (c) 1993-2002, 2003, 2005, 2006, 2007
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
*
* 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 3, 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 (see the file COPYING); if not, see
* https://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*
****************************************************************
* $Id$ GNU
*/
struct logfile
{
struct logfile *next;
FILE *fp; /* a hopefully uniq filepointer to the log file */
char *name; /* the name. used to reopen, when stat fails. */
int opencount; /* synchronize logfopen() and logfclose() */
int writecount; /* increments at logfwrite(), counts write() and fflush() */
int flushcount; /* increments at logfflush(), zeroed at logfwrite() */
struct stat *st; /* how the file looks like */
};
/*
* open a logfile, The second argument must be NULL, when the named file
* is already a logfile or must be a appropriatly opened file pointer
* otherwise.
* example: l = logfopen(name, islogfile(name) : NULL ? fopen(name, "a"));
*/
struct logfile *logfopen __P((char *name, FILE *fp));
/*
* lookup a logfile by name. This is useful, so that we can provide
* logfopen with a nonzero second argument, exactly when needed.
* islogfile(NULL); returns nonzero if there are any open logfiles at all.
*/
int islogfile __P((char *name));
/*
* logfclose does free()
*/
int logfclose __P((struct logfile *));
int logfwrite __P((struct logfile *, char *, int));
/*
* logfflush should be called periodically. If no argument is passed,
* all logfiles are flushed, else the specified file
* the number of flushed filepointers is returned
*/
int logfflush __P((struct logfile *ifany));
/*
* a reopen function may be registered here, in case you want to bring your
* own (more secure open), it may come along with a private data pointer.
* this function is called, whenever logfwrite/logfflush detect that the
* file has been (re)moved, truncated or changed by someone else.
* if you provide NULL as parameter to logreopen_register, the builtin
* reopen function will be reactivated.
*/
void logreopen_register __P((int (*fn) __P((char *, int, struct logfile *)) ));
/*
* Your custom reopen function is required to reuse the exact
* filedescriptor.
* See logfile.c for further specs and an example.
*
* lf_move_fd may help you here, if you do not have dup2(2).
* It closes fd and opens wantfd to access whatever fd accessed.
*/
int lf_move_fd __P((int fd, int wantfd));

1449
mark.c Normal file

File diff suppressed because it is too large Load diff

58
mark.h Normal file
View file

@ -0,0 +1,58 @@
/* Copyright (c) 2008, 2009
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Micah Cowan (micah@cowan.name)
* Sadrul Habib Chowdhury (sadrul@users.sourceforge.net)
* Copyright (c) 1993-2002, 2003, 2005, 2006, 2007
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
*
* 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 3, 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 (see the file COPYING); if not, see
* https://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*
****************************************************************
* $Id$ GNU
*/
struct markdata
{
struct win *md_window;/* pointer to window we are working on */
struct acluser *md_user; /* The user who brought us up */
int cx, cy; /* cursor Position in WIN coords*/
int x1, y1; /* first mark in WIN coords */
int second; /* first mark dropped flag */
int left_mar, right_mar, nonl;
int rep_cnt; /* number of repeats */
int append_mode; /* shall we overwrite or append to copybuffer */
int write_buffer; /* shall we do a KEY_WRITE_EXCHANGE right away? */
int hist_offset; /* how many lines are on top of the screen */
char isstr[100]; /* string we are searching for */
int isstrl;
char isistr[200]; /* string of chars user has typed */
int isistrl;
int isdir; /* current search direction */
int isstartpos; /* position where isearch was started */
int isstartdir; /* direction when isearch was started */
struct { /* bookkeeping for fFtT;, commands */
int flag, target, direction;
} f_cmd;
};
#define W2D(y) ((y) - markdata->hist_offset)
#define D2W(y) ((y) + markdata->hist_offset)

722
misc.c Normal file
View file

@ -0,0 +1,722 @@
/* Copyright (c) 2008, 2009
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Micah Cowan (micah@cowan.name)
* Sadrul Habib Chowdhury (sadrul@users.sourceforge.net)
* Copyright (c) 1993-2002, 2003, 2005, 2006, 2007
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
*
* 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 3, 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 (see the file COPYING); if not, see
* https://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*
****************************************************************
*/
#include <poll.h>
#include <sys/types.h>
#include <sys/stat.h> /* mkdir() declaration */
#include <signal.h>
#include "config.h"
#include "screen.h"
#include "extern.h"
#ifdef SVR4
# include <sys/resource.h>
#endif
extern struct layer *flayer;
extern int eff_uid, real_uid;
extern int eff_gid, real_gid;
extern struct mline mline_old;
extern struct mchar mchar_blank;
extern unsigned char *null, *blank;
#ifdef HAVE_FDWALK
static int close_func __P((void *, int));
#endif
char *
SaveStr(register const char *str)
{
register char *cp;
if (str == NULL)
Panic(0, "SaveStr() received NULL - possibly failed crypt()");
if ((cp = malloc(strlen(str) + 1)) == NULL)
Panic(0, "%s", strnomem);
else
strcpy(cp, str);
return cp;
}
char *
SaveStrn(register const char *str, int n)
{
register char *cp;
if ((cp = malloc(n + 1)) == NULL)
Panic(0, "%s", strnomem);
else {
bcopy((char *)str, cp, n);
cp[n] = 0;
}
return cp;
}
/* cheap strstr replacement */
char *
InStr(char *str, const char *pat)
{
int npat = strlen(pat);
for (; *str; str++)
if (!strncmp(str, pat, npat))
return str;
return 0;
}
#ifndef HAVE_STRERROR
char *
strerror(int err)
{
extern int sys_nerr;
extern char *sys_errlist[];
static char er[20];
if (err > 0 && err < sys_nerr)
return sys_errlist[err];
sprintf(er, "Error %d", err);
return er;
}
#endif
void
centerline(char *str, int y)
{
int l, n;
ASSERT(flayer);
n = strlen(str);
if (n > flayer->l_width - 1)
n = flayer->l_width - 1;
l = (flayer->l_width - 1 - n) / 2;
LPutStr(flayer, str, n, &mchar_blank, l, y);
}
void
leftline(char *str, int y, struct mchar *rend)
{
int l, n;
struct mchar mchar_dol;
mchar_dol = mchar_blank;
mchar_dol.image = '$';
ASSERT(flayer);
l = n = strlen(str);
if (n > flayer->l_width - 1)
n = flayer->l_width - 1;
LPutStr(flayer, str, n, rend ? rend : &mchar_blank, 0, y);
if (n != l)
LPutChar(flayer, &mchar_dol, n, y);
}
char *
Filename(char *s)
{
register char *p = s;
if (p)
while (*p)
if (*p++ == '/')
s = p;
return s;
}
char *
stripdev(char *nam)
{
#ifdef apollo
char *p;
if (nam == NULL)
return NULL;
# ifdef SVR4
/* unixware has /dev/pts012 as synonym for /dev/pts/12 */
if (!strncmp(nam, "/dev/pts", 8) && nam[8] >= '0' && nam[8] <= '9') {
static char b[13];
sprintf(b, "pts/%d", atoi(nam + 8));
return b;
}
# endif /* SVR4 */
if (p = strstr(nam, "/dev/"))
return p + 5;
#else /* apollo */
if (nam == NULL)
return NULL;
if (strncmp(nam, "/dev/", 5) == 0)
return nam + 5;
#endif /* apollo */
return nam;
}
/*
* Signal handling
*/
#ifdef POSIX
sigret_t (*xsignal(sig, func))
# ifndef __APPLE__
__P(SIGPROTOARG)
# else
()
# endif
int sig;
sigret_t (*func) __P(SIGPROTOARG);
{
struct sigaction osa, sa;
sa.sa_handler = func;
(void)sigemptyset(&sa.sa_mask);
#ifdef SA_RESTART
sa.sa_flags = (sig == SIGCHLD ? SA_RESTART : 0);
#else
sa.sa_flags = 0;
#endif
if (sigaction(sig, &sa, &osa))
return (sigret_t (*)__P(SIGPROTOARG))-1;
return osa.sa_handler;
}
#else
# ifdef hpux
/*
* hpux has berkeley signal semantics if we use sigvector,
* but not, if we use signal, so we define our own signal() routine.
*/
void (*xsignal(sig, func)) __P(SIGPROTOARG)
int sig;
void (*func) __P(SIGPROTOARG);
{
struct sigvec osv, sv;
sv.sv_handler = func;
sv.sv_mask = sigmask(sig);
sv.sv_flags = SV_BSDSIG;
if (sigvector(sig, &sv, &osv) < 0)
return (void (*)__P(SIGPROTOARG))(BADSIG);
return osv.sv_handler;
}
# endif /* hpux */
#endif /* POSIX */
/*
* uid/gid handling
*/
#ifdef HAVE_SETEUID
void
xseteuid(int euid)
{
if (seteuid(euid) == 0)
return;
seteuid(0);
if (seteuid(euid))
Panic(errno, "seteuid");
}
void
xsetegid(int egid)
{
if (setegid(egid))
Panic(errno, "setegid");
}
#else /* HAVE_SETEUID */
# ifdef HAVE_SETREUID
void
xseteuid(int euid)
{
int oeuid;
oeuid = geteuid();
if (oeuid == euid)
return;
if ((int)getuid() != euid)
oeuid = getuid();
if (setreuid(oeuid, euid))
Panic(errno, "setreuid");
}
void
xsetegid(int egid)
{
int oegid;
oegid = getegid();
if (oegid == egid)
return;
if ((int)getgid() != egid)
oegid = getgid();
if (setregid(oegid, egid))
Panic(errno, "setregid");
}
# endif /* HAVE_SETREUID */
#endif /* HAVE_SETEUID */
#ifdef NEED_OWN_BCOPY
void
xbcopy(register char *s1, register char *s2, register int len)
{
if (s1 < s2 && s2 < s1 + len) {
s1 += len;
s2 += len;
while (len-- > 0)
*--s2 = *--s1;
} else
while (len-- > 0)
*s2++ = *s1++;
}
#endif /* NEED_OWN_BCOPY */
void
bclear(char *p, int n)
{
bcopy((char *)blank, p, n);
}
void
Kill(int pid, int sig)
{
if (pid < 2)
return;
(void)kill(pid, sig);
}
#ifdef HAVE_FDWALK
/*
* Modern versions of Solaris include fdwalk(3c) which allows efficient
* implementation of closing open descriptors; this is helpful because
* the default file descriptor limit has risen to 65k.
*/
static int
close_func(void *cb_data, int fd)
{
int except = *(int *)cb_data;
if (fd > 2 && fd != except)
(void)close(fd);
return (0);
}
void
closeallfiles(int except)
{
(void)fdwalk(close_func, &except);
}
#else /* HAVE_FDWALK */
void
closeallfiles(int except)
{
int f;
#ifdef SVR4
struct rlimit rl;
if ((getrlimit(RLIMIT_NOFILE, &rl) == 0) &&
rl.rlim_max != RLIM_INFINITY)
f = rl.rlim_max;
else
#endif /* SVR4 */
#if defined(SYSV) && defined(NOFILE) && !defined(ISC)
f = NOFILE;
while (--f > 2)
if (f != except)
close(f);
#else /* SYSV && !ISC */
{
struct pollfd pfd[1024];
int maxfd, i, ret, z;
i = 3; /* skip stdin, stdout and stderr */
maxfd = getdtablesize();
while (i < maxfd) {
memset(pfd, 0, sizeof(pfd));
z = 0;
for (f = i; f < maxfd && f < i + 1024; f++)
pfd[z++].fd = f;
ret = poll(pfd, f - i, 0);
if (ret < 0)
Panic(errno, "poll");
z = 0;
for (f = i; f < maxfd && f < i + 1024; f++)
if (!(pfd[z++].revents & POLLNVAL) &&
f != except)
close(f);
i = f;
}
}
#endif /* SYSV && !ISC */
}
#endif /* HAVE_FDWALK */
/*
* Security - switch to real uid
*/
#ifndef USE_SETEUID
static int UserPID;
static sigret_t (*Usersigcld) __P(SIGPROTOARG);
#endif
static int UserSTAT;
int
UserContext()
{
#ifndef USE_SETEUID
if (eff_uid == real_uid && eff_gid == real_gid)
return 1;
Usersigcld = signal(SIGCHLD, SIG_DFL);
debug("UserContext: forking.\n");
switch (UserPID = fork()) {
case -1:
Msg(errno, "fork");
return -1;
case 0:
signal(SIGHUP, SIG_DFL);
signal(SIGINT, SIG_IGN);
signal(SIGQUIT, SIG_DFL);
signal(SIGTERM, SIG_DFL);
# ifdef BSDJOBS
signal(SIGTTIN, SIG_DFL);
signal(SIGTTOU, SIG_DFL);
# endif
setuid(real_uid);
setgid(real_gid);
return 1;
default:
return 0;
}
#else
xseteuid(real_uid);
xsetegid(real_gid);
return 1;
#endif
}
void
UserReturn(int val)
{
#ifndef USE_SETEUID
if (eff_uid == real_uid && eff_gid == real_gid)
UserSTAT = val;
else
_exit(val);
#else
xseteuid(eff_uid);
xsetegid(eff_gid);
UserSTAT = val;
#endif
}
int
UserStatus()
{
#ifndef USE_SETEUID
int i;
# ifdef BSDWAIT
union wait wstat;
# else
int wstat;
# endif
if (eff_uid == real_uid && eff_gid == real_gid)
return UserSTAT;
if (UserPID < 0)
return -1;
while ((errno = 0, i = wait(&wstat)) != UserPID)
if (i < 0 && errno != EINTR)
break;
(void)signal(SIGCHLD, Usersigcld);
if (i == -1)
return -1;
return WEXITSTATUS(wstat);
#else
return UserSTAT;
#endif
}
#ifndef HAVE_RENAME
int
rename(char *old, char *new)
{
if (link(old, new) < 0)
return -1;
return unlink(old);
}
#endif
int
AddXChar(char *buf, int ch)
{
char *p = buf;
if (ch < ' ' || ch == 0x7f) {
*p++ = '^';
*p++ = ch ^ 0x40;
} else if (ch >= 0x80) {
*p++ = '\\';
*p++ = (ch >> 6 & 7) + '0';
*p++ = (ch >> 3 & 7) + '0';
*p++ = (ch >> 0 & 7) + '0';
} else
*p++ = ch;
return p - buf;
}
int
AddXChars(char *buf, int len, char *str)
{
char *p;
if (str == 0) {
*buf = 0;
return 0;
}
len -= 4; /* longest sequence produced by AddXChar() */
for (p = buf; p < buf + len && *str; str++) {
if (*str == ' ')
*p++ = *str;
else
p += AddXChar(p, *str);
}
*p = 0;
return p - buf;
}
#ifdef DEBUG
void
opendebug(int new, int shout)
{
char buf[256];
#ifdef _MODE_T
mode_t oumask = umask(0);
#else
int oumask = umask(0);
#endif
ASSERT(!dfp);
(void)mkdir(DEBUGDIR, 0777);
sprintf(buf, shout ?
"%s/SCREEN.%d" : "%s/screen.%d", DEBUGDIR, getpid());
if (!(dfp = fopen(buf, new ? "w" : "a")))
dfp = stderr;
else
(void)chmod(buf, 0666);
(void)umask(oumask);
debug("opendebug: done.\n");
}
#endif /* DEBUG */
void
sleep1000(int msec)
{
struct timeval t;
t.tv_sec = (long)(msec / 1000);
t.tv_usec = (long)((msec % 1000) * 1000);
select(0, (fd_set *)0, (fd_set *)0, (fd_set *)0, &t);
}
/*
* This uses either setenv() or putenv(). If it is putenv() we cannot dare
* to free the buffer after putenv(), unless it it the one found in putenv.c
*/
void
xsetenv(char *var, char *value)
{
#ifndef USESETENV
char *buf;
int l;
if ((buf = (char *)malloc((l = strlen(var)) +
strlen(value) + 2)) == NULL) {
Msg(0, strnomem);
return;
}
strcpy(buf, var);
buf[l] = '=';
strcpy(buf + l + 1, value);
putenv(buf);
# ifdef NEEDPUTENV
/*
* we use our own putenv(), knowing that it does a malloc()
* the string space, we can free our buf now.
*/
free(buf);
# else /* NEEDPUTENV */
/*
* For all sysv-ish systems that link a standard putenv()
* the string-space buf is added to the environment and must not
* be freed, or modified.
* We are sorry to say that memory is lost here, when setting
* the same variable again and again.
*/
# endif /* NEEDPUTENV */
#else /* USESETENV */
# if HAVE_SETENV_3
setenv(var, value, 1);
# else
setenv(var, value);
# endif /* HAVE_SETENV_3 */
#endif /* USESETENV */
}
#ifdef TERMINFO
/*
* This is a replacement for the buggy _delay function from the termcap
* emulation of libcurses, which ignores ospeed.
*/
int
_delay(register int delay, int (*outc) __P((int)))
{
int pad;
extern short ospeed;
static short osp2pad[] = {
0,2000,1333,909,743,666,500,333,166,83,55,41,20,10,5,2,1,1
};
if (ospeed <= 0 || ospeed >= (int)(sizeof(osp2pad)/sizeof(*osp2pad)))
return 0;
pad =osp2pad[ospeed];
delay = (delay + pad / 2) / pad;
while (delay-- > 0)
(*outc)(0);
return 0;
}
#endif /* TERMINFO */
#ifndef USEVARARGS
# define xva_arg(s, t, tn) (*(t *)(s += xsnoff(tn, 0, 0), s - xsnoff(tn, 0, 0)))
# define xva_list char *
static int
xsnoff(int a, char *b, int c)
{
return a ? (char *)&c - (char *)&b : (char *)&b - (char *)&a;
}
int
xsnprintf(char *s, int n, char *fmt, unsigned long p1, p2, p3, p4, p5, p6)
{
int xvsnprintf __P((char *, int, char *, xva_list));
return xvsnprintf(s, n, fmt, (char *)&fmt + xsnoff(1, 0, 0));
}
#else
# define xva_arg(s, t, tn) va_arg(s, t)
# define xva_list va_list
#endif
#if !defined(USEVARARGS) || !defined(HAVE_VSNPRINTF)
int
xvsnprintf(char *s, int n, char *fmt, xva_list stack)
{
char *f, *sf = 0;
int i, on, argl = 0;
char myf[10], buf[20];
char *arg, *myfp;
on = n;
f = fmt;
arg = 0;
while (arg || (sf = index(f, '%')) || (sf = f + strlen(f))) {
if (arg == 0) {
arg = f;
argl = sf - f;
}
if (argl) {
i = argl > n - 1 ? n - 1 : argl;
strncpy(s, arg, i);
s += i;
n -= i;
if (i < argl) {
*s = 0;
return on;
}
}
arg = 0;
if (sf == 0)
continue;
f = sf;
sf = 0;
if (!*f)
break;
myfp = myf;
*myfp++ = *f++;
while (((*f >= '0' && *f <= '9') || *f == '#') &&
myfp - myf < 8)
*myfp++ = *f++;
*myfp++ = *f;
*myfp = 0;
if (!*f++)
break;
switch (f[-1]) {
case '%':
arg = "%";
break;
case 'c':
case 'o':
case 'd':
case 'x':
i = xva_arg(stack, int, 0);
sprintf(buf, myf, i);
arg = buf;
break;
case 's':
arg = xva_arg(stack, char *, 1);
if (arg == 0)
arg = "NULL";
break;
default:
arg = "";
break;
}
argl = strlen(arg);
}
*s = 0;
return on - n;
}
#endif

138
nethack.c Normal file
View file

@ -0,0 +1,138 @@
/* Copyright (c) 2008, 2009
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Micah Cowan (micah@cowan.name)
* Sadrul Habib Chowdhury (sadrul@users.sourceforge.net)
* Copyright (c) 1993-2002, 2003, 2005, 2006, 2007
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
*
* 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 3, 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 (see the file COPYING); if not, see
* https://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*
****************************************************************
*/
#include "config.h"
#include "screen.h"
#ifdef NETHACK
extern int nethackflag;
#endif
struct nlstrans {
char *from;
char *to;
};
#ifdef NETHACK
static struct nlstrans nethacktrans[] = {
{"Cannot lock terminal - fork failed",
"Cannot fork terminal - lock failed"},
{"Got only %d bytes from %s",
"You choke on your food: %d bytes from %s"},
{"Copy mode - Column %d Line %d(+%d) (%d,%d)",
"Welcome to hacker's treasure zoo - Column %d Line %d(+%d) (%d,%d)"},
{"First mark set - Column %d Line %d",
"You drop a magic marker - Column %d Line %d"},
{"Copy mode aborted",
"You escaped the dungeon."},
{"Filter removed.",
"You have a sad feeling for a moment..."},
{"Window %d (%s) killed.",
"You destroy poor window %d (%s)."},
{"Window %d (%s) is now being monitored for all activity.",
"You feel like someone is watching you..."},
{"Window %d (%s) is no longer being monitored for activity.",
"You no longer sense the watcher's presence."},
{"empty buffer",
"Nothing happens."},
{"switched to audible bell.",
"Suddenly you can't see your bell!"},
{"switched to visual bell.",
"Your bell is no longer invisible."},
{"The window is now being monitored for %d sec. silence.",
"You feel like someone is waiting for %d sec. silence..."},
{"The window is no longer being monitored for silence.",
"You no longer sense the watcher's silence."},
{"No other window.",
"You cannot escape from window %d!"},
{"Logfile \"%s\" closed.",
"You put away your scroll of logging named \"%s\"." },
{"Error opening logfile \"%s\"",
"You don't seem to have a scroll of logging named \"%s\"."},
{"Creating logfile \"%s\".",
"You start writing on your scroll of logging named \"%s\"."},
{"Appending to logfile \"%s\".",
"You add to your scroll of logging named \"%s\"."},
{"Detach aborted.",
"The blast of disintegration whizzes by you!"},
{"Empty register.",
"Nothing happens."},
{"[ Passwords don't match - checking turned off ]",
"[ Passwords don't match - your armor crumbles away ]"},
{"Aborted because of window size change.",
"KAABLAMM!!! You triggered a land mine!"},
{"Out of memory.",
"Who was that Maude person anyway?"},
{"getpwuid() can't identify your account!",
"An alarm sounds through the dungeon...\nThe Keystone Kops are after you!"},
{"Must be connected to a terminal.",
"You must play from a terminal."},
{"No Sockets found in %s.\n",
"This room is empty (%s).\n"},
{"New screen...",
"Be careful! New screen tonight."},
{"Child has been stopped, restarting.",
"You regain consciousness."},
{"There are screens on:",
"Your inventory:"},
{"There is a screen on:",
"Your inventory:"},
{"There are several screens on:",
"Prove thyself worthy or perish:"},
{"There is a suitable screen on:",
"You see here a good looking screen:"},
{"There are several suitable screens on:",
"You may wish for a screen, what do you want?"},
{"%d socket%s wiped out.",
"You hear %d distant explosion%s."},
{"Remove dead screens with 'screen -wipe'.",
"The dead screen%s touch%s you. Try 'screen -wipe'."},
{"Illegal reattach attempt from terminal %s.",
"'%s' tries to touch your session, but fails."},
{"Could not write %s",
"%s is too hard to dig in"},
{0, 0}
};
#endif
const char *
DoNLS(from)
const char *from;
{
#ifdef NETHACK
struct nlstrans *t;
if (nethackflag)
{
for (t = nethacktrans; t->from; t++)
if (strcmp(from, t->from) == 0)
return t->to;
}
#endif
return from;
}

529
os.h Normal file
View file

@ -0,0 +1,529 @@
/* Copyright (c) 2008, 2009
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Micah Cowan (micah@cowan.name)
* Sadrul Habib Chowdhury (sadrul@users.sourceforge.net)
* Copyright (c) 1993-2002, 2003, 2005, 2006, 2007
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
*
* 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 3, 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 (see the file COPYING); if not, see
* https://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*
****************************************************************
* $Id$ GNU
*/
#include <stdio.h>
#include <errno.h>
#include <sys/param.h>
/* In strict ANSI mode, HP-UX machines define __hpux but not hpux */
#if defined(__hpux) && !defined(hpux)
# define hpux
#endif
#if defined(__bsdi__) || defined(__386BSD__) || defined(_CX_UX) || defined(hpux) || defined(_IBMR2) || defined(linux)
# include <signal.h>
#endif /* __bsdi__ || __386BSD__ || _CX_UX || hpux || _IBMR2 || linux */
#if !defined(HAVE_LONG_FILE_NAMES) && !defined(NAME_MAX)
#define NAME_MAX 14
#endif
#ifdef ISC
# ifdef ENAMETOOLONG
# undef ENAMETOOLONG
# endif
# ifdef ENOTEMPTY
# undef ENOTEMPTY
# endif
# include <sys/bsdtypes.h>
# include <net/errno.h>
#endif
#ifdef sun
# define getpgrp __getpgrp
# define exit __exit
#endif
#ifdef POSIX
# include <unistd.h>
# if defined(__STDC__)
# include <stdlib.h>
# endif /* __STDC__ */
#endif /* POSIX */
#ifdef sun
# undef getpgrp
# undef exit
#endif /* sun */
#ifndef linux /* all done in <errno.h> */
extern int errno;
#endif /* linux */
#ifndef HAVE_STRERROR
/* No macros, please */
#undef strerror
#endif
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#ifdef HAVE_STRING_H
# include <string.h>
#endif
#ifdef USEVARARGS
# if defined(__STDC__)
# include <stdarg.h>
# define VA_LIST(var) va_list var;
# define VA_DOTS ...
# define VA_DECL
# define VA_START(ap, fmt) va_start(ap, fmt)
# define VA_ARGS(ap) ap
# define VA_END(ap) va_end(ap)
# else
# include <varargs.h>
# define VA_LIST(var) va_list var;
# define VA_DOTS va_alist
# define VA_DECL va_dcl
# define VA_START(ap, fmt) va_start(ap)
# define VA_ARGS(ap) ap
# define VA_END(ap) va_end(ap)
# endif
#else
# define VA_LIST(var)
# define VA_DOTS p1, p2, p3, p4, p5, p6
# define VA_DECL unsigned long VA_DOTS;
# define VA_START(ap, fmt)
# define VA_ARGS(ap) VA_DOTS
# define VA_END(ap)
# undef vsnprintf
# define vsnprintf xsnprintf
#endif
#if !defined(sun) && !defined(B43) && !defined(ISC) && !defined(pyr) && !defined(_CX_UX)
# include <time.h>
#endif
#include <sys/time.h>
#ifdef M_UNIX /* SCO */
# include <sys/stream.h>
# include <sys/ptem.h>
# define ftruncate(fd, s) chsize(fd, s)
#endif
#ifdef SYSV
# define index strchr
# define rindex strrchr
# define bzero(poi,len) memset(poi,0,len)
# define bcmp memcmp
# define killpg(pgrp,sig) kill( -(pgrp), sig)
#endif
#ifndef HAVE_GETCWD
# define getcwd(b,l) getwd(b)
#endif
#ifndef USEBCOPY
# ifdef USEMEMMOVE
# define bcopy(s,d,len) memmove(d,s,len)
# else
# ifdef USEMEMCPY
# define bcopy(s,d,len) memcpy(d,s,len)
# else
# define NEED_OWN_BCOPY
# define bcopy xbcopy
# endif
# endif
#endif
#if defined(HAVE_SETRESUID) && !defined(HAVE_SETREUID)
# define setreuid(ruid, euid) setresuid(ruid, euid, -1)
# define setregid(rgid, egid) setresgid(rgid, egid, -1)
#endif
#if defined(HAVE_SETEUID) || defined(HAVE_SETREUID) || defined(HAVE_SETRESUID)
# define USE_SETEUID
#endif
#if !defined(HAVE__EXIT) && !defined(_exit)
#define _exit(x) exit(x)
#endif
#ifndef HAVE_UTIMES
# define utimes utime
#endif
#ifndef HAVE_VSNPRINTF
# define vsnprintf xvsnprintf
#endif
#ifdef BUILTIN_TELNET
# include <netinet/in.h>
# include <arpa/inet.h>
#endif
#if defined(USE_LOCALE) && (!defined(HAVE_SETLOCALE) || !defined(HAVE_STRFTIME))
# undef USE_LOCALE
#endif
/*****************************************************************
* terminal handling
*/
#ifdef POSIX
# include <termios.h>
# ifdef hpux
# include <bsdtty.h>
# endif /* hpux */
# ifdef NCCS
# define MAXCC NCCS
# else
# define MAXCC 256
# endif
#else /* POSIX */
# ifdef TERMIO
# include <termio.h>
# ifdef NCC
# define MAXCC NCC
# else
# define MAXCC 256
# endif
# ifdef CYTERMIO
# include <cytermio.h>
# endif
# else /* TERMIO */
# include <sgtty.h>
# endif /* TERMIO */
#endif /* POSIX */
#ifndef VDISABLE
# ifdef _POSIX_VDISABLE
# define VDISABLE _POSIX_VDISABLE
# else
# define VDISABLE 0377
# endif /* _POSIX_VDISABLE */
#endif /* !VDISABLE */
/* on sgi, regardless of the stream head's read mode (RNORM/RMSGN/RMSGD)
* TIOCPKT mode causes data loss if our buffer is too small (IOSIZE)
* to hold the whole packet at first read().
* (Marc Boucher)
*
* matthew green:
* TIOCPKT is broken on dgux 5.4.1 generic AViiON mc88100
*
* Joe Traister: On AIX4, programs like irc won't work if screen
* uses TIOCPKT (select fails to return on pty read).
*/
#if defined(sgi) || defined(DGUX) || defined(_IBMR2)
# undef TIOCPKT
#endif
/* Alexandre Oliva: SVR4 style ptys don't work with osf */
#ifdef __osf__
# undef HAVE_SVR4_PTYS
#endif
/*****************************************************************
* utmp handling
*/
#ifdef GETUTENT
typedef char *slot_t;
#else
typedef int slot_t;
#endif
#if defined(UTMPOK) || defined(BUGGYGETLOGIN)
# if defined(SVR4) && !defined(DGUX) && !defined(__hpux) && !defined(linux)
# include <utmpx.h>
# define UTMPFILE UTMPX_FILE
# define utmp utmpx
# define getutent getutxent
# define getutid getutxid
# define getutline getutxline
# define pututline pututxline
# define setutent setutxent
# define endutent endutxent
# define ut_time ut_xtime
# else /* SVR4 */
# include <utmp.h>
# endif /* SVR4 */
# ifdef apollo
/*
* We don't have GETUTENT, so we dig into utmp ourselves.
* But we save the permanent filedescriptor and
* open utmp just when we need to.
* This code supports an unsorted utmp. jw.
*/
# define UTNOKEEP
# endif /* apollo */
# ifndef UTMPFILE
# ifdef UTMP_FILE
# define UTMPFILE UTMP_FILE
# else
# ifdef _PATH_UTMP
# define UTMPFILE _PATH_UTMP
# else
# define UTMPFILE "/etc/utmp"
# endif /* _PATH_UTMP */
# endif
# endif
#endif /* UTMPOK || BUGGYGETLOGIN */
#if !defined(UTMPOK) && defined(USRLIMIT)
# undef USRLIMIT
#endif
#ifdef LOGOUTOK
# ifndef LOGINDEFAULT
# define LOGINDEFAULT 0
# endif
#else
# ifdef LOGINDEFAULT
# undef LOGINDEFAULT
# endif
# define LOGINDEFAULT 1
#endif
/*****************************************************************
* file stuff
*/
#ifndef F_OK
#define F_OK 0
#endif
#ifndef X_OK
#define X_OK 1
#endif
#ifndef W_OK
#define W_OK 2
#endif
#ifndef R_OK
#define R_OK 4
#endif
#ifndef S_IFIFO
#define S_IFIFO 0010000
#endif
#ifndef S_IREAD
#define S_IREAD 0000400
#endif
#ifndef S_IWRITE
#define S_IWRITE 0000200
#endif
#ifndef S_IEXEC
#define S_IEXEC 0000100
#endif
#if defined(S_IFIFO) && defined(S_IFMT) && !defined(S_ISFIFO)
#define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO)
#endif
#if defined(S_IFSOCK) && defined(S_IFMT) && !defined(S_ISSOCK)
#define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK)
#endif
#if defined(S_IFCHR) && defined(S_IFMT) && !defined(S_ISCHR)
#define S_ISCHR(mode) (((mode) & S_IFMT) == S_IFCHR)
#endif
#if defined(S_IFDIR) && defined(S_IFMT) && !defined(S_ISDIR)
#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
#endif
#if defined(S_IFLNK) && defined(S_IFMT) && !defined(S_ISLNK)
#define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK)
#endif
/*
* SunOS 4.1.3: `man 2V open' has only one line that mentions O_NOBLOCK:
*
* O_NONBLOCK Same as O_NDELAY above.
*
* on the very same SunOS 4.1.3, I traced the open system call and found
* that an open("/dev/ttyy08", O_RDWR|O_NONBLOCK|O_NOCTTY) was blocked,
* whereas open("/dev/ttyy08", O_RDWR|O_NDELAY |O_NOCTTY) went through.
*
* For this simple reason I now favour O_NDELAY. jw. 4.5.95
*/
#if defined(sun) && !defined(SVR4)
# undef O_NONBLOCK
#endif
#if !defined(O_NONBLOCK) && defined(O_NDELAY)
# define O_NONBLOCK O_NDELAY
#endif
#if !defined(FNBLOCK) && defined(FNONBLOCK)
# define FNBLOCK FNONBLOCK
#endif
#if !defined(FNBLOCK) && defined(FNDELAY)
# define FNBLOCK FNDELAY
#endif
#if !defined(FNBLOCK) && defined(O_NONBLOCK)
# define FNBLOCK O_NONBLOCK
#endif
#ifndef POSIX
#undef mkfifo
#define mkfifo(n,m) mknod(n,S_IFIFO|(m),0)
#endif
#if !defined(HAVE_LSTAT) && !defined(lstat)
# define lstat stat
#endif
/*****************************************************************
* signal handling
*/
#ifdef SIGVOID
# define SIGRETURN
# define sigret_t void
#else
# define SIGRETURN return 0;
# define sigret_t int
#endif
/* Geeeee, reverse it? */
#if defined(SVR4) || (defined(SYSV) && defined(ISC)) || defined(_AIX) || defined(linux) || defined(ultrix) || defined(__386BSD__) || defined(__bsdi__) || defined(POSIX) || defined(NeXT)
# define SIGHASARG
#endif
#ifdef SIGHASARG
# define SIGPROTOARG (int)
# define SIGDEFARG (sigsig) int sigsig;
# define SIGARG 0
#else
# define SIGPROTOARG (void)
# define SIGDEFARG ()
# define SIGARG
#endif
#ifndef SIGCHLD
#define SIGCHLD SIGCLD
#endif
#if defined(POSIX) || defined(hpux)
# define signal xsignal
#else
# ifdef USESIGSET
# define signal sigset
# endif /* USESIGSET */
#endif
/* used in screen.c and attacher.c */
#ifndef NSIG /* kbeal needs these w/o SYSV */
# define NSIG 32
#endif /* !NSIG */
/*****************************************************************
* Wait stuff
*/
#if (!defined(sysV68) && !defined(M_XENIX)) || defined(NeXT) || defined(M_UNIX)
# include <sys/wait.h>
#endif
#ifndef WTERMSIG
# ifndef BSDWAIT /* if wait is NOT a union: */
# define WTERMSIG(status) (status & 0177)
# else
# define WTERMSIG(status) status.w_T.w_Termsig
# endif
#endif
#ifndef WSTOPSIG
# ifndef BSDWAIT /* if wait is NOT a union: */
# define WSTOPSIG(status) ((status >> 8) & 0377)
# else
# define WSTOPSIG(status) status.w_S.w_Stopsig
# endif
#endif
/* NET-2 uses WCOREDUMP */
#if defined(WCOREDUMP) && !defined(WIFCORESIG)
# define WIFCORESIG(status) WCOREDUMP(status)
#endif
#ifndef WIFCORESIG
# ifndef BSDWAIT /* if wait is NOT a union: */
# define WIFCORESIG(status) (status & 0200)
# else
# define WIFCORESIG(status) status.w_T.w_Coredump
# endif
#endif
#ifndef WEXITSTATUS
# ifndef BSDWAIT /* if wait is NOT a union: */
# define WEXITSTATUS(status) ((status >> 8) & 0377)
# else
# define WEXITSTATUS(status) status.w_T.w_Retcode
# endif
#endif
/*****************************************************************
* select stuff
*/
#if defined(M_XENIX) || defined(M_UNIX) || defined(_SEQUENT_)
#include <sys/select.h> /* for timeval + FD... */
#endif
/*
* SunOS 3.5 - Tom Schmidt - Micron Semiconductor, Inc - 27-Jul-93
* tschmidt@vax.micron.com
*/
#ifndef FD_SET
# ifndef SUNOS3
typedef struct fd_set { int fds_bits[1]; } fd_set;
# endif
# define FD_ZERO(fd) ((fd)->fds_bits[0] = 0)
# define FD_SET(b, fd) ((fd)->fds_bits[0] |= 1 << (b))
# define FD_ISSET(b, fd) ((fd)->fds_bits[0] & 1 << (b))
# define FD_SETSIZE 32
#endif
/*****************************************************************
* user defineable stuff
*/
#ifndef TERMCAP_BUFSIZE
# define TERMCAP_BUFSIZE 1023
#endif
#ifndef MAXPATHLEN
# define MAXPATHLEN 1024
#endif
/*
* you may try to vary this value. Use low values if your (VMS) system
* tends to choke when pasting. Use high values if you want to test
* how many characters your pty's can buffer.
*/
#define IOSIZE 4096
/* Changing those you won't be able to attach to your old sessions
* when changing those values in official tree don't forget to bump
* MSG_VERSION */
#define MAXTERMLEN 32
#define MAXLOGINLEN 256

202
osdef.h.in Normal file
View file

@ -0,0 +1,202 @@
/* Copyright (c) 1993-2000
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
*
* 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 3, 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 (see the file COPYING); if not, see
* http://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*
****************************************************************
* $Id$ GNU
*/
/****************************************************************
* Thanks to Christos S. Zoulas (christos@ee.cornell.edu) who
* mangled the screen source through 'gcc -Wall'.
****************************************************************
*/
extern int printf __P((char *, ...));
extern int fprintf __P((FILE *, char *, ...));
extern int sprintf __P((char *, char *, ...));
#ifdef USEVARARGS
extern int vsprintf __P((char *, char *, char *));
#endif
#ifdef LOG_NOTICE
extern int openlog __P((char *, int, int));
extern int syslog __P((int, char *, ... ));
extern int closelog __P((void));
#endif
#if defined(sun) || defined(_SEQUENT_)
extern int _flsbuf __P((int, FILE *));
#endif
#ifdef SYSV
extern char *strchr __P((char *, int));
extern char *strrchr __P((char *, int));
extern char *memset __P((char *, int, int));
extern int memcmp __P((char *, char *, int));
#else
extern char *index __P((char *, int));
extern char *rindex __P((char *, int));
extern void bzero __P((char *, int));
extern int bcmp __P((char *, char *, int));
extern int killpg __P((int, int));
#endif
#ifndef USEBCOPY
# ifdef USEMEMCPY
extern void memcpy __P((char *, char *, int));
# else
# ifdef USEMEMMOVE
extern void memmove __P((char *, char *, int));
# else
extern void bcopy __P((char *, char *, int));
# endif
# endif
#else
extern void bcopy __P((char *, char *, int));
#endif
#ifdef BSDWAIT
struct rusage; /* for wait3 __P */
union wait; /* for wait3 __P */
extern int wait3 __P((union wait *, int, struct rusage *));
#else
extern int waitpid __P((int, int *, int));
#endif
extern int getdtablesize __P((void));
#ifdef HAVE_SETRESUID
extern int setresuid __P((int, int, int));
extern int setresgid __P((int, int, int));
#endif
#ifdef HAVE_SETREUID
extern int setreuid __P((int, int));
extern int setregid __P((int, int));
#endif
#ifdef HAVE_SETEUID
extern int seteuid __P((int));
extern int setegid __P((int));
#endif
extern char *crypt __P((char *, char *));
extern int putenv __P((char *));
extern int tgetent __P((char *, char *));
extern char *tgetstr __P((char *, char **));
extern int tgetnum __P((char *));
extern int tgetflag __P((char *));
extern void tputs __P((char *, int, int (*)(int)));
extern char *tgoto __P((char *, int, int));
#ifdef POSIX
#include <string.h>
extern int setsid __P((void));
extern int setpgid __P((int, int));
extern int tcsetpgrp __P((int, int));
#endif
extern int ioctl __P((int, unsigned long, char *));
extern int kill __P((int, int));
extern int getpid __P((void));
extern int getuid __P((void));
extern int geteuid __P((void));
extern int getgid __P((void));
extern int getegid __P((void));
struct passwd; /* for getpwuid __P */
extern struct passwd *getpwuid __P((int));
extern struct passwd *getpwnam __P((char *));
extern int isatty __P((int));
extern int chown __P((char *, int, int));
extern int rename __P((char *, char *));
extern int gethostname __P((char *, int));
extern int lseek __P((int, int, int));
extern void exit __P((int));
extern char *getwd __P((char *));
extern char *getenv __P((char *));
extern time_t time __P((time_t *));
extern char *getpass __P((char *));
extern char *getlogin __P((void));
extern char *ttyname __P((int));
extern int fputs __P((char *, FILE *));
extern int fwrite __P((char *, int, int, FILE *));
extern int fflush __P((FILE *));
extern int fclose __P((FILE *));
extern char *malloc __P((int));
extern char *realloc __P((char *, int));
extern void free __P((char *));
extern int mknod __P((char *, int, int));
struct sockaddr; /* for connect __P */
extern int socket __P((int, int, int));
extern int connect __P((int, struct sockaddr *, int));
extern int bind __P((int, struct sockaddr *, int));
extern int listen __P((int, int));
#ifdef _AIX
extern int accept __P((int, struct sockaddr *, socklen_t *));
#else
extern int accept __P((int, struct sockaddr *, int *));
#endif
#if defined(UTMPOK) && defined(GETUTENT)
extern void setutent __P((void));
#endif
#if defined(sequent) || defined(_SEQUENT_)
extern int getpseudotty __P((char **, char **));
#ifdef _SEQUENT_
extern int fvhangup __P((char *));
#endif
#endif
struct timeval; /* for select __P */
extern int select __P((int, fd_set *, fd_set *, fd_set *, struct timeval *));
#ifdef HAVE_UTIMES
extern int utimes __P((char *, struct timeval *));
#endif
extern void unsetenv __P((char *));
# if defined(GETTTYENT) && !defined(GETUTENT) && !defined(UTNOKEEP)
struct ttyent; /* for getttyent __P */
extern void setttyent __P((void));
extern struct ttyent *getttyent __P((void));
# endif
#ifdef SVR4
struct rlimit; /* for getrlimit __P */
extern int getrlimit __P((int, struct rlimit *));
#endif
struct stat;
extern int stat __P((char *, struct stat *));
extern int lstat __P((char *, struct stat *));
extern int fstat __P((int, struct stat *));
extern int fchmod __P((int, int));
extern int fchown __P((int, int, int));
#if defined(LOADAV) && defined(LOADAV_GETLOADAVG)
extern int getloadavg(double *, int);
#endif

69
osdef.sh Normal file
View file

@ -0,0 +1,69 @@
#! /bin/sh
if test -z "$CPP"; then
CPP="cc -E"
fi
if test -z "$srcdir"; then
srcdir=.
fi
rm -f core*
sed < $srcdir/osdef.h.in -n -e '/^extern/s@.*[)* ][)* ]*\([^ *]*\) __P.*@/[)*, ]\1[ (]/i\\\
\\/\\[^a-zA-Z_\\]\1 __P\\/d@p' > osdef1.sed
cat << EOF > osdef0.c
#include "config.h"
#include <sys/types.h>
#include <stdio.h>
#include <signal.h>
#include <sys/stat.h>
#include <pwd.h>
#ifdef SHADOWPW
#include <shadow.h>
#endif
#ifndef sun
#include <sys/ioctl.h>
#endif
#ifdef linux
#include <string.h>
#include <stdlib.h>
#endif
#include <sys/socket.h>
#ifndef NOSYSLOG
#include <syslog.h>
#endif
#include "os.h"
#if defined(UTMPOK) && defined (GETTTYENT) && !defined(GETUTENT)
#include <ttyent.h>
#endif
#ifdef SVR4
# include <sys/resource.h>
#endif
EOF
cat << EOF > osdef2.sed
1i\\
/*
1i\\
* This file is automagically created from osdef.sh -- DO NOT EDIT
1i\\
*/
EOF
$CPP -I. -I$srcdir osdef0.c | sed -n -f osdef1.sed >> osdef2.sed
sed -f osdef2.sed < $srcdir/osdef.h.in > osdef.h
rm osdef0.c osdef1.sed osdef2.sed
if test -f core*; then
file core*
echo " Sorry, your sed is broken. Call the system administrator."
echo " Meanwhile, you may try to compile screen with an empty osdef.h file."
echo " But if your compiler needs to have all functions declared, you should"
echo " retry 'make' now and only remove offending lines from osdef.h later."
exit 1
fi
if eval test "`diff osdef.h $srcdir/osdef.h.in | wc -l`" -eq 4; then
echo " Hmm, sed is very pessimistic about your system header files."
echo " But it did not dump core -- strange! Let's continue carefully..."
echo " If this fails, you may want to remove offending lines from osdef.h"
echo " or try with an empty osdef.h file, if your compiler can do without"
echo " function declarations."
fi

538
patchlevel.h Normal file
View file

@ -0,0 +1,538 @@
/* Copyright (c) 2008, 2009
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Micah Cowan (micah@cowan.name)
* Sadrul Habib Chowdhury (sadrul@users.sourceforge.net)
* Copyright (c) 1993-2002, 2003, 2005, 2006, 2007
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
*
* 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 3, 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 (see the file COPYING); if not, see
* https://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*
****************************************************************
* $Id$ GNU
*/
/****************************************************************
*
* patchlevel.h: Our life story.
*
* 08.07.91 -- 3.00.01 -wipe and a 'setenv TERM dumb' bugfix.
* 17.07.91 -- 3.00.02 another patchlevel by Wayne Davison
* 31.07.91 -- 3.00.03 E0, S0, C0 for flexible semi-graphics, nonblocking
* window title input and 'C-a :' command input.
* 10.08.91 -- 3.00.04 scrollback, markkeys and some bugfixes.
* 13.08.91 -- 3.00.05 mark routine improved, ansi prototypes added.
* 20.08.91 -- 3.00.06 screen -h, faster GotoPos in overlay, termcap %.
* instead of %c
* 28.08.91 -- 3.00.07 environment variable support. security. terminfo.
* pyramid and ultrix support.
* 07.09.91 -- 3.00.99 secopen(), MIPS support, SVR4 support.
* 09.09.91 -- 3.01.00 backspace bug fixed.
* 03.10.91 -- 3.01.01 ansi.c: null-ptr fixed, CLS now saves to scrollback.
* Using setresuid on hpux. Memory leak fixed.
* Better GotoPos(). Support for IC. Another resize bug.
* Detach() w/o fore crashed. -T and -A(dapt) option.
* GNU copyleft.
* 19.12.91 -- 3.01.02 flow now really automatic (autoflow killed).
* 7 bit restriction removed from WriteString().
* 09.01.92 -- 3.01.03 flow reattach bug fixed. VDISCARD bug fixed.
* 13.01.92 -- 3.01.04 new flow concept: ^Af toggles now three states
* 21.01.92 -- 3.01.05 '^A:screen 11' bug fixed. aflag in DoScreen().
* Some code cleanup. attach_tty and display_tty[]
* added.
* 26.01.92 -- 3.01.06 apollo support, "hardcopy_append on", "bufferfile",
* SECURITY PROBLEM cleared..
* 28.01.92 -- 3.01.07 screen after su allowed. Pid became part of
* SockName. sysvish 14 character restriction considered.
* 31.01.92 -- 3.02.00 Ultrix port, Irix 3.3 SGI port, shadow pw support,
* data loss on stdin overflow fixed. "refresh off".
* 12.02.92 -- 3.02.02 stripdev() moved, -S introduced, bufferfile improved,
* ShellProg coredump cleared. SVR4 bugfixes.
* I/O code speedup added.
* 24.04.92 -- 3.02.03 perfectly stackable overlays. One scrollback per window,
* not per display.
* 05.05.92 -- 3.02.04 very nasty initialisation bug fixed.
* 09.05.92 -- 3.02.05 parsing for $:cl: termcap strings and \012 octal notation
* in screenrc file. More structuring. Detached startup
* with 'screen -d -m -S...' bugfixed.
* 11.05.92 -- 3.02.06 setreuid() bugs cleared, C-a : setenv added.
* "xn" capability in TERMCAP needed since "am" is there.
* 25.06.92 -- 3.02.07 The multi display test version. Have merci.
* 15.07.92 -- 3.02.08 :B8: supports automatic charset switching for 8-bit
* 26.09.92 -- 3.02.09 Ported to linux. Ignoring bad files in $SCREENDIR
* 22.10.92 -- 3.02.10 screen.c/ansi.c splitted in several pieces.
* Better ISearch. Cleanup of loadav.c
* 29.10.92 -- 3.02.11 Key mechanism rewritten. New command names.
* New iscreenrc syntax.
* 02.11.92 -- 3.02.12 'bind g copy_reg' and 'bind x ins_reg' as suggested by
* stillson@tsfsrv.mitre.org (Ken Stillson).
* 03.11.92 -- 3.02.13 Ported to SunOs 4.1.2. Gulp. Some NULL ptrs fixed and
* misc. braindamage fixed.
* 03.11.92 -- 3.02.14 Argument number checking, AKA fixed.
* 05.11.92 -- 3.02.15 Memory leaks in Detach() and KillWindow() fixed.
* Lockprg powerdetaches on SIGHUP.
* 12.11.92 -- 3.02.16 Introduced two new termcaps: "CS" and "CE".
* (Switch cursorkeys in application mode)
* Tim's async output patch.
* Fixed an ugly bug in WriteString().
* New command: 'process'
* 16.11.92 -- 3.02.17 Nuking unsent tty output is now optional, (toxic
* ESC radiation).
* 30.11.92 -- 3.02.18 Lots of multi display bugs fixed. New layer
* function 'Restore'. MULTIUSER code cleanup.
* Rudimental acls added for multiuser.
* No more error output, when output gives write errors.
* 02.12.92 -- 3.02.19 BROKEN_PIPE and SOCK_NOT_IN_FS defines added for
* braindead systems. Bug in recover socket code fixed.
* Can create windows again from shell.
* 22.12.92 -- 3.02.20 Made a superb configure script. STY and break fixed.
* 01.02.93 -- 3.02.21 Coredump bug fixed: 8-bit output in background windows.
* Console grabbing somewhat more useable.
* 23.02.93 -- 3.02.22 Added ^:exec command, but not tested at all.
* 23.02.93 -- 3.02.23 Added 'hardcopydir' and 'logdir' commands.
* 11.03.93 -- 3.02.24 Prefixed display and window structure elements.
* Screen now handles autowrapped lines correctly
* in the redisplay and mark function.
* 19.03.93 -- 3.03.00 Patched for BSD386. pseudos work.
* 31.03.93 -- 3.03.01 Don't allocate so much empty attr and font lines.
* 04.04.93 -- 3.03.02 fixed :exec !..| less and :|less, patched BELL_DONE &
* ^B/^F. Fixed auto_nuke attribute resetting. Better linux
* configure. ^AW shows '&' when window has other attacher.
* MAXWIN > 10 patch. KEEP_UNDEF in config.h.in, shellaka
* bug fixed. dec alpha port. Solaris port.
* 02.05.93 -- 3.03.03 Configure tweaked for sgi. Update environment with
* setenv command. Silence on|off, silencewait <sec>,
* defautonuke commands added. Manual page updated.
* 13.05.93 -- 3.03.04 exit in newsyntax script, finished _CX_UX port.
* Texinfo page added by Jason Merrill. Much longish debug
* output removed. Select window by title (or number).
* 16.06.93 -- 3.04.00 Replaced ^A- by ^A^H to be complementary to ^A SPACE.
* Moved into CVS. Yacc.
* 28.06.93 -- 3.04.01 Fixed selecting windows with numeric title. Silence
* now works without nethackoption set.
* 01.07.93 -- 3.04.02 Implementing real acls.
* 22.07.93 -- 3.05.00 Fixed SVR4, some multiuser bugs, -- DISTRIBUTED
* 05.08.93 -- 3.05.01 ${srcdir} feature added. Shellprog bug fixed.
* Motorola reattach bug fixed. Writelock bug fixed.
* Copybuffer moved into struct acluser. Configure.in
* uglified for Autoconf1.5. Paste may now have an
* argument. Interactive setenv. Right margin bug
* fixed. IRIX 5 patches. -- DISTRIBUTED
* 13.08.93 -- 3.05.02 ultrix support added. expand_vars removed from
* register function. Paste bug fixed.
* sysmacros.h now included in pty.c on sgis
* Strange hpux hack added for TTYCMP.
* Zombie feature improved.
* 08.09.93 -- 3.05.03 Makefile and OSF1 fine tuning. Eased attach to
* multi sessions. Writelock now obeys acl write
* permissions. UserDel() now preserves defaults.
* acladd/aclchg syntax improved. Updated
* documentation. Bug in at command fixed.
* MakeWindow() now obeys perm defaults.
* 03.10.93 -- 3.05.90 Multiple displays can now share the same window.
* Layers now belong to Windows. "Select -" yields a blank
* page. Debug output can be switched on/off at runtime.
* Number command changes window number and utmp-slot.
* 14.10.93 -- 3.05.91 Mechanism to find the "best" window added. Much
* debugging done and still needed. Slowpaste setting now
* per window. Preserving fore AND other window when
* detached. Per user settings for `monitor' and `silence'.
* New command `su'. BlankWindow performs now ColonInput.
* History command fixed, it depended on paste code that
* was previously changed to allow concatenation of buffers.
* Fixing umask problem with WriteFile() reported by Jamie
* Mason.
* 30.11.93 -- 3.05.04 Kanji support added. New keymap feature:
* bindkey and various map commands. GR and C1
* flags now define the character processing.
* 30.11.93 -- 3.05.92 Kanji support added. New keymap feature:
* bindkey and various map commands. GR and C1
* flags now define the character processing.
* 17.12.93 -- 3.05.93 Tcon authentification mechanism. AddChar macro broken up
* into 2 functions. Acl.c, network.c, misc.c, termcap.c
* and tty.c are now display free!
* 27.12.93 -- 3.05.94 Telnet login works, can export one window per mux.
* Acl-groups added. Export rights is an acl.
* connect works, can create shadow window thus import
* command channel and switch windows. Can detach sessions
* from each other. Can renumber imported and exported
* windows. DL_LOOP prevents now SEGV, sessions have names
* and can be connected to very flexible.
* 03.01.94 -- 3.05.95 Import and export of any number of channels works,
* except a small bug with margin handling when exporting.
* Window titles are forwarded, break is forwarded and
* tcon learned the mux protocoll. A few more bugs in
* network.c fixed. Tcon has Mux arrays, Protocoll is '\0'
* free.
* 08.01.94 -- 3.05.96 More tcon work. Solaris debugging.
*
* 14.01.94 -- 3.05.05 New FindSocket() code. Nicer socket handling.
* 20.01.94 -- 3.05.06 New attribute handling code. NeXT fixes.
* 04.02.94 -- 3.05.07 Ugly bug in ScrollH fixed. Keymap defaults.
* 10.03.94 -- 3.05.97 'defsilence' by Lloyd Zusman. Zombie resurrekt key.
* -b, -p options. Fixed Compilekeys(), gulp. config.h
* allows choice of VMIN/VTIME/NDELAY for ttys.
* 13.04.94 -- 3.05.08 Kanji bug fixed. POSIX sigaction support.
* os.h cleanup. UTNOKEEP splitted into
* UT_CLOSE and UT_UNSORTED. linux no longer
* implies UT_CLOSE. "struct display" name
* convention change: _d_ to d_ and d_ to D_.
* 20.04.94 -- 3.05.09 configure.in ptyrange bug fixed. Upgraded
* to autoconf-1.8
* 27.04.94 -- 3.05.10 97801 obscure code support. Linux long
* password workaround.
* 09.05.94 -- 3.05.11 seteuid() support added. Security fixes.
* _IBMR2 kludge makes call to sleep obsolete.
* Small fixes in uname() code. djm suggests replace of
* BSDI by __bsdi__.
* 27.07.94 -- 3.05.12 seteuid attacher bug fixed. ks/ke changed
* in termcap/info and termcap.c
* 01.09.94 -- 3.05.58 (There are a few more patches to come, subtracted 40)
* breaktype command to select how we cause breaks.
* Testing logfile.c. Manual and texinfo documentation
* updated to explain all new commands except keymapping.
* Added modem lines to info of plain ttys. Using
* cfset{i,o}speed() for POSIX is better, much better.
* 07.09.94 -- 3.05.59 Flushing logfiles every 5 seconds. Testing new
* resize linewrap code. Resize with care.
* Resurrect now displays its command string.
* 11.09.94 -- 3.05.60 Lines are now correctly wrapped, when window size
* changes; this prevents loss of text.
* 15.09.94 -- 3.05.61 umask renamed to aclumask, bell renamed to bell_msg.
* *_msg commands show message when called w/o parameter.
* Many changes in the manual, thanks to Sven Guckes.
* -O removed.
* 27.09.94 -- 3.05.13 defwlock stupidity fixed. MakeTermcap ks/ke
* ':' removed. Termcap entry improved.
* copy_reg and ins_reg obsoleted by better paste command:
* paste => paste .
* copy_reg r => paste . r
* ins_reg r => paste r
* ins_reg => paste
* 18.10.94 -- 3.05.62 breaktype changed. -L option added to enable logging
* from both command line and screenrc. SIGXFSZ ignored.
* 28.11.94 -- 3.05.63 ACL's sharpened. No user has any rights, unless
* explicitly given. Only two exceptions: 1) "acladd user"
* without further parameters. 2) Evry user has a default
* umask that gives himself all permissions on the windows
* he creates. Bug with colon input on shared windows fixed.
* The commad is now executed by the user typing the final
* Enter-Key rather by a random user.
* 30.11.94 -- 3.05.64 On demand grabbing of pending auto writelocks.
* Solaris troubles us with kill(pid, 0) ... not fixed...
* defbreaktype added. (breaktype is also global, still...)
* SIGARGHACK cleared, to pamper poor little Ultrix4.4 cfe.
* defescape added.
* w_status changed to w_hstatus, it's a #define in
* Domain/OS reported by ejackson@iastate.edu.
* 05.12.94 -- 3.05.17 SVR4 pty bug fixed, don't update window status
* line if not changed, onyx support. Manual
* pages updated.
* 14.12.94 -- 3.05.18 w_status changed to w_hstatus, it's a #define in
* Domain/OS reported by ejackson@iastate.edu.
* Screen manpage patches by larry.
* Ugly seteuid bug in ForkWindow() fixed.
* 20.12.94 -- 3.06.00 Solaris has broken seteuid().
* osf loadav patches. -- DISTRIBUTED
* 08.01.95 -- 3.05.65 Bug with LOGOUTOK and -ln fixed. redundant secfopen()
* avoided, when logfflush() looks at delayed nfs updates.
* Option parser now allowes condensed options. -A fixed.
* New commands 'preselect' and 'defpreselect'. New option
* -WdmS starts a detached screen session with watchdog.
* 16.01.95 -- 3.06.01 KANJI patch. doc/Makefile.in fixed.
* Install now calls doc/Makefile install.
* Don't use 'ds' too often, breaks MSkermit.
* undef'd LOGOUTOK logs in now.
* Ultrix is broken, too (seteuid).
* Use \r (not \n) to join lines in pastebuf.
* bindkey can now remove sequences.
* InitTTY fixed for PLAIN. -- DISTRIBUTED
* 06.02.95 -- 3.05.66 DisplayLine() does now clipping to reduce coredump-
* frequency. Window size is adapted to the display that
* types input, to reduce multi-user confusion. Scrollback
* mode still may get the wrong size.
* 07.02.95 -- 3.05.67 WinRewrite() also needs to clip. Users without unix
* account, but with screen password allowed. Chacl
* allows password change, su prompts for user name too.
* 01.03.95 -- 3.05.68 Leaving a window may now cause a resize to match a
* remaining display. Simple ESC-CR fix in the vt100
* state machine.
* 26.03.95 -- 3.05.69 Markroutine() needs to resize the window to avoid
* coredumps, just like WinProcess() already does.
* More NEED_ flags added in comm.c to avoid coredumps.
* 04.04.95 -- 3.06.02 Simple ESC-CR fix in the vt100 state machine.
* Now compiles again with all extras disabled.
* Zombie resurrect added. defc1, defgr, defkanji
* added. Screen now replies to a secondary DA
* query. Some missing NEED_XXX added in comm.c.
* Better default tty permissions/group test.
* More AUX support, now compiles with POSIX.
* Function keycodes xtermified (F11, F12).
* Paste bug fixed (only worked with KANJI).
* Check bcopy before memcpy/memmove.
* FindSocket code much fixed & improved.
* 10.04.95 -- 3.05.70 Display_displays() now shows the users permissions on
* the currently displayed window, this is easier than a
* full featured lsacl, but also helps. chacl can now copy
* users, but we need to copy windows.
* 26.04.95 -- 3.05.71 Multi digit screen numbers in utmp. MakeWindow() now
* echoes what it does, just like RemakeWindow() when
* 'verbose on' (default off).
* `screen -ls myname/' will find own(!) non-multi sessions.
* Command line option -q improved and documented.
* 'debug off' also shuts attacher debugging off now.
* 03.05.95 -- 3.05.72 'connect' command bugfixed. colon prompt improved.
* open(O_NONBLOCK) does not work on 4.1.3, using O_NDELAY.
* There are writes to exp_wid2chan[-1], XXX I just added
* fillers to the mux structure, please debug this ASAP!
* WindowByName() prefers exact matches now. Esc forwarding
* from Frontend to Backend suppressed unless specified.
* 26.06.95 -- 3.05.73 Improving the combination of dflag and rflag: If both
* are set, a screen session is reattached, regardless
* if it was previously detached or attached elseewhere.
* "screen -D -RR" is thus most powerful: Give me my screen
* session here and now. No matter, if this means creating
* a new session (due to the second R without warning
* message), detching the session first (and due to the
* capitalised D logging out), or simply attaching to it.
* 13.07.95 -- 3.05.74 Markroutine learned new join mode: comma seperated.
* Can disable the detach feature from config.h.
* Configure.in now calls etc/toolcheck. Password is no
* longer a static array.
* 30.07.95 -- 3.05.75 Karl Heuer wants to install with a relative symlink.
* Command line option -k removed (try -t).
* 31.08.95 -- 3.06.03 Color support, digraph command, code
* cleanup (struct mchar/mline added).
* 03.09.95 -- 3.06.04 SetRendition display check. Solaris unblock
* SIGHUP. w_curchar->w_rend, lintified.
* Shadow-password code moved and rewritten
* (includes sun C2).
* 06.09.95 -- 3.05.76 Added support for braille displays (by Hadi Bargi Rangin
* and Bill Barry, {bargy,barryb}@dots.physics.orst.edu
* Added baud, cs8, istrip, ixon, ixoff options for plain
* tty windows. Untested.
* 09.09.95 -- 3.07.99 Merged 3.7.76 back into the main distribution but
* without network, blankwindow and dlist support.
* Global variable Password removed.
* Resize code completely rewritten.
* New commands: sorendition, (def)charset.
* strftime-like message generation.
* 26.09.95 -- 3.06.05 resize code completely rewritten.
* Very visible cursor added. vbell sequence
* \Eb added. _delay for terminfo libs added
* to make the padding work for the first time.
* New ProcessInput() makes "command command"
* work. '[def]escape ""' clears escape chars.
* Changed logdir command to logfile. It now uses
* MakeWinMsg() to create the filename.
* Updated the manuals.
* 03.10.95 -- 3.08.00 Merged 3.07.99 back into my 3.06.05.
* pause removed. NONROOT now in config.h.
* sysV68 configure test. Socket protocol got
* revision number. New command termcapinfo.
* Screenrcs, docs & configure.in updated
* 18.10.95 -- 3.08.01 Info shows parser state.
* Very visible cursor added. vbell sequence
* \Eb added. _delay for terminfo libs added
* to make the padding work for the first time.
* Braille code almost completely reworked.
* New ProcessInput() makes "command command"
* work. '[def]escape ""' clears escape chars.
* Command logdir -> logfile and uses MakeWinMsg.
* Updated the manuals. New mark command 'x'.
* stuff has new "-k" parameter.
* 28.10.95 -- 3.06.06 Added new 'XC' capability to provide
* a method for character translation.
* 17.11.95 -- 3.07.00 Added CheckEscape() function.
* acl -> acls because of hpux10 nameclash
* /stand/vmunix added to kernel list (hpux10)
* stripdev changed to translate
* /dev/pts<n> to /dev/pts/<n> (unixware)
* -lgen added to GETUTENT configure test.
* 20.11.95 -- 3.07.01 corrected vbell null ptr reference.
* -- DISTRIBUTED
* 27.11.95 -- 3.08.02 Added CheckEscape() function.
* acl -> acls because of hpux10 nameclash
* /stand/vmunix added to kernel list (hpux10)
* stripdev changed to translate
* /dev/pts<n> to /dev/pts/<n> (unixware)
* -lgen added to GETUTENT configure test.
* corrected vbell null ptr reference
* -- 3.08.03 etc/toolcheck is now shouting louder.
* Solaris 2.5 has /kernel/genunix.
* Touching socket when detach/attach.
* FindWindow corrected. AIX4 patch
* from robert@mayday.cix.co.uk.
* 1.09.96 -- 3.07.02 added #ifdef MAPKEYS for CheckEscape.
* etc/toolcheck is now shouting louder.
* Touching socket when detach/attach.
* Linux tcflush hack. Linux md5 password suport.
* USE_SGR support for dumb (wyse) terminals.
* "at" and "reset" commands improved.
* Now sensitive to broken AIX4 TIOCPKT.
* tek patch unapplied.
* linux utmp patch: set slot to DEAD_PROCESS.
* include signal.h for killpg if hpux10.10.
* linux: elf, but no SVR4, check for utmpx.
* hpux10.10 libcurses breaks select()!
* -- DISTRIBUTED
* 27.09.96 -- 3.07.03 ncurses tgetflag returns -1 if cap not valid.
* autonuke fix: reset application mode. An init
* string may have cleared it.
* Small UTMPOK patch from Douglas B. Jones.
* 23.06.97 -- 3.07.04 Some bugfixes. Kanji fixed.
* Code update from 3.8.6: Colon line editing added.
* Digraph made line-editing resistant.
* DEC ALPHA ut_user[0] = 0;
* Added error messages to exit_with_usage.
* FindSocket code improved (the MULTIUSER part).
* Use utimes() if available. Power-detached start.
* vsnprintf() support. exit -> _exit in window.c.
* AddXChars now tolerates NULL string.
* -- DISTRIBUTED
* 10.11.98 -- 3.07.05 Wayne's resize.c patch to keep the cursor
* onscreen. FindWindow corrected. AIX4 patch
* from robert@mayday.cix.co.uk.
* Fixed kanji am & markcursor bugs.
* SCO support (Gert Doering).
* Wayne's statusline extra space. New flag nospc
* for MakeWinMsg. New TF capability: add missing
* termcap/info caps. screen-exchange security
* fix. Use kstat for Solaris' loadavg.
* Check for mode 775 if screen runs setgid.
* Fixed typo in silence command.
* Allow detach with no tty. HPUX10.20 ltchars
* hack. Use @1/@7 as replacement for kh/kH.
* Use seteuid before calling tgetent.
* Check for displays in Msg().
* Linux ncurses hack: redefine _nc_timed_wait.
* Configure check for ncurses (sigh).
* ITOH Yasufumi: kanji fixes, osf support,
* bug fixes. More secure Rewrite().
* Increased line buffer size to 2048 bytes.
* SCO-5 Fixes (Brian L. Gentry).
* 25.11.98 -- 3.07.06 resize code now handles tabs correctly.
* -- DISTRIBUTED
* -- 3.09.00 loads'o'bugs fixed, 3.8 merged with 3.7.
* new region clip code.
* Many new features (see NEWS file).
* 3.08.99 -- 3.09.02 -- DISTRIBUTED
* 11.08.99 -- 3.09.04 small utmp fix, BSD chflags fix, tty mode fix
* -- DISTRIBUTED
* 1.09.99 -- 3.09.05 linux SVR4_PTYS fixes, better ShowWindos(),
* Panic() displays bug fixed, strerror fixed,
* missing $srcdir & bad prefix in Makefiles.
* console grabbing with SRIOCSREDIR.
* linux utmp workaround added. Some KANJI bugs
* fixed. Stupid StuffKey() bug fixed.
* -- DISTRIBUTED
* 24.07.00 -- 3.09.06 kanji fixes. lock escape char fix.
* removed delayed message hack.
* resize command & focus subcomands by joze.
* fix for solaris' utmp_helper bug.
* linux tty handling fix.
* mousetracking, rxvt osc sequences.
* background color erase support.
* don't log user in after hangup.
* hstatus escape update bug fixed.
* 1.09.00 -- 3.09.08 -- DISTRIBUTED
* 25.05.01 -- 3.09.09 use $DESTDIR in Makefiles.
* renamed struct user to acluser to fix hpux
* problem for good. utf8 support. 16 color
* support. New -X option and escape sequence
* to send screen commands.
* New commands: attrcolor, defutf8, dinfo, utf8.
* Extended commands: width, height, readbuf,
* writebuf. Better nlist64 detection.
* New config.h option SOCKDIR_IS_LOCAL_TO_HOST.
* Don't call tputs with an empty string.
* New string escape %{ for attr/color changes.
* LRefreshAll bug fixed (0 instead of -1 as bce).
* New quote handling in Parse(). Workaround for
* some bad termcap/info entries added. Set BE
* for all xtermish emulators. Added '0x' and
* 'U+' prefix in digraph command. LOADAV_TYPE
* detection fixed.
* -- DISTRIBUTED
* 4.09.01 -- 3.09.10 '-R' security fix. Fixed array in MScrollV().
* -- DISTRIBUTED
* Reset charset after 'me'.
* 14.02.02 -- 3.09.11 Support for other encodings. Double width
* utf-8 chars. 'L' modifier for %D, %M, %w
* and %W. New %= (hfill), %H (hostname),
* %f (flags), %F (focus) escapes. New commands
* source, windowlist, deflog. Command key classes.
* New login state: always. Time format
* changeable. 256 color support.
* Updated digraph table. Ignorecase.
* Windowlist resizeable on blank window.
* Added encoding to paste buffers.
* Hpux loadtype detection fixed.
* Disabled im/ic warning. Fixed a bug that
* could cause window lockups in rare
* circumstances. Made hangup signal to the
* backend process detach all displays.
* New escapes %< %>, + and - flag for %w.
* Added eval command, added -h option to detach.
* Also set flayer when processing -X commands.
* use getpt() on linux systems. doc patches from
* Adam Lazur. tty flow/intr cleanup.
* -- DISTRIBUTED
* 29.08.2002 3.09.12 Port to POSIX 1003.1-2001 hosts (Paul Eggert).
* Fixed encoding for reattach password test.
* Fixed NUL characters when encodings are active.
* Fixed silly encodings bugs. Fixed bogus
* oldflayer when a window gets freed.
* Altscreen support by Gurusamy Sarathy.
* Reuse old password in builtin_screenlock.
* -- DISTRIBUTED
* 05.09.2002 3.09.13 added missing break statement that broke
* the eval command.
* -- DISTRIBUTED
* 13.03.2003 3.09.15 Console workaround for linux. Scrolling-region
* reset fix. GBK encoding added.
* support for unicode combining characters added.
* openpty() support added (thomas@xs4all.nl).
* preselect of blank window ('-') or window
* list ('=') added. Added %` string escape
* and backtick command.
* -- DISTRIBUTED
* 08.09.2003 4.00.00 rewrote nonblock command, added defnonblock.
* added zmodem support (catch & passthrough).
* added screenblanker.
* fixed a couple of GBK bugs.
* rewrote command parsing.
* added -m option to windowlist (Felix Rosencrantz)
* -- DISTRIBUTED
* 18.09.2003 4.00.01 fixed two small bugs in the new parser.
* -- DISTRIBUTED
* 05.12.2003 4.00.02 fixed a bug in the ansi parser. fixed execs
* on ttys. fixed hardstatus line on blanked screen.
* -- DISTRIBUTED
* 11.10.2004, 4.00.03jw handle StartRc errors nonfatal if due to a msg.
* 12.10.2004, 4.00.03jw1 let docu of 'split' 'focus' 'remove' and 'only' refer to each other.
* 01.11.2004, 4.00.03jw2 zombie command has new option 'onerror'
* 2005-12-19, 4.00.03jw3 syntax error.
*/
#define ORIGIN "GNU"
#define REV 4
#define VERS 9
#define PATCHLEVEL 1
#define DATE "20-Aug-23"
#define STATE ""

7414
process.c Normal file

File diff suppressed because it is too large Load diff

425
pty.c Normal file
View file

@ -0,0 +1,425 @@
/* Copyright (c) 2008, 2009
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Micah Cowan (micah@cowan.name)
* Sadrul Habib Chowdhury (sadrul@users.sourceforge.net)
* Copyright (c) 1993-2002, 2003, 2005, 2006, 2007
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
*
* 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 3, 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 (see the file COPYING); if not, see
* https://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*
****************************************************************
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <signal.h>
#if defined(__OpenBSD__)
#include <utils.h> /* for openpty() */
#endif
#include "config.h"
#include "screen.h"
#ifndef sun
# include <sys/ioctl.h>
#endif
/* for solaris 2.1, Unixware (SVR4.2) and possibly others */
#ifdef HAVE_STROPTS_H
# include <sys/stropts.h>
#endif
#if defined(sun) && defined(LOCKPTY) && !defined(TIOCEXCL)
# include <sys/ttold.h>
#endif
#ifdef ISC
# include <sys/tty.h>
# include <sys/sioctl.h>
# include <sys/pty.h>
#endif
#ifdef sgi
# include <sys/sysmacros.h>
#endif /* sgi */
#include "extern.h"
/*
* if no PTYRANGE[01] is in the config file, we pick a default
*/
#ifndef PTYRANGE0
# define PTYRANGE0 "qpr"
#endif
#ifndef PTYRANGE1
# define PTYRANGE1 "0123456789abcdef"
#endif
/* SVR4 pseudo ttys don't seem to work with SCO-5 */
#ifdef M_UNIX
# undef HAVE_SVR4_PTYS
#endif
extern int eff_uid;
/* used for opening a new pty-pair: */
static char PtyName[32], TtyName[32];
#if !(defined(sequent) || defined(_SEQUENT_) || defined(HAVE_SVR4_PTYS))
# ifdef hpux
static char PtyProto[] = "/dev/ptym/ptyXY";
static char TtyProto[] = "/dev/pty/ttyXY";
# else
# ifdef M_UNIX
static char PtyProto[] = "/dev/ptypXY";
static char TtyProto[] = "/dev/ttypXY";
# else
static char PtyProto[] = "/dev/ptyXY";
static char TtyProto[] = "/dev/ttyXY";
# endif
# endif /* hpux */
#endif
static void initmaster __P((int));
#if defined(sun)
/* sun's utmp_update program opens the salve side, thus corrupting
*/
int pty_preopen = 1;
#else
int pty_preopen = 0;
#endif
/*
* Open all ptys with O_NOCTTY, just to be on the safe side
* (RISCos mips breaks otherwise)
*/
#ifndef O_NOCTTY
# define O_NOCTTY 0
#endif
/***************************************************************/
static void
initmaster(f)
int f;
{
#ifdef POSIX
tcflush(f, TCIOFLUSH);
#else
# ifdef TIOCFLUSH
(void) ioctl(f, TIOCFLUSH, (char *) 0);
# endif
#endif
#ifdef LOCKPTY
(void) ioctl(f, TIOCEXCL, (char *) 0);
#endif
}
void
InitPTY(f)
int f;
{
if (f < 0)
return;
#if defined(I_PUSH) && defined(HAVE_SVR4_PTYS) && !defined(sgi) && !defined(linux) && !defined(__GLIBC__) && !defined(__osf__) && !defined(M_UNIX)
if (ioctl(f, I_PUSH, "ptem"))
Panic(errno, "InitPTY: cannot I_PUSH ptem");
if (ioctl(f, I_PUSH, "ldterm"))
Panic(errno, "InitPTY: cannot I_PUSH ldterm");
# ifdef sun
if (ioctl(f, I_PUSH, "ttcompat"))
Panic(errno, "InitPTY: cannot I_PUSH ttcompat");
# endif
#endif
}
/***************************************************************/
#if defined(OSX) && !defined(PTY_DONE)
#define PTY_DONE
int
OpenPTY(ttyn)
char **ttyn;
{
register int f;
if ((f = open_controlling_pty(TtyName)) < 0)
return -1;
initmaster(f);
*ttyn = TtyName;
return f;
}
#endif
/***************************************************************/
#if (defined(sequent) || defined(_SEQUENT_)) && !defined(PTY_DONE)
#define PTY_DONE
int
OpenPTY(ttyn)
char **ttyn;
{
char *m, *s;
register int f;
if ((f = getpseudotty(&s, &m)) < 0)
return -1;
#ifdef _SEQUENT_
fvhangup(s);
#endif
strncpy(PtyName, m, sizeof(PtyName));
strncpy(TtyName, s, sizeof(TtyName));
initmaster(f);
*ttyn = TtyName;
return f;
}
#endif
/***************************************************************/
#if defined(__sgi) && !defined(PTY_DONE)
#define PTY_DONE
int
OpenPTY(ttyn)
char **ttyn;
{
int f;
char *name, *_getpty();
sigret_t (*sigcld)__P(SIGPROTOARG);
/*
* SIGCHLD set to SIG_DFL for _getpty() because it may fork() and
* exec() /usr/adm/mkpts
*/
sigcld = signal(SIGCHLD, SIG_DFL);
name = _getpty(&f, O_RDWR | O_NONBLOCK, 0600, 0);
signal(SIGCHLD, sigcld);
if (name == 0)
return -1;
initmaster(f);
*ttyn = name;
return f;
}
#endif
/***************************************************************/
#if defined(MIPS) && defined(HAVE_DEV_PTC) && !defined(PTY_DONE)
#define PTY_DONE
int
OpenPTY(ttyn)
char **ttyn;
{
register int f;
struct stat buf;
strcpy(PtyName, "/dev/ptc");
if ((f = open(PtyName, O_RDWR | O_NOCTTY | O_NONBLOCK)) < 0)
return -1;
if (fstat(f, &buf) < 0)
{
close(f);
return -1;
}
sprintf(TtyName, "/dev/ttyq%d", minor(buf.st_rdev));
initmaster(f);
*ttyn = TtyName;
return f;
}
#endif
/***************************************************************/
#if defined(HAVE_SVR4_PTYS) && !defined(PTY_DONE)
#define PTY_DONE
int
OpenPTY(ttyn)
char **ttyn;
{
register int f;
char *m, *ptsname();
int unlockpt __P((int)), grantpt __P((int));
#if defined(HAVE_GETPT) && defined(linux)
int getpt __P((void));
#endif
sigret_t (*sigcld)__P(SIGPROTOARG);
strcpy(PtyName, "/dev/ptmx");
#if defined(HAVE_GETPT) && (defined(linux) || defined(__GLIBC__))
if ((f = getpt()) == -1)
#else
if ((f = open(PtyName, O_RDWR | O_NOCTTY)) == -1)
#endif
return -1;
/*
* SIGCHLD set to SIG_DFL for grantpt() because it fork()s and
* exec()s pt_chmod
*/
sigcld = signal(SIGCHLD, SIG_DFL);
if ((m = ptsname(f)) == NULL || grantpt(f) || unlockpt(f))
{
signal(SIGCHLD, sigcld);
close(f);
return -1;
}
signal(SIGCHLD, sigcld);
if (strlen(m) < sizeof(TtyName))
strcpy(TtyName, m);
else
{
close(f);
return -1;
}
initmaster(f);
*ttyn = TtyName;
return f;
}
#endif
/***************************************************************/
#if defined(_AIX) && defined(HAVE_DEV_PTC) && !defined(PTY_DONE)
#define PTY_DONE
int
OpenPTY(ttyn)
char **ttyn;
{
register int f;
/* a dumb looking loop replaced by mycrofts code: */
strcpy (PtyName, "/dev/ptc");
if ((f = open (PtyName, O_RDWR | O_NOCTTY)) < 0)
return -1;
strncpy(TtyName, GetPtsPathOrSymlink(f), sizeof(TtyName));
if (eff_uid && access(TtyName, R_OK | W_OK))
{
close(f);
return -1;
}
initmaster(f);
# ifdef _IBMR2
pty_preopen = 1;
# endif
*ttyn = TtyName;
return f;
}
#endif
/***************************************************************/
#if defined(HAVE_OPENPTY) && !defined(PTY_DONE)
#define PTY_DONE
int
OpenPTY(ttyn)
char **ttyn;
{
int f, s;
if (openpty(&f, &s, TtyName, NULL, NULL) != 0)
return -1;
close(s);
initmaster(f);
pty_preopen = 1;
*ttyn = TtyName;
return f;
}
#endif
/***************************************************************/
#ifndef PTY_DONE
int
OpenPTY(ttyn)
char **ttyn;
{
register char *p, *q, *l, *d;
register int f;
debug("OpenPTY: Using BSD style ptys.\n");
strcpy(PtyName, PtyProto);
strcpy(TtyName, TtyProto);
for (p = PtyName; *p != 'X'; p++)
;
for (q = TtyName; *q != 'X'; q++)
;
for (l = PTYRANGE0; (*p = *l) != '\0'; l++)
{
for (d = PTYRANGE1; (p[1] = *d) != '\0'; d++)
{
debug1("OpenPTY tries '%s'\n", PtyName);
if ((f = open(PtyName, O_RDWR | O_NOCTTY)) == -1)
continue;
q[0] = *l;
q[1] = *d;
if (eff_uid && access(TtyName, R_OK | W_OK))
{
close(f);
continue;
}
#if defined(sun) && defined(TIOCGPGRP) && !defined(SUNOS3)
/* Hack to ensure that the slave side of the pty is
* unused. May not work in anything other than SunOS4.1
*/
{
int pgrp;
/* tcgetpgrp does not work (uses TIOCGETPGRP)! */
if (ioctl(f, TIOCGPGRP, (char *)&pgrp) != -1 || errno != EIO)
{
close(f);
continue;
}
}
#endif
initmaster(f);
*ttyn = TtyName;
return f;
}
}
return -1;
}
#endif
/* len(/proc/self/fd/) + len(max 64 bit int) */
#define MAX_PTS_SYMLINK (14 + 21)
char *GetPtsPathOrSymlink(int fd)
{
int ret;
char *tty_name;
static char tty_symlink[MAX_PTS_SYMLINK];
errno = 0;
tty_name = ttyname(fd);
if (!tty_name && errno == ENODEV) {
ret = snprintf(tty_symlink, MAX_PTS_SYMLINK, "/proc/self/fd/%d", fd);
if (ret < 0 || ret >= MAX_PTS_SYMLINK)
return NULL;
/* We are setting errno to ENODEV to allow callers to check
* whether the pts device exists in another namespace.
*/
errno = ENODEV;
return tty_symlink;
}
return tty_name;
}

216
putenv.c Normal file
View file

@ -0,0 +1,216 @@
/* Copyright (c) 2008, 2009
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Micah Cowan (micah@cowan.name)
* Sadrul Habib Chowdhury (sadrul@users.sourceforge.net)
* Copyright (c) 1993-2002, 2003, 2005, 2006, 2007
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
*
* 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 3, 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 (see the file COPYING); if not, see
* https://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*
****************************************************************
*/
/*
* putenv -- put value into environment
*
* Usage: i = putenv (string)
* int i;
* char *string;
*
* where string is of the form <name>=<value>.
* If "value" is 0, then "name" will be deleted from the environment.
* Putenv returns 0 normally, -1 on error (not enough core for malloc).
*
* Putenv may need to add a new name into the environment, or to
* associate a value longer than the current value with a particular
* name. So, to make life simpler, putenv() copies your entire
* environment into the heap (i.e. malloc()) from the stack
* (i.e. where it resides when your process is initiated) the first
* time you call it.
*
* HISTORY
* 3-Sep-91 Michael Schroeder (mlschroe). Modified to behave as
* as putenv.
* 16-Aug-91 Tim MacKenzie (tym) at Monash University. Modified for
* use in screen (iScreen) (ignores final int parameter)
* 14-Oct-85 Michael Mauldin (mlm) at Carnegie-Mellon University
* Ripped out of CMU lib for Rob-O-Matic portability
* 20-Nov-79 Steven Shafer (sas) at Carnegie-Mellon University
* Created for VAX. Too bad Bell Labs didn't provide this. It's
* unfortunate that you have to copy the whole environment onto the
* heap, but the bookkeeping-and-not-so-much-copying approach turns
* out to be much hairier. So, I decided to do the simple thing,
* copying the entire environment onto the heap the first time you
* call putenv(), then doing realloc() uniformly later on.
*/
#include "config.h"
#ifdef NEEDPUTENV
#if defined(__STDC__)
# define __P(a) a
#else
# define __P(a) ()
#endif
char *malloc __P((int));
char *realloc __P((char *, int));
void free __P((char *));
int sprintf __P((char *, char *, ...));
#define EXTRASIZE 5 /* increment to add to env. size */
static int envsize = -1; /* current size of environment */
extern char **environ; /* the global which is your env. */
static int findenv __P((char *)); /* look for a name in the env. */
static int newenv __P((void)); /* copy env. from stack to heap */
static int moreenv __P((void)); /* incr. size of env. */
int
unsetenv(name)
char *name;
{
register int i;
if (envsize < 0)
{ /* first time putenv called */
if (newenv() < 0) /* copy env. to heap */
return -1;
}
i = findenv(name);
if (i < 0)
return 0; /* Already here */
free(environ[i]);
if (envsize > 0)
envsize--;
for (; environ[i]; i++)
environ[i] = environ[i+1];
return 0; /* Already here */
}
int
putenv(string)
char *string;
{
register int i;
register char *p;
if (envsize < 0)
{ /* first time putenv called */
if (newenv() < 0) /* copy env. to heap */
return -1;
}
i = findenv(string); /* look for name in environment */
if (i < 0)
{ /* name must be added */
for (i = 0; environ[i]; i++);
if (i >= (envsize - 1))
{ /* need new slot */
if (moreenv() < 0)
return -1;
}
p = malloc(strlen(string) + 1);
if (p == 0) /* not enough core */
return -1;
environ[i + 1] = 0; /* new end of env. */
}
else
{ /* name already in env. */
p = realloc(environ[i], strlen(string) + 1);
if (p == 0)
return -1;
}
sprintf(p, "%s", string); /* copy into env. */
environ[i] = p;
return 0;
}
static int
findenv(name)
char *name;
{
register char *namechar, *envchar;
register int i, found;
found = 0;
for (i = 0; environ[i] && !found; i++)
{
envchar = environ[i];
namechar = name;
while (*namechar && *namechar != '=' && (*namechar == *envchar))
{
namechar++;
envchar++;
}
found = ((*namechar == '\0' || *namechar == '=') && *envchar == '=');
}
return found ? i - 1 : -1;
}
static int
newenv()
{
register char **env, *elem;
register int i, esize;
for (i = 0; environ[i]; i++)
;
esize = i + EXTRASIZE + 1;
env = (char **)malloc(esize * sizeof (elem));
if (env == 0)
return -1;
for (i = 0; environ[i]; i++)
{
elem = malloc(strlen(environ[i]) + 1);
if (elem == 0)
return -1;
env[i] = elem;
strcpy(elem, environ[i]);
}
env[i] = 0;
environ = env;
envsize = esize;
return 0;
}
static int
moreenv()
{
register int esize;
register char **env;
esize = envsize + EXTRASIZE;
env = (char **)realloc((char *)environ, esize * sizeof (*env));
if (env == 0)
return -1;
environ = env;
envsize = esize;
return 0;
}
#endif /* NEEDPUTENV */

1133
resize.c Normal file

File diff suppressed because it is too large Load diff

272
sched.c Normal file
View file

@ -0,0 +1,272 @@
/* Copyright (c) 2008, 2009
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Micah Cowan (micah@cowan.name)
* Sadrul Habib Chowdhury (sadrul@users.sourceforge.net)
* Copyright (c) 1993-2002, 2003, 2005, 2006, 2007
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
*
* 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 3, 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 (see the file COPYING); if not, see
* https://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*
****************************************************************
*/
#include <sys/types.h>
#if !defined(sun) && !defined(B43) && !defined(ISC) && !defined(pyr) && !defined(_CX_UX)
# include <time.h>
#endif
#include <sys/time.h>
#include "config.h"
#include "screen.h"
#include "extern.h"
static struct event *evs;
static struct event *tevs;
static struct event *nextev;
static int calctimeout;
static struct event *calctimo __P((void));
#if (defined(sgi) && defined(SVR4)) || defined(__osf__) || defined(M_UNIX)
static int sgihack __P((void));
#endif
void
evenq(struct event *ev)
{
struct event *evp, **evpp;
debug3("New event fd %d type %d queued %d\n", ev -> fd, ev -> type, ev -> queued);
if (ev->queued)
return;
evpp = &evs;
if (ev->type == EV_TIMEOUT) {
calctimeout = 1;
evpp = &tevs;
}
for (; (evp = *evpp); evpp = &evp->next)
if (ev->pri > evp->pri)
break;
ev->next = evp;
*evpp = ev;
ev->queued = 1;
}
void
evdeq(struct event *ev)
{
struct event *evp, **evpp;
debug3("Deq event fd %d type %d queued %d\n", ev -> fd, ev -> type, ev -> queued);
if (!ev->queued)
return;
evpp = &evs;
if (ev->type == EV_TIMEOUT) {
calctimeout = 1;
evpp = &tevs;
}
for (; (evp = *evpp); evpp = &evp->next)
if (evp == ev)
break;
ASSERT(evp);
*evpp = ev->next;
ev->queued = 0;
if (ev == nextev)
nextev = nextev->next;
}
static struct event *
calctimo()
{
struct event *ev, *min;
long mins;
if ((min = tevs) == 0)
return 0;
mins = min->timeout.tv_sec;
for (ev = tevs->next; ev; ev = ev->next) {
ASSERT(ev->type == EV_TIMEOUT);
if (mins < ev->timeout.tv_sec)
continue;
if (mins > ev->timeout.tv_sec || min->timeout.tv_usec > ev->timeout.tv_usec) {
min = ev;
mins = ev->timeout.tv_sec;
}
}
return min;
}
void
sched()
{
struct event *ev;
fd_set r, w, *set;
struct event *timeoutev = 0;
struct timeval timeout;
int nsel;
for (;;) {
if (calctimeout)
timeoutev = calctimo();
if (timeoutev) {
gettimeofday(&timeout, NULL);
/* tp - timeout */
timeout.tv_sec = timeoutev->timeout.tv_sec - timeout.tv_sec;
timeout.tv_usec = timeoutev->timeout.tv_usec - timeout.tv_usec;
if (timeout.tv_usec < 0) {
timeout.tv_usec += 1000000;
timeout.tv_sec--;
}
if (timeout.tv_sec < 0) {
timeout.tv_usec = 0;
timeout.tv_sec = 0;
}
}
#ifdef DEBUG
debug("waiting for events");
if (timeoutev)
debug2(" timeout %ld secs %ld usecs", (long)timeout.tv_sec, (long)timeout.tv_usec);
debug(":\n");
for (ev = evs; ev; ev = ev->next)
debug3(" - fd %d type %d pri %d\n", ev->fd, ev->type, ev->pri);
if (tevs)
debug("timed events:\n");
for (ev = tevs; ev; ev = ev->next)
debug3(" - pri %d sec %ld usec %ld\n", ev->pri,
(long)ev->timeout.tv_sec, (long)ev->timeout.tv_usec);
#endif
FD_ZERO(&r);
FD_ZERO(&w);
for (ev = evs; ev; ev = ev->next) {
if (ev->condpos && *ev->condpos <= (ev->condneg ? *ev->condneg : 0)) {
debug2(" - cond ev fd %d type %d failed\n", ev->fd, ev->type);
continue;
}
if (ev->type == EV_READ)
FD_SET(ev->fd, &r);
else if (ev->type == EV_WRITE)
FD_SET(ev->fd, &w);
}
#ifdef DEBUG
debug("readfds:");
for (nsel = 0; nsel < FD_SETSIZE; nsel++)
if (FD_ISSET(nsel, &r))
debug1(" %d", nsel);
debug("\n");
debug("writefds:");
for (nsel = 0; nsel < FD_SETSIZE; nsel++)
if (FD_ISSET(nsel, &w))
debug1(" %d", nsel);
debug("\n");
#endif
nsel = select(FD_SETSIZE, &r, &w, (fd_set *)0, timeoutev ? &timeout : (struct timeval *)0);
if (nsel < 0) {
if (errno != EINTR) {
#if defined(sgi) && defined(SVR4)
if (errno == EIO && sgihack())
continue;
#endif
#if defined(__osf__) || defined(M_UNIX)
/* OSF/1 3.x, SCO bug: EBADF */
/* OSF/1 4.x bug: EIO */
if ((errno == EIO || errno == EBADF) && sgihack())
continue;
#endif
Panic(errno, "select");
}
nsel = 0;
} else if (nsel == 0) { /* timeout */
debug("TIMEOUT!\n");
ASSERT(timeoutev);
evdeq(timeoutev);
timeoutev->handler(timeoutev, timeoutev->data);
}
#ifdef SELECT_BROKEN
/*
* Sequents select emulation counts a descriptor which is
* readable and writeable only as one hit. Waaaaa.
*/
if (nsel)
nsel = 2 * FD_SETSIZE;
#endif
for (ev = evs; ev; ev = nextev) {
nextev = ev->next;
if (ev->type != EV_ALWAYS) {
set = ev->type == EV_READ ? &r : &w;
if (nsel == 0 || !FD_ISSET(ev->fd, set))
continue;
nsel--;
}
if (ev->condpos &&
*ev->condpos <= (ev->condneg ? *ev->condneg : 0))
continue;
debug2(" + hit ev fd %d type %d!\n", ev->fd, ev->type);
ev->handler(ev, ev->data);
}
}
}
void
SetTimeout(struct event *ev, int timo)
{
ASSERT(ev->type == EV_TIMEOUT);
debug2("event %lx new timeout %d ms\n", (long)ev, timo);
gettimeofday(&ev->timeout, NULL);
ev->timeout.tv_sec += timo / 1000;
ev->timeout.tv_usec += (timo % 1000) * 1000;
if (ev->timeout.tv_usec > 1000000) {
ev->timeout.tv_usec -= 1000000;
ev->timeout.tv_sec++;
}
if (ev->queued)
calctimeout = 1;
}
#if (defined(sgi) && defined(SVR4)) || defined(__osf__) || defined(M_UNIX)
/* do we still need it?
@anaumov */
extern struct display *display, *displays;
static int
sgihack()
{
fd_set r, w;
struct timeval tv;
debug("IRIX5.2 workaround: searching for bad display\n");
for (display = displays; display;) {
FD_ZERO(&r);
FD_ZERO(&w);
FD_SET(D_userfd, &r);
FD_SET(D_userfd, &w);
tv.tv_sec = tv.tv_usec = 0;
if (select(FD_SETSIZE, &r, &w, (fd_set *)0, &tv) == -1) {
if (errno == EINTR)
continue;
Hangup(); /* goodbye display */
return 1;
}
display = display->d_next;
}
return 0;
}
#endif

48
sched.h Normal file
View file

@ -0,0 +1,48 @@
/* Copyright (c) 2008, 2009
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Micah Cowan (micah@cowan.name)
* Sadrul Habib Chowdhury (sadrul@users.sourceforge.net)
* Copyright (c) 1993-2002, 2003, 2005, 2006, 2007
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
*
* 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 3, 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 (see the file COPYING); if not, see
* https://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*
****************************************************************
* $Id$ GNU
*/
struct event
{
struct event *next;
void (*handler) __P((struct event *, char *));
char *data;
int fd;
int type;
int pri;
struct timeval timeout;
int queued; /* in evs queue */
int active; /* in fdset */
int *condpos; /* only active if condpos - condneg > 0 */
int *condneg;
};
#define EV_TIMEOUT 0
#define EV_READ 1
#define EV_WRITE 2
#define EV_ALWAYS 3

3447
screen.c Normal file

File diff suppressed because it is too large Load diff

316
screen.h Normal file
View file

@ -0,0 +1,316 @@
/* Copyright (c) 2008, 2009
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Micah Cowan (micah@cowan.name)
* Sadrul Habib Chowdhury (sadrul@users.sourceforge.net)
* Copyright (c) 1993-2002, 2003, 2005, 2006, 2007
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
*
* 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 3, 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 (see the file COPYING); if not, see
* https://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*
****************************************************************
* $Id$ GNU
*/
#include "os.h"
#if defined(__STDC__)
# ifndef __P
# define __P(a) a
# endif
#else
# ifndef __P
# define __P(a) ()
# endif
# define const
#endif
#include "osdef.h"
#include "ansi.h"
#include "sched.h"
#include "acls.h"
#include "comm.h"
#include "layer.h"
#include "term.h"
#ifdef DEBUG
# define STATIC /* a function that the debugger should see */
#else
# define STATIC static
#endif
#ifdef DEBUG
# define DEBUGDIR "/tmp/debug"
# define debugf(a) do {if(dfp){fprintf a;fflush(dfp);}} while (0)
# define debug(x) debugf((dfp,x))
# define debug1(x,a) debugf((dfp,x,a))
# define debug2(x,a,b) debugf((dfp,x,a,b))
# define debug3(x,a,b,c) debugf((dfp,x,a,b,c))
extern FILE *dfp;
#else
# define debugf(a) do {} while (0)
# define debug(x) debugf(x)
# define debug1(x,a) debugf(x)
# define debug2(x,a,b) debugf(x)
# define debug3(x,a,b,c) debugf(x)
#endif
#ifndef DEBUG
# define NOASSERT
#endif
#ifndef NOASSERT
# if defined(__STDC__)
# define ASSERT(lousy_cpp) do {if (!(lousy_cpp)) {if (!dfp) opendebug(0, 1);debug2("ASSERT("#lousy_cpp") failed file %s line %d\n", __FILE__, __LINE__);abort();}} while (0)
# else
# define ASSERT(lousy_cpp) do {if (!(lousy_cpp)) {if (!dfp) opendebug(0, 1);debug2("ASSERT(lousy_cpp) failed file %s line %d\n", __FILE__, __LINE__);abort();}} while (0)
# endif
#else
# define ASSERT(lousy_cpp) do {} while (0)
#endif
/* here comes my own Free: jw. */
#define Free(a) {if ((a) == 0) abort(); else free((void *)(a)); (a)=0;}
#define Ctrl(c) ((c)&037)
#define MAXSTR 768
#define MAXARGS 64
#define MSGWAIT 5
#define MSGMINWAIT 1
#define SILENCEWAIT 30
/*
* if a nasty user really wants to try a history of 3000 lines on all 10
* windows, he will allocate 8 MegaBytes of memory, which is quite enough.
*/
#define MAXHISTHEIGHT 3000
#define DEFAULTHISTHEIGHT 100
#if defined(NAME_MAX) && NAME_MAX < 16
# define DEFAULT_BUFFERFILE "/tmp/screen-xchg"
#else
# define DEFAULT_BUFFERFILE "/tmp/screen-exchange"
#endif
#if defined(hpux) && !(defined(VSUSP) && defined(VDSUSP) && defined(VWERASE) && defined(VLNEXT))
# define HPUX_LTCHARS_HACK
#endif
struct mode
{
#ifdef POSIX
struct termios tio;
# ifdef HPUX_LTCHARS_HACK
struct ltchars m_ltchars;
# endif /* HPUX_LTCHARS_HACK */
#else /* POSIX */
# ifdef TERMIO
struct termio tio;
# ifdef CYTERMIO
int m_mapkey;
int m_mapscreen;
int m_backspace;
# endif
# else /* TERMIO */
struct sgttyb m_ttyb;
struct tchars m_tchars;
struct ltchars m_ltchars;
int m_ldisc;
int m_lmode;
# endif /* TERMIO */
#endif /* POSIX */
#if defined(KANJI) && defined(TIOCKSET)
struct jtchars m_jtchars;
int m_knjmode;
#endif
};
/* #include "logfile.h" */ /* (requires stat.h) struct logfile */
#include "image.h"
#include "canvas.h"
#include "display.h"
#include "window.h"
/*
* Parameters for the Detach() routine
*/
#define D_DETACH 0
#define D_STOP 1
#define D_REMOTE 2
#define D_POWER 3
#define D_REMOTE_POWER 4
#define D_LOCK 5
#define D_HANGUP 6
/*
* Here are the messages the attacher sends to the backend
*/
#define MSG_CREATE 0
#define MSG_ERROR 1
#define MSG_ATTACH 2
#define MSG_CONT 3
#define MSG_DETACH 4
#define MSG_POW_DETACH 5
#define MSG_WINCH 6
#define MSG_HANGUP 7
#define MSG_COMMAND 8
#define MSG_QUERY 9
/*
* versions of struct msg:
* 0: screen version 3.6.6 (version count introduced)
* 1: screen version 4.1.0devel (revisions e3fc19a upto 8147d08)
* A few revisions after 8147d08 incorrectly
* carried version 1, but should have carried 2.
* 2: screen version 4.1.0devel (revisions 8b46d8a upto YYYYYYY)
* 3: screen version 4.2.0 (was incorrectly originally. Patched here)
* 4: screen version 4.2.1 (bumped once again due to changed terminal and login length)
* 5: screen version 4.4.0 (fix screenterm size)
*/
#define MSG_VERSION 5
#define MSG_REVISION (('m'<<24) | ('s'<<16) | ('g'<<8) | MSG_VERSION)
struct msg
{
int protocol_revision; /* reduce harm done by incompatible messages */
int type;
char m_tty[MAXPATHLEN]; /* ttyname */
union
{
struct
{
int lflag;
int aflag;
int flowflag;
int hheight; /* size of scrollback buffer */
int nargs;
char line[MAXPATHLEN];
char dir[MAXPATHLEN];
char screenterm[MAXTERMLEN + 1]; /* is screen really "screen" ? */
}
create;
struct
{
char auser[MAXLOGINLEN + 1]; /* username */
int apid; /* pid of frontend */
int adaptflag; /* adapt window size? */
int lines, columns; /* display size */
char preselect[20];
int esc; /* his new escape character unless -1 */
int meta_esc; /* his new meta esc character unless -1 */
char envterm[MAXTERMLEN + 1]; /* terminal type */
int encoding; /* encoding of display */
int detachfirst; /* whether to detach remote sessions first */
}
attach;
struct
{
char duser[MAXLOGINLEN + 1]; /* username */
int dpid; /* pid of frontend */
}
detach;
struct
{
char auser[MAXLOGINLEN + 1]; /* username */
int nargs;
char cmd[MAXPATHLEN]; /* command */
int apid; /* pid of frontend */
char preselect[20];
char writeback[MAXPATHLEN]; /* The socket to write the result.
Only used for MSG_QUERY */
}
command;
char message[MAXPATHLEN * 2];
} m;
};
/*
* And the signals the attacher receives from the backend
*/
#define SIG_BYE SIGHUP
#define SIG_POWER_BYE SIGUSR1
#define SIG_LOCK SIGUSR2
#define SIG_STOP SIGTSTP
#ifdef SIGIO
#define SIG_NODEBUG SIGIO /* triggerd by command 'debug off' */
#endif
#define BELL (Ctrl('g'))
#define VBELLWAIT 1 /* No. of seconds a vbell will be displayed */
#define BELL_ON 0 /* No bell has occurred in the window */
#define BELL_FOUND 1 /* A bell has occurred, but user not yet notified */
#define BELL_DONE 2 /* A bell has occured, user has been notified */
#define BELL_VISUAL 3 /* A bell has occured in fore win, notify him visually */
#define MON_OFF 0 /* Monitoring is off in the window */
#define MON_ON 1 /* No activity has occurred in the window */
#define MON_FOUND 2 /* Activity has occured, but user not yet notified */
#define MON_DONE 3 /* Activity has occured, user has been notified */
#define DUMP_TERMCAP 0 /* WriteFile() options */
#define DUMP_HARDCOPY 1
#define DUMP_EXCHANGE 2
#define DUMP_SCROLLBACK 3
#define SILENCE_OFF 0 /* Not checking for silence */
#define SILENCE_ON 1 /* Window being monitored for silence */
#define SILENCE_FOUND 2 /* Window is silent */
#define SILENCE_DONE 3 /* Window is silent and user is notified */
extern char strnomem[];
/*
* line modes used by Input()
*/
#define INP_COOKED 0
#define INP_NOECHO 1
#define INP_RAW 2
#define INP_EVERY 4
#ifdef MULTIUSER
struct acl
{
struct acl *next;
char *name;
};
#endif
/* register list */
#define MAX_PLOP_DEFS 256
struct baud_values
{
int idx; /* the index in the bsd-is padding lookup table */
int bps; /* bits per seconds */
int sym; /* symbol defined in ttydev.h */
};
/*
* windowlist orders
*/
#define WLIST_NUM 0
#define WLIST_MRU 1
#define WLIST_NESTED 2

383
search.c Normal file
View file

@ -0,0 +1,383 @@
/* Copyright (c) 2008, 2009
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Micah Cowan (micah@cowan.name)
* Sadrul Habib Chowdhury (sadrul@users.sourceforge.net)
* Copyright (c) 1993-2002, 2003, 2005, 2006, 2007
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
*
* 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 3, 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 (see the file COPYING); if not, see
* https://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*
****************************************************************
*/
#include <sys/types.h>
#include "config.h"
#include "screen.h"
#include "mark.h"
#include "extern.h"
#define INPUTLINE (flayer->l_height - 1)
extern struct layer *flayer;
extern struct win *fore;
#ifdef COPY_PASTE
int search_ic;
/********************************************************************
* VI style Search
*/
static int matchword __P((char*, int, int, int));
static void searchend __P((char*, int, char *));
static void backsearchend __P((char*, int, char *));
void
Search(int dir)
{
struct markdata *markdata;
if (dir == 0) {
markdata = (struct markdata *)flayer->l_data;
if (markdata->isdir > 0)
searchend(0, 0, NULL);
else if (markdata->isdir < 0)
backsearchend(0, 0, NULL);
else
LMsg(0, "No previous pattern");
} else
Input((dir > 0 ? "/" : "?"), sizeof(markdata->isstr) - 1,
INP_COOKED, (dir > 0 ? searchend : backsearchend), NULL, 0);
}
static void
searchend(char *buf, int len, char *data)
{
int x = 0, sx, ex, y;
struct markdata *markdata;
struct win *p;
markdata = (struct markdata *)flayer->l_data;
p = markdata->md_window;
markdata->isdir = 1;
if (len)
strcpy(markdata->isstr, buf);
sx = markdata->cx + 1;
ex = flayer->l_width - 1;
for (y = markdata->cy; y < p->w_histheight + flayer->l_height;
y++, sx = 0) {
if ((x = matchword(markdata->isstr, y, sx, ex)) >= 0)
break;
}
if (y >= p->w_histheight + flayer->l_height) {
LGotoPos(flayer, markdata->cx, W2D(markdata->cy));
LMsg(0, "Pattern not found");
} else
revto(x, y);
}
static void
backsearchend(char *buf, int len, char *data)
{
int sx, ex, x = -1, y;
struct markdata *markdata;
markdata = (struct markdata *)flayer->l_data;
markdata->isdir = -1;
if (len)
strcpy(markdata->isstr, buf);
ex = markdata->cx - 1;
for (y = markdata->cy; y >= 0; y--, ex = flayer->l_width - 1) {
sx = 0;
while ((sx = matchword(markdata->isstr, y, sx, ex)) >= 0)
x = sx++;
if (x >= 0)
break;
}
if (y < 0) {
LGotoPos(flayer, markdata->cx, W2D(markdata->cy));
LMsg(0, "Pattern not found");
} else
revto(x, y);
}
/*
* Search for a string that matches pattern. The first character of the
* match must be on line y, between columns sx and ex (inclusive), but
* the rest of the match can extend beyond column ex and even onto the
* following line. Returns the starting column of the first match found,
* or -1 if there's no match.
*/
static int
matchword(char *pattern, int y, int sx, int ex)
{
unsigned char *cp, *pp, *cpe;
int cy;
fore = ((struct markdata *)flayer->l_data)->md_window;
for (; sx <= ex; sx++) {
cy = y;
cp = WIN(cy)->image + sx;
cpe = WIN(cy)->image + flayer->l_width;
pp = (unsigned char *)pattern;
for (;;) {
if (*cp != *pp)
if (!search_ic || ((*cp ^ *pp) & 0xdf) ||
(*cp | 0x20) < 'a' || (*cp | 0x20) > 'z')
break;
cp++;
pp++;
if (*pp == 0)
return sx;
if (cp == cpe) {
/*
* We have a partial match, but we've hit
* the end of this line. Does it wrap onto
* the following line? If not, we're done.
*/
if (*cp == ' ' ||
cy >=
fore->w_histheight + flayer->l_height - 1)
break;
/*
* This line does wrap, so look on the next
* line for the rest of our match.
*/
cy++;
cp = WIN(cy)->image;
cpe = WIN(cy)->image + flayer->l_width;
}
}
}
return -1;
}
/********************************************************************
* Emacs style ISearch
*/
static char *isprompts[] = {
"I-search backward: ", "failing I-search backward: ",
"I-search: ", "failing I-search: "
};
static int is_redo __P((struct markdata*));
static void is_process __P((char*, int, char *));
static int is_bm __P((char*, int, int, int, int));
static int
is_bm(char *str, int l, int p, int end, int dir)
{
int tab[256];
int i, q;
unsigned char *s, c;
int w = flayer->l_width;
/* *sigh* to make WIN work */
fore = ((struct markdata *)flayer->l_next->l_data)->md_window;
debug2("is_bm: searching for %s len %d\n", str, l);
debug3("start at %d end %d dir %d\n", p, end, dir);
if (p < 0 || p + l > end)
return -1;
if (l == 0)
return p;
if (dir < 0)
str += l - 1;
for (i = 0; i < 256; i++)
tab[i] = l * dir;
for (i = 0; i < l - 1; i++, str += dir) {
q = *(unsigned char *)str;
tab[q] = (l - 1 - i) * dir;
if (search_ic && (q | 0x20) >= 'a' && ((q | 0x20) <= 'z'))
tab[q ^ 0x20] = (l - 1 - i) * dir;
}
if (dir > 0)
p += l - 1;
debug1("first char to match: %c\n", *str);
while (p >= 0 && p < end) {
q = p;
s = (unsigned char *)str;
for (i = 0;;) {
c = (WIN(q / w))->image[q % w];
if (i == 0)
p += tab[(int)(unsigned char)c];
if (c != *s)
if (!search_ic || ((c ^ *s) & 0xdf) ||
(c | 0x20) < 'a' || (c | 0x20) > 'z')
break;
q -= dir;
s -= dir;
if (++i == l)
return q + (dir > 0 ? 1 : -l);
}
}
return -1;
}
/*ARGSUSED*/
static void
is_process(char *p, int n, char *data) /* i-search */
{
int pos, x, y, dir;
struct markdata *markdata;
if (n == 0)
return;
ASSERT(p);
markdata = (struct markdata *)flayer->l_next->l_data;
pos = markdata->cx + markdata->cy * flayer->l_width;
LGotoPos(flayer, markdata->cx, W2D(markdata->cy));
switch (*p) {
case '\007': /* CTRL-G */
pos = markdata->isstartpos;
/*FALLTHROUGH*/
case '\033': /* ESC */
*p = 0;
break;
case '\013': /* CTRL-K */
case '\027': /* CTRL-W */
markdata->isistrl = 1;
/*FALLTHROUGH*/
case '\b':
case '\177':
if (markdata->isistrl == 0)
return;
markdata->isistrl--;
pos = is_redo(markdata);
*p = '\b';
break;
case '\023': /* CTRL-S */
case '\022': /* CTRL-R */
if (markdata->isistrl >= (int)sizeof(markdata->isistr))
return;
dir = (*p == '\023') ? 1 : -1;
pos += dir;
if (markdata->isdir == dir && markdata->isistrl == 0) {
strcpy(markdata->isistr, markdata->isstr);
markdata->isistrl = markdata->isstrl = strlen(markdata->isstr);
break;
}
markdata->isdir = dir;
markdata->isistr[markdata->isistrl++] = *p;
break;
default:
if (*p < ' ' ||
markdata->isistrl >=
(int)sizeof(markdata->isistr) ||
markdata->isstrl >= (int)sizeof(markdata->isstr) - 1)
return;
markdata->isstr[markdata->isstrl++] = *p;
markdata->isistr[markdata->isistrl++] = *p;
markdata->isstr[markdata->isstrl] = 0;
debug2("New char: %c - left %d\n", *p,
(int)sizeof(markdata->isistr) - markdata->isistrl);
}
if (*p && *p != '\b')
pos = is_bm(markdata->isstr, markdata->isstrl, pos,
flayer->l_width *
(markdata->md_window->w_histheight + flayer->l_height),
markdata->isdir);
if (pos >= 0) {
x = pos % flayer->l_width;
y = pos / flayer->l_width;
LAY_CALL_UP(LayRedisplayLine(INPUTLINE, 0, flayer -> l_width - 1,
0) ; revto(x, y) ; if(W2D(markdata -> cy) == INPUTLINE) revto_line(markdata
-> cx, markdata -> cy, INPUTLINE > 0 ? INPUTLINE - 1 : 1) ;);
}
if (*p)
inp_setprompt(isprompts[markdata->isdir + (pos < 0) + 1],
markdata->isstrl ? markdata->isstr : "");
flayer->l_x = markdata->cx;
flayer->l_y = W2D(markdata->cy);
LGotoPos(flayer, flayer->l_x, flayer->l_y);
if (!*p) {
/* we are about to finish, keep cursor position */
flayer->l_next->l_x = markdata->cx;
flayer->l_next->l_y = W2D(markdata->cy);
}
}
static int
is_redo(struct markdata *markdata)
{
int i, pos, npos, dir;
char c;
npos = pos = markdata->isstartpos;
dir = markdata->isstartdir;
markdata->isstrl = 0;
for (i = 0; i < markdata->isistrl; i++) {
c = markdata->isistr[i];
if (c == '\022') /* ^R */
pos += (dir = -1);
else if (c == '\023') /* ^S */
pos += (dir = 1);
else
markdata->isstr[markdata->isstrl++] = c;
if (pos >= 0) {
npos = is_bm(markdata->isstr, markdata->isstrl, pos,
flayer->l_width *
(markdata->md_window->w_histheight +
flayer->l_height), dir);
if (npos >= 0)
pos = npos;
}
}
markdata->isstr[markdata->isstrl] = 0;
markdata->isdir = dir;
return npos;
}
void
ISearch(int dir)
{
struct markdata *markdata;
markdata = (struct markdata *)flayer->l_data;
markdata->isdir = markdata->isstartdir = dir;
markdata->isstartpos = markdata->cx + markdata->cy * flayer->l_width;
markdata->isistrl = markdata->isstrl = 0;
if (W2D(markdata->cy) == INPUTLINE)
revto_line(markdata->cx, markdata->cy,
INPUTLINE > 0 ? INPUTLINE - 1 : 1);
Input(isprompts[dir + 1], sizeof(markdata->isstr) - 1, INP_RAW,
is_process, NULL, 0);
LGotoPos(flayer, markdata->cx, W2D(markdata->cy));
flayer->l_x = markdata->cx;
flayer->l_y = W2D(markdata->cy);
}
#endif /* COPY_PASTE */

1944
socket.c Normal file

File diff suppressed because it is too large Load diff

Some files were not shown because too many files have changed in this diff Show more